@agoric/orchestration 0.1.1-dev-bc8900d.0 → 0.1.1-dev-9ced650.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/orchestration",
3
- "version": "0.1.1-dev-bc8900d.0+bc8900d",
3
+ "version": "0.1.1-dev-9ced650.0+9ced650",
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-bc8900d.0+bc8900d",
37
- "@agoric/cosmic-proto": "0.4.1-dev-bc8900d.0+bc8900d",
38
- "@agoric/ertp": "0.16.3-dev-bc8900d.0+bc8900d",
39
- "@agoric/internal": "0.3.3-dev-bc8900d.0+bc8900d",
40
- "@agoric/network": "0.1.1-dev-bc8900d.0+bc8900d",
41
- "@agoric/notifier": "0.6.3-dev-bc8900d.0+bc8900d",
42
- "@agoric/store": "0.9.3-dev-bc8900d.0+bc8900d",
43
- "@agoric/time": "0.3.3-dev-bc8900d.0+bc8900d",
44
- "@agoric/vat-data": "0.5.3-dev-bc8900d.0+bc8900d",
45
- "@agoric/vats": "0.15.2-dev-bc8900d.0+bc8900d",
46
- "@agoric/vow": "0.1.1-dev-bc8900d.0+bc8900d",
47
- "@agoric/zoe": "0.26.3-dev-bc8900d.0+bc8900d",
48
- "@agoric/zone": "0.2.3-dev-bc8900d.0+bc8900d",
36
+ "@agoric/async-flow": "0.1.1-dev-9ced650.0+9ced650",
37
+ "@agoric/cosmic-proto": "0.4.1-dev-9ced650.0+9ced650",
38
+ "@agoric/ertp": "0.16.3-dev-9ced650.0+9ced650",
39
+ "@agoric/internal": "0.3.3-dev-9ced650.0+9ced650",
40
+ "@agoric/network": "0.1.1-dev-9ced650.0+9ced650",
41
+ "@agoric/notifier": "0.6.3-dev-9ced650.0+9ced650",
42
+ "@agoric/store": "0.9.3-dev-9ced650.0+9ced650",
43
+ "@agoric/time": "0.3.3-dev-9ced650.0+9ced650",
44
+ "@agoric/vat-data": "0.5.3-dev-9ced650.0+9ced650",
45
+ "@agoric/vats": "0.15.2-dev-9ced650.0+9ced650",
46
+ "@agoric/vow": "0.1.1-dev-9ced650.0+9ced650",
47
+ "@agoric/zoe": "0.26.3-dev-9ced650.0+9ced650",
48
+ "@agoric/zone": "0.2.3-dev-9ced650.0+9ced650",
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": "github:paulmillr/noble-hashes#ae060daa6252f3ff2aa2f84e887de0aab491281d"
55
55
  },
56
56
  "devDependencies": {
57
- "@agoric/swingset-liveslots": "0.10.3-dev-bc8900d.0+bc8900d",
57
+ "@agoric/swingset-liveslots": "0.10.3-dev-9ced650.0+9ced650",
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": 98.1
96
96
  },
97
- "gitHead": "bc8900d6cd2a51265533b9731437391f9194ec05"
97
+ "gitHead": "9ced650db6b0983ae5d060a00b3752c3700c4f06"
98
98
  }
@@ -15,17 +15,6 @@ export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: Orchestrati
15
15
  }>>, {
16
16
  chainNames: string[];
17
17
  }>>;
18
- makeSendICQQueryInvitation(): Promise<Invitation<import("@agoric/vow").Vow<string>, {
19
- chainName: string;
20
- msgs: Parameters<import("../cosmos-api.js").ICQQueryFunction>[0];
21
- }>>;
22
- makeAccountAndSendBalanceQueryInvitation(): Promise<Invitation<import("@agoric/vow").Vow<string>, {
23
- chainName: string;
24
- denom: import("../orchestration-api.js").DenomArg;
25
- }>>;
26
- makeSendLocalQueryInvitation(): Promise<Invitation<import("@agoric/vow").Vow<string>, {
27
- msgs: Parameters<import("@agoric/vats/src/localchain.js").QueryManyFn>[0];
28
- }>>;
29
18
  }>;
30
19
  }>;
31
20
  export type BasicFlowsSF = typeof start;
@@ -1 +1 @@
1
- {"version":3,"file":"basic-flows.contract.d.ts","sourceRoot":"","sources":["basic-flows.contract.js"],"names":[],"mappings":"AAoFA;gBAjEiB,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEsB;2BAGnC,OAAO,KAAK;yCA3EY,0BAA0B"}
1
+ {"version":3,"file":"basic-flows.contract.d.ts","sourceRoot":"","sources":["basic-flows.contract.js"],"names":[],"mappings":"AA8DA;gBA3CiB,UAAU;;;;;;;;;;;;;;;;;GA2CsB;2BAGnC,OAAO,KAAK;yCArDY,0BAA0B"}
@@ -40,10 +40,6 @@ const contract = async (
40
40
  M.interface('Basic Flows PF', {
41
41
  makeOrchAccountInvitation: M.callWhen().returns(InvitationShape),
42
42
  makePortfolioAccountInvitation: M.callWhen().returns(InvitationShape),
43
- makeSendICQQueryInvitation: M.callWhen().returns(InvitationShape),
44
- makeAccountAndSendBalanceQueryInvitation:
45
- M.callWhen().returns(InvitationShape),
46
- makeSendLocalQueryInvitation: M.callWhen().returns(InvitationShape),
47
43
  }),
48
44
  {
49
45
  makeOrchAccountInvitation() {
@@ -58,24 +54,6 @@ const contract = async (
58
54
  'Make an Orchestration Account',
59
55
  );
60
56
  },
61
- makeSendICQQueryInvitation() {
62
- return zcf.makeInvitation(
63
- orchFns.sendICQQuery,
64
- 'Submit a query to a remote chain',
65
- );
66
- },
67
- makeAccountAndSendBalanceQueryInvitation() {
68
- return zcf.makeInvitation(
69
- orchFns.makeAccountAndSendBalanceQuery,
70
- 'Make an account and submit a balance query',
71
- );
72
- },
73
- makeSendLocalQueryInvitation() {
74
- return zcf.makeInvitation(
75
- orchFns.sendLocalQuery,
76
- 'Submit a query to the local chain',
77
- );
78
- },
79
57
  },
80
58
  );
81
59
 
@@ -13,21 +13,7 @@ export function makePortfolioAccount(orch: Orchestrator, { makePortfolioHolder }
13
13
  MakeInvitation<IA extends unknown[]>(chainName: string, action: string, invitationArgs: IA): Promise<Invitation<unknown, IA>>;
14
14
  }>;
15
15
  }>>;
16
- export function sendICQQuery(orch: Orchestrator, _ctx: any, seat: ZCFSeat, { chainName, msgs }: {
17
- chainName: string;
18
- msgs: Parameters<ICQQueryFunction>[0];
19
- }): Promise<string>;
20
- export function makeAccountAndSendBalanceQuery(orch: Orchestrator, _ctx: any, seat: ZCFSeat, { chainName, denom }: {
21
- chainName: string;
22
- denom: DenomArg;
23
- }): Promise<string>;
24
- export function sendLocalQuery(orch: Orchestrator, _ctx: any, seat: ZCFSeat, { msgs }: {
25
- msgs: Parameters<QueryManyFn>[0];
26
- }): Promise<string>;
27
16
  import type { Orchestrator } from '@agoric/orchestration';
28
17
  import type { MakePortfolioHolder } from '../exos/portfolio-holder-kit.js';
29
18
  import type { ResolvedPublicTopic } from '@agoric/zoe/src/contractSupport/topics.js';
30
- import type { ICQQueryFunction } from '@agoric/orchestration';
31
- import type { DenomArg } from '@agoric/orchestration';
32
- import type { QueryManyFn } from '@agoric/vats/src/localchain.js';
33
19
  //# sourceMappingURL=basic-flows.flows.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"basic-flows.flows.d.ts","sourceRoot":"","sources":["basic-flows.flows.js"],"names":[],"mappings":"AA+BO,sCALI,YAAY,QACZ,GAAG,QACH,OAAO,iBACP;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,0EAQ/B;AAgBM,2CANI,YAAY,2BAEpB;IAAiC,mBAAmB,EAA5C,mBAAmB;CAC3B,QAAQ,OAAO,kBACP;IAAE,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE;;;;;;;IAkClC;AAeM,mCALI,YAAY,QACZ,GAAG,QACH,OAAO,uBACP;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAA;CAAE,mBActE;AAeM,qDALI,YAAY,QACZ,GAAG,QACH,OAAO,wBACP;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,mBAiBhD;AAiBM,qCAPI,YAAY,QACZ,GAAG,QACH,OAAO,YACP;IACV,IAAQ,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,mBASH;kCA3J+J,uBAAuB;yCAMjJ,iCAAiC;yCALjC,2CAA2C;sCAD+E,uBAAuB;8BAAvB,uBAAuB;iCAGzJ,gCAAgC"}
1
+ {"version":3,"file":"basic-flows.flows.d.ts","sourceRoot":"","sources":["basic-flows.flows.js"],"names":[],"mappings":"AA0BO,sCALI,YAAY,QACZ,GAAG,QACH,OAAO,iBACP;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,0EAS/B;AAgBM,2CANI,YAAY,2BAEpB;IAAiC,mBAAmB,EAA5C,mBAAmB;CAC3B,QAAQ,OAAO,kBACP;IAAE,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE;;;;;;;IAmClC;kCAvEuE,uBAAuB;yCAEzD,iCAAiC;yCADjC,2CAA2C"}
@@ -1,22 +1,17 @@
1
1
  /**
2
- * @file Primarily a testing fixture, but also serves as an example of how to
3
- * leverage basic functionality of the Orchestration API with async-flow.
2
+ * @file An example of how to leverage basic functionality of the Orchestration
3
+ * API with async-flow. Each offer returning a ContinuingOfferResult, with
4
+ * invitationMakers for Delegate, WithdrawRewards, Transfer, etc.
4
5
  */
5
6
  import { makeTracer } from '@agoric/internal';
6
- import { Fail, q } from '@endo/errors';
7
7
  import { M, mustMatch } from '@endo/patterns';
8
8
 
9
9
  const trace = makeTracer('BasicFlows');
10
10
 
11
11
  /**
12
- * @import {Chain, DenomArg, OrchestrationAccount, OrchestrationFlow, Orchestrator, KnownChains, OrchestrationAccountI, ICQQueryFunction, CosmosChainInfo} from '@agoric/orchestration';
12
+ * @import {OrchestrationAccount, OrchestrationFlow, Orchestrator} from '@agoric/orchestration';
13
13
  * @import {ResolvedPublicTopic} from '@agoric/zoe/src/contractSupport/topics.js';
14
- * @import {JsonSafe} from '@agoric/cosmic-proto';
15
- * @import {QueryManyFn} from '@agoric/vats/src/localchain.js';
16
- * @import {RequestQuery} from '@agoric/cosmic-proto/tendermint/abci/types.js';
17
- * @import {OrchestrationPowers} from '../utils/start-helper.js';
18
14
  * @import {MakePortfolioHolder} from '../exos/portfolio-holder-kit.js';
19
- * @import {OrchestrationTools} from '../utils/start-helper.js';
20
15
  */
21
16
 
22
17
  /**
@@ -30,6 +25,7 @@ const trace = makeTracer('BasicFlows');
30
25
  * @param {{ chainName: string }} offerArgs
31
26
  */
32
27
  export const makeOrchAccount = async (orch, _ctx, seat, { chainName }) => {
28
+ trace('makeOrchAccount', chainName);
33
29
  seat.exit(); // no funds exchanged
34
30
  mustMatch(chainName, M.string());
35
31
  const remoteChain = await orch.getChain(chainName);
@@ -57,6 +53,7 @@ export const makePortfolioAccount = async (
57
53
  seat,
58
54
  { chainNames },
59
55
  ) => {
56
+ trace('makePortfolioAccount', chainNames);
60
57
  seat.exit(); // no funds exchanged
61
58
  mustMatch(chainNames, M.arrayOf(M.string()));
62
59
  const allChains = await Promise.all(chainNames.map(n => orch.getChain(n)));
@@ -85,84 +82,3 @@ export const makePortfolioAccount = async (
85
82
  return portfolioHolder.asContinuingOffer();
86
83
  };
87
84
  harden(makePortfolioAccount);
88
-
89
- /**
90
- * Send a query to a remote chain and get the response back in an offer result.
91
- * This invitation is for testing only. In a real scenario it's better to use an
92
- * RPC or API client and vstorage to retrieve data for a frontend. Queries
93
- * should only be leveraged if contract logic requires it.
94
- *
95
- * @satisfies {OrchestrationFlow}
96
- * @param {Orchestrator} orch
97
- * @param {any} _ctx
98
- * @param {ZCFSeat} seat
99
- * @param {{ chainName: string; msgs: Parameters<ICQQueryFunction>[0] }} offerArgs
100
- */
101
- export const sendICQQuery = async (orch, _ctx, seat, { chainName, msgs }) => {
102
- seat.exit(); // no funds exchanged
103
- mustMatch(chainName, M.string());
104
- if (chainName === 'agoric') throw Fail`ICQ not supported on local chain`;
105
- const remoteChain =
106
- /** @type {Chain<CosmosChainInfo & { icqEnabled: true }>} */ (
107
- await orch.getChain(chainName)
108
- );
109
- const queryResponse = await remoteChain.query(msgs);
110
- trace('SendICQQuery response:', queryResponse);
111
- // `quote` to ensure offerResult (array) is visible in smart-wallet
112
- return q(queryResponse).toString();
113
- };
114
- harden(sendICQQuery);
115
-
116
- /**
117
- * Create an account and send a query and get the response back in an offer
118
- * result. Like `sendQuery`, this invitation is for testing only. In a real
119
- * scenario it doesn't make much sense to send a query immediately after the
120
- * account is created - it won't have any funds.
121
- *
122
- * @satisfies {OrchestrationFlow}
123
- * @param {Orchestrator} orch
124
- * @param {any} _ctx
125
- * @param {ZCFSeat} seat
126
- * @param {{ chainName: string; denom: DenomArg }} offerArgs
127
- */
128
- export const makeAccountAndSendBalanceQuery = async (
129
- orch,
130
- _ctx,
131
- seat,
132
- { chainName, denom },
133
- ) => {
134
- seat.exit(); // no funds exchanged
135
- mustMatch(chainName, M.string());
136
- if (chainName === 'agoric') throw Fail`ICQ not supported on local chain`;
137
- const remoteChain = await orch.getChain(chainName);
138
- const orchAccount = await remoteChain.makeAccount();
139
- const queryResponse = await orchAccount.getBalance(denom);
140
- trace('ICQ Balance Query response:', queryResponse);
141
- // `quote` to ensure offerResult (record) is visible in smart-wallet
142
- return q(queryResponse).toString();
143
- };
144
- harden(makeAccountAndSendBalanceQuery);
145
-
146
- /**
147
- * Send a query to the local chain and get the response back in an offer result.
148
- * This invitation is for testing only. In a real scenario it's better to use an
149
- * RPC or API client and vstorage to retrieve data for a frontend. Queries
150
- * should only be leveraged if contract logic requires it.
151
- *
152
- * @satisfies {OrchestrationFlow}
153
- * @param {Orchestrator} orch
154
- * @param {any} _ctx
155
- * @param {ZCFSeat} seat
156
- * @param {{
157
- * msgs: Parameters<QueryManyFn>[0];
158
- * }} offerArgs
159
- */
160
- export const sendLocalQuery = async (orch, _ctx, seat, { msgs }) => {
161
- seat.exit(); // no funds exchanged
162
- const remoteChain = await orch.getChain('agoric');
163
- const queryResponse = await remoteChain.query(msgs);
164
- trace('Local Query response:', queryResponse);
165
- // `quote` to ensure offerResult (array) is visible in smart-wallet
166
- return q(queryResponse).toString();
167
- };
168
- harden(sendLocalQuery);
@@ -28,10 +28,10 @@ export function start(zcf: ZCF<StakeIcaTerms>, privateArgs: {
28
28
  getPublicTopics(): import("@agoric/vow").Vow<Record<string, import("@agoric/zoe/src/contractSupport").ResolvedPublicTopic<unknown>> extends import("@endo/pass-style").Passable ? import("@endo/pass-style").Passable & Record<string, import("@agoric/zoe/src/contractSupport").ResolvedPublicTopic<unknown>> : import("@agoric/async-flow").HostInterface<Record<string, import("@agoric/zoe/src/contractSupport").ResolvedPublicTopic<unknown>>>>;
29
29
  getAddress(): import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").ChainAddress>;
30
30
  delegate(validator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): import("@agoric/vow").Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
31
- getBalances(): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
32
31
  redelegate(srcValidator: import("../cosmos-api.js").CosmosValidatorAddress, dstValidator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): import("@agoric/vow").Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
33
32
  withdrawReward(validator: import("../cosmos-api.js").CosmosValidatorAddress): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
34
33
  getBalance(denom: import("../orchestration-api.js").DenomArg): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount>>;
34
+ getBalances(): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
35
35
  send(toAccount: import("../orchestration-api.js").ChainAddress, amounts: import("../orchestration-api.js").AmountArg): import("@agoric/vow").Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
36
36
  sendAll(toAccount: import("../orchestration-api.js").ChainAddress, amounts: import("../orchestration-api.js").AmountArg[]): import("@agoric/vow").Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
37
37
  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 extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
@@ -1,6 +1,6 @@
1
1
  # Exo structure
2
2
 
3
- Last verified 2024-07-31
3
+ Last verified 2024-08-30
4
4
 
5
5
  ```mermaid
6
6
  classDiagram
@@ -117,6 +117,7 @@ classDiagram
117
117
  executeEncodedTx()
118
118
  getAddress()
119
119
  getBalance()
120
+ getBalances()
120
121
  getPublicTopics()
121
122
  redelegate()
122
123
  send()
@@ -72,6 +72,12 @@ export function prepareCosmosOrchestrationAccountKit(zone: Zone, { chainHub, mak
72
72
  */
73
73
  onFulfilled([result]: JsonSafe<ResponseQuery>[]): DenomAmount;
74
74
  };
75
+ allBalancesQueryWatcher: {
76
+ /**
77
+ * @param {JsonSafe<ResponseQuery>[]} results
78
+ */
79
+ onFulfilled([result]: JsonSafe<ResponseQuery>[]): DenomAmount[];
80
+ };
75
81
  undelegateWatcher: {
76
82
  /**
77
83
  * @param {string} result
@@ -157,14 +163,14 @@ export function prepareCosmosOrchestrationAccountKit(zone: Zone, { chainHub, mak
157
163
  getAddress(): import("@agoric/async-flow").HostInterface<ChainAddress>;
158
164
  /** @type {HostOf<StakingAccountActions['delegate']>} */
159
165
  delegate(validator: CosmosValidatorAddress, amount: AmountArg): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
160
- /** @type {HostOf<OrchestrationAccountI['getBalances']>} */
161
- getBalances(): Vow<DenomAmount[] extends import("@endo/pass-style").Passable ? DenomAmount[] : import("@agoric/async-flow").HostInterface<DenomAmount[]>>;
162
166
  /** @type {HostOf<StakingAccountActions['redelegate']>} */
163
167
  redelegate(srcValidator: CosmosValidatorAddress, dstValidator: CosmosValidatorAddress, amount: AmountArg): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
164
168
  /** @type {HostOf<StakingAccountActions['withdrawReward']>} */
165
169
  withdrawReward(validator: CosmosValidatorAddress): Vow<DenomAmount[] extends import("@endo/pass-style").Passable ? DenomAmount[] : import("@agoric/async-flow").HostInterface<DenomAmount[]>>;
166
170
  /** @type {HostOf<OrchestrationAccountI['getBalance']>} */
167
171
  getBalance(denom: import("../orchestration-api.js").DenomArg): Vow<DenomAmount extends import("@endo/pass-style").Passable ? DenomAmount : import("@agoric/async-flow").HostInterface<DenomAmount>>;
172
+ /** @type {HostOf<OrchestrationAccountI['getBalances']>} */
173
+ getBalances(): Vow<DenomAmount[] extends import("@endo/pass-style").Passable ? DenomAmount[] : import("@agoric/async-flow").HostInterface<DenomAmount[]>>;
168
174
  /** @type {HostOf<OrchestrationAccountI['send']>} */
169
175
  send(toAccount: ChainAddress, amounts: AmountArg): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
170
176
  /** @type {HostOf<OrchestrationAccountI['sendAll']>} */
@@ -1 +1 @@
1
- {"version":3,"file":"cosmos-orchestration-account.d.ts","sourceRoot":"","sources":["cosmos-orchestration-account.js"],"names":[],"mappings":"AA2DA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;GAKG;AAEH,mCAAmC;AACnC;;;;;;;;;;;;;;;;;GAeG;AAmBI,2DARI,IAAI,gGAEZ;IAAyB,QAAQ,EAAzB,QAAQ;IACgB,eAAe,EAAvC,eAAe;IACc,YAAY,EAAzC,OAAO,YAAY,CAAC;IACH,QAAQ,EAAzB,QAAQ;IACI,GAAG,EAAf,GAAG;CACb;kBA0Ec,YAAY;eACZ,MAAM;kBACN,eAAe;mBACf,gBAAgB;;aAEhB,UAAU;iBACV,OAAO,WAAW,CAAC;mBACnB,aAAa,GAAG,SAAS;WACzB,OAAO,YAAY,CAAC;;;QA6B3B,wDAAwD;;;QAWxD;;;WAGG;6BAFQ,SAAS,GACP,IAAI;;;QAOjB;;WAEG;8BADQ,SAAS,aAAa,CAAC,EAAE;;;QAYpC;;WAEG;4BADQ,MAAM;;IAgBnB;;;OAGG;;QAED,uDAAuD;4BAA3C,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;QAO5C,6BAA6B;4BAAjB,MAAM;;;QAYlB;;;;;;;;;;WAUG;6DATQ,CACV;YAAM,eAAe,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAA;SAAE,EAC7D,MAAU,CACP,gCACO;YACV,WAAe,EAAE,YAAY,CAAC;YAC9B,IAAQ,CAAC,EAAE,qBAAqB,CAAC;YACjC,KAAS,EAAE,IAAI,CAAC;SACb;;;QA2BJ;;;WAGG;4BAFQ,sBAAsB,UACtB,SAAS;QAUpB;;;;WAIG;iCAHQ,sBAAsB,gBACtB,sBAAsB,UACtB,SAAS;QAYpB,gDAAgD;kCAApC,sBAAsB;QASlC,kEAAkE;gC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,YAAgB,EAAE,eAAe,CAAC;IAClC,aAAiB,EAAE,gBAAgB,CAAC;IACpC,aAAiB,EAAE,aAAa,GAAG,SAAS,CAAC;IAC7C,SAAa,EAAE,MAAM,CAAC;IACtB,KAAS,EAAE,OAAO,YAAY,CAAC,CAAC;CAC7B;qDAIS;IACZ,YAAgB,EAAE,eAAe,CAAC;IAClC,aAAiB,EAAE,gBAAgB,CAAC;CACjC;4CA6pBS,UAAU,CACtB,UAAc,CAAC,OAAO,oCAAoC,CAAC,CACxD;yCA8BU,6BAA6B,CAAC,QAAQ,CAAC;0BA9tB9B,cAAc;8BARuK,aAAa;qCAC1K,6CAA6C;kCAK7D,cAAc;4BAFpB,kBAAkB;8BAGX,aAAa;kCAP+J,aAAa;qCAYrK,iCAAiC;sCAAjC,iCAAiC;gCAZuH,aAAa;mCAAb,aAAa;+BAAb,aAAa;0BAElM,kDAAkD;mCAOzC,+CAA+C;8BACpD,sBAAsB;iCAV2J,aAAa;yBAOzL,aAAa;uCAP+J,aAAa;2CAAb,aAAa;4CAAb,aAAa;gCAG5L,wDAAwD;iCAFtC,6CAA6C"}
@@ -3,6 +3,8 @@ import { toRequestQueryJson } from '@agoric/cosmic-proto';
3
3
  import {
4
4
  QueryBalanceRequest,
5
5
  QueryBalanceResponse,
6
+ QueryAllBalancesRequest,
7
+ QueryAllBalancesResponse,
6
8
  } from '@agoric/cosmic-proto/cosmos/bank/v1beta1/query.js';
7
9
  import { MsgSend } from '@agoric/cosmic-proto/cosmos/bank/v1beta1/tx.js';
8
10
  import {
@@ -22,7 +24,7 @@ import { Shape as NetworkShape } from '@agoric/network';
22
24
  import { M } from '@agoric/vat-data';
23
25
  import { VowShape } from '@agoric/vow';
24
26
  import { decodeBase64 } from '@endo/base64';
25
- import { Fail } from '@endo/errors';
27
+ import { Fail, makeError, q } from '@endo/errors';
26
28
  import { E } from '@endo/far';
27
29
  import {
28
30
  AmountArgShape,
@@ -146,6 +148,11 @@ export const prepareCosmosOrchestrationAccountKit = (
146
148
  .optional(M.arrayOf(M.undefined())) // empty context
147
149
  .returns(M.or(M.record(), M.undefined())),
148
150
  }),
151
+ allBalancesQueryWatcher: M.interface('allBalancesQueryWatcher', {
152
+ onFulfilled: M.call(M.arrayOf(M.record())).returns(
153
+ M.arrayOf(M.record()),
154
+ ),
155
+ }),
149
156
  undelegateWatcher: M.interface('undelegateWatcher', {
150
157
  onFulfilled: M.call(M.string())
151
158
  .optional(M.arrayOf(M.undefined())) // empty context
@@ -259,6 +266,29 @@ export const prepareCosmosOrchestrationAccountKit = (
259
266
  return harden(toDenomAmount(balance));
260
267
  },
261
268
  },
269
+ allBalancesQueryWatcher: {
270
+ /**
271
+ * @param {JsonSafe<ResponseQuery>[]} results
272
+ */
273
+ onFulfilled([result]) {
274
+ let response;
275
+ try {
276
+ response = QueryAllBalancesResponse.decode(
277
+ // note: an empty string for result.key is a valid result
278
+ decodeBase64(result.key),
279
+ );
280
+ } catch (cause) {
281
+ throw makeError(
282
+ `Error parsing QueryAllBalances result ${q(result)}`,
283
+ undefined,
284
+ { cause },
285
+ );
286
+ }
287
+ const { balances } = response;
288
+ if (!balances) throw Fail`Result lacked balances key: ${q(result)}`;
289
+ return harden(balances.map(coin => toDenomAmount(coin)));
290
+ },
291
+ },
262
292
  undelegateWatcher: {
263
293
  /**
264
294
  * @param {string} result
@@ -514,11 +544,7 @@ export const prepareCosmosOrchestrationAccountKit = (
514
544
  return watch(results, this.facets.returnVoidWatcher);
515
545
  });
516
546
  },
517
- /** @type {HostOf<OrchestrationAccountI['getBalances']>} */
518
- getBalances() {
519
- // TODO https://github.com/Agoric/agoric-sdk/issues/9610
520
- return asVow(() => Fail`not yet implemented`);
521
- },
547
+
522
548
  /** @type {HostOf<StakingAccountActions['redelegate']>} */
523
549
  redelegate(srcValidator, dstValidator, amount) {
524
550
  return asVow(() => {
@@ -565,7 +591,7 @@ export const prepareCosmosOrchestrationAccountKit = (
565
591
  return asVow(() => {
566
592
  const { chainAddress, icqConnection } = this.state;
567
593
  if (!icqConnection) {
568
- throw Fail`Queries not available for chain ${chainAddress.chainId}`;
594
+ throw Fail`Queries not available for chain ${q(chainAddress.chainId)}`;
569
595
  }
570
596
  const results = E(icqConnection).query([
571
597
  toRequestQueryJson(
@@ -579,6 +605,24 @@ export const prepareCosmosOrchestrationAccountKit = (
579
605
  });
580
606
  },
581
607
 
608
+ /** @type {HostOf<OrchestrationAccountI['getBalances']>} */
609
+ getBalances() {
610
+ return asVow(() => {
611
+ const { chainAddress, icqConnection } = this.state;
612
+ if (!icqConnection) {
613
+ throw Fail`Queries not available for chain ${q(chainAddress.chainId)}`;
614
+ }
615
+ const results = E(icqConnection).query([
616
+ toRequestQueryJson(
617
+ QueryAllBalancesRequest.toProtoMsg({
618
+ address: chainAddress.value,
619
+ }),
620
+ ),
621
+ ]);
622
+ return watch(results, this.facets.allBalancesQueryWatcher);
623
+ });
624
+ },
625
+
582
626
  /** @type {HostOf<OrchestrationAccountI['send']>} */
583
627
  send(toAccount, amount) {
584
628
  return asVow(() => {
@@ -34,10 +34,10 @@ export function prepareRemoteChainFacade(zone: Zone, powers: RemoteChainFacadePo
34
34
  getPublicTopics(): Vow<Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>> extends import("@endo/pass-style").Passable ? import("@endo/pass-style").Passable & Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>> : import("@agoric/async-flow").HostInterface<Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>>>>;
35
35
  getAddress(): import("@agoric/async-flow").HostInterface<ChainAddress>;
36
36
  delegate(validator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
37
- getBalances(): Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
38
37
  redelegate(srcValidator: import("../cosmos-api.js").CosmosValidatorAddress, dstValidator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
39
38
  withdrawReward(validator: import("../cosmos-api.js").CosmosValidatorAddress): Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
40
39
  getBalance(denom: import("../orchestration-api.js").DenomArg): Vow<import("../orchestration-api.js").DenomAmount extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount>>;
40
+ getBalances(): Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
41
41
  send(toAccount: ChainAddress, amounts: import("../orchestration-api.js").AmountArg): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
42
42
  sendAll(toAccount: ChainAddress, amounts: import("../orchestration-api.js").AmountArg[]): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
43
43
  transfer(amount: import("../orchestration-api.js").AmountArg, destination: ChainAddress, opts?: import("../cosmos-api.js").IBCMsgTransferOptions | undefined): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
@@ -66,10 +66,10 @@ export function prepareRemoteChainFacade(zone: Zone, powers: RemoteChainFacadePo
66
66
  getPublicTopics(): Vow<Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>> extends import("@endo/pass-style").Passable ? import("@endo/pass-style").Passable & Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>> : import("@agoric/async-flow").HostInterface<Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>>>>;
67
67
  getAddress(): import("@agoric/async-flow").HostInterface<ChainAddress>;
68
68
  delegate(validator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
69
- getBalances(): Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
70
69
  redelegate(srcValidator: import("../cosmos-api.js").CosmosValidatorAddress, dstValidator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
71
70
  withdrawReward(validator: import("../cosmos-api.js").CosmosValidatorAddress): Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
72
71
  getBalance(denom: import("../orchestration-api.js").DenomArg): Vow<import("../orchestration-api.js").DenomAmount extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount>>;
72
+ getBalances(): Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
73
73
  send(toAccount: ChainAddress, amounts: import("../orchestration-api.js").AmountArg): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
74
74
  sendAll(toAccount: ChainAddress, amounts: import("../orchestration-api.js").AmountArg[]): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
75
75
  transfer(amount: import("../orchestration-api.js").AmountArg, destination: ChainAddress, opts?: import("../cosmos-api.js").IBCMsgTransferOptions | undefined): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
@@ -100,10 +100,10 @@ export function prepareRemoteChainFacade(zone: Zone, powers: RemoteChainFacadePo
100
100
  getPublicTopics(): Vow<Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>> extends import("@endo/pass-style").Passable ? import("@endo/pass-style").Passable & Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>> : import("@agoric/async-flow").HostInterface<Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>>>>;
101
101
  getAddress(): import("@agoric/async-flow").HostInterface<ChainAddress>;
102
102
  delegate(validator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
103
- getBalances(): Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
104
103
  redelegate(srcValidator: import("../cosmos-api.js").CosmosValidatorAddress, dstValidator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
105
104
  withdrawReward(validator: import("../cosmos-api.js").CosmosValidatorAddress): Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
106
105
  getBalance(denom: import("../orchestration-api.js").DenomArg): Vow<import("../orchestration-api.js").DenomAmount extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount>>;
106
+ getBalances(): Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
107
107
  send(toAccount: ChainAddress, amounts: import("../orchestration-api.js").AmountArg): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
108
108
  sendAll(toAccount: ChainAddress, amounts: import("../orchestration-api.js").AmountArg[]): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
109
109
  transfer(amount: import("../orchestration-api.js").AmountArg, destination: ChainAddress, opts?: import("../cosmos-api.js").IBCMsgTransferOptions | undefined): Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
@@ -0,0 +1,3 @@
1
+ # Fixtures
2
+
3
+ This directory contains contracts used for testing. They are NOT representative of patterns we'd like to use in production, and only exist to facilitate testing.
@@ -0,0 +1,24 @@
1
+ export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: OrchestrationPowers & {
2
+ marshaller: Marshaller;
3
+ }, baggage: import("@agoric/vat-data").Baggage) => Promise<{
4
+ publicFacet: import("@endo/exo").Guarded<{
5
+ makeSendICQQueryInvitation(): Promise<Invitation<import("@agoric/vow").Vow<string>, {
6
+ chainName: string;
7
+ msgs: Parameters<import("../cosmos-api.js").ICQQueryFunction>[0];
8
+ }>>;
9
+ makeAccountAndGetBalanceQueryInvitation(): Promise<Invitation<import("@agoric/vow").Vow<string>, {
10
+ chainName: string;
11
+ denom: import("../orchestration-api.js").DenomArg;
12
+ }>>;
13
+ makeAccountAndGetBalancesQueryInvitation(): Promise<Invitation<import("@agoric/vow").Vow<string>, {
14
+ chainName: string;
15
+ denom: import("../orchestration-api.js").DenomArg;
16
+ }>>;
17
+ makeSendLocalQueryInvitation(): Promise<Invitation<import("@agoric/vow").Vow<string>, {
18
+ msgs: Parameters<import("@agoric/vats/src/localchain.js").QueryManyFn>[0];
19
+ }>>;
20
+ }>;
21
+ }>;
22
+ export type QueryFlowsSF = typeof start;
23
+ import type { OrchestrationPowers } from '..//utils/start-helper.js';
24
+ //# sourceMappingURL=query-flows.contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-flows.contract.d.ts","sourceRoot":"","sources":["query-flows.contract.js"],"names":[],"mappings":"AAkEA;gBAjDiB,UAAU;;;;;;;;;;;;;;;;;;;GAiDsB;2BAGnC,OAAO,KAAK;yCA3DY,2BAA2B"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @file Testing fixture for Local and Interchain Queries
3
+ */
4
+ import { InvitationShape } from '@agoric/zoe/src/typeGuards.js';
5
+ import { M } from '@endo/patterns';
6
+ import { withOrchestration } from '../utils/start-helper.js';
7
+ import * as flows from './query-flows.flows.js';
8
+
9
+ /**
10
+ * @import {Zone} from '@agoric/zone';
11
+ * @import {OrchestrationPowers} from '..//utils/start-helper.js';
12
+ * @import {OrchestrationTools} from '../utils/start-helper.js';
13
+ */
14
+
15
+ /**
16
+ * @param {ZCF} zcf
17
+ * @param {OrchestrationPowers & {
18
+ * marshaller: Marshaller;
19
+ * }} _privateArgs
20
+ * @param {Zone} zone
21
+ * @param {OrchestrationTools} tools
22
+ */
23
+ const contract = async (zcf, _privateArgs, zone, { orchestrateAll }) => {
24
+ const orchFns = orchestrateAll(flows, {});
25
+
26
+ const publicFacet = zone.exo(
27
+ 'Query Flows Public Facet',
28
+ M.interface('Query Flows PF', {
29
+ makeSendICQQueryInvitation: M.callWhen().returns(InvitationShape),
30
+ makeAccountAndGetBalanceQueryInvitation:
31
+ M.callWhen().returns(InvitationShape),
32
+ makeAccountAndGetBalancesQueryInvitation:
33
+ M.callWhen().returns(InvitationShape),
34
+ makeSendLocalQueryInvitation: M.callWhen().returns(InvitationShape),
35
+ }),
36
+ {
37
+ makeSendICQQueryInvitation() {
38
+ return zcf.makeInvitation(
39
+ orchFns.sendICQQuery,
40
+ 'Submit a query to a remote chain',
41
+ );
42
+ },
43
+ makeAccountAndGetBalanceQueryInvitation() {
44
+ return zcf.makeInvitation(
45
+ orchFns.makeAccountAndGetBalanceQuery,
46
+ 'Make an account and submit a balance query',
47
+ );
48
+ },
49
+ makeAccountAndGetBalancesQueryInvitation() {
50
+ return zcf.makeInvitation(
51
+ orchFns.makeAccountAndGetBalancesQuery,
52
+ 'Make an account and submit a balance query',
53
+ );
54
+ },
55
+ makeSendLocalQueryInvitation() {
56
+ return zcf.makeInvitation(
57
+ orchFns.sendLocalQuery,
58
+ 'Submit a query to the local chain',
59
+ );
60
+ },
61
+ },
62
+ );
63
+
64
+ return { publicFacet };
65
+ };
66
+
67
+ export const start = withOrchestration(contract);
68
+ harden(start);
69
+
70
+ /** @typedef {typeof start} QueryFlowsSF */
@@ -0,0 +1,20 @@
1
+ export function sendICQQuery(orch: Orchestrator, _ctx: any, seat: ZCFSeat, { chainName, msgs }: {
2
+ chainName: string;
3
+ msgs: Parameters<ICQQueryFunction>[0];
4
+ }): Promise<string>;
5
+ export function makeAccountAndGetBalanceQuery(orch: Orchestrator, _ctx: any, seat: ZCFSeat, { chainName, denom }: {
6
+ chainName: string;
7
+ denom: DenomArg;
8
+ }): Promise<string>;
9
+ export function makeAccountAndGetBalancesQuery(orch: Orchestrator, _ctx: any, seat: ZCFSeat, { chainName }: {
10
+ chainName: string;
11
+ denom: DenomArg;
12
+ }): Promise<string>;
13
+ export function sendLocalQuery(orch: Orchestrator, _ctx: any, seat: ZCFSeat, { msgs }: {
14
+ msgs: Parameters<QueryManyFn>[0];
15
+ }): Promise<string>;
16
+ import type { Orchestrator } from '@agoric/orchestration';
17
+ import type { ICQQueryFunction } from '@agoric/orchestration';
18
+ import type { DenomArg } from '@agoric/orchestration';
19
+ import type { QueryManyFn } from '@agoric/vats/src/localchain.js';
20
+ //# sourceMappingURL=query-flows.flows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-flows.flows.d.ts","sourceRoot":"","sources":["query-flows.flows.js"],"names":[],"mappings":"AA0BO,mCALI,YAAY,QACZ,GAAG,QACH,OAAO,uBACP;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAA;CAAE,mBActE;AAeM,oDALI,YAAY,QACZ,GAAG,QACH,OAAO,wBACP;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,mBAiBhD;AAeM,qDALI,YAAY,QACZ,GAAG,QACH,OAAO,iBACP;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,mBAiBhD;AAiBM,qCAPI,YAAY,QACZ,GAAG,QACH,OAAO,YACP;IACV,IAAQ,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,mBASH;kCAhHqG,uBAAuB;sCAAvB,uBAAuB;8BAAvB,uBAAuB;iCAC/F,gCAAgC"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * @file Testing fixture for Local and Interchain Queries
3
+ */
4
+ import { makeTracer } from '@agoric/internal';
5
+ import { Fail, q } from '@endo/errors';
6
+ import { M, mustMatch } from '@endo/patterns';
7
+
8
+ const trace = makeTracer('BasicFlows');
9
+
10
+ /**
11
+ * @import {Chain, DenomArg, OrchestrationFlow, Orchestrator, ICQQueryFunction, CosmosChainInfo} from '@agoric/orchestration';
12
+ * @import {QueryManyFn} from '@agoric/vats/src/localchain.js';
13
+ */
14
+
15
+ /**
16
+ * Send a query to a remote chain and get the response back in an offer result.
17
+ * This invitation is for testing only. In a real scenario it's better to use an
18
+ * RPC or API client and vstorage to retrieve data for a frontend. Queries
19
+ * should only be leveraged if contract logic requires it.
20
+ *
21
+ * @satisfies {OrchestrationFlow}
22
+ * @param {Orchestrator} orch
23
+ * @param {any} _ctx
24
+ * @param {ZCFSeat} seat
25
+ * @param {{ chainName: string; msgs: Parameters<ICQQueryFunction>[0] }} offerArgs
26
+ */
27
+ export const sendICQQuery = async (orch, _ctx, seat, { chainName, msgs }) => {
28
+ seat.exit(); // no funds exchanged
29
+ mustMatch(chainName, M.string());
30
+ if (chainName === 'agoric') throw Fail`ICQ not supported on local chain`;
31
+ const remoteChain =
32
+ /** @type {Chain<CosmosChainInfo & { icqEnabled: true }>} */ (
33
+ await orch.getChain(chainName)
34
+ );
35
+ const queryResponse = await remoteChain.query(msgs);
36
+ trace('SendICQQuery response:', queryResponse);
37
+ // `quote` to ensure offerResult (array) is visible in smart-wallet
38
+ return q(queryResponse).toString();
39
+ };
40
+ harden(sendICQQuery);
41
+
42
+ /**
43
+ * Create an account, send a balance query, and get the response back in an
44
+ * offer result. Like `sendQuery`, this invitation is for testing only. In a
45
+ * real scenario it doesn't make much sense to send a query immediately after
46
+ * the account is created - it won't have any funds.
47
+ *
48
+ * @satisfies {OrchestrationFlow}
49
+ * @param {Orchestrator} orch
50
+ * @param {any} _ctx
51
+ * @param {ZCFSeat} seat
52
+ * @param {{ chainName: string; denom: DenomArg }} offerArgs
53
+ */
54
+ export const makeAccountAndGetBalanceQuery = async (
55
+ orch,
56
+ _ctx,
57
+ seat,
58
+ { chainName, denom },
59
+ ) => {
60
+ seat.exit(); // no funds exchanged
61
+ mustMatch(chainName, M.string());
62
+ if (chainName === 'agoric') throw Fail`ICQ not supported on local chain`;
63
+ const remoteChain = await orch.getChain(chainName);
64
+ const orchAccount = await remoteChain.makeAccount();
65
+ const queryResponse = await orchAccount.getBalance(denom);
66
+ trace('ICQ Balance Query response:', queryResponse);
67
+ // `quote` to ensure offerResult (record) is visible in smart-wallet
68
+ return q(queryResponse).toString();
69
+ };
70
+ harden(makeAccountAndGetBalanceQuery);
71
+
72
+ /**
73
+ * Create an account, send an all balances query, and get the response back in
74
+ * an offer result. Like `sendQuery`, this invitation is for testing only. In a
75
+ * real scenario it doesn't make much sense to send a query immediately after
76
+ * the account is created - it won't have any funds.
77
+ *
78
+ * @satisfies {OrchestrationFlow}
79
+ * @param {Orchestrator} orch
80
+ * @param {any} _ctx
81
+ * @param {ZCFSeat} seat
82
+ * @param {{ chainName: string; denom: DenomArg }} offerArgs
83
+ */
84
+ export const makeAccountAndGetBalancesQuery = async (
85
+ orch,
86
+ _ctx,
87
+ seat,
88
+ { chainName },
89
+ ) => {
90
+ seat.exit(); // no funds exchanged
91
+ mustMatch(chainName, M.string());
92
+ if (chainName === 'agoric') throw Fail`ICQ not supported on local chain`;
93
+ const remoteChain = await orch.getChain(chainName);
94
+ const orchAccount = await remoteChain.makeAccount();
95
+ const queryResponse = await orchAccount.getBalances();
96
+ trace('ICQ All Balances Query response:', queryResponse);
97
+ // `quote` to ensure offerResult (record) is visible in smart-wallet
98
+ return q(queryResponse).toString();
99
+ };
100
+ harden(makeAccountAndGetBalancesQuery);
101
+
102
+ /**
103
+ * Send a query to the local chain and get the response back in an offer result.
104
+ * This invitation is for testing only. In a real scenario it's better to use an
105
+ * RPC or API client and vstorage to retrieve data for a frontend. Queries
106
+ * should only be leveraged if contract logic requires it.
107
+ *
108
+ * @satisfies {OrchestrationFlow}
109
+ * @param {Orchestrator} orch
110
+ * @param {any} _ctx
111
+ * @param {ZCFSeat} seat
112
+ * @param {{
113
+ * msgs: Parameters<QueryManyFn>[0];
114
+ * }} offerArgs
115
+ */
116
+ export const sendLocalQuery = async (orch, _ctx, seat, { msgs }) => {
117
+ seat.exit(); // no funds exchanged
118
+ const remoteChain = await orch.getChain('agoric');
119
+ const queryResponse = await remoteChain.query(msgs);
120
+ trace('Local Query response:', queryResponse);
121
+ // `quote` to ensure offerResult (array) is visible in smart-wallet
122
+ return q(queryResponse).toString();
123
+ };
124
+ harden(sendLocalQuery);
@@ -14,10 +14,10 @@ export function startStakeAtom({ consume: { agoricNames, board, chainStorage, ch
14
14
  getPublicTopics(): import("@agoric/vow").Vow<Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>> extends import("@endo/pass-style").Passable ? import("@endo/pass-style").Passable & Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>> : import("@agoric/async-flow").HostInterface<Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>>>>;
15
15
  getAddress(): import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").ChainAddress>;
16
16
  delegate(validator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): import("@agoric/vow").Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
17
- getBalances(): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
18
17
  redelegate(srcValidator: import("../cosmos-api.js").CosmosValidatorAddress, dstValidator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): import("@agoric/vow").Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
19
18
  withdrawReward(validator: import("../cosmos-api.js").CosmosValidatorAddress): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
20
19
  getBalance(denom: import("../orchestration-api.js").DenomArg): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount>>;
20
+ getBalances(): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
21
21
  send(toAccount: import("../orchestration-api.js").ChainAddress, amounts: import("../orchestration-api.js").AmountArg): import("@agoric/vow").Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
22
22
  sendAll(toAccount: import("../orchestration-api.js").ChainAddress, amounts: import("../orchestration-api.js").AmountArg[]): import("@agoric/vow").Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
23
23
  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 extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
@@ -14,10 +14,10 @@ export function startStakeOsmo({ consume: { agoricNames, board, chainStorage, ch
14
14
  getPublicTopics(): import("@agoric/vow").Vow<Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>> extends import("@endo/pass-style").Passable ? import("@endo/pass-style").Passable & Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>> : import("@agoric/async-flow").HostInterface<Record<string, import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>>>>;
15
15
  getAddress(): import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").ChainAddress>;
16
16
  delegate(validator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): import("@agoric/vow").Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
17
- getBalances(): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
18
17
  redelegate(srcValidator: import("../cosmos-api.js").CosmosValidatorAddress, dstValidator: import("../cosmos-api.js").CosmosValidatorAddress, amount: import("../orchestration-api.js").AmountArg): import("@agoric/vow").Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
19
18
  withdrawReward(validator: import("../cosmos-api.js").CosmosValidatorAddress): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
20
19
  getBalance(denom: import("../orchestration-api.js").DenomArg): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount>>;
20
+ getBalances(): import("@agoric/vow").Vow<import("../orchestration-api.js").DenomAmount[] extends import("@endo/pass-style").Passable ? import("../orchestration-api.js").DenomAmount[] : import("@agoric/async-flow").HostInterface<import("../orchestration-api.js").DenomAmount[]>>;
21
21
  send(toAccount: import("../orchestration-api.js").ChainAddress, amounts: import("../orchestration-api.js").AmountArg): import("@agoric/vow").Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
22
22
  sendAll(toAccount: import("../orchestration-api.js").ChainAddress, amounts: import("../orchestration-api.js").AmountArg[]): import("@agoric/vow").Vow<void extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;
23
23
  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 extends import("@endo/pass-style").Passable ? void : import("@agoric/async-flow").HostInterface<void>>;