@skip-go/client 1.5.3-alpha.1 → 1.5.3
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.
- package/dist/cjs/api/getAssets.cjs +1 -1
- package/dist/cjs/api/getAssetsBetweenChains.cjs +1 -1
- package/dist/cjs/api/getBridges.cjs +1 -1
- package/dist/cjs/api/getChains.cjs +1 -1
- package/dist/cjs/api/getVenues.cjs +1 -1
- package/dist/cjs/api/postAssetsFromSource.cjs +1 -1
- package/dist/cjs/api/postBalances.cjs +1 -1
- package/dist/cjs/api/postIbcOriginAssets.cjs +1 -1
- package/dist/cjs/api/postMessages.cjs +1 -1
- package/dist/cjs/api/postMessagesDirect.cjs +1 -1
- package/dist/cjs/api/postRecommendAssets.cjs +1 -1
- package/dist/cjs/api/postRoute.cjs +1 -1
- package/dist/cjs/api/postSubmitTransaction.cjs +1 -1
- package/dist/cjs/api/postTrackTransaction.cjs +1 -1
- package/dist/cjs/api/postTransactionStatus.cjs +1 -1
- package/dist/cjs/chunk-3UPZIINE.cjs +454 -0
- package/dist/cjs/chunk-4RLEZ5DV.cjs +55 -0
- package/dist/cjs/{chunk-KM2D7PJL.cjs → chunk-4TBONPD6.cjs} +33 -33
- package/dist/cjs/{chunk-WKYP2NMS.cjs → chunk-6W2OIU3O.cjs} +15 -15
- package/dist/cjs/{chunk-I2FDWZZJ.cjs → chunk-BFA7XKVT.cjs} +64 -765
- package/dist/cjs/chunk-BT6HQNBF.cjs +214 -0
- package/dist/cjs/{chunk-APJDSXWR.cjs → chunk-DAPPFYGA.cjs} +8 -8
- package/dist/cjs/{chunk-RC73RNNQ.cjs → chunk-GOQK63JP.cjs} +4 -4
- package/dist/cjs/chunk-KZOSEIWH.cjs +10 -0
- package/dist/cjs/{chunk-3M7YYWGL.cjs → chunk-MUJBB64F.cjs} +3 -7
- package/dist/cjs/{chunk-NWD4MAMT.cjs → chunk-ND7SYSAP.cjs} +2 -8
- package/dist/cjs/{chunk-DWOE6N5S.cjs → chunk-NM4PISTQ.cjs} +189 -188
- package/dist/cjs/{chunk-PDTIT3JO.cjs → chunk-QWQVTCKP.cjs} +12 -12
- package/dist/cjs/{chunk-XCFPRLX3.cjs → chunk-U2NZCNKX.cjs} +153 -153
- package/dist/cjs/{chunk-DLT6Q6RB.cjs → chunk-WOSAJSJB.cjs} +163 -149
- package/dist/cjs/index.cjs +83 -79
- package/dist/cjs/public-functions/executeMultipleRoutes.cjs +11 -21
- package/dist/cjs/public-functions/executeRoute.cjs +11 -21
- package/dist/cjs/public-functions/getCosmosGasAmountForMessage.cjs +5 -5
- package/dist/cjs/public-functions/getEvmGasAmountForMessage.cjs +1 -1
- package/dist/cjs/public-functions/getFeeInfoForChain.cjs +4 -3
- package/dist/cjs/public-functions/getRecommendedGasPrice.cjs +6 -5
- package/dist/cjs/public-functions/getRouteWithGasOnReceive.cjs +17 -13
- package/dist/cjs/public-functions/getSigningStargateClient.cjs +4 -4
- package/dist/cjs/public-functions/setApiOptions.cjs +1 -1
- package/dist/cjs/public-functions/setClientOptions.cjs +5 -5
- package/dist/cjs/public-functions/subscribeToRouteStatus.cjs +1 -1
- package/dist/cjs/public-functions/validateCosmosGasBalance.cjs +8 -8
- package/dist/cjs/public-functions/waitForTransaction.cjs +1 -1
- package/dist/esm/api/getAssets.d.ts +1 -1
- package/dist/esm/api/getAssets.js +1 -1
- package/dist/esm/api/getAssetsBetweenChains.d.ts +1 -1
- package/dist/esm/api/getAssetsBetweenChains.js +1 -1
- package/dist/esm/api/getBridges.d.ts +1 -1
- package/dist/esm/api/getBridges.js +1 -1
- package/dist/esm/api/getChains.d.ts +1 -1
- package/dist/esm/api/getChains.js +1 -1
- package/dist/esm/api/getVenues.js +1 -1
- package/dist/esm/api/postAssetsFromSource.d.ts +1 -1
- package/dist/esm/api/postAssetsFromSource.js +1 -1
- package/dist/esm/api/postBalances.d.ts +2 -2
- package/dist/esm/api/postBalances.js +1 -1
- package/dist/esm/api/postIbcOriginAssets.js +1 -1
- package/dist/esm/api/postMessages.d.ts +2 -2
- package/dist/esm/api/postMessages.js +1 -1
- package/dist/esm/api/postMessagesDirect.d.ts +1 -1
- package/dist/esm/api/postMessagesDirect.js +1 -1
- package/dist/esm/api/postRecommendAssets.d.ts +1 -1
- package/dist/esm/api/postRecommendAssets.js +1 -1
- package/dist/esm/api/postRoute.d.ts +2 -2
- package/dist/esm/api/postRoute.js +1 -1
- package/dist/esm/api/postSubmitTransaction.d.ts +2 -2
- package/dist/esm/api/postSubmitTransaction.js +1 -1
- package/dist/esm/api/postTrackTransaction.d.ts +2 -2
- package/dist/esm/api/postTrackTransaction.js +1 -1
- package/dist/esm/api/postTransactionStatus.d.ts +2 -2
- package/dist/esm/api/postTransactionStatus.js +1 -1
- package/dist/esm/{callbacks-C-KUJnDv.d.ts → callbacks-CJ_p70xa.d.ts} +3 -3
- package/dist/esm/chunk-426BGQ4K.js +431 -0
- package/dist/esm/chunk-BBEFB277.js +53 -0
- package/dist/esm/{chunk-UIDIKXMB.js → chunk-F2LQB2DP.js} +6 -5
- package/dist/esm/{chunk-KNXMSLOB.js → chunk-GLH7IRLX.js} +2 -2
- package/dist/esm/{chunk-2PWROHHX.js → chunk-GLM7QWYT.js} +1 -1
- package/dist/esm/{chunk-SFWTQBQT.js → chunk-H2TTIB5K.js} +3 -3
- package/dist/esm/{chunk-QL423UEF.js → chunk-HP5EMWC6.js} +163 -149
- package/dist/esm/{chunk-V7VKYD4J.js → chunk-HZVXNDMH.js} +2 -2
- package/dist/esm/{chunk-JYYCFKB4.js → chunk-KS764SOZ.js} +15 -15
- package/dist/esm/{chunk-IKWC55JU.js → chunk-L233BZ4I.js} +59 -738
- package/dist/esm/{chunk-6M7N6EAO.js → chunk-LBS7KX5I.js} +12 -12
- package/dist/esm/{chunk-QRKO56DH.js → chunk-QYIZGNWZ.js} +2 -7
- package/dist/esm/{chunk-QO2CYYF5.js → chunk-RTDD7HZ3.js} +4 -7
- package/dist/esm/chunk-SA4GETWP.js +212 -0
- package/dist/esm/chunk-SWYON2RG.js +7 -0
- package/dist/esm/{client-types-CGMuZ3zo.d.ts → client-types-uXKJQRqe.d.ts} +1 -1
- package/dist/esm/{generateApi-D_-Gso-x.d.ts → generateApi-BMFrG4FZ.d.ts} +1 -1
- package/dist/esm/index.d.ts +260 -259
- package/dist/esm/index.js +16 -12
- package/dist/esm/public-functions/executeMultipleRoutes.d.ts +4 -4
- package/dist/esm/public-functions/executeMultipleRoutes.js +10 -20
- package/dist/esm/public-functions/executeRoute.d.ts +4 -4
- package/dist/esm/public-functions/executeRoute.js +10 -20
- package/dist/esm/public-functions/getCosmosGasAmountForMessage.d.ts +1 -1
- package/dist/esm/public-functions/getCosmosGasAmountForMessage.js +3 -3
- package/dist/esm/public-functions/getEvmGasAmountForMessage.d.ts +3 -3
- package/dist/esm/public-functions/getEvmGasAmountForMessage.js +1 -1
- package/dist/esm/public-functions/getFeeInfoForChain.d.ts +1 -1
- package/dist/esm/public-functions/getFeeInfoForChain.js +3 -2
- package/dist/esm/public-functions/getRecommendedGasPrice.js +5 -4
- package/dist/esm/public-functions/getRouteWithGasOnReceive.d.ts +1 -1
- package/dist/esm/public-functions/getRouteWithGasOnReceive.js +16 -12
- package/dist/esm/public-functions/getSigningStargateClient.js +3 -3
- package/dist/esm/public-functions/setApiOptions.d.ts +1 -1
- package/dist/esm/public-functions/setApiOptions.js +1 -1
- package/dist/esm/public-functions/setClientOptions.d.ts +4 -4
- package/dist/esm/public-functions/setClientOptions.js +4 -4
- package/dist/esm/public-functions/subscribeToRouteStatus.d.ts +4 -4
- package/dist/esm/public-functions/subscribeToRouteStatus.js +1 -1
- package/dist/esm/public-functions/validateCosmosGasBalance.d.ts +4 -4
- package/dist/esm/public-functions/validateCosmosGasBalance.js +7 -7
- package/dist/esm/public-functions/waitForTransaction.d.ts +4 -4
- package/dist/esm/public-functions/waitForTransaction.js +1 -1
- package/dist/esm/{setClientOptions-C8g92xTm.d.ts → setClientOptions-D1qgaOqC.d.ts} +3 -3
- package/dist/esm/{swaggerTypes-B_jKfpvz.d.ts → swaggerTypes-Cop47I0X.d.ts} +257 -255
- package/package.json +5 -5
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkBFA7XKVT_cjs = require('./chunk-BFA7XKVT.cjs');
|
|
4
|
+
var chunkBCX2D6TE_cjs = require('./chunk-BCX2D6TE.cjs');
|
|
5
|
+
var chunk3NHW3XWK_cjs = require('./chunk-3NHW3XWK.cjs');
|
|
6
|
+
var chunkPLO5CVGN_cjs = require('./chunk-PLO5CVGN.cjs');
|
|
7
|
+
var chunkHFEMNOJS_cjs = require('./chunk-HFEMNOJS.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 chunkBFA7XKVT_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 chunk3NHW3XWK_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: chunkHFEMNOJS_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 } = chunkBCX2D6TE_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 chunkBFA7XKVT_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
|
+
chunkBCX2D6TE_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 chunkPLO5CVGN_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 chunkBCX2D6TE_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
|
+
chunkBCX2D6TE_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;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunk4TBONPD6_cjs = require('./chunk-4TBONPD6.cjs');
|
|
4
|
+
var chunk6W2OIU3O_cjs = require('./chunk-6W2OIU3O.cjs');
|
|
5
|
+
var chunkQWQVTCKP_cjs = require('./chunk-QWQVTCKP.cjs');
|
|
6
6
|
var chunkQAHHTQ7V_cjs = require('./chunk-QAHHTQ7V.cjs');
|
|
7
7
|
var stargate = require('@cosmjs/stargate');
|
|
8
8
|
var math = require('@cosmjs/math');
|
|
@@ -35,11 +35,11 @@ var validateCosmosGasBalance = async ({
|
|
|
35
35
|
if (txIndex !== 0 && chainId === "noble-1") {
|
|
36
36
|
return "0";
|
|
37
37
|
}
|
|
38
|
-
const { stargateClient } = await
|
|
38
|
+
const { stargateClient } = await chunkQWQVTCKP_cjs.getSigningStargateClient({
|
|
39
39
|
chainId,
|
|
40
40
|
getOfflineSigner
|
|
41
41
|
});
|
|
42
|
-
const estimatedGas = await
|
|
42
|
+
const estimatedGas = await chunk4TBONPD6_cjs.getCosmosGasAmountForMessage(
|
|
43
43
|
stargateClient,
|
|
44
44
|
signerAddress,
|
|
45
45
|
chainId,
|
|
@@ -76,7 +76,7 @@ var validateCosmosGasBalance = async ({
|
|
|
76
76
|
}
|
|
77
77
|
if (!price) return;
|
|
78
78
|
return new stargate.GasPrice(
|
|
79
|
-
math.Decimal.fromUserInput(
|
|
79
|
+
math.Decimal.fromUserInput(chunk6W2OIU3O_cjs.BigNumber(price).toFixed(), 18),
|
|
80
80
|
asset?.denom ?? ""
|
|
81
81
|
);
|
|
82
82
|
})();
|
|
@@ -148,8 +148,8 @@ var validateCosmosGasBalance = async ({
|
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
150
|
if (parseInt(balance?.amount ?? "") < parseInt(fee.amount[0]?.amount)) {
|
|
151
|
-
const userAmount = new
|
|
152
|
-
const feeAmount = new
|
|
151
|
+
const userAmount = new chunk6W2OIU3O_cjs.BigNumber(parseFloat(balance?.amount ?? "")).shiftedBy(-decimal).toFixed(decimal);
|
|
152
|
+
const feeAmount = new chunk6W2OIU3O_cjs.BigNumber(parseFloat(fee.amount[0]?.amount)).shiftedBy(-decimal).toFixed(decimal);
|
|
153
153
|
return {
|
|
154
154
|
error: `Insufficient balance for gas on ${chain?.prettyName}. Need ${feeAmount} ${symbol} but only have ${userAmount} ${symbol}.`,
|
|
155
155
|
asset
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk6W2OIU3O_cjs = require('./chunk-6W2OIU3O.cjs');
|
|
4
|
+
var chunkND7SYSAP_cjs = require('./chunk-ND7SYSAP.cjs');
|
|
5
5
|
var math = require('@cosmjs/math');
|
|
6
6
|
var stargate = require('@cosmjs/stargate');
|
|
7
7
|
|
|
8
8
|
var getRecommendedGasPrice = async (props) => {
|
|
9
|
-
const feeInfo = await
|
|
9
|
+
const feeInfo = await chunkND7SYSAP_cjs.getFeeInfoForChain(props);
|
|
10
10
|
if (!feeInfo || !feeInfo.gasPrice) {
|
|
11
11
|
return void 0;
|
|
12
12
|
}
|
|
@@ -18,7 +18,7 @@ var getRecommendedGasPrice = async (props) => {
|
|
|
18
18
|
price = feeInfo.gasPrice.low;
|
|
19
19
|
}
|
|
20
20
|
if (!price) return;
|
|
21
|
-
return new stargate.GasPrice(math.Decimal.fromUserInput(
|
|
21
|
+
return new stargate.GasPrice(math.Decimal.fromUserInput(chunk6W2OIU3O_cjs.BigNumber(price).toFixed(), 18), feeInfo.denom);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
exports.getRecommendedGasPrice = getRecommendedGasPrice;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/constants/constants.ts
|
|
4
|
+
var DEFAULT_GAS_DENOM_OVERRIDES = {
|
|
5
|
+
"noble-1": "uusdc"
|
|
6
|
+
};
|
|
7
|
+
var GAS_STATION_CHAIN_IDS = ["bbn-test-5", "bbn-1"];
|
|
8
|
+
|
|
9
|
+
exports.DEFAULT_GAS_DENOM_OVERRIDES = DEFAULT_GAS_DENOM_OVERRIDES;
|
|
10
|
+
exports.GAS_STATION_CHAIN_IDS = GAS_STATION_CHAIN_IDS;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _m0 = require('protobufjs/minimal.js');
|
|
4
4
|
var Long = require('long');
|
|
5
|
-
|
|
5
|
+
require('@keplr-wallet/unit');
|
|
6
6
|
|
|
7
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
8
|
|
|
@@ -72,9 +72,6 @@ function fromJsonTimestamp(o) {
|
|
|
72
72
|
function numberToLong(number) {
|
|
73
73
|
return Long__default.default.fromNumber(number);
|
|
74
74
|
}
|
|
75
|
-
function padDecimal(decStr) {
|
|
76
|
-
return decStr ? new unit.Dec(decStr).toString() : decStr;
|
|
77
|
-
}
|
|
78
75
|
function createBaseAny() {
|
|
79
76
|
return {
|
|
80
77
|
$typeUrl: "/google.protobuf.Any",
|
|
@@ -254,8 +251,8 @@ var BaseAccount = {
|
|
|
254
251
|
const obj = {};
|
|
255
252
|
obj.address = message.address === "" ? void 0 : message.address;
|
|
256
253
|
obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : void 0;
|
|
257
|
-
obj.account_number = !message.accountNumber.isZero() ? message.accountNumber
|
|
258
|
-
obj.sequence = !message.sequence.isZero() ? message.sequence
|
|
254
|
+
obj.account_number = !message.accountNumber.isZero() ? message.accountNumber?.toString() : void 0;
|
|
255
|
+
obj.sequence = !message.sequence.isZero() ? message.sequence?.toString() : void 0;
|
|
259
256
|
return obj;
|
|
260
257
|
},
|
|
261
258
|
fromAminoMsg(object) {
|
|
@@ -291,5 +288,4 @@ exports.bytesFromBase64 = bytesFromBase64;
|
|
|
291
288
|
exports.fromJsonTimestamp = fromJsonTimestamp;
|
|
292
289
|
exports.fromTimestamp = fromTimestamp;
|
|
293
290
|
exports.isSet = isSet;
|
|
294
|
-
exports.padDecimal = padDecimal;
|
|
295
291
|
exports.toTimestamp = toTimestamp;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkKZOSEIWH_cjs = require('./chunk-KZOSEIWH.cjs');
|
|
3
4
|
var chunkUMBMSRZZ_cjs = require('./chunk-UMBMSRZZ.cjs');
|
|
4
5
|
var chunkQAHHTQ7V_cjs = require('./chunk-QAHHTQ7V.cjs');
|
|
5
6
|
|
|
6
|
-
// src/constants/constants.ts
|
|
7
|
-
var DEFAULT_GAS_DENOM_OVERRIDES = {
|
|
8
|
-
"noble-1": "uusdc"
|
|
9
|
-
};
|
|
10
|
-
var GAS_STATION_CHAIN_IDS = ["bbn-test-5", "bbn-1"];
|
|
11
|
-
|
|
12
7
|
// src/private-functions/getDefaultGasTokenForChain.ts
|
|
13
8
|
var getDefaultGasTokenForChain = async (chainId) => {
|
|
14
|
-
const gasDenom = DEFAULT_GAS_DENOM_OVERRIDES[chainId];
|
|
9
|
+
const gasDenom = chunkKZOSEIWH_cjs.DEFAULT_GAS_DENOM_OVERRIDES[chainId];
|
|
15
10
|
if (gasDenom) {
|
|
16
11
|
return gasDenom;
|
|
17
12
|
}
|
|
@@ -97,5 +92,4 @@ var getFeeInfoForChain = async ({ chainId, apiUrl, apiKey }) => {
|
|
|
97
92
|
};
|
|
98
93
|
};
|
|
99
94
|
|
|
100
|
-
exports.GAS_STATION_CHAIN_IDS = GAS_STATION_CHAIN_IDS;
|
|
101
95
|
exports.getFeeInfoForChain = getFeeInfoForChain;
|