-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs: #9281 ## Description AsyncFlow requires that everything passing the membrane is durable. This makes the facade objects durable to conform. Following #9529 ### Security Considerations none ### Scaling Considerations Exo for each chain and each account ### Documentation Considerations none ### Testing Considerations Existing coverage ### Upgrade Considerations not yet deployed
- Loading branch information
Showing
25 changed files
with
250 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** @file ChainAccount exo */ | ||
import { V } from '@agoric/vow/vat.js'; | ||
|
||
import { ChainFacadeI } from '../typeGuards.js'; | ||
|
||
/** | ||
* @import {Zone} from '@agoric/base-zone'; | ||
* @import {TimerService} from '@agoric/time'; | ||
* @import {Remote} from '@agoric/internal'; | ||
* @import {LocalChain} from '@agoric/vats/src/localchain.js'; | ||
* @import {OrchestrationService} from '../service.js'; | ||
* @import {MakeLocalOrchestrationAccountKit} from './local-orchestration-account.js'; | ||
* @import {ChainInfo, CosmosChainInfo, IBCConnectionInfo, OrchestrationAccount} from '../types.js'; | ||
*/ | ||
|
||
/** | ||
* @param {Zone} zone | ||
* @param {{ | ||
* makeLocalOrchestrationAccountKit: MakeLocalOrchestrationAccountKit; | ||
* orchestration: Remote<OrchestrationService>; | ||
* storageNode: Remote<StorageNode>; | ||
* timer: Remote<TimerService>; | ||
* localchain: Remote<LocalChain>; | ||
* }} powers | ||
*/ | ||
export const prepareLocalChainFacade = ( | ||
zone, | ||
{ makeLocalOrchestrationAccountKit, localchain, storageNode }, | ||
) => | ||
zone.exoClass( | ||
'LocalChainFacade', | ||
ChainFacadeI, | ||
/** | ||
* @param {CosmosChainInfo} localChainInfo | ||
*/ | ||
localChainInfo => { | ||
return { localChainInfo }; | ||
}, | ||
{ | ||
async getChainInfo() { | ||
return this.state.localChainInfo; | ||
}, | ||
|
||
// FIXME parameterize on the remoteChainInfo to make() | ||
// That used to work but got lost in the migration to Exo | ||
/** @returns {Promise<OrchestrationAccount<ChainInfo>>} */ | ||
async makeAccount() { | ||
const { localChainInfo } = this.state; | ||
const lcaP = V(localchain).makeAccount(); | ||
const [lca, address] = await Promise.all([lcaP, V(lcaP).getAddress()]); | ||
const { holder: account } = makeLocalOrchestrationAccountKit({ | ||
account: lca, | ||
address: harden({ | ||
address, | ||
chainId: localChainInfo.chainId, | ||
addressEncoding: 'bech32', | ||
}), | ||
// FIXME storage path | ||
storageNode, | ||
}); | ||
|
||
return account; | ||
}, | ||
}, | ||
); | ||
harden(prepareLocalChainFacade); | ||
/** @typedef {ReturnType<typeof prepareLocalChainFacade>} MakeLocalChainFacade */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.