@skip-go/client 1.0.1 → 1.0.2

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 (62) 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.js +2 -11
  10. package/dist/api/postMessagesDirect.js +2 -11
  11. package/dist/api/postRecommendAssets.js +2 -11
  12. package/dist/api/postRoute.js +2 -11
  13. package/dist/api/postSubmitTransaction.js +2 -11
  14. package/dist/api/postTrackTransaction.js +2 -11
  15. package/dist/api/postTransactionStatus.js +2 -11
  16. package/dist/chunk-33K6EESX.js +10 -0
  17. package/dist/{chunk-X2YPYBVN.js → chunk-3N7XVGLX.js} +59 -68
  18. package/dist/{chunk-RT5TZAMU.js → chunk-3OZQ35X3.js} +212 -312
  19. package/dist/{chunk-Z4ZKOUGH.js → chunk-4JJWOILI.js} +3 -5
  20. package/dist/chunk-735L35R6.js +1790 -0
  21. package/dist/chunk-BQTQJQ5E.js +10 -0
  22. package/dist/chunk-BRJDNGYH.js +22 -0
  23. package/dist/chunk-BRMONS6A.js +130 -0
  24. package/dist/{chunk-ZG23Z3WY.js → chunk-C2EDPY6J.js} +3 -5
  25. package/dist/chunk-DW4U6YI6.js +10 -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-RE2QZJWE.js → chunk-PRQ2NHRZ.js} +3 -5
  32. package/dist/chunk-RDRDFJQE.js +10 -0
  33. package/dist/chunk-RMP3HM5N.js +14 -0
  34. package/dist/{chunk-GFRPLEJR.js → chunk-SQGWZAUC.js} +279 -311
  35. package/dist/chunk-SWYON2RG.js +1 -4
  36. package/dist/{chunk-PKPZTO4H.js → chunk-TW77BXMT.js} +10 -13
  37. package/dist/{chunk-4XWIXR2P.js → chunk-VMPFHQ7U.js} +19 -27
  38. package/dist/chunk-VQ5SIQWU.js +1 -3
  39. package/dist/chunk-W6TBGBV3.js +675 -0
  40. package/dist/index.d.ts +0 -2
  41. package/dist/index.js +24 -209
  42. package/dist/public-functions/executeRoute.js +12 -21
  43. package/dist/public-functions/getFeeInfoForChain.js +5 -14
  44. package/dist/public-functions/getRecommendedGasPrice.d.ts +1 -1
  45. package/dist/public-functions/getRecommendedGasPrice.js +7 -16
  46. package/dist/public-functions/getSigningStargateClient.d.ts +1 -1
  47. package/dist/public-functions/getSigningStargateClient.js +4 -13
  48. package/dist/public-functions/setApiOptions.js +2 -11
  49. package/dist/public-functions/setClientOptions.js +4 -13
  50. package/package.json +12 -3
  51. package/dist/chunk-2WHYWV4Y.js +0 -12
  52. package/dist/chunk-5KVRQLI5.js +0 -17
  53. package/dist/chunk-6BTWKTNM.js +0 -16
  54. package/dist/chunk-6GJEXV5J.js +0 -130
  55. package/dist/chunk-ASPVKNJ7.js +0 -242
  56. package/dist/chunk-EQLA2SEZ.js +0 -2361
  57. package/dist/chunk-FVSSCQ6C.js +0 -12
  58. package/dist/chunk-KYFTM3PI.js +0 -12
  59. package/dist/chunk-L2Q5RP6O.js +0 -25
  60. package/dist/chunk-LRIPQQ4M.js +0 -11
  61. package/dist/chunk-X2E2TKVR.js +0 -12
  62. package/dist/chunk-YYNIFO2A.js +0 -13
@@ -0,0 +1,10 @@
1
+ import { api } from './chunk-W6TBGBV3.js';
2
+
3
+ // src/api/postMessagesDirect.ts
4
+ var messagesDirect = api({
5
+ methodName: "getMsgsDirectV2",
6
+ method: "post",
7
+ path: "/v2/fungible/msgs_direct"
8
+ });
9
+
10
+ export { messagesDirect };
@@ -0,0 +1,22 @@
1
+ import { BigNumber } from './chunk-VQ5SIQWU.js';
2
+ import { getFeeInfoForChain } from './chunk-VMPFHQ7U.js';
3
+ import { Decimal } from '@cosmjs/math/build/decimal';
4
+ import { GasPrice } from '@cosmjs/stargate';
5
+
6
+ var getRecommendedGasPrice = async (props) => {
7
+ const feeInfo = await getFeeInfoForChain(props);
8
+ if (!feeInfo || !feeInfo.gasPrice) {
9
+ return void 0;
10
+ }
11
+ let price = feeInfo.gasPrice.average;
12
+ if (price === "") {
13
+ price = feeInfo.gasPrice.high;
14
+ }
15
+ if (price === "") {
16
+ price = feeInfo.gasPrice.low;
17
+ }
18
+ if (!price) return;
19
+ return new GasPrice(Decimal.fromUserInput(BigNumber(price).toFixed(), 18), feeInfo.denom);
20
+ };
21
+
22
+ export { getRecommendedGasPrice };
@@ -0,0 +1,130 @@
1
+ import { api } from './chunk-W6TBGBV3.js';
2
+
3
+ // src/private-functions/getMainnetAndTestnetChains.ts
4
+ var getMainnetAndTestnetChains = async (apiOptions) => {
5
+ const [mainnetRes, testnetRes] = await Promise.all([
6
+ chains({
7
+ includeEvm: true,
8
+ includeSvm: true,
9
+ ...apiOptions
10
+ }),
11
+ chains({
12
+ includeEvm: true,
13
+ includeSvm: true,
14
+ onlyTestnets: true,
15
+ ...apiOptions
16
+ })
17
+ ]);
18
+ const combinedChains = [...mainnetRes ?? [], ...testnetRes ?? []];
19
+ ClientState.skipChains = combinedChains;
20
+ return combinedChains;
21
+ };
22
+
23
+ // src/api/getAssets.ts
24
+ var assets = api({
25
+ methodName: "getAssets",
26
+ path: "/v2/fungible/assets",
27
+ transformResponse: (response) => {
28
+ return transformAssetsMap(response.chainToAssetsMap);
29
+ },
30
+ onSuccess: (response, options) => {
31
+ if (options?.includeEvmAssets && options?.includeSvmAssets && options?.includeCw20Assets) {
32
+ ClientState.skipAssets = response;
33
+ }
34
+ }
35
+ });
36
+ var transformAssetsMap = (input) => Object.entries(input ?? {}).reduce(
37
+ (acc, [chainId, { assets: assets2 }]) => {
38
+ acc[chainId] = (assets2 ?? []).map((asset) => asset);
39
+ return acc;
40
+ },
41
+ {}
42
+ );
43
+
44
+ // src/private-functions/getMainnetAndTestnetAssets.ts
45
+ var getMainnetAndTestnetAssets = async ({
46
+ chainId,
47
+ ...apiOptions
48
+ }) => {
49
+ const [assetsMainnet, assetsTestnet] = await Promise.all([
50
+ assets({
51
+ chainIds: chainId ? [chainId] : void 0,
52
+ ...apiOptions
53
+ }),
54
+ assets({
55
+ chainIds: chainId ? [chainId] : void 0,
56
+ onlyTestnets: true,
57
+ ...apiOptions
58
+ })
59
+ ]);
60
+ const mainnet = assetsMainnet;
61
+ const testnet = assetsTestnet;
62
+ const merged = {
63
+ ...mainnet,
64
+ ...testnet
65
+ };
66
+ ClientState.skipAssets = merged;
67
+ return merged;
68
+ };
69
+
70
+ // src/api/postBalances.ts
71
+ var balances = api({
72
+ methodName: "getBalances",
73
+ method: "post",
74
+ path: "/v2/info/balances",
75
+ onSuccess: (response, options) => {
76
+ if (!options) {
77
+ ClientState.skipBalances = response;
78
+ }
79
+ }
80
+ });
81
+
82
+ // src/state/clientState.ts
83
+ var ClientState = class {
84
+ static aminoTypes;
85
+ static registry;
86
+ static endpointOptions;
87
+ static skipChains;
88
+ static skipAssets;
89
+ static skipBalances;
90
+ static async getSkipChains(apiOptions) {
91
+ if (this.skipChains) {
92
+ return this.skipChains;
93
+ }
94
+ const response = await getMainnetAndTestnetChains(apiOptions);
95
+ this.skipChains = response;
96
+ return response;
97
+ }
98
+ static async getSkipAssets(props) {
99
+ if (this.skipAssets) {
100
+ return this.skipAssets;
101
+ }
102
+ const response = await getMainnetAndTestnetAssets(props);
103
+ this.skipAssets = response;
104
+ return response;
105
+ }
106
+ static async getSkipBalances() {
107
+ if (this.skipBalances) {
108
+ return this.skipBalances;
109
+ }
110
+ const response = await balances();
111
+ this.skipBalances = response;
112
+ return response;
113
+ }
114
+ static signingStargateClientByChainId = {};
115
+ static validateGasResults;
116
+ };
117
+
118
+ // src/api/getChains.ts
119
+ var chains = api({
120
+ methodName: "getChains",
121
+ path: "/v2/info/chains",
122
+ transformResponse: (response) => response.chains,
123
+ onSuccess: (response, options) => {
124
+ if (options?.includeEvm && options?.includeSvm) {
125
+ ClientState.skipChains = response;
126
+ }
127
+ }
128
+ });
129
+
130
+ export { ClientState, assets, balances, chains, transformAssetsMap };
@@ -1,12 +1,10 @@
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/getVenues.ts
6
- var venues = chunkASPVKNJ7_js.api({
4
+ var venues = api({
7
5
  methodName: "getVenues",
8
6
  path: "/v2/fungible/venues",
9
7
  transformResponse: (response) => response.venues
10
8
  });
11
9
 
12
- exports.venues = venues;
10
+ export { venues };
@@ -0,0 +1,10 @@
1
+ import { api } from './chunk-W6TBGBV3.js';
2
+
3
+ // src/api/postMessages.ts
4
+ var messages = api({
5
+ methodName: "getMsgsV2",
6
+ method: "post",
7
+ path: "/v2/fungible/msgs"
8
+ });
9
+
10
+ export { messages };
@@ -0,0 +1,16 @@
1
+ import { ApiState, api } from './chunk-W6TBGBV3.js';
2
+
3
+ // src/api/postRoute.ts
4
+ var route = async (request) => {
5
+ const requestWithAffiliateFeeBps = {
6
+ ...request,
7
+ cumulativeAffiliateFeeBps: ApiState.cumulativeAffiliateFeeBPS
8
+ };
9
+ return api({
10
+ methodName: "getRouteV2",
11
+ method: "post",
12
+ path: "/v2/fungible/route"
13
+ })(requestWithAffiliateFeeBps);
14
+ };
15
+
16
+ export { route };