Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use orchFns.autoStake as target for receiveUpcall #10065

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

0xpatrickdev
Copy link
Member

@0xpatrickdev 0xpatrickdev commented Sep 11, 2024

closes: #10047

Description

Rework auto-stake-it.contract.js to use an orchestrated async-flow as the handler for .monitorTransfers() (vtransfer). Previously, it was written using vows and watchers.

To Do

  • get rid of ts-expect-error 's introduced

Security Considerations

n/a

Scaling Considerations

n/a

Documentation Considerations

Better example code for prospective developers.

Testing Considerations

Existing tests should pass.

Upgrade Considerations

n/a, example code

- uses an async-flow function as the handler for a `.monitorTransfers()` tap
- allows guest develoeprs to write handlers as flows instead of with vows and watchers
Copy link

cloudflare-workers-and-pages bot commented Sep 11, 2024

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5b8b568
Status: ✅  Deploy successful!
Preview URL: https://72c52e85.agoric-sdk.pages.dev
Branch Preview URL: https://10047-monitor-transfers-flow.agoric-sdk.pages.dev

View logs

@0xpatrickdev 0xpatrickdev added the force:integration Force integration tests to run on PR label Sep 11, 2024
trace('receiveUpcall', event);
const { localAccount, stakingAccount, config } = this.state;
// eslint-disable-next-line no-use-before-define -- defined by orchestrateAll, necessarily after this
orchFns.autoStake(localAccount, stakingAccount, config, event);
Copy link
Member Author

@0xpatrickdev 0xpatrickdev Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to do orchFns.autoStake(this.state, event) here, and call it ~(continuingOfferCtx, event) on the other end, but was greeted with Error: cannot serialize Remotables with accessors like "localAccount"

Comment on lines +29 to +30
* stakingAccount: GuestInterface<CosmosOrchestrationAccount>;
* localAccount: GuestInterface<LocalOrchestrationAccount>;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we use OrchestrationAccount<any>, which the flow is expecting, we see Argument of type '<OrchestrationAccount<any>>' is not assignable to parameter of type 'Passable'. on L105.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
force:integration Force integration tests to run on PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Orchestration: use orchestrated flow as handler for monitorTransfer tap
1 participant