@skip-go/client 1.3.4 → 1.3.6
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/{chunk-KJ5NZG2D.cjs → chunk-3FYU3BJ7.cjs} +3 -3
- package/dist/cjs/{chunk-TWXIFMTM.cjs → chunk-IE22IVFA.cjs} +2 -2
- package/dist/cjs/{chunk-B4OGYBRC.cjs → chunk-JTB3SPCH.cjs} +4 -4
- package/dist/cjs/chunk-MN763TPC.cjs +187 -0
- package/dist/cjs/{chunk-L4MLX6KI.cjs → chunk-SZ64FWGB.cjs} +2 -2
- package/dist/cjs/{chunk-4AB775IT.cjs → chunk-VGS46RWR.cjs} +43 -16
- package/dist/cjs/index.cjs +11 -11
- package/dist/cjs/public-functions/executeRoute.cjs +5 -5
- package/dist/cjs/public-functions/getFeeInfoForChain.cjs +3 -3
- package/dist/cjs/public-functions/getRecommendedGasPrice.cjs +4 -4
- package/dist/cjs/public-functions/getSigningStargateClient.cjs +3 -3
- package/dist/cjs/public-functions/validateCosmosGasBalance.cjs +4 -4
- package/dist/esm/{chunk-CFDTJGQK.js → chunk-5KIWNRW4.js} +1 -1
- package/dist/esm/{chunk-JOBBQQDA.js → chunk-6ZLEWCU2.js} +35 -8
- package/dist/esm/{chunk-GD7EWX2G.js → chunk-ADUNNC4O.js} +1 -1
- package/dist/esm/chunk-VBWLUZXT.js +182 -0
- package/dist/esm/{chunk-6F2T2KB3.js → chunk-YLVFZDR5.js} +2 -2
- package/dist/esm/{chunk-Y5H25R7Z.js → chunk-ZL6XF5A3.js} +1 -1
- package/dist/esm/index.js +6 -6
- package/dist/esm/public-functions/executeRoute.js +4 -4
- package/dist/esm/public-functions/getFeeInfoForChain.js +2 -2
- package/dist/esm/public-functions/getRecommendedGasPrice.js +3 -3
- package/dist/esm/public-functions/getSigningStargateClient.js +2 -2
- package/dist/esm/public-functions/validateCosmosGasBalance.js +3 -3
- package/package.json +1 -1
- package/dist/cjs/chunk-T5LPU5A2.cjs +0 -188
- package/dist/esm/chunk-43P4WRGN.js +0 -183
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk4R6OCWRR_cjs = require('./chunk-4R6OCWRR.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkJTB3SPCH_cjs = require('./chunk-JTB3SPCH.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 chunkJTB3SPCH_cjs.getFeeInfoForChain(props);
|
|
10
10
|
if (!feeInfo || !feeInfo.gasPrice) {
|
|
11
11
|
return void 0;
|
|
12
12
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkIE22IVFA_cjs = require('./chunk-IE22IVFA.cjs');
|
|
4
4
|
var chunkJ5RC6ZU5_cjs = require('./chunk-J5RC6ZU5.cjs');
|
|
5
5
|
var chunkN3LR7KTI_cjs = require('./chunk-N3LR7KTI.cjs');
|
|
6
6
|
var chunkF3EB2AQG_cjs = require('./chunk-F3EB2AQG.cjs');
|
|
7
7
|
var chunk4R6OCWRR_cjs = require('./chunk-4R6OCWRR.cjs');
|
|
8
8
|
var chunkKZOSEIWH_cjs = require('./chunk-KZOSEIWH.cjs');
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var chunk3FYU3BJ7_cjs = require('./chunk-3FYU3BJ7.cjs');
|
|
10
|
+
var chunkMN763TPC_cjs = require('./chunk-MN763TPC.cjs');
|
|
11
11
|
var chunkFY56EEFB_cjs = require('./chunk-FY56EEFB.cjs');
|
|
12
12
|
var chunk2CCLIBCC_cjs = require('./chunk-2CCLIBCC.cjs');
|
|
13
13
|
var chunkMW3TE7DC_cjs = require('./chunk-MW3TE7DC.cjs');
|
|
@@ -39,7 +39,7 @@ var getRestEndpointForChain = async (chainId) => {
|
|
|
39
39
|
return endpointOptions.rest;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
const chain =
|
|
42
|
+
const chain = chunkMN763TPC_cjs.chains().find((chain2) => chain2.chainId === chainId);
|
|
43
43
|
if (!chain) {
|
|
44
44
|
throw new Error(
|
|
45
45
|
`getRestEndpointForChain error: failed to find chain id '${chainId}' in registry`
|
|
@@ -51,7 +51,7 @@ var getRestEndpointForChain = async (chainId) => {
|
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
const endpoints = chain.apis?.rest?.map((api) => api.address);
|
|
54
|
-
const endpoint = await
|
|
54
|
+
const endpoint = await chunkMN763TPC_cjs.findFirstWorkingEndpoint(endpoints, "rest");
|
|
55
55
|
if (!endpoint) {
|
|
56
56
|
throw new Error(
|
|
57
57
|
`getRestEndpointForChain error: failed to find REST endpoint for chain id '${chainId}'`
|
|
@@ -65,9 +65,9 @@ var getAccountNumberAndSequence = async (address, chainId) => {
|
|
|
65
65
|
if (chainId.includes("dymension")) {
|
|
66
66
|
return getAccountNumberAndSequenceFromDymension(address, chainId);
|
|
67
67
|
}
|
|
68
|
-
const endpoint = await
|
|
68
|
+
const endpoint = await chunk3FYU3BJ7_cjs.getRpcEndpointForChain(chainId);
|
|
69
69
|
const client = chunkQSISUSYP_cjs.ClientState.signingStargateClientByChainId[chainId] ?? await stargate.StargateClient.connect(endpoint, {
|
|
70
|
-
accountParser:
|
|
70
|
+
accountParser: chunk3FYU3BJ7_cjs.accountParser
|
|
71
71
|
});
|
|
72
72
|
const account = await client.getAccount(address);
|
|
73
73
|
if (!account) {
|
|
@@ -81,9 +81,18 @@ var getAccountNumberAndSequence = async (address, chainId) => {
|
|
|
81
81
|
};
|
|
82
82
|
var getAccountNumberAndSequenceFromDymension = async (address, chainId) => {
|
|
83
83
|
const endpoint = await getRestEndpointForChain(chainId);
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
const res = await fetch(
|
|
85
|
+
`${endpoint}/cosmos/auth/v1beta1/accounts/${address}`,
|
|
86
|
+
{
|
|
87
|
+
headers: {
|
|
88
|
+
"Content-Type": "application/json"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
if (!res.ok) {
|
|
93
|
+
throw new Error(`Failed to fetch account data: ${res.statusText}`);
|
|
94
|
+
}
|
|
95
|
+
const jsonResponse = await res.json();
|
|
87
96
|
const response = chunkHKQ5VION_cjs.toCamel(jsonResponse);
|
|
88
97
|
let sequence = 0;
|
|
89
98
|
let accountNumber = 0;
|
|
@@ -208,7 +217,7 @@ function encodeEthSecp256k1Pubkey(pubkey) {
|
|
|
208
217
|
|
|
209
218
|
// src/proto-signing/pubkey.ts
|
|
210
219
|
function makePubkeyAnyFromAccount(account, chainId) {
|
|
211
|
-
const isEthermint =
|
|
220
|
+
const isEthermint = chunkMN763TPC_cjs.getIsEthermint(chainId);
|
|
212
221
|
const pubkey = isEthermint ? encodeEthSecp256k1Pubkey(account.pubkey) : amino.encodeSecp256k1Pubkey(account.pubkey);
|
|
213
222
|
const pubkeyAny = encodePubkeyToAny(pubkey, chainId, isEthermint);
|
|
214
223
|
return pubkeyAny;
|
|
@@ -229,7 +238,7 @@ function encodePubkeyToAny(pubkey, chainId, isEthermint) {
|
|
|
229
238
|
value: Uint8Array.from(keys_js.PubKey.encode(pubkeyProto).finish())
|
|
230
239
|
});
|
|
231
240
|
} else {
|
|
232
|
-
const isInitia =
|
|
241
|
+
const isInitia = chunkMN763TPC_cjs.getIsInitia(chainId);
|
|
233
242
|
const pubkeyProto = keys_js.PubKey.fromPartial({
|
|
234
243
|
key: encoding.fromBase64(pubkey.value)
|
|
235
244
|
});
|
|
@@ -371,7 +380,7 @@ var signCosmosTransaction = async ({
|
|
|
371
380
|
if (messages2 === void 0) {
|
|
372
381
|
throw new Error("no messages found for tx");
|
|
373
382
|
}
|
|
374
|
-
const { signer } = await
|
|
383
|
+
const { signer } = await chunk3FYU3BJ7_cjs.getSigningStargateClient({
|
|
375
384
|
chainId,
|
|
376
385
|
getOfflineSigner: options?.getCosmosSigner
|
|
377
386
|
});
|
|
@@ -802,7 +811,7 @@ var executeSvmTransaction = async (tx, options, index) => {
|
|
|
802
811
|
if (!signedTx) {
|
|
803
812
|
throw new Error("executeSvmTransaction error: signedTx is undefined");
|
|
804
813
|
}
|
|
805
|
-
const endpoint = await
|
|
814
|
+
const endpoint = await chunk3FYU3BJ7_cjs.getRpcEndpointForChain(svmTx.chainId);
|
|
806
815
|
const connection = new web3_js.Connection(endpoint);
|
|
807
816
|
let signature;
|
|
808
817
|
const submitTxResponse = await chunk2CCLIBCC_cjs.submitTransaction({
|
|
@@ -1033,7 +1042,7 @@ var validateSvmGasBalance = async ({
|
|
|
1033
1042
|
fee: null
|
|
1034
1043
|
};
|
|
1035
1044
|
}
|
|
1036
|
-
const endpoint = await
|
|
1045
|
+
const endpoint = await chunk3FYU3BJ7_cjs.getRpcEndpointForChain(tx.chainId ?? "");
|
|
1037
1046
|
const connection = new web3_js.Connection(endpoint);
|
|
1038
1047
|
if (!connection) throw new Error(`Failed to connect to ${tx.chainId}`);
|
|
1039
1048
|
if (!tx.tx) {
|
|
@@ -1113,7 +1122,7 @@ var validateGasBalances = async ({
|
|
|
1113
1122
|
throw new Error(`invalid msgs ${tx?.cosmosTx?.msgs}`);
|
|
1114
1123
|
}
|
|
1115
1124
|
try {
|
|
1116
|
-
const res = await
|
|
1125
|
+
const res = await chunkIE22IVFA_cjs.validateCosmosGasBalance({
|
|
1117
1126
|
chainId: tx.cosmosTx.chainId ?? "",
|
|
1118
1127
|
signerAddress: tx.cosmosTx.signerAddress ?? "",
|
|
1119
1128
|
messages: tx.cosmosTx.msgs,
|
|
@@ -1274,6 +1283,24 @@ var executeTransactions = async (options) => {
|
|
|
1274
1283
|
}
|
|
1275
1284
|
if ("cosmosTx" in tx) {
|
|
1276
1285
|
await validateEnabledChainIds(tx.cosmosTx?.chainId ?? "");
|
|
1286
|
+
const isAllowedToBatchSignTxsUpfront = await (async () => {
|
|
1287
|
+
try {
|
|
1288
|
+
const currentUserAddress = options.userAddresses.find((x) => x.chainId === tx.cosmosTx?.chainId)?.address;
|
|
1289
|
+
if (!currentUserAddress) {
|
|
1290
|
+
return false;
|
|
1291
|
+
}
|
|
1292
|
+
const { accountNumber } = await getAccountNumberAndSequence(currentUserAddress, tx.cosmosTx?.chainId);
|
|
1293
|
+
if (accountNumber) {
|
|
1294
|
+
return true;
|
|
1295
|
+
}
|
|
1296
|
+
return false;
|
|
1297
|
+
} catch (_error) {
|
|
1298
|
+
return false;
|
|
1299
|
+
}
|
|
1300
|
+
})();
|
|
1301
|
+
if (!isAllowedToBatchSignTxsUpfront) {
|
|
1302
|
+
continue;
|
|
1303
|
+
}
|
|
1277
1304
|
const signedTx = await signCosmosTransaction({
|
|
1278
1305
|
tx,
|
|
1279
1306
|
options,
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkVGS46RWR_cjs = require('./chunk-VGS46RWR.cjs');
|
|
4
|
+
var chunkIE22IVFA_cjs = require('./chunk-IE22IVFA.cjs');
|
|
5
5
|
var chunkJ5RC6ZU5_cjs = require('./chunk-J5RC6ZU5.cjs');
|
|
6
6
|
var chunkN3LR7KTI_cjs = require('./chunk-N3LR7KTI.cjs');
|
|
7
7
|
var chunkF3EB2AQG_cjs = require('./chunk-F3EB2AQG.cjs');
|
|
8
|
-
var
|
|
8
|
+
var chunkSZ64FWGB_cjs = require('./chunk-SZ64FWGB.cjs');
|
|
9
9
|
require('./chunk-4R6OCWRR.cjs');
|
|
10
|
-
var
|
|
10
|
+
var chunkJTB3SPCH_cjs = require('./chunk-JTB3SPCH.cjs');
|
|
11
11
|
var chunkKZOSEIWH_cjs = require('./chunk-KZOSEIWH.cjs');
|
|
12
|
-
var
|
|
13
|
-
require('./chunk-
|
|
12
|
+
var chunk3FYU3BJ7_cjs = require('./chunk-3FYU3BJ7.cjs');
|
|
13
|
+
require('./chunk-MN763TPC.cjs');
|
|
14
14
|
var chunkFO25SR66_cjs = require('./chunk-FO25SR66.cjs');
|
|
15
15
|
var chunk2EKCOIWV_cjs = require('./chunk-2EKCOIWV.cjs');
|
|
16
16
|
require('./chunk-WMXUOVHN.cjs');
|
|
@@ -176,11 +176,11 @@ var FeeBehaviorJson = /* @__PURE__ */ ((FeeBehaviorJson2) => {
|
|
|
176
176
|
|
|
177
177
|
Object.defineProperty(exports, "executeRoute", {
|
|
178
178
|
enumerable: true,
|
|
179
|
-
get: function () { return
|
|
179
|
+
get: function () { return chunkVGS46RWR_cjs.executeRoute; }
|
|
180
180
|
});
|
|
181
181
|
Object.defineProperty(exports, "validateCosmosGasBalance", {
|
|
182
182
|
enumerable: true,
|
|
183
|
-
get: function () { return
|
|
183
|
+
get: function () { return chunkIE22IVFA_cjs.validateCosmosGasBalance; }
|
|
184
184
|
});
|
|
185
185
|
Object.defineProperty(exports, "waitForTransaction", {
|
|
186
186
|
enumerable: true,
|
|
@@ -196,11 +196,11 @@ Object.defineProperty(exports, "getEVMGasAmountForMessage", {
|
|
|
196
196
|
});
|
|
197
197
|
Object.defineProperty(exports, "getRecommendedGasPrice", {
|
|
198
198
|
enumerable: true,
|
|
199
|
-
get: function () { return
|
|
199
|
+
get: function () { return chunkSZ64FWGB_cjs.getRecommendedGasPrice; }
|
|
200
200
|
});
|
|
201
201
|
Object.defineProperty(exports, "getFeeInfoForChain", {
|
|
202
202
|
enumerable: true,
|
|
203
|
-
get: function () { return
|
|
203
|
+
get: function () { return chunkJTB3SPCH_cjs.getFeeInfoForChain; }
|
|
204
204
|
});
|
|
205
205
|
Object.defineProperty(exports, "GAS_STATION_CHAIN_IDS", {
|
|
206
206
|
enumerable: true,
|
|
@@ -208,7 +208,7 @@ Object.defineProperty(exports, "GAS_STATION_CHAIN_IDS", {
|
|
|
208
208
|
});
|
|
209
209
|
Object.defineProperty(exports, "getSigningStargateClient", {
|
|
210
210
|
enumerable: true,
|
|
211
|
-
get: function () { return
|
|
211
|
+
get: function () { return chunk3FYU3BJ7_cjs.getSigningStargateClient; }
|
|
212
212
|
});
|
|
213
213
|
Object.defineProperty(exports, "setApiOptions", {
|
|
214
214
|
enumerable: true,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunkVGS46RWR_cjs = require('../chunk-VGS46RWR.cjs');
|
|
4
|
+
require('../chunk-IE22IVFA.cjs');
|
|
5
5
|
require('../chunk-J5RC6ZU5.cjs');
|
|
6
6
|
require('../chunk-N3LR7KTI.cjs');
|
|
7
7
|
require('../chunk-F3EB2AQG.cjs');
|
|
8
8
|
require('../chunk-4R6OCWRR.cjs');
|
|
9
9
|
require('../chunk-KZOSEIWH.cjs');
|
|
10
|
-
require('../chunk-
|
|
11
|
-
require('../chunk-
|
|
10
|
+
require('../chunk-3FYU3BJ7.cjs');
|
|
11
|
+
require('../chunk-MN763TPC.cjs');
|
|
12
12
|
require('../chunk-WMXUOVHN.cjs');
|
|
13
13
|
require('../chunk-FY56EEFB.cjs');
|
|
14
14
|
require('../chunk-2CCLIBCC.cjs');
|
|
@@ -23,5 +23,5 @@ require('../chunk-IDDRJJO5.cjs');
|
|
|
23
23
|
|
|
24
24
|
Object.defineProperty(exports, "executeRoute", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkVGS46RWR_cjs.executeRoute; }
|
|
27
27
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkJTB3SPCH_cjs = require('../chunk-JTB3SPCH.cjs');
|
|
4
4
|
require('../chunk-KZOSEIWH.cjs');
|
|
5
|
-
require('../chunk-
|
|
5
|
+
require('../chunk-MN763TPC.cjs');
|
|
6
6
|
require('../chunk-QSISUSYP.cjs');
|
|
7
7
|
require('../chunk-HKQ5VION.cjs');
|
|
8
8
|
require('../chunk-IDDRJJO5.cjs');
|
|
@@ -11,5 +11,5 @@ require('../chunk-IDDRJJO5.cjs');
|
|
|
11
11
|
|
|
12
12
|
Object.defineProperty(exports, "getFeeInfoForChain", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkJTB3SPCH_cjs.getFeeInfoForChain; }
|
|
15
15
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkSZ64FWGB_cjs = require('../chunk-SZ64FWGB.cjs');
|
|
4
4
|
require('../chunk-4R6OCWRR.cjs');
|
|
5
|
-
require('../chunk-
|
|
5
|
+
require('../chunk-JTB3SPCH.cjs');
|
|
6
6
|
require('../chunk-KZOSEIWH.cjs');
|
|
7
|
-
require('../chunk-
|
|
7
|
+
require('../chunk-MN763TPC.cjs');
|
|
8
8
|
require('../chunk-QSISUSYP.cjs');
|
|
9
9
|
require('../chunk-HKQ5VION.cjs');
|
|
10
10
|
require('../chunk-IDDRJJO5.cjs');
|
|
@@ -13,5 +13,5 @@ require('../chunk-IDDRJJO5.cjs');
|
|
|
13
13
|
|
|
14
14
|
Object.defineProperty(exports, "getRecommendedGasPrice", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkSZ64FWGB_cjs.getRecommendedGasPrice; }
|
|
17
17
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var chunk3FYU3BJ7_cjs = require('../chunk-3FYU3BJ7.cjs');
|
|
4
|
+
require('../chunk-MN763TPC.cjs');
|
|
5
5
|
require('../chunk-QSISUSYP.cjs');
|
|
6
6
|
require('../chunk-HKQ5VION.cjs');
|
|
7
7
|
require('../chunk-IDDRJJO5.cjs');
|
|
@@ -10,5 +10,5 @@ require('../chunk-IDDRJJO5.cjs');
|
|
|
10
10
|
|
|
11
11
|
Object.defineProperty(exports, "getSigningStargateClient", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk3FYU3BJ7_cjs.getSigningStargateClient; }
|
|
14
14
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkIE22IVFA_cjs = require('../chunk-IE22IVFA.cjs');
|
|
4
4
|
require('../chunk-N3LR7KTI.cjs');
|
|
5
5
|
require('../chunk-4R6OCWRR.cjs');
|
|
6
|
-
require('../chunk-
|
|
7
|
-
require('../chunk-
|
|
6
|
+
require('../chunk-3FYU3BJ7.cjs');
|
|
7
|
+
require('../chunk-MN763TPC.cjs');
|
|
8
8
|
require('../chunk-WMXUOVHN.cjs');
|
|
9
9
|
require('../chunk-QSISUSYP.cjs');
|
|
10
10
|
require('../chunk-HKQ5VION.cjs');
|
|
@@ -14,5 +14,5 @@ require('../chunk-IDDRJJO5.cjs');
|
|
|
14
14
|
|
|
15
15
|
Object.defineProperty(exports, "validateCosmosGasBalance", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkIE22IVFA_cjs.validateCosmosGasBalance; }
|
|
18
18
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { validateCosmosGasBalance } from './chunk-
|
|
1
|
+
import { validateCosmosGasBalance } from './chunk-ADUNNC4O.js';
|
|
2
2
|
import { waitForTransaction } from './chunk-CU6W3622.js';
|
|
3
3
|
import { getEncodeObjectFromCosmosMessage, getEncodeObjectFromCosmosMessageInjective } from './chunk-TV2XPAIF.js';
|
|
4
4
|
import { getEVMGasAmountForMessage } from './chunk-GV2QOWB4.js';
|
|
5
5
|
import { BigNumber } from './chunk-VQ5SIQWU.js';
|
|
6
6
|
import { GAS_STATION_CHAIN_IDS } from './chunk-SWYON2RG.js';
|
|
7
|
-
import {
|
|
8
|
-
import { chains, findFirstWorkingEndpoint, getIsEthermint, getIsInitia } from './chunk-
|
|
7
|
+
import { getRpcEndpointForChain, accountParser, getSigningStargateClient } from './chunk-YLVFZDR5.js';
|
|
8
|
+
import { chains, findFirstWorkingEndpoint, getIsEthermint, getIsInitia } from './chunk-VBWLUZXT.js';
|
|
9
9
|
import { messages } from './chunk-7LSTJXAF.js';
|
|
10
10
|
import { submitTransaction } from './chunk-OHV2LZEG.js';
|
|
11
11
|
import { venues } from './chunk-JSY7M43P.js';
|
|
12
12
|
import { ClientState, balances } from './chunk-2L7PKZDY.js';
|
|
13
|
-
import { ApiState,
|
|
13
|
+
import { ApiState, toCamel, wait } from './chunk-LZI7A4JI.js';
|
|
14
14
|
import { PublicKey, Transaction, Connection, LAMPORTS_PER_SOL } from '@solana/web3.js';
|
|
15
15
|
import { bech32m, bech32 } from 'bech32';
|
|
16
16
|
import { StargateClient } from '@cosmjs/stargate';
|
|
@@ -37,7 +37,7 @@ var getRestEndpointForChain = async (chainId) => {
|
|
|
37
37
|
return endpointOptions.rest;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
const chain = chains().find((chain2) => chain2.
|
|
40
|
+
const chain = chains().find((chain2) => chain2.chainId === chainId);
|
|
41
41
|
if (!chain) {
|
|
42
42
|
throw new Error(
|
|
43
43
|
`getRestEndpointForChain error: failed to find chain id '${chainId}' in registry`
|
|
@@ -79,9 +79,18 @@ var getAccountNumberAndSequence = async (address, chainId) => {
|
|
|
79
79
|
};
|
|
80
80
|
var getAccountNumberAndSequenceFromDymension = async (address, chainId) => {
|
|
81
81
|
const endpoint = await getRestEndpointForChain(chainId);
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
const res = await fetch(
|
|
83
|
+
`${endpoint}/cosmos/auth/v1beta1/accounts/${address}`,
|
|
84
|
+
{
|
|
85
|
+
headers: {
|
|
86
|
+
"Content-Type": "application/json"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
if (!res.ok) {
|
|
91
|
+
throw new Error(`Failed to fetch account data: ${res.statusText}`);
|
|
92
|
+
}
|
|
93
|
+
const jsonResponse = await res.json();
|
|
85
94
|
const response = toCamel(jsonResponse);
|
|
86
95
|
let sequence = 0;
|
|
87
96
|
let accountNumber = 0;
|
|
@@ -1272,6 +1281,24 @@ var executeTransactions = async (options) => {
|
|
|
1272
1281
|
}
|
|
1273
1282
|
if ("cosmosTx" in tx) {
|
|
1274
1283
|
await validateEnabledChainIds(tx.cosmosTx?.chainId ?? "");
|
|
1284
|
+
const isAllowedToBatchSignTxsUpfront = await (async () => {
|
|
1285
|
+
try {
|
|
1286
|
+
const currentUserAddress = options.userAddresses.find((x) => x.chainId === tx.cosmosTx?.chainId)?.address;
|
|
1287
|
+
if (!currentUserAddress) {
|
|
1288
|
+
return false;
|
|
1289
|
+
}
|
|
1290
|
+
const { accountNumber } = await getAccountNumberAndSequence(currentUserAddress, tx.cosmosTx?.chainId);
|
|
1291
|
+
if (accountNumber) {
|
|
1292
|
+
return true;
|
|
1293
|
+
}
|
|
1294
|
+
return false;
|
|
1295
|
+
} catch (_error) {
|
|
1296
|
+
return false;
|
|
1297
|
+
}
|
|
1298
|
+
})();
|
|
1299
|
+
if (!isAllowedToBatchSignTxsUpfront) {
|
|
1300
|
+
continue;
|
|
1301
|
+
}
|
|
1275
1302
|
const signedTx = await signCosmosTransaction({
|
|
1276
1303
|
tx,
|
|
1277
1304
|
options,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getCosmosGasAmountForMessage } from './chunk-TV2XPAIF.js';
|
|
2
2
|
import { BigNumber } from './chunk-VQ5SIQWU.js';
|
|
3
|
-
import { getSigningStargateClient } from './chunk-
|
|
3
|
+
import { getSigningStargateClient } from './chunk-YLVFZDR5.js';
|
|
4
4
|
import { ClientState, balances } from './chunk-2L7PKZDY.js';
|
|
5
5
|
import { GasPrice, calculateFee } from '@cosmjs/stargate';
|
|
6
6
|
import { Decimal } from '@cosmjs/math';
|