@@ -15,6 +15,8 @@ import { startOrcaContract } from '../src/orca.proposal.js';
1515import { makeMockTools } from './boot-tools.js' ;
1616import { getBundleId } from '../tools/bundle-tools.js' ;
1717import { startOrchCoreEval } from '../tools/startOrch.js' ;
18+ import { makeHeapZone } from '@agoric/zone' ;
19+ import { prepareSwingsetVowTools } from '@agoric/vow/vat.js' ;
1820
1921/** @typedef {typeof import('../src/orca.contract.js').start } OrcaContractFn */
2022
@@ -42,6 +44,9 @@ const makeTestContext = async t => {
4244 const bundle = await bundleCache . load ( contractPath , 'orca' ) ;
4345 const tools = await makeMockTools ( t , bundleCache ) ;
4446
47+ const rootZone = makeHeapZone ( ) ;
48+ const vowTools = prepareSwingsetVowTools ( rootZone . subZone ( 'vows' ) ) ;
49+
4550 const makeDummyStorageNode = ( nodeName = 'rootNode' ) => {
4651 return Far ( 'DummyStorageNode' , {
4752 makeChildNode : async childName => {
@@ -135,6 +140,30 @@ const makeTestContext = async t => {
135140 client_id : 'client-0' ,
136141 connectionDetails : `${ name } connection details` ,
137142 } ) ;
143+ } else if ( key === 'vbankAsset' ) {
144+ return harden ( {
145+ blockHeight : '1' ,
146+ values : ( ) => [
147+ {
148+ body : [
149+ [
150+ 'ubld' ,
151+ {
152+ brand : '$0.Alleged: BLD brand' ,
153+ denom : 'ubld' ,
154+ displayInfo : {
155+ assetKind : 'nat' ,
156+ decimalPlaces : 6 ,
157+ } ,
158+ issuer : '$1.Alleged: BLD issuer' ,
159+ issuerName : 'BLD' ,
160+ proposedName : 'Agoric token' ,
161+ } ,
162+ ] ,
163+ ] ,
164+ } ,
165+ ] ,
166+ } ) ;
138167 }
139168 throw Error ( `Chain or connection not found: ${ name } ` ) ;
140169 } ,
@@ -172,7 +201,7 @@ const makeTestContext = async t => {
172201 harden ( {
173202 chainId : state . chainId ,
174203 value : `${ state . name } AccountAddress` ,
175- encoding : 'bech32' , // or 'ethereum', based on your requirements
204+ encoding : 'bech32' ,
176205 } ) ,
177206 getBalance : ( ) => `1000${ state . denom } ` ,
178207 } ) ,
@@ -201,6 +230,55 @@ const makeTestContext = async t => {
201230 } ,
202231 } ) ;
203232
233+ const localchain = Far ( 'DummyLocalchain' , {
234+ getChainHub : async ( ) => {
235+ const chainHub = {
236+ registerChain : async ( name , details ) => {
237+ console . log ( `chain registered: ${ name } ` , details ) ;
238+ } ,
239+ getChain : async ( ) => {
240+ const state = harden ( {
241+ name : 'agoric' ,
242+ chainId : `agoriclocal` ,
243+ denom : 'agoric' ,
244+ expectedAddressPrefix : 'agoric' ,
245+ details : `agoric chain details` ,
246+ stakingTokens : [ { denom : 'agoric' } ] ,
247+ } ) ;
248+
249+ return harden ( {
250+ ...state ,
251+ makeAccount : ( ) =>
252+ Far ( 'Account' , {
253+ getChainId : ( ) => state . chainId ,
254+ getAccountAddress : ( ) => `${ state . name } AccountAddress` ,
255+ getAddress : ( ) => `${ state . name } AccountAddress` ,
256+ getBalance : ( ) => `1000${ state . denom } ` ,
257+ monitorTransfers : ( ) => `` ,
258+ } ) ,
259+ getChainInfo : ( ) =>
260+ Far ( 'ChainInfo' , {
261+ getChainId : ( ) => state . chainId ,
262+ getDenom : ( ) => state . denom ,
263+ getExpectedAddressPrefix : ( ) => state . expectedAddressPrefix ,
264+ } ) ,
265+ } ) ;
266+ } ,
267+ } ;
268+ return chainHub ;
269+ } ,
270+ makeAccount : async name => {
271+ const chainHub = await E ( localchain ) . getChainHub ( ) ;
272+ const chain = await E ( chainHub ) . getChain ( name ) ;
273+ return E ( chain ) . makeAccount ( ) ;
274+ } ,
275+ getChainInfo : async name => {
276+ const chainHub = await E ( localchain ) . getChainHub ( ) ;
277+ const chain = await E ( chainHub ) . getChain ( name ) ;
278+ return E ( chain ) . getChainInfo ( ) ;
279+ } ,
280+ } ) ;
281+
204282 return {
205283 zoe,
206284 bundle,
@@ -210,6 +288,8 @@ const makeTestContext = async t => {
210288 agoricNames,
211289 storageNode : makeDummyStorageNode ( ) ,
212290 marshaller : makeDummyMarshaller ( ) ,
291+ vowTools,
292+ localchain,
213293 ...tools ,
214294 } ;
215295} ;
@@ -384,6 +464,7 @@ const orchestrationAccountScenario = test.macro({
384464 agoricNames,
385465 storageNode,
386466 marshaller,
467+ vowTools : vt ,
387468 } = t . context ;
388469 t . log ( 'installing the contract...' ) ;
389470 const installation = E ( zoe ) . install ( bundle ) ;
@@ -429,12 +510,13 @@ const orchestrationAccountScenario = test.macro({
429510 initialInvitation ,
430511 makeAccountOffer ,
431512 undefined ,
432- { id : offerId } ,
513+ { id : offerId , chainName : 'osmosis' } ,
433514 ) ;
434515 t . log ( 'initial user seat:' , initialUserSeat ) ;
435516
436517 t . log ( 'getting offer result...' ) ;
437- const offerResult = await E ( initialUserSeat ) . getOfferResult ( ) ;
518+ const offerResult = await vt . when ( E ( initialUserSeat ) . getOfferResult ( ) ) ;
519+
438520 t . log ( 'offer result:' , offerResult ) ;
439521 t . truthy ( offerResult , 'Offer result should exist' ) ;
440522
@@ -496,6 +578,8 @@ const orchestrationAccountAndFundScenario = test.macro({
496578 agoricNames,
497579 storageNode,
498580 marshaller,
581+ vowTools : vt ,
582+ localchain,
499583 } = t . context ;
500584 t . log ( 'installing the contract...' ) ;
501585 const installation = E ( zoe ) . install ( bundle ) ;
@@ -507,7 +591,8 @@ const orchestrationAccountAndFundScenario = test.macro({
507591 marshaller,
508592 timer : Far ( 'DummyTimer' ) ,
509593 timerService : Far ( 'DummyTimer' ) ,
510- localchain : Far ( 'DummyLocalchain' ) ,
594+ // localchain: Far('DummyLocalchain'),
595+ localchain,
511596 agoricNames,
512597 } ) ;
513598
@@ -559,12 +644,14 @@ const orchestrationAccountAndFundScenario = test.macro({
559644 } ,
560645 {
561646 id : offerId ,
647+ chainName : 'osmosis' ,
562648 } ,
563649 ) ;
564650 t . log ( 'initial user seat:' , initialUserSeat ) ;
565651
566652 t . log ( 'getting offer result...' ) ;
567- const offerResult = await E ( initialUserSeat ) . getOfferResult ( ) ;
653+ const offerResult = await vt . when ( E ( initialUserSeat ) . getOfferResult ( ) ) ;
654+
568655 t . log ( 'offer result:' , offerResult ) ;
569656 t . truthy ( offerResult , 'Offer result should exist' ) ;
570657
0 commit comments