@skip-go/client 1.6.0-alpha.3 → 1.6.0-alpha.5

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 (158) hide show
  1. package/dist/cjs/api/getAssets.cjs +16 -0
  2. package/dist/cjs/api/getAssetsBetweenChains.cjs +12 -0
  3. package/dist/cjs/api/getBridges.cjs +12 -0
  4. package/dist/cjs/api/getChains.cjs +12 -0
  5. package/dist/cjs/api/getVenues.cjs +12 -0
  6. package/dist/cjs/api/postAssetsFromSource.cjs +13 -0
  7. package/dist/cjs/api/postBalances.cjs +12 -0
  8. package/dist/cjs/api/postIbcOriginAssets.cjs +12 -0
  9. package/dist/cjs/api/postMessages.cjs +12 -0
  10. package/dist/cjs/api/postMessagesDirect.cjs +12 -0
  11. package/dist/cjs/api/postRecommendAssets.cjs +12 -0
  12. package/dist/cjs/api/postRoute.cjs +12 -0
  13. package/dist/cjs/api/postSubmitTransaction.cjs +12 -0
  14. package/dist/cjs/api/postTrackTransaction.cjs +12 -0
  15. package/dist/cjs/api/postTransactionStatus.cjs +12 -0
  16. package/dist/cjs/chunk-25TA7Z7R.cjs +460 -0
  17. package/dist/cjs/chunk-2QPPD3BB.cjs +210 -0
  18. package/dist/cjs/chunk-2SA3OAIJ.cjs +18 -0
  19. package/dist/cjs/chunk-3KO2DHFX.cjs +1495 -0
  20. package/dist/cjs/chunk-477CU2G2.cjs +280 -0
  21. package/dist/cjs/chunk-4BWE7SOV.cjs +68 -0
  22. package/dist/cjs/chunk-4GHUZDDP.cjs +16 -0
  23. package/dist/cjs/chunk-4ZIVDKQN.cjs +387 -0
  24. package/dist/cjs/chunk-6T4SBY5H.cjs +214 -0
  25. package/dist/cjs/chunk-A3UNNRKD.cjs +574 -0
  26. package/dist/cjs/chunk-A5S6SIYN.cjs +12 -0
  27. package/dist/cjs/chunk-ASDMDYTC.cjs +11 -0
  28. package/dist/cjs/chunk-ATW6UNT5.cjs +136 -0
  29. package/dist/cjs/chunk-AUTOIM57.cjs +22 -0
  30. package/dist/cjs/chunk-AVWWCQ5P.cjs +2264 -0
  31. package/dist/cjs/chunk-CIZTNJ3K.cjs +24 -0
  32. package/dist/cjs/chunk-CK6CQWQU.cjs +49 -0
  33. package/dist/cjs/chunk-EAZQ2ECA.cjs +185 -0
  34. package/dist/cjs/chunk-F3EB2AQG.cjs +28 -0
  35. package/dist/cjs/chunk-FCTBCHOT.cjs +12 -0
  36. package/dist/cjs/chunk-IJIBMN2F.cjs +12 -0
  37. package/dist/cjs/chunk-IUMMXFGP.cjs +189 -0
  38. package/dist/cjs/chunk-JRXPJ45U.cjs +12 -0
  39. package/dist/cjs/chunk-LJV45UGL.cjs +582 -0
  40. package/dist/cjs/chunk-MUJBB64F.cjs +291 -0
  41. package/dist/cjs/chunk-NCFH5MGF.cjs +39 -0
  42. package/dist/cjs/chunk-NM4PISTQ.cjs +3359 -0
  43. package/dist/cjs/chunk-OJISEAMX.cjs +13 -0
  44. package/dist/cjs/chunk-OVKHTOBP.cjs +99 -0
  45. package/dist/cjs/chunk-PDNKS5R2.cjs +13 -0
  46. package/dist/cjs/chunk-TELXDMYL.cjs +55 -0
  47. package/dist/cjs/chunk-UXW4XVHF.cjs +15 -0
  48. package/dist/cjs/index.cjs +349 -0
  49. package/dist/cjs/public-functions/executeMultipleRoutes.cjs +27 -0
  50. package/dist/cjs/public-functions/executeRoute.cjs +27 -0
  51. package/dist/cjs/public-functions/getCosmosGasAmountForMessage.cjs +16 -0
  52. package/dist/cjs/public-functions/getEvmGasAmountForMessage.cjs +11 -0
  53. package/dist/cjs/public-functions/getFeeInfoForChain.cjs +14 -0
  54. package/dist/cjs/public-functions/getRecommendedGasPrice.cjs +15 -0
  55. package/dist/cjs/public-functions/getRouteWithGasOnReceive.cjs +41 -0
  56. package/dist/cjs/public-functions/getSigningStargateClient.cjs +15 -0
  57. package/dist/cjs/public-functions/setApiOptions.cjs +12 -0
  58. package/dist/cjs/public-functions/setClientOptions.cjs +16 -0
  59. package/dist/cjs/public-functions/subscribeToRouteStatus.cjs +26 -0
  60. package/dist/cjs/public-functions/validateCosmosGasBalance.cjs +18 -0
  61. package/dist/cjs/public-functions/waitForTransaction.cjs +18 -0
  62. package/dist/esm/api/getAssets.d.ts +19 -0
  63. package/dist/esm/api/getAssets.js +3 -0
  64. package/dist/esm/api/getAssetsBetweenChains.d.ts +56 -0
  65. package/dist/esm/api/getAssetsBetweenChains.js +3 -0
  66. package/dist/esm/api/getBridges.d.ts +55 -0
  67. package/dist/esm/api/getBridges.js +3 -0
  68. package/dist/esm/api/getChains.d.ts +41 -0
  69. package/dist/esm/api/getChains.js +3 -0
  70. package/dist/esm/api/getVenues.d.ts +13 -0
  71. package/dist/esm/api/getVenues.js +3 -0
  72. package/dist/esm/api/postAssetsFromSource.d.ts +22 -0
  73. package/dist/esm/api/postAssetsFromSource.js +4 -0
  74. package/dist/esm/api/postBalances.d.ts +35 -0
  75. package/dist/esm/api/postBalances.js +3 -0
  76. package/dist/esm/api/postIbcOriginAssets.d.ts +32 -0
  77. package/dist/esm/api/postIbcOriginAssets.js +3 -0
  78. package/dist/esm/api/postMessages.d.ts +101 -0
  79. package/dist/esm/api/postMessages.js +3 -0
  80. package/dist/esm/api/postMessagesDirect.d.ts +640 -0
  81. package/dist/esm/api/postMessagesDirect.js +3 -0
  82. package/dist/esm/api/postRecommendAssets.d.ts +40 -0
  83. package/dist/esm/api/postRecommendAssets.js +3 -0
  84. package/dist/esm/api/postRoute.d.ts +530 -0
  85. package/dist/esm/api/postRoute.js +3 -0
  86. package/dist/esm/api/postSubmitTransaction.d.ts +17 -0
  87. package/dist/esm/api/postSubmitTransaction.js +3 -0
  88. package/dist/esm/api/postTrackTransaction.d.ts +12 -0
  89. package/dist/esm/api/postTrackTransaction.js +3 -0
  90. package/dist/esm/api/postTransactionStatus.d.ts +639 -0
  91. package/dist/esm/api/postTransactionStatus.js +3 -0
  92. package/dist/esm/apiState-1VvikVK-.d.ts +8 -0
  93. package/dist/esm/callbacks-DdC6QMlE.d.ts +158 -0
  94. package/dist/esm/chunk-3DIX6KRJ.js +566 -0
  95. package/dist/esm/chunk-3JHLVPRG.js +10 -0
  96. package/dist/esm/chunk-5WYMRZIO.js +97 -0
  97. package/dist/esm/chunk-A5NZMSTI.js +10 -0
  98. package/dist/esm/chunk-BU5RCZQH.js +187 -0
  99. package/dist/esm/chunk-CGJRRAFS.js +22 -0
  100. package/dist/esm/chunk-DMJMN4J3.js +379 -0
  101. package/dist/esm/chunk-E4NRDAVO.js +65 -0
  102. package/dist/esm/chunk-ETBJVFQP.js +10 -0
  103. package/dist/esm/chunk-F2LQB2DP.js +3323 -0
  104. package/dist/esm/chunk-F66EKL3W.js +203 -0
  105. package/dist/esm/chunk-G665WTT3.js +212 -0
  106. package/dist/esm/chunk-GPEO2I4P.js +272 -0
  107. package/dist/esm/chunk-GV2QOWB4.js +26 -0
  108. package/dist/esm/chunk-GZJLX2CP.js +2258 -0
  109. package/dist/esm/chunk-HNU2Y3JI.js +13 -0
  110. package/dist/esm/chunk-IZUHXTBP.js +53 -0
  111. package/dist/esm/chunk-J24LYWJE.js +130 -0
  112. package/dist/esm/chunk-KZKAL5ZN.js +16 -0
  113. package/dist/esm/chunk-N4PTRCNT.js +11 -0
  114. package/dist/esm/chunk-NUHMTWHP.js +180 -0
  115. package/dist/esm/chunk-P36PE4CR.js +37 -0
  116. package/dist/esm/chunk-QYXGDTUU.js +47 -0
  117. package/dist/esm/chunk-RH7PDDI5.js +433 -0
  118. package/dist/esm/chunk-RTDD7HZ3.js +275 -0
  119. package/dist/esm/chunk-SXBG57J3.js +20 -0
  120. package/dist/esm/chunk-TGTOO2ZQ.js +14 -0
  121. package/dist/esm/chunk-UHCKOKBM.js +9 -0
  122. package/dist/esm/chunk-ULUX2CVU.js +557 -0
  123. package/dist/esm/chunk-UN46DUOV.js +11 -0
  124. package/dist/esm/chunk-XIVAEU6S.js +1492 -0
  125. package/dist/esm/chunk-XNU3TKKM.js +10 -0
  126. package/dist/esm/client-types-D03Tellv.d.ts +114 -0
  127. package/dist/esm/generateApi-Bv02Xt5y.d.ts +56 -0
  128. package/dist/esm/index.d.ts +1859 -0
  129. package/dist/esm/index.js +32 -0
  130. package/dist/esm/public-functions/executeMultipleRoutes.d.ts +80 -0
  131. package/dist/esm/public-functions/executeMultipleRoutes.js +18 -0
  132. package/dist/esm/public-functions/executeRoute.d.ts +12 -0
  133. package/dist/esm/public-functions/executeRoute.js +18 -0
  134. package/dist/esm/public-functions/getCosmosGasAmountForMessage.d.ts +8 -0
  135. package/dist/esm/public-functions/getCosmosGasAmountForMessage.js +3 -0
  136. package/dist/esm/public-functions/getEvmGasAmountForMessage.d.ts +14 -0
  137. package/dist/esm/public-functions/getEvmGasAmountForMessage.js +2 -0
  138. package/dist/esm/public-functions/getFeeInfoForChain.d.ts +9 -0
  139. package/dist/esm/public-functions/getFeeInfoForChain.js +5 -0
  140. package/dist/esm/public-functions/getRecommendedGasPrice.d.ts +9 -0
  141. package/dist/esm/public-functions/getRecommendedGasPrice.js +6 -0
  142. package/dist/esm/public-functions/getRouteWithGasOnReceive.d.ts +20 -0
  143. package/dist/esm/public-functions/getRouteWithGasOnReceive.js +32 -0
  144. package/dist/esm/public-functions/getSigningStargateClient.d.ts +13 -0
  145. package/dist/esm/public-functions/getSigningStargateClient.js +6 -0
  146. package/dist/esm/public-functions/setApiOptions.d.ts +9 -0
  147. package/dist/esm/public-functions/setApiOptions.js +3 -0
  148. package/dist/esm/public-functions/setClientOptions.d.ts +11 -0
  149. package/dist/esm/public-functions/setClientOptions.js +7 -0
  150. package/dist/esm/public-functions/subscribeToRouteStatus.d.ts +12 -0
  151. package/dist/esm/public-functions/subscribeToRouteStatus.js +5 -0
  152. package/dist/esm/public-functions/validateCosmosGasBalance.d.ts +44 -0
  153. package/dist/esm/public-functions/validateCosmosGasBalance.js +9 -0
  154. package/dist/esm/public-functions/waitForTransaction.d.ts +1279 -0
  155. package/dist/esm/public-functions/waitForTransaction.js +5 -0
  156. package/dist/esm/setClientOptions-CTwe8YVX.d.ts +76 -0
  157. package/dist/esm/swaggerTypes-CzGbnX_b.d.ts +2067 -0
  158. package/package.json +1 -1
@@ -0,0 +1,387 @@
1
+ 'use strict';
2
+
3
+ var chunkMUJBB64F_cjs = require('./chunk-MUJBB64F.cjs');
4
+ var chunkEAZQ2ECA_cjs = require('./chunk-EAZQ2ECA.cjs');
5
+ var chunkATW6UNT5_cjs = require('./chunk-ATW6UNT5.cjs');
6
+ var stargate = require('@cosmjs/stargate');
7
+ var utils = require('@cosmjs/utils');
8
+ var binary_js = require('cosmjs-types/binary.js');
9
+ var auth_js = require('cosmjs-types/cosmos/auth/v1beta1/auth.js');
10
+ var coin_js = require('cosmjs-types/cosmos/base/v1beta1/coin.js');
11
+ var protoSigning = require('@cosmjs/proto-signing');
12
+ var keys_js = require('cosmjs-types/cosmos/crypto/secp256k1/keys.js');
13
+ var amino = require('@cosmjs/amino');
14
+ var _m0 = require('protobufjs/minimal.js');
15
+
16
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
17
+
18
+ var _m0__default = /*#__PURE__*/_interopDefault(_m0);
19
+
20
+ var createBaseVestingAccount = () => {
21
+ return {
22
+ // @ts-expect-error
23
+ baseAccount: void 0,
24
+ originalVesting: [],
25
+ delegatedFree: [],
26
+ delegatedVesting: [],
27
+ endTime: BigInt(0)
28
+ };
29
+ };
30
+ var BaseVestingAccount = {
31
+ encode(message, writer = binary_js.BinaryWriter.create()) {
32
+ if (message.baseAccount !== void 0) {
33
+ auth_js.BaseAccount.encode(
34
+ message.baseAccount,
35
+ writer.uint32(10).fork()
36
+ ).ldelim();
37
+ }
38
+ for (const v of message.originalVesting) {
39
+ coin_js.Coin.encode(v, writer.uint32(18).fork()).ldelim();
40
+ }
41
+ for (const v of message.delegatedFree) {
42
+ coin_js.Coin.encode(v, writer.uint32(26).fork()).ldelim();
43
+ }
44
+ for (const v of message.delegatedVesting) {
45
+ coin_js.Coin.encode(v, writer.uint32(34).fork()).ldelim();
46
+ }
47
+ if (message.endTime !== BigInt(0)) {
48
+ writer.uint32(40).int64(message.endTime);
49
+ }
50
+ return writer;
51
+ },
52
+ decode(input, length) {
53
+ const reader = input instanceof binary_js.BinaryReader ? input : new binary_js.BinaryReader(input);
54
+ const end = length === void 0 ? reader.len : reader.pos + length;
55
+ const message = createBaseVestingAccount();
56
+ while (reader.pos < end) {
57
+ const tag = reader.uint32();
58
+ switch (tag >>> 3) {
59
+ case 1:
60
+ message.baseAccount = auth_js.BaseAccount.decode(reader, reader.uint32());
61
+ break;
62
+ case 2:
63
+ message.originalVesting.push(coin_js.Coin.decode(reader, reader.uint32()));
64
+ break;
65
+ case 3:
66
+ message.delegatedFree.push(coin_js.Coin.decode(reader, reader.uint32()));
67
+ break;
68
+ case 4:
69
+ message.delegatedVesting.push(coin_js.Coin.decode(reader, reader.uint32()));
70
+ break;
71
+ case 5:
72
+ message.endTime = reader.int64();
73
+ break;
74
+ default:
75
+ reader.skipType(tag & 7);
76
+ break;
77
+ }
78
+ }
79
+ return message;
80
+ }
81
+ };
82
+ function createBasePeriod() {
83
+ return {
84
+ startTime: BigInt(0),
85
+ length: BigInt(0),
86
+ amount: [],
87
+ actionType: 0
88
+ };
89
+ }
90
+ var Period = {
91
+ encode(message, writer = binary_js.BinaryWriter.create()) {
92
+ if (message.startTime !== BigInt(0)) {
93
+ writer.uint32(8).int64(message.startTime);
94
+ }
95
+ if (message.length !== BigInt(0)) {
96
+ writer.uint32(16).int64(message.length);
97
+ }
98
+ for (const v of message.amount) {
99
+ coin_js.Coin.encode(v, writer.uint32(26).fork()).ldelim();
100
+ }
101
+ if (message.actionType !== 0) {
102
+ writer.uint32(32).int32(message.actionType);
103
+ }
104
+ return writer;
105
+ },
106
+ decode(input, length) {
107
+ const reader = input instanceof binary_js.BinaryReader ? input : new binary_js.BinaryReader(input);
108
+ const end = length === void 0 ? reader.len : reader.pos + length;
109
+ const message = createBasePeriod();
110
+ while (reader.pos < end) {
111
+ const tag = reader.uint32();
112
+ switch (tag >>> 3) {
113
+ case 1:
114
+ message.startTime = reader.int64();
115
+ break;
116
+ case 2:
117
+ message.length = reader.int64();
118
+ break;
119
+ case 3:
120
+ message.amount.push(coin_js.Coin.decode(reader, reader.uint32()));
121
+ break;
122
+ case 4:
123
+ message.actionType = reader.int32();
124
+ break;
125
+ default:
126
+ reader.skipType(tag & 7);
127
+ break;
128
+ }
129
+ }
130
+ return message;
131
+ }
132
+ };
133
+ function createBaseStridePeriodicVestingAccount() {
134
+ return {
135
+ //eslint-disable-next-line @typescript-eslint/ban-ts-comment
136
+ //@ts-ignore
137
+ baseVestingAccount: void 0,
138
+ vestingPeriods: []
139
+ };
140
+ }
141
+ var StridePeriodicVestingAccount = {
142
+ encode(message, writer = binary_js.BinaryWriter.create()) {
143
+ if (message.baseVestingAccount !== void 0) {
144
+ BaseVestingAccount.encode(
145
+ message.baseVestingAccount,
146
+ writer.uint32(10).fork()
147
+ ).ldelim();
148
+ }
149
+ for (const v of message.vestingPeriods) {
150
+ Period.encode(v, writer.uint32(26).fork()).ldelim();
151
+ }
152
+ return writer;
153
+ },
154
+ decode(input, length) {
155
+ const reader = input instanceof binary_js.BinaryReader ? input : new binary_js.BinaryReader(input);
156
+ const end = length === void 0 ? reader.len : reader.pos + length;
157
+ const message = createBaseStridePeriodicVestingAccount();
158
+ while (reader.pos < end) {
159
+ const tag = reader.uint32();
160
+ switch (tag >>> 3) {
161
+ case 1:
162
+ message.baseVestingAccount = BaseVestingAccount.decode(
163
+ reader,
164
+ reader.uint32()
165
+ );
166
+ break;
167
+ case 3:
168
+ message.vestingPeriods.push(Period.decode(reader, reader.uint32()));
169
+ break;
170
+ default:
171
+ reader.skipType(tag & 7);
172
+ break;
173
+ }
174
+ }
175
+ return message;
176
+ }
177
+ };
178
+ function createBaseEthAccount() {
179
+ return {
180
+ baseAccount: void 0,
181
+ codeHash: new Uint8Array()
182
+ };
183
+ }
184
+ var EthAccount = {
185
+ typeUrl: "/injective.types.v1beta1.EthAccount",
186
+ encode(message, writer = _m0__default.default.Writer.create()) {
187
+ if (message.baseAccount !== void 0) {
188
+ chunkMUJBB64F_cjs.BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim();
189
+ }
190
+ if (message.codeHash.length !== 0) {
191
+ writer.uint32(18).bytes(message.codeHash);
192
+ }
193
+ return writer;
194
+ },
195
+ decode(input, length) {
196
+ const reader = input instanceof _m0__default.default.Reader ? input : new _m0__default.default.Reader(input);
197
+ let end = length === void 0 ? reader.len : reader.pos + length;
198
+ const message = createBaseEthAccount();
199
+ while (reader.pos < end) {
200
+ const tag = reader.uint32();
201
+ switch (tag >>> 3) {
202
+ case 1:
203
+ message.baseAccount = chunkMUJBB64F_cjs.BaseAccount.decode(reader, reader.uint32());
204
+ break;
205
+ case 2:
206
+ message.codeHash = reader.bytes();
207
+ break;
208
+ default:
209
+ reader.skipType(tag & 7);
210
+ break;
211
+ }
212
+ }
213
+ return message;
214
+ },
215
+ fromJSON(object) {
216
+ return {
217
+ baseAccount: chunkMUJBB64F_cjs.isSet(object.baseAccount) ? chunkMUJBB64F_cjs.BaseAccount.fromJSON(object.baseAccount) : void 0,
218
+ codeHash: chunkMUJBB64F_cjs.isSet(object.codeHash) ? chunkMUJBB64F_cjs.bytesFromBase64(object.codeHash) : new Uint8Array()
219
+ };
220
+ },
221
+ toJSON(message) {
222
+ const obj = {};
223
+ message.baseAccount !== void 0 && (obj.baseAccount = message.baseAccount ? chunkMUJBB64F_cjs.BaseAccount.toJSON(message.baseAccount) : void 0);
224
+ message.codeHash !== void 0 && (obj.codeHash = chunkMUJBB64F_cjs.base64FromBytes(message.codeHash !== void 0 ? message.codeHash : new Uint8Array()));
225
+ return obj;
226
+ },
227
+ fromPartial(object) {
228
+ const message = createBaseEthAccount();
229
+ message.baseAccount = object.baseAccount !== void 0 && object.baseAccount !== null ? chunkMUJBB64F_cjs.BaseAccount.fromPartial(object.baseAccount) : void 0;
230
+ message.codeHash = object.codeHash ?? new Uint8Array();
231
+ return message;
232
+ },
233
+ fromAmino(object) {
234
+ const message = createBaseEthAccount();
235
+ if (object.base_account !== void 0 && object.base_account !== null) {
236
+ message.baseAccount = chunkMUJBB64F_cjs.BaseAccount.fromAmino(object.base_account);
237
+ }
238
+ if (object.code_hash !== void 0 && object.code_hash !== null) {
239
+ message.codeHash = chunkMUJBB64F_cjs.bytesFromBase64(object.code_hash);
240
+ }
241
+ return message;
242
+ },
243
+ toAmino(message) {
244
+ const obj = {};
245
+ obj.base_account = message.baseAccount ? chunkMUJBB64F_cjs.BaseAccount.toAmino(message.baseAccount) : void 0;
246
+ obj.code_hash = message.codeHash ? chunkMUJBB64F_cjs.base64FromBytes(message.codeHash) : void 0;
247
+ return obj;
248
+ },
249
+ fromAminoMsg(object) {
250
+ return EthAccount.fromAmino(object.value);
251
+ },
252
+ fromProtoMsg(message) {
253
+ return EthAccount.decode(message.value);
254
+ },
255
+ toProto(message) {
256
+ return EthAccount.encode(message).finish();
257
+ },
258
+ toProtoMsg(message) {
259
+ return {
260
+ typeUrl: "/injective.types.v1beta1.EthAccount",
261
+ value: EthAccount.encode(message).finish()
262
+ };
263
+ }
264
+ };
265
+
266
+ // src/registry.ts
267
+ var accountParser = (acc) => {
268
+ switch (acc.typeUrl) {
269
+ case "/stride.vesting.StridePeriodicVestingAccount": {
270
+ const baseAccount = StridePeriodicVestingAccount.decode(acc.value).baseVestingAccount?.baseAccount;
271
+ utils.assertDefinedAndNotNull(baseAccount);
272
+ return {
273
+ address: baseAccount.address,
274
+ pubkey: baseAccount.pubKey ? protoSigning.decodePubkey(baseAccount.pubKey) : null,
275
+ accountNumber: Number(baseAccount.accountNumber),
276
+ sequence: Number(baseAccount.sequence)
277
+ };
278
+ }
279
+ case "/injective.types.v1beta1.EthAccount":
280
+ return accountEthParser(
281
+ acc,
282
+ "/injective.crypto.v1beta1.ethsecp256k1.PubKey"
283
+ );
284
+ case "/ethermint.types.v1.EthAccount":
285
+ return accountEthParser(acc, "/ethermint.crypto.v1.ethsecp256k1.PubKey");
286
+ default: {
287
+ if (acc.typeUrl === "/cosmos.auth.v1beta1.BaseAccount") {
288
+ const { address, pubKey, accountNumber, sequence } = auth_js.BaseAccount.decode(
289
+ acc.value
290
+ );
291
+ switch (pubKey?.typeUrl) {
292
+ case "/initia.crypto.v1beta1.ethsecp256k1.PubKey":
293
+ case "/ethermint.crypto.v1.ethsecp256k1.PubKey":
294
+ case "/cosmos.evm.crypto.v1.ethsecp256k1.PubKey": {
295
+ const { key } = keys_js.PubKey.decode(pubKey.value);
296
+ const pk = amino.encodeSecp256k1Pubkey(key);
297
+ return {
298
+ address,
299
+ pubkey: pk,
300
+ accountNumber: Number(accountNumber),
301
+ sequence: Number(sequence)
302
+ };
303
+ }
304
+ }
305
+ }
306
+ return stargate.accountFromAny(acc);
307
+ }
308
+ }
309
+ };
310
+ var accountEthParser = (ethAccount, pubKeyTypeUrl = "/injective.crypto.v1beta1.ethsecp256k1.PubKey") => {
311
+ const account = EthAccount.decode(
312
+ ethAccount.value
313
+ );
314
+ const baseAccount = account.baseAccount;
315
+ const pubKey = baseAccount.pubKey;
316
+ return {
317
+ address: baseAccount.address,
318
+ pubkey: pubKey ? {
319
+ type: pubKeyTypeUrl,
320
+ value: Buffer.from(pubKey.value).toString("base64")
321
+ } : null,
322
+ accountNumber: parseInt(baseAccount.accountNumber.toString(), 10),
323
+ sequence: parseInt(baseAccount.sequence.toString(), 10)
324
+ };
325
+ };
326
+
327
+ // src/private-functions/getRpcEndpointForChain.ts
328
+ var getRpcEndpointForChain = async (chainId) => {
329
+ if (chunkATW6UNT5_cjs.ClientState.endpointOptions.getRpcEndpointForChain) {
330
+ return chunkATW6UNT5_cjs.ClientState.endpointOptions.getRpcEndpointForChain(chainId);
331
+ }
332
+ if (chunkATW6UNT5_cjs.ClientState.endpointOptions.endpoints && chunkATW6UNT5_cjs.ClientState.endpointOptions.endpoints[chainId]) {
333
+ const endpointOptions = chunkATW6UNT5_cjs.ClientState.endpointOptions.endpoints[chainId];
334
+ if (endpointOptions?.rpc) {
335
+ return endpointOptions.rpc;
336
+ }
337
+ }
338
+ console.warn(
339
+ "Warning: You are using unreliable public endpoints. We strongly recommend overriding them via endpointOptions for use beyond development settings."
340
+ );
341
+ const chain = chunkEAZQ2ECA_cjs.chains().find((chain2) => chain2.chainId === chainId);
342
+ if (!chain) {
343
+ throw new Error(`getRpcEndpointForChain: failed to find chain id '${chainId}' in registry`);
344
+ }
345
+ if (chain.apis?.rpc?.length === 0 || !chain.apis?.rpc) {
346
+ throw new Error(
347
+ `getRpcEndpointForChain error: failed to find RPC endpoint for chain id '${chainId}'`
348
+ );
349
+ }
350
+ const endpoints = chain.apis?.rpc?.map((api) => api.address);
351
+ const endpoint = await chunkEAZQ2ECA_cjs.findFirstWorkingEndpoint(endpoints, "rpc");
352
+ if (!endpoint) {
353
+ throw new Error(
354
+ `getRpcEndpointForChain error: failed to find RPC endpoint for chain id '${chainId}'`
355
+ );
356
+ }
357
+ return endpoint;
358
+ };
359
+
360
+ // src/public-functions/getSigningStargateClient.ts
361
+ var getSigningStargateClient = async ({
362
+ chainId,
363
+ getOfflineSigner
364
+ }) => {
365
+ if (!getOfflineSigner) {
366
+ throw new Error("'getCosmosSigner' is not provided or configured in skip router");
367
+ }
368
+ if (!chunkATW6UNT5_cjs.ClientState.signingStargateClientByChainId?.[chainId]) {
369
+ const [signer, endpoint] = await Promise.all([
370
+ getOfflineSigner(chainId),
371
+ getRpcEndpointForChain(chainId)
372
+ ]);
373
+ chunkATW6UNT5_cjs.ClientState.signingStargateClientByChainId[chainId] = await stargate.SigningStargateClient.connectWithSigner(endpoint, signer, {
374
+ aminoTypes: chunkATW6UNT5_cjs.ClientState.aminoTypes,
375
+ registry: chunkATW6UNT5_cjs.ClientState.registry,
376
+ accountParser
377
+ });
378
+ }
379
+ return {
380
+ stargateClient: chunkATW6UNT5_cjs.ClientState.signingStargateClientByChainId[chainId],
381
+ signer: await getOfflineSigner(chainId)
382
+ };
383
+ };
384
+
385
+ exports.accountParser = accountParser;
386
+ exports.getRpcEndpointForChain = getRpcEndpointForChain;
387
+ exports.getSigningStargateClient = getSigningStargateClient;
@@ -0,0 +1,214 @@
1
+ 'use strict';
2
+
3
+ var chunk3KO2DHFX_cjs = require('./chunk-3KO2DHFX.cjs');
4
+ var chunkA3UNNRKD_cjs = require('./chunk-A3UNNRKD.cjs');
5
+ var chunkNCFH5MGF_cjs = require('./chunk-NCFH5MGF.cjs');
6
+ var chunkAUTOIM57_cjs = require('./chunk-AUTOIM57.cjs');
7
+ var chunk2QPPD3BB_cjs = require('./chunk-2QPPD3BB.cjs');
8
+
9
+ // src/public-functions/executeMultipleRoutes.ts
10
+ var executeMultipleRoutes = async (options) => {
11
+ const {
12
+ route,
13
+ userAddresses,
14
+ appendCosmosMsgs,
15
+ postRouteHandler,
16
+ slippageTolerancePercent,
17
+ ...restOptions
18
+ } = options;
19
+ const addressList = {};
20
+ for (const [routeKey, routeValue] of Object.entries(route)) {
21
+ const _userAddresses = userAddresses[routeKey];
22
+ if (_userAddresses === void 0) {
23
+ throw new Error(
24
+ `executeMultipleRoutes error: no user addresses found for route: ${routeKey}`
25
+ );
26
+ }
27
+ const routeAddressList = await chunk3KO2DHFX_cjs.createValidAddressList({
28
+ userAddresses: _userAddresses,
29
+ route: routeValue
30
+ });
31
+ addressList[routeKey] = routeAddressList;
32
+ }
33
+ const msgsResponses = await Promise.all(
34
+ Object.entries(route).map(async ([routeKey, routeValue]) => {
35
+ const routeAddressList = addressList[routeKey];
36
+ if (routeAddressList === void 0) {
37
+ throw new Error(
38
+ `executeMultipleRoutes error: address list not found for route ${routeKey}`
39
+ );
40
+ }
41
+ return await chunkNCFH5MGF_cjs.messages({
42
+ timeoutSeconds: options.timeoutSeconds,
43
+ amountIn: routeValue?.amountIn,
44
+ amountOut: routeValue.estimatedAmountOut || "0",
45
+ sourceAssetChainId: routeValue?.sourceAssetChainId,
46
+ sourceAssetDenom: routeValue?.sourceAssetDenom,
47
+ destAssetChainId: routeValue?.destAssetChainId,
48
+ destAssetDenom: routeValue?.destAssetDenom,
49
+ operations: routeValue?.operations,
50
+ addressList: routeAddressList,
51
+ slippageTolerancePercent: slippageTolerancePercent?.[routeKey] || "1",
52
+ chainIdsToAffiliates: chunk2QPPD3BB_cjs.ApiState.chainIdsToAffiliates,
53
+ postRouteHandler: postRouteHandler?.[routeKey],
54
+ feePayerAddress: options.svmFeePayer?.address
55
+ });
56
+ })
57
+ );
58
+ let msgsRecord = {};
59
+ msgsResponses.forEach((msg, index2) => {
60
+ const routeKey = Object.keys(route)[index2];
61
+ if (!routeKey) {
62
+ throw new Error(
63
+ `executeMultipleRoutes error: route key not found for index ${index2}`
64
+ );
65
+ }
66
+ const addedCosmosMsgs = appendCosmosMsgs?.[routeKey];
67
+ if (addedCosmosMsgs) {
68
+ Object.entries(addedCosmosMsgs).forEach(([chainId, msgs]) => {
69
+ const txIndex = msg?.txs?.findIndex(
70
+ (tx2) => "cosmosTx" in tx2 && tx2.cosmosTx.chainId === chainId
71
+ );
72
+ if (txIndex === void 0 || txIndex === -1) return;
73
+ const tx = msg?.txs?.[txIndex];
74
+ if (tx && "cosmosTx" in tx) {
75
+ tx.cosmosTx.msgs?.unshift(...msgs);
76
+ }
77
+ });
78
+ }
79
+ msgsRecord[routeKey] = msg;
80
+ });
81
+ let transferIndexToRouteKey = void 0;
82
+ const cosmosTxIndex0Map = /* @__PURE__ */ new Map();
83
+ let transferIndex = 0;
84
+ for (const [routeKey, msgs] of Object.entries(msgsRecord)) {
85
+ const firstTx = msgs?.txs?.[0];
86
+ if (firstTx && "cosmosTx" in firstTx) {
87
+ const { chainId, msgs: firstTxMsgs } = firstTx.cosmosTx;
88
+ if (!transferIndexToRouteKey) {
89
+ transferIndexToRouteKey = {};
90
+ }
91
+ transferIndexToRouteKey[transferIndex] = routeKey;
92
+ transferIndex++;
93
+ if (!cosmosTxIndex0Map.has(chainId)) {
94
+ cosmosTxIndex0Map.set(chainId, {
95
+ routeKey,
96
+ firstCosmosTx: firstTx.cosmosTx
97
+ });
98
+ } else {
99
+ const existing = cosmosTxIndex0Map.get(chainId);
100
+ if (existing && firstTxMsgs) {
101
+ const modifyTarget = msgsRecord[existing.routeKey]?.txs?.[0];
102
+ if (modifyTarget && "cosmosTx" in modifyTarget) {
103
+ modifyTarget.cosmosTx.msgs?.push(...firstTxMsgs);
104
+ msgsRecord[routeKey]?.txs?.shift();
105
+ }
106
+ }
107
+ }
108
+ }
109
+ }
110
+ Object.entries(msgsRecord).forEach(([routeKey, msgs]) => {
111
+ if (msgs?.txs?.length === 0) {
112
+ delete msgsRecord[routeKey];
113
+ }
114
+ });
115
+ let mainRouteId = void 0;
116
+ let msgsRecordIndexToRouteId = {};
117
+ let index = 0;
118
+ const transactionDetailsList = {};
119
+ const executeTransactionList = {};
120
+ const mergedMainAndSecondaryRoutes = Object.entries(msgsRecord).length !== Object.entries(route).length;
121
+ for (const [routeKey, msgsResponse] of Object.entries(msgsRecord)) {
122
+ const { id: routeId } = chunkA3UNNRKD_cjs.updateRouteDetails({
123
+ status: "unconfirmed",
124
+ options: {
125
+ route: route[routeKey],
126
+ ...restOptions
127
+ },
128
+ mainRouteId,
129
+ transferIndexToRouteKey
130
+ });
131
+ msgsRecordIndexToRouteId[index] = routeId;
132
+ if (routeKey === "mainRoute") {
133
+ mainRouteId = routeId;
134
+ }
135
+ const { transactionDetails, executeTransaction: _executeTransaction } = await chunk3KO2DHFX_cjs.executeTransactions({
136
+ ...restOptions,
137
+ routeId,
138
+ txs: msgsResponse?.txs,
139
+ route: route[routeKey],
140
+ userAddresses: userAddresses[routeKey],
141
+ isMultiRoutes: true
142
+ });
143
+ const executeTransaction = async (index2) => {
144
+ const txResult = await _executeTransaction(index2);
145
+ if (routeKey !== "mainRoute" || mergedMainAndSecondaryRoutes) {
146
+ const relatedRoutes = Object.entries(route).filter(([key]) => key !== "mainRoute").map(([key, route2]) => ({ route: route2, routeKey: key, status: "pending" }));
147
+ chunkA3UNNRKD_cjs.updateRouteDetails({
148
+ options: {
149
+ route: route[routeKey],
150
+ ...restOptions
151
+ },
152
+ routeId: mainRouteId,
153
+ transferIndexToRouteKey,
154
+ relatedRoutes
155
+ });
156
+ }
157
+ return txResult;
158
+ };
159
+ if (transactionDetails[0]?.chainType === "evm" /* Evm */) {
160
+ for (const [index2, transactionDetail] of transactionDetails.entries()) {
161
+ const txResult = await executeTransaction(index2);
162
+ if (txResult.txHash) {
163
+ const trackResponse = await chunkAUTOIM57_cjs.trackTransaction({
164
+ chainId: transactionDetail.chainId,
165
+ txHash: txResult.txHash,
166
+ ...options.trackTxPollingOptions
167
+ });
168
+ await options?.onTransactionTracked?.({
169
+ txHash: txResult.txHash,
170
+ chainId: transactionDetail.chainId,
171
+ explorerLink: trackResponse.explorerLink
172
+ });
173
+ transactionDetail.txHash = txResult.txHash;
174
+ transactionDetail.explorerLink = trackResponse.explorerLink;
175
+ }
176
+ }
177
+ } else {
178
+ executeTransactionList[index] = executeTransaction;
179
+ }
180
+ transactionDetailsList[index] = transactionDetails;
181
+ index++;
182
+ }
183
+ await Promise.all(
184
+ Object.entries(msgsRecord).map(([routeKey, msgsResponse], index2) => {
185
+ return chunkA3UNNRKD_cjs.executeAndSubscribeToRouteStatus({
186
+ transactionDetails: transactionDetailsList[index2],
187
+ executeTransaction: executeTransactionList[index2],
188
+ routeId: msgsRecordIndexToRouteId[index2],
189
+ options: {
190
+ route: route[routeKey],
191
+ userAddresses: userAddresses[routeKey],
192
+ ...restOptions,
193
+ onRouteStatusUpdated: (routeStatus) => {
194
+ const relatedRoutes = Object.entries(route).filter(([key]) => key !== "mainRoute").map(([key, route2]) => ({ route: route2, routeKey: key, status: routeStatus.status }));
195
+ if (routeKey !== "mainRoute") {
196
+ chunkA3UNNRKD_cjs.updateRouteDetails({
197
+ options: {
198
+ route: route[routeKey],
199
+ ...restOptions
200
+ },
201
+ routeId: mainRouteId,
202
+ transferIndexToRouteKey,
203
+ relatedRoutes
204
+ });
205
+ }
206
+ options.onRouteStatusUpdated?.(routeStatus);
207
+ }
208
+ }
209
+ });
210
+ })
211
+ );
212
+ };
213
+
214
+ exports.executeMultipleRoutes = executeMultipleRoutes;