-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61bb791
commit 42b2e7e
Showing
7 changed files
with
160 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { makeHelpers } from '@agoric/deploy-script-support'; | ||
|
||
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').ProposalBuilder} */ | ||
export const defaultProposalBuilder = async _powers => | ||
harden({ | ||
sourceSpec: '@agoric/vats/src/proposals/vtransfer-echoer.js', | ||
getManifestCall: [ | ||
'getManifestForVtransferEchoer', | ||
{ | ||
target: 'agoric1vtransfertest', | ||
}, | ||
], | ||
}); | ||
|
||
export default async (homeP, endowments) => { | ||
const { writeCoreProposal } = await makeHelpers(homeP, endowments); | ||
await writeCoreProposal('test-vtransfer', defaultProposalBuilder); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// @ts-check | ||
import { makeExo } from '@agoric/store'; | ||
import { E } from '@endo/far'; | ||
|
||
/** | ||
* @param {BootstrapPowers & { | ||
* consume: { | ||
* transferMiddleware: import('../vat-transfer.js').TransferMiddleware; | ||
* }; | ||
* }} powers | ||
* @param {object} options | ||
* @param {{ target: string }} options.options | ||
*/ | ||
export const echoVtransfer = async ( | ||
{ consume: { transferMiddleware } }, | ||
{ options: { target } }, | ||
) => { | ||
console.warn(`=== vtransfer echoer targeting ${target}`); | ||
|
||
// a tap that simply returns what it received | ||
const tap = makeExo('echoer', undefined, { | ||
// ack value must be stringlike | ||
upcall: async param => JSON.stringify(param), | ||
}); | ||
|
||
// TODO put something in promise space to unregister this one and register again | ||
// or maybe put all imperative stuff into promise space | ||
await E(transferMiddleware).intercept(target, tap); | ||
|
||
console.warn('=== vtransfer echoer registered'); | ||
}; | ||
|
||
export const getManifestForVtransferEchoer = (_powers, { target }) => ({ | ||
manifest: { | ||
[echoVtransfer.name]: { | ||
consume: { | ||
transferMiddleware: 'transferMiddleware', | ||
}, | ||
}, | ||
}, | ||
options: { | ||
target, | ||
}, | ||
}); |
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