Skip to content

Commit

Permalink
test: compute hash in auto-stake-it example
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Aug 28, 2024
1 parent 25b46fe commit 80a9cdd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
11 changes: 4 additions & 7 deletions packages/orchestration/src/examples/auto-stake-it.flows.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Fail } from '@endo/errors';
import { denomHash } from '../utils/denomHash.js';

/**
* @import {ResolvedPublicTopic} from '@agoric/zoe/src/contractSupport/topics.js';
Expand All @@ -21,19 +22,13 @@ import { Fail } from '@endo/errors';
* @param {{
* chainName: string;
* validator: CosmosValidatorAddress;
* localDenom: Denom;
* }} offerArgs
*/
export const makeAccounts = async (
orch,
{ makeStakingTap, makePortfolioHolder, chainHub },
seat,
{
chainName,
validator,
// TODO localDenom is user supplied, until #9211
localDenom,
},
{ chainName, validator },
) => {
seat.exit(); // no funds exchanged
const [agoric, remoteChain] = await Promise.all([
Expand Down Expand Up @@ -65,6 +60,8 @@ export const makeAccounts = async (
);
assert(transferChannel.counterPartyChannelId, 'unable to find sourceChannel');

const localDenom = `ibc/${denomHash({ denom: remoteDenom, channelId: transferChannel.counterPartyChannelId })}`;

// Every time the `localAccount` receives `remoteDenom` over IBC, delegate it.
const tap = makeStakingTap({
localAccount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ test('auto-stake-it - make accounts, register tap, return invitationMakers', asy
value: 'cosmosvaloper1test',
encoding: 'bech32',
},
// TODO user supplied until #9211
localDenom: 'ibc/fakeuatomhash',
});
const result = await heapVowE(userSeat).getOfferResult();

Expand Down Expand Up @@ -114,7 +112,9 @@ test('auto-stake-it - make accounts, register tap, return invitationMakers', asy
receiver: 'cosmos1test',
sender: execAddr,
sourceChannel: 'channel-5',
token: { amount: '10', denom: 'ibc/fakeuatomhash' },
token: {
amount: '10',
},
},
'tokens transferred from LOA to COA',
);
Expand All @@ -139,8 +139,6 @@ test('auto-stake-it - make accounts, register tap, return invitationMakers', asy
value: 'cosmosvaloper1test',
encoding: 'bech32',
},
// TODO user supplied until #9211
localDenom: 'ibc/fakeuatomhash',
});
const { publicSubscribers: pubSubs2 } =
await heapVowE(userSeat2).getOfferResult();
Expand Down

0 comments on commit 80a9cdd

Please sign in to comment.