@skip-go/client 1.3.3 → 1.3.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.
- package/dist/cjs/api/postMessages.cjs +2 -2
- package/dist/cjs/{chunk-KJ5NZG2D.cjs → chunk-3FYU3BJ7.cjs} +3 -3
- package/dist/cjs/{chunk-A7GR26AQ.cjs → chunk-5BVYKNVO.cjs} +50 -21
- package/dist/cjs/{chunk-LP3L6XJB.cjs → chunk-FY56EEFB.cjs} +1 -0
- package/dist/cjs/{chunk-XNBHMZQZ.cjs → chunk-IE22IVFA.cjs} +3 -3
- 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/index.cjs +13 -13
- package/dist/cjs/public-functions/executeRoute.cjs +6 -6
- 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/api/postMessages.js +1 -1
- package/dist/esm/{chunk-CFDTJGQK.js → chunk-5KIWNRW4.js} +1 -1
- package/dist/esm/{chunk-GSCIF7YA.js → chunk-7LSTJXAF.js} +1 -0
- package/dist/esm/{chunk-2R3M45RX.js → chunk-ADUNNC4O.js} +2 -2
- package/dist/esm/chunk-VBWLUZXT.js +182 -0
- package/dist/esm/{chunk-35H4PDPF.js → chunk-YL6PL36T.js} +41 -12
- 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 +7 -7
- package/dist/esm/public-functions/executeRoute.d.ts +12 -0
- package/dist/esm/public-functions/executeRoute.js +5 -5
- 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,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFY56EEFB_cjs = require('../chunk-FY56EEFB.cjs');
|
|
4
4
|
require('../chunk-HKQ5VION.cjs');
|
|
5
5
|
require('../chunk-IDDRJJO5.cjs');
|
|
6
6
|
|
|
@@ -8,5 +8,5 @@ require('../chunk-IDDRJJO5.cjs');
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "messages", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkFY56EEFB_cjs.messages; }
|
|
12
12
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMN763TPC_cjs = require('./chunk-MN763TPC.cjs');
|
|
4
4
|
var chunkQSISUSYP_cjs = require('./chunk-QSISUSYP.cjs');
|
|
5
5
|
var stargate = require('@cosmjs/stargate');
|
|
6
6
|
var utils = require('@cosmjs/utils');
|
|
@@ -224,7 +224,7 @@ var getRpcEndpointForChain = async (chainId) => {
|
|
|
224
224
|
console.warn(
|
|
225
225
|
"Warning: You are using unreliable public endpoints. We strongly recommend overriding them via endpointOptions for use beyond development settings."
|
|
226
226
|
);
|
|
227
|
-
const chain =
|
|
227
|
+
const chain = chunkMN763TPC_cjs.chains().find((chain2) => chain2.chainId === chainId);
|
|
228
228
|
if (!chain) {
|
|
229
229
|
throw new Error(`getRpcEndpointForChain: failed to find chain id '${chainId}' in registry`);
|
|
230
230
|
}
|
|
@@ -234,7 +234,7 @@ var getRpcEndpointForChain = async (chainId) => {
|
|
|
234
234
|
);
|
|
235
235
|
}
|
|
236
236
|
const endpoints = chain.apis?.rpc?.map((api) => api.address);
|
|
237
|
-
const endpoint = await
|
|
237
|
+
const endpoint = await chunkMN763TPC_cjs.findFirstWorkingEndpoint(endpoints, "rpc");
|
|
238
238
|
if (!endpoint) {
|
|
239
239
|
throw new Error(
|
|
240
240
|
`getRpcEndpointForChain error: failed to find RPC endpoint for chain id '${chainId}'`
|
|
@@ -1,14 +1,14 @@
|
|
|
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
|
|
11
|
-
var
|
|
9
|
+
var chunk3FYU3BJ7_cjs = require('./chunk-3FYU3BJ7.cjs');
|
|
10
|
+
var chunkMN763TPC_cjs = require('./chunk-MN763TPC.cjs');
|
|
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');
|
|
14
14
|
var chunkQSISUSYP_cjs = require('./chunk-QSISUSYP.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
|
});
|
|
@@ -772,6 +781,14 @@ var signSvmTransaction = async ({
|
|
|
772
781
|
}
|
|
773
782
|
const txBuffer = Buffer.from(svmTx.tx ?? "", "base64");
|
|
774
783
|
const transaction = web3_js.Transaction.from(txBuffer);
|
|
784
|
+
if (options.svmFeePayer) {
|
|
785
|
+
const message = transaction.serializeMessage();
|
|
786
|
+
const resSignTx = await options.svmFeePayer.signTransaction(message);
|
|
787
|
+
transaction.addSignature(
|
|
788
|
+
new web3_js.PublicKey(options.svmFeePayer.address),
|
|
789
|
+
Buffer.from(resSignTx)
|
|
790
|
+
);
|
|
791
|
+
}
|
|
775
792
|
if (!("signTransaction" in signer)) return;
|
|
776
793
|
options?.onTransactionSignRequested?.({
|
|
777
794
|
chainId: svmTx.chainId,
|
|
@@ -794,7 +811,7 @@ var executeSvmTransaction = async (tx, options, index) => {
|
|
|
794
811
|
if (!signedTx) {
|
|
795
812
|
throw new Error("executeSvmTransaction error: signedTx is undefined");
|
|
796
813
|
}
|
|
797
|
-
const endpoint = await
|
|
814
|
+
const endpoint = await chunk3FYU3BJ7_cjs.getRpcEndpointForChain(svmTx.chainId);
|
|
798
815
|
const connection = new web3_js.Connection(endpoint);
|
|
799
816
|
let signature;
|
|
800
817
|
const submitTxResponse = await chunk2CCLIBCC_cjs.submitTransaction({
|
|
@@ -1012,10 +1029,20 @@ var validateEvmGasBalance = async ({
|
|
|
1012
1029
|
}
|
|
1013
1030
|
};
|
|
1014
1031
|
var validateSvmGasBalance = async ({
|
|
1015
|
-
tx
|
|
1032
|
+
tx,
|
|
1033
|
+
simulate
|
|
1016
1034
|
}) => {
|
|
1017
1035
|
if (!tx) throw new Error("Transaction is required");
|
|
1018
|
-
|
|
1036
|
+
if (simulate === false) {
|
|
1037
|
+
return {
|
|
1038
|
+
success: true,
|
|
1039
|
+
logs: [],
|
|
1040
|
+
error: null,
|
|
1041
|
+
asset: null,
|
|
1042
|
+
fee: null
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
const endpoint = await chunk3FYU3BJ7_cjs.getRpcEndpointForChain(tx.chainId ?? "");
|
|
1019
1046
|
const connection = new web3_js.Connection(endpoint);
|
|
1020
1047
|
if (!connection) throw new Error(`Failed to connect to ${tx.chainId}`);
|
|
1021
1048
|
if (!tx.tx) {
|
|
@@ -1095,7 +1122,7 @@ var validateGasBalances = async ({
|
|
|
1095
1122
|
throw new Error(`invalid msgs ${tx?.cosmosTx?.msgs}`);
|
|
1096
1123
|
}
|
|
1097
1124
|
try {
|
|
1098
|
-
const res = await
|
|
1125
|
+
const res = await chunkIE22IVFA_cjs.validateCosmosGasBalance({
|
|
1099
1126
|
chainId: tx.cosmosTx.chainId ?? "",
|
|
1100
1127
|
signerAddress: tx.cosmosTx.signerAddress ?? "",
|
|
1101
1128
|
messages: tx.cosmosTx.msgs,
|
|
@@ -1148,7 +1175,8 @@ var validateGasBalances = async ({
|
|
|
1148
1175
|
});
|
|
1149
1176
|
try {
|
|
1150
1177
|
const res = await validateSvmGasBalance({
|
|
1151
|
-
tx: tx.svmTx
|
|
1178
|
+
tx: tx.svmTx,
|
|
1179
|
+
simulate
|
|
1152
1180
|
});
|
|
1153
1181
|
return res;
|
|
1154
1182
|
} catch (e) {
|
|
@@ -1377,7 +1405,7 @@ var executeRoute = async (options) => {
|
|
|
1377
1405
|
if (!isUserAddressesValid) {
|
|
1378
1406
|
throw new Error("executeRoute error: invalid user addresses");
|
|
1379
1407
|
}
|
|
1380
|
-
const response = await
|
|
1408
|
+
const response = await chunkFY56EEFB_cjs.messages({
|
|
1381
1409
|
timeoutSeconds,
|
|
1382
1410
|
amountIn: route?.amountIn,
|
|
1383
1411
|
amountOut: route.estimatedAmountOut || "0",
|
|
@@ -1389,7 +1417,8 @@ var executeRoute = async (options) => {
|
|
|
1389
1417
|
addressList,
|
|
1390
1418
|
slippageTolerancePercent: options.slippageTolerancePercent || "1",
|
|
1391
1419
|
chainIdsToAffiliates: chunkHKQ5VION_cjs.ApiState.chainIdsToAffiliates,
|
|
1392
|
-
postRouteHandler: options.postRouteHandler
|
|
1420
|
+
postRouteHandler: options.postRouteHandler,
|
|
1421
|
+
feePayerAddress: options.svmFeePayer?.address
|
|
1393
1422
|
});
|
|
1394
1423
|
if (beforeMsg && (response?.txs?.length ?? 0) > 0) {
|
|
1395
1424
|
const firstTx = response?.txs?.[0];
|
|
@@ -15,6 +15,7 @@ var filterMessagesRequest = (request) => {
|
|
|
15
15
|
operations: request.operations,
|
|
16
16
|
estimatedAmountOut: request.estimatedAmountOut,
|
|
17
17
|
slippageTolerancePercent: request.slippageTolerancePercent,
|
|
18
|
+
feePayerAddress: request.feePayerAddress,
|
|
18
19
|
timeoutSeconds: request.timeoutSeconds,
|
|
19
20
|
postRouteHandler: request.postRouteHandler,
|
|
20
21
|
chainIdsToAffiliates: request.chainIdsToAffiliates,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkN3LR7KTI_cjs = require('./chunk-N3LR7KTI.cjs');
|
|
4
4
|
var chunk4R6OCWRR_cjs = require('./chunk-4R6OCWRR.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunk3FYU3BJ7_cjs = require('./chunk-3FYU3BJ7.cjs');
|
|
6
6
|
var chunkQSISUSYP_cjs = require('./chunk-QSISUSYP.cjs');
|
|
7
7
|
var stargate = require('@cosmjs/stargate');
|
|
8
8
|
var math = require('@cosmjs/math');
|
|
@@ -30,11 +30,11 @@ var validateCosmosGasBalance = async ({
|
|
|
30
30
|
}
|
|
31
31
|
const estimatedGasAmount = await (async () => {
|
|
32
32
|
try {
|
|
33
|
-
if (
|
|
33
|
+
if (simulate === false) throw new Error("simulate");
|
|
34
34
|
if (txIndex !== 0 && chainId === "noble-1") {
|
|
35
35
|
return "0";
|
|
36
36
|
}
|
|
37
|
-
const { stargateClient } = await
|
|
37
|
+
const { stargateClient } = await chunk3FYU3BJ7_cjs.getSigningStargateClient({
|
|
38
38
|
chainId,
|
|
39
39
|
getOfflineSigner
|
|
40
40
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkKZOSEIWH_cjs = require('./chunk-KZOSEIWH.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkMN763TPC_cjs = require('./chunk-MN763TPC.cjs');
|
|
5
5
|
var chunkQSISUSYP_cjs = require('./chunk-QSISUSYP.cjs');
|
|
6
6
|
|
|
7
7
|
// src/private-functions/getDefaultGasTokenForChain.ts
|
|
@@ -10,7 +10,7 @@ var getDefaultGasTokenForChain = async (chainId) => {
|
|
|
10
10
|
if (gasDenom) {
|
|
11
11
|
return gasDenom;
|
|
12
12
|
}
|
|
13
|
-
const chain =
|
|
13
|
+
const chain = chunkMN763TPC_cjs.chains().find((chain2) => chain2.chainId === chainId);
|
|
14
14
|
if (!chain) {
|
|
15
15
|
return void 0;
|
|
16
16
|
}
|
|
@@ -39,7 +39,7 @@ var getDefaultGasTokenForChain = async (chainId) => {
|
|
|
39
39
|
return chain.fees.feeTokens[0]?.denom;
|
|
40
40
|
};
|
|
41
41
|
var getStakingTokensForChain = (chainId) => {
|
|
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
|
`getStakingTokensForChain error: failed to find chain id '${chainId}' in registry`
|
|
@@ -69,7 +69,7 @@ var getFeeInfoForChain = async ({ chainId, apiUrl, apiKey }) => {
|
|
|
69
69
|
if (skipFeeInfo && skipFeeInfo.gasPrice !== null) {
|
|
70
70
|
return skipFeeInfo;
|
|
71
71
|
}
|
|
72
|
-
const chain =
|
|
72
|
+
const chain = chunkMN763TPC_cjs.chains().find((chain2) => chain2.chainId === chainId);
|
|
73
73
|
if (!chain) {
|
|
74
74
|
return void 0;
|
|
75
75
|
}
|