@swapkit/toolboxes 4.23.1 → 4.24.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/CHANGELOG.md +19 -0
- package/dist/chunk-ap5mzmjf.js +1 -0
- package/dist/{chunk-9psy287z.js → chunk-btth5bse.js} +1 -1
- package/dist/{chunk-jdh5asaw.js → chunk-nvfkjbyq.js} +1 -1
- package/dist/{chunk-fjyc6m34.js → chunk-xbdjxeqd.js} +1 -1
- package/dist/chunk-z61r1327.js +2 -0
- package/dist/src/aptos/index.cjs +1 -1
- package/dist/src/aptos/index.js +1 -1
- package/dist/src/cardano/index.cjs +1 -1
- package/dist/src/cardano/index.js +1 -1
- package/dist/src/cosmos/index.cjs +1 -1
- package/dist/src/cosmos/index.js +1 -1
- package/dist/src/evm/index.cjs +1 -1
- package/dist/src/evm/index.js +1 -1
- package/dist/src/hypercore/index.cjs +1 -1
- package/dist/src/hypercore/index.js +1 -1
- package/dist/src/index.cjs +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/near/index.cjs +1 -1
- package/dist/src/near/index.js +1 -1
- package/dist/src/radix/index.js +1 -1
- package/dist/src/ripple/index.cjs +1 -1
- package/dist/src/ripple/index.js +1 -1
- package/dist/src/solana/index.cjs +1 -1
- package/dist/src/solana/index.js +1 -1
- package/dist/src/starknet/index.cjs +1 -1
- package/dist/src/starknet/index.js +1 -1
- package/dist/src/stellar/index.cjs +1 -1
- package/dist/src/stellar/index.js +1 -1
- package/dist/src/substrate/index.cjs +1 -1
- package/dist/src/substrate/index.js +1 -1
- package/dist/src/sui/index.cjs +1 -1
- package/dist/src/sui/index.js +1 -1
- package/dist/src/ton/index.cjs +1 -1
- package/dist/src/ton/index.js +1 -1
- package/dist/src/tron/index.cjs +1 -1
- package/dist/src/tron/index.js +1 -1
- package/dist/src/utxo/index.cjs +1 -1
- package/dist/src/utxo/index.js +1 -1
- package/dist/types/aptos/toolbox.d.ts +11 -7
- package/dist/types/cardano/toolbox.d.ts +2 -2
- package/dist/types/cosmos/thorchainUtils/messages.d.ts +2 -1
- package/dist/types/cosmos/thorchainUtils/registry.d.ts +1 -1
- package/dist/types/cosmos/toolbox/cosmos.d.ts +1 -1
- package/dist/types/cosmos/toolbox/thorchain.d.ts +6 -6
- package/dist/types/cosmos/util.d.ts +16 -2
- package/dist/types/evm/toolbox/baseEVMToolbox.d.ts +66 -21
- package/dist/types/evm/toolbox/evm.d.ts +1603 -234
- package/dist/types/evm/toolbox/op.d.ts +235 -11
- package/dist/types/evm/types.d.ts +7 -13
- package/dist/types/hypercore/toolbox.d.ts +2 -2
- package/dist/types/hypercore/types.d.ts +3 -1
- package/dist/types/near/toolbox.d.ts +22 -3
- package/dist/types/near/types.d.ts +4 -1
- package/dist/types/ripple/index.d.ts +3 -2
- package/dist/types/solana/toolbox.d.ts +2 -2
- package/dist/types/starknet/toolbox.d.ts +2 -2
- package/dist/types/starknet/types.d.ts +3 -12
- package/dist/types/stellar/toolbox.d.ts +2 -2
- package/dist/types/sui/toolbox.d.ts +3 -3
- package/dist/types/ton/toolbox.d.ts +1 -4
- package/dist/types/tron/toolbox.d.ts +2 -2
- package/dist/types/utxo/helpers/coinselect.d.ts +2 -1
- package/dist/types/utxo/toolbox/bitcoinCash.d.ts +7 -5
- package/dist/types/utxo/toolbox/utxo.d.ts +8 -5
- package/dist/types/utxo/toolbox/zcash.d.ts +6 -4
- package/package.json +2 -2
- package/dist/chunk-6b99avsd.js +0 -2
- package/dist/chunk-e02sjx7s.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OfflineSigner } from "@cosmjs/proto-signing";
|
|
2
2
|
import type { SigningStargateClientOptions } from "@cosmjs/stargate";
|
|
3
|
-
import { AssetValue, type CosmosChain } from "@swapkit/helpers";
|
|
3
|
+
import { AssetValue, type CosmosChain, SwapKitNumber, type TCLikeChain } from "@swapkit/helpers";
|
|
4
4
|
import type { CosmosCreateTransactionParams } from "./types";
|
|
5
5
|
export declare const USK_KUJIRA_FACTORY_DENOM = "FACTORY/KUJIRA1QK00H5ATUTPSV900X202PXX42NPJR9THG58DNQPA72F2P7M2LUASE444A7/UUSK";
|
|
6
6
|
export declare const YUM_KUJIRA_FACTORY_DENOM = "FACTORY/KUJIRA1YGFXN0ER40KLCNCK8THLTUPRDXLCK6WVNPKF2K/UYUM";
|
|
@@ -32,6 +32,7 @@ export declare function getDefaultChainFee(chain: CosmosChain): {
|
|
|
32
32
|
}[];
|
|
33
33
|
gas: string;
|
|
34
34
|
};
|
|
35
|
+
export declare function getThorchainNativeFee(chain: TCLikeChain): Promise<SwapKitNumber>;
|
|
35
36
|
export declare const getMsgSendDenom: (symbol: string, isThorchain?: boolean) => string;
|
|
36
37
|
export declare const getDenomWithChain: ({ symbol, chain }: AssetValue) => string;
|
|
37
38
|
export declare function createStargateClient(url: string): Promise<import("@cosmjs/stargate/build").StargateClient>;
|
|
@@ -40,7 +41,7 @@ export declare function createOfflineStargateClient(wallet: OfflineSigner, regis
|
|
|
40
41
|
/**
|
|
41
42
|
* Used to build tx for Cosmos and Kujira
|
|
42
43
|
*/
|
|
43
|
-
export declare function cosmosCreateTransaction({ sender, recipient, assetValue, memo, feeRate, sequence, accountNumber, }: CosmosCreateTransactionParams): Promise<{
|
|
44
|
+
export declare function cosmosCreateTransaction({ sender, recipient, assetValue, memo, feeRate, sequence, accountNumber, sweep, }: CosmosCreateTransactionParams): Promise<{
|
|
44
45
|
accountNumber: number;
|
|
45
46
|
chainId: import("@swapkit/types").ChainId;
|
|
46
47
|
fee: {
|
|
@@ -64,6 +65,19 @@ export declare function cosmosCreateTransaction({ sender, recipient, assetValue,
|
|
|
64
65
|
}[];
|
|
65
66
|
sequence: number;
|
|
66
67
|
}>;
|
|
68
|
+
export declare function getFeeAmountForDenom(fees: readonly {
|
|
69
|
+
amount: string;
|
|
70
|
+
denom: string;
|
|
71
|
+
}[], denom: string): bigint;
|
|
72
|
+
export declare function getSweepAssetValue({ assetValue, balances, denom, feeAmount, }: {
|
|
73
|
+
assetValue: AssetValue;
|
|
74
|
+
balances: readonly {
|
|
75
|
+
amount: string;
|
|
76
|
+
denom: string;
|
|
77
|
+
}[];
|
|
78
|
+
denom: string;
|
|
79
|
+
feeAmount?: bigint;
|
|
80
|
+
}): AssetValue;
|
|
67
81
|
/**
|
|
68
82
|
* Converts a Cosmos denom and amount to an AssetValue with proper decimal handling
|
|
69
83
|
* @param denom - The denomination string
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
import { type Asset, AssetValue, type ChainSigner, type EVMChain, FeeOption } from "@swapkit/helpers";
|
|
2
|
-
import { BrowserProvider, Contract, type ContractTransaction, type Fragment, type HDNodeWallet, type JsonFragment, type JsonRpcSigner, type Provider, type Signer } from "ethers";
|
|
2
|
+
import { BrowserProvider, Contract, type ContractTransaction, type Fragment, type HDNodeWallet, type JsonFragment, type JsonRpcSigner, type Provider, type Signer, type TransactionRequest } from "ethers";
|
|
3
3
|
import type { ApproveParams, CallParams, EIP1559TxParams, EstimateCallParams, EVMCreateTransactionParams, EVMTransferParams, EVMTxParams, IsApprovedParams, SignTypedDataParams } from "../types";
|
|
4
|
+
type GasPrices = {
|
|
5
|
+
[key in FeeOption]: {
|
|
6
|
+
gasPrice?: bigint;
|
|
7
|
+
l1GasPrice?: bigint;
|
|
8
|
+
maxFeePerGas?: bigint;
|
|
9
|
+
maxPriorityFeePerGas?: bigint;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
4
12
|
type ToolboxWrapParams<P = Provider | BrowserProvider, T = {}> = T & {
|
|
13
|
+
estimateGasPrices?: () => Promise<GasPrices>;
|
|
14
|
+
estimateAdditionalFee?: (tx: TransactionRequest) => Promise<bigint | undefined>;
|
|
5
15
|
isEIP1559Compatible?: boolean;
|
|
6
16
|
provider: P;
|
|
7
17
|
signer?: Signer;
|
|
8
18
|
chain: EVMChain;
|
|
9
19
|
};
|
|
10
20
|
export declare const MAX_APPROVAL: bigint;
|
|
11
|
-
export declare function BaseEVMToolbox<P extends Provider | BrowserProvider, S extends (ChainSigner<EVMTransferParams, string> & Signer) | JsonRpcSigner | HDNodeWallet | undefined>({ chain, provider, signer, isEIP1559Compatible, }: {
|
|
21
|
+
export declare function BaseEVMToolbox<P extends Provider | BrowserProvider, S extends (ChainSigner<EVMTransferParams, string> & Signer) | JsonRpcSigner | HDNodeWallet | undefined>({ chain, provider, signer, isEIP1559Compatible, estimateGasPrices: estimateGasPricesOverride, estimateAdditionalFee, }: {
|
|
12
22
|
signer: S;
|
|
13
23
|
provider: P;
|
|
24
|
+
estimateGasPrices?: () => Promise<GasPrices>;
|
|
25
|
+
estimateAdditionalFee?: (tx: TransactionRequest) => Promise<bigint | undefined>;
|
|
14
26
|
isEIP1559Compatible?: boolean;
|
|
15
27
|
chain?: EVMChain;
|
|
16
28
|
}): {
|
|
@@ -55,7 +67,29 @@ export declare function BaseEVMToolbox<P extends Provider | BrowserProvider, S e
|
|
|
55
67
|
blockTag?: import("ethers").BlockTag;
|
|
56
68
|
enableCcipRead?: boolean;
|
|
57
69
|
}>;
|
|
58
|
-
createTransaction: ({ assetValue, memo, recipient, data, sender: fromOverride, maxFeePerGas, maxPriorityFeePerGas, gasPrice, ...tx }: EVMCreateTransactionParams) => Promise<{
|
|
70
|
+
createTransaction: ({ assetValue, authorizations, memo, recipient, data, feeOptionKey, gasLimit, sender: fromOverride, sweep, type, maxFeePerGas, maxPriorityFeePerGas, gasPrice, ...tx }: EVMCreateTransactionParams) => Promise<{
|
|
71
|
+
gasLimit: bigint;
|
|
72
|
+
value: string;
|
|
73
|
+
data: string;
|
|
74
|
+
from: string;
|
|
75
|
+
to: string;
|
|
76
|
+
maxFeePerGas: bigint;
|
|
77
|
+
maxPriorityFeePerGas: bigint;
|
|
78
|
+
gasPrice?: undefined;
|
|
79
|
+
type?: number | undefined;
|
|
80
|
+
nonce?: number | undefined;
|
|
81
|
+
} | {
|
|
82
|
+
gasLimit: bigint;
|
|
83
|
+
value: string;
|
|
84
|
+
data: string;
|
|
85
|
+
from: string;
|
|
86
|
+
to: string;
|
|
87
|
+
gasPrice: bigint;
|
|
88
|
+
maxFeePerGas?: undefined;
|
|
89
|
+
maxPriorityFeePerGas?: undefined;
|
|
90
|
+
type?: number | undefined;
|
|
91
|
+
nonce?: number | undefined;
|
|
92
|
+
} | {
|
|
59
93
|
value: string;
|
|
60
94
|
to: string;
|
|
61
95
|
data: string;
|
|
@@ -73,7 +107,29 @@ export declare function BaseEVMToolbox<P extends Provider | BrowserProvider, S e
|
|
|
73
107
|
blockTag?: import("ethers").BlockTag;
|
|
74
108
|
enableCcipRead?: boolean;
|
|
75
109
|
}>;
|
|
76
|
-
createTransferTx: ({ assetValue, memo, recipient, data, sender: fromOverride, maxFeePerGas, maxPriorityFeePerGas, gasPrice, ...tx }: EVMCreateTransactionParams) => Promise<{
|
|
110
|
+
createTransferTx: ({ assetValue, authorizations, memo, recipient, data, feeOptionKey, gasLimit, sender: fromOverride, sweep, type, maxFeePerGas, maxPriorityFeePerGas, gasPrice, ...tx }: EVMCreateTransactionParams) => Promise<{
|
|
111
|
+
gasLimit: bigint;
|
|
112
|
+
value: string;
|
|
113
|
+
data: string;
|
|
114
|
+
from: string;
|
|
115
|
+
to: string;
|
|
116
|
+
maxFeePerGas: bigint;
|
|
117
|
+
maxPriorityFeePerGas: bigint;
|
|
118
|
+
gasPrice?: undefined;
|
|
119
|
+
type?: number | undefined;
|
|
120
|
+
nonce?: number | undefined;
|
|
121
|
+
} | {
|
|
122
|
+
gasLimit: bigint;
|
|
123
|
+
value: string;
|
|
124
|
+
data: string;
|
|
125
|
+
from: string;
|
|
126
|
+
to: string;
|
|
127
|
+
gasPrice: bigint;
|
|
128
|
+
maxFeePerGas?: undefined;
|
|
129
|
+
maxPriorityFeePerGas?: undefined;
|
|
130
|
+
type?: number | undefined;
|
|
131
|
+
nonce?: number | undefined;
|
|
132
|
+
} | {
|
|
77
133
|
value: string;
|
|
78
134
|
to: string;
|
|
79
135
|
data: string;
|
|
@@ -100,12 +156,7 @@ export declare function BaseEVMToolbox<P extends Provider | BrowserProvider, S e
|
|
|
100
156
|
txOverrides?: EVMTxParams;
|
|
101
157
|
data?: string;
|
|
102
158
|
}) => Promise<bigint>;
|
|
103
|
-
estimateGasPrices: () => Promise<
|
|
104
|
-
l1GasPrice?: bigint;
|
|
105
|
-
gasPrice?: bigint;
|
|
106
|
-
maxFeePerGas?: bigint;
|
|
107
|
-
maxPriorityFeePerGas?: bigint;
|
|
108
|
-
}; }>;
|
|
159
|
+
estimateGasPrices: () => Promise<GasPrices>;
|
|
109
160
|
estimateTransactionFee: ({ feeOption, ...txObject }: EIP1559TxParams & {
|
|
110
161
|
feeOption: FeeOption;
|
|
111
162
|
}) => Promise<AssetValue>;
|
|
@@ -113,8 +164,9 @@ export declare function BaseEVMToolbox<P extends Provider | BrowserProvider, S e
|
|
|
113
164
|
getBalance: (address: string, scamFilter?: boolean) => Promise<AssetValue[]>;
|
|
114
165
|
getNetworkParams: () => import("@swapkit/helpers").NetworkParams | undefined;
|
|
115
166
|
isApproved: ({ assetAddress, spenderAddress, from, amount }: IsApprovedParams) => Promise<boolean>;
|
|
116
|
-
sendTransaction: ({ feeOptionKey, ...tx }: EVMTxParams & {
|
|
167
|
+
sendTransaction: ({ feeOptionKey, sweep, ...tx }: EVMTxParams & {
|
|
117
168
|
feeOptionKey?: FeeOption;
|
|
169
|
+
sweep?: boolean;
|
|
118
170
|
}) => Promise<string>;
|
|
119
171
|
signAuthorization: ((params: {
|
|
120
172
|
address: string;
|
|
@@ -123,7 +175,7 @@ export declare function BaseEVMToolbox<P extends Provider | BrowserProvider, S e
|
|
|
123
175
|
}) => Promise<import("ethers").Authorization>) | undefined;
|
|
124
176
|
signMessage: ((message: string | Uint8Array) => Promise<string>) | undefined;
|
|
125
177
|
signTypedData: (({ domain, types, value }: SignTypedDataParams) => Promise<string>) | undefined;
|
|
126
|
-
transfer: ({ assetValue, memo, recipient, feeOptionKey, sender, ...tx }: EVMTransferParams) => Promise<string>;
|
|
178
|
+
transfer: ({ assetValue, memo, recipient, feeOptionKey, sender, sweep, ...tx }: EVMTransferParams) => Promise<string>;
|
|
127
179
|
validateAddress: typeof validateEVMAddress;
|
|
128
180
|
};
|
|
129
181
|
export declare function validateEVMAddress(address: string): boolean;
|
|
@@ -135,7 +187,7 @@ export declare function isStateChangingCall({ abi, funcName }: {
|
|
|
135
187
|
funcName: string;
|
|
136
188
|
}): any;
|
|
137
189
|
export declare function toChecksumAddress(address: string): string;
|
|
138
|
-
export declare function getEIP1193SendTransaction(provider: Provider | BrowserProvider): ({ value, ...params }: EVMTxParams | ContractTransaction) => Promise<string>;
|
|
190
|
+
export declare function getEIP1193SendTransaction(provider: Provider | BrowserProvider, includeGasFields?: boolean): ({ value, ...params }: EVMTxParams | ContractTransaction) => Promise<string>;
|
|
139
191
|
export declare function getChecksumAddressFromAsset(asset: Asset, chain: EVMChain): string;
|
|
140
192
|
export declare const ContractAddress: Record<EVMChain, string>;
|
|
141
193
|
export declare function getTokenAddress({ chain, symbol, ticker }: Asset, baseAssetChain: EVMChain): string | null;
|
|
@@ -161,14 +213,7 @@ export declare function getEstimateGasPrices({ chain, provider, isEIP1559Compati
|
|
|
161
213
|
provider: Provider;
|
|
162
214
|
isEIP1559Compatible?: boolean;
|
|
163
215
|
chain: EVMChain;
|
|
164
|
-
}): () => Promise<
|
|
165
|
-
[key in FeeOption]: {
|
|
166
|
-
l1GasPrice?: bigint;
|
|
167
|
-
gasPrice?: bigint;
|
|
168
|
-
maxFeePerGas?: bigint;
|
|
169
|
-
maxPriorityFeePerGas?: bigint;
|
|
170
|
-
};
|
|
171
|
-
}>;
|
|
216
|
+
}): () => Promise<GasPrices>;
|
|
172
217
|
export declare const isEIP7702Transaction: (tx: EVMTxParams) => boolean;
|
|
173
218
|
export declare const isEIP1559Transaction: (tx: EVMTxParams) => boolean;
|
|
174
219
|
type EVMTxType = "eip7702" | "eip1559" | "legacy";
|