@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.
Files changed (69) hide show
  1. package/CHANGELOG.md +19 -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
@@ -25,7 +25,7 @@ export declare function createBCHToolbox<T extends typeof Chain.BitcoinCash>(too
25
25
  signTransaction: (tx: InstanceType<typeof Transaction>) => any;
26
26
  stripPrefix: typeof stripPrefix;
27
27
  stripToCashAddress: typeof stripToCashAddress;
28
- transfer: ({ recipient, assetValue, feeOptionKey, ...rest }: UTXOTransferParams) => Promise<string>;
28
+ transfer: ({ recipient, assetValue, feeOptionKey, sweep, ...rest }: UTXOTransferParams) => Promise<string>;
29
29
  validateAddress: typeof validateBchAddress;
30
30
  accumulative: typeof accumulative;
31
31
  bumpFee: ({ txid, newFeeRate, recipient, memo }: import("..").RBFTransactionParams) => Promise<{
@@ -52,11 +52,12 @@ export declare function createBCHToolbox<T extends typeof Chain.BitcoinCash>(too
52
52
  pubkey: string;
53
53
  } | undefined;
54
54
  derivePrivateKeyAtIndex: ({ accountIndex, index, change }: import("..").DeriveAddressParams) => Uint8Array<ArrayBufferLike> | undefined;
55
- estimateMaxSendableAmount: ({ from, memo, feeRate, feeOptionKey, recipients, }: {
55
+ estimateMaxSendableAmount: ({ from, memo, feeRate, feeOptionKey, recipient, recipients, }: {
56
56
  from: string;
57
57
  memo?: string;
58
58
  feeRate?: number;
59
59
  feeOptionKey?: FeeOption;
60
+ recipient?: string;
60
61
  recipients?: number | TargetOutput[];
61
62
  }) => Promise<import("@swapkit/helpers").AssetValue>;
62
63
  estimateTransactionFee: (params: {
@@ -76,7 +77,7 @@ export declare function createBCHToolbox<T extends typeof Chain.BitcoinCash>(too
76
77
  path: string;
77
78
  xpub: string;
78
79
  } | undefined;
79
- getInputsOutputsFee: ({ assetValue, feeOptionKey, feeRate, memo, sender, recipient, }: Omit<UTXOBuildTxParams, "feeRate"> & {
80
+ getInputsOutputsFee: ({ assetValue, feeOptionKey, feeRate, memo, sender, recipient, sweep, }: Omit<UTXOBuildTxParams, "feeRate"> & {
80
81
  feeOptionKey?: FeeOption;
81
82
  feeRate?: number;
82
83
  }) => Promise<{
@@ -116,7 +117,7 @@ export declare function createBCHToolbox<T extends typeof Chain.BitcoinCash>(too
116
117
  tx: InstanceType<typeof Transaction>;
117
118
  inputDerivations: import("..").InputDerivation[];
118
119
  }) => Transaction;
119
- transferFromMultipleAddresses: ({ utxos, recipient, assetValue, memo, feeRate, feeOptionKey, changeAddress, }: {
120
+ transferFromMultipleAddresses: ({ utxos, recipient, assetValue, memo, feeRate, feeOptionKey, changeAddress, sweep, }: {
120
121
  utxos: import("..").UTXOForMultiAddressTransfer[];
121
122
  recipient: string;
122
123
  assetValue: import("@swapkit/helpers").AssetValue;
@@ -124,9 +125,10 @@ export declare function createBCHToolbox<T extends typeof Chain.BitcoinCash>(too
124
125
  feeRate?: number;
125
126
  feeOptionKey?: FeeOption;
126
127
  changeAddress?: string;
128
+ sweep?: boolean;
127
129
  }) => Promise<string>;
128
130
  };
129
- declare function createTransaction({ assetValue, recipient, memo, feeRate, sender }: UTXOBuildTxParams): Promise<{
131
+ declare function createTransaction({ assetValue, recipient, memo, feeRate, sender, sweep }: UTXOBuildTxParams): Promise<{
130
132
  inputs: UTXOType[];
131
133
  tx: Transaction;
132
134
  utxos: {
@@ -37,7 +37,7 @@ export declare function addInputsAndOutputs({ inputs, outputs, chain, tx, sender
37
37
  inputs: UTXOType[];
38
38
  tx: Transaction;
39
39
  };
40
- declare function createTransaction({ assetValue, recipient, memo, feeRate, sender, fetchTxHex, enableRBF, }: UTXOBuildTxParams): Promise<{
40
+ declare function createTransaction({ assetValue, recipient, memo, feeRate, sender, fetchTxHex, enableRBF, sweep, }: UTXOBuildTxParams): Promise<{
41
41
  inputs: UTXOType[];
42
42
  tx: Transaction;
43
43
  utxos: {
@@ -52,7 +52,7 @@ declare function createTransaction({ assetValue, recipient, memo, feeRate, sende
52
52
  };
53
53
  }[];
54
54
  }>;
55
- declare function getInputsOutputsFee({ assetValue, feeOptionKey, feeRate, memo, sender, recipient, }: Omit<UTXOBuildTxParams, "feeRate"> & {
55
+ declare function getInputsOutputsFee({ assetValue, feeOptionKey, feeRate, memo, sender, recipient, sweep, }: Omit<UTXOBuildTxParams, "feeRate"> & {
56
56
  feeOptionKey?: FeeOption;
57
57
  feeRate?: number;
58
58
  }): Promise<{
@@ -134,11 +134,12 @@ export declare function createUTXOToolbox<T extends UTXOChain>({ chain, ...toolb
134
134
  pubkey: string;
135
135
  } | undefined;
136
136
  derivePrivateKeyAtIndex: ({ accountIndex, index, change }: DeriveAddressParams) => Uint8Array<ArrayBufferLike> | undefined;
137
- estimateMaxSendableAmount: ({ from, memo, feeRate, feeOptionKey, recipients, }: {
137
+ estimateMaxSendableAmount: ({ from, memo, feeRate, feeOptionKey, recipient, recipients, }: {
138
138
  from: string;
139
139
  memo?: string;
140
140
  feeRate?: number;
141
141
  feeOptionKey?: FeeOption;
142
+ recipient?: string;
142
143
  recipients?: number | TargetOutput[];
143
144
  }) => Promise<AssetValue>;
144
145
  estimateTransactionFee: (params: {
@@ -189,10 +190,10 @@ export declare function createUTXOToolbox<T extends UTXOChain>({ chain, ...toolb
189
190
  tx: InstanceType<typeof Transaction>;
190
191
  inputDerivations: InputDerivation[];
191
192
  }) => Transaction;
192
- transfer: ({ memo, recipient, feeOptionKey, feeRate, assetValue, enableRBF, }: UTXOTransferParams & {
193
+ transfer: ({ memo, recipient, feeOptionKey, feeRate, assetValue, enableRBF, sweep, }: UTXOTransferParams & {
193
194
  enableRBF?: boolean;
194
195
  }) => Promise<string>;
195
- transferFromMultipleAddresses: ({ utxos, recipient, assetValue, memo, feeRate, feeOptionKey, changeAddress, }: {
196
+ transferFromMultipleAddresses: ({ utxos, recipient, assetValue, memo, feeRate, feeOptionKey, changeAddress, sweep, }: {
196
197
  utxos: UTXOForMultiAddressTransfer[];
197
198
  recipient: string;
198
199
  assetValue: AssetValue;
@@ -200,6 +201,8 @@ export declare function createUTXOToolbox<T extends UTXOChain>({ chain, ...toolb
200
201
  feeRate?: number;
201
202
  feeOptionKey?: FeeOption;
202
203
  changeAddress?: string;
204
+ /** Multi-address sweeps are unsupported because this path requires an explicit send amount and change address. */
205
+ sweep?: boolean;
203
206
  }) => Promise<string>;
204
207
  validateAddress: (address: string) => boolean;
205
208
  };
@@ -30,7 +30,7 @@ export declare function createZcashToolbox(toolboxParams: {
30
30
  }) => string;
31
31
  signAndBroadcastTransaction: (tx: ZcashTransaction | PCZT | ZcashPSBT) => Promise<string>;
32
32
  signTransaction: (tx: ZcashTransaction | PCZT | ZcashPSBT) => Promise<ZcashTransaction>;
33
- transfer: ({ recipient, assetValue, feeOptionKey, ...rest }: UTXOTransferParams) => Promise<string>;
33
+ transfer: ({ recipient, assetValue, feeOptionKey, sweep, ...rest }: UTXOTransferParams) => Promise<string>;
34
34
  validateAddress: typeof validateZcashAddress;
35
35
  accumulative: typeof accumulative;
36
36
  broadcastTx: (txHash: string) => Promise<string>;
@@ -50,11 +50,12 @@ export declare function createZcashToolbox(toolboxParams: {
50
50
  pubkey: string;
51
51
  } | undefined;
52
52
  derivePrivateKeyAtIndex: ({ accountIndex, index, change }: import("..").DeriveAddressParams) => Uint8Array<ArrayBufferLike> | undefined;
53
- estimateMaxSendableAmount: ({ from, memo, feeRate, feeOptionKey, recipients, }: {
53
+ estimateMaxSendableAmount: ({ from, memo, feeRate, feeOptionKey, recipient, recipients, }: {
54
54
  from: string;
55
55
  memo?: string;
56
56
  feeRate?: number;
57
57
  feeOptionKey?: FeeOption;
58
+ recipient?: string;
58
59
  recipients?: number | TargetOutput[];
59
60
  }) => Promise<import("@swapkit/helpers").AssetValue>;
60
61
  estimateTransactionFee: (params: {
@@ -84,7 +85,7 @@ export declare function createZcashToolbox(toolboxParams: {
84
85
  fast: number;
85
86
  fastest: number;
86
87
  }>;
87
- getInputsOutputsFee: ({ assetValue, feeOptionKey, feeRate, memo, sender, recipient, }: Omit<UTXOBuildTxParams, "feeRate"> & {
88
+ getInputsOutputsFee: ({ assetValue, feeOptionKey, feeRate, memo, sender, recipient, sweep, }: Omit<UTXOBuildTxParams, "feeRate"> & {
88
89
  feeOptionKey?: FeeOption;
89
90
  feeRate?: number;
90
91
  }) => Promise<{
@@ -120,7 +121,7 @@ export declare function createZcashToolbox(toolboxParams: {
120
121
  tx: InstanceType<typeof import("@swapkit/utxo-signer").Transaction>;
121
122
  inputDerivations: import("..").InputDerivation[];
122
123
  }) => import("@swapkit/utxo-signer").Transaction;
123
- transferFromMultipleAddresses: ({ utxos, recipient, assetValue, memo, feeRate, feeOptionKey, changeAddress, }: {
124
+ transferFromMultipleAddresses: ({ utxos, recipient, assetValue, memo, feeRate, feeOptionKey, changeAddress, sweep, }: {
124
125
  utxos: import("..").UTXOForMultiAddressTransfer[];
125
126
  recipient: string;
126
127
  assetValue: import("@swapkit/helpers").AssetValue;
@@ -128,6 +129,7 @@ export declare function createZcashToolbox(toolboxParams: {
128
129
  feeRate?: number;
129
130
  feeOptionKey?: FeeOption;
130
131
  changeAddress?: string;
132
+ sweep?: boolean;
131
133
  }) => Promise<string>;
132
134
  };
133
135
  export {};
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "dependencies": { "@swapkit/helpers": "4.16.2", "@swapkit/utxo-signer": "2.2.3" },
2
+ "dependencies": { "@swapkit/helpers": "4.17.1", "@swapkit/utxo-signer": "2.2.3" },
3
3
  "description": "SwapKit - Toolboxes",
4
4
  "devDependencies": {
5
5
  "@aptos-labs/ts-sdk": "7.0.1",
@@ -198,5 +198,5 @@
198
198
  "type-check:go": "tsgo"
199
199
  },
200
200
  "type": "module",
201
- "version": "4.23.1"
201
+ "version": "4.24.1"
202
202
  }
@@ -1,2 +0,0 @@
1
- import{ea as Wt}from"./chunk-jdh5asaw.js";import{fa as g}from"./chunk-fjyc6m34.js";import{Chain as w}from"@swapkit/helpers";import{match as Cy}from"ts-pattern";import{Chain as q,getChainConfig as P,getRPCUrl as rt,SKConfig as ty,SwapKitError as K}from"@swapkit/helpers";import{FallbackProvider as yy,getAddress as Dt,Interface as uy,JsonRpcProvider as s,Network as ny}from"ethers";import{match as Lt}from"ts-pattern";function Ty(t){return new s(t)}async function vy(t,y){return Ty(y||await rt(t))}function Rt(t){let y=ty.get("rpcUrls")[t]?.filter(Boolean)??[];if(y.length===0)throw new K("helpers_chain_no_public_or_set_rpc_url",{chain:t});let{chainId:u}=P(t),n=ny.from(Number(u)),[T]=y;if(y.length===1)return new s(T,n,{staticNetwork:n});return new yy(y.map((l,b)=>({priority:b+1,provider:new s(l,n,{staticNetwork:n}),stallTimeout:2000})),n,{quorum:1})}function N(t){return t>0n?`0x${t.toString(16)}`:"0x0"}function qt(t){let{explorerUrl:y,chainIdHex:u,rpcUrls:n}=P(t);return function(){return t!==q.Ethereum?{...ly({chain:t}),blockExplorerUrls:[y],chainId:u,rpcUrls:n}:void 0}}function Gt(t){return![q.Adi,q.Arbitrum,q.BinanceSmartChain,q.Robinhood].includes(t)}function ly({chain:t}){let{name:y,nativeCurrency:u,baseDecimal:n}=P(t);return Lt(t).with(q.Arbitrum,()=>({chainName:"Arbitrum One",nativeCurrency:{decimals:n,name:"Ethereum",symbol:q.Ethereum}})).with(q.Aurora,()=>({chainName:"Aurora Mainnet",nativeCurrency:{decimals:n,name:"Ethereum",symbol:q.Ethereum}})).with(q.Avalanche,()=>({chainName:"Avalanche Network",nativeCurrency:{decimals:n,name:"Avalanche",symbol:t}})).with(q.Base,()=>({chainName:"Base Mainnet",nativeCurrency:{decimals:n,name:"Ethereum",symbol:q.Ethereum}})).with(q.Berachain,()=>({chainName:"Berachain",nativeCurrency:{decimals:n,name:"Berachain",symbol:"BERA"}})).with(q.XLayer,()=>({chainName:"X Layer",nativeCurrency:{decimals:n,name:"OKB",symbol:"OKB"}})).with(q.BinanceSmartChain,()=>({chainName:"BNB Smart Chain Mainnet",nativeCurrency:{decimals:n,name:"Binance Coin",symbol:"BNB"}})).with(q.Gnosis,()=>({chainName:"Gnosis",nativeCurrency:{decimals:n,name:"xDAI",symbol:"XDAI"}})).with(q.Optimism,()=>({chainName:"OP Mainnet",nativeCurrency:{decimals:n,name:"Ethereum",symbol:q.Ethereum}})).with(q.Polygon,()=>({chainName:"Polygon Mainnet",nativeCurrency:{decimals:n,name:"Polygon",symbol:q.Polygon}})).with(q.Robinhood,()=>({chainName:"Robinhood Chain",nativeCurrency:{decimals:n,name:"Ethereum",symbol:q.Ethereum}})).otherwise(()=>({chainName:y,nativeCurrency:{decimals:n,name:u,symbol:u}}))}async function Bt(t,y){if(!("authorize"in t))throw Error("Signer does not support EIP-7702 authorization. Requires ethers.js v6.14+");let u={...y,nonce:y.nonce!==void 0?BigInt(y.nonce):void 0};return await t.authorize(u)}var Mt=(t)=>typeof t==="string"&&/^0x[a-fA-F0-9]{64}$/.test(t),by=(t)=>{try{return typeof t==="string"&&!!Dt(t)}catch{return!1}};function My(t,y){let u=y!==void 0?`index ${y}: `:"",n=(T,l)=>{throw new K({errorKey:"toolbox_evm_invalid_eip7702_authorization",info:{field:T,message:`${u}${l}`}})};Lt(t).when(({chainId:T})=>typeof T!=="bigint",()=>n("chainId","chainId must be a bigint")).when(({address:T})=>!by(T),()=>n("address","address must be a valid checksummed address")).when(({nonce:T})=>typeof T!=="bigint"||T<0n,()=>n("nonce","nonce must be a non-negative bigint")).when(({signature:T})=>!T,()=>n("signature","signature is required")).when(({signature:T})=>typeof T?.yParity!=="number"||![0,1].includes(T.yParity),()=>n("signature.yParity","yParity must be 0 or 1")).when(({signature:T})=>!Mt(T?.r),()=>n("signature.r","r must be a 32-byte hex string")).when(({signature:T})=>!Mt(T?.s),()=>n("signature.s","s must be a 32-byte hex string")).otherwise(()=>{})}function Dy(t){return[{key:"name",type:"string"},{key:"version",type:"string"},{key:"chainId",type:"uint256"},{key:"verifyingContract",type:"address"},{key:"salt",type:"bytes32"}].filter(({key:y})=>t[y]!=null).map(({key:y,type:u})=>({name:y,type:u}))}function e(t){return t.charAt(0).toUpperCase()+t.slice(1)}function i(t,y){if(t.isTuple()&&t.components){let u=e(t.name);return y[u]=t.components.map((n)=>({name:n.name,type:i(n,y)})),u}if(t.isArray()){let u=t.arrayChildren;if(u?.isTuple()&&u.components){let n=e(t.name.replace(/s$/,""));return y[n]=u.components.map((T)=>({name:T.name,type:i(T,y)})),`${n}[]`}return`${u?.type??"bytes"}[]`}return t.type}function a(t,y){if(typeof t==="bigint")return t;if(y?.isTuple()&&typeof t?.toObject==="function"){let u=t.toObject(),n={};for(let[T,l]of(y.components??[]).entries())n[l.name]=a(u[l.name]??t[T],l);return n}if(Array.isArray(t)){let u=y?.arrayChildren;return t.map((n)=>a(n,u??void 0))}return t}function hy({chain:t,abi:y,data:u,to:n}){let l=new uy(y).parseTransaction({data:u});if(!l)throw new K({errorKey:"toolbox_evm_invalid_params",info:{error:"Could not decode calldata"}});let b={},M=e(l.name);b[M]=l.fragment.inputs.map((D)=>({name:D.name,type:i(D,b)}));let R={};for(let[D,Q]of l.fragment.inputs.entries())R[Q.name]=a(l.args[D],Q);let{chainId:B}=P(t),G={chainId:Number(B),verifyingContract:Dt(n)},X=Dy(G);return{domain:G,message:R,primaryType:M,types:{EIP712Domain:X,...b}}}function wt(t,y){if(!Array.isArray(t)||t.length===0)throw new K({errorKey:"toolbox_evm_invalid_eip7702_authorization",info:{message:"EIP-7702 transactions require at least one authorization"}});for(let[u,n]of t.entries())if(My(n,u),y!==void 0&&n.chainId!==y)throw new K({errorKey:"toolbox_evm_invalid_eip7702_authorization",info:{field:"chainId",message:`index ${u}: authorization chainId (${n.chainId}) does not match transaction chainId (${y})`}})}import{Chain as W,FeeOption as Ny}from"@swapkit/helpers";import{HDNodeWallet as Vy}from"ethers";import{match as Sy,P as Jt}from"ts-pattern";var Ht=[{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall2.Call[]",name:"calls",type:"tuple[]"}],name:"aggregate",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"},{internalType:"bytes[]",name:"returnData",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall2.Call[]",name:"calls",type:"tuple[]"}],name:"blockAndAggregate",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"},{internalType:"bytes32",name:"blockHash",type:"bytes32"},{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall2.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"}],name:"getBlockHash",outputs:[{internalType:"bytes32",name:"blockHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"getBlockNumber",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockCoinbase",outputs:[{internalType:"address",name:"coinbase",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockDifficulty",outputs:[{internalType:"uint256",name:"difficulty",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockGasLimit",outputs:[{internalType:"uint256",name:"gaslimit",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"getEthBalance",outputs:[{internalType:"uint256",name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastBlockHash",outputs:[{internalType:"bytes32",name:"blockHash",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bool",name:"requireSuccess",type:"bool"},{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall2.Call[]",name:"calls",type:"tuple[]"}],name:"tryAggregate",outputs:[{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall2.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bool",name:"requireSuccess",type:"bool"},{components:[{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"callData",type:"bytes"}],internalType:"struct Multicall2.Call[]",name:"calls",type:"tuple[]"}],name:"tryBlockAndAggregate",outputs:[{internalType:"uint256",name:"blockNumber",type:"uint256"},{internalType:"bytes32",name:"blockHash",type:"bytes32"},{components:[{internalType:"bool",name:"success",type:"bool"},{internalType:"bytes",name:"returnData",type:"bytes"}],internalType:"struct Multicall2.Result[]",name:"returnData",type:"tuple[]"}],stateMutability:"nonpayable",type:"function"}];import{AssetValue as Ly,applyFeeMultiplierToBigInt as $,Chain as k,EVMChains as Ry,FeeOption as L,isGasAsset as qy,SwapKitError as H,SwapKitNumber as m}from"@swapkit/helpers";import{erc20ABI as x}from"@swapkit/helpers/contracts";import{BrowserProvider as Gy,Contract as Ut,getAddress as p,Interface as Qt}from"ethers";import{match as Xt}from"ts-pattern";function C(t){return{getBalance:Wt(t)}}function iy(t){return t}var tt=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function c({chain:t=k.Ethereum,provider:y,signer:u,isEIP1559Compatible:n=!0}){return{approve:Zy({chain:t,isEIP1559Compatible:n,provider:y,signer:u}),approvedAmount:Yt({chain:t,provider:y}),broadcastTransaction:y.broadcastTransaction,call:ut({chain:t,isEIP1559Compatible:n,provider:y,signer:u}),createApprovalTx:_y({chain:t,provider:y,signer:u}),createContract:wy({chain:t,provider:y}),createContractTxObject:F({chain:t,provider:y}),createTransaction:r({chain:t,provider:y,signer:u}),createTransferTx:r({chain:t,provider:y,signer:u}),EIP1193SendTransaction:h(y),estimateCall:Zt({provider:y,signer:u}),estimateGasLimit:zy({chain:t,provider:y,signer:u}),estimateGasPrices:A({chain:t,isEIP1559Compatible:n,provider:y}),estimateTransactionFee:jy({chain:t,isEIP1559Compatible:n,provider:y}),getAddress:()=>{return u?u.getAddress():void 0},getBalance:C(t).getBalance,getNetworkParams:qt(t),isApproved:Yy({chain:t,provider:y}),sendTransaction:zt({chain:t,isEIP1559Compatible:n,provider:y,signer:u}),signAuthorization:Jy({signer:u}),signMessage:u?(T)=>u.signMessage(T):void 0,signTypedData:u?({domain:T,types:l,value:b})=>u.signTypedData(T,l,b):void 0,transfer:$y({chain:t,isEIP1559Compatible:n,provider:y,signer:u}),validateAddress:By}}function By(t){try{return p(t),!0}catch{return!1}}function v(t){return t instanceof Gy}function yt(t,y,u){return new Ut(t,Qt.from(y),u)}function wy({provider:t}){return function(u,n){return new Ut(u,Qt.from(n),t)}}var Hy=["payable","nonpayable"];function Wy({abi:t,funcName:y}){let u=t.find((n)=>n.name===y);if(!u)throw new H("toolbox_evm_no_abi_fragment",{funcName:y});return u.stateMutability&&Hy.includes(u.stateMutability)}function lu(t){return p(t)}function h(t){return function({value:u,...n}){if(!v(t))throw new H("toolbox_evm_provider_not_eip1193_compatible");let{gasLimit:T,gasPrice:l,maxFeePerGas:b,maxPriorityFeePerGas:M,...R}=n;return t.send("eth_sendTransaction",[{...R,value:N(BigInt(u||0))}])}}function bu(t,y){let u=d(t,y);if(u)return p(u.toLowerCase());throw new H("toolbox_evm_invalid_gas_asset_address")}var Uy=Ry.reduce((t,y)=>{return t[y]="0x0000000000000000000000000000000000000000",t},{}),Qy={...Uy,[k.Optimism]:"0x4200000000000000000000000000000000000042",[k.Polygon]:"0x0000000000000000000000000000000000001010"},Xy=[k.Arbitrum,k.Aurora,k.Base,k.Optimism,k.Robinhood];function d({chain:t,symbol:y,ticker:u},n){try{let T=t===k.BinanceSmartChain&&y==="BNB"&&u==="BNB",l=t===k.Hyperevm&&y==="HYPE"&&u==="HYPE",b=t===n&&y===n&&u===n,M=Xy.includes(t)&&y==="ETH"&&u==="ETH";if(b||T||l||M)return Qy[n];return p(y.slice(u.length+1).replace(/^0X/,""))}catch{return null}}function F({provider:t}){return async({contractAddress:y,abi:u,funcName:n,funcParams:T=[],txOverrides:l})=>{let b=await yt(y,u,t).getFunction(n).populateTransaction(...T.concat(l).filter((M)=>typeof M<"u"));return{...b,value:N(BigInt(b.value||0))}}}function A({chain:t,provider:y,isEIP1559Compatible:u=!0}){return Xt(t).with(k.Gnosis,()=>{return async function(){try{let{gasPrice:T,maxPriorityFeePerGas:l}=await y.getFeeData();if(!T||l===null)throw new H("toolbox_evm_no_fee_data");return{[L.Average]:{maxFeePerGas:$(T,L.Average),maxPriorityFeePerGas:$(l,L.Average)},[L.Fast]:{maxFeePerGas:$(T,L.Fast),maxPriorityFeePerGas:$(l,L.Fast)},[L.Fastest]:{maxFeePerGas:$(T,L.Fastest),maxPriorityFeePerGas:$(l,L.Fastest)}}}catch(T){throw new H("toolbox_evm_gas_estimation_error",{error:T.msg??T.toString()})}}}).with(k.Arbitrum,()=>{return async function(){try{let{gasPrice:T}=await y.getFeeData();if(!T)throw new H("toolbox_evm_no_fee_data");let l=T*12n/10n;return{[L.Average]:{gasPrice:l},[L.Fast]:{gasPrice:$(l,L.Fast)},[L.Fastest]:{gasPrice:$(l,L.Fastest)}}}catch(T){throw new H("toolbox_evm_gas_estimation_error",{error:T.msg??T.toString()})}}}).otherwise(()=>{return async function(){try{let{maxFeePerGas:T,maxPriorityFeePerGas:l,gasPrice:b}=await y.getFeeData();if(u){if(T===null||l===null)throw new H("toolbox_evm_no_fee_data");return{[L.Average]:{maxFeePerGas:T,maxPriorityFeePerGas:l},[L.Fast]:{maxFeePerGas:$(T,L.Fast),maxPriorityFeePerGas:$(l,L.Fast)},[L.Fastest]:{maxFeePerGas:$(T,L.Fastest),maxPriorityFeePerGas:$(l,L.Fastest)}}}if(!b)throw new H("toolbox_evm_no_gas_price");return{[L.Average]:{gasPrice:b},[L.Fast]:{gasPrice:$(b,L.Fast)},[L.Fastest]:{gasPrice:$(b,L.Fastest)}}}catch(T){throw new H("toolbox_evm_gas_estimation_error",{error:T.msg??T.toString()})}}})}function ut({provider:t,isEIP1559Compatible:y,signer:u,chain:n}){return async function({callProvider:l,contractAddress:b,abi:M,funcName:R,funcParams:B=[],txOverrides:G={},feeOption:X=L.Fast}){let D=l||t;if(!b)throw new H("toolbox_evm_invalid_params",{error:"contractAddress must be provided"});let Q=Wy({abi:M,funcName:R});if(Q&&v(D)&&u){let z=F({chain:n,provider:D}),_=G?.from||await u?.getAddress(),f=await z({abi:M,contractAddress:b,funcName:R,funcParams:B,txOverrides:{...G,from:_}});return h(D)(f)}let Y=yt(b,M,D);if(Q){if(!u)throw new H("toolbox_evm_no_signer");let z=G?.from||await u.getAddress();if(!z)throw new H("toolbox_evm_no_signer_address");let _=Y.connect(u),f=A({chain:n,isEIP1559Compatible:y,provider:t}),{maxFeePerGas:V,maxPriorityFeePerGas:E,gasPrice:o}=(await f())[X],O=await Y.getFunction(R).estimateGas(...B,G),J=await _[R](...B,{...G,gasLimit:O,gasPrice:o,maxFeePerGas:V,maxPriorityFeePerGas:E,nonce:G?.nonce||await D.getTransactionCount(z)});return typeof J?.hash==="string"?J?.hash:J}let Z=await Y[R]?.(...B);return typeof Z?.hash==="string"?Z?.hash:Z}}function Yt({provider:t,chain:y}){return function({assetAddress:n,spenderAddress:T,from:l}){return ut({chain:y,isEIP1559Compatible:!0,provider:t})({abi:x,contractAddress:n,funcName:"allowance",funcParams:[l,T]})}}function Yy({provider:t,chain:y}){return async function({assetAddress:n,spenderAddress:T,from:l,amount:b=tt}){let M=await Yt({chain:y,provider:t})({assetAddress:n,from:l,spenderAddress:T});return m.fromBigInt(M).gte(m.fromBigInt(BigInt(b)))}}function Zy({signer:t,isEIP1559Compatible:y=!0,provider:u,chain:n}){return async function({assetAddress:l,spenderAddress:b,feeOptionKey:M=L.Fast,amount:R,gasLimitFallback:B,from:G,nonce:X}){let D=[b,BigInt(R||tt)],Q=await t?.getAddress()||G,Y={abi:x,contractAddress:l,funcName:"approve",funcParams:D,signer:t,txOverrides:{from:Q}};if(v(u)){let z=F({chain:n,provider:u}),_=h(u),f=await z(Y);return _(f)}return ut({chain:n,isEIP1559Compatible:y,provider:u,signer:t})({...Y,feeOption:M,funcParams:D,txOverrides:{from:Q,gasLimit:B?BigInt(B.toString()):void 0,nonce:X}})}}function $y({signer:t,isEIP1559Compatible:y=!0,provider:u}){return async function({assetValue:T,memo:l,recipient:b,feeOptionKey:M=L.Fast,sender:R,...B}){let{hexlify:G,toUtf8Bytes:X}=await import("ethers"),D=T.getBaseValue("bigint"),Q=T.chain,Y=R||await t?.getAddress(),Z=zt({chain:Q,isEIP1559Compatible:y,provider:u,signer:t});if(!Y)throw new H("toolbox_evm_no_from_address");if(T.isGasAsset){let o={...B,data:G(X(l||"")),feeOptionKey:M,from:Y,to:b,value:N(D)};return Z(o)}if(!d(T,Q))throw new H("toolbox_evm_no_contract_address");let{maxFeePerGas:_,maxPriorityFeePerGas:f,gasPrice:V}=(await A({chain:Q,isEIP1559Compatible:y,provider:u})())[M],E=await r({chain:Q,provider:u,signer:t})({assetValue:T,data:G(X(l||"")),gasPrice:V,maxFeePerGas:_,maxPriorityFeePerGas:f,memo:l,recipient:b,sender:Y});return Z(E)}}function Zt({provider:t,signer:y}){return function({contractAddress:n,abi:T,funcName:l,funcParams:b=[],txOverrides:M}){if(!n)throw new H("toolbox_evm_no_contract_address");let R=yt(n,T,t);return y?R.connect(y).getFunction(l).estimateGas(...b,M):R.getFunction(l).estimateGas(...b,M)}}function zy({provider:t,signer:y}){return async function({assetValue:n,recipient:T,memo:l,data:b,sender:M,funcName:R,funcParams:B,txOverrides:G}){let X=n.bigIntValue,D=n.isGasAsset?null:d(n,n.chain);if(D&&R)return Zt({provider:t,signer:y})({abi:x,contractAddress:D,funcName:R,funcParams:B,txOverrides:G});let{hexlify:Q,toUtf8Bytes:Y}=await import("ethers");return t.estimateGas({data:b?b:l?Q(Y(l)):void 0,from:M,to:T,value:X})}}function Jy({signer:t}){if(!t)return;return(y)=>Bt(t,y)}var $t=(t)=>t.type===4||(t.authorizations?.length??0)>0,fy=(t)=>!$t(t)&&(t.type===2||!!t.maxFeePerGas||!!t.maxPriorityFeePerGas),ky=(t,y=!0)=>{if($t(t))return"eip7702";if(fy(t)||y)return"eip1559";return"legacy"};function zt({provider:t,signer:y,isEIP1559Compatible:u=!0,chain:n}){return async function({feeOptionKey:l=L.Fast,...b}){let{from:M,to:R,data:B,value:G,...X}=b;if(!y)throw new H("toolbox_evm_no_signer");if(!R)throw new H("toolbox_evm_no_to_address");let D={...X,data:B||"0x",from:M,to:R,value:BigInt(G||0)};if(v(t))return h(t)(D);let Q=M||await y.getAddress(),Y=b.nonce||await t.getTransactionCount(Q),Z=(await t.getNetwork()).chainId,z=ky(D,u);if(z==="eip7702")wt(D.authorizations||[],Z);let _=Xt(z).with("eip7702",()=>4).with("eip1559",()=>2).otherwise(()=>0),f={...D,chainId:Z,nonce:Y,type:_,...z==="eip7702"&&{authorizationList:D.authorizations}},V=A({chain:n,isEIP1559Compatible:u,provider:t}),o=z!=="legacy"&&!(D.maxFeePerGas&&D.maxPriorityFeePerGas)||!D.gasPrice?Object.entries((await V())[l]).reduce((J,[I,bt])=>({...J,[I]:N(BigInt(bt))}),{}):{},O;try{O=N(D.gasLimit?BigInt(D.gasLimit):await t.estimateGas(f)*11n/10n)}catch(J){throw new H("toolbox_evm_error_estimating_gas_limit",{error:J})}try{let J={...f,gasLimit:O,...o};try{return(await y.sendTransaction(J)).hash}catch{let I=await y.signTransaction({...J,from:Q});return(await t.broadcastTransaction(I)).hash}}catch(J){throw new H("toolbox_evm_error_sending_transaction",{error:J})}}}function r({provider:t,signer:y}){return async function({assetValue:n,memo:T,recipient:l,data:b,sender:M,maxFeePerGas:R,maxPriorityFeePerGas:B,gasPrice:G,...X}){let D=n.getBaseValue("bigint"),Q=n.chain,Y=M||await y?.getAddress();if(!Y)throw new H("toolbox_evm_no_from_address");if(qy(n)){let{hexlify:_,toUtf8Bytes:f}=await import("ethers");return{...X,data:b||_(f(T||"")),from:Y,to:l,value:N(D)}}let Z=d(n,Q);if(!Z)throw new H("toolbox_evm_no_contract_address");return F({chain:n.chain,provider:t})({abi:x,contractAddress:Z,funcName:"transfer",funcParams:[l,D],txOverrides:{from:Y,gasPrice:G,maxFeePerGas:R,maxPriorityFeePerGas:B}})}}function _y({provider:t,signer:y,chain:u}){return async function({assetAddress:T,spenderAddress:l,amount:b,from:M}){let R=await y?.getAddress()||M,B=F({chain:u,provider:t}),G=["bigint","number"].includes(typeof b)?b:b||tt;return await B({abi:x,contractAddress:T,funcName:"approve",funcParams:[l,BigInt(G)],txOverrides:{from:R}})}}function jy({provider:t,isEIP1559Compatible:y=!0,chain:u}){return async function({feeOption:T=L.Fast,...l}){let M=await A({chain:u,isEIP1559Compatible:y,provider:t})(),R=await t.estimateGas(l),B=Ly.from({chain:u}),{gasPrice:G,maxFeePerGas:X,maxPriorityFeePerGas:D}=M[T];if(!y&&G)return B.set(m.fromBigInt(G*R,B.decimal));if(X&&D){let Q=(X+D)*R;return B.set(m.fromBigInt(Q,B.decimal))}throw new H("toolbox_evm_no_gas_price")}}function ft(t){let y=U(W.Ethereum)(t);async function u(n,T="0x5ba1e12693dc8f9c48aad8770482f4739beed696",l="aggregate",b=Ny.Fast){let M=await y.createContractTxObject({abi:Ht,contractAddress:T,funcName:l,funcParams:[n]});return y.sendTransaction({...M,feeOptionKey:b})}return{...y,multicall:u}}var kt=U(W.Adi),_t=U(W.Arbitrum),jt=U(W.Aurora),Nt=U(W.Avalanche),Vt=U(W.Base),St=U(W.Berachain),ot=U(W.BinanceSmartChain),wu=U(W.Botanix),Kt=U(W.Core),xt=U(W.Corn),Ft=U(W.Cronos),At=U(W.Gnosis),Et=U(W.Robinhood),Ot=U(W.Hyperevm),It=U(W.Linea),Pt=U(W.Polygon),Ct=U(W.MegaETH),mt=U(W.Monad),gt=U(W.Plasma),nt=U(W.Sonic),pt=U(W.Unichain),ct=U(W.XLayer);function U(t){return function({provider:u,...n}){let T=Gt(t),l=Sy(n).with({phrase:Jt.string},({phrase:M})=>Vy.fromPhrase(M).connect(u)).with({signer:Jt.any},({signer:M})=>M).otherwise(()=>{return});return c({chain:t,isEIP1559Compatible:T,provider:u,signer:l})}}import{applyFeeMultiplierToBigInt as S,Chain as Ky,FeeOption as j,SwapKitError as Tt}from"@swapkit/helpers";import{Contract as xy,HDNodeWallet as Fy}from"ethers";import{match as Ay,P as ht}from"ts-pattern";var vt=[{inputs:[{internalType:"address",name:"_owner",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"",type:"uint256"}],name:"DecimalsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"",type:"uint256"}],name:"GasPriceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"",type:"uint256"}],name:"L1BaseFeeUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"",type:"uint256"}],name:"OverheadUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"",type:"uint256"}],name:"ScalarUpdated",type:"event"},{inputs:[],name:"decimals",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"gasPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"getL1Fee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"getL1GasUsed",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"l1BaseFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"overhead",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"scalar",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_decimals",type:"uint256"}],name:"setDecimals",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_gasPrice",type:"uint256"}],name:"setGasPrice",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_baseFee",type:"uint256"}],name:"setL1BaseFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_overhead",type:"uint256"}],name:"setOverhead",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_scalar",type:"uint256"}],name:"setScalar",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}];var Ey="0x420000000000000000000000000000000000000f";function lt(t){return new xy(Ey,vt,t)}function dt(t){return async function(){let u=lt(t);if(u&&"l1BaseFee"in u)return await u?.l1BaseFee();return}}function st(t){return async function({from:u,to:n,nonce:T,...l}){let{Transaction:b}=await import("ethers");if(!n)throw new Tt("toolbox_evm_invalid_transaction",{error:"Missing to address"});return b.from({...l,authorizationList:l.authorizationList,nonce:T?T:u?await t.getTransactionCount(u):0,to:n}).serialized}}function et(t){return async function(u){let n=lt(t),T=await st(t)(u);if(n&&"getL1Fee"in n)return n.getL1Fee(T)}}function it(t){return async function(u){let T=(await t.getFeeData()).gasPrice??0n,l=await t.estimateGas(u);return T*l}}function Oy(t){return async function(u){let n=await et(t)(u)??0n,T=await it(t)(u);return n+T}}function Iy(t){return async function(u){let n=lt(t),T=await st(t)(u);if(n&&"getL1GasUsed"in n)return n.getL1GasUsed(T)}}function Py(t){return async function(){try{let{maxFeePerGas:u,maxPriorityFeePerGas:n,gasPrice:T}=await t.getFeeData(),l=await dt(t)(),b=T;if(!(u&&n))throw new Tt("toolbox_evm_no_fee_data");return{[j.Average]:{gasPrice:b,l1GasPrice:l,maxFeePerGas:u,maxPriorityFeePerGas:n},[j.Fast]:{gasPrice:S(b,j.Fast),l1GasPrice:S(l||0n,j.Fast),maxFeePerGas:u,maxPriorityFeePerGas:S(n,j.Fast)},[j.Fastest]:{gasPrice:S(b,j.Fastest),l1GasPrice:S(l||0n,j.Fastest),maxFeePerGas:u,maxPriorityFeePerGas:S(n,j.Fastest)}}}catch(u){throw new Tt("toolbox_evm_gas_estimation_error",{error:u.msg??u.toString()})}}}function at({provider:t,...y}){let u=Ay(y).with({phrase:ht.string},({phrase:l})=>Fy.fromPhrase(l).connect(t)).with({signer:ht.any},({signer:l})=>l).otherwise(()=>{return}),n=c({provider:t,signer:u}),T=dt(t);return{...n,estimateGasPrices:Py(t),estimateL1Gas:Iy(t),estimateL1GasCost:et(t),estimateL2GasCost:it(t),estimateTotalGasCost:Oy(t),getBalance:C(Ky.Optimism).getBalance,getL1GasPrice:T}}function my(t,y){return Cy(t).with(w.Adi,()=>kt(y)).with(w.Arbitrum,()=>_t(y)).with(w.Aurora,()=>jt(y)).with(w.Avalanche,()=>Nt(y)).with(w.Base,()=>Vt(y)).with(w.Berachain,()=>St(y)).with(w.BinanceSmartChain,()=>ot(y)).with(w.Botanix,()=>nt(y)).with(w.Core,()=>Kt(y)).with(w.Corn,()=>xt(y)).with(w.Cronos,()=>Ft(y)).with(w.Ethereum,()=>ft(y)).with(w.Gnosis,()=>At(y)).with(w.Hyperevm,()=>Ot(y)).with(w.Linea,()=>It(y)).with(w.MegaETH,()=>Ct(y)).with(w.Monad,()=>mt(y)).with(w.Optimism,()=>at(y)).with(w.Plasma,()=>gt(y)).with(w.Polygon,()=>Pt(y)).with(w.Robinhood,()=>Et(y)).with(w.Sonic,()=>nt(y)).with(w.Unichain,()=>pt(y)).with(w.XLayer,()=>ct(y)).exhaustive()}async function _u(t,y){let u={...y,provider:y?.provider||Rt(t)};return my(t,u)}
2
- export{C as b,iy as c,Ty as d,vy as e,Rt as f,N as g,qt as h,Gt as i,Bt as j,My as k,Dy as l,hy as m,wt as n,tt as o,c as p,By as q,v as r,yt as s,wy as t,Wy as u,lu as v,h as w,bu as x,Qy as y,d as z,F as A,A as B,$t as C,fy as D,ky as E,ft as F,kt as G,_t as H,jt as I,Nt as J,Vt as K,St as L,ot as M,wu as N,Kt as O,xt as P,Ft as Q,At as R,Et as S,Ot as T,It as U,Pt as V,Ct as W,mt as X,gt as Y,nt as Z,pt as _,ct as $,at as aa,my as ba,_u as ca};
@@ -1 +0,0 @@
1
- import{$ as N,A as m,B as n,C as o,D as p,E as q,F as r,G as s,H as t,I as u,J as v,K as w,L as x,M as y,N as z,O as A,P as B,Q as C,R as D,S as E,T as F,U as G,V as H,W as I,X as J,Y as K,Z as L,_ as M,aa as O,ba as P,ca as Q,o as a,p as b,q as c,r as d,s as e,t as f,u as g,v as h,w as i,x as j,y as k,z as l}from"./chunk-6b99avsd.js";import"./chunk-jdh5asaw.js";import"./chunk-fjyc6m34.js";export{c as validateEVMAddress,h as toChecksumAddress,g as isStateChangingCall,o as isEIP7702Transaction,p as isEIP1559Transaction,d as isBrowserProvider,l as getTokenAddress,Q as getEvmToolboxAsync,P as getEvmToolbox,n as getEstimateGasPrices,q as getEVMTxType,i as getEIP1193SendTransaction,m as getCreateContractTxObject,f as getCreateContract,j as getChecksumAddressFromAsset,e as createContract,N as XLayerToolbox,M as UNIToolbox,L as SONICToolbox,K as PLASMAToolbox,O as OPToolbox,J as MONADToolbox,I as MEGAETHToolbox,a as MAX_APPROVAL,H as MATICToolbox,G as LINEAToolbox,F as HYPEREVMToolbox,E as HOODToolbox,D as GNOToolbox,r as ETHToolbox,k as ContractAddress,C as CROToolbox,B as CORNToolbox,A as COREToolbox,z as BotanixToolbox,b as BaseEVMToolbox,y as BSCToolbox,x as BERAToolbox,w as BASEToolbox,v as AVAXToolbox,u as AURORAToolbox,t as ARBToolbox,s as ADIToolbox};