@agoric/orchestration 0.1.1-calypso-dev-84eb287.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 (120) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +5 -0
  3. package/index.d.ts +4 -0
  4. package/index.js +7 -0
  5. package/package.json +95 -0
  6. package/src/chain-info.d.ts +2318 -0
  7. package/src/chain-info.d.ts.map +1 -0
  8. package/src/chain-info.js +114 -0
  9. package/src/cosmos-api.d.ts +174 -0
  10. package/src/cosmos-api.d.ts.map +1 -0
  11. package/src/cosmos-api.ts +231 -0
  12. package/src/ethereum-api.d.ts +8 -0
  13. package/src/ethereum-api.d.ts.map +1 -0
  14. package/src/ethereum-api.ts +7 -0
  15. package/src/examples/sendAnywhere.contract.d.ts +31 -0
  16. package/src/examples/sendAnywhere.contract.d.ts.map +1 -0
  17. package/src/examples/sendAnywhere.contract.js +171 -0
  18. package/src/examples/stakeBld.contract.d.ts +121 -0
  19. package/src/examples/stakeBld.contract.d.ts.map +1 -0
  20. package/src/examples/stakeBld.contract.js +133 -0
  21. package/src/examples/stakeIca.contract.d.ts +93 -0
  22. package/src/examples/stakeIca.contract.d.ts.map +1 -0
  23. package/src/examples/stakeIca.contract.js +143 -0
  24. package/src/examples/swapExample.contract.d.ts +34 -0
  25. package/src/examples/swapExample.contract.d.ts.map +1 -0
  26. package/src/examples/swapExample.contract.js +155 -0
  27. package/src/examples/unbondExample.contract.d.ts +21 -0
  28. package/src/examples/unbondExample.contract.d.ts.map +1 -0
  29. package/src/examples/unbondExample.contract.js +105 -0
  30. package/src/exos/README.md +56 -0
  31. package/src/exos/agoric-names-tools.d.ts +27 -0
  32. package/src/exos/agoric-names-tools.d.ts.map +1 -0
  33. package/src/exos/agoric-names-tools.js +109 -0
  34. package/src/exos/chain-account-kit.d.ts +88 -0
  35. package/src/exos/chain-account-kit.d.ts.map +1 -0
  36. package/src/exos/chain-account-kit.js +210 -0
  37. package/src/exos/chain-hub.d.ts +77 -0
  38. package/src/exos/chain-hub.d.ts.map +1 -0
  39. package/src/exos/chain-hub.js +214 -0
  40. package/src/exos/cosmos-orchestration-account.d.ts +207 -0
  41. package/src/exos/cosmos-orchestration-account.d.ts.map +1 -0
  42. package/src/exos/cosmos-orchestration-account.js +536 -0
  43. package/src/exos/icq-connection-kit.d.ts +50 -0
  44. package/src/exos/icq-connection-kit.d.ts.map +1 -0
  45. package/src/exos/icq-connection-kit.js +135 -0
  46. package/src/exos/local-chain-facade.d.ts +81 -0
  47. package/src/exos/local-chain-facade.d.ts.map +1 -0
  48. package/src/exos/local-chain-facade.js +113 -0
  49. package/src/exos/local-orchestration-account.d.ts +176 -0
  50. package/src/exos/local-orchestration-account.d.ts.map +1 -0
  51. package/src/exos/local-orchestration-account.js +446 -0
  52. package/src/exos/orchestrator.d.ts +91 -0
  53. package/src/exos/orchestrator.d.ts.map +1 -0
  54. package/src/exos/orchestrator.js +141 -0
  55. package/src/exos/remote-chain-facade.d.ts +144 -0
  56. package/src/exos/remote-chain-facade.d.ts.map +1 -0
  57. package/src/exos/remote-chain-facade.js +145 -0
  58. package/src/facade.d.ts +57 -0
  59. package/src/facade.d.ts.map +1 -0
  60. package/src/facade.js +132 -0
  61. package/src/fetched-chain-info.d.ts +2311 -0
  62. package/src/fetched-chain-info.d.ts.map +1 -0
  63. package/src/fetched-chain-info.js +2288 -0
  64. package/src/internal.d.ts +13 -0
  65. package/src/internal.d.ts.map +1 -0
  66. package/src/internal.ts +20 -0
  67. package/src/orchestration-api.d.ts +158 -0
  68. package/src/orchestration-api.d.ts.map +1 -0
  69. package/src/orchestration-api.ts +201 -0
  70. package/src/proposals/orchestration-proposal.d.ts +53 -0
  71. package/src/proposals/orchestration-proposal.d.ts.map +1 -0
  72. package/src/proposals/orchestration-proposal.js +179 -0
  73. package/src/proposals/revise-chain-info.d.ts +21 -0
  74. package/src/proposals/revise-chain-info.d.ts.map +1 -0
  75. package/src/proposals/revise-chain-info.js +44 -0
  76. package/src/proposals/start-stakeAtom.d.ts +109 -0
  77. package/src/proposals/start-stakeAtom.d.ts.map +1 -0
  78. package/src/proposals/start-stakeAtom.js +105 -0
  79. package/src/proposals/start-stakeBld.d.ts +154 -0
  80. package/src/proposals/start-stakeBld.d.ts.map +1 -0
  81. package/src/proposals/start-stakeBld.js +103 -0
  82. package/src/proposals/start-stakeOsmo.d.ts +108 -0
  83. package/src/proposals/start-stakeOsmo.d.ts.map +1 -0
  84. package/src/proposals/start-stakeOsmo.js +106 -0
  85. package/src/service.d.ts +97 -0
  86. package/src/service.d.ts.map +1 -0
  87. package/src/service.js +259 -0
  88. package/src/typeGuards.d.ts +55 -0
  89. package/src/typeGuards.d.ts.map +1 -0
  90. package/src/typeGuards.js +104 -0
  91. package/src/types.d.ts +11 -0
  92. package/src/types.d.ts.map +1 -0
  93. package/src/types.ts +11 -0
  94. package/src/utils/address.d.ts +14 -0
  95. package/src/utils/address.d.ts.map +1 -0
  96. package/src/utils/address.js +79 -0
  97. package/src/utils/cosmos.d.ts +9 -0
  98. package/src/utils/cosmos.d.ts.map +1 -0
  99. package/src/utils/cosmos.js +36 -0
  100. package/src/utils/orc.d.ts +17 -0
  101. package/src/utils/orc.d.ts.map +1 -0
  102. package/src/utils/orc.js +38 -0
  103. package/src/utils/orchestrationAccount.d.ts +10 -0
  104. package/src/utils/orchestrationAccount.d.ts.map +1 -0
  105. package/src/utils/orchestrationAccount.js +22 -0
  106. package/src/utils/packet.d.ts +57 -0
  107. package/src/utils/packet.d.ts.map +1 -0
  108. package/src/utils/packet.js +112 -0
  109. package/src/utils/registry.d.ts +13 -0
  110. package/src/utils/registry.d.ts.map +1 -0
  111. package/src/utils/registry.js +131 -0
  112. package/src/utils/start-helper.d.ts +51 -0
  113. package/src/utils/start-helper.d.ts.map +1 -0
  114. package/src/utils/start-helper.js +109 -0
  115. package/src/utils/time.d.ts +31 -0
  116. package/src/utils/time.d.ts.map +1 -0
  117. package/src/utils/time.js +63 -0
  118. package/src/vat-orchestration.d.ts +58 -0
  119. package/src/vat-orchestration.d.ts.map +1 -0
  120. package/src/vat-orchestration.js +24 -0
@@ -0,0 +1,207 @@
1
+ /**
2
+ * @typedef {object} ComosOrchestrationAccountNotification
3
+ * @property {ChainAddress} chainAddress
4
+ */
5
+ /**
6
+ * @typedef {{
7
+ * topicKit: RecorderKit<ComosOrchestrationAccountNotification>;
8
+ * account: IcaAccount;
9
+ * chainAddress: ChainAddress;
10
+ * icqConnection: ICQConnection | undefined;
11
+ * bondDenom: string;
12
+ * timer: Remote<TimerService>;
13
+ * }} State
14
+ */
15
+ /** @see {OrchestrationAccountI} */
16
+ export const IcaAccountHolderI: import("@endo/patterns").InterfaceGuard<{
17
+ asContinuingOffer: import("@endo/patterns").MethodGuard;
18
+ getPublicTopics: import("@endo/patterns").MethodGuard;
19
+ delegate: import("@endo/patterns").MethodGuard;
20
+ redelegate: import("@endo/patterns").MethodGuard;
21
+ withdrawReward: import("@endo/patterns").MethodGuard;
22
+ withdrawRewards: import("@endo/patterns").MethodGuard;
23
+ undelegate: import("@endo/patterns").MethodGuard;
24
+ getAddress: import("@endo/patterns").MethodGuard;
25
+ getBalance: import("@endo/patterns").MethodGuard;
26
+ getBalances: import("@endo/patterns").MethodGuard;
27
+ send: import("@endo/patterns").MethodGuard;
28
+ transfer: import("@endo/patterns").MethodGuard;
29
+ transferSteps: import("@endo/patterns").MethodGuard;
30
+ deposit: import("@endo/patterns").MethodGuard;
31
+ }>;
32
+ export function prepareCosmosOrchestrationAccountKit(zone: Zone, makeRecorderKit: MakeRecorderKit, { watch, asVow }: VowTools, zcf: ZCF): (chainAddress: ChainAddress, bondDenom: string, io: {
33
+ account: IcaAccount;
34
+ storageNode: Remote<StorageNode>;
35
+ icqConnection: ICQConnection | undefined;
36
+ timer: Remote<TimerService>;
37
+ }) => import("@endo/exo").GuardedKit<{
38
+ helper: {
39
+ /** @throws if this holder no longer owns the account */
40
+ owned(): IcaAccount;
41
+ getUpdater(): import("@agoric/zoe/src/contractSupport/recorder.js").Recorder<ComosOrchestrationAccountNotification>;
42
+ /**
43
+ * @param {AmountArg} amount
44
+ * @returns {Coin}
45
+ */
46
+ amountToCoin(amount: AmountArg): Coin;
47
+ };
48
+ balanceQueryWatcher: {
49
+ /**
50
+ * @param {JsonSafe<ResponseQuery>[]} results
51
+ */
52
+ onFulfilled([result]: JsonSafe<ResponseQuery>[]): DenomAmount;
53
+ };
54
+ undelegateWatcher: {
55
+ /**
56
+ * @param {string} result
57
+ */
58
+ onFulfilled(result: string): Vow<import("@agoric/time").TimestampRecord>;
59
+ };
60
+ /**
61
+ * takes an array of results (from `executeEncodedTx`) and returns void
62
+ * since we are not interested in the result
63
+ */
64
+ returnVoidWatcher: {
65
+ /** @param {string | Record<string, unknown>} result */
66
+ onFulfilled(result: string | Record<string, unknown>): undefined;
67
+ };
68
+ withdrawRewardWatcher: {
69
+ /** @param {string} result */
70
+ onFulfilled(result: string): DenomAmount[];
71
+ };
72
+ invitationMakers: {
73
+ /**
74
+ * @param {CosmosValidatorAddress} validator
75
+ * @param {AmountArg} amount
76
+ */
77
+ Delegate(validator: CosmosValidatorAddress, amount: AmountArg): Promise<Invitation<Vow<undefined>, undefined>>;
78
+ /**
79
+ * @param {CosmosValidatorAddress} srcValidator
80
+ * @param {CosmosValidatorAddress} dstValidator
81
+ * @param {AmountArg} amount
82
+ */
83
+ Redelegate(srcValidator: CosmosValidatorAddress, dstValidator: CosmosValidatorAddress, amount: AmountArg): Promise<Invitation<Vow<undefined>, undefined>>;
84
+ /** @param {CosmosValidatorAddress} validator */
85
+ WithdrawReward(validator: CosmosValidatorAddress): Promise<Invitation<Vow<DenomAmount[]>, undefined>>;
86
+ /** @param {Omit<Delegation, 'delegatorAddress'>[]} delegations */
87
+ Undelegate(delegations: Omit<Delegation, "delegatorAddress">[]): Promise<Invitation<Vow<undefined>, undefined>>;
88
+ CloseAccount(): never;
89
+ /**
90
+ * Starting a transfer revokes the account holder. The associated
91
+ * updater will get a special notification that the account is being
92
+ * transferred.
93
+ */
94
+ TransferAccount(): never;
95
+ };
96
+ holder: {
97
+ asContinuingOffer(): {
98
+ publicSubscribers: {
99
+ account: {
100
+ description: string;
101
+ subscriber: globalThis.Subscriber<ComosOrchestrationAccountNotification>;
102
+ storagePath: Promise<string>;
103
+ };
104
+ };
105
+ invitationMakers: import("@endo/exo").Guarded<{
106
+ /**
107
+ * @param {CosmosValidatorAddress} validator
108
+ * @param {AmountArg} amount
109
+ */
110
+ Delegate(validator: CosmosValidatorAddress, amount: AmountArg): Promise<Invitation<Vow<undefined>, undefined>>;
111
+ /**
112
+ * @param {CosmosValidatorAddress} srcValidator
113
+ * @param {CosmosValidatorAddress} dstValidator
114
+ * @param {AmountArg} amount
115
+ */
116
+ Redelegate(srcValidator: CosmosValidatorAddress, dstValidator: CosmosValidatorAddress, amount: AmountArg): Promise<Invitation<Vow<undefined>, undefined>>;
117
+ /** @param {CosmosValidatorAddress} validator */
118
+ WithdrawReward(validator: CosmosValidatorAddress): Promise<Invitation<Vow<DenomAmount[]>, undefined>>;
119
+ /** @param {Omit<Delegation, 'delegatorAddress'>[]} delegations */
120
+ Undelegate(delegations: Omit<Delegation, "delegatorAddress">[]): Promise<Invitation<Vow<undefined>, undefined>>;
121
+ CloseAccount(): never;
122
+ /**
123
+ * Starting a transfer revokes the account holder. The associated
124
+ * updater will get a special notification that the account is being
125
+ * transferred.
126
+ */
127
+ TransferAccount(): never;
128
+ }>;
129
+ holder: import("@endo/exo").Guarded<any>;
130
+ };
131
+ getPublicTopics(): {
132
+ account: {
133
+ description: string;
134
+ subscriber: globalThis.Subscriber<ComosOrchestrationAccountNotification>;
135
+ storagePath: Promise<string>;
136
+ };
137
+ };
138
+ /** @returns {ChainAddress} */
139
+ getAddress(): ChainAddress;
140
+ /**
141
+ * _Assumes users has already sent funds to their ICA, until #9193
142
+ *
143
+ * @param {CosmosValidatorAddress} validator
144
+ * @param {AmountArg} amount
145
+ */
146
+ delegate(validator: CosmosValidatorAddress, amount: AmountArg): Vow<undefined>;
147
+ deposit(payment: any): void;
148
+ getBalances(): Vow<never>;
149
+ /**
150
+ * _Assumes users has already sent funds to their ICA, until #9193
151
+ *
152
+ * @param {CosmosValidatorAddress} srcValidator
153
+ * @param {CosmosValidatorAddress} dstValidator
154
+ * @param {AmountArg} amount
155
+ */
156
+ redelegate(srcValidator: CosmosValidatorAddress, dstValidator: CosmosValidatorAddress, amount: AmountArg): Vow<undefined>;
157
+ /**
158
+ * @param {CosmosValidatorAddress} validator
159
+ * @returns {Vow<DenomAmount[]>}
160
+ */
161
+ withdrawReward(validator: CosmosValidatorAddress): Vow<DenomAmount[]>;
162
+ /**
163
+ * @param {DenomArg} denom
164
+ * @returns {Vow<DenomAmount>}
165
+ */
166
+ getBalance(denom: DenomArg): Vow<DenomAmount>;
167
+ send(toAccount: any, amount: any): Vow<never>;
168
+ transfer(amount: any, msg: any): Vow<never>;
169
+ transferSteps(amount: any, msg: any): Vow<never>;
170
+ withdrawRewards(): Vow<never>;
171
+ /** @param {Omit<Delegation, 'delegatorAddress'>[]} delegations */
172
+ undelegate(delegations: Omit<Delegation, "delegatorAddress">[]): Vow<undefined>;
173
+ };
174
+ }>;
175
+ export function prepareCosmosOrchestrationAccount(zone: Zone, makeRecorderKit: MakeRecorderKit, vowTools: VowTools, zcf: ZCF): (...args: Parameters<ReturnType<typeof prepareCosmosOrchestrationAccountKit>>) => CosmosOrchestrationAccountKit["holder"];
176
+ export type ComosOrchestrationAccountNotification = {
177
+ chainAddress: ChainAddress;
178
+ };
179
+ export type State = {
180
+ topicKit: RecorderKit<ComosOrchestrationAccountNotification>;
181
+ account: IcaAccount;
182
+ chainAddress: ChainAddress;
183
+ icqConnection: ICQConnection | undefined;
184
+ bondDenom: string;
185
+ timer: Remote<TimerService>;
186
+ };
187
+ export type CosmosOrchestrationAccountKit = ReturnType<ReturnType<typeof prepareCosmosOrchestrationAccountKit>>;
188
+ export type CosmosOrchestrationAccount = CosmosOrchestrationAccountKit["holder"];
189
+ import type { Zone } from '@agoric/zone';
190
+ import type { MakeRecorderKit } from '@agoric/zoe/src/contractSupport/recorder.js';
191
+ import type { VowTools } from '@agoric/vow';
192
+ import type { ChainAddress } from '../types.js';
193
+ import type { IcaAccount } from '../types.js';
194
+ import type { Remote } from '@agoric/internal';
195
+ import type { ICQConnection } from '../types.js';
196
+ import type { TimerService } from '@agoric/time';
197
+ import type { AmountArg } from '../types.js';
198
+ import type { Coin } from '@agoric/cosmic-proto/cosmos/base/v1beta1/coin.js';
199
+ import type { ResponseQuery } from '@agoric/cosmic-proto/tendermint/abci/types.js';
200
+ import type { JsonSafe } from '@agoric/cosmic-proto';
201
+ import type { DenomAmount } from '../types.js';
202
+ import type { Vow } from '@agoric/vow';
203
+ import type { CosmosValidatorAddress } from '../types.js';
204
+ import type { Delegation } from '@agoric/cosmic-proto/cosmos/staking/v1beta1/staking.js';
205
+ import type { DenomArg } from '../types.js';
206
+ import type { RecorderKit } from '@agoric/zoe/src/contractSupport/recorder.js';
207
+ //# sourceMappingURL=cosmos-orchestration-account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cosmos-orchestration-account.d.ts","sourceRoot":"","sources":["cosmos-orchestration-account.js"],"names":[],"mappings":"AAqDA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,mCAAmC;AACnC;;;;;;;;;;;;;;;GAmBG;AAgBI,2DALI,IAAI,mBACJ,eAAe,oBACf,QAAQ,OACR,GAAG;aAwDC,UAAU;iBACV,OAAO,WAAW,CAAC;mBACnB,aAAa,GAAG,SAAS;WACzB,OAAO,YAAY,CAAC;;;QAe3B,wDAAwD;;;QAWxD;;;WAGG;6BAFQ,SAAS,GACP,IAAI;;;QAiBjB;;WAEG;8BADQ,SAAS,aAAa,CAAC,EAAE;;;QAYpC;;WAEG;4BADQ,MAAM;;IAiBnB;;;OAGG;;QAED,uDAAuD;4BAA3C,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;QAO5C,6BA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