@skip-go/client 0.9.3 → 0.10.0
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/README.md +8 -3
- package/dist/index.d.ts +18 -5
- package/dist/index.js +82 -24
- package/dist/{shared-DxdVuIaC.d.ts → shared-BXdO_XhQ.d.ts} +2 -2
- package/dist/transactions.d.ts +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
[](https://www.npmjs.com/package/@skip-go/client)
|
|
3
3
|
[](https://github.com/skip-mev/skip-go)
|
|
4
4
|
|
|
5
|
-
#
|
|
5
|
+
# `@skip-go/client`
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
TypeScript library that streamlines interaction with the Skip Go API, enabling cross-chain swaps and transfers across multiple ecosystems.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -12,9 +12,13 @@ JavaScript SDK for Skip Go API
|
|
|
12
12
|
npm install @skip-go/client
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
```bash
|
|
16
|
+
yarn add @skip-go/client
|
|
17
|
+
```
|
|
18
|
+
|
|
15
19
|
## Usage
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
Follow the [Getting Started](https://docs.skip.build/go/client/getting-started) guide to begin your integration.
|
|
18
22
|
|
|
19
23
|
## Development
|
|
20
24
|
|
|
@@ -36,6 +40,7 @@ npm -w @skip-go/client run watch
|
|
|
36
40
|
npm run build
|
|
37
41
|
```
|
|
38
42
|
|
|
43
|
+
|
|
39
44
|
## Unit Tests
|
|
40
45
|
|
|
41
46
|
```bash
|
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ import { AminoConverters, GasPrice, StdFee, SignerData, AminoTypes, SigningStarg
|
|
|
7
7
|
import { TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
|
|
8
8
|
import { TxStatusResponse, Chain, SubmitTxResponse, TrackTxResponse, FeeAsset } from './types.js';
|
|
9
9
|
export { AcknowledgementError, AxelarTransferInfo, AxelarTransferInfoJSON, AxelarTransferState, AxelarTransferTransactions, AxelarTransferTransactionsJSON, AxelarTransferType, CCTPTransferInfo, CCTPTransferInfoJSON, CCTPTransferState, CCTPTransferTransactions, CCTPTransferTransactionsJSON, ChainJSON, ChainTransaction, ChainTransactionJSON, ContractCallWithTokenError, ContractCallWithTokenErrorType, ContractCallWithTokenTransactions, ContractCallWithTokenTransactionsJSON, FeeAssetJSON, GasPriceInfo, HyperlaneTransferInfo, HyperlaneTransferInfoJSON, HyperlaneTransferState, HyperlaneTransferTransactions, HyperlaneTransferTransactionsJSON, IbcCapabilities, IbcCapabilitiesJSON, ModuleSupport, ModuleVersionInfo, NextBlockingTransfer, NextBlockingTransferJSON, OPInitTransferInfo, OPInitTransferInfoJSON, OPInitTransferState, OPInitTransferTransactions, OPInitTransferTransactionsJSON, Packet, PacketError, PacketErrorJSON, PacketErrorType, PacketJSON, SendTokenError, SendTokenErrorType, SendTokenTransactions, SendTokenTransactionsJSON, StatusError, StatusErrorJSON, StatusErrorType, StatusRequest, StatusRequestJSON, StatusState, SubmitTxRequest, SubmitTxRequestJSON, SubmitTxResponseJSON, TrackTxRequest, TrackTxRequestJSON, TrackTxResponseJSON, TransactionExecutionError, TransferAssetRelease, TransferAssetReleaseJSON, TransferEvent, TransferEventJSON, TransferInfo, TransferInfoJSON, TransferState, TransferStatus, TransferStatusJSON, TxStatusResponseJSON, Venue, affiliateFromJSON, affiliateToJSON, assetBetweenChainsFromJSON, assetBetweenChainsToJSON, assetFromJSON, assetOrErrorFromJSON, assetOrErrorToJSON, assetRecommendationFromJSON, assetRecommendationRequestFromJSON, assetRecommendationRequestToJSON, assetRecommendationToJSON, assetToJSON, assetsBetweenChainsRequestFromJSON, assetsBetweenChainsRequestToJSON, assetsBetweenChainsResponseFromJSON, assetsFromSourceRequestFromJSON, assetsFromSourceRequestToJSON, assetsRequestFromJSON, assetsRequestToJSON, axelarTransferFromJSON, axelarTransferInfoFromJSON, axelarTransferInfoToJSON, axelarTransferToJSON, axelarTransferTransactionsFromJSON, axelarTransferTransactionsToJSON, balanceRequestChainEntryFromJSON, balanceRequestChainEntryToJSON, balanceRequestFromJSON, balanceRequestToJSON, balanceResponseChainEntryFromJSON, balanceResponseChainEntryToJSON, balanceResponseDenomEntryFromJSON, balanceResponseDenomEntryToJSON, balanceResponseFromJSON, balanceResponseToJSON, bankSendFromJSON, bankSendToJSON, bridgeFromJSON, bridgeToJSON, bridgesResponseFromJSON, bridgesResponseToJSON, cctpTransferFromJSON, cctpTransferInfoFromJSON, cctpTransferInfoToJSON, cctpTransferToJSON, cctpTransferTransactionsFromJSON, cctpTransferTransactionsToJSON, chainAffiliatesFromJSON, chainAffiliatesToJSON, chainFromJSON, chainIDsToAffiliatesMapFromJSON, chainIDsToAffiliatesMapToJSON, chainToJSON, chainTransactionFromJSON, chainTransactionToJSON, contractCallWithTokenTransactionsFromJSON, contractCallWithTokenTransactionsToJSON, cosmWasmContractMsgFromJSON, cosmWasmContractMsgToJSON, cosmosMsgFromJSON, cosmosMsgToJSON, cosmosTxFromJSON, cosmosTxToJSON, denomWithChainIDFromJSON, denomWithChainIDToJSON, erc20ApprovalFromJSON, erc20ApprovalToJSON, estimatedFeeFromJSON, estimatedFeeToJSON, evmSwapFromJSON, evmSwapToJSON, evmTxFromJSON, evmTxToJSON, feeAssetFromJSON, feeAssetToJSON, hyperlaneTransferFromJSON, hyperlaneTransferInfoFromJSON, hyperlaneTransferInfoToJSON, hyperlaneTransferToJSON, hyperlaneTransferTransactionsFromJSON, hyperlaneTransferTransactionsToJSON, ibcAddressFromJSON, ibcAddressToJSON, ibcCapabilitiesFromJSON, ibcCapabilitiesToJSON, messageResponseFromJSON, msgFromJSON, msgToJSON, msgsDirectRequestFromJSON, msgsDirectRequestToJSON, msgsRequestFromJSON, msgsRequestToJSON, multiChainMsgFromJSON, multiChainMsgToJSON, nextBlockingTransferFromJSON, nextBlockingTransferToJSON, opInitTransferFromJSON, opInitTransferInfoFromJSON, opInitTransferInfoToJSON, opInitTransferToJSON, opInitTransferTransactionsFromJSON, opInitTransferTransactionsToJSON, operationFromJSON, operationToJSON, originAssetsRequestFromJSON, originAssetsRequestToJSON, originAssetsResponseFromJSON, originAssetsResponseToJSON, packetFromJSON, packetToJSON, postHandlerFromJSON, postHandlerToJSON, recommendAssetsRequestFromJSON, recommendAssetsRequestToJSON, recommendAssetsResponseFromJSON, recommendAssetsResponseToJSON, recommendationEntryFromJSON, recommendationEntryToJSON, routeRequestFromJSON, routeRequestToJSON, routeResponseFromJSON, routeResponseToJSON, sendTokenTransactionsFromJSON, sendTokenTransactionsToJSON, smartRelayFeeQuoteFromJSON, smartRelayFeeQuoteToJSON, smartSwapExactCoinInFromJSON, smartSwapExactCoinInToJSON, smartSwapOptionsFromJSON, smartSwapOptionsToJSON, submitTxRequestFromJSON, submitTxRequestToJSON, submitTxResponseFromJSON, submitTxResponseToJSON, svmTxFromJSON, svmTxToJSON, swapExactCoinInFromJSON, swapExactCoinInToJSON, swapExactCoinOutFromJSON, swapExactCoinOutToJSON, swapFromJSON, swapOperationFromJSON, swapOperationToJSON, swapRouteFromJSON, swapRouteToJSON, swapToJSON, swapVenueFromJSON, swapVenueRequestFromJSON, swapVenueRequestToJSON, swapVenueToJSON, trackTxRequestFromJSON, trackTxRequestToJSON, trackTxResponseFromJSON, trackTxResponseToJSON, transferAssetReleaseFromJSON, transferAssetReleaseToJSON, transferEventFromJSON, transferEventToJSON, transferFromJSON, transferInfoFromJSON, transferInfoToJSON, transferStatusFromJSON, transferStatusToJSON, transferToJSON, txFromJSON, txStatusRequestFromJSON, txStatusRequestToJSON, txStatusResponseFromJSON, txStatusResponseToJSON, txToJSON } from './types.js';
|
|
10
|
-
import { a as ChainAffiliates, R as RouteResponse, M as MultiChainMsg, C as CosmosMsg, A as AssetsRequest, b as Asset, c as AssetsFromSourceRequest, d as AssetsBetweenChainsRequest, e as AssetBetweenChains, B as Bridge, f as BalanceRequest, g as BalanceResponse, T as Tx, E as EvmTx, S as SvmTx, h as MsgsRequest, i as MsgsResponse, j as RouteRequest, k as MsgsDirectRequest, l as MsgsDirectResponse, m as AssetRecommendationRequest, n as RecommendationEntry, D as DenomWithChainID, o as AssetOrError, p as SwapVenue } from './shared-
|
|
11
|
-
export { aa as Affiliate, a9 as AffiliateJSON, ao as ApiError, b4 as AssetBetweenChainsJSON, r as AssetJSON, ap as AssetOrErrorJSON, ay as AssetRecommendation, az as AssetRecommendationJSON, aA as AssetRecommendationRequestJSON, b5 as AssetsBetweenChainsRequestJSON, b7 as AssetsBetweenChainsResponse, b6 as AssetsBetweenChainsResponseJSON, ax as AssetsFromSourceRequestJSON, aw as AssetsRequestJSON, af as AutopilotAction, ag as AutopilotMsg, v as AxelarTransfer, u as AxelarTransferJSON, b9 as BalanceRequestChainEntry, b8 as BalanceRequestChainEntryJSON, ba as BalanceRequestJSON, be as BalanceResponseChainEntry, bd as BalanceResponseChainEntryJSON, bc as BalanceResponseDenomEntry, bb as BalanceResponseDenomEntryJSON, bf as BalanceResponseJSON, x as BankSend, w as BankSendJSON, bi as BridgeJSON, b3 as BridgeType, bh as BridgesResponse, bg as BridgesResponseJSON, J as CCTPTransfer, H as CCTPTransferJSON, ab as ChainAffiliatesJSON, ae as CosmWasmContractMsg, ad as CosmWasmContractMsgJSON, z as CosmosMsgJSON, G as CosmosTx, F as CosmosTxJSON, an as DenomWithChainIDJSON, ak as ERC20Approval, aj as ERC20ApprovalJSON, aU as EstimatedFee, aV as EstimatedFeeJSON, a8 as EvmSwap, a7 as EvmSwapJSON, am as EvmTxJSON, aQ as ExperimentalFeature, aT as FeeType, L as HyperlaneTransfer, K as HyperlaneTransferJSON, q as IBCAddress, I as IBCAddressJSON, b0 as Msg, a$ as MsgJSON, a_ as MsgsDirectRequestJSON, aK as MsgsDirectResponseJSON, aZ as MsgsRequestJSON, b2 as MsgsResponseJSON, aS as MsgsWarning, aP as MsgsWarningType, y as MultiChainMsgJSON, N as OPInitTransfer, O as OPInitTransferJSON, aX as Operation, aW as OperationJSON, ar as OriginAssetsRequest, aq as OriginAssetsRequestJSON, at as OriginAssetsResponse, as as OriginAssetsResponseJSON, ai as PostHandler, ah as PostHandlerJSON, ac as Reason, aC as RecommendAssetsRequest, aB as RecommendAssetsRequestJSON, aE as RecommendAssetsResponse, aD as RecommendAssetsResponseJSON, aF as RecommendationEntryJSON, aL as RouteRequestBase, aG as RouteRequestBaseJSON, aM as RouteRequestGivenIn, aH as RouteRequestGivenInJSON, aN as RouteRequestGivenOut, aI as RouteRequestGivenOutJSON, aJ as RouteRequestJSON, aY as RouteResponseJSON, aR as RouteWarning, aO as RouteWarningType, Q as SmartRelayFeeQuote, P as SmartRelayFeeQuoteJSON, a4 as SmartSwapExactCoinIn, a3 as SmartSwapExactCoinInJSON, av as SmartSwapOptions, au as SmartSwapOptionsJSON, al as SvmTxJSON, a6 as Swap, a0 as SwapExactCoinIn, $ as SwapExactCoinInJSON, _ as SwapExactCoinOut, Z as SwapExactCoinOutJSON, a5 as SwapJSON, Y as SwapOperation, X as SwapOperationJSON, a2 as SwapRoute, a1 as SwapRouteJSON, U as SwapVenueJSON, W as SwapVenueRequest, V as SwapVenueRequestJSON, t as Transfer, s as TransferJSON, b1 as TxJSON } from './shared-
|
|
10
|
+
import { a as ChainAffiliates, R as RouteResponse, M as MultiChainMsg, C as CosmosMsg, A as AssetsRequest, b as Asset, c as AssetsFromSourceRequest, d as AssetsBetweenChainsRequest, e as AssetBetweenChains, B as Bridge, f as BalanceRequest, g as BalanceResponse, T as Tx, E as EvmTx, S as SvmTx, h as MsgsRequest, i as MsgsResponse, j as RouteRequest, k as MsgsDirectRequest, l as MsgsDirectResponse, m as AssetRecommendationRequest, n as RecommendationEntry, D as DenomWithChainID, o as AssetOrError, p as SwapVenue } from './shared-BXdO_XhQ.js';
|
|
11
|
+
export { aa as Affiliate, a9 as AffiliateJSON, ao as ApiError, b4 as AssetBetweenChainsJSON, r as AssetJSON, ap as AssetOrErrorJSON, ay as AssetRecommendation, az as AssetRecommendationJSON, aA as AssetRecommendationRequestJSON, b5 as AssetsBetweenChainsRequestJSON, b7 as AssetsBetweenChainsResponse, b6 as AssetsBetweenChainsResponseJSON, ax as AssetsFromSourceRequestJSON, aw as AssetsRequestJSON, af as AutopilotAction, ag as AutopilotMsg, v as AxelarTransfer, u as AxelarTransferJSON, b9 as BalanceRequestChainEntry, b8 as BalanceRequestChainEntryJSON, ba as BalanceRequestJSON, be as BalanceResponseChainEntry, bd as BalanceResponseChainEntryJSON, bc as BalanceResponseDenomEntry, bb as BalanceResponseDenomEntryJSON, bf as BalanceResponseJSON, x as BankSend, w as BankSendJSON, bi as BridgeJSON, b3 as BridgeType, bh as BridgesResponse, bg as BridgesResponseJSON, J as CCTPTransfer, H as CCTPTransferJSON, ab as ChainAffiliatesJSON, ae as CosmWasmContractMsg, ad as CosmWasmContractMsgJSON, z as CosmosMsgJSON, G as CosmosTx, F as CosmosTxJSON, an as DenomWithChainIDJSON, ak as ERC20Approval, aj as ERC20ApprovalJSON, aU as EstimatedFee, aV as EstimatedFeeJSON, a8 as EvmSwap, a7 as EvmSwapJSON, am as EvmTxJSON, aQ as ExperimentalFeature, aT as FeeType, L as HyperlaneTransfer, K as HyperlaneTransferJSON, q as IBCAddress, I as IBCAddressJSON, b0 as Msg, a$ as MsgJSON, a_ as MsgsDirectRequestJSON, aK as MsgsDirectResponseJSON, aZ as MsgsRequestJSON, b2 as MsgsResponseJSON, aS as MsgsWarning, aP as MsgsWarningType, y as MultiChainMsgJSON, N as OPInitTransfer, O as OPInitTransferJSON, aX as Operation, aW as OperationJSON, ar as OriginAssetsRequest, aq as OriginAssetsRequestJSON, at as OriginAssetsResponse, as as OriginAssetsResponseJSON, ai as PostHandler, ah as PostHandlerJSON, ac as Reason, aC as RecommendAssetsRequest, aB as RecommendAssetsRequestJSON, aE as RecommendAssetsResponse, aD as RecommendAssetsResponseJSON, aF as RecommendationEntryJSON, aL as RouteRequestBase, aG as RouteRequestBaseJSON, aM as RouteRequestGivenIn, aH as RouteRequestGivenInJSON, aN as RouteRequestGivenOut, aI as RouteRequestGivenOutJSON, aJ as RouteRequestJSON, aY as RouteResponseJSON, aR as RouteWarning, aO as RouteWarningType, Q as SmartRelayFeeQuote, P as SmartRelayFeeQuoteJSON, a4 as SmartSwapExactCoinIn, a3 as SmartSwapExactCoinInJSON, av as SmartSwapOptions, au as SmartSwapOptionsJSON, al as SvmTxJSON, a6 as Swap, a0 as SwapExactCoinIn, $ as SwapExactCoinInJSON, _ as SwapExactCoinOut, Z as SwapExactCoinOutJSON, a5 as SwapJSON, Y as SwapOperation, X as SwapOperationJSON, a2 as SwapRoute, a1 as SwapRouteJSON, U as SwapVenueJSON, W as SwapVenueRequest, V as SwapVenueRequestJSON, t as Transfer, s as TransferJSON, b1 as TxJSON } from './shared-BXdO_XhQ.js';
|
|
12
12
|
import { Adapter } from '@solana/wallet-adapter-base';
|
|
13
13
|
export { DEFAULT_GAS_MULTIPLIER, getCosmosGasAmountForMessage, getEncodeObjectFromCosmosMessage, getEncodeObjectFromCosmosMessageInjective } from './transactions.js';
|
|
14
14
|
import '@injectivelabs/sdk-ts/dist/cjs/core/modules/msgs';
|
|
@@ -55,6 +55,10 @@ type ExecuteRouteOptions = {
|
|
|
55
55
|
getEVMSigner?: (chainID: string) => Promise<WalletClient>;
|
|
56
56
|
getCosmosSigner?: (chainID: string) => Promise<OfflineSigner>;
|
|
57
57
|
getSVMSigner?: () => Promise<Adapter>;
|
|
58
|
+
onTransactionSigned?: (txInfo: {
|
|
59
|
+
txHash: string;
|
|
60
|
+
chainID: string;
|
|
61
|
+
}) => Promise<void>;
|
|
58
62
|
onTransactionBroadcast?: (txInfo: {
|
|
59
63
|
txHash: string;
|
|
60
64
|
chainID: string;
|
|
@@ -65,6 +69,11 @@ type ExecuteRouteOptions = {
|
|
|
65
69
|
explorerLink: string;
|
|
66
70
|
}) => Promise<void>;
|
|
67
71
|
onTransactionCompleted?: (chainID: string, txHash: string, status: TxStatusResponse) => Promise<void>;
|
|
72
|
+
onValidateGasBalance?: (value: {
|
|
73
|
+
chainID?: string;
|
|
74
|
+
txIndex?: number;
|
|
75
|
+
status: "success" | "error" | "pending" | "completed";
|
|
76
|
+
}) => Promise<void>;
|
|
68
77
|
validateGasBalance?: boolean;
|
|
69
78
|
slippageTolerancePercent?: string;
|
|
70
79
|
/**
|
|
@@ -98,6 +107,7 @@ type ExecuteCosmosMessage = {
|
|
|
98
107
|
messages: CosmosMsg[];
|
|
99
108
|
gasAmountMultiplier?: number;
|
|
100
109
|
gasTokenUsed?: Coin;
|
|
110
|
+
onTransactionSigned?: ExecuteRouteOptions['onTransactionSigned'];
|
|
101
111
|
};
|
|
102
112
|
type SignCosmosMessageDirectOptions = {
|
|
103
113
|
signerAddress: string;
|
|
@@ -163,13 +173,15 @@ declare class SkipClient {
|
|
|
163
173
|
encodedMsgs?: EncodeObject[];
|
|
164
174
|
getFallbackGasAmount?: GetFallbackGasAmount;
|
|
165
175
|
}): Promise<StdFee>;
|
|
166
|
-
executeEVMTransaction({ message, signer, }: {
|
|
176
|
+
executeEVMTransaction({ message, signer, onTransactionSigned, }: {
|
|
167
177
|
message: EvmTx;
|
|
168
178
|
signer: WalletClient;
|
|
179
|
+
onTransactionSigned?: ExecuteRouteOptions['onTransactionSigned'];
|
|
169
180
|
}): Promise<viem.TransactionReceipt>;
|
|
170
|
-
executeSVMTransaction({ signer, message, }: {
|
|
181
|
+
executeSVMTransaction({ signer, message, onTransactionSigned, }: {
|
|
171
182
|
signer: Adapter;
|
|
172
183
|
message: SvmTx;
|
|
184
|
+
onTransactionSigned?: ExecuteRouteOptions['onTransactionSigned'];
|
|
173
185
|
}): Promise<string>;
|
|
174
186
|
signCosmosMessageDirect(options: SignCosmosMessageDirectOptions): Promise<TxRaw>;
|
|
175
187
|
private signCosmosMessageDirectEvmos;
|
|
@@ -289,13 +301,14 @@ declare class SkipClient {
|
|
|
289
301
|
getFeeInfoForChain(chainID: string): Promise<FeeAsset | undefined>;
|
|
290
302
|
private getDefaultGasTokenForChain;
|
|
291
303
|
private getStakingTokensForChain;
|
|
292
|
-
validateGasBalances({ txs, userAddresses, getOfflineSigner, getGasPrice, gasAmountMultiplier, getFallbackGasAmount, }: {
|
|
304
|
+
validateGasBalances({ txs, userAddresses, getOfflineSigner, getGasPrice, gasAmountMultiplier, getFallbackGasAmount, onValidateGasBalance }: {
|
|
293
305
|
txs: Tx[];
|
|
294
306
|
userAddresses: UserAddress[];
|
|
295
307
|
getOfflineSigner?: (chainID: string) => Promise<OfflineSigner>;
|
|
296
308
|
getGasPrice?: GetGasPrice;
|
|
297
309
|
gasAmountMultiplier?: number;
|
|
298
310
|
getFallbackGasAmount?: GetFallbackGasAmount;
|
|
311
|
+
onValidateGasBalance?: ExecuteRouteOptions['onValidateGasBalance'];
|
|
299
312
|
}): Promise<Record<number, Coin>>;
|
|
300
313
|
validateCosmosGasBalance({ chainID, client, signerAddress, messages, getGasPrice, gasAmountMultiplier, getFallbackGasAmount, }: {
|
|
301
314
|
client: SigningStargateClient;
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ var coreProtoTs = require('@injectivelabs/core-proto-ts');
|
|
|
27
27
|
var tx$2 = require('@injectivelabs/sdk-ts/dist/cjs/core/modules/tx/utils/tx');
|
|
28
28
|
var keccak256 = require('keccak256');
|
|
29
29
|
var web3_js = require('@solana/web3.js');
|
|
30
|
+
var crypto = require('@cosmjs/crypto');
|
|
30
31
|
|
|
31
32
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
32
33
|
|
|
@@ -3163,7 +3164,8 @@ var SkipClient = class {
|
|
|
3163
3164
|
getOfflineSigner: options.getCosmosSigner,
|
|
3164
3165
|
getGasPrice,
|
|
3165
3166
|
gasAmountMultiplier,
|
|
3166
|
-
getFallbackGasAmount
|
|
3167
|
+
getFallbackGasAmount,
|
|
3168
|
+
onValidateGasBalance: options.onValidateGasBalance
|
|
3167
3169
|
});
|
|
3168
3170
|
}
|
|
3169
3171
|
for (let i = 0; i < txs.length; i++) {
|
|
@@ -3221,7 +3223,8 @@ var SkipClient = class {
|
|
|
3221
3223
|
gasAmountMultiplier,
|
|
3222
3224
|
signerAddress: currentUserAddress,
|
|
3223
3225
|
getFallbackGasAmount,
|
|
3224
|
-
gasTokenUsed
|
|
3226
|
+
gasTokenUsed,
|
|
3227
|
+
onTransactionSigned: options.onTransactionSigned
|
|
3225
3228
|
});
|
|
3226
3229
|
txResult = {
|
|
3227
3230
|
chainID: cosmosTx.chainID,
|
|
@@ -3244,7 +3247,8 @@ var SkipClient = class {
|
|
|
3244
3247
|
const svmSigner = yield getSVMSigner();
|
|
3245
3248
|
const txReceipt = yield this.executeSVMTransaction({
|
|
3246
3249
|
signer: svmSigner,
|
|
3247
|
-
message: svmTx
|
|
3250
|
+
message: svmTx,
|
|
3251
|
+
onTransactionSigned: options.onTransactionSigned
|
|
3248
3252
|
});
|
|
3249
3253
|
txResult = {
|
|
3250
3254
|
chainID: svmTx.chainID,
|
|
@@ -3279,7 +3283,8 @@ var SkipClient = class {
|
|
|
3279
3283
|
const evmSigner = yield getEVMSigner(evmTx.chainID);
|
|
3280
3284
|
return yield this.executeEVMTransaction({
|
|
3281
3285
|
message: evmTx,
|
|
3282
|
-
signer: evmSigner
|
|
3286
|
+
signer: evmSigner,
|
|
3287
|
+
onTransactionSigned: options.onTransactionSigned
|
|
3283
3288
|
});
|
|
3284
3289
|
});
|
|
3285
3290
|
}
|
|
@@ -3293,7 +3298,8 @@ var SkipClient = class {
|
|
|
3293
3298
|
getGasPrice,
|
|
3294
3299
|
gasAmountMultiplier,
|
|
3295
3300
|
getFallbackGasAmount,
|
|
3296
|
-
gasTokenUsed
|
|
3301
|
+
gasTokenUsed,
|
|
3302
|
+
onTransactionSigned
|
|
3297
3303
|
} = options;
|
|
3298
3304
|
const getOfflineSigner = this.getCosmosSigner || getCosmosSigner || raise(
|
|
3299
3305
|
"executeRoute error: 'getCosmosSigner' is not provided or configured in skip router"
|
|
@@ -3369,6 +3375,11 @@ var SkipClient = class {
|
|
|
3369
3375
|
});
|
|
3370
3376
|
}
|
|
3371
3377
|
const txBytes = tx$1.TxRaw.encode(rawTx).finish();
|
|
3378
|
+
const txHash = encoding.toHex(crypto.sha256(txBytes));
|
|
3379
|
+
onTransactionSigned == null ? void 0 : onTransactionSigned({
|
|
3380
|
+
chainID,
|
|
3381
|
+
txHash
|
|
3382
|
+
});
|
|
3372
3383
|
const tx = yield stargateClient.broadcastTx(txBytes);
|
|
3373
3384
|
return tx;
|
|
3374
3385
|
});
|
|
@@ -3385,6 +3396,16 @@ var SkipClient = class {
|
|
|
3385
3396
|
getFallbackGasAmount
|
|
3386
3397
|
}) {
|
|
3387
3398
|
var _a;
|
|
3399
|
+
const gasPrice = (getGasPrice ? yield getGasPrice(chainID, "cosmos") : yield this.getRecommendedGasPrice(chainID)) || raise(
|
|
3400
|
+
`executeRoute error: unable to get gas prices for chain '${chainID}'`
|
|
3401
|
+
);
|
|
3402
|
+
if (chainID === "noble-1") {
|
|
3403
|
+
const fee2 = stargate.calculateFee(
|
|
3404
|
+
2e5,
|
|
3405
|
+
gasPrice
|
|
3406
|
+
);
|
|
3407
|
+
return fee2;
|
|
3408
|
+
}
|
|
3388
3409
|
const estimatedGasAmount = yield (() => chunk6FNC3XMI_js.__async(this, null, function* () {
|
|
3389
3410
|
try {
|
|
3390
3411
|
const estimatedGas = yield chunkTUX4SN3U_js.getCosmosGasAmountForMessage(
|
|
@@ -3409,14 +3430,9 @@ var SkipClient = class {
|
|
|
3409
3430
|
}
|
|
3410
3431
|
return String(fallbackGasAmount);
|
|
3411
3432
|
}
|
|
3412
|
-
|
|
3413
|
-
`executeRoute error: unable to estimate gas for message(s) ${messages || encodedMsgs}`
|
|
3414
|
-
);
|
|
3433
|
+
throw error;
|
|
3415
3434
|
}
|
|
3416
3435
|
}))();
|
|
3417
|
-
const gasPrice = (getGasPrice ? yield getGasPrice(chainID, "cosmos") : yield this.getRecommendedGasPrice(chainID)) || raise(
|
|
3418
|
-
`executeRoute error: unable to get gas prices for chain '${chainID}'`
|
|
3419
|
-
);
|
|
3420
3436
|
const fee = stargate.calculateFee(
|
|
3421
3437
|
Math.ceil(parseFloat(estimatedGasAmount)),
|
|
3422
3438
|
gasPrice
|
|
@@ -3458,7 +3474,8 @@ var SkipClient = class {
|
|
|
3458
3474
|
executeEVMTransaction(_0) {
|
|
3459
3475
|
return chunk6FNC3XMI_js.__async(this, arguments, function* ({
|
|
3460
3476
|
message,
|
|
3461
|
-
signer
|
|
3477
|
+
signer,
|
|
3478
|
+
onTransactionSigned
|
|
3462
3479
|
}) {
|
|
3463
3480
|
if (!signer.account) {
|
|
3464
3481
|
throw new Error(
|
|
@@ -3490,6 +3507,10 @@ var SkipClient = class {
|
|
|
3490
3507
|
],
|
|
3491
3508
|
chain: signer.chain
|
|
3492
3509
|
});
|
|
3510
|
+
onTransactionSigned == null ? void 0 : onTransactionSigned({
|
|
3511
|
+
chainID: message.chainID,
|
|
3512
|
+
txHash: txHash2
|
|
3513
|
+
});
|
|
3493
3514
|
const receipt2 = yield extendedSigner.waitForTransactionReceipt({
|
|
3494
3515
|
hash: txHash2
|
|
3495
3516
|
});
|
|
@@ -3515,7 +3536,8 @@ var SkipClient = class {
|
|
|
3515
3536
|
executeSVMTransaction(_0) {
|
|
3516
3537
|
return chunk6FNC3XMI_js.__async(this, arguments, function* ({
|
|
3517
3538
|
signer,
|
|
3518
|
-
message
|
|
3539
|
+
message,
|
|
3540
|
+
onTransactionSigned
|
|
3519
3541
|
}) {
|
|
3520
3542
|
var _a;
|
|
3521
3543
|
const _tx = Buffer.from(message.tx, "base64");
|
|
@@ -3529,6 +3551,12 @@ var SkipClient = class {
|
|
|
3529
3551
|
yield this.submitTransaction({
|
|
3530
3552
|
chainID: message.chainID,
|
|
3531
3553
|
tx: Buffer.from(serializedTx).toString("base64")
|
|
3554
|
+
}).then((res) => {
|
|
3555
|
+
onTransactionSigned == null ? void 0 : onTransactionSigned({
|
|
3556
|
+
chainID: message.chainID,
|
|
3557
|
+
txHash: res.txHash
|
|
3558
|
+
});
|
|
3559
|
+
signature = res.txHash;
|
|
3532
3560
|
});
|
|
3533
3561
|
const sig = yield connection.sendRawTransaction(serializedTx, {
|
|
3534
3562
|
preflightCommitment: "confirmed",
|
|
@@ -3547,6 +3575,7 @@ var SkipClient = class {
|
|
|
3547
3575
|
searchTransactionHistory: true
|
|
3548
3576
|
});
|
|
3549
3577
|
if (((_a = result == null ? void 0 : result.value) == null ? void 0 : _a.confirmationStatus) === "confirmed") {
|
|
3578
|
+
console.log("sol2 sig", signature);
|
|
3550
3579
|
return signature;
|
|
3551
3580
|
} else if (getStatusCount > 12) {
|
|
3552
3581
|
yield wait(3e3);
|
|
@@ -4287,7 +4316,8 @@ var SkipClient = class {
|
|
|
4287
4316
|
getOfflineSigner,
|
|
4288
4317
|
getGasPrice,
|
|
4289
4318
|
gasAmountMultiplier,
|
|
4290
|
-
getFallbackGasAmount
|
|
4319
|
+
getFallbackGasAmount,
|
|
4320
|
+
onValidateGasBalance
|
|
4291
4321
|
}) {
|
|
4292
4322
|
var _a;
|
|
4293
4323
|
let gasTokenRecord = {};
|
|
@@ -4297,6 +4327,11 @@ var SkipClient = class {
|
|
|
4297
4327
|
raise(`validateGasBalances error: invalid tx at index ${i}`);
|
|
4298
4328
|
}
|
|
4299
4329
|
if ("cosmosTx" in tx) {
|
|
4330
|
+
onValidateGasBalance == null ? void 0 : onValidateGasBalance({
|
|
4331
|
+
chainID: tx.cosmosTx.chainID,
|
|
4332
|
+
txIndex: i,
|
|
4333
|
+
status: "pending"
|
|
4334
|
+
});
|
|
4300
4335
|
const msgs = tx.cosmosTx.msgs;
|
|
4301
4336
|
if (!msgs) {
|
|
4302
4337
|
raise(`validateGasBalances error: invalid msgs ${msgs}`);
|
|
@@ -4323,18 +4358,38 @@ var SkipClient = class {
|
|
|
4323
4358
|
)) == null ? void 0 : _a.address) || raise(
|
|
4324
4359
|
`validateGasBalance error: invalid address for chain '${tx.cosmosTx.chainID}'`
|
|
4325
4360
|
);
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4361
|
+
try {
|
|
4362
|
+
const coinUsed = yield this.validateCosmosGasBalance({
|
|
4363
|
+
client,
|
|
4364
|
+
signerAddress: currentAddress,
|
|
4365
|
+
chainID: tx.cosmosTx.chainID,
|
|
4366
|
+
messages: msgs,
|
|
4367
|
+
getGasPrice,
|
|
4368
|
+
gasAmountMultiplier,
|
|
4369
|
+
getFallbackGasAmount
|
|
4370
|
+
});
|
|
4371
|
+
gasTokenRecord[i] = coinUsed;
|
|
4372
|
+
onValidateGasBalance == null ? void 0 : onValidateGasBalance({
|
|
4373
|
+
chainID: tx.cosmosTx.chainID,
|
|
4374
|
+
txIndex: i,
|
|
4375
|
+
status: "success"
|
|
4376
|
+
});
|
|
4377
|
+
} catch (e) {
|
|
4378
|
+
const error = e;
|
|
4379
|
+
onValidateGasBalance == null ? void 0 : onValidateGasBalance({
|
|
4380
|
+
chainID: tx.cosmosTx.chainID,
|
|
4381
|
+
txIndex: i,
|
|
4382
|
+
status: "error"
|
|
4383
|
+
});
|
|
4384
|
+
throw new Error(
|
|
4385
|
+
`validateGasBalances error: ${error.message}`
|
|
4386
|
+
);
|
|
4387
|
+
}
|
|
4336
4388
|
}
|
|
4337
4389
|
}
|
|
4390
|
+
onValidateGasBalance == null ? void 0 : onValidateGasBalance({
|
|
4391
|
+
status: "completed"
|
|
4392
|
+
});
|
|
4338
4393
|
return gasTokenRecord;
|
|
4339
4394
|
});
|
|
4340
4395
|
}
|
|
@@ -4363,6 +4418,9 @@ var SkipClient = class {
|
|
|
4363
4418
|
`validateCosmosGasBalance error: unable to get fee amount`
|
|
4364
4419
|
);
|
|
4365
4420
|
}
|
|
4421
|
+
if (chainID === "noble-1") {
|
|
4422
|
+
return fee.amount[0];
|
|
4423
|
+
}
|
|
4366
4424
|
const mainnetAssets = yield this.assets();
|
|
4367
4425
|
const testnetAssets = yield this.assets({ onlyTestnets: true });
|
|
4368
4426
|
const assets = chunk6FNC3XMI_js.__spreadValues(chunk6FNC3XMI_js.__spreadValues({}, mainnetAssets), testnetAssets);
|
|
@@ -469,11 +469,11 @@ type AssetsBetweenChainsResponse = {
|
|
|
469
469
|
};
|
|
470
470
|
type BalanceRequestChainEntryJSON = {
|
|
471
471
|
address: string;
|
|
472
|
-
denoms
|
|
472
|
+
denoms?: string[];
|
|
473
473
|
};
|
|
474
474
|
type BalanceRequestChainEntry = {
|
|
475
475
|
address: string;
|
|
476
|
-
denoms
|
|
476
|
+
denoms?: string[];
|
|
477
477
|
};
|
|
478
478
|
type BalanceRequestJSON = {
|
|
479
479
|
chains: {
|
package/dist/transactions.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EncodeObject } from '@cosmjs/proto-signing';
|
|
2
2
|
import { Msgs } from '@injectivelabs/sdk-ts/dist/cjs/core/modules/msgs';
|
|
3
|
-
import { C as CosmosMsg } from './shared-
|
|
3
|
+
import { C as CosmosMsg } from './shared-BXdO_XhQ.js';
|
|
4
4
|
import { SigningStargateClient } from '@cosmjs/stargate';
|
|
5
5
|
|
|
6
6
|
declare const DEFAULT_GAS_MULTIPLIER = 1.5;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a9 as AffiliateJSON, aa as Affiliate, r as AssetJSON, b as Asset, az as AssetRecommendationJSON, ay as AssetRecommendation, ax as AssetsFromSourceRequestJSON, c as AssetsFromSourceRequest, aw as AssetsRequestJSON, A as AssetsRequest, aB as RecommendAssetsRequestJSON, aC as RecommendAssetsRequest, aD as RecommendAssetsResponseJSON, aE as RecommendAssetsResponse, aF as RecommendationEntryJSON, n as RecommendationEntry, aV as EstimatedFeeJSON, aU as EstimatedFee, U as SwapVenueJSON, p as SwapVenue, V as SwapVenueRequestJSON, W as SwapVenueRequest, aJ as RouteRequestJSON, j as RouteRequest, s as TransferJSON, t as Transfer, X as SwapOperationJSON, Y as SwapOperation, a1 as SwapRouteJSON, a2 as SwapRoute, $ as SwapExactCoinInJSON, a0 as SwapExactCoinIn, a3 as SmartSwapExactCoinInJSON, a4 as SmartSwapExactCoinIn, Z as SwapExactCoinOutJSON, _ as SwapExactCoinOut, a5 as SwapJSON, a6 as Swap, a7 as EvmSwapJSON, a8 as EvmSwap, aW as OperationJSON, aX as Operation, aY as RouteResponseJSON, R as RouteResponse, ad as CosmWasmContractMsgJSON, ae as CosmWasmContractMsg, ah as PostHandlerJSON, ai as PostHandler, aZ as MsgsRequestJSON, h as MsgsRequest, y as MultiChainMsgJSON, M as MultiChainMsg, z as CosmosMsgJSON, C as CosmosMsg, I as IBCAddressJSON, q as IBCAddress, u as AxelarTransferJSON, v as AxelarTransfer, w as BankSendJSON, x as BankSend, P as SmartRelayFeeQuoteJSON, Q as SmartRelayFeeQuote, H as CCTPTransferJSON, J as CCTPTransfer, K as HyperlaneTransferJSON, L as HyperlaneTransfer, O as OPInitTransferJSON, N as OPInitTransfer, aj as ERC20ApprovalJSON, ak as ERC20Approval, al as SvmTxJSON, S as SvmTx, am as EvmTxJSON, E as EvmTx, F as CosmosTxJSON, G as CosmosTx, b1 as TxJSON, T as Tx, a$ as MsgJSON, b0 as Msg, b2 as MsgsResponseJSON, i as MsgsResponse, an as DenomWithChainIDJSON, D as DenomWithChainID, ap as AssetOrErrorJSON, o as AssetOrError, aq as OriginAssetsRequestJSON, ar as OriginAssetsRequest, as as OriginAssetsResponseJSON, at as OriginAssetsResponse, b4 as AssetBetweenChainsJSON, e as AssetBetweenChains, b5 as AssetsBetweenChainsRequestJSON, d as AssetsBetweenChainsRequest, b6 as AssetsBetweenChainsResponseJSON, b7 as AssetsBetweenChainsResponse, aA as AssetRecommendationRequestJSON, m as AssetRecommendationRequest, bg as BridgesResponseJSON, bh as BridgesResponse, bi as BridgeJSON, B as Bridge, a_ as MsgsDirectRequestJSON, k as MsgsDirectRequest, au as SmartSwapOptionsJSON, av as SmartSwapOptions, ab as ChainAffiliatesJSON, a as ChainAffiliates, b8 as BalanceRequestChainEntryJSON, b9 as BalanceRequestChainEntry, ba as BalanceRequestJSON, f as BalanceRequest, bb as BalanceResponseDenomEntryJSON, bc as BalanceResponseDenomEntry, bd as BalanceResponseChainEntryJSON, be as BalanceResponseChainEntry, bf as BalanceResponseJSON, g as BalanceResponse } from './shared-
|
|
2
|
-
export { ao as ApiError, af as AutopilotAction, ag as AutopilotMsg, b3 as BridgeType, aQ as ExperimentalFeature, aT as FeeType, l as MsgsDirectResponse, aK as MsgsDirectResponseJSON, aS as MsgsWarning, aP as MsgsWarningType, ac as Reason, aL as RouteRequestBase, aG as RouteRequestBaseJSON, aM as RouteRequestGivenIn, aH as RouteRequestGivenInJSON, aN as RouteRequestGivenOut, aI as RouteRequestGivenOutJSON, aR as RouteWarning, aO as RouteWarningType } from './shared-
|
|
1
|
+
import { a9 as AffiliateJSON, aa as Affiliate, r as AssetJSON, b as Asset, az as AssetRecommendationJSON, ay as AssetRecommendation, ax as AssetsFromSourceRequestJSON, c as AssetsFromSourceRequest, aw as AssetsRequestJSON, A as AssetsRequest, aB as RecommendAssetsRequestJSON, aC as RecommendAssetsRequest, aD as RecommendAssetsResponseJSON, aE as RecommendAssetsResponse, aF as RecommendationEntryJSON, n as RecommendationEntry, aV as EstimatedFeeJSON, aU as EstimatedFee, U as SwapVenueJSON, p as SwapVenue, V as SwapVenueRequestJSON, W as SwapVenueRequest, aJ as RouteRequestJSON, j as RouteRequest, s as TransferJSON, t as Transfer, X as SwapOperationJSON, Y as SwapOperation, a1 as SwapRouteJSON, a2 as SwapRoute, $ as SwapExactCoinInJSON, a0 as SwapExactCoinIn, a3 as SmartSwapExactCoinInJSON, a4 as SmartSwapExactCoinIn, Z as SwapExactCoinOutJSON, _ as SwapExactCoinOut, a5 as SwapJSON, a6 as Swap, a7 as EvmSwapJSON, a8 as EvmSwap, aW as OperationJSON, aX as Operation, aY as RouteResponseJSON, R as RouteResponse, ad as CosmWasmContractMsgJSON, ae as CosmWasmContractMsg, ah as PostHandlerJSON, ai as PostHandler, aZ as MsgsRequestJSON, h as MsgsRequest, y as MultiChainMsgJSON, M as MultiChainMsg, z as CosmosMsgJSON, C as CosmosMsg, I as IBCAddressJSON, q as IBCAddress, u as AxelarTransferJSON, v as AxelarTransfer, w as BankSendJSON, x as BankSend, P as SmartRelayFeeQuoteJSON, Q as SmartRelayFeeQuote, H as CCTPTransferJSON, J as CCTPTransfer, K as HyperlaneTransferJSON, L as HyperlaneTransfer, O as OPInitTransferJSON, N as OPInitTransfer, aj as ERC20ApprovalJSON, ak as ERC20Approval, al as SvmTxJSON, S as SvmTx, am as EvmTxJSON, E as EvmTx, F as CosmosTxJSON, G as CosmosTx, b1 as TxJSON, T as Tx, a$ as MsgJSON, b0 as Msg, b2 as MsgsResponseJSON, i as MsgsResponse, an as DenomWithChainIDJSON, D as DenomWithChainID, ap as AssetOrErrorJSON, o as AssetOrError, aq as OriginAssetsRequestJSON, ar as OriginAssetsRequest, as as OriginAssetsResponseJSON, at as OriginAssetsResponse, b4 as AssetBetweenChainsJSON, e as AssetBetweenChains, b5 as AssetsBetweenChainsRequestJSON, d as AssetsBetweenChainsRequest, b6 as AssetsBetweenChainsResponseJSON, b7 as AssetsBetweenChainsResponse, aA as AssetRecommendationRequestJSON, m as AssetRecommendationRequest, bg as BridgesResponseJSON, bh as BridgesResponse, bi as BridgeJSON, B as Bridge, a_ as MsgsDirectRequestJSON, k as MsgsDirectRequest, au as SmartSwapOptionsJSON, av as SmartSwapOptions, ab as ChainAffiliatesJSON, a as ChainAffiliates, b8 as BalanceRequestChainEntryJSON, b9 as BalanceRequestChainEntry, ba as BalanceRequestJSON, f as BalanceRequest, bb as BalanceResponseDenomEntryJSON, bc as BalanceResponseDenomEntry, bd as BalanceResponseChainEntryJSON, be as BalanceResponseChainEntry, bf as BalanceResponseJSON, g as BalanceResponse } from './shared-BXdO_XhQ.js';
|
|
2
|
+
export { ao as ApiError, af as AutopilotAction, ag as AutopilotMsg, b3 as BridgeType, aQ as ExperimentalFeature, aT as FeeType, l as MsgsDirectResponse, aK as MsgsDirectResponseJSON, aS as MsgsWarning, aP as MsgsWarningType, ac as Reason, aL as RouteRequestBase, aG as RouteRequestBaseJSON, aM as RouteRequestGivenIn, aH as RouteRequestGivenInJSON, aN as RouteRequestGivenOut, aI as RouteRequestGivenOutJSON, aR as RouteWarning, aO as RouteWarningType } from './shared-BXdO_XhQ.js';
|
|
3
3
|
|
|
4
4
|
type SubmitTxRequestJSON = {
|
|
5
5
|
tx: string;
|
package/package.json
CHANGED