@skip-go/client 1.5.8 → 1.5.10
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-AJAKXRMU.cjs → chunk-7NPXYEWD.cjs} +3 -3
- package/dist/cjs/{chunk-P4WDCGXH.cjs → chunk-BQA7DW7X.cjs} +4 -4
- package/dist/cjs/{chunk-GFISU6YP.cjs → chunk-D4WH536A.cjs} +16 -16
- package/dist/cjs/{chunk-2ZWLTAT4.cjs → chunk-NRW7LIZP.cjs} +6 -6
- package/dist/cjs/chunk-QCXACS5B.cjs +185 -0
- package/dist/cjs/{chunk-4KPBBDLF.cjs → chunk-SNDRAYA6.cjs} +11 -9
- package/dist/cjs/{chunk-MAIPDPG2.cjs → chunk-T3FJZY62.cjs} +3 -3
- package/dist/cjs/{chunk-IKW6KEBR.cjs → chunk-VAHQ7Z6F.cjs} +3 -3
- package/dist/cjs/{chunk-QTEVKV42.cjs → chunk-YCEP26JD.cjs} +4 -4
- package/dist/cjs/index.cjs +37 -38
- package/dist/cjs/public-functions/executeMultipleRoutes.cjs +6 -7
- package/dist/cjs/public-functions/executeRoute.cjs +6 -7
- package/dist/cjs/public-functions/getFeeInfoForChain.cjs +3 -3
- package/dist/cjs/public-functions/getRecommendedGasPrice.cjs +4 -5
- package/dist/cjs/public-functions/getRouteWithGasOnReceive.cjs +10 -11
- package/dist/cjs/public-functions/getSigningStargateClient.cjs +3 -3
- package/dist/cjs/public-functions/validateCosmosGasBalance.cjs +4 -5
- package/dist/esm/{chunk-7VC424OM.js → chunk-372ICCFS.js} +1 -1
- package/dist/esm/{chunk-WIQPJ6JH.js → chunk-5FHOHRZP.js} +1 -1
- package/dist/esm/{chunk-4HXJSGX4.js → chunk-5NDMKWQ5.js} +1 -1
- package/dist/esm/{chunk-M7ODNKRS.js → chunk-6G4PYWTU.js} +4 -4
- package/dist/esm/{chunk-32JIBODG.js → chunk-6URWUQ4I.js} +7 -9
- package/dist/esm/chunk-AUQYHQNV.js +180 -0
- package/dist/esm/{chunk-I6MYY4XP.js → chunk-BDL2EYW6.js} +2 -2
- package/dist/esm/{chunk-3HAURBPX.js → chunk-LCXLEGIY.js} +1 -1
- package/dist/esm/{chunk-LY5N6CIL.js → chunk-MX34RPR2.js} +2 -2
- package/dist/esm/index.js +9 -10
- package/dist/esm/public-functions/executeMultipleRoutes.js +5 -6
- package/dist/esm/public-functions/executeRoute.js +5 -6
- package/dist/esm/public-functions/getFeeInfoForChain.js +2 -2
- package/dist/esm/public-functions/getRecommendedGasPrice.js +3 -4
- package/dist/esm/public-functions/getRouteWithGasOnReceive.js +9 -10
- package/dist/esm/public-functions/getSigningStargateClient.js +2 -2
- package/dist/esm/public-functions/validateCosmosGasBalance.js +3 -4
- package/package.json +2 -1
- package/dist/cjs/chunk-6W2OIU3O.cjs +0 -1348
- package/dist/cjs/chunk-E4JCU2RG.cjs +0 -185
- package/dist/esm/chunk-CGZNJAHL.js +0 -180
- package/dist/esm/chunk-KS764SOZ.js +0 -1345
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkD4WH536A_cjs = require('./chunk-D4WH536A.cjs');
|
|
4
4
|
var chunkA3UNNRKD_cjs = require('./chunk-A3UNNRKD.cjs');
|
|
5
5
|
var chunkNCFH5MGF_cjs = require('./chunk-NCFH5MGF.cjs');
|
|
6
6
|
var chunkAUTOIM57_cjs = require('./chunk-AUTOIM57.cjs');
|
|
@@ -24,7 +24,7 @@ var executeMultipleRoutes = async (options) => {
|
|
|
24
24
|
`executeMultipleRoutes error: no user addresses found for route: ${routeKey}`
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
|
-
const routeAddressList = await
|
|
27
|
+
const routeAddressList = await chunkD4WH536A_cjs.createValidAddressList({
|
|
28
28
|
userAddresses: _userAddresses,
|
|
29
29
|
route: routeValue
|
|
30
30
|
});
|
|
@@ -132,7 +132,7 @@ var executeMultipleRoutes = async (options) => {
|
|
|
132
132
|
if (routeKey === "mainRoute") {
|
|
133
133
|
mainRouteId = routeId;
|
|
134
134
|
}
|
|
135
|
-
const { transactionDetails, executeTransaction: _executeTransaction } = await
|
|
135
|
+
const { transactionDetails, executeTransaction: _executeTransaction } = await chunkD4WH536A_cjs.executeTransactions({
|
|
136
136
|
...restOptions,
|
|
137
137
|
routeId,
|
|
138
138
|
txs: msgsResponse?.txs,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var chunkQTEVKV42_cjs = require('./chunk-QTEVKV42.cjs');
|
|
3
|
+
var chunkYCEP26JD_cjs = require('./chunk-YCEP26JD.cjs');
|
|
5
4
|
var math = require('@cosmjs/math');
|
|
6
5
|
var stargate = require('@cosmjs/stargate');
|
|
6
|
+
var bignumber_js = require('bignumber.js');
|
|
7
7
|
|
|
8
8
|
var getRecommendedGasPrice = async (props) => {
|
|
9
|
-
const feeInfo = await
|
|
9
|
+
const feeInfo = await chunkYCEP26JD_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(bignumber_js.BigNumber(price).toFixed(), 18), feeInfo.denom);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
exports.getRecommendedGasPrice = getRecommendedGasPrice;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkA3UNNRKD_cjs = require('./chunk-A3UNNRKD.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkNRW7LIZP_cjs = require('./chunk-NRW7LIZP.cjs');
|
|
5
5
|
var chunkTEH6UMUR_cjs = require('./chunk-TEH6UMUR.cjs');
|
|
6
6
|
var chunkF3EB2AQG_cjs = require('./chunk-F3EB2AQG.cjs');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var chunkE4JCU2RG_cjs = require('./chunk-E4JCU2RG.cjs');
|
|
7
|
+
var chunkT3FJZY62_cjs = require('./chunk-T3FJZY62.cjs');
|
|
8
|
+
var chunkQCXACS5B_cjs = require('./chunk-QCXACS5B.cjs');
|
|
10
9
|
var chunkJRXPJ45U_cjs = require('./chunk-JRXPJ45U.cjs');
|
|
11
10
|
var chunkFCTBCHOT_cjs = require('./chunk-FCTBCHOT.cjs');
|
|
12
11
|
var chunkATW6UNT5_cjs = require('./chunk-ATW6UNT5.cjs');
|
|
@@ -22,6 +21,7 @@ var math = require('@cosmjs/math');
|
|
|
22
21
|
var signing_js = require('cosmjs-types/cosmos/tx/signing/v1beta1/signing.js');
|
|
23
22
|
var viem = require('viem');
|
|
24
23
|
var web3_js = require('@solana/web3.js');
|
|
24
|
+
var bignumber_js = require('bignumber.js');
|
|
25
25
|
var bech32 = require('bech32');
|
|
26
26
|
|
|
27
27
|
// src/private-functions/getRestEndpointForChain.ts
|
|
@@ -35,7 +35,7 @@ var getRestEndpointForChain = async (chainId) => {
|
|
|
35
35
|
return endpointOptions.rest;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
const chain =
|
|
38
|
+
const chain = chunkQCXACS5B_cjs.chains().find((chain2) => chain2.chainId === chainId);
|
|
39
39
|
if (!chain) {
|
|
40
40
|
throw new Error(
|
|
41
41
|
`getRestEndpointForChain error: failed to find chain id '${chainId}' in registry`
|
|
@@ -47,7 +47,7 @@ var getRestEndpointForChain = async (chainId) => {
|
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
const endpoints = chain.apis?.rest?.map((api) => api.address);
|
|
50
|
-
const endpoint = await
|
|
50
|
+
const endpoint = await chunkQCXACS5B_cjs.findFirstWorkingEndpoint(endpoints, "rest");
|
|
51
51
|
if (!endpoint) {
|
|
52
52
|
throw new Error(
|
|
53
53
|
`getRestEndpointForChain error: failed to find REST endpoint for chain id '${chainId}'`
|
|
@@ -61,9 +61,9 @@ var getAccountNumberAndSequence = async (address, chainId) => {
|
|
|
61
61
|
if (chainId.includes("dymension")) {
|
|
62
62
|
return getAccountNumberAndSequenceFromDymension(address, chainId);
|
|
63
63
|
}
|
|
64
|
-
const endpoint = await
|
|
64
|
+
const endpoint = await chunkT3FJZY62_cjs.getRpcEndpointForChain(chainId);
|
|
65
65
|
const client = chunkATW6UNT5_cjs.ClientState.signingStargateClientByChainId[chainId] ?? await stargate.StargateClient.connect(endpoint, {
|
|
66
|
-
accountParser:
|
|
66
|
+
accountParser: chunkT3FJZY62_cjs.accountParser
|
|
67
67
|
});
|
|
68
68
|
const account = await client.getAccount(address);
|
|
69
69
|
if (!account) {
|
|
@@ -124,7 +124,7 @@ function encodeEthSecp256k1Pubkey(pubkey) {
|
|
|
124
124
|
|
|
125
125
|
// src/proto-signing/pubkey.ts
|
|
126
126
|
function makePubkeyAnyFromAccount(account, chainId) {
|
|
127
|
-
const isEthermint =
|
|
127
|
+
const isEthermint = chunkQCXACS5B_cjs.getIsEthermint(chainId);
|
|
128
128
|
const pubkey = isEthermint ? encodeEthSecp256k1Pubkey(account.pubkey) : amino.encodeSecp256k1Pubkey(account.pubkey);
|
|
129
129
|
const pubkeyAny = encodePubkeyToAny(pubkey, chainId, isEthermint);
|
|
130
130
|
return pubkeyAny;
|
|
@@ -145,7 +145,7 @@ function encodePubkeyToAny(pubkey, chainId, isEthermint) {
|
|
|
145
145
|
value: Uint8Array.from(keys_js.PubKey.encode(pubkeyProto).finish())
|
|
146
146
|
});
|
|
147
147
|
} else {
|
|
148
|
-
const isInitia =
|
|
148
|
+
const isInitia = chunkQCXACS5B_cjs.getIsInitia(chainId);
|
|
149
149
|
const pubkeyProto = keys_js.PubKey.fromPartial({
|
|
150
150
|
key: encoding.fromBase64(pubkey.value)
|
|
151
151
|
});
|
|
@@ -288,7 +288,7 @@ var signCosmosTransaction = async ({
|
|
|
288
288
|
if (messages === void 0) {
|
|
289
289
|
throw new Error("no messages found for tx");
|
|
290
290
|
}
|
|
291
|
-
const { signer } = await
|
|
291
|
+
const { signer } = await chunkT3FJZY62_cjs.getSigningStargateClient({
|
|
292
292
|
chainId,
|
|
293
293
|
getOfflineSigner: options?.getCosmosSigner
|
|
294
294
|
});
|
|
@@ -757,7 +757,7 @@ var executeSvmTransaction = async (tx, options, index, routeId) => {
|
|
|
757
757
|
if (!signedTx) {
|
|
758
758
|
throw new Error("executeSvmTransaction error: signedTx is undefined");
|
|
759
759
|
}
|
|
760
|
-
const endpoint = await
|
|
760
|
+
const endpoint = await chunkT3FJZY62_cjs.getRpcEndpointForChain(svmTx.chainId);
|
|
761
761
|
const connection = new web3_js.Connection(endpoint);
|
|
762
762
|
let signature;
|
|
763
763
|
const submitTxResponse = await chunkJRXPJ45U_cjs.submitTransaction({
|
|
@@ -845,7 +845,7 @@ var validateEvmTokenApproval = async ({
|
|
|
845
845
|
`Insufficient balance for gas on ${chain.prettyName}. Need ${formattedGasAmount} ${asset.symbol}.`
|
|
846
846
|
);
|
|
847
847
|
}
|
|
848
|
-
if (
|
|
848
|
+
if (bignumber_js.BigNumber(gasBalance.amount).lt(Number(allowanceGasFee))) {
|
|
849
849
|
const chainAssets = (await chunkATW6UNT5_cjs.ClientState.getSkipAssets({ chainId: tx.chainId }))[tx.chainId];
|
|
850
850
|
const asset = chainAssets?.find(
|
|
851
851
|
(x) => x.denom.includes("-native") || x.denom.toLowerCase() === "0x0000000000000000000000000000000000000000"
|
|
@@ -977,7 +977,7 @@ var validateEvmGasBalance = async ({
|
|
|
977
977
|
fee: null
|
|
978
978
|
};
|
|
979
979
|
}
|
|
980
|
-
if (
|
|
980
|
+
if (bignumber_js.BigNumber(gasBalance.amount ?? "").lt(Number(gasAmount))) {
|
|
981
981
|
const asset = skipAssets?.find(
|
|
982
982
|
(x) => x.denom?.includes("-native") || x.denom?.toLowerCase() === "0x0000000000000000000000000000000000000000"
|
|
983
983
|
);
|
|
@@ -1010,7 +1010,7 @@ var validateSvmGasBalance = async ({
|
|
|
1010
1010
|
fee: null
|
|
1011
1011
|
};
|
|
1012
1012
|
}
|
|
1013
|
-
const endpoint = await
|
|
1013
|
+
const endpoint = await chunkT3FJZY62_cjs.getRpcEndpointForChain(tx.chainId ?? "");
|
|
1014
1014
|
const connection = new web3_js.Connection(endpoint);
|
|
1015
1015
|
if (!connection) throw new Error(`Failed to connect to ${tx.chainId}`);
|
|
1016
1016
|
if (!tx.tx) {
|
|
@@ -1097,7 +1097,7 @@ var validateGasBalances = async ({
|
|
|
1097
1097
|
throw new Error(`invalid msgs ${tx?.cosmosTx?.msgs}`);
|
|
1098
1098
|
}
|
|
1099
1099
|
try {
|
|
1100
|
-
const res = await
|
|
1100
|
+
const res = await chunkNRW7LIZP_cjs.validateCosmosGasBalance({
|
|
1101
1101
|
chainId: tx.cosmosTx.chainId ?? "",
|
|
1102
1102
|
signerAddress: tx.cosmosTx.signerAddress ?? "",
|
|
1103
1103
|
messages: tx.cosmosTx.msgs,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkTEH6UMUR_cjs = require('./chunk-TEH6UMUR.cjs');
|
|
4
|
-
var
|
|
5
|
-
var chunkMAIPDPG2_cjs = require('./chunk-MAIPDPG2.cjs');
|
|
4
|
+
var chunkT3FJZY62_cjs = require('./chunk-T3FJZY62.cjs');
|
|
6
5
|
var chunkATW6UNT5_cjs = require('./chunk-ATW6UNT5.cjs');
|
|
6
|
+
var bignumber_js = require('bignumber.js');
|
|
7
7
|
var stargate = require('@cosmjs/stargate');
|
|
8
8
|
var math = require('@cosmjs/math');
|
|
9
9
|
|
|
@@ -35,7 +35,7 @@ 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 chunkT3FJZY62_cjs.getSigningStargateClient({
|
|
39
39
|
chainId,
|
|
40
40
|
getOfflineSigner
|
|
41
41
|
});
|
|
@@ -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(bignumber_js.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 bignumber_js.BigNumber(parseFloat(balance?.amount ?? "")).shiftedBy(-decimal).toFixed(decimal);
|
|
152
|
+
const feeAmount = new bignumber_js.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
|