@agoric/orchestration 0.2.0 → 0.2.1-upgrade-23-dev-bd79330.0.bd79330

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 (234) hide show
  1. package/index.js +0 -4
  2. package/package.json +27 -27
  3. package/src/axelar-types.d.ts +2 -0
  4. package/src/axelar-types.d.ts.map +1 -1
  5. package/src/axelar-types.js +2 -0
  6. package/src/cctp-chain-info.js +4 -1
  7. package/src/chain-info.d.ts +21 -6
  8. package/src/chain-info.d.ts.map +1 -1
  9. package/src/chain-info.js +9 -8
  10. package/src/cosmos-api.d.ts +102 -29
  11. package/src/cosmos-api.d.ts.map +1 -1
  12. package/src/cosmos-api.js +585 -0
  13. package/src/{ethereum-api.ts → ethereum-api.js} +1 -1
  14. package/src/examples/auto-stake-it-tap-kit.d.ts +4 -3
  15. package/src/examples/auto-stake-it-tap-kit.d.ts.map +1 -1
  16. package/src/examples/auto-stake-it-tap-kit.js +3 -4
  17. package/src/examples/auto-stake-it.contract.d.ts +6 -4
  18. package/src/examples/auto-stake-it.contract.d.ts.map +1 -1
  19. package/src/examples/auto-stake-it.contract.js +3 -1
  20. package/src/examples/auto-stake-it.flows.d.ts +2 -1
  21. package/src/examples/auto-stake-it.flows.d.ts.map +1 -1
  22. package/src/examples/auto-stake-it.flows.js +1 -0
  23. package/src/examples/axelar-gmp-account-kit.d.ts +6 -4
  24. package/src/examples/axelar-gmp-account-kit.d.ts.map +1 -1
  25. package/src/examples/axelar-gmp-account-kit.js +4 -2
  26. package/src/examples/axelar-gmp.contract.d.ts +8 -8
  27. package/src/examples/axelar-gmp.contract.d.ts.map +1 -1
  28. package/src/examples/axelar-gmp.contract.js +2 -2
  29. package/src/examples/axelar-gmp.flows.d.ts +1 -1
  30. package/src/examples/basic-flows.contract.d.ts +7 -5
  31. package/src/examples/basic-flows.contract.d.ts.map +1 -1
  32. package/src/examples/basic-flows.contract.js +3 -1
  33. package/src/examples/basic-flows.flows.d.ts +2 -1
  34. package/src/examples/basic-flows.flows.d.ts.map +1 -1
  35. package/src/examples/basic-flows.flows.js +1 -0
  36. package/src/examples/send-anywhere.contract.d.ts +12 -6
  37. package/src/examples/send-anywhere.contract.d.ts.map +1 -1
  38. package/src/examples/send-anywhere.contract.js +4 -1
  39. package/src/examples/send-anywhere.flows.d.ts +3 -2
  40. package/src/examples/send-anywhere.flows.d.ts.map +1 -1
  41. package/src/examples/send-anywhere.flows.js +3 -6
  42. package/src/examples/stake-bld.contract.d.ts +206 -25
  43. package/src/examples/stake-bld.contract.d.ts.map +1 -1
  44. package/src/examples/stake-bld.contract.js +19 -4
  45. package/src/examples/stake-ica.contract.d.ts +434 -71
  46. package/src/examples/stake-ica.contract.d.ts.map +1 -1
  47. package/src/examples/stake-ica.contract.js +28 -6
  48. package/src/examples/staking-combinations.contract.d.ts +4 -2
  49. package/src/examples/staking-combinations.contract.d.ts.map +1 -1
  50. package/src/examples/staking-combinations.contract.js +5 -3
  51. package/src/examples/staking-combinations.flows.d.ts +3 -2
  52. package/src/examples/staking-combinations.flows.d.ts.map +1 -1
  53. package/src/examples/staking-combinations.flows.js +7 -6
  54. package/src/examples/swap-anything.contract.d.ts +14 -7
  55. package/src/examples/swap-anything.contract.d.ts.map +1 -1
  56. package/src/examples/swap-anything.contract.js +12 -8
  57. package/src/examples/swap.contract.d.ts +18 -6
  58. package/src/examples/swap.contract.d.ts.map +1 -1
  59. package/src/examples/swap.contract.js +9 -3
  60. package/src/examples/swap.flows.d.ts +2 -0
  61. package/src/examples/swap.flows.d.ts.map +1 -1
  62. package/src/examples/swap.flows.js +2 -0
  63. package/src/examples/unbond.contract.d.ts +7 -4
  64. package/src/examples/unbond.contract.d.ts.map +1 -1
  65. package/src/examples/unbond.contract.js +6 -3
  66. package/src/exos/chain-hub-admin.d.ts +1 -19
  67. package/src/exos/chain-hub-admin.d.ts.map +1 -1
  68. package/src/exos/chain-hub-admin.js +1 -1
  69. package/src/exos/chain-hub.d.ts +4 -2
  70. package/src/exos/chain-hub.d.ts.map +1 -1
  71. package/src/exos/chain-hub.js +2 -1
  72. package/src/exos/combine-invitation-makers.d.ts +2 -1
  73. package/src/exos/combine-invitation-makers.d.ts.map +1 -1
  74. package/src/exos/combine-invitation-makers.js +2 -1
  75. package/src/exos/cosmos-orchestration-account.d.ts +615 -98
  76. package/src/exos/cosmos-orchestration-account.d.ts.map +1 -1
  77. package/src/exos/cosmos-orchestration-account.js +695 -306
  78. package/src/exos/exo-interfaces.js +35 -0
  79. package/src/exos/ibc-packet.d.ts +11 -9
  80. package/src/exos/ibc-packet.d.ts.map +1 -1
  81. package/src/exos/ibc-packet.js +33 -8
  82. package/src/exos/ica-account-kit.d.ts +4 -9
  83. package/src/exos/ica-account-kit.d.ts.map +1 -1
  84. package/src/exos/ica-account-kit.js +10 -7
  85. package/src/exos/icq-connection-kit.d.ts +1 -1
  86. package/src/exos/local-chain-facade.d.ts +1542 -5
  87. package/src/exos/local-chain-facade.d.ts.map +1 -1
  88. package/src/exos/local-chain-facade.js +4 -2
  89. package/src/exos/local-orchestration-account.d.ts +201 -56
  90. package/src/exos/local-orchestration-account.d.ts.map +1 -1
  91. package/src/exos/local-orchestration-account.js +260 -51
  92. package/src/exos/orchestrator.d.ts +35813 -73
  93. package/src/exos/orchestrator.d.ts.map +1 -1
  94. package/src/exos/orchestrator.js +7 -10
  95. package/src/exos/packet-tools.d.ts +19 -8
  96. package/src/exos/packet-tools.d.ts.map +1 -1
  97. package/src/exos/packet-tools.js +92 -9
  98. package/src/exos/portfolio-holder-kit.d.ts +90 -2
  99. package/src/exos/portfolio-holder-kit.d.ts.map +1 -1
  100. package/src/exos/remote-chain-facade.d.ts +1499 -1
  101. package/src/exos/remote-chain-facade.d.ts.map +1 -1
  102. package/src/exos/remote-chain-facade.js +8 -3
  103. package/src/facade.d.ts +1 -0
  104. package/src/facade.d.ts.map +1 -1
  105. package/src/facade.js +4 -6
  106. package/src/fixtures/query-flows.contract.d.ts +8 -6
  107. package/src/fixtures/query-flows.contract.d.ts.map +1 -1
  108. package/src/fixtures/query-flows.contract.js +3 -1
  109. package/src/fixtures/query-flows.flows.d.ts +1 -0
  110. package/src/fixtures/query-flows.flows.d.ts.map +1 -1
  111. package/src/fixtures/query-flows.flows.js +1 -0
  112. package/src/orchestration-api.d.ts +46 -16
  113. package/src/orchestration-api.d.ts.map +1 -1
  114. package/src/orchestration-api.js +410 -0
  115. package/src/proposals/init-chain-info.js +10 -2
  116. package/src/proposals/orchestration-proposal.js +3 -0
  117. package/src/proposals/revise-chain-info.js +4 -1
  118. package/src/proposals/start-auto-stake-it.js +1 -0
  119. package/src/proposals/start-axelar-gmp.js +2 -2
  120. package/src/proposals/start-basic-flows.js +5 -0
  121. package/src/proposals/start-send-anywhere.js +4 -2
  122. package/src/proposals/start-stakeAtom.js +5 -4
  123. package/src/proposals/start-stakeBld.js +8 -6
  124. package/src/proposals/start-stakeOsmo.js +5 -4
  125. package/src/proposals/start-swap-anything.js +4 -2
  126. package/src/stubs/{viem-abi.d.ts → viem-typedData.js} +10 -4
  127. package/src/typeGuards.d.ts +38 -5
  128. package/src/typeGuards.d.ts.map +1 -1
  129. package/src/typeGuards.js +92 -22
  130. package/src/types.d.ts +1 -0
  131. package/src/types.d.ts.map +1 -1
  132. package/src/types.js +27 -0
  133. package/src/utils/abitype.d.ts +6 -0
  134. package/src/utils/abitype.d.ts.map +1 -0
  135. package/src/utils/abitype.js +13 -0
  136. package/src/utils/address.d.ts +3 -1
  137. package/src/utils/address.d.ts.map +1 -1
  138. package/src/utils/address.js +24 -2
  139. package/src/utils/agd-lib.d.ts +1 -51
  140. package/src/utils/agd-lib.d.ts.map +1 -1
  141. package/src/utils/agd-lib.js +1 -1
  142. package/src/utils/amounts.d.ts +1 -0
  143. package/src/utils/amounts.d.ts.map +1 -1
  144. package/src/utils/amounts.js +1 -0
  145. package/src/utils/asset.d.ts +1 -0
  146. package/src/utils/asset.d.ts.map +1 -1
  147. package/src/utils/asset.js +1 -0
  148. package/src/utils/chain-hub-helper.d.ts +1 -0
  149. package/src/utils/chain-hub-helper.d.ts.map +1 -1
  150. package/src/utils/chain-hub-helper.js +1 -0
  151. package/src/utils/codecs.d.ts +145 -0
  152. package/src/utils/codecs.d.ts.map +1 -0
  153. package/src/utils/codecs.js +206 -0
  154. package/src/utils/cosmos.d.ts +5 -4
  155. package/src/utils/cosmos.d.ts.map +1 -1
  156. package/src/utils/cosmos.js +29 -9
  157. package/src/utils/exo-helpers.d.ts +156 -0
  158. package/src/utils/exo-helpers.d.ts.map +1 -0
  159. package/src/utils/exo-helpers.js +241 -0
  160. package/src/utils/gmp.d.ts +2 -2
  161. package/src/utils/gmp.d.ts.map +1 -1
  162. package/src/utils/gmp.js +31 -15
  163. package/src/utils/orchestrationAccount.d.ts +79 -0
  164. package/src/utils/orchestrationAccount.d.ts.map +1 -1
  165. package/src/utils/orchestrationAccount.js +210 -6
  166. package/src/utils/packet.d.ts.map +1 -1
  167. package/src/utils/packet.js +5 -0
  168. package/src/utils/permit2/signatureTransfer.d.ts +221 -0
  169. package/src/utils/permit2/signatureTransfer.d.ts.map +1 -0
  170. package/src/utils/permit2/signatureTransfer.js +265 -0
  171. package/src/utils/permit2/signatureTransferHelpers.d.ts +334 -0
  172. package/src/utils/permit2/signatureTransferHelpers.d.ts.map +1 -0
  173. package/src/utils/permit2/signatureTransferHelpers.js +270 -0
  174. package/src/utils/permit2.d.ts +11 -0
  175. package/src/utils/permit2.d.ts.map +1 -0
  176. package/src/utils/permit2.js +11 -0
  177. package/src/utils/progress.d.ts +41 -0
  178. package/src/utils/progress.d.ts.map +1 -0
  179. package/src/utils/progress.js +180 -0
  180. package/src/utils/start-helper.d.ts +28 -10
  181. package/src/utils/start-helper.d.ts.map +1 -1
  182. package/src/utils/start-helper.js +30 -7
  183. package/src/utils/time.d.ts +2 -2
  184. package/src/utils/time.d.ts.map +1 -1
  185. package/src/utils/time.js +1 -1
  186. package/src/utils/viem-utils/hashTypedData.d.ts +21 -0
  187. package/src/utils/viem-utils/hashTypedData.d.ts.map +1 -0
  188. package/src/utils/viem-utils/hashTypedData.js +61 -0
  189. package/src/utils/viem-utils/types.d.ts +6 -0
  190. package/src/utils/viem-utils/types.d.ts.map +1 -0
  191. package/src/utils/viem-utils/types.js +18 -0
  192. package/src/utils/viem.d.ts +11 -0
  193. package/src/utils/viem.d.ts.map +1 -0
  194. package/src/utils/viem.js +11 -0
  195. package/src/utils/zcf-tools.d.ts +15 -1
  196. package/src/utils/zcf-tools.d.ts.map +1 -1
  197. package/src/utils/zcf-tools.js +19 -3
  198. package/src/utils/zoe-tools.d.ts +5 -2
  199. package/src/utils/zoe-tools.d.ts.map +1 -1
  200. package/src/utils/zoe-tools.js +8 -2
  201. package/src/vat-orchestration.d.ts +5 -3
  202. package/src/vat-orchestration.d.ts.map +1 -1
  203. package/src/vat-orchestration.js +4 -3
  204. package/src/vendor/viem/{_esm-YOAV66U4.js → _esm-OKAICHVC.js} +2 -2
  205. package/src/vendor/viem/{ccip-AAQDZF3N.js → ccip-34BSSMV5.js} +1 -2
  206. package/src/vendor/viem/{chunk-4EF4K2MH.js → chunk-GCI53Z2G.js} +35 -1
  207. package/src/vendor/viem/chunk-ZKSIP2AM.js +326 -0
  208. package/src/vendor/viem/viem-abi.js +2 -2
  209. package/src/vendor/viem/viem-typedData.d.ts +19 -0
  210. package/src/vendor/viem/viem-typedData.js +59 -0
  211. package/tools/contract-tests.d.ts +34 -19
  212. package/tools/contract-tests.d.ts.map +1 -1
  213. package/tools/contract-tests.ts +15 -3
  214. package/tools/ibc-mock-fixtures.d.ts +49 -0
  215. package/tools/ibc-mock-fixtures.d.ts.map +1 -0
  216. package/tools/ibc-mock-fixtures.ts +161 -0
  217. package/tools/ibc-mocks.d.ts +2 -3
  218. package/tools/ibc-mocks.d.ts.map +1 -1
  219. package/tools/ibc-mocks.ts +2 -1
  220. package/tools/make-test-address.d.ts +1 -1
  221. package/tools/make-test-address.d.ts.map +1 -1
  222. package/tools/make-test-address.js +1 -2
  223. package/tools/network-fakes.d.ts +142 -0
  224. package/tools/network-fakes.d.ts.map +1 -0
  225. package/tools/network-fakes.ts +388 -0
  226. package/tsup.config.ts +3 -1
  227. package/src/cosmos-api.ts +0 -469
  228. package/src/exos/exo-interfaces.ts +0 -35
  229. package/src/orchestration-api.ts +0 -365
  230. package/src/stubs/viem-abi.d.ts.map +0 -1
  231. package/src/types.ts +0 -26
  232. package/src/vendor/viem/chunk-XN4LUOIH.js +0 -253
  233. package/src/vendor/viem/secp256k1-WHBDSQB2.js +0 -1914
  234. /package/src/stubs/{viem-abi.ts → viem-abi.js} +0 -0
@@ -0,0 +1,334 @@
1
+ /**
2
+ * @file Helpers for working with Uniswap Permit2 SignatureTransfer
3
+ * `permitWitnessTransferFrom`.
4
+ * @see {@link https://docs.uniswap.org/contracts/permit2/reference/signature-transfer}
5
+ *
6
+ * This is original code that was adapted for permit2-sdk, unlike @see ./permit2SignatureTransfer.ts
7
+ */
8
+ import type { AbiParameterToPrimitiveType, TypedData } from 'abitype';
9
+ import type { TypedDataParameter } from '../abitype.js';
10
+ import type { encodeType } from '../viem-utils/hashTypedData.js';
11
+ declare const PrimaryTypes: import("@agoric/internal/src/keyMirror.js").KeyMirrorResult<{
12
+ PermitBatchWitnessTransferFrom: null;
13
+ PermitWitnessTransferFrom: null;
14
+ }>;
15
+ type PrimaryTypeName = keyof typeof PrimaryTypes;
16
+ export declare const isPermit2MessageType: (type: string) => type is PrimaryTypeName;
17
+ declare const permit2BaseTypeParams: {
18
+ PermitBatchWitnessTransferFrom: [{
19
+ readonly name: "permitted";
20
+ readonly type: "TokenPermissions[]";
21
+ }, {
22
+ readonly name: "spender";
23
+ readonly type: "address";
24
+ }, {
25
+ readonly name: "nonce";
26
+ readonly type: "uint256";
27
+ }, {
28
+ readonly name: "deadline";
29
+ readonly type: "uint256";
30
+ }];
31
+ PermitWitnessTransferFrom: [{
32
+ readonly name: "permitted";
33
+ readonly type: "TokenPermissions";
34
+ }, {
35
+ readonly name: "spender";
36
+ readonly type: "address";
37
+ }, {
38
+ readonly name: "nonce";
39
+ readonly type: "uint256";
40
+ }, {
41
+ readonly name: "deadline";
42
+ readonly type: "uint256";
43
+ }];
44
+ };
45
+ /**
46
+ * Make a function for returning the `witnessTypeString` argument to use in a
47
+ * `permitWitnessTransferFrom` call.
48
+ */
49
+ export declare const makeWitnessTypeStringExtractor: (powers: {
50
+ encodeType: typeof encodeType;
51
+ }) => (types: TypedData) => string;
52
+ /**
53
+ * Confirm that the input is a EIP-712 `types` record with a single struct
54
+ * definition for the first argument to a `permitWitnessTransferFrom` call
55
+ * (i.e., named either "PermitWitnessTransferFrom" for a single-token transfer
56
+ * or "PermitBatchWitnessTransferFrom" for a multi-token transfer), and return
57
+ * the TypedDataParameter describing the witness field of that definition.
58
+ */
59
+ export declare const extractWitnessFieldFromTypes: <T extends Readonly<TypedDataParameter>>(types: { [K in PrimaryTypeName]: Record<K, readonly [...(typeof permit2BaseTypeParams)[K], T]>; }[PrimaryTypeName]) => T;
60
+ export declare const TokenPermissionsComponents: [{
61
+ readonly name: "token";
62
+ readonly type: "address";
63
+ }, {
64
+ readonly name: "amount";
65
+ readonly type: "uint256";
66
+ }];
67
+ export declare const TokenPermissionsInternalTypeName: "struct ISignatureTransfer.TokenPermissions";
68
+ export declare const PermitTransferFromComponents: [{
69
+ readonly name: "permitted";
70
+ readonly type: "tuple";
71
+ readonly internalType: "struct ISignatureTransfer.TokenPermissions";
72
+ readonly components: [{
73
+ readonly name: "token";
74
+ readonly type: "address";
75
+ }, {
76
+ readonly name: "amount";
77
+ readonly type: "uint256";
78
+ }];
79
+ }, {
80
+ readonly name: "nonce";
81
+ readonly type: "uint256";
82
+ }, {
83
+ readonly name: "deadline";
84
+ readonly type: "uint256";
85
+ }];
86
+ export declare const PermitTransferFromInternalTypeName: "struct ISignatureTransfer.PermitTransferFrom";
87
+ export type PermitTransferFromStruct = AbiParameterToPrimitiveType<{
88
+ type: 'tuple';
89
+ internalType: typeof PermitTransferFromInternalTypeName;
90
+ components: typeof PermitTransferFromComponents;
91
+ }>;
92
+ export declare const PermitBatchTransferFromComponents: [{
93
+ readonly name: "permitted";
94
+ readonly type: "tuple[]";
95
+ readonly internalType: "struct ISignatureTransfer.TokenPermissions[]";
96
+ readonly components: [{
97
+ readonly name: "token";
98
+ readonly type: "address";
99
+ }, {
100
+ readonly name: "amount";
101
+ readonly type: "uint256";
102
+ }];
103
+ }, {
104
+ readonly name: "nonce";
105
+ readonly type: "uint256";
106
+ }, {
107
+ readonly name: "deadline";
108
+ readonly type: "uint256";
109
+ }];
110
+ export declare const PermitBatchTransferFromInternalTypeName: "struct ISignatureTransfer.PermitBatchTransferFrom";
111
+ export type PermitBatchTransferFromStruct = AbiParameterToPrimitiveType<{
112
+ type: 'tuple';
113
+ internalType: typeof PermitBatchTransferFromInternalTypeName;
114
+ components: typeof PermitBatchTransferFromComponents;
115
+ }>;
116
+ export declare const SignatureTransferDetailsComponents: [{
117
+ readonly name: "to";
118
+ readonly type: "address";
119
+ }, {
120
+ readonly name: "requestedAmount";
121
+ readonly type: "uint256";
122
+ }];
123
+ export declare const SignatureTransferDetailsInternalTypeName: "struct ISignatureTransfer.SignatureTransferDetails";
124
+ export type SignatureTransferDetailsStruct = AbiParameterToPrimitiveType<{
125
+ type: 'tuple';
126
+ internalType: typeof SignatureTransferDetailsInternalTypeName;
127
+ components: typeof SignatureTransferDetailsComponents;
128
+ }>;
129
+ export declare const PermitWitnessTransferFromInputComponents: [{
130
+ readonly name: "permit";
131
+ readonly type: "tuple";
132
+ readonly internalType: "struct ISignatureTransfer.PermitTransferFrom";
133
+ readonly components: [{
134
+ readonly name: "permitted";
135
+ readonly type: "tuple";
136
+ readonly internalType: "struct ISignatureTransfer.TokenPermissions";
137
+ readonly components: [{
138
+ readonly name: "token";
139
+ readonly type: "address";
140
+ }, {
141
+ readonly name: "amount";
142
+ readonly type: "uint256";
143
+ }];
144
+ }, {
145
+ readonly name: "nonce";
146
+ readonly type: "uint256";
147
+ }, {
148
+ readonly name: "deadline";
149
+ readonly type: "uint256";
150
+ }];
151
+ }, {
152
+ readonly name: "transferDetails";
153
+ readonly type: "tuple";
154
+ readonly internalType: "struct ISignatureTransfer.SignatureTransferDetails";
155
+ readonly components: [{
156
+ readonly name: "to";
157
+ readonly type: "address";
158
+ }, {
159
+ readonly name: "requestedAmount";
160
+ readonly type: "uint256";
161
+ }];
162
+ }, {
163
+ readonly name: "owner";
164
+ readonly type: "address";
165
+ }, {
166
+ readonly name: "witness";
167
+ readonly type: "bytes32";
168
+ }, {
169
+ readonly name: "witnessTypeString";
170
+ readonly type: "string";
171
+ }, {
172
+ readonly name: "signature";
173
+ readonly type: "bytes";
174
+ }];
175
+ export type PermitWitnessTransferFromPayload = AbiParameterToPrimitiveType<{
176
+ type: 'tuple';
177
+ components: typeof PermitWitnessTransferFromInputComponents;
178
+ }>;
179
+ export declare const BatchPermitWitnessTransferFromInputComponents: [{
180
+ readonly name: "permit";
181
+ readonly type: "tuple";
182
+ readonly internalType: "struct ISignatureTransfer.PermitBatchTransferFrom";
183
+ readonly components: [{
184
+ readonly name: "permitted";
185
+ readonly type: "tuple[]";
186
+ readonly internalType: "struct ISignatureTransfer.TokenPermissions[]";
187
+ readonly components: [{
188
+ readonly name: "token";
189
+ readonly type: "address";
190
+ }, {
191
+ readonly name: "amount";
192
+ readonly type: "uint256";
193
+ }];
194
+ }, {
195
+ readonly name: "nonce";
196
+ readonly type: "uint256";
197
+ }, {
198
+ readonly name: "deadline";
199
+ readonly type: "uint256";
200
+ }];
201
+ }, {
202
+ readonly name: "transferDetails";
203
+ readonly type: "tuple[]";
204
+ readonly internalType: "struct ISignatureTransfer.SignatureTransferDetails[]";
205
+ readonly components: [{
206
+ readonly name: "to";
207
+ readonly type: "address";
208
+ }, {
209
+ readonly name: "requestedAmount";
210
+ readonly type: "uint256";
211
+ }];
212
+ }, {
213
+ readonly name: "owner";
214
+ readonly type: "address";
215
+ }, {
216
+ readonly name: "witness";
217
+ readonly type: "bytes32";
218
+ }, {
219
+ readonly name: "witnessTypeString";
220
+ readonly type: "string";
221
+ }, {
222
+ readonly name: "signature";
223
+ readonly type: "bytes";
224
+ }];
225
+ export type BatchPermitWitnessTransferFromPayload = AbiParameterToPrimitiveType<{
226
+ type: 'tuple';
227
+ components: typeof BatchPermitWitnessTransferFromInputComponents;
228
+ }>;
229
+ export declare const PermitWitnessTransferFromFunctionABIType: {
230
+ readonly name: "permitWitnessTransferFrom";
231
+ readonly inputs: [{
232
+ readonly name: "permit";
233
+ readonly type: "tuple";
234
+ readonly internalType: "struct ISignatureTransfer.PermitTransferFrom";
235
+ readonly components: [{
236
+ readonly name: "permitted";
237
+ readonly type: "tuple";
238
+ readonly internalType: "struct ISignatureTransfer.TokenPermissions";
239
+ readonly components: [{
240
+ readonly name: "token";
241
+ readonly type: "address";
242
+ }, {
243
+ readonly name: "amount";
244
+ readonly type: "uint256";
245
+ }];
246
+ }, {
247
+ readonly name: "nonce";
248
+ readonly type: "uint256";
249
+ }, {
250
+ readonly name: "deadline";
251
+ readonly type: "uint256";
252
+ }];
253
+ }, {
254
+ readonly name: "transferDetails";
255
+ readonly type: "tuple";
256
+ readonly internalType: "struct ISignatureTransfer.SignatureTransferDetails";
257
+ readonly components: [{
258
+ readonly name: "to";
259
+ readonly type: "address";
260
+ }, {
261
+ readonly name: "requestedAmount";
262
+ readonly type: "uint256";
263
+ }];
264
+ }, {
265
+ readonly name: "owner";
266
+ readonly type: "address";
267
+ }, {
268
+ readonly name: "witness";
269
+ readonly type: "bytes32";
270
+ }, {
271
+ readonly name: "witnessTypeString";
272
+ readonly type: "string";
273
+ }, {
274
+ readonly name: "signature";
275
+ readonly type: "bytes";
276
+ }];
277
+ readonly outputs: readonly [];
278
+ readonly stateMutability: "nonpayable";
279
+ readonly type: "function";
280
+ };
281
+ export declare const BatchPermitWitnessTransferFunctionABIType: {
282
+ readonly name: "permitWitnessTransferFrom";
283
+ readonly inputs: [{
284
+ readonly name: "permit";
285
+ readonly type: "tuple";
286
+ readonly internalType: "struct ISignatureTransfer.PermitBatchTransferFrom";
287
+ readonly components: [{
288
+ readonly name: "permitted";
289
+ readonly type: "tuple[]";
290
+ readonly internalType: "struct ISignatureTransfer.TokenPermissions[]";
291
+ readonly components: [{
292
+ readonly name: "token";
293
+ readonly type: "address";
294
+ }, {
295
+ readonly name: "amount";
296
+ readonly type: "uint256";
297
+ }];
298
+ }, {
299
+ readonly name: "nonce";
300
+ readonly type: "uint256";
301
+ }, {
302
+ readonly name: "deadline";
303
+ readonly type: "uint256";
304
+ }];
305
+ }, {
306
+ readonly name: "transferDetails";
307
+ readonly type: "tuple[]";
308
+ readonly internalType: "struct ISignatureTransfer.SignatureTransferDetails[]";
309
+ readonly components: [{
310
+ readonly name: "to";
311
+ readonly type: "address";
312
+ }, {
313
+ readonly name: "requestedAmount";
314
+ readonly type: "uint256";
315
+ }];
316
+ }, {
317
+ readonly name: "owner";
318
+ readonly type: "address";
319
+ }, {
320
+ readonly name: "witness";
321
+ readonly type: "bytes32";
322
+ }, {
323
+ readonly name: "witnessTypeString";
324
+ readonly type: "string";
325
+ }, {
326
+ readonly name: "signature";
327
+ readonly type: "bytes";
328
+ }];
329
+ readonly outputs: readonly [];
330
+ readonly stateMutability: "nonpayable";
331
+ readonly type: "function";
332
+ };
333
+ export {};
334
+ //# sourceMappingURL=signatureTransferHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signatureTransferHelpers.d.ts","sourceRoot":"","sources":["signatureTransferHelpers.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,270 @@
1
+ /**
2
+ * @file Helpers for working with Uniswap Permit2 SignatureTransfer
3
+ * `permitWitnessTransferFrom`.
4
+ * @see {@link https://docs.uniswap.org/contracts/permit2/reference/signature-transfer}
5
+ *
6
+ * This is original code that was adapted for permit2-sdk, unlike @see ./permit2SignatureTransfer.ts
7
+ */
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+ import { keyMirror } from '@agoric/internal/src/keyMirror.js';
16
+ import { objectMapMutable } from '@agoric/internal/src/js-utils.js';
17
+ ;
18
+ ;
19
+ import {
20
+ PermitBatchTransferFromTypeParams,
21
+ permitBatchWitnessTransferFromTypes,
22
+ PermitTransferFromTypeParams,
23
+ permitWitnessTransferFromTypes,
24
+ } from './signatureTransfer.js';
25
+
26
+ const PrimaryTypes = keyMirror({
27
+ PermitBatchWitnessTransferFrom: null,
28
+ PermitWitnessTransferFrom: null,
29
+ });
30
+ ;
31
+
32
+ export const isPermit2MessageType = (type ) =>
33
+ type in PrimaryTypes;
34
+
35
+ const getPrimaryType = (types ) => {
36
+ const found = Object.keys(types).filter(isPermit2MessageType);
37
+ if (found.length !== 1) {
38
+ throw new Error(
39
+ `Exactly one of the following types must be defined: ${Object.keys(PrimaryTypes).join(', ')}`,
40
+ );
41
+ }
42
+ return found[0];
43
+ };
44
+
45
+ const permit2BaseTypeParams = {
46
+ PermitBatchWitnessTransferFrom: PermitBatchTransferFromTypeParams,
47
+ PermitWitnessTransferFrom: PermitTransferFromTypeParams,
48
+ } ;
49
+
50
+ const typeMakers = {
51
+ PermitBatchWitnessTransferFrom: permitBatchWitnessTransferFromTypes,
52
+ PermitWitnessTransferFrom: permitWitnessTransferFromTypes,
53
+ } ;
54
+
55
+ /**
56
+ * Make a function for returning the `witnessTypeString` argument to use in a
57
+ * `permitWitnessTransferFrom` call.
58
+ */
59
+ export const makeWitnessTypeStringExtractor = (powers
60
+
61
+ ) => {
62
+ const { encodeType } = powers;
63
+ const encodedTypePrefixes = objectMapMutable(
64
+ typeMakers,
65
+ (makeTypes, primaryType) => {
66
+ // Each EIP-712 `types` record produced by `makeTypes` differs only in the
67
+ // fields of the struct identified by `primaryType` and any dependencies
68
+ // of its witness field, so the string encoding of any such struct will
69
+ // have a common prefix (e.g.,
70
+ // `PermitWitnessTransferFrom(TokenPermissions permitted,...,uint256 deadline,`,
71
+ // where what follows that last comma is the witness field).
72
+ // We construct that prefix by calling `makeTypes` with *no* witness,
73
+ // which is in violation of its static typing information but implemented
74
+ // to return types in which `primaryType` has no witness field and
75
+ // therefore encodes to a string with a `)` where the witness field
76
+ // belongs.
77
+ // @ts-expect-error undefined witness
78
+ const baseTypes = makeTypes(undefined);
79
+ const encoded = encodeType({ primaryType, types: baseTypes });
80
+ const prefix = encoded.substring(0, encoded.indexOf(')'));
81
+ return `${prefix},`;
82
+ },
83
+ );
84
+
85
+ /**
86
+ * Return the `witnessTypeString` argument for a `permitWitnessTransferFrom`
87
+ * call using the provided EIP-712 `types` record.
88
+ * Note that `types` must define either a valid "PermitWitnessTransferFrom" or
89
+ * a valid "PermitBatchWitnessTransferFrom", but not both.
90
+ * The returned string is the suffix of the EIP-712 encoding of that primary
91
+ * type that starts with its witness field.
92
+ */
93
+ const getWitnessTypeString = (types ) => {
94
+ const primaryType = getPrimaryType(types);
95
+ const encodedType = encodeType({ primaryType, types });
96
+
97
+ const prefix = encodedTypePrefixes[primaryType];
98
+ if (!encodedType.startsWith(prefix)) {
99
+ throw new Error(`${primaryType} must start with expected base fields`);
100
+ }
101
+
102
+ return encodedType.substring(prefix.length);
103
+ };
104
+ return getWitnessTypeString;
105
+ };
106
+
107
+ ;
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+ /**
116
+ * Confirm that the input is a EIP-712 `types` record with a single struct
117
+ * definition for the first argument to a `permitWitnessTransferFrom` call
118
+ * (i.e., named either "PermitWitnessTransferFrom" for a single-token transfer
119
+ * or "PermitBatchWitnessTransferFrom" for a multi-token transfer), and return
120
+ * the TypedDataParameter describing the witness field of that definition.
121
+ */
122
+ export const extractWitnessFieldFromTypes = (
123
+
124
+
125
+ types
126
+
127
+
128
+
129
+
130
+ ,
131
+ ) => {
132
+ const primaryTypeName = getPrimaryType(types);
133
+ const fieldDefs = (types )[primaryTypeName];
134
+
135
+ // `fieldDefs` must match the expected base type with a single extra field for
136
+ // witness data.
137
+ const baseFieldDefs = permit2BaseTypeParams[primaryTypeName];
138
+ if (fieldDefs.length !== baseFieldDefs.length + 1) {
139
+ throw new Error(
140
+ `${primaryTypeName} must have ${baseFieldDefs.length + 1} fields`,
141
+ );
142
+ }
143
+ for (const [i, { name, type }] of baseFieldDefs.entries()) {
144
+ if (fieldDefs[i].name !== name || fieldDefs[i].type !== type) {
145
+ throw new Error(
146
+ `${primaryTypeName} field at index ${i} must be \`${type} ${name}\``,
147
+ );
148
+ }
149
+ }
150
+
151
+ return fieldDefs[fieldDefs.length - 1] ;
152
+ };
153
+
154
+ export const TokenPermissionsComponents = [
155
+ { name: 'token', type: 'address' },
156
+ { name: 'amount', type: 'uint256' },
157
+ ] ;
158
+ export const TokenPermissionsInternalTypeName =
159
+ 'struct ISignatureTransfer.TokenPermissions' ;
160
+
161
+ export const PermitTransferFromComponents = [
162
+ {
163
+ name: 'permitted',
164
+ type: 'tuple',
165
+ internalType: TokenPermissionsInternalTypeName,
166
+ components: TokenPermissionsComponents,
167
+ },
168
+ { name: 'nonce', type: 'uint256' },
169
+ { name: 'deadline', type: 'uint256' },
170
+ ] ;
171
+ export const PermitTransferFromInternalTypeName =
172
+ 'struct ISignatureTransfer.PermitTransferFrom' ;
173
+ ;
174
+
175
+
176
+
177
+
178
+
179
+ export const PermitBatchTransferFromComponents = [
180
+ {
181
+ name: 'permitted',
182
+ type: 'tuple[]',
183
+ internalType: `${TokenPermissionsInternalTypeName}[]`,
184
+ components: TokenPermissionsComponents,
185
+ },
186
+ { name: 'nonce', type: 'uint256' },
187
+ { name: 'deadline', type: 'uint256' },
188
+ ] ;
189
+ export const PermitBatchTransferFromInternalTypeName =
190
+ 'struct ISignatureTransfer.PermitBatchTransferFrom' ;
191
+ ;
192
+
193
+
194
+
195
+
196
+
197
+ export const SignatureTransferDetailsComponents = [
198
+ { name: 'to', type: 'address' },
199
+ { name: 'requestedAmount', type: 'uint256' },
200
+ ] ;
201
+ export const SignatureTransferDetailsInternalTypeName =
202
+ 'struct ISignatureTransfer.SignatureTransferDetails' ;
203
+ ;
204
+
205
+
206
+
207
+
208
+
209
+ export const PermitWitnessTransferFromInputComponents = [
210
+ {
211
+ name: 'permit',
212
+ type: 'tuple',
213
+ internalType: PermitTransferFromInternalTypeName,
214
+ components: PermitTransferFromComponents,
215
+ },
216
+ {
217
+ name: 'transferDetails',
218
+ type: 'tuple',
219
+ internalType: SignatureTransferDetailsInternalTypeName,
220
+ components: SignatureTransferDetailsComponents,
221
+ },
222
+ { name: 'owner', type: 'address' },
223
+ { name: 'witness', type: 'bytes32' },
224
+ { name: 'witnessTypeString', type: 'string' },
225
+ { name: 'signature', type: 'bytes' },
226
+ ] ;
227
+ ;
228
+
229
+
230
+
231
+
232
+ export const BatchPermitWitnessTransferFromInputComponents = [
233
+ {
234
+ name: 'permit',
235
+ type: 'tuple',
236
+ internalType: PermitBatchTransferFromInternalTypeName,
237
+ components: PermitBatchTransferFromComponents,
238
+ },
239
+ {
240
+ name: 'transferDetails',
241
+ type: 'tuple[]',
242
+ internalType: `${SignatureTransferDetailsInternalTypeName}[]`,
243
+ components: SignatureTransferDetailsComponents,
244
+ },
245
+ { name: 'owner', type: 'address' },
246
+ { name: 'witness', type: 'bytes32' },
247
+ { name: 'witnessTypeString', type: 'string' },
248
+ { name: 'signature', type: 'bytes' },
249
+ ] ;
250
+ ;
251
+
252
+
253
+
254
+
255
+
256
+ export const PermitWitnessTransferFromFunctionABIType = {
257
+ name: 'permitWitnessTransferFrom',
258
+ inputs: PermitWitnessTransferFromInputComponents,
259
+ outputs: [],
260
+ stateMutability: 'nonpayable',
261
+ type: 'function',
262
+ } ;
263
+
264
+ export const BatchPermitWitnessTransferFunctionABIType = {
265
+ name: 'permitWitnessTransferFrom',
266
+ inputs: BatchPermitWitnessTransferFromInputComponents,
267
+ outputs: [],
268
+ stateMutability: 'nonpayable',
269
+ type: 'function',
270
+ } ;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @file entry point for orchestration's permit2 utils
3
+ *
4
+ * This file should eventually become a `.js` file once we can strip types from
5
+ * `.ts` files and rewrite relative import specifiers in `.js` files.
6
+ *
7
+ * NPM consumers could use jsr.io to consume this in the meantime.
8
+ */
9
+ export * from './permit2/signatureTransfer.js';
10
+ export * from './permit2/signatureTransferHelpers.js';
11
+ //# sourceMappingURL=permit2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permit2.d.ts","sourceRoot":"","sources":["permit2.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @file entry point for orchestration's permit2 utils
3
+ *
4
+ * This file should eventually become a `.js` file once we can strip types from
5
+ * `.ts` files and rewrite relative import specifiers in `.js` files.
6
+ *
7
+ * NPM consumers could use jsr.io to consume this in the meantime.
8
+ */
9
+
10
+ export * from './permit2/signatureTransfer.js';
11
+ export * from './permit2/signatureTransferHelpers.js';
@@ -0,0 +1,41 @@
1
+ export namespace progressTrackerAsyncFlowUtils {
2
+ function promiseFromVow<T>(specimen: T): Promise<Fulfilled<T>>;
3
+ function reduceProgressReports<A = unknown>(tracker: ProgressTracker, reducer: PublicationReducer<ProgressReport, A>, initialAccum: A): Promise<A>;
4
+ }
5
+ export function prepareProgressTracker(zone: Zone, { vowTools: { makeVowKit } }: {
6
+ vowTools: Pick<VowTools, "makeVowKit">;
7
+ }): () => import("@endo/exo").Guarded<{
8
+ getCurrentProgressReport(): ProgressReport;
9
+ /**
10
+ * @param {ProgressReport} progressReport
11
+ */
12
+ update(progressReport: ProgressReport): ProgressReport;
13
+ finish(): ProgressReport;
14
+ /**
15
+ * CAVEAT: Intended for use only by `progress.js` utilities.
16
+ *
17
+ * @returns {PublicationInternals<ProgressReport>}
18
+ * @internal
19
+ */
20
+ exposePublicationInternals(): PublicationInternals<ProgressReport>;
21
+ }>;
22
+ export type ProgressReport = Record<string, any>;
23
+ export type PublicationInternals<T> = {
24
+ value: T;
25
+ tail: EVow<PublicationInternals<T>>;
26
+ };
27
+ /**
28
+ * Called on the value of each linked T. This
29
+ * function should perform any side-effects it can when it receives a new
30
+ * value, since there is no guarantee that the ProgressRecord tail will be
31
+ * prompt (it may take a long time with cross-chain communication) or ever
32
+ * fulfill (it may result in a rejection).
33
+ */
34
+ export type PublicationReducer<T, A = unknown> = (value: T | undefined | null, accum: A) => EVow<A | null>;
35
+ export type MakeProgressTracker = ReturnType<typeof prepareProgressTracker>;
36
+ export type ProgressTracker = ReturnType<MakeProgressTracker>;
37
+ import type { Fulfilled } from '@agoric/vow';
38
+ import type { Zone } from '@agoric/base-zone';
39
+ import type { VowTools } from '@agoric/vow';
40
+ import type { EVow } from '@agoric/vow';
41
+ //# sourceMappingURL=progress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["progress.js"],"names":[],"mappings":";IAgDkB,wBAJH,CAAC,YACH,CAAC,GACC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAQjC;IAcsB,+BATT,CAAC,qBACJ,eAAe,WACf,kBAAkB,CAAC,cAAc,EAAE,CAAC,CAAC,gBACrC,CAAC,GAIC,OAAO,CAAC,CAAC,CAAC,CA0BtB;;AAYI,6CAJI,IAAI,gCAEZ;IAA6C,QAAQ,EAA7C,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC;CACtC;;IA0BO;;OAEG;2BADQ,cAAc;;IAyBzB;;;;;OAKG;kCAFU,oBAAoB,CAAC,cAAc,CAAC;GAYxD;6BA9JY,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;iCAInB,CAAC;WAEA,CAAC;UACD,KAAK,oBAAoB,CAAC,CAAC,CAAC,CAAC;;;;;;;;;+BAI9B,CAAC,EACA,CAAC,sBAMJ,CAAC,GAAG,SAAS,GAAG,IAAI,SAEpB,CAAC,KACC,KAAK,CAAC,GAAG,IAAI,CAAC;kCA6Id,UAAU,CAAC,OAAO,sBAAsB,CAAC;8BAIzC,UAAU,CAAC,mBAAmB,CAAC;+BA3KA,aAAa;0BAClC,mBAAmB;8BADE,aAAa;0BAAb,aAAa"}