@agoric/orchestration 0.1.1-dev-0b1501a.0 → 0.1.1-dev-e3b41dc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +16 -16
- package/src/examples/send-anywhere.contract.d.ts +19 -1
- package/src/examples/send-anywhere.contract.d.ts.map +1 -1
- package/src/examples/send-anywhere.contract.js +14 -4
- package/src/examples/send-anywhere.flows.d.ts +4 -1
- package/src/examples/send-anywhere.flows.d.ts.map +1 -1
- package/src/examples/send-anywhere.flows.js +15 -5
- package/src/types-index.d.ts +1 -0
- package/src/utils/start-helper.d.ts +1 -1
- package/types.d.ts +0 -1
- /package/{types.js → src/types-index.js} +0 -0
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/// <reference types="@agoric/zoe/exported" />
|
|
4
4
|
|
|
5
5
|
// eslint-disable-next-line import/export
|
|
6
|
-
export * from './types.js'; // no named exports
|
|
6
|
+
export * from './src/types-index.js'; // no named exports
|
|
7
7
|
export * from './src/exos/cosmos-interchain-service.js';
|
|
8
8
|
export * from './src/exos/chain-hub-admin.js';
|
|
9
9
|
export * from './src/typeGuards.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/orchestration",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-e3b41dc.0+e3b41dc",
|
|
4
4
|
"description": "Chain abstraction for Agoric's orchestration clients",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/Agoric/agoric-sdk#readme",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@agoric/async-flow": "0.1.1-dev-
|
|
37
|
-
"@agoric/cosmic-proto": "0.4.1-dev-
|
|
38
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
39
|
-
"@agoric/internal": "0.3.3-dev-
|
|
40
|
-
"@agoric/network": "0.1.1-dev-
|
|
41
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
42
|
-
"@agoric/store": "0.9.3-dev-
|
|
43
|
-
"@agoric/time": "0.3.3-dev-
|
|
44
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
45
|
-
"@agoric/vats": "0.15.2-dev-
|
|
46
|
-
"@agoric/vow": "0.1.1-dev-
|
|
47
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
48
|
-
"@agoric/zone": "0.2.3-dev-
|
|
36
|
+
"@agoric/async-flow": "0.1.1-dev-e3b41dc.0+e3b41dc",
|
|
37
|
+
"@agoric/cosmic-proto": "0.4.1-dev-e3b41dc.0+e3b41dc",
|
|
38
|
+
"@agoric/ertp": "0.16.3-dev-e3b41dc.0+e3b41dc",
|
|
39
|
+
"@agoric/internal": "0.3.3-dev-e3b41dc.0+e3b41dc",
|
|
40
|
+
"@agoric/network": "0.1.1-dev-e3b41dc.0+e3b41dc",
|
|
41
|
+
"@agoric/notifier": "0.6.3-dev-e3b41dc.0+e3b41dc",
|
|
42
|
+
"@agoric/store": "0.9.3-dev-e3b41dc.0+e3b41dc",
|
|
43
|
+
"@agoric/time": "0.3.3-dev-e3b41dc.0+e3b41dc",
|
|
44
|
+
"@agoric/vat-data": "0.5.3-dev-e3b41dc.0+e3b41dc",
|
|
45
|
+
"@agoric/vats": "0.15.2-dev-e3b41dc.0+e3b41dc",
|
|
46
|
+
"@agoric/vow": "0.1.1-dev-e3b41dc.0+e3b41dc",
|
|
47
|
+
"@agoric/zoe": "0.26.3-dev-e3b41dc.0+e3b41dc",
|
|
48
|
+
"@agoric/zone": "0.2.3-dev-e3b41dc.0+e3b41dc",
|
|
49
49
|
"@endo/base64": "^1.0.7",
|
|
50
50
|
"@endo/errors": "^1.2.5",
|
|
51
51
|
"@endo/far": "^1.1.5",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@noble/hashes": "^1.5.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
57
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-e3b41dc.0+e3b41dc",
|
|
58
58
|
"@chain-registry/client": "^1.47.4",
|
|
59
59
|
"@cosmjs/amino": "^0.32.3",
|
|
60
60
|
"@cosmjs/proto-signing": "^0.32.3",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"typeCoverage": {
|
|
95
95
|
"atLeast": 97.6
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "e3b41dc204ce335217bf18ed4889aba18734d8f6"
|
|
98
98
|
}
|
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* @import {Vow} from '@agoric/vow';
|
|
2
3
|
* @import {Zone} from '@agoric/zone';
|
|
3
4
|
* @import {OrchestrationPowers, OrchestrationTools} from '../utils/start-helper.js';
|
|
4
5
|
*/
|
|
5
6
|
export const SingleNatAmountRecord: import("@endo/patterns").Matcher;
|
|
7
|
+
export function contract(zcf: ZCF, privateArgs: OrchestrationPowers & {
|
|
8
|
+
marshaller: Marshaller;
|
|
9
|
+
}, zone: Zone, { chainHub, orchestrateAll, vowTools, zoeTools }: OrchestrationTools): Promise<{
|
|
10
|
+
publicFacet: import("@endo/exo").Guarded<{
|
|
11
|
+
makeSendInvitation(): Promise<Invitation<Vow<void>, {
|
|
12
|
+
chainName: string;
|
|
13
|
+
destAddr: string;
|
|
14
|
+
}>>;
|
|
15
|
+
}>;
|
|
16
|
+
creatorFacet: import("@endo/exo").Guarded<{
|
|
17
|
+
registerChain(chainName: string, chainInfo: import("../cosmos-api.js").CosmosChainInfo, connectionInfo: import("../cosmos-api.js").IBCConnectionInfo): Promise<void>;
|
|
18
|
+
registerAsset(denom: import("../orchestration-api.js").Denom, detail: import("../types.js").DenomDetail): Promise<void>;
|
|
19
|
+
}>;
|
|
20
|
+
}>;
|
|
6
21
|
export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: OrchestrationPowers & {
|
|
7
22
|
marshaller: Marshaller;
|
|
8
23
|
}, baggage: import("@agoric/vat-data").Baggage) => Promise<{
|
|
9
24
|
publicFacet: import("@endo/exo").Guarded<{
|
|
10
|
-
makeSendInvitation(): Promise<Invitation<
|
|
25
|
+
makeSendInvitation(): Promise<Invitation<Vow<void>, {
|
|
11
26
|
chainName: string;
|
|
12
27
|
destAddr: string;
|
|
13
28
|
}>>;
|
|
@@ -25,4 +40,7 @@ export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: Orchestrati
|
|
|
25
40
|
}>;
|
|
26
41
|
}>;
|
|
27
42
|
import type { OrchestrationPowers } from '../utils/start-helper.js';
|
|
43
|
+
import type { Zone } from '@agoric/zone';
|
|
44
|
+
import type { OrchestrationTools } from '../utils/start-helper.js';
|
|
45
|
+
import type { Vow } from '@agoric/vow';
|
|
28
46
|
//# sourceMappingURL=send-anywhere.contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-anywhere.contract.d.ts","sourceRoot":"","sources":["send-anywhere.contract.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"send-anywhere.contract.d.ts","sourceRoot":"","sources":["send-anywhere.contract.js"],"names":[],"mappings":"AAUA;;;;GAIG;AAEH,qEAKE;AAaK,8BAPI,GAAG,eACH,mBAAmB,GAAG;IAC5B,UAAU,EAAE,UAAU,CAAC;CACxB,QACO,IAAI,oDACJ,kBAAkB;;;;;;;;;;;GA8C5B;AAGD;gBApDiB,UAAU;;;;;;;;;;;;;;;;;;;GAoDsB;yCApES,0BAA0B;0BAD7D,cAAc;wCACqB,0BAA0B;yBAF9D,aAAa"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { makeSharedStateRecord } from '@agoric/async-flow';
|
|
2
|
+
|
|
2
3
|
import { InvitationShape } from '@agoric/zoe/src/typeGuards.js';
|
|
4
|
+
import { E } from '@endo/far';
|
|
3
5
|
import { M } from '@endo/patterns';
|
|
4
|
-
import { withOrchestration } from '../utils/start-helper.js';
|
|
5
|
-
import * as flows from './send-anywhere.flows.js';
|
|
6
6
|
import { prepareChainHubAdmin } from '../exos/chain-hub-admin.js';
|
|
7
7
|
import { AnyNatAmountShape } from '../typeGuards.js';
|
|
8
|
+
import { withOrchestration } from '../utils/start-helper.js';
|
|
9
|
+
import * as flows from './send-anywhere.flows.js';
|
|
8
10
|
|
|
9
11
|
/**
|
|
12
|
+
* @import {Vow} from '@agoric/vow';
|
|
10
13
|
* @import {Zone} from '@agoric/zone';
|
|
11
14
|
* @import {OrchestrationPowers, OrchestrationTools} from '../utils/start-helper.js';
|
|
12
15
|
*/
|
|
@@ -29,11 +32,11 @@ harden(SingleNatAmountRecord);
|
|
|
29
32
|
* @param {Zone} zone
|
|
30
33
|
* @param {OrchestrationTools} tools
|
|
31
34
|
*/
|
|
32
|
-
const contract = async (
|
|
35
|
+
export const contract = async (
|
|
33
36
|
zcf,
|
|
34
37
|
privateArgs,
|
|
35
38
|
zone,
|
|
36
|
-
{ chainHub, orchestrateAll, zoeTools },
|
|
39
|
+
{ chainHub, orchestrateAll, vowTools, zoeTools },
|
|
37
40
|
) => {
|
|
38
41
|
const contractState = makeSharedStateRecord(
|
|
39
42
|
/** @type {{ account: OrchestrationAccount<any> | undefined }} */ {
|
|
@@ -43,9 +46,15 @@ const contract = async (
|
|
|
43
46
|
|
|
44
47
|
const creatorFacet = prepareChainHubAdmin(zone, chainHub);
|
|
45
48
|
|
|
49
|
+
// UNTIL https://github.com/Agoric/agoric-sdk/issues/9066
|
|
50
|
+
const logNode = E(privateArgs.storageNode).makeChildNode('log');
|
|
51
|
+
/** @type {(msg: string) => Vow<void>} */
|
|
52
|
+
const log = msg => vowTools.watch(E(logNode).setValue(msg));
|
|
53
|
+
|
|
46
54
|
// orchestrate uses the names on orchestrationFns to do a "prepare" of the associated behavior
|
|
47
55
|
const orchFns = orchestrateAll(flows, {
|
|
48
56
|
contractState,
|
|
57
|
+
log,
|
|
49
58
|
zoeTools,
|
|
50
59
|
});
|
|
51
60
|
|
|
@@ -68,6 +77,7 @@ const contract = async (
|
|
|
68
77
|
|
|
69
78
|
return { publicFacet, creatorFacet };
|
|
70
79
|
};
|
|
80
|
+
harden(contract);
|
|
71
81
|
|
|
72
82
|
export const start = withOrchestration(contract);
|
|
73
83
|
harden(start);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export function sendIt(orch: Orchestrator, { contractState, zoeTools: { localTransfer, withdrawToSeat } }: {
|
|
1
|
+
export function sendIt(orch: Orchestrator, { contractState, log, zoeTools: { localTransfer, withdrawToSeat } }: {
|
|
2
2
|
contractState: {
|
|
3
3
|
localAccount?: OrchestrationAccountI & LocalAccountMethods;
|
|
4
4
|
};
|
|
5
5
|
zoeTools: GuestInterface<ZoeTools>;
|
|
6
|
+
log: GuestOf<(msg: string) => Vow<void>>;
|
|
6
7
|
}, seat: ZCFSeat, offerArgs: {
|
|
7
8
|
chainName: string;
|
|
8
9
|
destAddr: string;
|
|
@@ -12,4 +13,6 @@ import type { OrchestrationAccountI } from '../types.js';
|
|
|
12
13
|
import type { LocalAccountMethods } from '../types.js';
|
|
13
14
|
import type { ZoeTools } from '../utils/zoe-tools.js';
|
|
14
15
|
import type { GuestInterface } from '@agoric/async-flow';
|
|
16
|
+
import type { Vow } from '@agoric/vow';
|
|
17
|
+
import type { GuestOf } from '@agoric/async-flow';
|
|
15
18
|
//# sourceMappingURL=send-anywhere.flows.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-anywhere.flows.d.ts","sourceRoot":"","sources":["send-anywhere.flows.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"send-anywhere.flows.d.ts","sourceRoot":"","sources":["send-anywhere.flows.js"],"names":[],"mappings":"AA0BO,6BARI,YAAY,uEAEpB;IAA4E,aAAa,EAAjF;QAAE,YAAY,CAAC,EAAE,qBAAqB,GAAG,mBAAmB,CAAA;KAAE;IAChC,QAAQ,EAAtC,eAAe,QAAQ,CAAC;IACiB,GAAG,EAA5C,QAAQ,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,IAAI,CAAC,CAAC;CAC3C,QAAQ,OAAO,aACP;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,iBAyDjD;kCAzE6F,aAAa;2CAAb,aAAa;yCAAb,aAAa;8BADhF,uBAAuB;oCAFR,oBAAoB;yBACxC,aAAa;6BADO,oBAAoB"}
|
|
@@ -3,7 +3,8 @@ import { makeError, q } from '@endo/errors';
|
|
|
3
3
|
import { M, mustMatch } from '@endo/patterns';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @import {GuestInterface} from '@agoric/async-flow';
|
|
6
|
+
* @import {GuestInterface, GuestOf} from '@agoric/async-flow';
|
|
7
|
+
* @import {Vow} from '@agoric/vow';
|
|
7
8
|
* @import {ZoeTools} from '../utils/zoe-tools.js';
|
|
8
9
|
* @import {Orchestrator, LocalAccountMethods, OrchestrationAccountI, OrchestrationFlow} from '../types.js';
|
|
9
10
|
*/
|
|
@@ -19,12 +20,13 @@ const { entries } = Object;
|
|
|
19
20
|
* @param {object} ctx
|
|
20
21
|
* @param {{ localAccount?: OrchestrationAccountI & LocalAccountMethods }} ctx.contractState
|
|
21
22
|
* @param {GuestInterface<ZoeTools>} ctx.zoeTools
|
|
23
|
+
* @param {GuestOf<(msg: string) => Vow<void>>} ctx.log
|
|
22
24
|
* @param {ZCFSeat} seat
|
|
23
25
|
* @param {{ chainName: string; destAddr: string }} offerArgs
|
|
24
26
|
*/
|
|
25
27
|
export const sendIt = async (
|
|
26
28
|
orch,
|
|
27
|
-
{ contractState, zoeTools: { localTransfer, withdrawToSeat } },
|
|
29
|
+
{ contractState, log, zoeTools: { localTransfer, withdrawToSeat } },
|
|
28
30
|
seat,
|
|
29
31
|
offerArgs,
|
|
30
32
|
) => {
|
|
@@ -33,25 +35,30 @@ export const sendIt = async (
|
|
|
33
35
|
// NOTE the proposal shape ensures that the `give` is a single asset
|
|
34
36
|
const { give } = seat.getProposal();
|
|
35
37
|
const [[_kw, amt]] = entries(give);
|
|
38
|
+
void log(`sending {${amt.value}} from ${chainName} to ${destAddr}`);
|
|
36
39
|
const agoric = await orch.getChain('agoric');
|
|
37
40
|
const assets = await agoric.getVBankAssetInfo();
|
|
41
|
+
void log(`got info for denoms: ${assets.map(a => a.denom).join(', ')}`);
|
|
38
42
|
const { denom } = NonNullish(
|
|
39
43
|
assets.find(a => a.brand === amt.brand),
|
|
40
44
|
`${amt.brand} not registered in vbank`,
|
|
41
45
|
);
|
|
42
|
-
const chain = await orch.getChain(chainName);
|
|
43
46
|
|
|
47
|
+
// FIXME racy
|
|
44
48
|
if (!contractState.localAccount) {
|
|
45
|
-
|
|
46
|
-
contractState.localAccount = await agoricChain.makeAccount();
|
|
49
|
+
contractState.localAccount = await agoric.makeAccount();
|
|
47
50
|
}
|
|
48
51
|
|
|
52
|
+
const chain = await orch.getChain(chainName);
|
|
49
53
|
const info = await chain.getChainInfo();
|
|
50
54
|
const { chainId } = info;
|
|
51
55
|
assert(typeof chainId === 'string', 'bad chainId');
|
|
56
|
+
void log(`got info for chain: ${chainName} ${chainId}`);
|
|
52
57
|
|
|
53
58
|
await localTransfer(seat, contractState.localAccount, give);
|
|
54
59
|
|
|
60
|
+
void log(`completed transfer to localAccount`);
|
|
61
|
+
|
|
55
62
|
try {
|
|
56
63
|
await contractState.localAccount.transfer(
|
|
57
64
|
{
|
|
@@ -61,13 +68,16 @@ export const sendIt = async (
|
|
|
61
68
|
},
|
|
62
69
|
{ denom, value: amt.value },
|
|
63
70
|
);
|
|
71
|
+
void log(`completed transfer to ${destAddr}`);
|
|
64
72
|
} catch (e) {
|
|
65
73
|
await withdrawToSeat(contractState.localAccount, seat, give);
|
|
66
74
|
const errorMsg = `IBC Transfer failed ${q(e)}`;
|
|
75
|
+
void log(`ERROR: ${errorMsg}`);
|
|
67
76
|
seat.exit(errorMsg);
|
|
68
77
|
throw makeError(errorMsg);
|
|
69
78
|
}
|
|
70
79
|
|
|
71
80
|
seat.exit();
|
|
81
|
+
void log(`transfer complete, seat exited`);
|
|
72
82
|
};
|
|
73
83
|
harden(sendIt);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types.js';
|
|
@@ -19,7 +19,7 @@ export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: O
|
|
|
19
19
|
getAsset(denom: import("../orchestration-api.js").Denom): DenomDetail | undefined;
|
|
20
20
|
getDenom(brand: Brand): import("../orchestration-api.js").Denom | undefined;
|
|
21
21
|
}>;
|
|
22
|
-
vowTools: import("@agoric/vow
|
|
22
|
+
vowTools: import("@agoric/vow").VowTools;
|
|
23
23
|
asyncFlowTools: {
|
|
24
24
|
prepareAsyncFlowKit: (zone: Zone, tag: string, guestAsyncFunc: import("@agoric/async-flow").GuestAsyncFunc, options?: {
|
|
25
25
|
startEager?: boolean;
|
package/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/types.js';
|
|
File without changes
|