@skip-go/client 1.1.1 → 1.1.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.
|
@@ -7,6 +7,7 @@ import { messages } from './chunk-7FSLD7Y4.js';
|
|
|
7
7
|
import { submitTransaction } from './chunk-7P6AOFMX.js';
|
|
8
8
|
import { trackTransaction } from './chunk-BCN2WD5Q.js';
|
|
9
9
|
import { transactionStatus } from './chunk-2NYWLY5S.js';
|
|
10
|
+
import { venues } from './chunk-RL5AVCSG.js';
|
|
10
11
|
import { ClientState, balances } from './chunk-EAUM5JYS.js';
|
|
11
12
|
import { ApiState, wait, createRequestClient, toCamel } from './chunk-SOGMQT4H.js';
|
|
12
13
|
import { PublicKey, Transaction, Connection, LAMPORTS_PER_SOL } from '@solana/web3.js';
|
|
@@ -47,7 +48,7 @@ var getRestEndpointForChain = async (chainId) => {
|
|
|
47
48
|
}
|
|
48
49
|
if (chain.apis?.rest?.length === 0 || !chain.apis?.rest) {
|
|
49
50
|
throw new Error(
|
|
50
|
-
`
|
|
51
|
+
`getRestEndpointForChain error: failed to find REST endpoint for chain '${chainId}'`
|
|
51
52
|
);
|
|
52
53
|
}
|
|
53
54
|
const endpoints = chain.apis?.rest?.map((api) => api.address);
|
|
@@ -894,9 +895,9 @@ var executeEvmTransaction = async (message, options) => {
|
|
|
894
895
|
throw new Error(gas?.error);
|
|
895
896
|
}
|
|
896
897
|
const { evmTx } = message;
|
|
897
|
-
const getEvmSigner = options.getEvmSigner
|
|
898
|
+
const getEvmSigner = options.getEvmSigner;
|
|
898
899
|
if (!getEvmSigner) {
|
|
899
|
-
throw new Error("
|
|
900
|
+
throw new Error("executeEVMTransaction error: getEvmSigner is not provided");
|
|
900
901
|
}
|
|
901
902
|
if (!evmTx?.chainId) {
|
|
902
903
|
throw new Error("chain id not found in evmTx");
|
|
@@ -908,7 +909,7 @@ var executeEvmTransaction = async (message, options) => {
|
|
|
908
909
|
if (!evmTx.chainId) {
|
|
909
910
|
throw new Error("executeEVMTransaction error: chainId not found for evmTx");
|
|
910
911
|
}
|
|
911
|
-
if (!evmTx.value) {
|
|
912
|
+
if (!evmTx.value && evmTx.value !== "") {
|
|
912
913
|
throw new Error("executeEVMTransaction error: no value found in evmTx");
|
|
913
914
|
}
|
|
914
915
|
const { onApproveAllowance, onTransactionSigned, bypassApprovalCheck, useUnlimitedApproval } = options;
|
|
@@ -983,10 +984,10 @@ var executeSvmTransaction = async (tx, options) => {
|
|
|
983
984
|
throw new Error(gas?.error);
|
|
984
985
|
}
|
|
985
986
|
const svmTx = tx?.svmTx;
|
|
986
|
-
const getSvmSigner = options?.getSvmSigner
|
|
987
|
+
const getSvmSigner = options?.getSvmSigner;
|
|
987
988
|
if (!getSvmSigner) {
|
|
988
989
|
throw new Error(
|
|
989
|
-
"
|
|
990
|
+
"executeSvmTransaction error: getSvmSigner is not provided"
|
|
990
991
|
);
|
|
991
992
|
}
|
|
992
993
|
const signer = await getSvmSigner();
|
|
@@ -1608,7 +1609,11 @@ var executeTransactions = async (options) => {
|
|
|
1608
1609
|
onTransactionBroadcast,
|
|
1609
1610
|
onTransactionCompleted,
|
|
1610
1611
|
simulate = true,
|
|
1611
|
-
batchSimulate = true
|
|
1612
|
+
batchSimulate = true,
|
|
1613
|
+
getFallbackGasAmount = getDefaultFallbackGasAmount,
|
|
1614
|
+
getCosmosSigner,
|
|
1615
|
+
getEvmSigner,
|
|
1616
|
+
onValidateGasBalance
|
|
1612
1617
|
} = options;
|
|
1613
1618
|
if (txs === void 0) {
|
|
1614
1619
|
throw new Error("executeTransactions error: txs is undefined in executeTransactions");
|
|
@@ -1640,20 +1645,20 @@ var executeTransactions = async (options) => {
|
|
|
1640
1645
|
const validateChainIds = !batchSimulate ? chainIds.map((x) => x?.chainId ?? "") : isGasStationSourceEVM ? GAS_STATION_CHAIN_IDS : [];
|
|
1641
1646
|
await validateGasBalances({
|
|
1642
1647
|
txs,
|
|
1643
|
-
getFallbackGasAmount
|
|
1644
|
-
getCosmosSigner
|
|
1645
|
-
getEvmSigner
|
|
1646
|
-
onValidateGasBalance
|
|
1648
|
+
getFallbackGasAmount,
|
|
1649
|
+
getCosmosSigner,
|
|
1650
|
+
getEvmSigner,
|
|
1651
|
+
onValidateGasBalance,
|
|
1647
1652
|
simulate,
|
|
1648
1653
|
disabledChainIds: validateChainIds
|
|
1649
1654
|
});
|
|
1650
1655
|
const validateEnabledChainIds = async (chainId) => {
|
|
1651
1656
|
await validateGasBalances({
|
|
1652
1657
|
txs,
|
|
1653
|
-
getFallbackGasAmount
|
|
1654
|
-
getCosmosSigner
|
|
1655
|
-
getEvmSigner
|
|
1656
|
-
onValidateGasBalance
|
|
1658
|
+
getFallbackGasAmount,
|
|
1659
|
+
getCosmosSigner,
|
|
1660
|
+
getEvmSigner,
|
|
1661
|
+
onValidateGasBalance,
|
|
1657
1662
|
simulate,
|
|
1658
1663
|
enabledChainIds: !batchSimulate ? [chainId] : validateChainIds
|
|
1659
1664
|
});
|
|
@@ -1696,6 +1701,27 @@ var executeTransactions = async (options) => {
|
|
|
1696
1701
|
});
|
|
1697
1702
|
}
|
|
1698
1703
|
};
|
|
1704
|
+
var EVM_GAS_AMOUNT = 15e4;
|
|
1705
|
+
var COSMOS_GAS_AMOUNT = {
|
|
1706
|
+
DEFAULT: 3e5,
|
|
1707
|
+
SWAP: 28e5,
|
|
1708
|
+
CARBON: 1e6
|
|
1709
|
+
};
|
|
1710
|
+
var getDefaultFallbackGasAmount = async (chainId, chainType) => {
|
|
1711
|
+
if (chainType === "evm" /* Evm */) {
|
|
1712
|
+
return EVM_GAS_AMOUNT;
|
|
1713
|
+
}
|
|
1714
|
+
if (chainType !== "cosmos" /* Cosmos */) return void 0;
|
|
1715
|
+
const venuesResult = await venues();
|
|
1716
|
+
const isSwapChain = venuesResult?.some((venue) => venue.chainId === chainId) ?? false;
|
|
1717
|
+
const defaultGasAmount = Math.ceil(
|
|
1718
|
+
isSwapChain ? COSMOS_GAS_AMOUNT.SWAP : COSMOS_GAS_AMOUNT.DEFAULT
|
|
1719
|
+
);
|
|
1720
|
+
if (chainId === "carbon-1") {
|
|
1721
|
+
return COSMOS_GAS_AMOUNT.CARBON;
|
|
1722
|
+
}
|
|
1723
|
+
return defaultGasAmount;
|
|
1724
|
+
};
|
|
1699
1725
|
var executeRoute = async (options) => {
|
|
1700
1726
|
const { route, userAddresses, beforeMsg, afterMsg, timeoutSeconds } = options;
|
|
1701
1727
|
let addressList = [];
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { executeRoute } from '../chunk-
|
|
1
|
+
export { executeRoute } from '../chunk-XS6ZMEDX.js';
|
|
2
2
|
import '../chunk-VQ5SIQWU.js';
|
|
3
3
|
import '../chunk-SWYON2RG.js';
|
|
4
4
|
import '../chunk-UPL6CT4S.js';
|
|
@@ -8,5 +8,6 @@ import '../chunk-7FSLD7Y4.js';
|
|
|
8
8
|
import '../chunk-7P6AOFMX.js';
|
|
9
9
|
import '../chunk-BCN2WD5Q.js';
|
|
10
10
|
import '../chunk-2NYWLY5S.js';
|
|
11
|
+
import '../chunk-RL5AVCSG.js';
|
|
11
12
|
import '../chunk-EAUM5JYS.js';
|
|
12
13
|
import '../chunk-SOGMQT4H.js';
|