@skip-go/client 1.1.9 → 1.2.1
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/api/getAssets.d.ts +1 -1
- package/dist/api/getAssetsBetweenChains.d.ts +1 -1
- package/dist/api/getBridges.d.ts +1 -1
- package/dist/api/getChains.d.ts +1 -1
- package/dist/api/postAssetsFromSource.d.ts +1 -1
- package/dist/api/postBalances.d.ts +2 -2
- package/dist/api/postMessages.d.ts +3 -2
- package/dist/api/postMessagesDirect.d.ts +2 -1
- package/dist/api/postRecommendAssets.d.ts +1 -1
- package/dist/api/postRoute.d.ts +2 -2
- package/dist/api/postSubmit.d.ts +2 -2
- package/dist/api/postTrackTransaction.d.ts +6 -8
- package/dist/api/postTrackTransaction.js +1 -1
- package/dist/api/postTransactionStatus.d.ts +2 -2
- package/dist/{callbacks-BGRu2Ule.d.ts → callbacks-CPh0dr86.d.ts} +2 -2
- package/dist/{chunk-7G7IEOTQ.js → chunk-72PK3PKI.js} +2 -2
- package/dist/{chunk-SGHGLGUJ.js → chunk-COJAW7OW.js} +5 -3
- package/dist/chunk-CXFOPLGZ.js +20 -0
- package/dist/{chunk-NCE6R2CP.js → chunk-TTLOL6VT.js} +150 -53
- package/dist/{client-types-BkeR6R_z.d.ts → client-types-DRmsTfeT.d.ts} +1 -1
- package/dist/generateApi-D7KXciAd.d.ts +55 -0
- package/dist/index.d.ts +11 -7
- package/dist/index.js +4 -4
- package/dist/public-functions/executeRoute.d.ts +23 -4
- package/dist/public-functions/executeRoute.js +4 -4
- package/dist/public-functions/getCosmosGasAmountForMessage.d.ts +1 -1
- package/dist/public-functions/getEvmGasAmountForMessage.d.ts +2 -2
- package/dist/public-functions/getFeeInfoForChain.d.ts +1 -1
- package/dist/public-functions/getSigningStargateClient.js +1 -1
- package/dist/public-functions/setApiOptions.d.ts +1 -1
- package/dist/public-functions/setClientOptions.d.ts +3 -3
- package/dist/public-functions/waitForTransaction.d.ts +6 -6
- package/dist/public-functions/waitForTransaction.js +2 -2
- package/dist/{setClientOptions-D8SDeegt.d.ts → setClientOptions-CwcM5Ps9.d.ts} +1 -1
- package/dist/{swaggerTypes-CAERZYPb.d.ts → swaggerTypes-BpJPRbC3.d.ts} +6 -2
- package/package.json +1 -1
- package/dist/chunk-563FE62N.js +0 -11
- package/dist/generateApi-8YPJU-Al.d.ts +0 -22
package/dist/api/getAssets.d.ts
CHANGED
package/dist/api/getBridges.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as SkipApiOptions } from '../apiState-DwZhwVul.js';
|
|
2
|
-
import { bt as ContentType, J as BridgeType } from '../swaggerTypes-
|
|
2
|
+
import { bt as ContentType, J as BridgeType } from '../swaggerTypes-BpJPRbC3.js';
|
|
3
3
|
|
|
4
4
|
declare const bridges: (options?: ({
|
|
5
5
|
cache?: RequestCache | undefined;
|
package/dist/api/getChains.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as SkipApiOptions } from '../apiState-DwZhwVul.js';
|
|
2
|
-
import { A as ApiRequest, a as ApiResponse } from '../generateApi-
|
|
3
|
-
import '../swaggerTypes-
|
|
2
|
+
import { A as ApiRequest, a as ApiResponse } from '../generateApi-D7KXciAd.js';
|
|
3
|
+
import '../swaggerTypes-BpJPRbC3.js';
|
|
4
4
|
|
|
5
5
|
declare const balances: (options?: ({
|
|
6
6
|
chains?: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b3 as FeeType, J as BridgeType } from '../swaggerTypes-
|
|
1
|
+
import { b3 as FeeType, J as BridgeType } from '../swaggerTypes-BpJPRbC3.js';
|
|
2
2
|
import { S as SkipApiOptions } from '../apiState-DwZhwVul.js';
|
|
3
|
-
import { A as ApiRequest, a as ApiResponse } from '../generateApi-
|
|
3
|
+
import { A as ApiRequest, a as ApiResponse } from '../generateApi-D7KXciAd.js';
|
|
4
4
|
|
|
5
5
|
declare const messages: (request: MessagesRequest) => Promise<{
|
|
6
6
|
msgs?: ({
|
|
@@ -63,6 +63,7 @@ declare const messages: (request: MessagesRequest) => Promise<{
|
|
|
63
63
|
};
|
|
64
64
|
operationsIndices?: number[] | undefined;
|
|
65
65
|
})[] | undefined;
|
|
66
|
+
minAmountOut?: string | undefined;
|
|
66
67
|
estimatedFees?: {
|
|
67
68
|
feeType?: FeeType | undefined;
|
|
68
69
|
bridgeId?: BridgeType | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as SkipApiOptions } from '../apiState-DwZhwVul.js';
|
|
2
|
-
import { f as AutopilotAction, J as BridgeType, ap as RoutePriceWarningType, b3 as FeeType } from '../swaggerTypes-
|
|
2
|
+
import { f as AutopilotAction, J as BridgeType, ap as RoutePriceWarningType, b3 as FeeType } from '../swaggerTypes-BpJPRbC3.js';
|
|
3
3
|
|
|
4
4
|
declare const messagesDirect: (options?: ({
|
|
5
5
|
sourceAssetDenom?: string | undefined;
|
|
@@ -112,6 +112,7 @@ declare const messagesDirect: (options?: ({
|
|
|
112
112
|
};
|
|
113
113
|
operationsIndices?: number[] | undefined;
|
|
114
114
|
})[] | undefined;
|
|
115
|
+
minAmountOut?: string | undefined;
|
|
115
116
|
route?: {
|
|
116
117
|
amountIn: string;
|
|
117
118
|
amountOut: string;
|
package/dist/api/postRoute.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { J as BridgeType, ap as RoutePriceWarningType, b3 as FeeType } from '../swaggerTypes-
|
|
1
|
+
import { J as BridgeType, ap as RoutePriceWarningType, b3 as FeeType } from '../swaggerTypes-BpJPRbC3.js';
|
|
2
2
|
import { S as SkipApiOptions } from '../apiState-DwZhwVul.js';
|
|
3
|
-
import { A as ApiRequest } from '../generateApi-
|
|
3
|
+
import { A as ApiRequest } from '../generateApi-D7KXciAd.js';
|
|
4
4
|
|
|
5
5
|
declare const route: (request: RouteRequest) => Promise<{
|
|
6
6
|
amountIn: string;
|
package/dist/api/postSubmit.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as SkipApiOptions } from '../apiState-DwZhwVul.js';
|
|
2
|
-
import { A as ApiRequest, a as ApiResponse } from '../generateApi-
|
|
3
|
-
import '../swaggerTypes-
|
|
2
|
+
import { A as ApiRequest, a as ApiResponse } from '../generateApi-D7KXciAd.js';
|
|
3
|
+
import '../swaggerTypes-BpJPRbC3.js';
|
|
4
4
|
|
|
5
5
|
declare const submit: (options?: ({
|
|
6
6
|
tx?: string | undefined;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as ApiRequest, P as PollingProps } from '../generateApi-D7KXciAd.js';
|
|
2
|
+
import '../swaggerTypes-BpJPRbC3.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} & SkipApiOptions & {
|
|
7
|
-
abortDuplicateRequests?: boolean | undefined;
|
|
8
|
-
}) | undefined) => Promise<{
|
|
4
|
+
type TrackTxRequest = ApiRequest<"status"> & TrackTxPollingProps;
|
|
5
|
+
type TrackTxPollingProps = Omit<PollingProps<"status">, "isSuccess" | "onError" | "onSuccess">;
|
|
6
|
+
declare const trackTransaction: ({ maxRetries, retryInterval, backoffMultiplier, ...trackTxRequest }: TrackTxRequest) => Promise<{
|
|
9
7
|
txHash: string;
|
|
10
8
|
explorerLink: string;
|
|
11
9
|
}>;
|
|
12
10
|
|
|
13
|
-
export { trackTransaction };
|
|
11
|
+
export { type TrackTxPollingProps, type TrackTxRequest, trackTransaction };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { av as StatusErrorType, aJ as TransactionState, al as PacketErrorType, aS as TransferState, k as AxelarTransferState, O as ContractCallWithTokenErrorType, as as SendTokenErrorType, l as AxelarTransferType, p as CCTPTransferState, a8 as HyperlaneTransferState, aO as OPInitTransferState, s as StargateTransferState, w as GoFastTransferState, aP as LayerZeroTransferState } from '../swaggerTypes-
|
|
1
|
+
import { av as StatusErrorType, aJ as TransactionState, al as PacketErrorType, aS as TransferState, k as AxelarTransferState, O as ContractCallWithTokenErrorType, as as SendTokenErrorType, l as AxelarTransferType, p as CCTPTransferState, a8 as HyperlaneTransferState, aO as OPInitTransferState, s as StargateTransferState, w as GoFastTransferState, aP as LayerZeroTransferState } from '../swaggerTypes-BpJPRbC3.js';
|
|
2
2
|
import { S as SkipApiOptions } from '../apiState-DwZhwVul.js';
|
|
3
|
-
import { a as ApiResponse } from '../generateApi-
|
|
3
|
+
import { a as ApiResponse } from '../generateApi-D7KXciAd.js';
|
|
4
4
|
|
|
5
5
|
declare const transactionStatus: (params?: ({
|
|
6
6
|
txHash: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { aU as TransferStatus, T as Erc20Approval } from './swaggerTypes-
|
|
1
|
+
import { aU as TransferStatus, T as Erc20Approval } from './swaggerTypes-BpJPRbC3.js';
|
|
2
2
|
|
|
3
|
-
type CallbackStatus = "
|
|
3
|
+
type CallbackStatus = "error" | "pending" | "completed";
|
|
4
4
|
type TransactionCallbacks = {
|
|
5
5
|
onTransactionSigned?: (txInfo: {
|
|
6
6
|
chainId: string;
|
|
@@ -228,14 +228,14 @@ var getRpcEndpointForChain = async (chainId) => {
|
|
|
228
228
|
}
|
|
229
229
|
if (chain.apis?.rpc?.length === 0 || !chain.apis?.rpc) {
|
|
230
230
|
throw new Error(
|
|
231
|
-
`getRpcEndpointForChain error: failed to find RPC endpoint for chain '${chainId}'`
|
|
231
|
+
`getRpcEndpointForChain error: failed to find RPC endpoint for chain id '${chainId}'`
|
|
232
232
|
);
|
|
233
233
|
}
|
|
234
234
|
const endpoints = chain.apis?.rpc?.map((api) => api.address);
|
|
235
235
|
const endpoint = await findFirstWorkingEndpoint(endpoints, "rpc");
|
|
236
236
|
if (!endpoint) {
|
|
237
237
|
throw new Error(
|
|
238
|
-
`getRpcEndpointForChain error: failed to find RPC endpoint for chain '${chainId}'`
|
|
238
|
+
`getRpcEndpointForChain error: failed to find RPC endpoint for chain id '${chainId}'`
|
|
239
239
|
);
|
|
240
240
|
}
|
|
241
241
|
return endpoint;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { transactionStatus } from './chunk-XZV42PVV.js';
|
|
2
|
-
import { trackTransaction } from './chunk-
|
|
2
|
+
import { trackTransaction } from './chunk-CXFOPLGZ.js';
|
|
3
3
|
import { wait } from './chunk-YABXOO3H.js';
|
|
4
4
|
|
|
5
5
|
// src/public-functions/waitForTransaction.ts
|
|
6
6
|
var waitForTransaction = async ({
|
|
7
7
|
chainId,
|
|
8
8
|
txHash,
|
|
9
|
-
onTransactionTracked
|
|
9
|
+
onTransactionTracked,
|
|
10
|
+
...trackTxPollingOptions
|
|
10
11
|
}) => {
|
|
11
12
|
const { explorerLink } = await trackTransaction({
|
|
12
13
|
chainId,
|
|
13
|
-
txHash
|
|
14
|
+
txHash,
|
|
15
|
+
...trackTxPollingOptions
|
|
14
16
|
});
|
|
15
17
|
await onTransactionTracked?.({ txHash, chainId, explorerLink });
|
|
16
18
|
while (true) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { pollingApi } from './chunk-YABXOO3H.js';
|
|
2
|
+
|
|
3
|
+
// src/api/postTrackTransaction.ts
|
|
4
|
+
var trackTransaction = ({
|
|
5
|
+
maxRetries,
|
|
6
|
+
retryInterval,
|
|
7
|
+
backoffMultiplier = 2.5,
|
|
8
|
+
...trackTxRequest
|
|
9
|
+
}) => {
|
|
10
|
+
return pollingApi({
|
|
11
|
+
methodName: "track",
|
|
12
|
+
path: "v2/tx/track",
|
|
13
|
+
method: "post",
|
|
14
|
+
maxRetries,
|
|
15
|
+
retryInterval,
|
|
16
|
+
backoffMultiplier
|
|
17
|
+
})(trackTxRequest);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { trackTransaction };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { waitForTransaction } from './chunk-
|
|
1
|
+
import { waitForTransaction } from './chunk-COJAW7OW.js';
|
|
2
2
|
import { getEncodeObjectFromCosmosMessage, getCosmosGasAmountForMessage, getEncodeObjectFromCosmosMessageInjective } from './chunk-TV2XPAIF.js';
|
|
3
3
|
import { getEVMGasAmountForMessage } from './chunk-GV2QOWB4.js';
|
|
4
4
|
import { BigNumber } from './chunk-VQ5SIQWU.js';
|
|
5
5
|
import { GAS_STATION_CHAIN_IDS } from './chunk-SWYON2RG.js';
|
|
6
|
-
import { getSigningStargateClient, getRpcEndpointForChain, accountParser } from './chunk-
|
|
6
|
+
import { getSigningStargateClient, getRpcEndpointForChain, accountParser } from './chunk-72PK3PKI.js';
|
|
7
7
|
import { chains, findFirstWorkingEndpoint, getIsEthermint, getIsInitia } from './chunk-36MCR5DZ.js';
|
|
8
8
|
import { messages } from './chunk-A7FWC5OX.js';
|
|
9
9
|
import { submit } from './chunk-OFBEDG4X.js';
|
|
@@ -45,14 +45,14 @@ var getRestEndpointForChain = async (chainId) => {
|
|
|
45
45
|
}
|
|
46
46
|
if (chain.apis?.rest?.length === 0 || !chain.apis?.rest) {
|
|
47
47
|
throw new Error(
|
|
48
|
-
`getRestEndpointForChain error: failed to find REST endpoint for chain '${chainId}'`
|
|
48
|
+
`getRestEndpointForChain error: failed to find REST endpoint for chain id '${chainId}'`
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
const endpoints = chain.apis?.rest?.map((api) => api.address);
|
|
52
52
|
const endpoint = await findFirstWorkingEndpoint(endpoints, "rest");
|
|
53
53
|
if (!endpoint) {
|
|
54
54
|
throw new Error(
|
|
55
|
-
`getRestEndpointForChain error: failed to find REST endpoint for chain '${chainId}'`
|
|
55
|
+
`getRestEndpointForChain error: failed to find REST endpoint for chain id '${chainId}'`
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
return endpoint;
|
|
@@ -340,9 +340,7 @@ var signCosmosMessageAmino = async (options) => {
|
|
|
340
340
|
signatures: [fromBase64(signature.signature)]
|
|
341
341
|
});
|
|
342
342
|
};
|
|
343
|
-
|
|
344
|
-
// src/private-functions/cosmos/executeCosmosTransaction.ts
|
|
345
|
-
var executeCosmosTransaction = async ({
|
|
343
|
+
var signCosmosTransaction = async ({
|
|
346
344
|
tx,
|
|
347
345
|
options,
|
|
348
346
|
index
|
|
@@ -369,7 +367,7 @@ var executeCosmosTransaction = async ({
|
|
|
369
367
|
if (messages2 === void 0) {
|
|
370
368
|
throw new Error("no messages found for tx");
|
|
371
369
|
}
|
|
372
|
-
const {
|
|
370
|
+
const { signer } = await getSigningStargateClient({
|
|
373
371
|
chainId,
|
|
374
372
|
getOfflineSigner: options?.getCosmosSigner
|
|
375
373
|
});
|
|
@@ -416,6 +414,24 @@ var executeCosmosTransaction = async ({
|
|
|
416
414
|
});
|
|
417
415
|
const txBytes = TxRaw.encode(rawTx).finish();
|
|
418
416
|
const rawTxBase64 = Buffer.from(txBytes).toString("base64");
|
|
417
|
+
return rawTxBase64;
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
// src/private-functions/cosmos/executeCosmosTransaction.ts
|
|
421
|
+
var executeCosmosTransaction = async ({
|
|
422
|
+
tx,
|
|
423
|
+
options,
|
|
424
|
+
index
|
|
425
|
+
}) => {
|
|
426
|
+
if (tx === void 0) {
|
|
427
|
+
throw new Error("executeCosmosTransaction error: tx is undefined");
|
|
428
|
+
}
|
|
429
|
+
const rawTxBase64 = await signCosmosTransaction({
|
|
430
|
+
tx,
|
|
431
|
+
options,
|
|
432
|
+
index
|
|
433
|
+
});
|
|
434
|
+
const chainId = tx.cosmosTx?.chainId;
|
|
419
435
|
const txResponse = await submit({
|
|
420
436
|
chainId,
|
|
421
437
|
tx: rawTxBase64
|
|
@@ -713,12 +729,17 @@ var executeEvmTransaction = async (message, options) => {
|
|
|
713
729
|
});
|
|
714
730
|
return receipt;
|
|
715
731
|
};
|
|
716
|
-
var
|
|
732
|
+
var signSvmTransaction = async ({
|
|
733
|
+
tx,
|
|
734
|
+
options
|
|
735
|
+
}) => {
|
|
717
736
|
const gasArray = ClientState.validateGasResults;
|
|
718
737
|
if (tx === void 0) {
|
|
719
738
|
throw new Error("executeSvmTransaction error: tx is undefined");
|
|
720
739
|
}
|
|
721
|
-
const gas = gasArray?.find(
|
|
740
|
+
const gas = gasArray?.find(
|
|
741
|
+
(gas2) => gas2?.error !== null && gas2?.error !== void 0
|
|
742
|
+
);
|
|
722
743
|
if (typeof gas?.error === "string") {
|
|
723
744
|
throw new Error(gas?.error);
|
|
724
745
|
}
|
|
@@ -735,25 +756,37 @@ var executeSvmTransaction = async (tx, options) => {
|
|
|
735
756
|
}
|
|
736
757
|
const txBuffer = Buffer.from(svmTx.tx ?? "", "base64");
|
|
737
758
|
const transaction = Transaction.from(txBuffer);
|
|
759
|
+
if (!("signTransaction" in signer)) return;
|
|
760
|
+
const signedTx = await signer.signTransaction(transaction);
|
|
761
|
+
options?.onTransactionSigned?.({ chainId: svmTx.chainId });
|
|
762
|
+
const serializedTx = signedTx.serialize();
|
|
763
|
+
return serializedTx;
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
// src/private-functions/svm/executeSvmTransaction.ts
|
|
767
|
+
var executeSvmTransaction = async (tx, options) => {
|
|
768
|
+
const svmTx = tx?.svmTx;
|
|
769
|
+
if (!svmTx?.chainId) {
|
|
770
|
+
throw new Error("executeSvmTransaction error: chainId not found in svmTx");
|
|
771
|
+
}
|
|
772
|
+
const signedTx = await signSvmTransaction({ tx, options });
|
|
773
|
+
if (!signedTx) {
|
|
774
|
+
throw new Error("executeSvmTransaction error: signedTx is undefined");
|
|
775
|
+
}
|
|
738
776
|
const endpoint = await getRpcEndpointForChain(svmTx.chainId);
|
|
739
777
|
const connection = new Connection(endpoint);
|
|
740
778
|
let signature;
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
preflightCommitment: "confirmed",
|
|
753
|
-
maxRetries: 5
|
|
754
|
-
});
|
|
755
|
-
signature = rpcSig;
|
|
756
|
-
}
|
|
779
|
+
await submitTransaction({
|
|
780
|
+
chainId: svmTx.chainId,
|
|
781
|
+
tx: signedTx.toString("base64")
|
|
782
|
+
}).then((res) => {
|
|
783
|
+
signature = res?.txHash;
|
|
784
|
+
});
|
|
785
|
+
const rpcSig = await connection.sendRawTransaction(signedTx, {
|
|
786
|
+
preflightCommitment: "confirmed",
|
|
787
|
+
maxRetries: 5
|
|
788
|
+
});
|
|
789
|
+
signature = rpcSig;
|
|
757
790
|
if (!signature) {
|
|
758
791
|
throw new Error("executeSvmTransaction error: signature not found");
|
|
759
792
|
}
|
|
@@ -799,11 +832,11 @@ var validateCosmosGasBalance = async ({
|
|
|
799
832
|
const skipChains = await ClientState.getSkipChains();
|
|
800
833
|
const chain = skipChains?.find((c) => c.chainId === chainId);
|
|
801
834
|
if (!chain) {
|
|
802
|
-
throw new Error(`failed to find chain id
|
|
835
|
+
throw new Error(`failed to find chain id '${chainId}'`);
|
|
803
836
|
}
|
|
804
837
|
const { feeAssets } = chain;
|
|
805
838
|
if (!feeAssets) {
|
|
806
|
-
throw new Error(`failed to find fee assets for chain '${chainId}'`);
|
|
839
|
+
throw new Error(`failed to find fee assets for chain id '${chainId}'`);
|
|
807
840
|
}
|
|
808
841
|
const estimatedGasAmount = await (async () => {
|
|
809
842
|
try {
|
|
@@ -928,11 +961,11 @@ var validateCosmosGasBalance = async ({
|
|
|
928
961
|
if (!feeUsed) {
|
|
929
962
|
if (validatedAssets.length > 1) {
|
|
930
963
|
throw new Error(
|
|
931
|
-
validatedAssets[0]?.error || `Insufficient fee token to initiate transfer on ${
|
|
964
|
+
validatedAssets[0]?.error || `Insufficient fee token to initiate transfer on ${chain.prettyName}.`
|
|
932
965
|
);
|
|
933
966
|
}
|
|
934
967
|
throw new Error(
|
|
935
|
-
validatedAssets[0]?.error || `Insufficient fee token to initiate transfer on ${
|
|
968
|
+
validatedAssets[0]?.error || `Insufficient fee token to initiate transfer on ${chain.prettyName}.`
|
|
936
969
|
);
|
|
937
970
|
}
|
|
938
971
|
return feeUsed;
|
|
@@ -1178,15 +1211,15 @@ var validateGasBalances = async ({
|
|
|
1178
1211
|
enabledChainIds,
|
|
1179
1212
|
useUnlimitedApproval
|
|
1180
1213
|
}) => {
|
|
1181
|
-
onValidateGasBalance?.({
|
|
1182
|
-
status: "pending"
|
|
1183
|
-
});
|
|
1184
1214
|
const validateResult = await Promise.all(
|
|
1185
1215
|
txs.map(async (tx, i) => {
|
|
1186
1216
|
if (!tx) {
|
|
1187
1217
|
throw new Error(`invalid tx at index ${i}`);
|
|
1188
1218
|
}
|
|
1189
1219
|
if ("cosmosTx" in tx && !disabledChainIds?.includes(tx?.cosmosTx?.chainId ?? "") && (enabledChainIds === void 0 || enabledChainIds.includes(tx?.cosmosTx?.chainId ?? ""))) {
|
|
1220
|
+
onValidateGasBalance?.({
|
|
1221
|
+
status: "pending"
|
|
1222
|
+
});
|
|
1190
1223
|
if (!tx?.cosmosTx?.msgs) {
|
|
1191
1224
|
throw new Error(`invalid msgs ${tx?.cosmosTx?.msgs}`);
|
|
1192
1225
|
}
|
|
@@ -1211,9 +1244,14 @@ var validateGasBalances = async ({
|
|
|
1211
1244
|
}
|
|
1212
1245
|
}
|
|
1213
1246
|
if ("evmTx" in tx && !disabledChainIds?.includes(tx?.evmTx?.chainId ?? "") && (enabledChainIds === void 0 || enabledChainIds.includes(tx?.evmTx?.chainId ?? ""))) {
|
|
1247
|
+
onValidateGasBalance?.({
|
|
1248
|
+
status: "pending"
|
|
1249
|
+
});
|
|
1214
1250
|
const signer = await getEvmSigner?.(tx?.evmTx?.chainId ?? "");
|
|
1215
1251
|
if (!signer) {
|
|
1216
|
-
throw new Error(
|
|
1252
|
+
throw new Error(
|
|
1253
|
+
`failed to get signer for chain ${tx?.evmTx?.chainId}`
|
|
1254
|
+
);
|
|
1217
1255
|
}
|
|
1218
1256
|
try {
|
|
1219
1257
|
const res = await validateEvmGasBalance({
|
|
@@ -1233,6 +1271,9 @@ var validateGasBalances = async ({
|
|
|
1233
1271
|
}
|
|
1234
1272
|
}
|
|
1235
1273
|
if ("svmTx" in tx && !disabledChainIds?.includes(tx?.svmTx?.chainId ?? "") && (enabledChainIds === void 0 || enabledChainIds.includes(tx?.svmTx?.chainId ?? ""))) {
|
|
1274
|
+
onValidateGasBalance?.({
|
|
1275
|
+
status: "pending"
|
|
1276
|
+
});
|
|
1236
1277
|
try {
|
|
1237
1278
|
const res = await validateSvmGasBalance({
|
|
1238
1279
|
tx: tx.svmTx
|
|
@@ -1277,10 +1318,14 @@ var executeTransactions = async (options) => {
|
|
|
1277
1318
|
getFallbackGasAmount = getDefaultFallbackGasAmount,
|
|
1278
1319
|
getCosmosSigner,
|
|
1279
1320
|
getEvmSigner,
|
|
1280
|
-
onValidateGasBalance
|
|
1321
|
+
onValidateGasBalance,
|
|
1322
|
+
trackTxPollingOptions,
|
|
1323
|
+
batchSignTxs = true
|
|
1281
1324
|
} = options;
|
|
1282
1325
|
if (txs === void 0) {
|
|
1283
|
-
throw new Error(
|
|
1326
|
+
throw new Error(
|
|
1327
|
+
"executeTransactions error: txs is undefined in executeTransactions"
|
|
1328
|
+
);
|
|
1284
1329
|
}
|
|
1285
1330
|
const chainIds = txs.map((tx) => {
|
|
1286
1331
|
if ("cosmosTx" in tx) {
|
|
@@ -1327,35 +1372,84 @@ var executeTransactions = async (options) => {
|
|
|
1327
1372
|
enabledChainIds: !batchSimulate ? [chainId] : validateChainIds
|
|
1328
1373
|
});
|
|
1329
1374
|
};
|
|
1375
|
+
let signedTxs = [];
|
|
1376
|
+
if (batchSignTxs) {
|
|
1377
|
+
for (let i = 0; i < txs.length; i++) {
|
|
1378
|
+
const tx = txs[i];
|
|
1379
|
+
if (!tx) {
|
|
1380
|
+
throw new Error(`executeRoute error: invalid message at index ${i}`);
|
|
1381
|
+
}
|
|
1382
|
+
if ("cosmosTx" in tx) {
|
|
1383
|
+
await validateEnabledChainIds(tx.cosmosTx?.chainId ?? "");
|
|
1384
|
+
const signedTx = await signCosmosTransaction({
|
|
1385
|
+
tx,
|
|
1386
|
+
options,
|
|
1387
|
+
index: i
|
|
1388
|
+
});
|
|
1389
|
+
signedTxs.push({
|
|
1390
|
+
index: i,
|
|
1391
|
+
chainId: tx.cosmosTx?.chainId ?? "",
|
|
1392
|
+
tx: signedTx,
|
|
1393
|
+
chainType: "cosmos" /* Cosmos */
|
|
1394
|
+
});
|
|
1395
|
+
}
|
|
1396
|
+
if ("svmTx" in tx) {
|
|
1397
|
+
await validateEnabledChainIds(tx.svmTx?.chainId ?? "");
|
|
1398
|
+
const signedTx = await signSvmTransaction({ tx, options });
|
|
1399
|
+
if (!signedTx) {
|
|
1400
|
+
throw new Error(`executeRoute error: signedTx is undefined`);
|
|
1401
|
+
}
|
|
1402
|
+
signedTxs.push({
|
|
1403
|
+
index: i,
|
|
1404
|
+
chainId: tx.svmTx?.chainId ?? "",
|
|
1405
|
+
tx: signedTx.toString("base64"),
|
|
1406
|
+
chainType: "svm" /* Svm */
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1330
1411
|
for (let i = 0; i < txs.length; i++) {
|
|
1331
1412
|
const tx = txs[i];
|
|
1332
1413
|
if (!tx) {
|
|
1333
1414
|
throw new Error(`executeRoute error: invalid message at index ${i}`);
|
|
1334
1415
|
}
|
|
1335
1416
|
let txResult;
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
index: i
|
|
1417
|
+
const txSigned = signedTxs.find((item) => item.index === i);
|
|
1418
|
+
if (txSigned) {
|
|
1419
|
+
const txResponse = await submit({
|
|
1420
|
+
chainId: txSigned.chainId,
|
|
1421
|
+
tx: txSigned.tx
|
|
1342
1422
|
});
|
|
1343
|
-
} else if ("evmTx" in tx) {
|
|
1344
|
-
await validateEnabledChainIds(tx.evmTx?.chainId ?? "");
|
|
1345
|
-
const txResponse = await executeEvmTransaction(tx, options);
|
|
1346
1423
|
txResult = {
|
|
1347
|
-
chainId:
|
|
1348
|
-
txHash: txResponse
|
|
1424
|
+
chainId: txSigned.chainId,
|
|
1425
|
+
txHash: txResponse?.txHash ?? ""
|
|
1349
1426
|
};
|
|
1350
|
-
} else if ("svmTx" in tx) {
|
|
1351
|
-
await validateEnabledChainIds(tx.svmTx?.chainId ?? "");
|
|
1352
|
-
txResult = await executeSvmTransaction(tx, options);
|
|
1353
1427
|
} else {
|
|
1354
|
-
|
|
1428
|
+
if ("cosmosTx" in tx) {
|
|
1429
|
+
await validateEnabledChainIds(tx.cosmosTx?.chainId ?? "");
|
|
1430
|
+
txResult = await executeCosmosTransaction({
|
|
1431
|
+
tx,
|
|
1432
|
+
options,
|
|
1433
|
+
index: i
|
|
1434
|
+
});
|
|
1435
|
+
} else if ("evmTx" in tx) {
|
|
1436
|
+
await validateEnabledChainIds(tx.evmTx?.chainId ?? "");
|
|
1437
|
+
const txResponse = await executeEvmTransaction(tx, options);
|
|
1438
|
+
txResult = {
|
|
1439
|
+
chainId: tx?.evmTx?.chainId ?? "",
|
|
1440
|
+
txHash: txResponse.transactionHash
|
|
1441
|
+
};
|
|
1442
|
+
} else if ("svmTx" in tx) {
|
|
1443
|
+
await validateEnabledChainIds(tx.svmTx?.chainId ?? "");
|
|
1444
|
+
txResult = await executeSvmTransaction(tx, options);
|
|
1445
|
+
} else {
|
|
1446
|
+
throw new Error("executeRoute error: invalid message type");
|
|
1447
|
+
}
|
|
1355
1448
|
}
|
|
1356
1449
|
await onTransactionBroadcast?.({ ...txResult });
|
|
1357
1450
|
const txStatusResponse = await waitForTransaction({
|
|
1358
1451
|
...txResult,
|
|
1452
|
+
...trackTxPollingOptions,
|
|
1359
1453
|
onTransactionTracked: options.onTransactionTracked
|
|
1360
1454
|
});
|
|
1361
1455
|
await onTransactionCompleted?.({
|
|
@@ -1377,7 +1471,9 @@ var getDefaultFallbackGasAmount = async (chainId, chainType) => {
|
|
|
1377
1471
|
}
|
|
1378
1472
|
if (chainType !== "cosmos" /* Cosmos */) return void 0;
|
|
1379
1473
|
const venuesResult = await venues();
|
|
1380
|
-
const isSwapChain = venuesResult?.some(
|
|
1474
|
+
const isSwapChain = venuesResult?.some(
|
|
1475
|
+
(venue) => venue.chainId === chainId
|
|
1476
|
+
) ?? false;
|
|
1381
1477
|
const defaultGasAmount = Math.ceil(
|
|
1382
1478
|
isSwapChain ? COSMOS_GAS_AMOUNT.SWAP : COSMOS_GAS_AMOUNT.DEFAULT
|
|
1383
1479
|
);
|
|
@@ -1417,7 +1513,8 @@ var executeRoute = async (options) => {
|
|
|
1417
1513
|
operations: route?.operations,
|
|
1418
1514
|
addressList,
|
|
1419
1515
|
slippageTolerancePercent: options.slippageTolerancePercent || "1",
|
|
1420
|
-
chainIdsToAffiliates: ApiState.chainIdsToAffiliates
|
|
1516
|
+
chainIdsToAffiliates: ApiState.chainIdsToAffiliates,
|
|
1517
|
+
postRouteHandler: options.postRouteHandler
|
|
1421
1518
|
});
|
|
1422
1519
|
if (beforeMsg && (response?.txs?.length ?? 0) > 0) {
|
|
1423
1520
|
const firstTx = response?.txs?.[0];
|
|
@@ -3,7 +3,7 @@ import { OfflineDirectSigner } from '@cosmjs/proto-signing';
|
|
|
3
3
|
import { StdFee, GasPrice, SignerData } from '@cosmjs/stargate';
|
|
4
4
|
import { WalletClient } from 'viem';
|
|
5
5
|
import { Adapter } from '@solana/wallet-adapter-base';
|
|
6
|
-
import { a3 as FeeAsset, L as ChainType, W as CosmosMsg } from './swaggerTypes-
|
|
6
|
+
import { a3 as FeeAsset, L as ChainType, W as CosmosMsg } from './swaggerTypes-BpJPRbC3.js';
|
|
7
7
|
|
|
8
8
|
/** Common Types */
|
|
9
9
|
type UserAddress = {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { bv as Api } from './swaggerTypes-BpJPRbC3.js';
|
|
2
|
+
|
|
3
|
+
type CamelKey<S extends string> = S extends `${infer T}_${infer U}` ? `${T}${Capitalize<CamelKey<U>>}` : S;
|
|
4
|
+
type Camel<T> = T extends (infer U)[] ? Camel<U>[] : T extends object ? {
|
|
5
|
+
[K in keyof T as K extends string ? CamelKey<K> : never]: Camel<T[K]>;
|
|
6
|
+
} : T;
|
|
7
|
+
|
|
8
|
+
type ApiInstance = InstanceType<typeof Api>;
|
|
9
|
+
type FunctionKeys<T> = {
|
|
10
|
+
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
|
|
11
|
+
}[keyof T];
|
|
12
|
+
type ValidApiMethodKeys = {
|
|
13
|
+
[K in FunctionKeys<ApiInstance>]: Awaited<ReturnType<ApiInstance[K]>> extends {
|
|
14
|
+
data: unknown;
|
|
15
|
+
} ? K : never;
|
|
16
|
+
}[FunctionKeys<ApiInstance>];
|
|
17
|
+
type ApiRequest<K extends ValidApiMethodKeys> = NonNullable<Camel<Parameters<ApiInstance[K]>[0]>>;
|
|
18
|
+
type ApiResponse<K extends ValidApiMethodKeys> = Camel<Awaited<ReturnType<ApiInstance[K]>> extends {
|
|
19
|
+
data: infer D;
|
|
20
|
+
} ? D extends object ? D : never : never>;
|
|
21
|
+
type PollingProps<K extends ValidApiMethodKeys> = {
|
|
22
|
+
isSuccess?: (result: ApiResponse<K>) => boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Maximum number of retries
|
|
25
|
+
* @default 5
|
|
26
|
+
*/
|
|
27
|
+
maxRetries?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Retry interval in milliseconds
|
|
30
|
+
* @default 1000
|
|
31
|
+
*/
|
|
32
|
+
retryInterval?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Backoff multiplier for retries
|
|
35
|
+
*
|
|
36
|
+
* example: `retryInterval` is set to 1000, backoffMultiplier is set to 2
|
|
37
|
+
*
|
|
38
|
+
* 1st retry: 1000ms
|
|
39
|
+
*
|
|
40
|
+
* 2nd retry: 2000ms
|
|
41
|
+
*
|
|
42
|
+
* 3rd retry: 4000ms
|
|
43
|
+
*
|
|
44
|
+
* 4th retry: 8000ms
|
|
45
|
+
*
|
|
46
|
+
* 5th retry: 16000ms
|
|
47
|
+
*
|
|
48
|
+
* @default 2
|
|
49
|
+
*/
|
|
50
|
+
backoffMultiplier?: number;
|
|
51
|
+
onError?: (error: unknown, attempt: number) => void;
|
|
52
|
+
onSuccess?: (result: ApiResponse<K>, attempt: number) => void;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type { ApiRequest as A, PollingProps as P, ApiResponse as a };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { A as AcknowledgementErrorDetails, a as Affiliate, bv as Api, br as ApiConfig, b as ApiError, c as Asset, d as AssetBetweenChains, e as AssetRecommendation, bh as AssetRecommendationsResponse, bd as AssetsFromSourceResponse, bb as AssetsRequest, bc as AssetsResponse, f as AutopilotAction, g as AutopilotMsg, h as AutopilotMsgWrapper, i as AxelarTransfer, j as AxelarTransferInfo, k as AxelarTransferState, l as AxelarTransferType, m as AxelarTransferWrapper, B as BalanceRequestChainEntry, E as BalanceResponseChainEntry, D as BalanceResponseDenomEntry, b7 as BalancesResponse, F as BankSend, H as BankSendWrapper, I as Bridge, J as BridgeType, b8 as BridgesResponse, C as CCTPTransfer, n as CCTPTransferInfo, p as CCTPTransferState, o as CCTPTransferTxs, q as CCTPTransferWrapper, K as Chain, M as ChainAffiliates, am as ChainTransaction, L as ChainType, b5 as ChainsRequest, b6 as ChainsResponse, bt as ContentType, N as ContractCallWithTokenError, O as ContractCallWithTokenErrorType, P as ContractCallWithTokenTxs, Q as CosmWasmContractMsg, R as CosmWasmContractMsgWrapper, b1 as CosmosModuleSupport, W as CosmosMsg, X as CosmosTx, Y as CosmosTxWrapper, T as Erc20Approval, V as Error, U as ErrorDetail, aW as EurekaTransfer, aX as EurekaTransferInfo, aY as EurekaTransferWrapper, Z as EvmSwap, _ as EvmSwapWrapper, $ as EvmTx, a0 as EvmTxWrapper, b4 as Fee, a3 as FeeAsset, b3 as FeeType, bp as FullRequestParams, bm as FungibleAssetsBetweenChainsCreateResponse, a5 as GRPCStatusCode, a4 as GoFastFee, G as GoFastTransfer, y as GoFastTransferInfo, w as GoFastTransferState, x as GoFastTransferTxs, z as GoFastTransferWrapper, bu as HttpClient, bs as HttpResponse, a6 as HyperlaneTransfer, a7 as HyperlaneTransferInfo, a8 as HyperlaneTransferState, a9 as HyperlaneTransferTransactions, aa as HyperlaneTransferWrapper, ab as IBCTransferInfo, b2 as IbcCapabilities, bl as IbcOriginAssetsResponse, aZ as LayerZeroTransfer, a_ as LayerZeroTransferInfo, aP as LayerZeroTransferState, ai as LayerZeroTransferTransactions, a$ as LayerZeroTransferWrapper, ac as Msg, bg as MsgsDirectResponse, bf as MsgsResponse, ae as MultiChainMsg, af as MultiChainMsgWrapper, aK as OPInitTransfer, aM as OPInitTransferInfo, aO as OPInitTransferState, aN as OPInitTransferTxs, aL as OPInitTransferWrapper, ag as Operation, ah as OptionalAsset, aj as Packet, ak as PacketError, al as PacketErrorType, an as PostHandler, bn as QueryParamsType, ao as Reason, b0 as RecommendationRequest, bq as RequestParams, bo as ResponseFormat, aq as Route, ap as RoutePriceWarningType, be as RouteResponse, ar as SendTokenError, as as SendTokenErrorType, at as SendTokenTxs, S as SmartRelayFeeQuote, aD as SmartSwapExactCoinIn, aF as SmartSwapInWrapper, aE as SmartSwapOptions, r as StargateTransfer, u as StargateTransferInfo, s as StargateTransferState, t as StargateTransferTxs, v as StargateTransferWrapper, au as StatusError, av as StatusErrorType, bj as StatusRequest, bk as StatusResponse, a1 as SvmTx, a2 as SvmTxWrapper, aw as Swap, ax as SwapExactCoinIn, ay as SwapExactCoinOut, az as SwapInWrapper, aA as SwapOperation, aB as SwapOutWrapper, aC as SwapRoute, aG as SwapVenue, aH as SwapWrapper, bi as TrackResponse, aI as TransactionExecutionErrorDetails, aJ as TransactionState, aQ as Transfer, aT as TransferAssetRelease, aR as TransferEvent, aS as TransferState, aU as TransferStatus, aV as TransferWrapper, ad as Tx, b9 as VenuesRequest, ba as VenuesResponse } from './swaggerTypes-
|
|
2
|
-
export { T as TransactionCallbacks } from './callbacks-
|
|
3
|
-
export { E as EndpointOptions, b as GasOptions, G as GetFallbackGasAmount, a as GetGasPrice, e as SignCosmosMessageAminoOptions, d as SignCosmosMessageDirectOptions, c as SignCosmosMessageOptionsBase, S as SignerGetters, T as TxResult, U as UserAddress, V as ValidateGasResult } from './client-types-
|
|
1
|
+
export { A as AcknowledgementErrorDetails, a as Affiliate, bv as Api, br as ApiConfig, b as ApiError, c as Asset, d as AssetBetweenChains, e as AssetRecommendation, bh as AssetRecommendationsResponse, bd as AssetsFromSourceResponse, bb as AssetsRequest, bc as AssetsResponse, f as AutopilotAction, g as AutopilotMsg, h as AutopilotMsgWrapper, i as AxelarTransfer, j as AxelarTransferInfo, k as AxelarTransferState, l as AxelarTransferType, m as AxelarTransferWrapper, B as BalanceRequestChainEntry, E as BalanceResponseChainEntry, D as BalanceResponseDenomEntry, b7 as BalancesResponse, F as BankSend, H as BankSendWrapper, I as Bridge, J as BridgeType, b8 as BridgesResponse, C as CCTPTransfer, n as CCTPTransferInfo, p as CCTPTransferState, o as CCTPTransferTxs, q as CCTPTransferWrapper, K as Chain, M as ChainAffiliates, am as ChainTransaction, L as ChainType, b5 as ChainsRequest, b6 as ChainsResponse, bt as ContentType, N as ContractCallWithTokenError, O as ContractCallWithTokenErrorType, P as ContractCallWithTokenTxs, Q as CosmWasmContractMsg, R as CosmWasmContractMsgWrapper, b1 as CosmosModuleSupport, W as CosmosMsg, X as CosmosTx, Y as CosmosTxWrapper, T as Erc20Approval, V as Error, U as ErrorDetail, aW as EurekaTransfer, aX as EurekaTransferInfo, aY as EurekaTransferWrapper, Z as EvmSwap, _ as EvmSwapWrapper, $ as EvmTx, a0 as EvmTxWrapper, b4 as Fee, a3 as FeeAsset, b3 as FeeType, bp as FullRequestParams, bm as FungibleAssetsBetweenChainsCreateResponse, a5 as GRPCStatusCode, a4 as GoFastFee, G as GoFastTransfer, y as GoFastTransferInfo, w as GoFastTransferState, x as GoFastTransferTxs, z as GoFastTransferWrapper, bu as HttpClient, bs as HttpResponse, a6 as HyperlaneTransfer, a7 as HyperlaneTransferInfo, a8 as HyperlaneTransferState, a9 as HyperlaneTransferTransactions, aa as HyperlaneTransferWrapper, ab as IBCTransferInfo, b2 as IbcCapabilities, bl as IbcOriginAssetsResponse, aZ as LayerZeroTransfer, a_ as LayerZeroTransferInfo, aP as LayerZeroTransferState, ai as LayerZeroTransferTransactions, a$ as LayerZeroTransferWrapper, ac as Msg, bg as MsgsDirectResponse, bf as MsgsResponse, ae as MultiChainMsg, af as MultiChainMsgWrapper, aK as OPInitTransfer, aM as OPInitTransferInfo, aO as OPInitTransferState, aN as OPInitTransferTxs, aL as OPInitTransferWrapper, ag as Operation, ah as OptionalAsset, aj as Packet, ak as PacketError, al as PacketErrorType, an as PostHandler, bn as QueryParamsType, ao as Reason, b0 as RecommendationRequest, bq as RequestParams, bo as ResponseFormat, aq as Route, ap as RoutePriceWarningType, be as RouteResponse, ar as SendTokenError, as as SendTokenErrorType, at as SendTokenTxs, S as SmartRelayFeeQuote, aD as SmartSwapExactCoinIn, aF as SmartSwapInWrapper, aE as SmartSwapOptions, r as StargateTransfer, u as StargateTransferInfo, s as StargateTransferState, t as StargateTransferTxs, v as StargateTransferWrapper, au as StatusError, av as StatusErrorType, bj as StatusRequest, bk as StatusResponse, a1 as SvmTx, a2 as SvmTxWrapper, aw as Swap, ax as SwapExactCoinIn, ay as SwapExactCoinOut, az as SwapInWrapper, aA as SwapOperation, aB as SwapOutWrapper, aC as SwapRoute, aG as SwapVenue, aH as SwapWrapper, bi as TrackResponse, aI as TransactionExecutionErrorDetails, aJ as TransactionState, aQ as Transfer, aT as TransferAssetRelease, aR as TransferEvent, aS as TransferState, aU as TransferStatus, aV as TransferWrapper, ad as Tx, b9 as VenuesRequest, ba as VenuesResponse } from './swaggerTypes-BpJPRbC3.js';
|
|
2
|
+
export { T as TransactionCallbacks } from './callbacks-CPh0dr86.js';
|
|
3
|
+
export { E as EndpointOptions, b as GasOptions, G as GetFallbackGasAmount, a as GetGasPrice, e as SignCosmosMessageAminoOptions, d as SignCosmosMessageDirectOptions, c as SignCosmosMessageOptionsBase, S as SignerGetters, T as TxResult, U as UserAddress, V as ValidateGasResult } from './client-types-DRmsTfeT.js';
|
|
4
4
|
export { assets } from './api/getAssets.js';
|
|
5
5
|
export { assetsBetweenChains } from './api/getAssetsBetweenChains.js';
|
|
6
6
|
export { bridges } from './api/getBridges.js';
|
|
@@ -18,7 +18,7 @@ export { trackTransaction } from './api/postTrackTransaction.js';
|
|
|
18
18
|
export { TxStatusResponse, transactionStatus } from './api/postTransactionStatus.js';
|
|
19
19
|
export { ExecuteRouteOptions, executeRoute } from './public-functions/executeRoute.js';
|
|
20
20
|
export { getSigningStargateClient, getSigningStargateClientProps } from './public-functions/getSigningStargateClient.js';
|
|
21
|
-
export { S as SkipClientOptions, s as setClientOptions } from './setClientOptions-
|
|
21
|
+
export { S as SkipClientOptions, s as setClientOptions } from './setClientOptions-CwcM5Ps9.js';
|
|
22
22
|
export { getRecommendedGasPrice } from './public-functions/getRecommendedGasPrice.js';
|
|
23
23
|
export { getFeeInfoForChain } from './public-functions/getFeeInfoForChain.js';
|
|
24
24
|
export { SetApiOptionsProps, setApiOptions } from './public-functions/setApiOptions.js';
|
|
@@ -32,7 +32,7 @@ import '@cosmjs/stargate';
|
|
|
32
32
|
import 'viem';
|
|
33
33
|
import '@solana/wallet-adapter-base';
|
|
34
34
|
import './apiState-DwZhwVul.js';
|
|
35
|
-
import './generateApi-
|
|
35
|
+
import './generateApi-D7KXciAd.js';
|
|
36
36
|
|
|
37
37
|
interface AcknowledgementErrorDetailsJson {
|
|
38
38
|
/** Error code */
|
|
@@ -1090,7 +1090,7 @@ declare enum TransactionStateJson {
|
|
|
1090
1090
|
STATE_ABANDONED = "STATE_ABANDONED",
|
|
1091
1091
|
STATE_PENDING_ERROR = "STATE_PENDING_ERROR"
|
|
1092
1092
|
}
|
|
1093
|
-
/** A transfer facilitated by the
|
|
1093
|
+
/** A transfer facilitated by the OP Init bridge */
|
|
1094
1094
|
interface OPInitTransferJson {
|
|
1095
1095
|
/** Canonical chain-id of the source chain of the bridge transaction */
|
|
1096
1096
|
from_chain_id?: string;
|
|
@@ -1118,7 +1118,7 @@ interface OPInitTransferJson {
|
|
|
1118
1118
|
smart_relay?: boolean;
|
|
1119
1119
|
}
|
|
1120
1120
|
interface OPInitTransferWrapperJson {
|
|
1121
|
-
/** A transfer facilitated by the
|
|
1121
|
+
/** A transfer facilitated by the OP Init bridge */
|
|
1122
1122
|
op_init_transfer?: OPInitTransferJson;
|
|
1123
1123
|
}
|
|
1124
1124
|
interface OPInitTransferInfoJson {
|
|
@@ -1516,12 +1516,16 @@ type RouteResponseJson = RouteJson;
|
|
|
1516
1516
|
interface MsgsResponseJson {
|
|
1517
1517
|
msgs?: MsgJson[];
|
|
1518
1518
|
txs?: TxJson[];
|
|
1519
|
+
/** Minimum possible output after all operations, including fees and slippage */
|
|
1520
|
+
min_amount_out?: string;
|
|
1519
1521
|
/** Indicates fees incurred in the execution of the transfer */
|
|
1520
1522
|
estimated_fees?: FeeJson[];
|
|
1521
1523
|
}
|
|
1522
1524
|
interface MsgsDirectResponseJson {
|
|
1523
1525
|
msgs?: MsgJson[];
|
|
1524
1526
|
txs?: TxJson[];
|
|
1527
|
+
/** Minimum possible output after all operations, including fees and slippage */
|
|
1528
|
+
min_amount_out?: string;
|
|
1525
1529
|
route?: RouteJson;
|
|
1526
1530
|
}
|
|
1527
1531
|
interface AssetRecommendationsResponseJson {
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { setClientOptions } from './chunk-A4M35XLF.js';
|
|
2
|
-
export { executeRoute } from './chunk-
|
|
3
|
-
export { waitForTransaction } from './chunk-
|
|
2
|
+
export { executeRoute } from './chunk-TTLOL6VT.js';
|
|
3
|
+
export { waitForTransaction } from './chunk-COJAW7OW.js';
|
|
4
4
|
export { transactionStatus } from './chunk-XZV42PVV.js';
|
|
5
5
|
export { getCosmosGasAmountForMessage } from './chunk-TV2XPAIF.js';
|
|
6
6
|
import './chunk-TD63P2AG.js';
|
|
@@ -9,7 +9,7 @@ export { getRecommendedGasPrice } from './chunk-O4IHON37.js';
|
|
|
9
9
|
import './chunk-VQ5SIQWU.js';
|
|
10
10
|
export { getFeeInfoForChain } from './chunk-6SQTOOYP.js';
|
|
11
11
|
export { GAS_STATION_CHAIN_IDS } from './chunk-SWYON2RG.js';
|
|
12
|
-
export { getSigningStargateClient } from './chunk-
|
|
12
|
+
export { getSigningStargateClient } from './chunk-72PK3PKI.js';
|
|
13
13
|
import './chunk-36MCR5DZ.js';
|
|
14
14
|
export { setApiOptions } from './chunk-2YOWXBHH.js';
|
|
15
15
|
export { ibcOriginAssets } from './chunk-NQZYCFAA.js';
|
|
@@ -19,7 +19,7 @@ export { recommendAssets } from './chunk-THUBVEVZ.js';
|
|
|
19
19
|
export { route } from './chunk-U6NXCWXE.js';
|
|
20
20
|
export { submit } from './chunk-OFBEDG4X.js';
|
|
21
21
|
export { submitTransaction } from './chunk-DF3WCTFB.js';
|
|
22
|
-
export { trackTransaction } from './chunk-
|
|
22
|
+
export { trackTransaction } from './chunk-CXFOPLGZ.js';
|
|
23
23
|
export { assetsBetweenChains } from './chunk-Z3Z7A3YS.js';
|
|
24
24
|
export { bridges } from './chunk-UCUUIQHV.js';
|
|
25
25
|
export { venues } from './chunk-RE4YYQCE.js';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { T as TransactionCallbacks } from '../callbacks-
|
|
2
|
-
import { be as RouteResponse, W as CosmosMsg } from '../swaggerTypes-
|
|
3
|
-
import { A as ApiRequest } from '../generateApi-
|
|
4
|
-
import { S as SignerGetters, b as GasOptions, U as UserAddress } from '../client-types-
|
|
1
|
+
import { T as TransactionCallbacks } from '../callbacks-CPh0dr86.js';
|
|
2
|
+
import { be as RouteResponse, W as CosmosMsg, an as PostHandler } from '../swaggerTypes-BpJPRbC3.js';
|
|
3
|
+
import { A as ApiRequest } from '../generateApi-D7KXciAd.js';
|
|
4
|
+
import { S as SignerGetters, b as GasOptions, U as UserAddress } from '../client-types-DRmsTfeT.js';
|
|
5
|
+
import { TrackTxPollingProps } from '../api/postTrackTransaction.js';
|
|
5
6
|
import '@cosmjs/amino';
|
|
6
7
|
import '@cosmjs/proto-signing';
|
|
7
8
|
import '@cosmjs/stargate';
|
|
@@ -39,6 +40,24 @@ type ExecuteRouteOptions = SignerGetters & GasOptions & TransactionCallbacks & P
|
|
|
39
40
|
* If `batchSimulate` is set to `false`, it will simulate each message one by one.
|
|
40
41
|
*/
|
|
41
42
|
batchSimulate?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Optional configuration for transaction polling behavior.
|
|
45
|
+
* - `maxRetries`: Maximum number of polling attempts (default: 5)
|
|
46
|
+
* - `retryInterval`: Retry interval in milliseconds (default: 1000)
|
|
47
|
+
* - `backoffMultiplier`: Exponential backoff multiplier for increasing delay between retries (default: 2.5)
|
|
48
|
+
* Example backoff with retryInterval = 1000 and backoffMultiplier = 2:
|
|
49
|
+
* 1st retry: 1000ms → 2nd: 2000ms → 3rd: 4000ms → 4th: 8000ms ...
|
|
50
|
+
*/
|
|
51
|
+
trackTxPollingOptions?: TrackTxPollingProps;
|
|
52
|
+
/**
|
|
53
|
+
* If `batchSignTxs` is set to `true`, it will sign all transactions in a batch up front.
|
|
54
|
+
* If `batchSignTxs` is set to `false`, it will sign each transaction one by one.
|
|
55
|
+
*/
|
|
56
|
+
batchSignTxs?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Specify actions to perform after the route is completed
|
|
59
|
+
*/
|
|
60
|
+
postRouteHandler?: PostHandler;
|
|
42
61
|
};
|
|
43
62
|
declare const executeRoute: (options: ExecuteRouteOptions) => Promise<void>;
|
|
44
63
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export { executeRoute } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { executeRoute } from '../chunk-TTLOL6VT.js';
|
|
2
|
+
import '../chunk-COJAW7OW.js';
|
|
3
3
|
import '../chunk-XZV42PVV.js';
|
|
4
4
|
import '../chunk-TV2XPAIF.js';
|
|
5
5
|
import '../chunk-TD63P2AG.js';
|
|
6
6
|
import '../chunk-GV2QOWB4.js';
|
|
7
7
|
import '../chunk-VQ5SIQWU.js';
|
|
8
8
|
import '../chunk-SWYON2RG.js';
|
|
9
|
-
import '../chunk-
|
|
9
|
+
import '../chunk-72PK3PKI.js';
|
|
10
10
|
import '../chunk-36MCR5DZ.js';
|
|
11
11
|
import '../chunk-A7FWC5OX.js';
|
|
12
12
|
import '../chunk-OFBEDG4X.js';
|
|
13
13
|
import '../chunk-DF3WCTFB.js';
|
|
14
|
-
import '../chunk-
|
|
14
|
+
import '../chunk-CXFOPLGZ.js';
|
|
15
15
|
import '../chunk-RE4YYQCE.js';
|
|
16
16
|
import '../chunk-4XUWIG3Z.js';
|
|
17
17
|
import '../chunk-YABXOO3H.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EncodeObject } from '@cosmjs/proto-signing';
|
|
2
2
|
import { SigningStargateClient } from '@cosmjs/stargate';
|
|
3
|
-
import { W as CosmosMsg } from '../swaggerTypes-
|
|
3
|
+
import { W as CosmosMsg } from '../swaggerTypes-BpJPRbC3.js';
|
|
4
4
|
|
|
5
5
|
declare const DEFAULT_GAS_MULTIPLIER = 1.5;
|
|
6
6
|
declare function getCosmosGasAmountForMessage(client: SigningStargateClient, signerAddress: string, chainId: string, messages?: CosmosMsg[], encodedMsgs?: EncodeObject[], multiplier?: number): Promise<string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as GetFallbackGasAmount } from '../client-types-
|
|
2
|
-
import { $ as EvmTx } from '../swaggerTypes-
|
|
1
|
+
import { G as GetFallbackGasAmount } from '../client-types-DRmsTfeT.js';
|
|
2
|
+
import { $ as EvmTx } from '../swaggerTypes-BpJPRbC3.js';
|
|
3
3
|
import { WalletClient } from 'viem';
|
|
4
4
|
import '@cosmjs/amino';
|
|
5
5
|
import '@cosmjs/proto-signing';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as SkipApiOptions } from '../apiState-DwZhwVul.js';
|
|
2
|
-
import { M as ChainAffiliates } from '../swaggerTypes-
|
|
2
|
+
import { M as ChainAffiliates } from '../swaggerTypes-BpJPRbC3.js';
|
|
3
3
|
|
|
4
4
|
type SetApiOptionsProps = {
|
|
5
5
|
chainIdsToAffiliates?: Record<string, ChainAffiliates>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { s as setClientOptions } from '../setClientOptions-
|
|
1
|
+
export { s as setClientOptions } from '../setClientOptions-CwcM5Ps9.js';
|
|
2
2
|
import '@cosmjs/proto-signing';
|
|
3
3
|
import '@cosmjs/stargate';
|
|
4
4
|
import '../apiState-DwZhwVul.js';
|
|
5
|
-
import '../client-types-
|
|
5
|
+
import '../client-types-DRmsTfeT.js';
|
|
6
6
|
import '@cosmjs/amino';
|
|
7
7
|
import 'viem';
|
|
8
8
|
import '@solana/wallet-adapter-base';
|
|
9
|
-
import '../swaggerTypes-
|
|
9
|
+
import '../swaggerTypes-BpJPRbC3.js';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { av as StatusErrorType, aJ as TransactionState, al as PacketErrorType, aS as TransferState, k as AxelarTransferState, O as ContractCallWithTokenErrorType, as as SendTokenErrorType, l as AxelarTransferType, p as CCTPTransferState, a8 as HyperlaneTransferState, aO as OPInitTransferState, s as StargateTransferState, w as GoFastTransferState, aP as LayerZeroTransferState } from '../swaggerTypes-
|
|
2
|
-
import { T as TransactionCallbacks } from '../callbacks-
|
|
1
|
+
import { av as StatusErrorType, aJ as TransactionState, al as PacketErrorType, aS as TransferState, k as AxelarTransferState, O as ContractCallWithTokenErrorType, as as SendTokenErrorType, l as AxelarTransferType, p as CCTPTransferState, a8 as HyperlaneTransferState, aO as OPInitTransferState, s as StargateTransferState, w as GoFastTransferState, aP as LayerZeroTransferState } from '../swaggerTypes-BpJPRbC3.js';
|
|
2
|
+
import { T as TransactionCallbacks } from '../callbacks-CPh0dr86.js';
|
|
3
|
+
import { TrackTxRequest } from '../api/postTrackTransaction.js';
|
|
4
|
+
import '../generateApi-D7KXciAd.js';
|
|
3
5
|
|
|
4
|
-
type WaitForTransactionProps = {
|
|
5
|
-
chainId: string;
|
|
6
|
-
txHash: string;
|
|
6
|
+
type WaitForTransactionProps = TrackTxRequest & {
|
|
7
7
|
onTransactionTracked?: TransactionCallbacks["onTransactionTracked"];
|
|
8
8
|
};
|
|
9
|
-
declare const waitForTransaction: ({ chainId, txHash, onTransactionTracked, }: WaitForTransactionProps) => Promise<{
|
|
9
|
+
declare const waitForTransaction: ({ chainId, txHash, onTransactionTracked, ...trackTxPollingOptions }: WaitForTransactionProps) => Promise<{
|
|
10
10
|
transfers?: {
|
|
11
11
|
error?: {
|
|
12
12
|
details?: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { waitForTransaction } from '../chunk-
|
|
1
|
+
export { waitForTransaction } from '../chunk-COJAW7OW.js';
|
|
2
2
|
import '../chunk-XZV42PVV.js';
|
|
3
|
-
import '../chunk-
|
|
3
|
+
import '../chunk-CXFOPLGZ.js';
|
|
4
4
|
import '../chunk-YABXOO3H.js';
|
|
5
5
|
import '../chunk-UXUJNZOA.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GeneratedType } from '@cosmjs/proto-signing';
|
|
2
2
|
import { AminoConverters } from '@cosmjs/stargate';
|
|
3
3
|
import { S as SkipApiOptions } from './apiState-DwZhwVul.js';
|
|
4
|
-
import { E as EndpointOptions } from './client-types-
|
|
4
|
+
import { E as EndpointOptions } from './client-types-DRmsTfeT.js';
|
|
5
5
|
|
|
6
6
|
type SkipClientOptions = SkipApiOptions & {
|
|
7
7
|
endpointOptions?: {
|
|
@@ -1054,7 +1054,7 @@ declare enum TransactionState {
|
|
|
1054
1054
|
STATE_ABANDONED = "STATE_ABANDONED",
|
|
1055
1055
|
STATE_PENDING_ERROR = "STATE_PENDING_ERROR"
|
|
1056
1056
|
}
|
|
1057
|
-
/** A transfer facilitated by the
|
|
1057
|
+
/** A transfer facilitated by the OP Init bridge */
|
|
1058
1058
|
interface OPInitTransfer {
|
|
1059
1059
|
/** Canonical chain-id of the source chain of the bridge transaction */
|
|
1060
1060
|
fromChainId?: string;
|
|
@@ -1082,7 +1082,7 @@ interface OPInitTransfer {
|
|
|
1082
1082
|
smartRelay?: boolean;
|
|
1083
1083
|
}
|
|
1084
1084
|
interface OPInitTransferWrapper {
|
|
1085
|
-
/** A transfer facilitated by the
|
|
1085
|
+
/** A transfer facilitated by the OP Init bridge */
|
|
1086
1086
|
opInitTransfer?: OPInitTransfer;
|
|
1087
1087
|
}
|
|
1088
1088
|
interface OPInitTransferInfo {
|
|
@@ -1480,12 +1480,16 @@ type RouteResponse = Route;
|
|
|
1480
1480
|
interface MsgsResponse {
|
|
1481
1481
|
msgs?: Msg[];
|
|
1482
1482
|
txs?: Tx[];
|
|
1483
|
+
/** Minimum possible output after all operations, including fees and slippage */
|
|
1484
|
+
minAmountOut?: string;
|
|
1483
1485
|
/** Indicates fees incurred in the execution of the transfer */
|
|
1484
1486
|
estimatedFees?: Fee[];
|
|
1485
1487
|
}
|
|
1486
1488
|
interface MsgsDirectResponse {
|
|
1487
1489
|
msgs?: Msg[];
|
|
1488
1490
|
txs?: Tx[];
|
|
1491
|
+
/** Minimum possible output after all operations, including fees and slippage */
|
|
1492
|
+
minAmountOut?: string;
|
|
1489
1493
|
route?: Route;
|
|
1490
1494
|
}
|
|
1491
1495
|
interface AssetRecommendationsResponse {
|
package/package.json
CHANGED
package/dist/chunk-563FE62N.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { bv as Api } from './swaggerTypes-CAERZYPb.js';
|
|
2
|
-
|
|
3
|
-
type CamelKey<S extends string> = S extends `${infer T}_${infer U}` ? `${T}${Capitalize<CamelKey<U>>}` : S;
|
|
4
|
-
type Camel<T> = T extends (infer U)[] ? Camel<U>[] : T extends object ? {
|
|
5
|
-
[K in keyof T as K extends string ? CamelKey<K> : never]: Camel<T[K]>;
|
|
6
|
-
} : T;
|
|
7
|
-
|
|
8
|
-
type ApiInstance = InstanceType<typeof Api>;
|
|
9
|
-
type FunctionKeys<T> = {
|
|
10
|
-
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
|
|
11
|
-
}[keyof T];
|
|
12
|
-
type ValidApiMethodKeys = {
|
|
13
|
-
[K in FunctionKeys<ApiInstance>]: Awaited<ReturnType<ApiInstance[K]>> extends {
|
|
14
|
-
data: unknown;
|
|
15
|
-
} ? K : never;
|
|
16
|
-
}[FunctionKeys<ApiInstance>];
|
|
17
|
-
type ApiRequest<K extends ValidApiMethodKeys> = NonNullable<Camel<Parameters<ApiInstance[K]>[0]>>;
|
|
18
|
-
type ApiResponse<K extends ValidApiMethodKeys> = Camel<Awaited<ReturnType<ApiInstance[K]>> extends {
|
|
19
|
-
data: infer D;
|
|
20
|
-
} ? D extends object ? D : never : never>;
|
|
21
|
-
|
|
22
|
-
export type { ApiRequest as A, ApiResponse as a };
|