@swapkit/toolboxes 4.23.0 → 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.
Files changed (69) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/chunk-ap5mzmjf.js +1 -0
  3. package/dist/{chunk-9psy287z.js → chunk-btth5bse.js} +1 -1
  4. package/dist/{chunk-jdh5asaw.js → chunk-nvfkjbyq.js} +1 -1
  5. package/dist/{chunk-fjyc6m34.js → chunk-xbdjxeqd.js} +1 -1
  6. package/dist/chunk-z61r1327.js +2 -0
  7. package/dist/src/aptos/index.cjs +1 -1
  8. package/dist/src/aptos/index.js +1 -1
  9. package/dist/src/cardano/index.cjs +1 -1
  10. package/dist/src/cardano/index.js +1 -1
  11. package/dist/src/cosmos/index.cjs +1 -1
  12. package/dist/src/cosmos/index.js +1 -1
  13. package/dist/src/evm/index.cjs +1 -1
  14. package/dist/src/evm/index.js +1 -1
  15. package/dist/src/hypercore/index.cjs +1 -1
  16. package/dist/src/hypercore/index.js +1 -1
  17. package/dist/src/index.cjs +1 -1
  18. package/dist/src/index.js +1 -1
  19. package/dist/src/near/index.cjs +1 -1
  20. package/dist/src/near/index.js +1 -1
  21. package/dist/src/radix/index.js +1 -1
  22. package/dist/src/ripple/index.cjs +1 -1
  23. package/dist/src/ripple/index.js +1 -1
  24. package/dist/src/solana/index.cjs +1 -1
  25. package/dist/src/solana/index.js +1 -1
  26. package/dist/src/starknet/index.cjs +1 -1
  27. package/dist/src/starknet/index.js +1 -1
  28. package/dist/src/stellar/index.cjs +1 -1
  29. package/dist/src/stellar/index.js +1 -1
  30. package/dist/src/substrate/index.cjs +1 -1
  31. package/dist/src/substrate/index.js +1 -1
  32. package/dist/src/sui/index.cjs +1 -1
  33. package/dist/src/sui/index.js +1 -1
  34. package/dist/src/ton/index.cjs +1 -1
  35. package/dist/src/ton/index.js +1 -1
  36. package/dist/src/tron/index.cjs +1 -1
  37. package/dist/src/tron/index.js +1 -1
  38. package/dist/src/utxo/index.cjs +1 -1
  39. package/dist/src/utxo/index.js +1 -1
  40. package/dist/types/aptos/toolbox.d.ts +11 -7
  41. package/dist/types/cardano/toolbox.d.ts +2 -2
  42. package/dist/types/cosmos/thorchainUtils/messages.d.ts +2 -1
  43. package/dist/types/cosmos/thorchainUtils/registry.d.ts +1 -1
  44. package/dist/types/cosmos/toolbox/cosmos.d.ts +1 -1
  45. package/dist/types/cosmos/toolbox/thorchain.d.ts +6 -6
  46. package/dist/types/cosmos/util.d.ts +16 -2
  47. package/dist/types/evm/toolbox/baseEVMToolbox.d.ts +66 -21
  48. package/dist/types/evm/toolbox/evm.d.ts +1603 -234
  49. package/dist/types/evm/toolbox/op.d.ts +235 -11
  50. package/dist/types/evm/types.d.ts +7 -13
  51. package/dist/types/hypercore/toolbox.d.ts +2 -2
  52. package/dist/types/hypercore/types.d.ts +3 -1
  53. package/dist/types/near/toolbox.d.ts +22 -3
  54. package/dist/types/near/types.d.ts +4 -1
  55. package/dist/types/ripple/index.d.ts +3 -2
  56. package/dist/types/solana/toolbox.d.ts +2 -2
  57. package/dist/types/starknet/toolbox.d.ts +2 -2
  58. package/dist/types/starknet/types.d.ts +3 -12
  59. package/dist/types/stellar/toolbox.d.ts +2 -2
  60. package/dist/types/sui/toolbox.d.ts +3 -3
  61. package/dist/types/ton/toolbox.d.ts +1 -4
  62. package/dist/types/tron/toolbox.d.ts +2 -2
  63. package/dist/types/utxo/helpers/coinselect.d.ts +2 -1
  64. package/dist/types/utxo/toolbox/bitcoinCash.d.ts +7 -5
  65. package/dist/types/utxo/toolbox/utxo.d.ts +8 -5
  66. package/dist/types/utxo/toolbox/zcash.d.ts +6 -4
  67. package/package.json +2 -2
  68. package/dist/chunk-6b99avsd.js +0 -2
  69. package/dist/chunk-e02sjx7s.js +0 -1
@@ -1,32 +1,191 @@
1
- import { FeeOption } from "@swapkit/helpers";
1
+ import { Chain, FeeOption } from "@swapkit/helpers";
2
2
  import type { Authorization, TransactionRequest } from "ethers";
3
3
  import { Contract } from "ethers";
4
4
  import type { EVMToolboxParams } from "../types";
5
- export declare function OPToolbox({ provider, ...toolboxSignerParams }: EVMToolboxParams): {
5
+ export declare function createOPStackToolbox(chain: Chain.Optimism | Chain.Base | Chain.Unichain): ({ provider, ...toolboxSignerParams }: EVMToolboxParams) => {
6
+ estimateL1Gas: (tx: TransactionRequest) => Promise<any>;
7
+ estimateL1GasCost: (tx: TransactionRequest) => Promise<bigint | undefined>;
8
+ estimateL2GasCost: (tx: TransactionRequest) => Promise<bigint>;
9
+ estimateOperatorFee: (gasLimit: bigint) => Promise<bigint>;
10
+ estimateTotalGasCost: (tx: TransactionRequest) => Promise<bigint>;
11
+ getBalance: (address: string, scamFilter?: boolean) => Promise<import("@swapkit/helpers").AssetValue[]>;
12
+ getL1GasPrice: () => Promise<bigint | undefined>;
13
+ approve: ({ assetAddress, spenderAddress, feeOptionKey, amount, gasLimitFallback, from: fromParam, nonce, }: import("..").ApproveParams) => Promise<string>;
14
+ approvedAmount: ({ assetAddress, spenderAddress, from }: import("..").IsApprovedParams) => Promise<bigint>;
15
+ broadcastTransaction: ((signedTx: string) => Promise<import("ethers").TransactionResponse>) | ((signedTx: string) => Promise<import("ethers").TransactionResponse>);
16
+ call: <T>({ callProvider, contractAddress, abi, funcName, funcParams, txOverrides, feeOption, }: import("..").CallParams) => Promise<T>;
17
+ createApprovalTx: ({ assetAddress, spenderAddress, amount, from: fromParam }: import("..").ApproveParams) => Promise<{
18
+ value: string;
19
+ to: string;
20
+ data: string;
21
+ from?: string;
22
+ type?: number;
23
+ nonce?: number;
24
+ gasLimit?: bigint;
25
+ gasPrice?: bigint;
26
+ maxPriorityFeePerGas?: bigint;
27
+ maxFeePerGas?: bigint;
28
+ chainId?: bigint;
29
+ accessList?: import("ethers").AccessList;
30
+ authorizationList?: Array<Authorization>;
31
+ customData?: any;
32
+ blockTag?: import("ethers").BlockTag;
33
+ enableCcipRead?: boolean;
34
+ }>;
35
+ createContract: (address: string, abi: readonly (import("ethers").JsonFragment | import("ethers").Fragment)[]) => Contract;
36
+ createContractTxObject: ({ contractAddress, abi, funcName, funcParams, txOverrides }: import("..").CallParams) => Promise<{
37
+ value: string;
38
+ to: string;
39
+ data: string;
40
+ from?: string;
41
+ type?: number;
42
+ nonce?: number;
43
+ gasLimit?: bigint;
44
+ gasPrice?: bigint;
45
+ maxPriorityFeePerGas?: bigint;
46
+ maxFeePerGas?: bigint;
47
+ chainId?: bigint;
48
+ accessList?: import("ethers").AccessList;
49
+ authorizationList?: Array<Authorization>;
50
+ customData?: any;
51
+ blockTag?: import("ethers").BlockTag;
52
+ enableCcipRead?: boolean;
53
+ }>;
54
+ createTransaction: ({ assetValue, authorizations, memo, recipient, data, feeOptionKey, gasLimit, sender: fromOverride, sweep, type, maxFeePerGas, maxPriorityFeePerGas, gasPrice, ...tx }: import("..").EVMCreateTransactionParams) => Promise<{
55
+ gasLimit: bigint;
56
+ value: string;
57
+ data: string;
58
+ from: string;
59
+ to: string;
60
+ maxFeePerGas: bigint;
61
+ maxPriorityFeePerGas: bigint;
62
+ gasPrice?: undefined;
63
+ type?: number | undefined;
64
+ nonce?: number | undefined;
65
+ } | {
66
+ gasLimit: bigint;
67
+ value: string;
68
+ data: string;
69
+ from: string;
70
+ to: string;
71
+ gasPrice: bigint;
72
+ maxFeePerGas?: undefined;
73
+ maxPriorityFeePerGas?: undefined;
74
+ type?: number | undefined;
75
+ nonce?: number | undefined;
76
+ } | {
77
+ value: string;
78
+ to: string;
79
+ data: string;
80
+ from?: string;
81
+ type?: number;
82
+ nonce?: number;
83
+ gasLimit?: bigint;
84
+ gasPrice?: bigint;
85
+ maxPriorityFeePerGas?: bigint;
86
+ maxFeePerGas?: bigint;
87
+ chainId?: bigint;
88
+ accessList?: import("ethers").AccessList;
89
+ authorizationList?: Array<Authorization>;
90
+ customData?: any;
91
+ blockTag?: import("ethers").BlockTag;
92
+ enableCcipRead?: boolean;
93
+ }>;
94
+ createTransferTx: ({ assetValue, authorizations, memo, recipient, data, feeOptionKey, gasLimit, sender: fromOverride, sweep, type, maxFeePerGas, maxPriorityFeePerGas, gasPrice, ...tx }: import("..").EVMCreateTransactionParams) => Promise<{
95
+ gasLimit: bigint;
96
+ value: string;
97
+ data: string;
98
+ from: string;
99
+ to: string;
100
+ maxFeePerGas: bigint;
101
+ maxPriorityFeePerGas: bigint;
102
+ gasPrice?: undefined;
103
+ type?: number | undefined;
104
+ nonce?: number | undefined;
105
+ } | {
106
+ gasLimit: bigint;
107
+ value: string;
108
+ data: string;
109
+ from: string;
110
+ to: string;
111
+ gasPrice: bigint;
112
+ maxFeePerGas?: undefined;
113
+ maxPriorityFeePerGas?: undefined;
114
+ type?: number | undefined;
115
+ nonce?: number | undefined;
116
+ } | {
117
+ value: string;
118
+ to: string;
119
+ data: string;
120
+ from?: string;
121
+ type?: number;
122
+ nonce?: number;
123
+ gasLimit?: bigint;
124
+ gasPrice?: bigint;
125
+ maxPriorityFeePerGas?: bigint;
126
+ maxFeePerGas?: bigint;
127
+ chainId?: bigint;
128
+ accessList?: import("ethers").AccessList;
129
+ authorizationList?: Array<Authorization>;
130
+ customData?: any;
131
+ blockTag?: import("ethers").BlockTag;
132
+ enableCcipRead?: boolean;
133
+ }>;
134
+ EIP1193SendTransaction: ({ value, ...params }: import("..").EVMTxParams | import("ethers").ContractTransaction) => Promise<string>;
135
+ estimateCall: ({ contractAddress, abi, funcName, funcParams, txOverrides }: import("..").EstimateCallParams) => Promise<bigint>;
136
+ estimateGasLimit: ({ assetValue, recipient, memo, data, sender, funcName, funcParams, txOverrides, }: import("..").EVMTransferParams & {
137
+ assetValue: import("@swapkit/helpers").AssetValue;
138
+ funcName?: string;
139
+ funcParams?: unknown[];
140
+ txOverrides?: import("..").EVMTxParams;
141
+ data?: string;
142
+ }) => Promise<bigint>;
6
143
  estimateGasPrices: () => Promise<{
7
144
  average: {
8
- l1GasPrice?: bigint;
9
145
  gasPrice?: bigint;
146
+ l1GasPrice?: bigint;
10
147
  maxFeePerGas?: bigint;
11
148
  maxPriorityFeePerGas?: bigint;
12
149
  };
13
150
  fast: {
14
- l1GasPrice?: bigint;
15
151
  gasPrice?: bigint;
152
+ l1GasPrice?: bigint;
16
153
  maxFeePerGas?: bigint;
17
154
  maxPriorityFeePerGas?: bigint;
18
155
  };
19
156
  fastest: {
20
- l1GasPrice?: bigint;
21
157
  gasPrice?: bigint;
158
+ l1GasPrice?: bigint;
22
159
  maxFeePerGas?: bigint;
23
160
  maxPriorityFeePerGas?: bigint;
24
161
  };
25
162
  }>;
163
+ estimateTransactionFee: ({ feeOption, ...txObject }: import("..").EIP1559TxParams & {
164
+ feeOption: FeeOption;
165
+ }) => Promise<import("@swapkit/helpers").AssetValue>;
166
+ getAddress: () => string | Promise<string> | undefined;
167
+ getNetworkParams: () => import("@swapkit/helpers").NetworkParams | undefined;
168
+ isApproved: ({ assetAddress, spenderAddress, from, amount }: import("..").IsApprovedParams) => Promise<boolean>;
169
+ sendTransaction: ({ feeOptionKey, sweep, ...tx }: import("..").EVMTxParams & {
170
+ feeOptionKey?: FeeOption;
171
+ sweep?: boolean;
172
+ }) => Promise<string>;
173
+ signAuthorization: ((params: {
174
+ address: string;
175
+ nonce?: number | bigint;
176
+ chainId?: bigint;
177
+ }) => Promise<Authorization>) | undefined;
178
+ signMessage: ((message: string | Uint8Array) => Promise<string>) | undefined;
179
+ signTypedData: (({ domain, types, value }: import("..").SignTypedDataParams) => Promise<string>) | undefined;
180
+ transfer: ({ assetValue, memo, recipient, feeOptionKey, sender, sweep, ...tx }: import("..").EVMTransferParams) => Promise<string>;
181
+ validateAddress: typeof import("./baseEVMToolbox").validateEVMAddress;
182
+ };
183
+ export declare const OPToolbox: ({ provider, ...toolboxSignerParams }: EVMToolboxParams) => {
26
184
  estimateL1Gas: (tx: TransactionRequest) => Promise<any>;
27
- estimateL1GasCost: (tx: TransactionRequest) => Promise<any>;
185
+ estimateL1GasCost: (tx: TransactionRequest) => Promise<bigint | undefined>;
28
186
  estimateL2GasCost: (tx: TransactionRequest) => Promise<bigint>;
29
- estimateTotalGasCost: (tx: TransactionRequest) => Promise<any>;
187
+ estimateOperatorFee: (gasLimit: bigint) => Promise<bigint>;
188
+ estimateTotalGasCost: (tx: TransactionRequest) => Promise<bigint>;
30
189
  getBalance: (address: string, scamFilter?: boolean) => Promise<import("@swapkit/helpers").AssetValue[]>;
31
190
  getL1GasPrice: () => Promise<bigint | undefined>;
32
191
  approve: ({ assetAddress, spenderAddress, feeOptionKey, amount, gasLimitFallback, from: fromParam, nonce, }: import("..").ApproveParams) => Promise<string>;
@@ -70,7 +229,29 @@ export declare function OPToolbox({ provider, ...toolboxSignerParams }: EVMToolb
70
229
  blockTag?: import("ethers").BlockTag;
71
230
  enableCcipRead?: boolean;
72
231
  }>;
73
- createTransaction: ({ assetValue, memo, recipient, data, sender: fromOverride, maxFeePerGas, maxPriorityFeePerGas, gasPrice, ...tx }: import("..").EVMCreateTransactionParams) => Promise<{
232
+ createTransaction: ({ assetValue, authorizations, memo, recipient, data, feeOptionKey, gasLimit, sender: fromOverride, sweep, type, maxFeePerGas, maxPriorityFeePerGas, gasPrice, ...tx }: import("..").EVMCreateTransactionParams) => Promise<{
233
+ gasLimit: bigint;
234
+ value: string;
235
+ data: string;
236
+ from: string;
237
+ to: string;
238
+ maxFeePerGas: bigint;
239
+ maxPriorityFeePerGas: bigint;
240
+ gasPrice?: undefined;
241
+ type?: number | undefined;
242
+ nonce?: number | undefined;
243
+ } | {
244
+ gasLimit: bigint;
245
+ value: string;
246
+ data: string;
247
+ from: string;
248
+ to: string;
249
+ gasPrice: bigint;
250
+ maxFeePerGas?: undefined;
251
+ maxPriorityFeePerGas?: undefined;
252
+ type?: number | undefined;
253
+ nonce?: number | undefined;
254
+ } | {
74
255
  value: string;
75
256
  to: string;
76
257
  data: string;
@@ -88,7 +269,29 @@ export declare function OPToolbox({ provider, ...toolboxSignerParams }: EVMToolb
88
269
  blockTag?: import("ethers").BlockTag;
89
270
  enableCcipRead?: boolean;
90
271
  }>;
91
- createTransferTx: ({ assetValue, memo, recipient, data, sender: fromOverride, maxFeePerGas, maxPriorityFeePerGas, gasPrice, ...tx }: import("..").EVMCreateTransactionParams) => Promise<{
272
+ createTransferTx: ({ assetValue, authorizations, memo, recipient, data, feeOptionKey, gasLimit, sender: fromOverride, sweep, type, maxFeePerGas, maxPriorityFeePerGas, gasPrice, ...tx }: import("..").EVMCreateTransactionParams) => Promise<{
273
+ gasLimit: bigint;
274
+ value: string;
275
+ data: string;
276
+ from: string;
277
+ to: string;
278
+ maxFeePerGas: bigint;
279
+ maxPriorityFeePerGas: bigint;
280
+ gasPrice?: undefined;
281
+ type?: number | undefined;
282
+ nonce?: number | undefined;
283
+ } | {
284
+ gasLimit: bigint;
285
+ value: string;
286
+ data: string;
287
+ from: string;
288
+ to: string;
289
+ gasPrice: bigint;
290
+ maxFeePerGas?: undefined;
291
+ maxPriorityFeePerGas?: undefined;
292
+ type?: number | undefined;
293
+ nonce?: number | undefined;
294
+ } | {
92
295
  value: string;
93
296
  to: string;
94
297
  data: string;
@@ -115,14 +318,35 @@ export declare function OPToolbox({ provider, ...toolboxSignerParams }: EVMToolb
115
318
  txOverrides?: import("..").EVMTxParams;
116
319
  data?: string;
117
320
  }) => Promise<bigint>;
321
+ estimateGasPrices: () => Promise<{
322
+ average: {
323
+ gasPrice?: bigint;
324
+ l1GasPrice?: bigint;
325
+ maxFeePerGas?: bigint;
326
+ maxPriorityFeePerGas?: bigint;
327
+ };
328
+ fast: {
329
+ gasPrice?: bigint;
330
+ l1GasPrice?: bigint;
331
+ maxFeePerGas?: bigint;
332
+ maxPriorityFeePerGas?: bigint;
333
+ };
334
+ fastest: {
335
+ gasPrice?: bigint;
336
+ l1GasPrice?: bigint;
337
+ maxFeePerGas?: bigint;
338
+ maxPriorityFeePerGas?: bigint;
339
+ };
340
+ }>;
118
341
  estimateTransactionFee: ({ feeOption, ...txObject }: import("..").EIP1559TxParams & {
119
342
  feeOption: FeeOption;
120
343
  }) => Promise<import("@swapkit/helpers").AssetValue>;
121
344
  getAddress: () => string | Promise<string> | undefined;
122
345
  getNetworkParams: () => import("@swapkit/helpers").NetworkParams | undefined;
123
346
  isApproved: ({ assetAddress, spenderAddress, from, amount }: import("..").IsApprovedParams) => Promise<boolean>;
124
- sendTransaction: ({ feeOptionKey, ...tx }: import("..").EVMTxParams & {
347
+ sendTransaction: ({ feeOptionKey, sweep, ...tx }: import("..").EVMTxParams & {
125
348
  feeOptionKey?: FeeOption;
349
+ sweep?: boolean;
126
350
  }) => Promise<string>;
127
351
  signAuthorization: ((params: {
128
352
  address: string;
@@ -131,6 +355,6 @@ export declare function OPToolbox({ provider, ...toolboxSignerParams }: EVMToolb
131
355
  }) => Promise<Authorization>) | undefined;
132
356
  signMessage: ((message: string | Uint8Array) => Promise<string>) | undefined;
133
357
  signTypedData: (({ domain, types, value }: import("..").SignTypedDataParams) => Promise<string>) | undefined;
134
- transfer: ({ assetValue, memo, recipient, feeOptionKey, sender, ...tx }: import("..").EVMTransferParams) => Promise<string>;
358
+ transfer: ({ assetValue, memo, recipient, feeOptionKey, sender, sweep, ...tx }: import("..").EVMTransferParams) => Promise<string>;
135
359
  validateAddress: typeof import("./baseEVMToolbox").validateEVMAddress;
136
360
  };
@@ -1,6 +1,6 @@
1
- import type { AssetValue, ChainSigner, DerivationPathArray, FeeOption, GenericCreateTransactionParams, GenericTransferParams } from "@swapkit/helpers";
1
+ import type { ChainSigner, DerivationPathArray, FeeOption, GenericCreateTransactionParams, GenericTransferParams } from "@swapkit/helpers";
2
2
  import { Chain } from "@swapkit/helpers";
3
- import type { BigNumberish, BrowserProvider, JsonFragment, JsonRpcSigner, Provider, Signer, TransactionRequest, TypedDataField } from "ethers";
3
+ import type { AuthorizationLike, BigNumberish, BrowserProvider, JsonFragment, JsonRpcSigner, Provider, Signer, TransactionRequest, TypedDataField } from "ethers";
4
4
  import type { getProvider } from "./index";
5
5
  import type { ADIToolbox, ARBToolbox, AURORAToolbox, AVAXToolbox, BASEToolbox, BERAToolbox, BSCToolbox, COREToolbox, CORNToolbox, CROToolbox, ETHToolbox, GNOToolbox, HOODToolbox, HYPEREVMToolbox, LINEAToolbox, MATICToolbox, MEGAETHToolbox, MONADToolbox, OPToolbox, PLASMAToolbox, SONICToolbox, UNIToolbox, XLayerToolbox } from "./toolbox";
6
6
  export declare enum EthNetwork {
@@ -35,26 +35,20 @@ export type CallParams = {
35
35
  };
36
36
  export type EstimateCallParams = Pick<CallParams, "contractAddress" | "abi" | "funcName" | "funcParams" | "txOverrides">;
37
37
  export type EVMTransferParams = GenericTransferParams & {
38
+ authorizations?: AuthorizationLike[];
38
39
  sender?: string;
40
+ type?: number;
39
41
  };
40
42
  export type EVMCreateTransactionParams = Omit<GenericCreateTransactionParams, "feeRate"> & {
43
+ authorizations?: AuthorizationLike[];
44
+ feeOptionKey?: FeeOption;
41
45
  gasLimit?: bigint;
42
46
  gasPrice?: bigint;
43
47
  maxFeePerGas?: bigint;
44
48
  maxPriorityFeePerGas?: bigint;
45
49
  data?: string;
46
50
  nonce?: number;
47
- };
48
- export type EVMMaxSendableAmountsParams = {
49
- from: string;
50
- assetValue: AssetValue;
51
- feeOptionKey?: FeeOption;
52
- memo?: string;
53
- abi?: readonly JsonFragment[];
54
- funcName?: string;
55
- contractAddress?: string;
56
- funcParams?: unknown[];
57
- txOverrides?: TransactionRequest;
51
+ type?: number;
58
52
  };
59
53
  export type EVMTxBaseParams<T = BigNumberish> = {
60
54
  to?: string;
@@ -44,7 +44,7 @@ declare function getUserFills({ aggregateByTime, user }: HyperCoreUserFillsQuery
44
44
  declare function getUserFillsByTime({ aggregateByTime, endTime, startTime, user }: HyperCoreUserFillsByTimeQueryParams): Promise<HyperCoreFill[]>;
45
45
  export declare function createL1ActionRequest<TAction extends HyperCoreL1Action>({ action, expiresAfter, nonce, vaultAddress, }: HyperCoreL1RequestParams<TAction>): Promise<HyperCoreUnsignedL1ActionRequest<TAction>>;
46
46
  export declare function createUserSignedActionRequest<TAction extends HyperCoreUserSignedAction>({ action, nonce, signatureChainId, }: HyperCoreUserSignedRequestParams<TAction>): Promise<HyperCoreUnsignedUserSignedActionRequest<TAction>>;
47
- export declare function createTransaction({ assetValue, recipient, sender, signatureChainId: customSignatureChainId, time, }: HyperCoreCreateTransactionParams): Promise<HyperCoreTransferTransaction>;
47
+ export declare function createTransaction({ assetValue, recipient, sender, signatureChainId: customSignatureChainId, sweep, time, }: HyperCoreCreateTransactionParams): Promise<HyperCoreTransferTransaction>;
48
48
  declare function broadcastTransaction(signed: HyperCoreSignedRequest): Promise<{
49
49
  response?: {
50
50
  data?: {
@@ -72,7 +72,7 @@ export declare function getHyperCoreToolbox(toolboxParams?: HyperCoreToolboxPara
72
72
  userFillsByTime: typeof getUserFillsByTime;
73
73
  };
74
74
  signTransaction: (request: HyperCoreUnsignedRequest) => Promise<HyperCoreSignedRequest>;
75
- transfer: (params: HyperCoreTransferParams) => Promise<string>;
75
+ transfer: ({ sweep, ...params }: HyperCoreTransferParams) => Promise<string>;
76
76
  validateAddress: typeof validateHyperCoreAddress;
77
77
  };
78
78
  export {};
@@ -1,7 +1,9 @@
1
1
  import type { GenericCreateTransactionParams } from "@swapkit/helpers";
2
2
  import type { TypedDataDomain, TypedDataField } from "ethers";
3
- export type HyperCoreCreateTransactionParams = GenericCreateTransactionParams & {
3
+ export type HyperCoreCreateTransactionParams = Omit<GenericCreateTransactionParams, "sweep"> & {
4
4
  signatureChainId?: string;
5
+ /** Drains the full spot token balance to another HyperCore account. Withdrawing off the exchange is out of scope. */
6
+ sweep?: boolean;
5
7
  time?: number;
6
8
  };
7
9
  export type HyperCoreTransferParams = Omit<HyperCoreCreateTransactionParams, "feeRate" | "sender"> & {
@@ -1,10 +1,28 @@
1
1
  import type { Account, Contract } from "@near-js/accounts";
2
+ import type { JsonRpcProvider } from "@near-js/providers";
2
3
  import type { SignedTransaction, Transaction } from "@near-js/transactions";
3
4
  import { AssetValue } from "@swapkit/helpers";
4
5
  import { getNearSignerFromPhrase, getNearSignerFromPrivateKey, validateNearAddress } from "./helpers/core";
5
6
  import type { NearCreateTransactionParams, NearFunctionCallParams, NearToolboxParams, NearTransferParams } from "./types";
6
7
  import type { NearContractInterface, NearGasEstimateParams } from "./types/contract";
7
8
  import type { BatchTransaction, ContractFunctionCallParams, CreateActionParams } from "./types/toolbox";
9
+ type NearProtocolConfig = {
10
+ runtime_config: {
11
+ storage_amount_per_byte: string;
12
+ transaction_costs: {
13
+ action_creation_config: {
14
+ transfer_cost: {
15
+ execution: string;
16
+ send_sir: string;
17
+ };
18
+ };
19
+ action_receipt_creation_config: {
20
+ execution: string;
21
+ send_sir: string;
22
+ };
23
+ };
24
+ };
25
+ };
8
26
  export declare function getNearToolbox(toolboxParams?: NearToolboxParams): {
9
27
  broadcastTransaction: (signedTransaction: SignedTransaction) => Promise<string>;
10
28
  callFunction: (params: NearFunctionCallParams) => Promise<string>;
@@ -12,16 +30,16 @@ export declare function getNearToolbox(toolboxParams?: NearToolboxParams): {
12
30
  createContract: <T extends Contract = Contract>(contractInterface: NearContractInterface) => Promise<T>;
13
31
  createContractFunctionCall: ({ args, attachedDeposit, contractId, gas, methodName, sender: accountId, }: ContractFunctionCallParams) => Promise<Transaction>;
14
32
  createSubAccount: (subAccountId: string, publicKey: string, initialBalance: string) => Promise<string>;
15
- createTransaction: ({ recipient, assetValue, memo, attachedDeposit, sender, functionCall, }: NearCreateTransactionParams) => Promise<Transaction>;
33
+ createTransaction: ({ recipient, assetValue, memo, attachedDeposit, sender, functionCall, sweep, }: NearCreateTransactionParams) => Promise<Transaction>;
16
34
  /** @deprecated Use `estimateGasLimit` instead */
17
35
  estimateGas: (params: NearGasEstimateParams, account?: Account) => Promise<AssetValue>;
18
36
  estimateGasLimit: (params: NearGasEstimateParams, account?: Account) => Promise<AssetValue>;
19
- estimateTransactionFee: (params: NearTransferParams | NearGasEstimateParams) => Promise<AssetValue>;
37
+ estimateTransactionFee: (params: NearTransferParams | NearGasEstimateParams, protocolConfigParam?: NearProtocolConfig) => Promise<AssetValue>;
20
38
  executeBatchTransaction: (batch: BatchTransaction) => Promise<string>;
21
39
  getAddress: () => Promise<string>;
22
40
  getBalance: (address: string, scamFilter?: boolean) => Promise<AssetValue[]>;
23
41
  getGasPrice: () => Promise<string>;
24
- getNearProvider: () => Promise<import("@near-js/providers").JsonRpcProvider>;
42
+ getNearProvider: () => Promise<JsonRpcProvider>;
25
43
  getPublicKey: () => Promise<string>;
26
44
  getSignerFromPhrase: typeof getNearSignerFromPhrase;
27
45
  getSignerFromPrivateKey: typeof getNearSignerFromPrivateKey;
@@ -31,3 +49,4 @@ export declare function getNearToolbox(toolboxParams?: NearToolboxParams): {
31
49
  transfer: (params: NearTransferParams) => Promise<string>;
32
50
  validateAddress: typeof validateNearAddress;
33
51
  };
52
+ export {};
@@ -35,6 +35,7 @@ export type NearToolboxParams = {
35
35
  derivationPath?: DerivationPathArray;
36
36
  };
37
37
  export interface NearTransferParams extends GenericTransferParams {
38
+ sweep?: boolean;
38
39
  }
39
40
  export interface NearConfig {
40
41
  networkId: "mainnet" | "testnet" | "betanet";
@@ -50,7 +51,7 @@ export interface NearFunctionCallParams {
50
51
  deposit?: bigint | string | number;
51
52
  gas?: bigint | string | number;
52
53
  }
53
- export interface NearCreateTransactionParams extends Omit<GenericCreateTransactionParams, "feeRate"> {
54
+ export interface NearCreateTransactionParams extends Omit<GenericCreateTransactionParams, "feeRate" | "sweep"> {
54
55
  attachedDeposit?: string;
55
56
  functionCall?: {
56
57
  methodName: string;
@@ -59,6 +60,8 @@ export interface NearCreateTransactionParams extends Omit<GenericCreateTransacti
59
60
  gas: string;
60
61
  contractId: string;
61
62
  };
63
+ /** Sweep the maximum transferable amount while keeping the account alive. DeleteAccount sweeps are out of scope. */
64
+ sweep?: boolean;
62
65
  }
63
66
  export * from "./toolbox";
64
67
  export * from "./types/contract";
@@ -54,11 +54,12 @@ type RippleToolboxParams = {
54
54
  export declare function getRippleToolbox(params?: RippleToolboxParams): {
55
55
  broadcastTransaction: (signedTxHex: string) => Promise<string>;
56
56
  createSigner: typeof createSigner;
57
- createTransaction: ({ assetValue, recipient, memo, sender, destinationTag, extendBySeconds, }: {
57
+ createTransaction: ({ assetValue, recipient, memo, sender, sweep, destinationTag, extendBySeconds, }: {
58
58
  assetValue: AssetValue;
59
59
  recipient: string;
60
60
  sender?: string;
61
61
  memo?: string;
62
+ sweep?: boolean;
62
63
  destinationTag?: number;
63
64
  extendBySeconds?: number;
64
65
  }) => Promise<Payment>;
@@ -79,6 +80,6 @@ export declare function getRippleToolbox(params?: RippleToolboxParams): {
79
80
  tx_blob: string;
80
81
  hash: string;
81
82
  }>;
82
- transfer: (params: GenericTransferParams) => Promise<string>;
83
+ transfer: ({ assetValue, memo, recipient, sweep }: GenericTransferParams) => Promise<string>;
83
84
  validateAddress: typeof validateRippleAddress;
84
85
  };
@@ -23,7 +23,7 @@ export declare function getSolanaToolbox(toolboxParams?: {
23
23
  }): {
24
24
  broadcastTransaction: (transaction: Transaction | VersionedTransaction) => Promise<string>;
25
25
  createKeysForPath: typeof createKeysForPath;
26
- createTransaction: ({ recipient, assetValue, memo, isProgramDerivedAddress, sender }: SolanaCreateTransactionParams) => Promise<Transaction>;
26
+ createTransaction: ({ recipient, assetValue, memo, isProgramDerivedAddress, sender, sweep, }: SolanaCreateTransactionParams) => Promise<Transaction>;
27
27
  createTransactionFromInstructions: typeof createTransactionFromInstructions;
28
28
  estimateTransactionFee: ({ recipient, assetValue, memo, isProgramDerivedAddress, sender, }: Omit<GenericCreateTransactionParams, "feeRate"> & {
29
29
  isProgramDerivedAddress?: boolean;
@@ -36,7 +36,7 @@ export declare function getSolanaToolbox(toolboxParams?: {
36
36
  getPubkeyFromAddress: (address: string) => PublicKey;
37
37
  signAndBroadcastTransaction: (transaction: Transaction | VersionedTransaction) => Promise<string>;
38
38
  signTransaction: (transaction: Transaction | VersionedTransaction) => Promise<Transaction | VersionedTransaction>;
39
- transfer: ({ recipient, assetValue, memo, isProgramDerivedAddress }: SolanaTransferParams) => Promise<string>;
39
+ transfer: ({ recipient, assetValue, memo, isProgramDerivedAddress, sweep }: SolanaTransferParams) => Promise<string>;
40
40
  validateAddress: typeof validateSolanaAddress;
41
41
  };
42
42
  declare function getConnection(): Promise<Connection>;
@@ -17,7 +17,7 @@ export declare function createKeysForPath({ phrase, derivationPath, }: {
17
17
  export declare function getStarknetToolbox(toolboxParams?: StarknetToolboxParams): {
18
18
  broadcastTransaction: (calls: StarknetCall[]) => Promise<string>;
19
19
  createKeysForPath: typeof createKeysForPath;
20
- createTransaction: ({ recipient, assetValue }: StarknetCreateTransactionParams) => Promise<StarknetCall[]>;
20
+ createTransaction: ({ recipient, assetValue, sender, sweep }: StarknetCreateTransactionParams) => Promise<StarknetCall[]>;
21
21
  deployAccount: () => Promise<string>;
22
22
  estimateTransactionFee: ({ recipient, assetValue, sender, }: StarknetTransferParams & {
23
23
  sender?: string;
@@ -28,6 +28,6 @@ export declare function getStarknetToolbox(toolboxParams?: StarknetToolboxParams
28
28
  isAccountDeployed: (address?: string) => Promise<boolean>;
29
29
  signAndBroadcastTransaction: (calls: StarknetCall[]) => Promise<string>;
30
30
  signMessage: (typedData: TypedData) => Promise<string[]>;
31
- transfer: ({ recipient, assetValue, memo }: StarknetTransferParams) => Promise<string>;
31
+ transfer: ({ recipient, assetValue, memo, sweep }: StarknetTransferParams) => Promise<string>;
32
32
  validateAddress: typeof validateStarknetAddress;
33
33
  };
@@ -1,4 +1,4 @@
1
- import type { AssetValue, DerivationPathArray, FeeOption } from "@swapkit/helpers";
1
+ import type { DerivationPathArray, GenericTransferParams } from "@swapkit/helpers";
2
2
  import type { Account } from "starknet";
3
3
  export type StarknetToolboxParams = {
4
4
  signer?: Account;
@@ -10,16 +10,7 @@ export type StarknetToolboxParams = {
10
10
  privateKey?: string;
11
11
  address?: string;
12
12
  };
13
- export type StarknetTransferParams = {
14
- recipient: string;
15
- assetValue: AssetValue;
16
- memo?: string;
17
- };
18
- export type StarknetCreateTransactionParams = {
19
- recipient: string;
20
- assetValue: AssetValue;
13
+ export type StarknetTransferParams = GenericTransferParams;
14
+ export type StarknetCreateTransactionParams = GenericTransferParams & {
21
15
  sender?: string;
22
- memo?: string;
23
- feeRate?: number;
24
- feeOptionKey?: FeeOption;
25
16
  };
@@ -7,7 +7,7 @@ export declare function getStellarToolbox(params?: StellarToolboxParams): {
7
7
  hash?: () => Buffer;
8
8
  toXDR: () => string;
9
9
  }) => Promise<string>;
10
- createTransaction: ({ recipient, assetValue, memo, sender }: StellarCreateTransactionParams) => Promise<import("@stellar/stellar-sdk").Transaction<import("@stellar/stellar-sdk").Memo<import("@stellar/stellar-sdk").MemoType>, import("@stellar/stellar-sdk").Operation[]>>;
10
+ createTransaction: ({ recipient, assetValue, memo, sender, sweep }: StellarCreateTransactionParams) => Promise<import("@stellar/stellar-sdk").Transaction<import("@stellar/stellar-sdk").Memo<import("@stellar/stellar-sdk").MemoType>, import("@stellar/stellar-sdk").Operation[]>>;
11
11
  createTrustline: ({ assetValue, limit }: StellarTrustlineParams) => Promise<string>;
12
12
  createTrustlineTransaction: ({ assetValue, limit, sender }: StellarCreateTrustlineTransactionParams) => Promise<import("@stellar/stellar-sdk").Transaction<import("@stellar/stellar-sdk").Memo<import("@stellar/stellar-sdk").MemoType>, import("@stellar/stellar-sdk").Operation[]>>;
13
13
  estimateTransactionFee: () => Promise<AssetValue>;
@@ -19,6 +19,6 @@ export declare function getStellarToolbox(params?: StellarToolboxParams): {
19
19
  signTransaction: (transaction: {
20
20
  toXDR: () => string;
21
21
  }) => Promise<import("@stellar/stellar-sdk").Transaction<import("@stellar/stellar-sdk").Memo<import("@stellar/stellar-sdk").MemoType>, import("@stellar/stellar-sdk").Operation[]> | import("@stellar/stellar-sdk").FeeBumpTransaction>;
22
- transfer: ({ recipient, assetValue, memo }: StellarTransferParams) => Promise<string>;
22
+ transfer: ({ recipient, assetValue, memo, sweep }: StellarTransferParams) => Promise<string>;
23
23
  validateAddress: typeof validateStellarAddress;
24
24
  };
@@ -7,7 +7,7 @@ export declare function getSuiToolbox({ provider: providerParam, ...signerParams
7
7
  bytes: string;
8
8
  signature: string;
9
9
  }) => Promise<string>;
10
- createTransaction: ({ recipient, assetValue, gasBudget, sender }: SuiCreateTransactionParams) => Promise<{
10
+ createTransaction: ({ recipient, assetValue, gasBudget, sender, sweep }: SuiCreateTransactionParams) => Promise<{
11
11
  tx: Transaction;
12
12
  txBytes: Uint8Array<ArrayBuffer>;
13
13
  }>;
@@ -15,13 +15,13 @@ export declare function getSuiToolbox({ provider: providerParam, ...signerParams
15
15
  getAddress: () => Promise<string>;
16
16
  getBalance: (targetAddress?: string) => Promise<AssetValue[]>;
17
17
  signAndBroadcastTransaction: (transaction: Transaction | Uint8Array<ArrayBuffer> | string) => Promise<string>;
18
- signTransaction: (params: Uint8Array<ArrayBuffer> | SuiCreateTransactionParams | Awaited<ReturnType<({ recipient, assetValue, gasBudget, sender }: SuiCreateTransactionParams) => Promise<{
18
+ signTransaction: (params: Uint8Array<ArrayBuffer> | SuiCreateTransactionParams | Awaited<ReturnType<({ recipient, assetValue, gasBudget, sender, sweep }: SuiCreateTransactionParams) => Promise<{
19
19
  tx: Transaction;
20
20
  txBytes: Uint8Array<ArrayBuffer>;
21
21
  }>>>) => Promise<{
22
22
  bytes: string;
23
23
  signature: string;
24
24
  } | import("@mysten/sui/cryptography").SignatureWithBytes>;
25
- transfer: ({ assetValue, gasBudget, recipient }: SuiTransferParams) => Promise<string>;
25
+ transfer: ({ assetValue, gasBudget, recipient, sweep }: SuiTransferParams) => Promise<string>;
26
26
  validateAddress: typeof validateSuiAddress;
27
27
  };
@@ -5,7 +5,6 @@ export declare function getTONToolbox(toolboxParams?: TONToolboxParams): {
5
5
  broadcastTransaction: (transferCell: Cell) => Promise<string>;
6
6
  createTransaction: ({ sender, sweep, ...params }: GenericTransferParams & {
7
7
  sender?: string;
8
- sweep?: boolean;
9
8
  }) => Promise<TONToolboxTransaction>;
10
9
  estimateTransactionFee: ({ sender, ...params }: GenericTransferParams & {
11
10
  sender?: string;
@@ -18,9 +17,7 @@ export declare function getTONToolbox(toolboxParams?: TONToolboxParams): {
18
17
  }) => Promise<Address>;
19
18
  sign: (transactionInput: TONTransactionInput) => Promise<Cell>;
20
19
  signAndBroadcastTransaction: (transaction: TONTransactionInput) => Promise<string>;
21
- transfer: ({ assetValue, recipient, memo, sweep }: GenericTransferParams & {
22
- sweep?: boolean;
23
- }) => Promise<string>;
20
+ transfer: ({ assetValue, recipient, memo, sweep }: GenericTransferParams) => Promise<string>;
24
21
  validateAddress: typeof validateTonAddress;
25
22
  };
26
23
  export declare function validateTonAddress(address: string): boolean;
@@ -13,7 +13,7 @@ export declare function getTronPrivateKeyFromMnemonic({ phrase, derivationPath:
13
13
  export declare function getTronToolbox(options?: TronToolboxOptions): {
14
14
  approve: ({ assetAddress, spenderAddress, amount, from }: TronApproveParams) => Promise<string>;
15
15
  broadcastTransaction: typeof broadcastTronTransaction;
16
- createTransaction: ({ recipient, assetValue, memo, sender, expiration }: TronCreateTransactionParams) => Promise<TronTransaction>;
16
+ createTransaction: ({ recipient, assetValue, memo, sender, expiration, sweep, }: TronCreateTransactionParams) => Promise<TronTransaction>;
17
17
  estimateTransactionFee: ({ assetValue, memo, recipient, sender, }: TronTransferParams & {
18
18
  sender?: string;
19
19
  }) => Promise<AssetValue>;
@@ -24,6 +24,6 @@ export declare function getTronToolbox(options?: TronToolboxOptions): {
24
24
  isApproved: ({ assetAddress, spenderAddress, from, amount }: TronIsApprovedParams) => Promise<boolean>;
25
25
  signAndBroadcastTransaction: (transaction: TronTransaction) => Promise<string>;
26
26
  signTransaction: (transaction: TronTransaction) => Promise<import("./types").TronSignedTransaction>;
27
- transfer: ({ recipient, assetValue, memo, expiration }: TronTransferParams) => Promise<string>;
27
+ transfer: ({ recipient, assetValue, memo, expiration, sweep }: TronTransferParams) => Promise<string>;
28
28
  validateAddress: typeof isValidTronAddress;
29
29
  };
@@ -6,9 +6,10 @@ type AccumulativeParams<T extends UTXOSizeInput> = {
6
6
  feeRate: number;
7
7
  chain: UTXOChain;
8
8
  changeAddress?: string;
9
+ sweep?: boolean;
9
10
  };
10
11
  export declare function getDustThreshold(chain: UTXOChain): 550 | 5500 | 100000 | 546;
11
- export declare function accumulative<T extends UTXOSizeInput>({ inputs, outputs, feeRate, chain, changeAddress, }: AccumulativeParams<T>): {
12
+ export declare function accumulative<T extends UTXOSizeInput>({ inputs, outputs, feeRate, chain, changeAddress, sweep, }: AccumulativeParams<T>): {
12
13
  fee: number;
13
14
  inputs: T[];
14
15
  outputs: TargetOutput[];