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(localOrchAccount): Deposit, Withdraw invitationMakers #10117

Merged
merged 2 commits into from
Sep 20, 2024

Conversation

0xpatrickdev
Copy link
Member

@0xpatrickdev 0xpatrickdev commented Sep 19, 2024

refs: #9193

Description

Adds Deposit and Withdraw invitationMakers to LocalOrchestrationAccount, leveraging ZoeTools.localTransfer and ZoeTools.withdrawToSeat

Security Considerations

Involves withdrawing payments to a temporary seat, which can be risky. Leverages ZoeTools which rolls back allocations in failure and partial failure scenarios.

Scaling Considerations

n/a

Documentation Considerations

I'm not sure how well we document the platform-provided invitationMakers and .asContinuingOffer() helper. We might consider doing so in the future.

Testing Considerations

Includes new unit tests. Wallet Driver tests in an e2e environment are coming in a future PR after #9966 lands

Upgrade Considerations

n/a, library code

@0xpatrickdev 0xpatrickdev force-pushed the pc/send-anywhere-fixups branch 3 times, most recently from 99f89dc to ea73ef7 Compare September 19, 2024 21:46
@0xpatrickdev 0xpatrickdev force-pushed the 9193-deposit-withdraw-invitation-makers branch from 08488af to 81943fd Compare September 19, 2024 22:01
Copy link

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

Deploying agoric-sdk with  Cloudflare Pages  Cloudflare Pages

Latest commit: c92ef27
Status: ✅  Deploy successful!
Preview URL: https://2dd11342.agoric-sdk.pages.dev
Branch Preview URL: https://9193-deposit-withdraw-invita.agoric-sdk.pages.dev

View logs

Comment on lines +227 to +241
return watch(
zoeTools.localTransfer(
seat,
// @ts-expect-error LocalAccount vs LocalAccountMethods
this.state.account,
give,
),
this.facets.seatExiterHandler,
seat,
);
},
'Deposit',
undefined,
M.splitRecord({ give: AnyNatAmountsRecord, want: {} }),
);
Copy link
Member Author

Choose a reason for hiding this comment

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

Given zoeTools.localTransfer is expected to resolve promptly, we technically do not need to use watch here and instead could use asVow.

This approach seems harmless, and appeases the linter. It also allows a developer to call Deposit() inside an async-flow if they wished.

@0xpatrickdev 0xpatrickdev force-pushed the 9193-deposit-withdraw-invitation-makers branch from 81943fd to b2932ee Compare September 19, 2024 22:07
Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

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

LGTM. Tests cover happy and error cases. Looking forward to E2E. (noting this PR doesn't close the issue)

@@ -180,3 +180,13 @@ export const TxBodyOptsShape = M.splitRecord(
nonCriticalExtensionOptions: M.arrayOf(M.any()),
},
);

/**
* Ensures at least one {@link AmountKeywordRecord} entry is present and only
Copy link
Member

Choose a reason for hiding this comment

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

clever

Copy link
Member Author

Choose a reason for hiding this comment

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

h/t SingleNatAmountRecord fka SingleAmountRecord from send-anywhere

Base automatically changed from pc/send-anywhere-fixups to master September 19, 2024 23:05
Copy link

Base branch is changed to master. Please re-run the integration tests by adding 'force:integration' label.

@0xpatrickdev 0xpatrickdev added the automerge:rebase Automatically rebase updates, then merge label Sep 19, 2024
@0xpatrickdev 0xpatrickdev force-pushed the 9193-deposit-withdraw-invitation-makers branch from b2932ee to c92ef27 Compare September 19, 2024 23:40
@mergify mergify bot merged commit c04c91c into master Sep 20, 2024
80 checks passed
@mergify mergify bot deleted the 9193-deposit-withdraw-invitation-makers branch September 20, 2024 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:rebase Automatically rebase updates, then merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants