@skip-go/client 1.0.1 → 1.0.3-alpha-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 (65) hide show
  1. package/dist/api/getAssets.js +2 -15
  2. package/dist/api/getAssetsBetweenChains.js +2 -11
  3. package/dist/api/getBridges.js +2 -11
  4. package/dist/api/getChains.js +2 -11
  5. package/dist/api/getVenues.js +2 -11
  6. package/dist/api/postAssetsFromSource.js +3 -12
  7. package/dist/api/postBalances.js +2 -11
  8. package/dist/api/postIbcOriginAssets.js +2 -11
  9. package/dist/api/postMessages.d.ts +183 -183
  10. package/dist/api/postMessages.js +2 -11
  11. package/dist/api/postMessagesDirect.d.ts +183 -183
  12. package/dist/api/postMessagesDirect.js +2 -11
  13. package/dist/api/postRecommendAssets.js +2 -11
  14. package/dist/api/postRoute.d.ts +160 -160
  15. package/dist/api/postRoute.js +2 -11
  16. package/dist/api/postSubmitTransaction.js +2 -11
  17. package/dist/api/postTrackTransaction.js +2 -11
  18. package/dist/api/postTransactionStatus.js +2 -11
  19. package/dist/chunk-33K6EESX.js +10 -0
  20. package/dist/{chunk-Z4ZKOUGH.js → chunk-4JJWOILI.js} +3 -5
  21. package/dist/chunk-BQTQJQ5E.js +10 -0
  22. package/dist/chunk-BRMONS6A.js +130 -0
  23. package/dist/{chunk-ZG23Z3WY.js → chunk-C2EDPY6J.js} +3 -5
  24. package/dist/chunk-DW4U6YI6.js +10 -0
  25. package/dist/chunk-F75DC5RW.js +1786 -0
  26. package/dist/chunk-GARVPN2H.js +16 -0
  27. package/dist/{chunk-CG5CQQBW.js → chunk-JTIHU43D.js} +33 -42
  28. package/dist/{chunk-5ZJBR5AQ.js → chunk-KNV72XRZ.js} +3 -5
  29. package/dist/chunk-MGVXJ2U4.js +11 -0
  30. package/dist/chunk-MTMPHY3Y.js +9 -0
  31. package/dist/{chunk-GFRPLEJR.js → chunk-PHTQQIAH.js} +278 -311
  32. package/dist/{chunk-RE2QZJWE.js → chunk-PRQ2NHRZ.js} +3 -5
  33. package/dist/chunk-RDRDFJQE.js +10 -0
  34. package/dist/chunk-RMP3HM5N.js +14 -0
  35. package/dist/{chunk-X2YPYBVN.js → chunk-SONZJVQM.js} +59 -68
  36. package/dist/chunk-SWYON2RG.js +1 -4
  37. package/dist/{chunk-RT5TZAMU.js → chunk-TD63P2AG.js} +212 -312
  38. package/dist/{chunk-PKPZTO4H.js → chunk-TW77BXMT.js} +10 -13
  39. package/dist/chunk-UNF72WYO.js +22 -0
  40. package/dist/{chunk-4XWIXR2P.js → chunk-VMPFHQ7U.js} +19 -27
  41. package/dist/chunk-VQ5SIQWU.js +1 -3
  42. package/dist/chunk-W6TBGBV3.js +675 -0
  43. package/dist/index.d.ts +0 -3
  44. package/dist/index.js +24 -209
  45. package/dist/public-functions/executeRoute.js +12 -21
  46. package/dist/public-functions/getFeeInfoForChain.js +5 -14
  47. package/dist/public-functions/getRecommendedGasPrice.d.ts +1 -1
  48. package/dist/public-functions/getRecommendedGasPrice.js +7 -16
  49. package/dist/public-functions/getSigningStargateClient.d.ts +2 -2
  50. package/dist/public-functions/getSigningStargateClient.js +4 -13
  51. package/dist/public-functions/setApiOptions.js +2 -11
  52. package/dist/public-functions/setClientOptions.js +4 -13
  53. package/package.json +12 -3
  54. package/dist/chunk-2WHYWV4Y.js +0 -12
  55. package/dist/chunk-5KVRQLI5.js +0 -17
  56. package/dist/chunk-6BTWKTNM.js +0 -16
  57. package/dist/chunk-6GJEXV5J.js +0 -130
  58. package/dist/chunk-ASPVKNJ7.js +0 -242
  59. package/dist/chunk-EQLA2SEZ.js +0 -2361
  60. package/dist/chunk-FVSSCQ6C.js +0 -12
  61. package/dist/chunk-KYFTM3PI.js +0 -12
  62. package/dist/chunk-L2Q5RP6O.js +0 -25
  63. package/dist/chunk-LRIPQQ4M.js +0 -11
  64. package/dist/chunk-X2E2TKVR.js +0 -12
  65. package/dist/chunk-YYNIFO2A.js +0 -13
@@ -1,13 +1,11 @@
1
- 'use strict';
2
-
3
- var chunkASPVKNJ7_js = require('./chunk-ASPVKNJ7.js');
1
+ import { api } from './chunk-W6TBGBV3.js';
4
2
 
5
3
  // src/api/postIbcOriginAssets.ts
6
- var ibcOriginAssets = chunkASPVKNJ7_js.api({
4
+ var ibcOriginAssets = api({
7
5
  methodName: "getOriginAssets",
8
6
  method: "post",
9
7
  path: "/v2/fungible/ibc_origin_assets",
10
8
  transformResponse: (response) => response.originAssets
11
9
  });
12
10
 
13
- exports.ibcOriginAssets = ibcOriginAssets;
11
+ export { ibcOriginAssets };
@@ -0,0 +1,10 @@
1
+ import { api } from './chunk-W6TBGBV3.js';
2
+
3
+ // src/api/postSubmitTransaction.ts
4
+ var submitTransaction = api({
5
+ methodName: "submitTransactionV2",
6
+ method: "post",
7
+ path: "/v2/tx/submit"
8
+ });
9
+
10
+ export { submitTransaction };
@@ -0,0 +1,14 @@
1
+ import { transformAssetsMap } from './chunk-BRMONS6A.js';
2
+ import { api } from './chunk-W6TBGBV3.js';
3
+
4
+ // src/api/postAssetsFromSource.ts
5
+ var assetsFromSource = api({
6
+ methodName: "getAssetsFromSource",
7
+ method: "post",
8
+ path: "/v2/fungible/assets_from_source",
9
+ transformResponse(response) {
10
+ return transformAssetsMap(response.destAssets);
11
+ }
12
+ });
13
+
14
+ export { assetsFromSource };
@@ -1,18 +1,14 @@
1
- 'use strict';
2
-
3
- var chunkCG5CQQBW_js = require('./chunk-CG5CQQBW.js');
4
- var chunk6GJEXV5J_js = require('./chunk-6GJEXV5J.js');
5
- var chunkASPVKNJ7_js = require('./chunk-ASPVKNJ7.js');
6
- var signingstargateclient = require('@cosmjs/stargate/build/signingstargateclient');
7
- var stargate = require('@cosmjs/stargate');
8
- var utils = require('@cosmjs/utils');
9
- var binary = require('cosmjs-types/binary');
10
- var auth = require('cosmjs-types/cosmos/auth/v1beta1/auth');
11
- var coin = require('cosmjs-types/cosmos/base/v1beta1/coin');
12
- var protoSigning = require('@cosmjs/proto-signing');
13
- var sdkTs = require('@injectivelabs/sdk-ts');
14
- var keys = require('cosmjs-types/cosmos/crypto/secp256k1/keys');
15
- var amino = require('@cosmjs/amino');
1
+ import { chains, findFirstWorkingEndpoint } from './chunk-JTIHU43D.js';
2
+ import { ClientState } from './chunk-BRMONS6A.js';
3
+ import { accountFromAny, SigningStargateClient } from '@cosmjs/stargate';
4
+ import { assertDefinedAndNotNull } from '@cosmjs/utils';
5
+ import { BinaryWriter, BinaryReader } from 'cosmjs-types/binary.js';
6
+ import { BaseAccount } from 'cosmjs-types/cosmos/auth/v1beta1/auth.js';
7
+ import { Coin } from 'cosmjs-types/cosmos/base/v1beta1/coin.js';
8
+ import { decodePubkey } from '@cosmjs/proto-signing';
9
+ import { accountEthParser } from '@injectivelabs/sdk-ts';
10
+ import { PubKey } from 'cosmjs-types/cosmos/crypto/secp256k1/keys.js';
11
+ import { encodeSecp256k1Pubkey } from '@cosmjs/amino';
16
12
 
17
13
  var createBaseVestingAccount = () => {
18
14
  return {
@@ -25,21 +21,21 @@ var createBaseVestingAccount = () => {
25
21
  };
26
22
  };
27
23
  var BaseVestingAccount = {
28
- encode(message, writer = binary.BinaryWriter.create()) {
24
+ encode(message, writer = BinaryWriter.create()) {
29
25
  if (message.baseAccount !== void 0) {
30
- auth.BaseAccount.encode(
26
+ BaseAccount.encode(
31
27
  message.baseAccount,
32
28
  writer.uint32(10).fork()
33
29
  ).ldelim();
34
30
  }
35
31
  for (const v of message.originalVesting) {
36
- coin.Coin.encode(v, writer.uint32(18).fork()).ldelim();
32
+ Coin.encode(v, writer.uint32(18).fork()).ldelim();
37
33
  }
38
34
  for (const v of message.delegatedFree) {
39
- coin.Coin.encode(v, writer.uint32(26).fork()).ldelim();
35
+ Coin.encode(v, writer.uint32(26).fork()).ldelim();
40
36
  }
41
37
  for (const v of message.delegatedVesting) {
42
- coin.Coin.encode(v, writer.uint32(34).fork()).ldelim();
38
+ Coin.encode(v, writer.uint32(34).fork()).ldelim();
43
39
  }
44
40
  if (message.endTime !== BigInt(0)) {
45
41
  writer.uint32(40).int64(message.endTime);
@@ -47,23 +43,23 @@ var BaseVestingAccount = {
47
43
  return writer;
48
44
  },
49
45
  decode(input, length) {
50
- const reader = input instanceof binary.BinaryReader ? input : new binary.BinaryReader(input);
46
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
51
47
  const end = length === void 0 ? reader.len : reader.pos + length;
52
48
  const message = createBaseVestingAccount();
53
49
  while (reader.pos < end) {
54
50
  const tag = reader.uint32();
55
51
  switch (tag >>> 3) {
56
52
  case 1:
57
- message.baseAccount = auth.BaseAccount.decode(reader, reader.uint32());
53
+ message.baseAccount = BaseAccount.decode(reader, reader.uint32());
58
54
  break;
59
55
  case 2:
60
- message.originalVesting.push(coin.Coin.decode(reader, reader.uint32()));
56
+ message.originalVesting.push(Coin.decode(reader, reader.uint32()));
61
57
  break;
62
58
  case 3:
63
- message.delegatedFree.push(coin.Coin.decode(reader, reader.uint32()));
59
+ message.delegatedFree.push(Coin.decode(reader, reader.uint32()));
64
60
  break;
65
61
  case 4:
66
- message.delegatedVesting.push(coin.Coin.decode(reader, reader.uint32()));
62
+ message.delegatedVesting.push(Coin.decode(reader, reader.uint32()));
67
63
  break;
68
64
  case 5:
69
65
  message.endTime = reader.int64();
@@ -85,7 +81,7 @@ function createBasePeriod() {
85
81
  };
86
82
  }
87
83
  var Period = {
88
- encode(message, writer = binary.BinaryWriter.create()) {
84
+ encode(message, writer = BinaryWriter.create()) {
89
85
  if (message.startTime !== BigInt(0)) {
90
86
  writer.uint32(8).int64(message.startTime);
91
87
  }
@@ -93,7 +89,7 @@ var Period = {
93
89
  writer.uint32(16).int64(message.length);
94
90
  }
95
91
  for (const v of message.amount) {
96
- coin.Coin.encode(v, writer.uint32(26).fork()).ldelim();
92
+ Coin.encode(v, writer.uint32(26).fork()).ldelim();
97
93
  }
98
94
  if (message.actionType !== 0) {
99
95
  writer.uint32(32).int32(message.actionType);
@@ -101,7 +97,7 @@ var Period = {
101
97
  return writer;
102
98
  },
103
99
  decode(input, length) {
104
- const reader = input instanceof binary.BinaryReader ? input : new binary.BinaryReader(input);
100
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
105
101
  const end = length === void 0 ? reader.len : reader.pos + length;
106
102
  const message = createBasePeriod();
107
103
  while (reader.pos < end) {
@@ -114,7 +110,7 @@ var Period = {
114
110
  message.length = reader.int64();
115
111
  break;
116
112
  case 3:
117
- message.amount.push(coin.Coin.decode(reader, reader.uint32()));
113
+ message.amount.push(Coin.decode(reader, reader.uint32()));
118
114
  break;
119
115
  case 4:
120
116
  message.actionType = reader.int32();
@@ -136,7 +132,7 @@ function createBaseStridePeriodicVestingAccount() {
136
132
  };
137
133
  }
138
134
  var StridePeriodicVestingAccount = {
139
- encode(message, writer = binary.BinaryWriter.create()) {
135
+ encode(message, writer = BinaryWriter.create()) {
140
136
  if (message.baseVestingAccount !== void 0) {
141
137
  BaseVestingAccount.encode(
142
138
  message.baseVestingAccount,
@@ -149,7 +145,7 @@ var StridePeriodicVestingAccount = {
149
145
  return writer;
150
146
  },
151
147
  decode(input, length) {
152
- const reader = input instanceof binary.BinaryReader ? input : new binary.BinaryReader(input);
148
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
153
149
  const end = length === void 0 ? reader.len : reader.pos + length;
154
150
  const message = createBaseStridePeriodicVestingAccount();
155
151
  while (reader.pos < end) {
@@ -173,33 +169,32 @@ var StridePeriodicVestingAccount = {
173
169
  }
174
170
  };
175
171
  var accountParser = (acc) => {
176
- var _a;
177
172
  switch (acc.typeUrl) {
178
173
  case "/stride.vesting.StridePeriodicVestingAccount": {
179
- const baseAccount = (_a = StridePeriodicVestingAccount.decode(acc.value).baseVestingAccount) == null ? void 0 : _a.baseAccount;
180
- utils.assertDefinedAndNotNull(baseAccount);
174
+ const baseAccount = StridePeriodicVestingAccount.decode(acc.value).baseVestingAccount?.baseAccount;
175
+ assertDefinedAndNotNull(baseAccount);
181
176
  return {
182
177
  address: baseAccount.address,
183
- pubkey: baseAccount.pubKey ? protoSigning.decodePubkey(baseAccount.pubKey) : null,
178
+ pubkey: baseAccount.pubKey ? decodePubkey(baseAccount.pubKey) : null,
184
179
  accountNumber: Number(baseAccount.accountNumber),
185
180
  sequence: Number(baseAccount.sequence)
186
181
  };
187
182
  }
188
183
  case "/injective.types.v1beta1.EthAccount":
189
- return sdkTs.accountEthParser(
184
+ return accountEthParser(
190
185
  acc,
191
186
  "/injective.crypto.v1beta1.ethsecp256k1.PubKey"
192
187
  );
193
188
  case "/ethermint.types.v1.EthAccount":
194
- return sdkTs.accountEthParser(acc, "/ethermint.crypto.v1.ethsecp256k1.PubKey");
189
+ return accountEthParser(acc, "/ethermint.crypto.v1.ethsecp256k1.PubKey");
195
190
  default: {
196
191
  if (acc.typeUrl === "/cosmos.auth.v1beta1.BaseAccount") {
197
- const { address, pubKey, accountNumber, sequence } = auth.BaseAccount.decode(
192
+ const { address, pubKey, accountNumber, sequence } = BaseAccount.decode(
198
193
  acc.value
199
194
  );
200
- if ((pubKey == null ? void 0 : pubKey.typeUrl) === "/initia.crypto.v1beta1.ethsecp256k1.PubKey") {
201
- const { key } = keys.PubKey.decode(pubKey.value);
202
- const pk = amino.encodeSecp256k1Pubkey(key);
195
+ if (pubKey?.typeUrl === "/initia.crypto.v1beta1.ethsecp256k1.PubKey") {
196
+ const { key } = PubKey.decode(pubKey.value);
197
+ const pk = encodeSecp256k1Pubkey(key);
203
198
  return {
204
199
  address,
205
200
  pubkey: pk,
@@ -208,71 +203,67 @@ var accountParser = (acc) => {
208
203
  };
209
204
  }
210
205
  }
211
- return stargate.accountFromAny(acc);
206
+ return accountFromAny(acc);
212
207
  }
213
208
  }
214
209
  };
215
210
 
216
211
  // src/private-functions/getRpcEndpointForChain.ts
217
- var getRpcEndpointForChain = (chainId) => chunkASPVKNJ7_js.__async(void 0, null, function* () {
218
- var _a, _b, _c, _d, _e;
219
- if (chunk6GJEXV5J_js.ClientState.endpointOptions.getRpcEndpointForChain) {
220
- return chunk6GJEXV5J_js.ClientState.endpointOptions.getRpcEndpointForChain(chainId);
212
+ var getRpcEndpointForChain = async (chainId) => {
213
+ if (ClientState.endpointOptions.getRpcEndpointForChain) {
214
+ return ClientState.endpointOptions.getRpcEndpointForChain(chainId);
221
215
  }
222
- if (chunk6GJEXV5J_js.ClientState.endpointOptions.endpoints && chunk6GJEXV5J_js.ClientState.endpointOptions.endpoints[chainId]) {
223
- const endpointOptions = chunk6GJEXV5J_js.ClientState.endpointOptions.endpoints[chainId];
224
- if (endpointOptions == null ? void 0 : endpointOptions.rpc) {
216
+ if (ClientState.endpointOptions.endpoints && ClientState.endpointOptions.endpoints[chainId]) {
217
+ const endpointOptions = ClientState.endpointOptions.endpoints[chainId];
218
+ if (endpointOptions?.rpc) {
225
219
  return endpointOptions.rpc;
226
220
  }
227
221
  }
228
222
  console.warn(
229
223
  "Warning: You are using unreliable public endpoints. We strongly recommend overriding them via endpointOptions for use beyond development settings."
230
224
  );
231
- const chain = chunkCG5CQQBW_js.chains().find((chain2) => chain2.chain_id === chainId);
225
+ const chain = chains().find((chain2) => chain2.chain_id === chainId);
232
226
  if (!chain) {
233
227
  throw new Error(`getRpcEndpointForChain: failed to find chain id '${chainId}' in registry`);
234
228
  }
235
- if (((_b = (_a = chain.apis) == null ? void 0 : _a.rpc) == null ? void 0 : _b.length) === 0 || !((_c = chain.apis) == null ? void 0 : _c.rpc)) {
229
+ if (chain.apis?.rpc?.length === 0 || !chain.apis?.rpc) {
236
230
  throw new Error(
237
231
  `getRpcEndpointForChain error: failed to find RPC endpoint for chain '${chainId}'`
238
232
  );
239
233
  }
240
- const endpoints = (_e = (_d = chain.apis) == null ? void 0 : _d.rpc) == null ? void 0 : _e.map((api) => api.address);
241
- const endpoint = yield chunkCG5CQQBW_js.findFirstWorkingEndpoint(endpoints, "rpc");
234
+ const endpoints = chain.apis?.rpc?.map((api) => api.address);
235
+ const endpoint = await findFirstWorkingEndpoint(endpoints, "rpc");
242
236
  if (!endpoint) {
243
237
  throw new Error(
244
238
  `getRpcEndpointForChain error: failed to find RPC endpoint for chain '${chainId}'`
245
239
  );
246
240
  }
247
241
  return endpoint;
248
- });
242
+ };
249
243
 
250
244
  // src/public-functions/getSigningStargateClient.ts
251
- var getSigningStargateClient = (_0) => chunkASPVKNJ7_js.__async(void 0, [_0], function* ({
245
+ var getSigningStargateClient = async ({
252
246
  chainId,
253
247
  getOfflineSigner
254
- }) {
255
- var _a;
248
+ }) => {
256
249
  if (!getOfflineSigner) {
257
250
  throw new Error("'getCosmosSigner' is not provided or configured in skip router");
258
251
  }
259
- if (!((_a = chunk6GJEXV5J_js.ClientState.signingStargateClientByChainId) == null ? void 0 : _a[chainId])) {
260
- const [signer, endpoint] = yield Promise.all([
252
+ if (!ClientState.signingStargateClientByChainId?.[chainId]) {
253
+ const [signer, endpoint] = await Promise.all([
261
254
  getOfflineSigner(chainId),
262
255
  getRpcEndpointForChain(chainId)
263
256
  ]);
264
- chunk6GJEXV5J_js.ClientState.signingStargateClientByChainId[chainId] = yield signingstargateclient.SigningStargateClient.connectWithSigner(endpoint, signer, {
265
- aminoTypes: chunk6GJEXV5J_js.ClientState.aminoTypes,
266
- registry: chunk6GJEXV5J_js.ClientState.registry,
257
+ ClientState.signingStargateClientByChainId[chainId] = await SigningStargateClient.connectWithSigner(endpoint, signer, {
258
+ aminoTypes: ClientState.aminoTypes,
259
+ registry: ClientState.registry,
267
260
  accountParser
268
261
  });
269
262
  }
270
263
  return {
271
- stargateClient: chunk6GJEXV5J_js.ClientState.signingStargateClientByChainId[chainId],
272
- signer: yield getOfflineSigner(chainId)
264
+ stargateClient: ClientState.signingStargateClientByChainId[chainId],
265
+ signer: await getOfflineSigner(chainId)
273
266
  };
274
- });
267
+ };
275
268
 
276
- exports.accountParser = accountParser;
277
- exports.getRpcEndpointForChain = getRpcEndpointForChain;
278
- exports.getSigningStargateClient = getSigningStargateClient;
269
+ export { accountParser, getRpcEndpointForChain, getSigningStargateClient };
@@ -1,10 +1,7 @@
1
- 'use strict';
2
-
3
1
  // src/constants/constants.ts
4
2
  var DEFAULT_GAS_DENOM_OVERRIDES = {
5
3
  "noble-1": "uusdc"
6
4
  };
7
5
  var GAS_STATION_CHAIN_IDS = ["bbn-test-5", "bbn-1"];
8
6
 
9
- exports.DEFAULT_GAS_DENOM_OVERRIDES = DEFAULT_GAS_DENOM_OVERRIDES;
10
- exports.GAS_STATION_CHAIN_IDS = GAS_STATION_CHAIN_IDS;
7
+ export { DEFAULT_GAS_DENOM_OVERRIDES, GAS_STATION_CHAIN_IDS };