@agoric/orchestration 0.2.0-upgrade-17-dev-ec448b0.0 → 0.2.0-upgrade-18-dev-b9b8db4.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 (126) hide show
  1. package/index.d.ts +1 -1
  2. package/index.js +2 -1
  3. package/package.json +29 -28
  4. package/src/chain-info.d.ts +31 -387
  5. package/src/chain-info.d.ts.map +1 -1
  6. package/src/chain-info.js +10 -64
  7. package/src/cosmos-api.d.ts +21 -10
  8. package/src/cosmos-api.d.ts.map +1 -1
  9. package/src/cosmos-api.ts +33 -14
  10. package/src/examples/README.md +3 -4
  11. package/src/examples/auto-stake-it-tap-kit.d.ts.map +1 -1
  12. package/src/examples/auto-stake-it-tap-kit.js +4 -7
  13. package/src/examples/auto-stake-it.contract.d.ts +1 -1
  14. package/src/examples/auto-stake-it.flows.d.ts +1 -1
  15. package/src/examples/auto-stake-it.flows.d.ts.map +1 -1
  16. package/src/examples/basic-flows.contract.d.ts +1 -1
  17. package/src/examples/basic-flows.flows.d.ts +1 -1
  18. package/src/examples/send-anywhere.contract.d.ts +20 -2
  19. package/src/examples/send-anywhere.contract.d.ts.map +1 -1
  20. package/src/examples/send-anywhere.contract.js +34 -18
  21. package/src/examples/send-anywhere.flows.d.ts +7 -7
  22. package/src/examples/send-anywhere.flows.d.ts.map +1 -1
  23. package/src/examples/send-anywhere.flows.js +40 -20
  24. package/src/examples/shared.flows.d.ts +4 -0
  25. package/src/examples/shared.flows.d.ts.map +1 -0
  26. package/src/examples/shared.flows.js +21 -0
  27. package/src/examples/stake-bld.contract.d.ts +49 -0
  28. package/src/examples/stake-bld.contract.d.ts.map +1 -0
  29. package/src/examples/{stakeBld.contract.js → stake-bld.contract.js} +10 -1
  30. package/src/examples/stake-ica.contract.d.ts +126 -0
  31. package/src/examples/stake-ica.contract.d.ts.map +1 -0
  32. package/src/examples/{stakeIca.contract.js → stake-ica.contract.js} +6 -2
  33. package/src/examples/staking-combinations.contract.d.ts +1 -1
  34. package/src/examples/staking-combinations.contract.d.ts.map +1 -1
  35. package/src/examples/staking-combinations.contract.js +16 -13
  36. package/src/examples/staking-combinations.flows.d.ts +6 -9
  37. package/src/examples/staking-combinations.flows.d.ts.map +1 -1
  38. package/src/examples/staking-combinations.flows.js +19 -16
  39. package/src/examples/swap.contract.d.ts.map +1 -1
  40. package/src/examples/swap.contract.js +0 -1
  41. package/src/examples/unbond.contract.d.ts +1 -1
  42. package/src/examples/unbond.contract.d.ts.map +1 -1
  43. package/src/examples/unbond.contract.js +10 -5
  44. package/src/examples/unbond.flows.d.ts +4 -3
  45. package/src/examples/unbond.flows.d.ts.map +1 -1
  46. package/src/examples/unbond.flows.js +23 -31
  47. package/src/exos/chain-hub.d.ts +12 -4
  48. package/src/exos/chain-hub.d.ts.map +1 -1
  49. package/src/exos/chain-hub.js +28 -19
  50. package/src/exos/combine-invitation-makers.d.ts +1 -0
  51. package/src/exos/combine-invitation-makers.d.ts.map +1 -1
  52. package/src/exos/combine-invitation-makers.js +6 -0
  53. package/src/exos/cosmos-interchain-service.d.ts +20 -70
  54. package/src/exos/cosmos-interchain-service.d.ts.map +1 -1
  55. package/src/exos/cosmos-orchestration-account.d.ts +152 -47
  56. package/src/exos/cosmos-orchestration-account.d.ts.map +1 -1
  57. package/src/exos/cosmos-orchestration-account.js +355 -13
  58. package/src/exos/exo-interfaces.d.ts +3 -3
  59. package/src/exos/exo-interfaces.d.ts.map +1 -1
  60. package/src/exos/exo-interfaces.ts +3 -3
  61. package/src/exos/ica-account-kit.d.ts +2 -2
  62. package/src/exos/ica-account-kit.d.ts.map +1 -1
  63. package/src/exos/icq-connection-kit.d.ts +17 -1
  64. package/src/exos/icq-connection-kit.d.ts.map +1 -1
  65. package/src/exos/local-chain-facade.d.ts +22 -170
  66. package/src/exos/local-chain-facade.d.ts.map +1 -1
  67. package/src/exos/local-orchestration-account.d.ts +41 -48
  68. package/src/exos/local-orchestration-account.d.ts.map +1 -1
  69. package/src/exos/local-orchestration-account.js +94 -13
  70. package/src/exos/orchestrator.d.ts +44 -136
  71. package/src/exos/orchestrator.d.ts.map +1 -1
  72. package/src/exos/orchestrator.js +42 -44
  73. package/src/exos/packet-tools.d.ts +21 -81
  74. package/src/exos/packet-tools.d.ts.map +1 -1
  75. package/src/exos/portfolio-holder-kit.d.ts +4 -4
  76. package/src/exos/portfolio-holder-kit.d.ts.map +1 -1
  77. package/src/exos/portfolio-holder-kit.js +65 -10
  78. package/src/exos/remote-chain-facade.d.ts +35 -128
  79. package/src/exos/remote-chain-facade.d.ts.map +1 -1
  80. package/src/facade.d.ts.map +1 -1
  81. package/src/facade.js +7 -0
  82. package/src/fetched-chain-info.d.ts +30 -340
  83. package/src/fetched-chain-info.js +18 -329
  84. package/src/fixtures/query-flows.flows.d.ts.map +1 -1
  85. package/src/orchestration-api.d.ts +4 -8
  86. package/src/orchestration-api.d.ts.map +1 -1
  87. package/src/orchestration-api.ts +3 -8
  88. package/src/proposals/init-chain-info.js +3 -3
  89. package/src/proposals/orchestration-proposal.d.ts.map +1 -1
  90. package/src/proposals/start-stakeAtom.d.ts +78 -16
  91. package/src/proposals/start-stakeAtom.d.ts.map +1 -1
  92. package/src/proposals/start-stakeAtom.js +9 -4
  93. package/src/proposals/start-stakeBld.d.ts +13 -39
  94. package/src/proposals/start-stakeBld.d.ts.map +1 -1
  95. package/src/proposals/start-stakeBld.js +2 -2
  96. package/src/proposals/start-stakeOsmo.d.ts +77 -15
  97. package/src/proposals/start-stakeOsmo.d.ts.map +1 -1
  98. package/src/proposals/start-stakeOsmo.js +9 -4
  99. package/src/typeGuards.d.ts +5 -1
  100. package/src/typeGuards.d.ts.map +1 -1
  101. package/src/typeGuards.js +21 -9
  102. package/src/types-index.d.ts +1 -0
  103. package/src/types-index.js +1 -0
  104. package/src/types.d.ts +14 -4
  105. package/src/types.d.ts.map +1 -1
  106. package/src/types.ts +15 -4
  107. package/src/utils/cosmos.d.ts +40 -1
  108. package/src/utils/cosmos.d.ts.map +1 -1
  109. package/src/utils/cosmos.js +48 -1
  110. package/src/utils/orchestrationAccount.js +1 -1
  111. package/src/utils/registry.d.ts.map +1 -1
  112. package/src/utils/registry.js +0 -3
  113. package/src/utils/start-helper.d.ts +4 -10
  114. package/src/utils/start-helper.d.ts.map +1 -1
  115. package/src/utils/start-helper.js +18 -15
  116. package/src/utils/zcf-tools.d.ts +5 -0
  117. package/src/utils/zcf-tools.d.ts.map +1 -0
  118. package/src/utils/zcf-tools.js +35 -0
  119. package/src/utils/zoe-tools.d.ts +5 -8
  120. package/src/utils/zoe-tools.d.ts.map +1 -1
  121. package/src/utils/zoe-tools.js +136 -33
  122. package/src/vat-orchestration.d.ts.map +1 -1
  123. package/src/examples/stakeBld.contract.d.ts +0 -75
  124. package/src/examples/stakeBld.contract.d.ts.map +0 -1
  125. package/src/examples/stakeIca.contract.d.ts +0 -64
  126. package/src/examples/stakeIca.contract.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"chain-info.d.ts","sourceRoot":"","sources":["chain-info.js"],"names":[],"mappings":"AA0FO,sDALI,IAAI,CAAC,SAAS,CAAC,QACf,MAAM,UACN,eAAe,EAAE,iBAQ3B;AAYM,gDAPI,IAAI,CAAC,SAAS,CAAC,QACf,MAAM,aACN,eAAe,uBACD,MAAM,EAAE,KAAK,IAAI,4EA6CzC;AAQM,sDAHI,IAAI,CAAC,OAAO,cAAc,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC,uBACtC,MAAM,EAAE,KAAK,IAAI,8BAOzC;;;;;wBA/IY,eAAe,GAAG,YAAY;0BA2D9B,OAAO,WAAW;+BAjEF,cAAc;qCADiD,YAAY;qCAAZ,YAAY;kCAAZ,YAAY;AAAxG,4GAA4G;AAC5G,+CAA+C;AAE/C;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEE"}
package/src/chain-info.js CHANGED
@@ -1,11 +1,6 @@
1
1
  import { E } from '@endo/far';
2
2
  import { M, mustMatch } from '@endo/patterns';
3
- import {
4
- ASSETS_KEY,
5
- CHAIN_KEY,
6
- CONNECTIONS_KEY,
7
- normalizeConnectionInfo,
8
- } from './exos/chain-hub.js';
3
+ import { HubName, normalizeConnectionInfo } from './exos/chain-hub.js';
9
4
  import fetchedChainInfo from './fetched-chain-info.js'; // Refresh with scripts/refresh-chain-info.ts
10
5
  import { CosmosAssetInfoShape, CosmosChainInfoShape } from './typeGuards.js';
11
6
 
@@ -20,58 +15,7 @@ import { CosmosAssetInfoShape, CosmosChainInfoShape } from './typeGuards.js';
20
15
  */
21
16
 
22
17
  const knownChains = /** @satisfies {Record<string, ChainInfo>} */ (
23
- harden({
24
- ...fetchedChainInfo,
25
- // FIXME does not have useful connections
26
- // UNTIL https://github.com/Agoric/agoric-sdk/issues/9492
27
- agoriclocal: {
28
- chainId: 'agoriclocal',
29
- connections: {
30
- 'cosmoshub-4': {
31
- id: 'connection-1',
32
- client_id: '07-tendermint-3',
33
- counterparty: {
34
- client_id: '07-tendermint-2',
35
- connection_id: 'connection-1',
36
- prefix: {
37
- key_prefix: '',
38
- },
39
- },
40
- state: 3 /* IBCConnectionState.STATE_OPEN */,
41
- transferChannel: {
42
- portId: 'transfer',
43
- channelId: 'channel-1',
44
- counterPartyChannelId: 'channel-1',
45
- counterPartyPortId: 'transfer',
46
- ordering: 1 /* Order.ORDER_UNORDERED */,
47
- state: 3 /* IBCConnectionState.STATE_OPEN */,
48
- version: 'ics20-1',
49
- },
50
- },
51
- osmosislocal: {
52
- id: 'connection-0',
53
- client_id: '07-tendermint-2',
54
- counterparty: {
55
- client_id: '07-tendermint-2',
56
- connection_id: 'connection-1',
57
- prefix: {
58
- key_prefix: '',
59
- },
60
- },
61
- state: 3 /* IBCConnectionState.STATE_OPEN */,
62
- transferChannel: {
63
- portId: 'transfer',
64
- channelId: 'channel-0',
65
- counterPartyChannelId: 'channel-1',
66
- counterPartyPortId: 'transfer',
67
- ordering: 1 /* Order.ORDER_UNORDERED */,
68
- state: 3 /* IBCConnectionState.STATE_OPEN */,
69
- version: 'ics20-1',
70
- },
71
- },
72
- },
73
- },
74
- })
18
+ harden(fetchedChainInfo)
75
19
  );
76
20
 
77
21
  /**
@@ -79,7 +23,7 @@ const knownChains = /** @satisfies {Record<string, ChainInfo>} */ (
79
23
  * @internal
80
24
  */
81
25
 
82
- // TODO(#9572): include this in registerChain
26
+ // TODO(#9966, #9967): include this in registerChain
83
27
  /**
84
28
  * Register chain assets into agoricNames
85
29
  *
@@ -90,8 +34,9 @@ const knownChains = /** @satisfies {Record<string, ChainInfo>} */ (
90
34
  */
91
35
  export const registerChainAssets = async (agoricNamesAdmin, name, assets) => {
92
36
  mustMatch(assets, M.arrayOf(CosmosAssetInfoShape));
93
- const { nameAdmin: assetAdmin } =
94
- await E(agoricNamesAdmin).provideChild(ASSETS_KEY);
37
+ const { nameAdmin: assetAdmin } = await E(agoricNamesAdmin).provideChild(
38
+ HubName.ChainAssets,
39
+ );
95
40
  return E(assetAdmin).update(name, assets);
96
41
  };
97
42
 
@@ -112,9 +57,10 @@ export const registerChain = async (
112
57
  log = () => {},
113
58
  handledConnections = new Set(),
114
59
  ) => {
115
- const { nameAdmin } = await E(agoricNamesAdmin).provideChild(CHAIN_KEY);
116
- const { nameAdmin: connAdmin } =
117
- await E(agoricNamesAdmin).provideChild(CONNECTIONS_KEY);
60
+ const { nameAdmin } = await E(agoricNamesAdmin).provideChild(HubName.Chain);
61
+ const { nameAdmin: connAdmin } = await E(agoricNamesAdmin).provideChild(
62
+ HubName.ChainConnection,
63
+ );
118
64
 
119
65
  mustMatch(chainInfo, CosmosChainInfoShape);
120
66
  const { connections = {}, ...vertex } = chainInfo;
@@ -1,5 +1,5 @@
1
1
  import type { AnyJson, TypedJson, JsonSafe } from '@agoric/cosmic-proto';
2
- import type { Delegation, Redelegation, UnbondingDelegation } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
2
+ import type { RedelegationResponse, UnbondingDelegation } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
3
3
  import type { TxBody } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
4
4
  import type { MsgTransfer } from '@agoric/cosmic-proto/ibc/applications/transfer/v1/tx.js';
5
5
  import type { State as IBCChannelState, Order } from '@agoric/cosmic-proto/ibc/core/channel/v1/channel.js';
@@ -24,9 +24,6 @@ export interface IBCConnectionInfo {
24
24
  counterparty: {
25
25
  client_id: string;
26
26
  connection_id: IBCConnectionID;
27
- prefix: {
28
- key_prefix: string;
29
- };
30
27
  };
31
28
  transferChannel: {
32
29
  portId: string;
@@ -77,6 +74,20 @@ export type CosmosChainInfo = Readonly<{
77
74
  denom: string;
78
75
  }>>;
79
76
  }>;
77
+ /** @see {QueryDelegationTotalRewardsResponse} */
78
+ export interface CosmosRewardsResponse {
79
+ rewards: {
80
+ validator: CosmosValidatorAddress;
81
+ reward: DenomAmount[];
82
+ }[];
83
+ total: DenomAmount[];
84
+ }
85
+ /** @see {DelegationResponse} */
86
+ export interface CosmosDelegationResponse {
87
+ delegator: ChainAddress;
88
+ validator: CosmosValidatorAddress;
89
+ amount: DenomAmount;
90
+ }
80
91
  /**
81
92
  * Queries for the staking properties of an account.
82
93
  *
@@ -87,12 +98,12 @@ export interface StakingAccountQueries {
87
98
  /**
88
99
  * @returns all active delegations from the account to any validator (or [] if none)
89
100
  */
90
- getDelegations: () => Promise<Delegation[]>;
101
+ getDelegations: () => Promise<CosmosDelegationResponse[]>;
91
102
  /**
92
103
  * @returns the active delegation from the account to a specific validator. Return an
93
104
  * empty Delegation if there is no delegation.
94
105
  */
95
- getDelegation: (validator: CosmosValidatorAddress) => Promise<Delegation>;
106
+ getDelegation: (validator: CosmosValidatorAddress) => Promise<CosmosDelegationResponse>;
96
107
  /**
97
108
  * @returns the unbonding delegations from the account to any validator (or [] if none)
98
109
  */
@@ -101,13 +112,12 @@ export interface StakingAccountQueries {
101
112
  * @returns the unbonding delegations from the account to a specific validator (or [] if none)
102
113
  */
103
114
  getUnbondingDelegation: (validator: CosmosValidatorAddress) => Promise<UnbondingDelegation>;
104
- getRedelegations: () => Promise<Redelegation[]>;
105
- getRedelegation: (srcValidator: CosmosValidatorAddress, dstValidator?: CosmosValidatorAddress) => Promise<Redelegation>;
115
+ getRedelegations: () => Promise<RedelegationResponse[]>;
106
116
  /**
107
117
  * Get the pending rewards for the account.
108
118
  * @returns the amounts of the account's rewards pending from all validators
109
119
  */
110
- getRewards: () => Promise<DenomAmount[]>;
120
+ getRewards: () => Promise<CosmosRewardsResponse>;
111
121
  /**
112
122
  * Get the rewards pending with a specific validator.
113
123
  * @param validator - the validator address to query for
@@ -146,6 +156,7 @@ export interface StakingAccountActions {
146
156
  */
147
157
  undelegate: (delegations: {
148
158
  amount: AmountArg;
159
+ delegator?: ChainAddress;
149
160
  validator: CosmosValidatorAddress;
150
161
  }[]) => Promise<void>;
151
162
  /**
@@ -250,6 +261,6 @@ export type CosmosChainAccountMethods<CCI extends CosmosChainInfo> = (CCI extend
250
261
  icaEnabled: true;
251
262
  } ? IcaAccount : {}) & CCI extends {
252
263
  stakingTokens: {};
253
- } ? StakingAccountActions : {};
264
+ } ? StakingAccountActions & StakingAccountQueries : {};
254
265
  export type ICQQueryFunction = (msgs: JsonSafe<RequestQuery>[]) => Promise<JsonSafe<ResponseQuery>[]>;
255
266
  //# sourceMappingURL=cosmos-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cosmos-api.d.ts","sourceRoot":"","sources":["cosmos-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,mBAAmB,EACpB,MAAM,wDAAwD,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8CAA8C,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yDAAyD,CAAC;AAC3F,OAAO,KAAK,EACV,KAAK,IAAI,eAAe,EACxB,KAAK,EACN,MAAM,qDAAqD,CAAC;AAC7D,OAAO,KAAK,EAAE,KAAK,IAAI,kBAAkB,EAAE,MAAM,2DAA2D,CAAC;AAC7G,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACd,MAAM,+CAA+C,CAAC;AACvD,OAAO,KAAK,EAAgB,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,KAAK,EACV,SAAS,EACT,kBAAkB,EACnB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EACjB,MAAM,iCAAiC,CAAC;AACzC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,CAAC;CACnD;AAED,sDAAsD;AACtD,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,0CAA0C;IAC1C,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7D;;;;;;;;;OASG;IACH,gBAAgB,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACnE;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;IAC7C,gBAAgB,CAAC,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,yBAAyB,CAAC,GAAG,SAAS,eAAe,IAC/D,CAAC,GAAG,SAAS;IACX,UAAU,EAAE,IAAI,CAAC;CAClB,GACG,UAAU,GACV,EAAE,CAAC,GACL,GAAG,SAAS;IACZ,aAAa,EAAE,EAAE,CAAC;CACnB,GACG,qBAAqB,GAAG,qBAAqB,GAC7C,EAAE,CAAC;AAET,MAAM,MAAM,gBAAgB,GAAG,CAC7B,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,KAC3B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC"}
package/src/cosmos-api.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import type { AnyJson, TypedJson, JsonSafe } from '@agoric/cosmic-proto';
2
2
  import type {
3
3
  Delegation,
4
+ DelegationResponse,
4
5
  Redelegation,
6
+ RedelegationResponse,
5
7
  UnbondingDelegation,
6
8
  } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
7
9
  import type { TxBody } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
@@ -26,6 +28,7 @@ import type {
26
28
  LocalIbcAddress,
27
29
  RemoteIbcAddress,
28
30
  } from '@agoric/vats/tools/ibc-utils.js';
31
+ import type { QueryDelegationTotalRewardsResponse } from '@agoric/cosmic-proto/cosmos/distribution/v1beta1/query.js';
29
32
  import type { AmountArg, ChainAddress, Denom, DenomAmount } from './types.js';
30
33
 
31
34
  /** An address for a validator on some blockchain, e.g., cosmos, eth, etc. */
@@ -43,9 +46,6 @@ export interface IBCConnectionInfo {
43
46
  counterparty: {
44
47
  client_id: string;
45
48
  connection_id: IBCConnectionID;
46
- prefix: {
47
- key_prefix: string;
48
- };
49
49
  };
50
50
  transferChannel: {
51
51
  portId: string;
@@ -97,6 +97,24 @@ export type CosmosChainInfo = Readonly<{
97
97
  stakingTokens?: Readonly<Array<{ denom: string }>>;
98
98
  }>;
99
99
 
100
+ // #region Orchestration views on Cosmos response types
101
+ // Naming scheme: Cosmos for the chain system, Rewards b/c getRewards function,
102
+ // and Response because it's the return value.
103
+
104
+ /** @see {QueryDelegationTotalRewardsResponse} */
105
+ export interface CosmosRewardsResponse {
106
+ rewards: { validator: CosmosValidatorAddress; reward: DenomAmount[] }[];
107
+ total: DenomAmount[];
108
+ }
109
+
110
+ /** @see {DelegationResponse} */
111
+ export interface CosmosDelegationResponse {
112
+ delegator: ChainAddress;
113
+ validator: CosmosValidatorAddress;
114
+ amount: DenomAmount;
115
+ }
116
+ // #endregion
117
+
100
118
  /**
101
119
  * Queries for the staking properties of an account.
102
120
  *
@@ -107,13 +125,15 @@ export interface StakingAccountQueries {
107
125
  /**
108
126
  * @returns all active delegations from the account to any validator (or [] if none)
109
127
  */
110
- getDelegations: () => Promise<Delegation[]>;
128
+ getDelegations: () => Promise<CosmosDelegationResponse[]>;
111
129
 
112
130
  /**
113
131
  * @returns the active delegation from the account to a specific validator. Return an
114
132
  * empty Delegation if there is no delegation.
115
133
  */
116
- getDelegation: (validator: CosmosValidatorAddress) => Promise<Delegation>;
134
+ getDelegation: (
135
+ validator: CosmosValidatorAddress,
136
+ ) => Promise<CosmosDelegationResponse>;
117
137
 
118
138
  /**
119
139
  * @returns the unbonding delegations from the account to any validator (or [] if none)
@@ -127,18 +147,13 @@ export interface StakingAccountQueries {
127
147
  validator: CosmosValidatorAddress,
128
148
  ) => Promise<UnbondingDelegation>;
129
149
 
130
- getRedelegations: () => Promise<Redelegation[]>;
131
-
132
- getRedelegation: (
133
- srcValidator: CosmosValidatorAddress,
134
- dstValidator?: CosmosValidatorAddress,
135
- ) => Promise<Redelegation>;
150
+ getRedelegations: () => Promise<RedelegationResponse[]>;
136
151
 
137
152
  /**
138
153
  * Get the pending rewards for the account.
139
154
  * @returns the amounts of the account's rewards pending from all validators
140
155
  */
141
- getRewards: () => Promise<DenomAmount[]>;
156
+ getRewards: () => Promise<CosmosRewardsResponse>;
142
157
 
143
158
  /**
144
159
  * Get the rewards pending with a specific validator.
@@ -187,7 +202,11 @@ export interface StakingAccountActions {
187
202
  * @param delegations - the delegation to undelegate
188
203
  */
189
204
  undelegate: (
190
- delegations: { amount: AmountArg; validator: CosmosValidatorAddress }[],
205
+ delegations: {
206
+ amount: AmountArg;
207
+ delegator?: ChainAddress;
208
+ validator: CosmosValidatorAddress;
209
+ }[],
191
210
  ) => Promise<void>;
192
211
 
193
212
  /**
@@ -307,7 +326,7 @@ export type CosmosChainAccountMethods<CCI extends CosmosChainInfo> =
307
326
  CCI extends {
308
327
  stakingTokens: {};
309
328
  }
310
- ? StakingAccountActions
329
+ ? StakingAccountActions & StakingAccountQueries
311
330
  : {};
312
331
 
313
332
  export type ICQQueryFunction = (
@@ -5,13 +5,12 @@ This directory contains sample contracts showcasing the Orchestration API. Each
5
5
  - **basic-flows.contract.js**: Account creation and query sending
6
6
  - **send-anywhere.contract.js**: Token sending across supported blockchains
7
7
  - **auto-stake-it.contract.js**: Automatic remote staking of received tokens
8
+ - **unbond.contract.js**: Cross-chain unbonding and transfer
8
9
 
9
10
  ## In Progress
10
11
 
11
12
  The following contracts are a work in progress as they contain bindings that need to be promptly updated.
12
13
 
13
- - **stakeIca.contract.js**: Interchain account creation for remote staking
14
- - **unbond.contract.js**: Cross-chain unbonding and liquid staking
14
+ - **stake-bld.contract.js**: BLD token staking on Agoric
15
+ - **stake-ica.contract.js**: Interchain account creation for remote staking
15
16
  - **swap.contract.js**: Token swapping and remote staking
16
- - **stakeBld.contract.js**: BLD token staking on Agoric
17
-
@@ -1 +1 @@
1
- {"version":3,"file":"auto-stake-it-tap-kit.d.ts","sourceRoot":"","sources":["auto-stake-it-tap-kit.js"],"names":[],"mappings":"AAsJO,wCANI,IAAI,YACJ,QAAQ,GACN,CACZ,GAAO,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,KACzD,UAAU,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,CAKjE;8BArIY;IACZ,cAAkB,EAAE,IAAI,CAAC,qBAAqB,GAAG,CAAC,GAAG,qBAAqB,CAAC,CAAC;IAC5E,YAAgB,EAAE,IAAI,CAAC,qBAAqB;QAAE,OAAO,EAAE,QAAQ,CAAA;KAAE,CAAC,CAAC,CAAC;IACpE,SAAa,EAAE,sBAAsB,CAAC;IACtC,iBAAqB,EAAE,YAAY,CAAC;IACpC,kBAAsB,EAAE,YAAY,CAAC;IACrC,aAAiB,EAAE,YAAY,CAAC;IAChC,WAAe,EAAE,KAAK,CAAC;IACvB,UAAc,EAAE,KAAK,CAAC;CACnB;6BA8HU,UAAU,CAAC,OAAO,iBAAiB,CAAC;yBACpC,UAAU,CAAC,cAAc,CAAC;0BAhJjB,cAAc;8BADV,aAAa;AAkCxC;;;GAGG;AACH,4CAHW,IAAI,aACJ,QAAQ;;QAwBX;;;;;;WAMG;6BADQ,iBAAiB;;;QAwC5B;;;WAGG;6BAFQ,IAAI,SACJ,MAAM;;GAcxB;0CAtH0G,uBAAuB;2CAAvB,uBAAuB;4CAAvB,uBAAuB;kCAAvB,uBAAuB;kCAJhF,cAAc;2BAI2C,uBAAuB;uCAJhF,cAAc"}
1
+ {"version":3,"file":"auto-stake-it-tap-kit.d.ts","sourceRoot":"","sources":["auto-stake-it-tap-kit.js"],"names":[],"mappings":"AAmJO,wCANI,IAAI,YACJ,QAAQ,GACN,CACZ,GAAO,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,KACzD,UAAU,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,CAKjE;8BAlIY;IACR,cAAc,EAAE,IAAI,CAAC,qBAAqB,GAAG,CAAC,GAAG,qBAAqB,CAAC,CAAC;IACxE,YAAY,EAAE,IAAI,CAAC,qBAAqB;QAAE,OAAO,EAAE,QAAQ,CAAA;KAAE,CAAC,CAAC,CAAC;IAChE,SAAS,EAAE,sBAAsB,CAAC;IAClC,iBAAiB,EAAE,YAAY,CAAC;IAChC,kBAAkB,EAAE,YAAY,CAAC;IACjC,aAAa,EAAE,YAAY,CAAC;IAC5B,WAAW,EAAE,KAAK,CAAC;IACnB,UAAU,EAAE,KAAK,CAAC;CACnB;6BA2HU,UAAU,CAAC,OAAO,iBAAiB,CAAC;yBACpC,UAAU,CAAC,cAAc,CAAC;0BA7IjB,cAAc;8BADV,aAAa;AAkCxC;;;GAGG;AACH,4CAHW,IAAI,aACJ,QAAQ;;QAwBX;;;;;;WAMG;6BADQ,iBAAiB;;;QAqC5B;;;WAGG;6BAFQ,IAAI,SACJ,MAAM;;GAcxB;0CAnH0G,uBAAuB;2CAAvB,uBAAuB;4CAAvB,uBAAuB;kCAAvB,uBAAuB;kCAJhF,cAAc;2BAI2C,uBAAuB;uCAJhF,cAAc"}
@@ -101,13 +101,10 @@ const prepareStakingTapKit = (zone, { watch }) => {
101
101
 
102
102
  const { localAccount, localDenom, remoteChainAddress } = this.state;
103
103
  return watch(
104
- E(localAccount).transfer(
105
- {
106
- denom: localDenom,
107
- value: BigInt(tx.amount),
108
- },
109
- remoteChainAddress,
110
- ),
104
+ E(localAccount).transfer(remoteChainAddress, {
105
+ denom: localDenom,
106
+ value: BigInt(tx.amount),
107
+ }),
111
108
  this.facets.transferWatcher,
112
109
  BigInt(tx.amount),
113
110
  );
@@ -7,7 +7,7 @@ export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: Orchestrati
7
7
  [k: string]: import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>;
8
8
  };
9
9
  invitationMakers: import("@endo/exo").Guarded<{
10
- Proxying<IA extends unknown[]>(chainName: string, action: string, invitationArgs: IA): Promise<Invitation<unknown, IA>>;
10
+ Proxying<IA extends unknown[]>(chainName: string, action: string, invitationArgs?: IA | undefined): Promise<Invitation<unknown, IA>>;
11
11
  }>;
12
12
  }>>, {
13
13
  chainName: string;
@@ -10,7 +10,7 @@ export function makeAccounts(orch: Orchestrator, { makeStakingTap, makePortfolio
10
10
  [k: string]: ResolvedPublicTopic<unknown>;
11
11
  };
12
12
  invitationMakers: import("@endo/exo").Guarded<{
13
- Proxying<IA extends unknown[]>(chainName: string, action: string, invitationArgs: IA): Promise<Invitation<unknown, IA>>;
13
+ Proxying<IA extends unknown[]>(chainName: string, action: string, invitationArgs?: IA | undefined): Promise<Invitation<unknown, IA>>;
14
14
  }>;
15
15
  }>>;
16
16
  import type { Orchestrator } from '@agoric/orchestration';
@@ -1 +1 @@
1
- {"version":3,"file":"auto-stake-it.flows.d.ts","sourceRoot":"","sources":["auto-stake-it.flows.js"],"names":[],"mappings":"AA0BO,mCAZI,YAAY,qDACZ;IACV,cAAkB,EAAE,cAAc,CAAC;IACnC,mBAAuB,EAAE,mBAAmB,CAAC;IAC7C,QAAY,EAAE,eAAe,QAAQ,CAAC,CAAC;CACpC,QACO,OAAO,4BACP;IACV,SAAa,EAAE,MAAM,CAAC;IACtB,SAAa,EAAE,sBAAsB,CAAC;CACnC;;;;;;;IA4EH;kCA9FsJ,uBAAuB;oCAC7I,4BAA4B;yCACvB,iCAAiC;8BAC5C,sBAAsB;oCAJhB,oBAAoB;4CACkG,uBAAuB;yCAFxI,2CAA2C"}
1
+ {"version":3,"file":"auto-stake-it.flows.d.ts","sourceRoot":"","sources":["auto-stake-it.flows.js"],"names":[],"mappings":"AA0BO,mCAZI,YAAY,qDACZ;IACN,cAAc,EAAE,cAAc,CAAC;IAC/B,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,QAAQ,EAAE,eAAe,QAAQ,CAAC,CAAC;CACpC,QACO,OAAO,4BACP;IACN,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,sBAAsB,CAAC;CACnC;;;;;;;IA4EH;kCA9FsJ,uBAAuB;oCAC7I,4BAA4B;yCACvB,iCAAiC;8BAC5C,sBAAsB;oCAJhB,oBAAoB;4CACkG,uBAAuB;yCAFxI,2CAA2C"}
@@ -10,7 +10,7 @@ export const start: (zcf: ZCF<Record<string, unknown>>, privateArgs: Orchestrati
10
10
  [k: string]: import("@agoric/zoe/src/contractSupport/topics.js").ResolvedPublicTopic<unknown>;
11
11
  };
12
12
  invitationMakers: import("@endo/exo").Guarded<{
13
- Proxying<IA extends unknown[]>(chainName: string, action: string, invitationArgs: IA): Promise<Invitation<unknown, IA>>;
13
+ Proxying<IA extends unknown[]>(chainName: string, action: string, invitationArgs?: IA | undefined): Promise<Invitation<unknown, IA>>;
14
14
  }>;
15
15
  }>>, {
16
16
  chainNames: string[];
@@ -10,7 +10,7 @@ export function makePortfolioAccount(orch: Orchestrator, { makePortfolioHolder }
10
10
  [k: string]: ResolvedPublicTopic<unknown>;
11
11
  };
12
12
  invitationMakers: import("@endo/exo").Guarded<{
13
- Proxying<IA extends unknown[]>(chainName: string, action: string, invitationArgs: IA): Promise<Invitation<unknown, IA>>;
13
+ Proxying<IA extends unknown[]>(chainName: string, action: string, invitationArgs?: IA | undefined): Promise<Invitation<unknown, IA>>;
14
14
  }>;
15
15
  }>>;
16
16
  import type { Orchestrator } from '@agoric/orchestration';
@@ -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
- export const SingleAmountRecord: import("@endo/patterns").Matcher;
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<import("@agoric/vow").Vow<void>, {
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":"AAQA;;;GAGG;AAEH,kEAKE;AAsDF;gBA9CiB,UAAU;;;;;;;;;;;;;;;;;;;GA8CsB;yCA9DS,0BAA0B"}
1
+ {"version":3,"file":"send-anywhere.contract.d.ts","sourceRoot":"","sources":["send-anywhere.contract.js"],"names":[],"mappings":"AASA;;;;GAIG;AAEH,qEAKE;AAaK,8BAPI,GAAG,eACH,mBAAmB,GAAG;IAC5B,UAAU,EAAE,UAAU,CAAC;CACxB,QACO,IAAI,oDACJ,kBAAkB;;;;;;;;;;;GAsD5B;AAGD;gBA5DiB,UAAU;;;;;;;;;;;;;;;;;;;GA4DsB;yCA5ES,0BAA0B;0BAD7D,cAAc;wCACqB,0BAA0B;yBAF9D,aAAa"}
@@ -1,23 +1,25 @@
1
- import { makeSharedStateRecord } from '@agoric/async-flow';
2
- import { AmountShape } from '@agoric/ertp';
3
1
  import { InvitationShape } from '@agoric/zoe/src/typeGuards.js';
2
+ import { E } from '@endo/far';
4
3
  import { M } from '@endo/patterns';
4
+ import { prepareChainHubAdmin } from '../exos/chain-hub-admin.js';
5
+ import { AnyNatAmountShape } from '../typeGuards.js';
5
6
  import { withOrchestration } from '../utils/start-helper.js';
6
7
  import * as flows from './send-anywhere.flows.js';
7
- import { prepareChainHubAdmin } from '../exos/chain-hub-admin.js';
8
+ import * as sharedFlows from './shared.flows.js';
8
9
 
9
10
  /**
11
+ * @import {Vow} from '@agoric/vow';
10
12
  * @import {Zone} from '@agoric/zone';
11
13
  * @import {OrchestrationPowers, OrchestrationTools} from '../utils/start-helper.js';
12
14
  */
13
15
 
14
- export const SingleAmountRecord = M.and(
15
- M.recordOf(M.string(), AmountShape, {
16
+ export const SingleNatAmountRecord = M.and(
17
+ M.recordOf(M.string(), AnyNatAmountShape, {
16
18
  numPropertiesLimit: 1,
17
19
  }),
18
20
  M.not(harden({})),
19
21
  );
20
- harden(SingleAmountRecord);
22
+ harden(SingleNatAmountRecord);
21
23
 
22
24
  /**
23
25
  * Orchestration contract to be wrapped by withOrchestration for Zoe
@@ -29,25 +31,38 @@ harden(SingleAmountRecord);
29
31
  * @param {Zone} zone
30
32
  * @param {OrchestrationTools} tools
31
33
  */
32
- const contract = async (
34
+ export const contract = async (
33
35
  zcf,
34
36
  privateArgs,
35
37
  zone,
36
- { chainHub, orchestrateAll, zoeTools },
38
+ { chainHub, orchestrateAll, vowTools, zoeTools },
37
39
  ) => {
38
- const contractState = makeSharedStateRecord(
39
- /** @type {{ account: OrchestrationAccount<any> | undefined }} */ {
40
- localAccount: undefined,
41
- },
42
- );
43
-
44
40
  const creatorFacet = prepareChainHubAdmin(zone, chainHub);
45
41
 
42
+ // UNTIL https://github.com/Agoric/agoric-sdk/issues/9066
43
+ const logNode = E(privateArgs.storageNode).makeChildNode('log');
44
+ /** @type {(msg: string) => Vow<void>} */
45
+ const log = msg => vowTools.watch(E(logNode).setValue(msg));
46
+
47
+ const { makeLocalAccount } = orchestrateAll(sharedFlows, {});
48
+ /**
49
+ * Setup a shared local account for use in async-flow functions. Typically,
50
+ * exo initState functions need to resolve synchronously, but `makeOnce`
51
+ * allows us to provide a Promise. When using this inside a flow, we must
52
+ * await it to ensure the account is available for use.
53
+ *
54
+ * @type {any} sharedLocalAccountP expects a Promise but this is a vow
55
+ * https://github.com/Agoric/agoric-sdk/issues/9822
56
+ */
57
+ const sharedLocalAccountP = zone.makeOnce('localAccount', () =>
58
+ makeLocalAccount(),
59
+ );
60
+
46
61
  // orchestrate uses the names on orchestrationFns to do a "prepare" of the associated behavior
47
62
  const orchFns = orchestrateAll(flows, {
48
- zcf,
49
- contractState,
50
- localTransfer: zoeTools.localTransfer,
63
+ log,
64
+ sharedLocalAccountP,
65
+ zoeTools,
51
66
  });
52
67
 
53
68
  const publicFacet = zone.exo(
@@ -61,7 +76,7 @@ const contract = async (
61
76
  orchFns.sendIt,
62
77
  'send',
63
78
  undefined,
64
- M.splitRecord({ give: SingleAmountRecord }),
79
+ M.splitRecord({ give: SingleNatAmountRecord }),
65
80
  );
66
81
  },
67
82
  },
@@ -69,6 +84,7 @@ const contract = async (
69
84
 
70
85
  return { publicFacet, creatorFacet };
71
86
  };
87
+ harden(contract);
72
88
 
73
89
  export const start = withOrchestration(contract);
74
90
  harden(start);
@@ -1,15 +1,15 @@
1
- export function sendIt(orch: Orchestrator, { contractState, localTransfer }: {
2
- contractState: {
3
- localAccount?: OrchestrationAccountI & LocalAccountMethods;
4
- };
5
- localTransfer: GuestOf<ZoeTools["localTransfer"]>;
1
+ export function sendIt(orch: Orchestrator, { sharedLocalAccountP, log, zoeTools: { localTransfer, withdrawToSeat } }: {
2
+ sharedLocalAccountP: Promise<GuestInterface<LocalOrchestrationAccountKit["holder"]>>;
3
+ zoeTools: GuestInterface<ZoeTools>;
4
+ log: GuestOf<(msg: string) => Vow<void>>;
6
5
  }, seat: ZCFSeat, offerArgs: {
7
6
  chainName: string;
8
7
  destAddr: string;
9
8
  }): Promise<void>;
10
9
  import type { Orchestrator } from '../types.js';
11
- import type { OrchestrationAccountI } from '../types.js';
12
- import type { LocalAccountMethods } from '../types.js';
10
+ import type { LocalOrchestrationAccountKit } from '../exos/local-orchestration-account.js';
11
+ import type { GuestInterface } from '@agoric/async-flow';
13
12
  import type { ZoeTools } from '../utils/zoe-tools.js';
13
+ import type { Vow } from '@agoric/vow';
14
14
  import type { GuestOf } from '@agoric/async-flow';
15
15
  //# 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":"AAuBO,6BAPI,YAAY,oCAEpB;IAA4E,aAAa,EAAjF;QAAE,YAAY,CAAC,EAAE,qBAAqB,GAAG,mBAAmB,CAAA;KAAE;IACtB,aAAa,EAArD,QAAQ,QAAQ,CAAC,eAAe,CAAC,CAAC;CAC1C,QAAQ,OAAO,aACP;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,iBAyCjD;kCAxD6F,aAAa;2CAAb,aAAa;yCAAb,aAAa;8BADhF,uBAAuB;6BADxB,oBAAoB"}
1
+ {"version":3,"file":"send-anywhere.flows.d.ts","sourceRoot":"","sources":["send-anywhere.flows.js"],"names":[],"mappings":"AA2BO,6BARI,YAAY,6EAEpB;IAA6E,mBAAmB,EAAxF,OAAO,CAAC,eAAe,4BAA4B,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjC,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;kCAzEsE,aAAa;kDAFrC,wCAAwC;oCAF7C,oBAAoB;8BAGnC,uBAAuB;yBAF5B,aAAa;6BADO,oBAAoB"}