Skip to content

Commit

Permalink
chore: contractState.account type alignment (#9580)
Browse files Browse the repository at this point in the history
refs: #9566

## Description

address a type error from #9566:

```
Error: src/examples/sendAnywhere.contract.js(112,9): error TS2741: Property 'account' is missing in type '{}' but required in type '{ account: OrchestrationAccount<any> | undefined; }'.
```
  • Loading branch information
mergify[bot] authored Jul 3, 2024
2 parents 940d3f0 + e12036c commit a9680dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions packages/async-flow/src/endowments.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ export const forwardingMethods = rem => {
* gets and sets, but is implemented using accessors, so it will be recognized
* as a state record.
*
* @param {object} dataRecord
* @returns {object}
* @template { string | number | symbol } K
* @template {Record<K, any>} R
* @param {R} dataRecord
* @returns {R}
*/
export const makeStateRecord = dataRecord =>
harden(
Expand Down
6 changes: 3 additions & 3 deletions packages/orchestration/src/examples/sendAnywhere.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const { entries } = Object;
* @param {object} ctx
* @param {ZCF} ctx.zcf
* @param {any} ctx.agoricNamesTools TODO Give this a better type
* @param {{ account: OrchestrationAccount<any> }} ctx.contractState
* @param {{ account: OrchestrationAccount<any> | undefined }} ctx.contractState
* @param {ZCFSeat} seat
* @param {object} offerArgs
* @param {string} offerArgs.chainName
Expand Down Expand Up @@ -68,8 +68,8 @@ const sendItFn = async (
const { chainId } = info;
assert(typeof chainId === 'string', 'bad chainId');
const { [kw]: pmtP } = await withdrawFromSeat(zcf, seat, give);
await E.when(pmtP, pmt => contractState.account.deposit(pmt));
await contractState.account.transfer(
await E.when(pmtP, pmt => contractState.account?.deposit(pmt));
await contractState.account?.transfer(
{ denom, value: amt.value },
{
address: destAddr,
Expand Down

0 comments on commit a9680dd

Please sign in to comment.