@agoric/orchestration 0.1.1-dev-0006934.0 → 0.1.1-dev-12ce494.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.
Files changed (52) hide show
  1. package/package.json +16 -16
  2. package/src/examples/basic-flows.contract.d.ts +11 -0
  3. package/src/examples/basic-flows.contract.d.ts.map +1 -0
  4. package/src/examples/basic-flows.contract.js +72 -0
  5. package/src/examples/sendAnywhere.contract.d.ts +20 -1
  6. package/src/examples/sendAnywhere.contract.d.ts.map +1 -1
  7. package/src/examples/sendAnywhere.contract.js +25 -67
  8. package/src/examples/sendAnywhereFlows.d.ts +24 -0
  9. package/src/examples/sendAnywhereFlows.d.ts.map +1 -0
  10. package/src/examples/sendAnywhereFlows.js +59 -0
  11. package/src/examples/stakeBld.contract.d.ts +20 -17
  12. package/src/examples/stakeBld.contract.d.ts.map +1 -1
  13. package/src/examples/stakeBld.contract.js +4 -12
  14. package/src/examples/stakeIca.contract.d.ts +9 -9
  15. package/src/examples/swapExample.contract.d.ts.map +1 -1
  16. package/src/examples/swapExample.contract.js +13 -15
  17. package/src/exos/cosmos-orchestration-account.d.ts +9 -9
  18. package/src/exos/cosmos-orchestration-account.d.ts.map +1 -1
  19. package/src/exos/cosmos-orchestration-account.js +27 -21
  20. package/src/exos/local-chain-facade.d.ts +71 -5
  21. package/src/exos/local-chain-facade.d.ts.map +1 -1
  22. package/src/exos/local-chain-facade.js +26 -2
  23. package/src/exos/local-orchestration-account.d.ts +27 -4
  24. package/src/exos/local-orchestration-account.d.ts.map +1 -1
  25. package/src/exos/local-orchestration-account.js +31 -10
  26. package/src/exos/orchestrator.d.ts +5 -0
  27. package/src/exos/orchestrator.d.ts.map +1 -1
  28. package/src/exos/orchestrator.js +8 -0
  29. package/src/exos/remote-chain-facade.d.ts +66 -19
  30. package/src/exos/remote-chain-facade.d.ts.map +1 -1
  31. package/src/exos/remote-chain-facade.js +46 -13
  32. package/src/facade.d.ts +9 -32
  33. package/src/facade.d.ts.map +1 -1
  34. package/src/facade.js +59 -72
  35. package/src/orchestration-api.d.ts +15 -0
  36. package/src/orchestration-api.d.ts.map +1 -1
  37. package/src/orchestration-api.ts +18 -6
  38. package/src/proposals/start-basic-flows.d.ts +40 -0
  39. package/src/proposals/start-basic-flows.d.ts.map +1 -0
  40. package/src/proposals/start-basic-flows.js +97 -0
  41. package/src/proposals/start-stakeAtom.d.ts +9 -9
  42. package/src/proposals/start-stakeBld.d.ts +20 -17
  43. package/src/proposals/start-stakeBld.d.ts.map +1 -1
  44. package/src/proposals/start-stakeOsmo.d.ts +9 -9
  45. package/src/utils/orchestrationAccount.d.ts +2 -0
  46. package/src/utils/orchestrationAccount.js +9 -0
  47. package/src/utils/start-helper.d.ts +48 -2
  48. package/src/utils/start-helper.d.ts.map +1 -1
  49. package/src/utils/start-helper.js +35 -9
  50. package/src/utils/zoe-tools.d.ts +48 -0
  51. package/src/utils/zoe-tools.d.ts.map +1 -0
  52. package/src/utils/zoe-tools.js +64 -0
@@ -0,0 +1,97 @@
1
+ /**
2
+ * @file A proposal to start the basic flows contract.
3
+ */
4
+ import { makeTracer } from '@agoric/internal';
5
+ import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
6
+ import { E } from '@endo/far';
7
+
8
+ /**
9
+ * @import {BasicFlowsSF} from '../examples/basic-flows.contract.js';
10
+ */
11
+
12
+ const trace = makeTracer('StartBasicFlows', true);
13
+ const contractName = 'basicFlows';
14
+
15
+ /**
16
+ * See `@agoric/builders/builders/scripts/orchestration/init-basic-flows.js` for
17
+ * the accompanying proposal builder. Run `agoric run
18
+ * packages/builders/scripts/orchestration/init-basic-flows.js` to build the
19
+ * contract and proposal files.
20
+ *
21
+ * @param {BootstrapPowers} powers
22
+ */
23
+ export const startBasicFlows = async ({
24
+ consume: {
25
+ agoricNames,
26
+ board,
27
+ chainStorage,
28
+ chainTimerService,
29
+ cosmosInterchainService,
30
+ localchain,
31
+ startUpgradable,
32
+ },
33
+ installation: {
34
+ // @ts-expect-error not a WellKnownName
35
+ consume: { [contractName]: installation },
36
+ },
37
+ instance: {
38
+ // @ts-expect-error not a WellKnownName
39
+ produce: { [contractName]: produceInstance },
40
+ },
41
+ }) => {
42
+ trace(`start ${contractName}`);
43
+ await null;
44
+
45
+ const storageNode = await makeStorageNodeChild(chainStorage, contractName);
46
+ const marshaller = await E(board).getPublishingMarshaller();
47
+
48
+ /** @type {StartUpgradableOpts<BasicFlowsSF>} */
49
+ const startOpts = {
50
+ label: 'basicFlows',
51
+ installation,
52
+ terms: undefined,
53
+ privateArgs: {
54
+ agoricNames: await agoricNames,
55
+ orchestrationService: await cosmosInterchainService,
56
+ localchain: await localchain,
57
+ storageNode,
58
+ marshaller,
59
+ timerService: await chainTimerService,
60
+ },
61
+ };
62
+
63
+ const { instance } = await E(startUpgradable)(startOpts);
64
+ produceInstance.resolve(instance);
65
+ };
66
+ harden(startBasicFlows);
67
+
68
+ export const getManifestForContract = (
69
+ { restoreRef },
70
+ { installKeys, ...options },
71
+ ) => {
72
+ return {
73
+ manifest: {
74
+ [startBasicFlows.name]: {
75
+ consume: {
76
+ agoricNames: true,
77
+ board: true,
78
+ chainStorage: true,
79
+ chainTimerService: true,
80
+ cosmosInterchainService: true,
81
+ localchain: true,
82
+ startUpgradable: true,
83
+ },
84
+ installation: {
85
+ consume: { [contractName]: true },
86
+ },
87
+ instance: {
88
+ produce: { [contractName]: true },
89
+ },
90
+ },
91
+ },
92
+ installations: {
93
+ [contractName]: restoreRef(installKeys[contractName]),
94
+ },
95
+ options,
96
+ };
97
+ };
@@ -9,12 +9,12 @@ export function startStakeAtom({ consume: { agoricNames, board, chainStorage, ch
9
9
  }, baggage: import("@agoric/vat-data").Baggage) => Promise<{
10
10
  publicFacet: import("@endo/exo").Guarded<{
11
11
  makeAccount(): Promise<import("@endo/exo").Guarded<{
12
- asContinuingOffer(): {
12
+ asContinuingOffer(): import("@agoric/vow").Vow<{
13
13
  publicSubscribers: {
14
14
  account: {
15
15
  description: string;
16
16
  subscriber: globalThis.Subscriber<import("../exos/cosmos-orchestration-account.js").ComosOrchestrationAccountNotification>;
17
- storagePath: Promise<string>;
17
+ storagePath: string;
18
18
  };
19
19
  };
20
20
  invitationMakers: import("@endo/exo").Guarded<{
@@ -26,14 +26,14 @@ export function startStakeAtom({ consume: { agoricNames, board, chainStorage, ch
26
26
  TransferAccount(): never;
27
27
  }>;
28
28
  holder: import("@endo/exo").Guarded<any>;
29
- };
30
- getPublicTopics(): {
29
+ }>;
30
+ getPublicTopics(): import("@agoric/vow").Vow<{
31
31
  account: {
32
32
  description: string;
33
33
  subscriber: globalThis.Subscriber<import("../exos/cosmos-orchestration-account.js").ComosOrchestrationAccountNotification>;
34
- storagePath: Promise<string>;
34
+ storagePath: string;
35
35
  };
36
- };
36
+ }>;
37
37
  getAddress(): import("../orchestration-api.js").ChainAddress;
38
38
  delegate(validator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): import("@agoric/vow").Vow<undefined>;
39
39
  getBalances(): import("@agoric/vow").Vow<never>;
@@ -46,12 +46,12 @@ export function startStakeAtom({ consume: { agoricNames, board, chainStorage, ch
46
46
  withdrawRewards(): import("@agoric/vow").Vow<never>;
47
47
  undelegate(delegations: Omit<import("@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js").Delegation, "delegatorAddress">[]): import("@agoric/vow").Vow<undefined>;
48
48
  }>>;
49
- makeAccountInvitationMaker(): Promise<Invitation<{
49
+ makeAccountInvitationMaker(): Promise<Invitation<import("@agoric/vow").Vow<{
50
50
  publicSubscribers: {
51
51
  account: {
52
52
  description: string;
53
53
  subscriber: globalThis.Subscriber<import("../exos/cosmos-orchestration-account.js").ComosOrchestrationAccountNotification>;
54
- storagePath: Promise<string>;
54
+ storagePath: string;
55
55
  };
56
56
  };
57
57
  invitationMakers: import("@endo/exo").Guarded<{
@@ -63,7 +63,7 @@ export function startStakeAtom({ consume: { agoricNames, board, chainStorage, ch
63
63
  TransferAccount(): never;
64
64
  }>;
65
65
  holder: import("@endo/exo").Guarded<any>;
66
- }, undefined>>;
66
+ }>, undefined>>;
67
67
  }>;
68
68
  }>>;
69
69
  };
@@ -9,12 +9,12 @@ export function startStakeBld({ consume: { agoricNames: agoricNamesP, board, cha
9
9
  timerService: import("@agoric/time").TimerService;
10
10
  }, baggage: import("@agoric/vat-data").Baggage) => Promise<{
11
11
  publicFacet: import("@endo/exo").Guarded<{
12
- makeStakeBldInvitation(): Promise<Invitation<{
12
+ makeStakeBldInvitation(): Promise<Invitation<import("@agoric/vow").Vow<{
13
13
  publicSubscribers: {
14
14
  account: {
15
15
  description: string;
16
16
  subscriber: globalThis.Subscriber<import("../exos/local-orchestration-account.js").LocalChainAccountNotification>;
17
- storagePath: Promise<string>;
17
+ storagePath: string;
18
18
  };
19
19
  };
20
20
  invitationMakers: import("@endo/exo").Guarded<{
@@ -22,16 +22,17 @@ export function startStakeBld({ consume: { agoricNames: agoricNamesP, board, cha
22
22
  Undelegate(validatorAddress: string, ertpAmount: Amount<"nat">): Promise<Invitation<import("@agoric/vow").Vow<import("@agoric/time").TimestampRecord>, undefined>>;
23
23
  CloseAccount(): never;
24
24
  }>;
25
- account: import("@endo/exo").Guarded<{
25
+ holder: import("@endo/exo").Guarded<{
26
+ asContinuingOffer(): import("@agoric/vow").Vow<any>;
26
27
  getBalance(denom: import("../orchestration-api.js").DenomArg): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount>;
27
28
  getBalances(): import("@agoric/vow").Vow<never>;
28
- getPublicTopics(): {
29
+ getPublicTopics(): import("@agoric/vow").Vow<{
29
30
  account: {
30
31
  description: string;
31
32
  subscriber: globalThis.Subscriber<import("../exos/local-orchestration-account.js").LocalChainAccountNotification>;
32
- storagePath: Promise<string>;
33
+ storagePath: string;
33
34
  };
34
- };
35
+ }>;
35
36
  delegate(validatorAddress: string, ertpAmount: Amount<"nat">): import("@agoric/vow").Vow<Record<unknown, unknown>>;
36
37
  undelegate(validatorAddress: string, ertpAmount: Amount<"nat">): import("@agoric/vow").Vow<void | import("@agoric/time").TimestampRecord>;
37
38
  deposit(payment: globalThis.Payment<"nat">, optAmountShape?: globalThis.Pattern): import("@agoric/vow").Vow<import("@agoric/ertp/src/types.js").NatAmount | import("@agoric/vow").Vow<import("@agoric/ertp/src/types.js").NatAmount>>;
@@ -46,17 +47,18 @@ export function startStakeBld({ consume: { agoricNames: agoricNamesP, board, cha
46
47
  transfer(amount: import("../orchestration-api.js").AmountArg, destination: import("../orchestration-api.js").ChainAddress, opts?: import("../cosmos-api.js").IBCMsgTransferOptions | undefined): import("@agoric/vow").Vow<void>;
47
48
  transferSteps(amount: import("../orchestration-api.js").AmountArg, msg: import("../orchestration-api.js").TransferMsg): import("@agoric/vow").Vow<void>;
48
49
  }>;
49
- }, undefined>>;
50
+ }>, undefined>>;
50
51
  makeAccount(): Promise<import("@endo/exo").Guarded<{
52
+ asContinuingOffer(): import("@agoric/vow").Vow<any>;
51
53
  getBalance(denom: import("../orchestration-api.js").DenomArg): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount>;
52
54
  getBalances(): import("@agoric/vow").Vow<never>;
53
- getPublicTopics(): {
55
+ getPublicTopics(): import("@agoric/vow").Vow<{
54
56
  account: {
55
57
  description: string;
56
58
  subscriber: globalThis.Subscriber<import("../exos/local-orchestration-account.js").LocalChainAccountNotification>;
57
- storagePath: Promise<string>;
59
+ storagePath: string;
58
60
  };
59
- };
61
+ }>;
60
62
  delegate(validatorAddress: string, ertpAmount: Amount<"nat">): import("@agoric/vow").Vow<Record<unknown, unknown>>;
61
63
  undelegate(validatorAddress: string, ertpAmount: Amount<"nat">): import("@agoric/vow").Vow<void | import("@agoric/time").TimestampRecord>;
62
64
  deposit(payment: globalThis.Payment<"nat">, optAmountShape?: globalThis.Pattern): import("@agoric/vow").Vow<import("@agoric/ertp/src/types.js").NatAmount | import("@agoric/vow").Vow<import("@agoric/ertp/src/types.js").NatAmount>>;
@@ -71,12 +73,12 @@ export function startStakeBld({ consume: { agoricNames: agoricNamesP, board, cha
71
73
  transfer(amount: import("../orchestration-api.js").AmountArg, destination: import("../orchestration-api.js").ChainAddress, opts?: import("../cosmos-api.js").IBCMsgTransferOptions | undefined): import("@agoric/vow").Vow<void>;
72
74
  transferSteps(amount: import("../orchestration-api.js").AmountArg, msg: import("../orchestration-api.js").TransferMsg): import("@agoric/vow").Vow<void>;
73
75
  }>>;
74
- makeAccountInvitationMaker(): Promise<Invitation<{
76
+ makeAccountInvitationMaker(): Promise<Invitation<import("@agoric/vow").Vow<{
75
77
  publicSubscribers: {
76
78
  account: {
77
79
  description: string;
78
80
  subscriber: globalThis.Subscriber<import("../exos/local-orchestration-account.js").LocalChainAccountNotification>;
79
- storagePath: Promise<string>;
81
+ storagePath: string;
80
82
  };
81
83
  };
82
84
  invitationMakers: import("@endo/exo").Guarded<{
@@ -84,16 +86,17 @@ export function startStakeBld({ consume: { agoricNames: agoricNamesP, board, cha
84
86
  Undelegate(validatorAddress: string, ertpAmount: Amount<"nat">): Promise<Invitation<import("@agoric/vow").Vow<import("@agoric/time").TimestampRecord>, undefined>>;
85
87
  CloseAccount(): never;
86
88
  }>;
87
- account: import("@endo/exo").Guarded<{
89
+ holder: import("@endo/exo").Guarded<{
90
+ asContinuingOffer(): import("@agoric/vow").Vow<any>;
88
91
  getBalance(denom: import("../orchestration-api.js").DenomArg): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount>;
89
92
  getBalances(): import("@agoric/vow").Vow<never>;
90
- getPublicTopics(): {
93
+ getPublicTopics(): import("@agoric/vow").Vow<{
91
94
  account: {
92
95
  description: string;
93
96
  subscriber: globalThis.Subscriber<import("../exos/local-orchestration-account.js").LocalChainAccountNotification>;
94
- storagePath: Promise<string>;
97
+ storagePath: string;
95
98
  };
96
- };
99
+ }>;
97
100
  delegate(validatorAddress: string, ertpAmount: Amount<"nat">): import("@agoric/vow").Vow<Record<unknown, unknown>>;
98
101
  undelegate(validatorAddress: string, ertpAmount: Amount<"nat">): import("@agoric/vow").Vow<void | import("@agoric/time").TimestampRecord>;
99
102
  deposit(payment: globalThis.Payment<"nat">, optAmountShape?: globalThis.Pattern): import("@agoric/vow").Vow<import("@agoric/ertp/src/types.js").NatAmount | import("@agoric/vow").Vow<import("@agoric/ertp/src/types.js").NatAmount>>;
@@ -108,7 +111,7 @@ export function startStakeBld({ consume: { agoricNames: agoricNamesP, board, cha
108
111
  transfer(amount: import("../orchestration-api.js").AmountArg, destination: import("../orchestration-api.js").ChainAddress, opts?: import("../cosmos-api.js").IBCMsgTransferOptions | undefined): import("@agoric/vow").Vow<void>;
109
112
  transferSteps(amount: import("../orchestration-api.js").AmountArg, msg: import("../orchestration-api.js").TransferMsg): import("@agoric/vow").Vow<void>;
110
113
  }>;
111
- }, undefined>>;
114
+ }>, undefined>>;
112
115
  }>;
113
116
  }>>;
114
117
  };
@@ -1 +1 @@
1
- {"version":3,"file":"start-stakeBld.d.ts","sourceRoot":"","sources":["start-stakeBld.js"],"names":[],"mappings":"AAkBO,6TAVI,eAAe,GAAG;IAC5B,YAAgB,EAAE;QAClB,OAAa,EAAE;YACf,QAAgB,EAAE,YAAY,CAC9B;;;;;;+BAiCqB,kBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAjC2B,CACxD,CAAC;SACH,CAAC;KACH,CAAC;CACH,iBAwDH;AAGM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BN;sBApGqB,gCAAgC"}
1
+ {"version":3,"file":"start-stakeBld.d.ts","sourceRoot":"","sources":["start-stakeBld.js"],"names":[],"mappings":"AAkBO,6TAVI,eAAe,GAAG;IAC5B,YAAgB,EAAE;QAClB,OAAa,EAAE;YACf,QAAgB,EAAE,YAAY,CAC9B;;;;;;+BAiCqB,kBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAjC2B,CACxD,CAAC;SACH,CAAC;KACH,CAAC;CACH,iBAwDH;AAGM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BN;sBApGqB,gCAAgC"}
@@ -9,12 +9,12 @@ export function startStakeOsmo({ consume: { agoricNames, board, chainStorage, ch
9
9
  }, baggage: import("@agoric/vat-data").Baggage) => Promise<{
10
10
  publicFacet: import("@endo/exo").Guarded<{
11
11
  makeAccount(): Promise<import("@endo/exo").Guarded<{
12
- asContinuingOffer(): {
12
+ asContinuingOffer(): import("@agoric/vow").Vow<{
13
13
  publicSubscribers: {
14
14
  account: {
15
15
  description: string;
16
16
  subscriber: globalThis.Subscriber<import("../exos/cosmos-orchestration-account.js").ComosOrchestrationAccountNotification>;
17
- storagePath: Promise<string>;
17
+ storagePath: string;
18
18
  };
19
19
  };
20
20
  invitationMakers: import("@endo/exo").Guarded<{
@@ -26,14 +26,14 @@ export function startStakeOsmo({ consume: { agoricNames, board, chainStorage, ch
26
26
  TransferAccount(): never;
27
27
  }>;
28
28
  holder: import("@endo/exo").Guarded<any>;
29
- };
30
- getPublicTopics(): {
29
+ }>;
30
+ getPublicTopics(): import("@agoric/vow").Vow<{
31
31
  account: {
32
32
  description: string;
33
33
  subscriber: globalThis.Subscriber<import("../exos/cosmos-orchestration-account.js").ComosOrchestrationAccountNotification>;
34
- storagePath: Promise<string>;
34
+ storagePath: string;
35
35
  };
36
- };
36
+ }>;
37
37
  getAddress(): import("../orchestration-api.js").ChainAddress;
38
38
  delegate(validator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): import("@agoric/vow").Vow<undefined>;
39
39
  getBalances(): import("@agoric/vow").Vow<never>;
@@ -46,12 +46,12 @@ export function startStakeOsmo({ consume: { agoricNames, board, chainStorage, ch
46
46
  withdrawRewards(): import("@agoric/vow").Vow<never>;
47
47
  undelegate(delegations: Omit<import("@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js").Delegation, "delegatorAddress">[]): import("@agoric/vow").Vow<undefined>;
48
48
  }>>;
49
- makeAccountInvitationMaker(): Promise<Invitation<{
49
+ makeAccountInvitationMaker(): Promise<Invitation<import("@agoric/vow").Vow<{
50
50
  publicSubscribers: {
51
51
  account: {
52
52
  description: string;
53
53
  subscriber: globalThis.Subscriber<import("../exos/cosmos-orchestration-account.js").ComosOrchestrationAccountNotification>;
54
- storagePath: Promise<string>;
54
+ storagePath: string;
55
55
  };
56
56
  };
57
57
  invitationMakers: import("@endo/exo").Guarded<{
@@ -63,7 +63,7 @@ export function startStakeOsmo({ consume: { agoricNames, board, chainStorage, ch
63
63
  TransferAccount(): never;
64
64
  }>;
65
65
  holder: import("@endo/exo").Guarded<any>;
66
- }, undefined>>;
66
+ }>, undefined>>;
67
67
  }>;
68
68
  }>>;
69
69
  };
@@ -5,5 +5,7 @@ export namespace orchestrationAccountMethods {
5
5
  let send: import("@endo/patterns").MethodGuard;
6
6
  let transfer: import("@endo/patterns").MethodGuard;
7
7
  let transferSteps: import("@endo/patterns").MethodGuard;
8
+ let asContinuingOffer: import("@endo/patterns").MethodGuard;
9
+ let getPublicTopics: import("@endo/patterns").MethodGuard;
8
10
  }
9
11
  //# sourceMappingURL=orchestrationAccount.d.ts.map
@@ -1,6 +1,7 @@
1
1
  import { M } from '@endo/patterns';
2
2
  import { Shape as NetworkShape } from '@agoric/network';
3
3
  import { VowShape } from '@agoric/vow';
4
+ import { TopicsRecordShape } from '@agoric/zoe/src/contractSupport/topics.js';
4
5
  import { AmountArgShape, ChainAddressShape, CoinShape } from '../typeGuards.js';
5
6
 
6
7
  /** @import {OrchestrationAccountI} from '../orchestration-api.js'; */
@@ -17,4 +18,12 @@ export const orchestrationAccountMethods = {
17
18
  .optional(M.record())
18
19
  .returns(VowShape),
19
20
  transferSteps: M.call(AmountArgShape, M.any()).returns(VowShape),
21
+ asContinuingOffer: M.call().returns(
22
+ Vow$({
23
+ publicSubscribers: TopicsRecordShape,
24
+ invitationMakers: M.any(),
25
+ holder: M.remotable(),
26
+ }),
27
+ ),
28
+ getPublicTopics: M.call().returns(Vow$(TopicsRecordShape)),
20
29
  };
@@ -17,15 +17,61 @@ export function provideOrchestration(zcf: ZCF, baggage: Baggage, remotePowers: O
17
17
  allVows: (maybeVows: import("@agoric/vow").EVow<unknown>[]) => import("@agoric/vow").Vow<any[]>;
18
18
  asVow: <T extends unknown>(fn: (...args: any[]) => import("@agoric/vow").Vow<Awaited<T>> | Awaited<T> | import("@agoric/vow").PromiseVow<T>) => import("@agoric/vow").Vow<Awaited<T>>;
19
19
  asPromise: import("@agoric/vow").AsPromiseFunction;
20
- retriable: <T>(fnZone: Zone, name: string, fn: (...args: unknown[]) => import("@agoric/vow").ERef<T>) => (...args: unknown[]) => import("@agoric/vow").Vow<T>;
20
+ retriable: <F extends (...args: any[]) => any>(fnZone: Zone, name: string, fn: F) => PromiseToVow<F>;
21
+ };
22
+ zoeTools: {
23
+ localTransfer: (srcSeat: ZCFSeat, localAccount: import("@endo/exo").Guarded<{
24
+ asContinuingOffer(): import("@agoric/vow").Vow<{
25
+ publicSubscribers: {
26
+ account: {
27
+ description: string;
28
+ subscriber: globalThis.Subscriber<import("../exos/local-orchestration-account.js").LocalChainAccountNotification>;
29
+ storagePath: string;
30
+ };
31
+ };
32
+ invitationMakers: import("@endo/exo").Guarded<{
33
+ Delegate(validatorAddress: string, ertpAmount: Amount<"nat">): Promise<Invitation<import("@agoric/vow").Vow<Record<unknown, unknown>>, undefined>>;
34
+ Undelegate(validatorAddress: string, ertpAmount: Amount<"nat">): Promise<Invitation<import("@agoric/vow").Vow<import("@agoric/time").TimestampRecord>, undefined>>;
35
+ CloseAccount(): never;
36
+ }>;
37
+ holder: import("@endo/exo").Guarded<any>;
38
+ }>;
39
+ getBalance(denom: import("../orchestration-api.js").DenomArg): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount>;
40
+ getBalances(): import("@agoric/vow").Vow<never>;
41
+ getPublicTopics(): import("@agoric/vow").Vow<{
42
+ account: {
43
+ description: string;
44
+ subscriber: globalThis.Subscriber<import("../exos/local-orchestration-account.js").LocalChainAccountNotification>;
45
+ storagePath: string;
46
+ };
47
+ }>;
48
+ delegate(validatorAddress: string, ertpAmount: Amount<"nat">): import("@agoric/vow").Vow<Record<unknown, unknown>>;
49
+ undelegate(validatorAddress: string, ertpAmount: Amount<"nat">): import("@agoric/vow").Vow<void | import("@agoric/time").TimestampRecord>;
50
+ deposit(payment: globalThis.Payment<"nat">, optAmountShape?: globalThis.Pattern): import("@agoric/vow").Vow<import("@agoric/ertp/src/types.js").NatAmount | import("@agoric/vow").Vow<import("@agoric/ertp/src/types.js").NatAmount>>;
51
+ withdraw(amount: import("@agoric/ertp/src/types.js").NatAmount): import("@agoric/vow").Vow<globalThis.Payment<"nat"> | import("@agoric/vow").Vow<globalThis.Payment<"nat">>>;
52
+ executeTx(messages: {
53
+ '@type': string;
54
+ }[]): import("@agoric/vow").Vow<import("@agoric/cosmic-proto").JsonSafe<{
55
+ '@type': string;
56
+ }>[]>;
57
+ getAddress(): import("../orchestration-api.js").ChainAddress;
58
+ send(toAccount: any, amount: any): import("@agoric/vow").Vow<never>;
59
+ transfer(amount: import("../orchestration-api.js").AmountArg, destination: import("../orchestration-api.js").ChainAddress, opts?: import("../cosmos-api.js").IBCMsgTransferOptions | undefined): import("@agoric/vow").Vow<void>;
60
+ transferSteps(amount: import("../orchestration-api.js").AmountArg, msg: import("../orchestration-api.js").TransferMsg): import("@agoric/vow").Vow<void>;
61
+ }>, give: AmountKeywordRecord) => import("@agoric/vow").Vow<void>;
21
62
  };
22
63
  zone: Zone;
23
- orchestrate<GuestReturn, HostReturn, GuestContext, HostContext, GuestArgs extends any[], HostArgs extends any[]>(durableName: string, hostCtx: HostContext, guestFn: (guestOrc: import("../orchestration-api.js").Orchestrator, guestCtx: GuestContext, ...args: GuestArgs) => Promise<GuestReturn>): (...args: HostArgs) => Promise<HostReturn>;
24
64
  adminAsyncFlow: import("@endo/exo").Guarded<{
25
65
  getFailures(): import("@endo/patterns").CopyMap<any, import("@endo/pass-style").Passable>;
26
66
  wakeAll(): void;
27
67
  getFlowForOutcomeVow(outcomeVow: any): any;
28
68
  }>;
69
+ orchestrate: <GuestReturn, HostReturn, GuestContext, HostContext, GuestArgs extends any[], HostArgs extends any[]>(durableName: string, hostCtx: HostContext, guestFn: (guestOrc: import("../orchestration-api.js").Orchestrator, guestCtx: GuestContext, ...args: GuestArgs) => Promise<GuestReturn>) => (...args: HostArgs) => Promise<HostReturn>;
70
+ orchestrateAll: (guestFns: {
71
+ [durableName: string]: (...args: any[]) => any;
72
+ }, hostCtx: any) => {
73
+ [k: string]: (...args: any[]) => Promise<any>;
74
+ };
29
75
  };
30
76
  export function withOrchestration<CT extends Record<string, unknown>, PA extends OrchestrationPowers & {
31
77
  marshaller: Marshaller;
@@ -1 +1 @@
1
- {"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"AAyCO,0CALI,GAAG,WACH,OAAO,gBACP,mBAAmB,cACnB,UAAU;;;;;;;;;;;;;;;;;wCAwC0B,GAAG;;wDA9Cd,GAAG,uDAC9B,GAAG;;;4PAsEK,GAAa,4CAK1B,GAAG;;;;;;EAaN;AAuBM,kCAdgC,EAAE,SAA3B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE,EAGhC,EAAE,SAFM,mBAAmB,GAAG;IACnC,UAAc,EAAE,UAAU,CAAC;CACvB,EACQ,CAAC,cACH,CACV,GAAO,EAAE,GAAG,CAAC,EAAE,CAAC,EAChB,WAAe,EAAE,EAAE,EACnB,IAAQ,EAAE,IAAI,EACd,KAAS,EAAE,kBAAkB,KACtB,OAAO,CAAC,CAAC,CAAC,GACL,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAYzE;kCAnIU;IACZ,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,oBAAwB,EAAE,OAAO,uBAAuB,CAAC,CAAC;IAC1D,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,WAAe,EAAE,OAAO,OAAO,CAAC,CAAC;CAC9B;iCAgGU,IAAI,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,EAAE,MAAM,CAAC;6BA9GzC,kBAAkB;0BAGrB,cAAc;gCALR,gCAAgC;4BAIpC,aAAa;6CAEI,sCAAsC;kCALrC,cAAc;6BAE/B,cAAc"}
1
+ {"version":3,"file":"start-helper.d.ts","sourceRoot":"","sources":["start-helper.js"],"names":[],"mappings":"AA8CO,0CALI,GAAG,WACH,OAAO,gBACP,mBAAmB,cACnB,UAAU;;;;;;;;;;;;;;;;;wCA+B+B,GAAG;;+BA/BtD,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8PAeA,GAAO,8CAEe,GAAG;;gCAgCzB,GAAE;;;;EAuDL;AAuBM,kCAdgC,EAAE,SAA3B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE,EAGhC,EAAE,SAFM,mBAAmB,GAAG;IACnC,UAAc,EAAE,UAAU,CAAC;CACvB,EACQ,CAAC,cACH,CACV,GAAO,EAAE,GAAG,CAAC,EAAE,CAAC,EAChB,WAAe,EAAE,EAAE,EACnB,IAAQ,EAAE,IAAI,EACd,KAAS,EAAE,kBAAkB,KACtB,OAAO,CAAC,CAAC,CAAC,GACL,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAYzE;kCA1JU;IACZ,UAAc,EAAE,OAAO,UAAU,CAAC,CAAC;IACnC,oBAAwB,EAAE,OAAO,uBAAuB,CAAC,CAAC;IAC1D,WAAe,EAAE,OAAO,WAAW,CAAC,CAAC;IACrC,YAAgB,EAAE,OAAO,YAAY,CAAC,CAAC;IACvC,WAAe,EAAE,OAAO,OAAO,CAAC,CAAC;CAC9B;iCAuHU,IAAI,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,EAAE,MAAM,CAAC;6BArIzC,kBAAkB;0BAGrB,cAAc;gCALR,gCAAgC;4BAIpC,aAAa;6CAEI,sCAAsC;kCALrC,cAAc;6BAE/B,cAAc"}
@@ -1,13 +1,16 @@
1
1
  import { prepareAsyncFlowTools } from '@agoric/async-flow';
2
+ import { pickFacet } from '@agoric/vat-data';
2
3
  import { prepareVowTools } from '@agoric/vow';
3
4
  import { prepareRecorderKitMakers } from '@agoric/zoe/src/contractSupport/recorder.js';
4
5
  import { makeDurableZone } from '@agoric/zone/durable.js';
5
- import { prepareLocalOrchestrationAccountKit } from '../exos/local-orchestration-account.js';
6
- import { makeOrchestrationFacade } from '../facade.js';
7
6
  import { makeChainHub } from '../exos/chain-hub.js';
8
- import { prepareRemoteChainFacade } from '../exos/remote-chain-facade.js';
9
7
  import { prepareCosmosOrchestrationAccount } from '../exos/cosmos-orchestration-account.js';
10
8
  import { prepareLocalChainFacade } from '../exos/local-chain-facade.js';
9
+ import { prepareLocalOrchestrationAccountKit } from '../exos/local-orchestration-account.js';
10
+ import { prepareOrchestratorKit } from '../exos/orchestrator.js';
11
+ import { prepareRemoteChainFacade } from '../exos/remote-chain-facade.js';
12
+ import { makeOrchestrationFacade } from '../facade.js';
13
+ import { makeZoeTools } from './zoe-tools.js';
11
14
 
12
15
  /**
13
16
  * @import {PromiseKit} from '@endo/promise-kit'
@@ -34,6 +37,8 @@ import { prepareLocalChainFacade } from '../exos/local-chain-facade.js';
34
37
  * Helper that a contract start function can use to set up the objects needed
35
38
  * for orchestration.
36
39
  *
40
+ * TODO strip problematic operations from ZCF (e.g., getPayouts)
41
+ *
37
42
  * @param {ZCF} zcf
38
43
  * @param {Baggage} baggage
39
44
  * @param {OrchestrationPowers} remotePowers
@@ -58,6 +63,7 @@ export const provideOrchestration = (
58
63
  contract: zone.subZone('contract'),
59
64
  orchestration: zone.subZone('orchestration'),
60
65
  vows: zone.subZone('vows'),
66
+ zoe: zone.subZone('zoe'),
61
67
  };
62
68
  })();
63
69
 
@@ -67,6 +73,8 @@ export const provideOrchestration = (
67
73
 
68
74
  const chainHub = makeChainHub(agoricNames, vowTools);
69
75
 
76
+ const zoeTools = makeZoeTools(zones.zoe, { zcf, vowTools });
77
+
70
78
  const { makeRecorderKit } = prepareRecorderKitMakers(baggage, marshaller);
71
79
  const makeLocalOrchestrationAccountKit = prepareLocalOrchestrationAccountKit(
72
80
  zones.orchestration,
@@ -106,20 +114,38 @@ export const provideOrchestration = (
106
114
  vowTools,
107
115
  });
108
116
 
109
- const facade = makeOrchestrationFacade({
110
- zcf,
111
- zone: zones.orchestration,
117
+ const makeOrchestratorKit = prepareOrchestratorKit(zones.orchestration, {
118
+ asyncFlowTools,
112
119
  chainHub,
113
- makeLocalOrchestrationAccountKit,
120
+ localchain: remotePowers.localchain,
114
121
  makeRecorderKit,
115
- makeCosmosOrchestrationAccount,
116
122
  makeLocalChainFacade,
117
123
  makeRemoteChainFacade,
124
+ storageNode: remotePowers.storageNode,
125
+ orchestrationService: remotePowers.orchestrationService,
126
+ timerService,
127
+ vowTools,
128
+ zcf,
129
+ });
130
+
131
+ const makeOrchestrator = pickFacet(makeOrchestratorKit, 'orchestrator');
132
+
133
+ const facade = makeOrchestrationFacade({
134
+ zcf,
135
+ zone: zones.orchestration,
136
+ makeRecorderKit,
137
+ makeOrchestrator,
118
138
  asyncFlowTools,
119
139
  vowTools,
120
140
  ...remotePowers,
121
141
  });
122
- return { ...facade, chainHub, vowTools, zone: zones.contract };
142
+ return {
143
+ ...facade,
144
+ chainHub,
145
+ vowTools,
146
+ zoeTools,
147
+ zone: zones.contract,
148
+ };
123
149
  };
124
150
  harden(provideOrchestration);
125
151
 
@@ -0,0 +1,48 @@
1
+ export function makeZoeTools(zone: Zone, { zcf, vowTools }: {
2
+ zcf: ZCF;
3
+ vowTools: VowTools;
4
+ }): {
5
+ localTransfer: (srcSeat: ZCFSeat, localAccount: import("@endo/exo").Guarded<{
6
+ asContinuingOffer(): Vow<{
7
+ publicSubscribers: {
8
+ account: {
9
+ description: string;
10
+ subscriber: globalThis.Subscriber<import("../exos/local-orchestration-account.js").LocalChainAccountNotification>;
11
+ storagePath: string;
12
+ };
13
+ };
14
+ invitationMakers: import("@endo/exo").Guarded<{
15
+ Delegate(validatorAddress: string, ertpAmount: Amount<"nat">): Promise<Invitation<Vow<Record<unknown, unknown>>, undefined>>;
16
+ Undelegate(validatorAddress: string, ertpAmount: Amount<"nat">): Promise<Invitation<Vow<import("@agoric/time").TimestampRecord>, undefined>>;
17
+ CloseAccount(): never;
18
+ }>;
19
+ holder: import("@endo/exo").Guarded<any>;
20
+ }>;
21
+ getBalance(denom: import("../orchestration-api.js").DenomArg): Vow<import("../orchestration-api.js").DenomAmount>;
22
+ getBalances(): Vow<never>;
23
+ getPublicTopics(): Vow<{
24
+ account: {
25
+ description: string;
26
+ subscriber: globalThis.Subscriber<import("../exos/local-orchestration-account.js").LocalChainAccountNotification>;
27
+ storagePath: string;
28
+ };
29
+ }>;
30
+ delegate(validatorAddress: string, ertpAmount: Amount<"nat">): Vow<Record<unknown, unknown>>;
31
+ undelegate(validatorAddress: string, ertpAmount: Amount<"nat">): Vow<void | import("@agoric/time").TimestampRecord>;
32
+ deposit(payment: globalThis.Payment<"nat">, optAmountShape?: globalThis.Pattern): Vow<import("@agoric/ertp/src/types.js").NatAmount | Vow<import("@agoric/ertp/src/types.js").NatAmount>>;
33
+ withdraw(amount: import("@agoric/ertp/src/types.js").NatAmount): Vow<globalThis.Payment<"nat"> | Vow<globalThis.Payment<"nat">>>;
34
+ executeTx(messages: {
35
+ '@type': string;
36
+ }[]): Vow<import("@agoric/cosmic-proto").JsonSafe<{
37
+ '@type': string;
38
+ }>[]>;
39
+ getAddress(): import("../orchestration-api.js").ChainAddress;
40
+ send(toAccount: any, amount: any): Vow<never>;
41
+ transfer(amount: import("../orchestration-api.js").AmountArg, destination: import("../orchestration-api.js").ChainAddress, opts?: import("../cosmos-api.js").IBCMsgTransferOptions | undefined): Vow<void>;
42
+ transferSteps(amount: import("../orchestration-api.js").AmountArg, msg: import("../orchestration-api.js").TransferMsg): Vow<void>;
43
+ }>, give: AmountKeywordRecord) => Vow<void>;
44
+ };
45
+ import type { Zone } from '@agoric/zone';
46
+ import type { VowTools } from '@agoric/vow';
47
+ import type { Vow } from '@agoric/vow';
48
+ //# sourceMappingURL=zoe-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zoe-tools.d.ts","sourceRoot":"","sources":["zoe-tools.js"],"names":[],"mappings":"AAcO,mCAHI,IAAI,qBACJ;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmD1C;0BAzDsB,cAAc;8BADL,aAAa;yBAAb,aAAa"}
@@ -0,0 +1,64 @@
1
+ import { Fail } from '@endo/errors';
2
+ import { atomicTransfer } from '@agoric/zoe/src/contractSupport/index.js';
3
+
4
+ /**
5
+ * @import {LocalOrchestrationAccountKit} from '../exos/local-orchestration-account.js';
6
+ * @import {Vow, VowTools} from '@agoric/vow';
7
+ * @import {Zone} from '@agoric/zone';
8
+ * @import {OrchestrationAccount} from '../orchestration-api.js'
9
+ */
10
+
11
+ /**
12
+ * @param {Zone} zone
13
+ * @param {{ zcf: ZCF; vowTools: VowTools }} io
14
+ */
15
+ export const makeZoeTools = (zone, { zcf, vowTools }) => {
16
+ /**
17
+ * Transfer the `give` a seat to a local account.
18
+ */
19
+ const localTransfer = vowTools.retriable(
20
+ zone,
21
+ 'localTransfer',
22
+ /**
23
+ * @type {(
24
+ * srcSeat: ZCFSeat,
25
+ * localAccount: LocalOrchestrationAccountKit['holder'],
26
+ * give: AmountKeywordRecord,
27
+ * ) => Promise<void>}
28
+ */
29
+ async (srcSeat, localAccount, give) => {
30
+ !srcSeat.hasExited() || Fail`The seat cannot have exited.`;
31
+ const { zcfSeat: tempSeat, userSeat: userSeatP } = zcf.makeEmptySeatKit();
32
+ const userSeat = await userSeatP;
33
+ atomicTransfer(zcf, srcSeat, tempSeat, give);
34
+ tempSeat.exit();
35
+ // TODO get the userSeat into baggage so it's at least recoverable
36
+ // const userSeat = await subzone.makeOnce(
37
+ // 'localTransferHelper',
38
+ // async () => {
39
+ // const { zcfSeat: tempSeat, userSeat: userSeatP } =
40
+ // zcf.makeEmptySeatKit();
41
+ // const uSeat = await userSeatP;
42
+ // // TODO how do I store in the place for this retriable?
43
+ // atomicTransfer(zcf, srcSeat, tempSeat, give);
44
+ // tempSeat.exit();
45
+ // return uSeat;
46
+ // },
47
+ // );
48
+
49
+ // Now all the `give` are accessible, so we can move them to the localAccount`
50
+
51
+ const promises = Object.entries(give).map(async ([kw, _amount]) => {
52
+ const pmt = await userSeat.getPayout(kw);
53
+ // TODO arrange recovery on upgrade of pmt?
54
+ return localAccount.deposit(pmt);
55
+ });
56
+ await Promise.all(promises);
57
+ // TODO remove userSeat from baggage
58
+ },
59
+ );
60
+
61
+ return harden({
62
+ localTransfer,
63
+ });
64
+ };