essential-eth 0.5.6 → 0.5.10-next.2

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 (196) hide show
  1. package/{lib/esm → dist}/classes/Contract.d.ts +11 -11
  2. package/dist/classes/test/Contract/crv-abi.d.ts +2 -0
  3. package/dist/classes/test/Contract/ens-abi.d.ts +2 -0
  4. package/dist/classes/test/Contract/fei-abi.d.ts +2 -0
  5. package/dist/classes/test/Contract/foo-abi.d.ts +2 -0
  6. package/dist/classes/test/Contract/uniswap-abi.d.ts +2 -0
  7. package/dist/classes/utils/clean-block.d.ts +3 -0
  8. package/dist/classes/utils/clean-log.d.ts +2 -0
  9. package/{lib/esm → dist}/classes/utils/clean-transaction-receipt.d.ts +2 -2
  10. package/{lib/esm → dist}/classes/utils/clean-transaction.d.ts +2 -2
  11. package/{lib/cjs → dist}/classes/utils/encode-decode-transaction.d.ts +4 -4
  12. package/{lib/cjs → dist}/classes/utils/fetchers.d.ts +9 -9
  13. package/{lib/esm → dist}/classes/utils/hex-to-decimal.d.ts +1 -1
  14. package/dist/classes/utils/prepare-transaction.d.ts +2 -0
  15. package/dist/index.cjs +2 -0
  16. package/dist/index.cjs.map +1 -0
  17. package/{lib/cjs → dist}/index.d.ts +25 -25
  18. package/dist/index.js +2 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/index.modern.js +2 -0
  21. package/dist/index.modern.js.map +1 -0
  22. package/dist/index.modern.mjs +2 -0
  23. package/dist/index.modern.mjs.map +1 -0
  24. package/dist/index.module.js +2 -0
  25. package/dist/index.module.js.map +1 -0
  26. package/dist/index.umd.js +2 -0
  27. package/dist/index.umd.js.map +1 -0
  28. package/{lib/esm → dist}/logger/logger.d.ts +11 -11
  29. package/dist/logger/package-version.d.ts +1 -0
  30. package/{lib/esm → dist}/providers/BaseProvider.d.ts +24 -21
  31. package/{lib/esm → dist}/providers/FallthroughProvider.d.ts +11 -11
  32. package/{lib/esm → dist}/providers/JsonRpcProvider.d.ts +7 -7
  33. package/{lib/cjs → dist}/providers/test/rpc-urls.d.ts +11 -11
  34. package/{lib/esm → dist}/providers/utils/chains-info.d.ts +467 -412
  35. package/{lib/cjs → dist}/shared/tiny-big/helpers.d.ts +1 -1
  36. package/{lib/esm → dist}/shared/tiny-big/tiny-big.d.ts +10 -10
  37. package/{lib/cjs → dist}/shared/validate-type.d.ts +3 -3
  38. package/{lib/cjs → dist}/types/Block.types.d.ts +40 -37
  39. package/{lib/cjs → dist}/types/Contract.types.d.ts +24 -24
  40. package/dist/types/Filter.types.d.ts +12 -0
  41. package/{lib/esm → dist}/types/Network.types.d.ts +5 -5
  42. package/{lib/cjs → dist}/types/Transaction.types.d.ts +113 -96
  43. package/{lib/esm → dist}/utils/bytes.d.ts +40 -40
  44. package/{lib/esm → dist}/utils/compute-address.d.ts +1 -1
  45. package/{lib/esm → dist}/utils/compute-public-key.d.ts +2 -2
  46. package/{lib/esm → dist}/utils/ether-to-gwei.d.ts +3 -3
  47. package/dist/utils/ether-to-wei.d.ts +3 -0
  48. package/dist/utils/gwei-to-ether.d.ts +3 -0
  49. package/{lib/esm → dist}/utils/hash-message.d.ts +2 -2
  50. package/{lib/esm → dist}/utils/is-address.d.ts +1 -1
  51. package/dist/utils/keccak256.d.ts +2 -0
  52. package/{lib/esm → dist}/utils/solidity-keccak256.d.ts +2 -2
  53. package/{lib/esm → dist}/utils/split-signature.d.ts +2 -2
  54. package/{lib/esm → dist}/utils/to-checksum-address.d.ts +1 -1
  55. package/{lib/cjs → dist}/utils/to-utf8-bytes.d.ts +1 -1
  56. package/dist/utils/wei-to-ether.d.ts +3 -0
  57. package/package.json +66 -19
  58. package/readme.md +643 -291
  59. package/lib/cjs/classes/Contract.d.ts +0 -72
  60. package/lib/cjs/classes/Contract.js +0 -129
  61. package/lib/cjs/classes/test/Contract/crv-abi.d.ts +0 -2
  62. package/lib/cjs/classes/test/Contract/crv-abi.js +0 -488
  63. package/lib/cjs/classes/test/Contract/ens-abi.d.ts +0 -2
  64. package/lib/cjs/classes/test/Contract/ens-abi.js +0 -453
  65. package/lib/cjs/classes/test/Contract/fei-abi.d.ts +0 -2
  66. package/lib/cjs/classes/test/Contract/fei-abi.js +0 -526
  67. package/lib/cjs/classes/test/Contract/foo-abi.d.ts +0 -2
  68. package/lib/cjs/classes/test/Contract/foo-abi.js +0 -42
  69. package/lib/cjs/classes/test/Contract/uniswap-abi.d.ts +0 -2
  70. package/lib/cjs/classes/test/Contract/uniswap-abi.js +0 -121
  71. package/lib/cjs/classes/utils/clean-block.d.ts +0 -6
  72. package/lib/cjs/classes/utils/clean-block.js +0 -47
  73. package/lib/cjs/classes/utils/clean-transaction-receipt.d.ts +0 -5
  74. package/lib/cjs/classes/utils/clean-transaction-receipt.js +0 -55
  75. package/lib/cjs/classes/utils/clean-transaction.d.ts +0 -5
  76. package/lib/cjs/classes/utils/clean-transaction.js +0 -42
  77. package/lib/cjs/classes/utils/encode-decode-transaction.js +0 -113
  78. package/lib/cjs/classes/utils/fetchers.js +0 -51
  79. package/lib/cjs/classes/utils/hex-to-decimal.d.ts +0 -5
  80. package/lib/cjs/classes/utils/hex-to-decimal.js +0 -11
  81. package/lib/cjs/index.js +0 -55
  82. package/lib/cjs/logger/logger.d.ts +0 -11
  83. package/lib/cjs/logger/logger.js +0 -36
  84. package/lib/cjs/logger/package-version.d.ts +0 -1
  85. package/lib/cjs/logger/package-version.js +0 -5
  86. package/lib/cjs/providers/BaseProvider.d.ts +0 -304
  87. package/lib/cjs/providers/BaseProvider.js +0 -405
  88. package/lib/cjs/providers/FallthroughProvider.d.ts +0 -24
  89. package/lib/cjs/providers/FallthroughProvider.js +0 -65
  90. package/lib/cjs/providers/JsonRpcProvider.d.ts +0 -27
  91. package/lib/cjs/providers/JsonRpcProvider.js +0 -40
  92. package/lib/cjs/providers/test/rpc-urls.js +0 -14
  93. package/lib/cjs/providers/types.d.ts +0 -7
  94. package/lib/cjs/providers/types.js +0 -2
  95. package/lib/cjs/providers/utils/chains-info.d.ts +0 -412
  96. package/lib/cjs/providers/utils/chains-info.js +0 -1237
  97. package/lib/cjs/shared/tiny-big/helpers.js +0 -71
  98. package/lib/cjs/shared/tiny-big/tiny-big.d.ts +0 -32
  99. package/lib/cjs/shared/tiny-big/tiny-big.js +0 -71
  100. package/lib/cjs/shared/validate-type.js +0 -9
  101. package/lib/cjs/types/Block.types.js +0 -2
  102. package/lib/cjs/types/Contract.types.js +0 -2
  103. package/lib/cjs/types/Network.types.d.ts +0 -8
  104. package/lib/cjs/types/Network.types.js +0 -2
  105. package/lib/cjs/types/Transaction.types.js +0 -2
  106. package/lib/cjs/utils/bytes.d.ts +0 -172
  107. package/lib/cjs/utils/bytes.js +0 -564
  108. package/lib/cjs/utils/compute-address.d.ts +0 -8
  109. package/lib/cjs/utils/compute-address.js +0 -24
  110. package/lib/cjs/utils/compute-public-key.d.ts +0 -9
  111. package/lib/cjs/utils/compute-public-key.js +0 -17
  112. package/lib/cjs/utils/ether-to-gwei.d.ts +0 -26
  113. package/lib/cjs/utils/ether-to-gwei.js +0 -34
  114. package/lib/cjs/utils/ether-to-wei.d.ts +0 -26
  115. package/lib/cjs/utils/ether-to-wei.js +0 -34
  116. package/lib/cjs/utils/gwei-to-ether.d.ts +0 -26
  117. package/lib/cjs/utils/gwei-to-ether.js +0 -34
  118. package/lib/cjs/utils/hash-message.d.ts +0 -12
  119. package/lib/cjs/utils/hash-message.js +0 -26
  120. package/lib/cjs/utils/is-address.d.ts +0 -24
  121. package/lib/cjs/utils/is-address.js +0 -39
  122. package/lib/cjs/utils/keccak256.d.ts +0 -2
  123. package/lib/cjs/utils/keccak256.js +0 -17
  124. package/lib/cjs/utils/solidity-keccak256.d.ts +0 -29
  125. package/lib/cjs/utils/solidity-keccak256.js +0 -118
  126. package/lib/cjs/utils/split-signature.d.ts +0 -26
  127. package/lib/cjs/utils/split-signature.js +0 -165
  128. package/lib/cjs/utils/to-checksum-address.d.ts +0 -17
  129. package/lib/cjs/utils/to-checksum-address.js +0 -46
  130. package/lib/cjs/utils/to-utf8-bytes.js +0 -7
  131. package/lib/cjs/utils/wei-to-ether.d.ts +0 -26
  132. package/lib/cjs/utils/wei-to-ether.js +0 -44
  133. package/lib/esm/classes/Contract.js +0 -65
  134. package/lib/esm/classes/test/Contract/crv-abi.d.ts +0 -2
  135. package/lib/esm/classes/test/Contract/crv-abi.js +0 -470
  136. package/lib/esm/classes/test/Contract/ens-abi.d.ts +0 -2
  137. package/lib/esm/classes/test/Contract/ens-abi.js +0 -435
  138. package/lib/esm/classes/test/Contract/fei-abi.d.ts +0 -2
  139. package/lib/esm/classes/test/Contract/fei-abi.js +0 -521
  140. package/lib/esm/classes/test/Contract/foo-abi.d.ts +0 -2
  141. package/lib/esm/classes/test/Contract/foo-abi.js +0 -33
  142. package/lib/esm/classes/test/Contract/uniswap-abi.d.ts +0 -2
  143. package/lib/esm/classes/test/Contract/uniswap-abi.js +0 -116
  144. package/lib/esm/classes/utils/clean-block.d.ts +0 -3
  145. package/lib/esm/classes/utils/clean-block.js +0 -36
  146. package/lib/esm/classes/utils/clean-transaction-receipt.js +0 -48
  147. package/lib/esm/classes/utils/clean-transaction.js +0 -33
  148. package/lib/esm/classes/utils/encode-decode-transaction.d.ts +0 -4
  149. package/lib/esm/classes/utils/encode-decode-transaction.js +0 -98
  150. package/lib/esm/classes/utils/fetchers.d.ts +0 -9
  151. package/lib/esm/classes/utils/fetchers.js +0 -43
  152. package/lib/esm/classes/utils/hex-to-decimal.js +0 -3
  153. package/lib/esm/index.d.ts +0 -25
  154. package/lib/esm/index.js +0 -21
  155. package/lib/esm/logger/logger.js +0 -33
  156. package/lib/esm/logger/package-version.d.ts +0 -1
  157. package/lib/esm/logger/package-version.js +0 -1
  158. package/lib/esm/providers/BaseProvider.js +0 -114
  159. package/lib/esm/providers/FallthroughProvider.js +0 -41
  160. package/lib/esm/providers/JsonRpcProvider.js +0 -15
  161. package/lib/esm/providers/test/rpc-urls.d.ts +0 -11
  162. package/lib/esm/providers/test/rpc-urls.js +0 -11
  163. package/lib/esm/providers/types.d.ts +0 -7
  164. package/lib/esm/providers/types.js +0 -1
  165. package/lib/esm/providers/utils/chains-info.js +0 -1233
  166. package/lib/esm/shared/tiny-big/helpers.d.ts +0 -1
  167. package/lib/esm/shared/tiny-big/helpers.js +0 -58
  168. package/lib/esm/shared/tiny-big/tiny-big.js +0 -41
  169. package/lib/esm/shared/validate-type.d.ts +0 -3
  170. package/lib/esm/shared/validate-type.js +0 -5
  171. package/lib/esm/types/Block.types.d.ts +0 -36
  172. package/lib/esm/types/Block.types.js +0 -1
  173. package/lib/esm/types/Contract.types.d.ts +0 -24
  174. package/lib/esm/types/Contract.types.js +0 -1
  175. package/lib/esm/types/Network.types.js +0 -1
  176. package/lib/esm/types/Transaction.types.d.ts +0 -87
  177. package/lib/esm/types/Transaction.types.js +0 -1
  178. package/lib/esm/utils/bytes.js +0 -245
  179. package/lib/esm/utils/compute-address.js +0 -11
  180. package/lib/esm/utils/compute-public-key.js +0 -6
  181. package/lib/esm/utils/ether-to-gwei.js +0 -7
  182. package/lib/esm/utils/ether-to-wei.d.ts +0 -3
  183. package/lib/esm/utils/ether-to-wei.js +0 -7
  184. package/lib/esm/utils/gwei-to-ether.d.ts +0 -3
  185. package/lib/esm/utils/gwei-to-ether.js +0 -7
  186. package/lib/esm/utils/hash-message.js +0 -12
  187. package/lib/esm/utils/is-address.js +0 -12
  188. package/lib/esm/utils/keccak256.d.ts +0 -2
  189. package/lib/esm/utils/keccak256.js +0 -13
  190. package/lib/esm/utils/solidity-keccak256.js +0 -85
  191. package/lib/esm/utils/split-signature.js +0 -126
  192. package/lib/esm/utils/to-checksum-address.js +0 -25
  193. package/lib/esm/utils/to-utf8-bytes.d.ts +0 -1
  194. package/lib/esm/utils/to-utf8-bytes.js +0 -3
  195. package/lib/esm/utils/wei-to-ether.d.ts +0 -3
  196. package/lib/esm/utils/wei-to-ether.js +0 -16
@@ -1,11 +1,11 @@
1
- import { JsonRpcProvider } from '../providers/JsonRpcProvider';
2
- import { ContractInterface } from '../types/Contract.types';
3
- export declare class BaseContract {
4
- private readonly _address;
5
- private readonly _provider;
6
- constructor(addressOrName: string, contractInterface: ContractInterface, signerOrProvider: JsonRpcProvider);
7
- }
8
- export declare function defineReadOnly<T>(object: T, name: string, value: any): void;
9
- export declare class Contract extends BaseContract {
10
- readonly [key: string]: any;
11
- }
1
+ import type { JsonRpcProvider } from '../providers/JsonRpcProvider';
2
+ import type { ContractInterface } from '../types/Contract.types';
3
+ export declare class BaseContract {
4
+ private readonly _address;
5
+ private readonly _provider;
6
+ constructor(addressOrName: string, contractInterface: ContractInterface, signerOrProvider: JsonRpcProvider);
7
+ }
8
+ export declare function defineReadOnly<T>(object: T, name: string, value: any): void;
9
+ export declare class Contract extends BaseContract {
10
+ readonly [key: string]: any;
11
+ }
@@ -0,0 +1,2 @@
1
+ import type { JSONABI } from '../../../types/Contract.types';
2
+ export declare const abi: JSONABI;
@@ -0,0 +1,2 @@
1
+ import type { JSONABI } from '../../..';
2
+ export declare const ensABI: JSONABI;
@@ -0,0 +1,2 @@
1
+ import type { JSONABI } from '../../../types/Contract.types';
2
+ export declare const feiABI: JSONABI;
@@ -0,0 +1,2 @@
1
+ import type { JSONABI } from '../../..';
2
+ export declare const fooABI: JSONABI;
@@ -0,0 +1,2 @@
1
+ import type { JSONABI } from '../../../types/Contract.types';
2
+ export declare const uniswapABI: JSONABI;
@@ -0,0 +1,3 @@
1
+ import type { BlockResponse } from '../..';
2
+ import type { RPCBlock } from '../../types/Block.types';
3
+ export declare function cleanBlock(block: RPCBlock, returnTransactionObjects: boolean): BlockResponse;
@@ -0,0 +1,2 @@
1
+ import type { Log, RPCLog } from './../../types/Transaction.types';
2
+ export declare function cleanLog(log: RPCLog, receiptLog: boolean): Log;
@@ -1,2 +1,2 @@
1
- import { RPCTransactionReceipt, TransactionReceipt } from '../../types/Transaction.types';
2
- export declare function cleanTransactionReceipt(transactionReceipt: RPCTransactionReceipt): TransactionReceipt;
1
+ import type { RPCTransactionReceipt, TransactionReceipt } from '../../types/Transaction.types';
2
+ export declare function cleanTransactionReceipt(transactionReceipt: RPCTransactionReceipt): TransactionReceipt;
@@ -1,2 +1,2 @@
1
- import { RPCTransaction, TransactionResponse } from '../../types/Transaction.types';
2
- export declare function cleanTransaction(transaction: RPCTransaction): TransactionResponse;
1
+ import type { RPCTransaction, TransactionResponse } from '../../types/Transaction.types';
2
+ export declare function cleanTransaction(transaction: RPCTransaction): TransactionResponse;
@@ -1,4 +1,4 @@
1
- import { JSONABIArgument } from '../../types/Contract.types';
2
- export declare const hexFalse: string;
3
- export declare function encodeData(jsonABIArgument: JSONABIArgument, args: any[]): string;
4
- export declare function decodeRPCResponse(jsonABIArgument: JSONABIArgument, nodeResponse: string): string | number | boolean | import("../..").TinyBig | (string | number | boolean | import("../..").TinyBig)[];
1
+ import type { JSONABIArgument } from '../../types/Contract.types';
2
+ export declare const hexFalse: string;
3
+ export declare function encodeData(jsonABIArgument: JSONABIArgument, args: any[]): string;
4
+ export declare function decodeRPCResponse(jsonABIArgument: JSONABIArgument, nodeResponse: string): string | number | boolean | import("../..").TinyBig | (string | number | boolean | import("../..").TinyBig)[];
@@ -1,9 +1,9 @@
1
- export declare function post(url: string, body: Record<string, unknown>): Promise<any>;
2
- declare type RPCMethodName = 'eth_getBlockByNumber' | 'eth_getBlockByHash' | 'eth_call' | 'eth_chainId' | 'eth_gasPrice' | 'eth_getBalance' | 'eth_getTransactionByHash' | 'eth_getTransactionReceipt' | 'eth_getTransactionCount' | 'eth_blockNumber' | 'eth_estimateGas';
3
- export declare function buildRPCPostBody(method: RPCMethodName, params: unknown[]): {
4
- jsonrpc: string;
5
- id: number;
6
- method: RPCMethodName;
7
- params: unknown[];
8
- };
9
- export {};
1
+ export declare function post(url: string, body: Record<string, unknown>): Promise<any>;
2
+ declare type RPCMethodName = 'eth_getBlockByNumber' | 'eth_getBlockByHash' | 'eth_call' | 'eth_chainId' | 'eth_gasPrice' | 'eth_getBalance' | 'eth_getTransactionByHash' | 'eth_getTransactionReceipt' | 'eth_getTransactionCount' | 'eth_getCode' | 'eth_blockNumber' | 'eth_estimateGas' | 'eth_getLogs';
3
+ export declare function buildRPCPostBody(method: RPCMethodName, params: unknown[]): {
4
+ jsonrpc: string;
5
+ id: number;
6
+ method: RPCMethodName;
7
+ params: unknown[];
8
+ };
9
+ export {};
@@ -1 +1 @@
1
- export declare function hexToDecimal(hex: string): string;
1
+ export declare function hexToDecimal(hex: string): string;
@@ -0,0 +1,2 @@
1
+ import type { RPCTransactionRequest, TransactionRequest } from './../../types/Transaction.types';
2
+ export declare function prepareTransaction(transaction: TransactionRequest): RPCTransactionRequest;
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ var t=require("sha3"),e=require("isomorphic-unfetch"),r=require("big.js"),n=require("@noble/secp256k1");function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var i=/*#__PURE__*/o(e),s=/*#__PURE__*/o(r);function a(){return a=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},a.apply(this,arguments)}function u(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,f(t,e)}function f(t,e){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},f(t,e)}function c(t){return BigInt(t).toString()}var h="0".repeat(64),l="0".repeat(63)+"1";function p(e,r){var n=new t.Keccak(256),o=e.name+"("+e.inputs.map(function(t){return"uint[]"===(e=t.type)?"uint256[]":"int[]"===e?"int256[]":e;var e})+")",i=n.update(o).digest("hex"),s=e.inputs.length,a=!0;if(e.inputs.find(function(t){return t.type.includes("[")})&&(a=!1),a&&r.length!==s)throw new Error('args inputs of "'+r.length+'" does not match expected length of "'+e.inputs.length+'"');var u=(e.inputs||[]).reduce(function(t,e,n){if(e.type.includes("[")){var o,i=null==(o=/([^[]*)\[.*$/g.exec(e.type))?void 0:o[1];return r.forEach(function(e){t=t.concat([[e,i]])}),t}return t.concat([[r[n],e.type]])},[]),f=u.map(function(t){var e=t[0],r=t[1],n=e;switch(r){case"bool":return e?l:h;case"address":n=e.replace(/^0x/g,"").toLowerCase();break;default:if(r.startsWith("bytes"))return n.split("").map(function(t){return t.charCodeAt(0).toString(16)}).join("").padEnd(64,"0");if("uint256"===r)return BigInt(e).toString(16).padStart(64,"0");if(r.startsWith("uint"))break;throw new Error('essential-eth does not yet support "'+r+'" inputs. Make a PR today!"')}return n.toString(16).padStart(64,"0")});return"0x"+i.slice(0,8)+f.join("")}function g(t,e){var r=t.outputs,n=(e.slice(2).match(/.{1,64}/g)||[]).map(function(t,e){var n=(r||[])[e].type;switch(n){case"bool":return t===l;case"address":return I("0x"+t.slice(24));case"uint256":return A(c("0x"+t));case"bytes32":return"0x"+t;case"uint8":return Number(c("0x"+t));default:throw new Error('essential-eth does not yet support "'+n+'" outputs. Make a PR today!"')}});return 1===n.length?n[0]:n}function y(t,e){return i.default(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(function(t){try{return Promise.resolve(t.text()).then(function(t){try{return JSON.parse(t)}catch(e){throw new Error('Invalid JSON RPC response: "'+t+'"')}})}catch(t){return Promise.reject(t)}}).then(function(t){if(!(null==t?void 0:t.result))throw new Error("Invalid JSON RPC response: "+JSON.stringify(t));return t.result})}function m(t,e){return{jsonrpc:"2.0",id:1,method:t,params:e}}function d(t){t.split("").reduce(function(t,e){return t+("0"===e?4:68)},0)}var v=function(t,e,r){var n=this,o=this;this._address=void 0,this._provider=void 0,this._address=t,this._provider=r,e.filter(function(t){return"function"===t.type}).forEach(function(t){var e;"name"in t&&"string"==typeof t.name&&(e=function(){try{var e=arguments,r=[].slice.call(e),n=r,i={},s=r[r.length-1];Array.isArray(s)||"object"!=typeof s||(i=s,n=r.slice(0,r.length-1));var u=p(t,n),f="number"==typeof i.gasLimit?i.gasLimit:"number"==typeof(null==t?void 0:t.gas)?d(u):null,c=function(){try{return Promise.resolve(y(o._provider.selectRpcUrl(),m("eth_call",[a({to:o._address.toLowerCase(),data:u},f?{gas:"0x"+f.toString(16)}:{}),"latest"])))}catch(t){return Promise.reject(t)}};return Promise.resolve(c()).then(function(e){return g(t,e)})}catch(t){return Promise.reject(t)}},Object.defineProperty(n,t.name,{enumerable:!0,value:e,writable:!1}))})},b=/*#__PURE__*/function(t){function e(){return t.apply(this,arguments)||this}return u(e,t),e}(v),w=new(/*#__PURE__*/function(){function t(){this.packageVersion=void 0,this.packageVersion="0.5.10-next.0"}var e=t.prototype;return e.throwError=function(t,e){var r=Object.keys(e).length;throw new Error(t+" ("+Object.entries(e).map(function(t,e){return t[0]+"="+t[1]+(e<r-1&&", ")})+", version=essential-eth@"+this.packageVersion+")")},e.throwArgumentError=function(t,e,r){throw new Error(t+' (argument="'+e+'" value='+r+", version=essential-eth@"+this.packageVersion+")")},e.checkSafeUint53=function(t,e){void 0===e&&(e="value not safe"),"number"==typeof t&&((t<0||t>=9007199254740991)&&this.throwError(e,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,{operation:"checkSafeInteger",fault:"non-integer",value:t}))},t}());function x(t){var e=t.startsWith("-");return(t=(t=(t=t.replace("-","")).replace(/\.0*$/g,"")).replace(/^0+/,"")).includes(".")&&(t=t.replace(/0+$/,"")),t.startsWith(".")&&(t="0"+t),(e?"-":"")+t}function E(t){if(!t.match(/e/i))return x(t);var e=t.split(/e/i),r=e[0],n=e[1],o=Number(r)<0,i=(r=x(r=r.replace("-",""))).split("."),s=i[0],a=i[1],u=void 0===a?"":a;if(0===Number(n))return(o?"-":"")+x(r);r.includes(".")||(r+=".");var f,c=(r=r.replace(".","")).length;return Number(n)<0?(s.length<Math.abs(Number(n))&&(r=r.padStart(c+Math.abs(Number(n))-s.length,"0")),f=r.split(""),s.length<Math.abs(Number(n))?f=["."].concat(f):f.splice(f.length-Math.abs(Number(n)),0,".")):(u.length<Math.abs(Number(n))&&(r=r.padEnd(c+Math.abs(Number(n))-u.length,"0")),f=r.split(""),u.length>Math.abs(Number(n))&&f.splice(f.length-Math.abs(Number(n)),0,".")),(o?"-":"")+x(f.join(""))}var B=/*#__PURE__*/function(t){function e(e){var r;return"string"==typeof e&&e.startsWith("0x")&&(e=c(e)),(r=t.call(this,e)||this).padAndChop=function(t,e,r){return(Array(r).fill(e).join("")+t).slice(-1*r)},r}u(e,t);var r=e.prototype;return r.toHexString=function(){return"0x"+BigInt(this.toString()).toString(16)},r.toNumber=function(){return Number(E(t.prototype.toString.call(this)))},r.toString=function(){return 0===this.toNumber()?"0":E(t.prototype.toString.call(this))},r.toTwos=function(t){var e;if(this.gte(0)){var r=this.toNumber().toString(2);e=this.padAndChop(r,"0",t||r.length)}else if(e=this.plus(Math.pow(2,t)).toNumber().toString(2),Number(e)<0)throw new Error("Cannot calculate twos complement");return A(Number("0b"+e))},e}(s.default);function A(t){return new B(t)}function P(t){var e=a({},t);return Object.keys(t).forEach(function(r){if(t[r])switch(r){case"blockNumber":case"chainId":case"transactionIndex":case"type":case"v":e[r]=Number(c(t[r]));break;case"from":case"to":t[r]&&(e[r]=I(t[r]));break;case"value":case"gas":case"gasPrice":case"maxFeePerGas":case"maxPriorityFeePerGas":case"nonce":e[r]=A(c(t[r]))}}),e}var k=function(t,e){if(!e.includes(typeof t))throw new Error(e.join(" or ")+" required. Received "+typeof t)};function I(e){if(k(e,["string"]),!/^(0x)?[0-9a-f]{40}$/i.test(e))throw new Error('Invalid Ethereum address "'+e+'"');for(var r=e.toLowerCase().replace(/^0x/i,""),n=new t.Keccak(256).update(r).digest("hex").replace(/^0x/i,""),o="0x",i=0;i<r.length;i++)parseInt(n[i],16)>7?o+=r[i].toUpperCase():o+=r[i];if(e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&o!==e)throw new Error('Invalid Checksum address for "'+e+'"');return o}function U(t,e){var r=a({},t);return Object.keys(t).forEach(function(n){switch(n){case"address":r[n]=I(t[n]);break;case"blockNumber":case"logIndex":case"transactionIndex":r[n]=Number(c(t[n]));break;case"removed":e&&delete r[n]}}),r}function S(t){return!!t.toHexString}function T(t){return L(t)&&!(t.length%2)||C(t)}function _(t){return"number"==typeof t&&t==t&&t%1==0}function C(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!_(t.length)||t.length<0)return!1;for(var e=0;e<t.length;e++){var r=t[e];if(!_(r)||r<0||r>=256)return!1}return!0}function O(t,e){if(e||(e={}),"number"==typeof t){w.checkSafeUint53(t,"invalid arrayify value");for(var r=[];t;)r.unshift(255&t),t=parseInt(String(t/256));return 0===r.length&&r.push(0),new Uint8Array(r)}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),S(t)&&(t=t.toHexString()),L(t)){var n=t.substring(2);n.length%2&&("left"===e.hexPad?n="0"+n:"right"===e.hexPad?n+="0":w.throwArgumentError("hex data is odd-length","value",t));for(var o=[],i=0;i<n.length;i+=2)o.push(parseInt(n.substring(i,i+2),16));return new Uint8Array(o)}return C(t)?new Uint8Array(t):w.throwArgumentError("invalid arrayify value","value",t)}function R(t){var e=t.map(function(t){return O(t)}),r=e.reduce(function(t,e){return t+e.length},0),n=new Uint8Array(r);return e.reduce(function(t,e){return n.set(e,t),t+e.length},0),n}function N(t,e){(t=O(t)).length>e&&w.throwArgumentError("value out of range","value",t);var r=new Uint8Array(e);return r.set(t,e-t.length),r}function L(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}function M(t,e){if(e||(e={}),"number"==typeof t){w.checkSafeUint53(t,"invalid hexlify value");for(var r="";t;)r="0123456789abcdef"[15&t]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),S(t))return t.toHexString();if(L(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":w.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(C(t)){for(var n="0x",o=0;o<t.length;o++){var i=t[o];n+="0123456789abcdef"[(240&i)>>4]+"0123456789abcdef"[15&i]}return n}return w.throwArgumentError("invalid hexlify value","value",t)}function j(t,e,r){return"string"!=typeof t?t=M(t):(!L(t)||t.length%2)&&w.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=r?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function F(t){"string"!=typeof t&&(t=M(t)),L(t)||w.throwArgumentError("invalid hex string","value",t),t=t.substring(2);for(var e=0;e<t.length&&"0"===t[e];)e++;return"0x"+t.substring(e)}function G(t,e){for("string"!=typeof t?t=M(t):L(t)||w.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&w.throwError("value out of range",{value:t,length:e});t.length<2*e+2;)t="0x0"+t.substring(2);return t}function q(t){var e=a({},t);return Object.keys(t).forEach(function(r){switch(r){case"gas":case"gasPrice":case"nonce":case"maxFeePerGas":case"maxPriorityFeePerGas":case"value":var n=t[r];e[r]=n instanceof B?n.toHexString():n instanceof s.default?"0x"+BigInt(n.toString()).toString(16):"number"==typeof t[r]?"0x"+t[r].toString(16):t[r].toString();break;case"data":e[r]=M(t[r])}}),e}var $={1:["eth","0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"],2:["exp"],3:["rop","0x112234455c3a32fd11230c42e7bccd4a84e02010"],4:["rin","0xe7410170f87102df0055eb195163a03b7f2bff4a"],5:["gor","0x112234455c3a32fd11230c42e7bccd4a84e02010"],6:["kot"],7:["tch"],8:["ubq"],9:["tubq"],10:["oeth"],11:["meta"],12:["kal"],13:["dstg"],14:["flr"],15:["diode"],16:["cflr"],17:["tfi"],18:["TST"],19:["sgb"],20:["elaeth"],21:["elaetht"],22:["eladid"],23:["eladidt"],24:["dthmainnet"],25:["cro"],26:["L1test"],27:["shib"],28:["Boba Rinkeby"],29:["L1"],30:["rsk"],31:["trsk"],32:["GooDT"],33:["GooD"],34:["dth"],35:["tbwg"],36:["dx"],38:["val"],40:["Telos EVM"],41:["Telos EVM Testnet"],42:["kov"],43:["pangolin"],44:["crab"],45:["pangoro"],46:["darwinia"],50:["xdc"],51:["TXDC"],52:["cet"],53:["tcet"],54:["OP"],55:["ZYX"],56:["bnb"],57:["sys"],58:["Ontology Mainnet"],59:["EOS Mainnet"],60:["go"],61:["etc"],62:["tetc"],63:["metc"],64:["ellaism"],65:["tokt"],66:["okt"],67:["dbm"],68:["SO1"],69:["okov"],70:["hsc"],71:["cfxtest"],72:["dxc"],74:["idchain"],76:["mix"],77:["spoa"],78:["primuschain"],79:["zenith"],80:["GeneChain"],81:["VIL"],82:["Meter"],83:["MeterTest"],85:["gttest"],86:["gt"],87:["nnw"],88:["tomo"],89:["tomot"],90:["gar-s0"],91:["gar-s1"],92:["gar-s2"],93:["gar-s3"],95:["Kylin Testnet"],96:["nsc"],97:["bnbt"],99:["poa"],100:["gno"],101:["eti"],102:["tw3g"],104:["tklc"],105:["dw3g"],106:["vlx"],107:["ntn"],108:["TT"],110:["xpr"],111:["ETL"],122:["fuse"],123:["spark"],124:["dwu"],125:["oychain testnet"],126:["oychain mainnet"],127:["feth"],128:["heco"],137:["MATIC"],141:["OPtest"],142:["dax"],162:["tpht"],163:["pht"],168:["aioz"],170:["hoosmartchain"],172:["resil"],180:["ame"],186:["Seele"],188:["BMC"],189:["BMCT"],193:["cem"],199:["BTT"],200:["aox"],211:["EDI"],218:["SO1-old"],222:["ASK"],225:["LA"],226:["TLA"],246:["ewt"],250:["ftm"],256:["hecot"],258:["setm"],262:["SUR"],269:["hpb"],280:["zksync-goerli"],288:["Boba"],300:["ogc"],321:["kcs"],322:["kcst"],333:["w3q"],335:["DFKTEST"],336:["sdn"],338:["tcro"],361:["theta-mainnet"],363:["theta-sapphire"],364:["theta-amber"],365:["theta-testnet"],369:["pls"],385:["lisinski"],416:["SX"],420:["ogor"],499:["rupx"],512:["aac"],513:["aact"],520:["xt"],530:["f(x)Core"],534:["CNDL"],555:["CLASS"],558:["tao"],588:["metis-stardust"],592:["astr"],595:["maca"],596:["tkar"],597:["taca"],600:["mesh-chain-testnet"],647:["SX-Testnet"],666:["pixie-chain-testnet"],686:["kar"],700:["SNS"],707:["bcs"],708:["tbcs"],721:["tfeth"],776:["opc"],777:["cth"],787:["aca"],788:["taero"],803:["haic"],808:["PFTEST"],820:["clo"],821:["tclo"],880:["ambros"],888:["wan"],900:["gar-test-s0"],901:["gar-test-s1"],902:["gar-test-s2"],903:["gar-test-s3"],909:["PF"],940:["tpls"],941:["t2bpls"],942:["t3pls"],977:["yeti"],980:["top_evm"],989:["top"],998:["ln"],999:["twan"],1e3:["gton"],1001:["Baobab"],1007:["tnew"],1008:["eun"],1010:["EVC"],1012:["new"],1022:["sku"],1023:["tclv"],1024:["clv"],1028:["tbtt"],1030:["cfx"],1088:["metis-andromeda"],1139:["MATH"],1140:["tMATH"],1197:["iora"],1201:["avis"],1202:["wtt"],1213:["popcat"],1214:["enter"],1246:["om"],1280:["HO"],1284:["mbeam"],1285:["mriver"],1286:["mrock-old"],1287:["mbase"],1288:["mrock"],1297:["Bobabase"],1319:["aitd"],1320:["aitdtestnet"],1337:["cennz-old"],1506:["Sherpax"],1507:["Sherpax Testnet"],1618:["cate"],1620:["ath"],1657:["bta"],1688:["LUDAN"],1818:["cube"],1819:["cubet"],1856:["tsf"],1898:["boya"],1984:["euntest"],1987:["egem"],2001:["milkAda"],2008:["cloudwalk_testnet"],2009:["cloudwalk_mainnet"],2020:["420"],2021:["edg"],2022:["edgt"],2023:["taycan-testnet"],2025:["rpg"],2100:["eco"],2101:["esp"],2152:["fra"],2153:["findora-testnet"],2213:["evanesco"],2221:["tkava"],2222:["kava"],2223:["VChain"],2559:["ktoc"],2569:["tpc"],2612:["EZChain"],2613:["Fuji-EZChain"],3e3:["cennz-r"],3001:["cennz-n"],3331:["zcrbeach"],3333:["w3q-t"],3334:["w3q-g"],3400:["prb"],3500:["prbtestnet"],3501:["jfin"],3690:["btx"],3737:["csb"],3966:["dyno"],3967:["tdyno"],3999:["ycc"],4002:["tftm"],4051:["Bobaopera Testnet"],4102:["aioz-testnet"],4181:["PHI"],4689:["iotex-mainnet"],4690:["iotex-testnet"],4918:["txvm"],4919:["xvm"],5177:["tlc"],5197:["es"],5315:["UZMI"],5551:["Nahmii"],5553:["Nahmii testnet"],5700:["tsys"],5777:["dgcc"],5851:["Ontology Testnet"],5869:["rbd"],6626:["pixie-chain"],6969:["tombchain"],7027:["ELLA"],7341:["shyft"],7777:["Rise of the Warbots Testnet"],7878:["tscas"],8e3:["teleport"],8001:["teleport-testnet"],8029:["mdgl"],8080:["GeneChainAdn"],8217:["Cypress"],8285:["Kortho"],8723:["olo"],8724:["tolo"],8888:["ambrostestnet"],8898:["mmt"],8995:["berg"],9e3:["evmos-testnet"],9001:["evmos"],9012:["brb"],9100:["GENEC"],9527:["trpg"],9999:["myn"],1e4:["smartbch"],10001:["smartbchtest"],10101:["GEN"],10823:["CCP"],10946:["quadrans"],10947:["quadranstestnet"],11111:["WAGMI"],11437:["shyftt"],12051:["tZERO"],12052:["ZERO"],13381:["Phoenix"],16e3:["mtt"],16001:["mtttest"],16888:["tivar"],19845:["btcix"],21337:["cennz-a"],21816:["omc"],22023:["SFL"],24484:["web"],24734:["mintme"],26863:["OAC"],30067:["Piece"],31102:["esn"],31337:["got"],32520:["Brise"],32659:["fsn"],35441:["q"],35443:["q-testnet"],39797:["nrg"],42069:["PC"],42161:["arb1"],42170:["arb-nova"],42220:["CELO"],42261:["emerald"],42262:["oasis"],43110:["avaeth"],43113:["Fuji"],43114:["avax"],44787:["ALFA"],45e3:["Autobahn Network"],47805:["REI"],49797:["tnrg"],50021:["tgton"],53935:["DFK"],55555:["reichain"],55556:["trei"],6e4:["TKM-test0"],60001:["TKM-test1"],60002:["TKM-test2"],60103:["TKM-test103"],62320:["BKLV"],62621:["mtv"],63e3:["ecs"],63001:["ecs-testnet"],69420:["cndr"],7e4:["TKM0"],70001:["TKM1"],70002:["TKM2"],70103:["TKM103"],71393:["ckb"],71401:["gw-testnet-v1"],71402:["gw-mainnet-v1"],73799:["vt"],73927:["mvm"],75e3:["resin"],78110:["firenze"],80001:["maticmum"],88888:["ivar"],99998:["usctest"],99999:["usc"],1e5:["qkc-r"],100001:["qkc-s0"],100002:["qkc-s1"],100003:["qkc-s2"],100004:["qkc-s3"],100005:["qkc-s4"],100006:["qkc-s5"],100007:["qkc-s6"],100008:["qkc-s7"],103090:["CRFI"],108801:["bro"],11e4:["qkc-d-r"],110001:["qkc-d-s0"],110002:["qkc-d-s1"],110003:["qkc-d-s2"],110004:["qkc-d-s3"],110005:["qkc-d-s4"],110006:["qkc-d-s5"],110007:["qkc-d-s6"],110008:["qkc-d-s7"],131419:["ETND"],200101:["milkTAda"],200625:["aka"],201018:["alaya"],201030:["alayadev"],210425:["platon"],234666:["hym"],246529:["ats"],246785:["atstau"],281121:["SoChain"],333888:["sparta"],333999:["olympus"],421611:["arb-rinkeby"],421613:["arb-goerli"],432201:["Dexalot"],444900:["wlkt"],474142:["oc"],512512:["cmp"],666666:["vpioneer"],846e3:["bloqs4good"],888888:["vision"],955305:["elv"],1313114:["etho"],1313500:["xero"],1337702:["kintsugi"],1337802:["kiln"],2203181:["platondev"],2206132:["platondev2"],7762959:["music"],11155111:["sep"],13371337:["tpep"],18289463:["ilt"],20180430:["spectrum"],20181205:["qki"],28945486:["auxi"],35855456:["JOYS"],61717561:["aqua"],99415706:["TOYS"],192837465:["GTH"],245022926:["neonevm-devnet"],245022934:["neonevm-mainnet"],245022940:["neonevm-testnet"],311752642:["oneledger"],356256156:["tGTH"],486217935:["dGTH"],1122334455:["ipos"],1313161554:["aurora"],1313161555:["aurora-testnet"],1313161556:["aurora-betanet"],16666e5:["hmy-s0"],1666600001:["hmy-s1"],1666600002:["hmy-s2"],1666600003:["hmy-s3"],16667e5:["hmy-b-s0"],1666700001:["hmy-b-s1"],1666700002:["hmy-b-s2"],1666700003:["hmy-b-s3"],2021121117:["hop"],3125659152:["pirl"],4216137055:["frankenstein"],11297108099:["tpalm"],11297108109:["palm"],197710212030:["ntt"],197710212031:["ntt-haradev"],6022140761023:["mole"],868455272153094:["gw-testnet-v1-deprecated"]};function D(t){return"number"==typeof t?A(t).toHexString():t}var z=/*#__PURE__*/function(){function t(t){var e=this;this._rpcUrls=[],this._post=function(t){return y(e.selectRpcUrl(),t)},this._rpcUrls=t}var e=t.prototype;return e.getNetwork=function(){try{return Promise.resolve(this.post(m("eth_chainId",[]))).then(function(t){var e=c(t),r=$[e];return{chainId:Number(e),name:r[0]||"unknown",ensAddress:r[1]||null}})}catch(t){return Promise.reject(t)}},e.getBlockNumber=function(){try{return Promise.resolve(this.post(m("eth_blockNumber",[]))).then(function(t){return Number(c(t))})}catch(t){return Promise.reject(t)}},e.getTransaction=function(t){try{return Promise.resolve(Promise.all([this.post(m("eth_getTransactionByHash",[t])),this.getBlock("latest")])).then(function(t){var e=t[1],r=P(t[0]);return r.confirmations=e.number-r.blockNumber+1,r})}catch(t){return Promise.reject(t)}},e.getTransactionReceipt=function(t){try{return Promise.resolve(Promise.all([this.post(m("eth_getTransactionReceipt",[t])),this.getBlock("latest")])).then(function(t){var e=t[1],r=function(t){var e=a({},P(t));return Object.keys(t).forEach(function(r){if(t[r])switch(r){case"status":e[r]=Number(c(t[r]));break;case"contractAddress":t[r]&&(e[r]=I(t[r]));break;case"cumulativeGasUsed":case"effectiveGasPrice":case"gasUsed":e[r]=A(c(t[r]));break;case"logs":t[r].forEach(function(t,n){e[r][n]=U(t,!0)})}}),e.byzantium=e.blockNumber>=437e4,e}(t[0]);return r.confirmations=e.number-r.blockNumber+1,r})}catch(t){return Promise.reject(t)}},e.getTransactionCount=function(t,e){void 0===e&&(e="latest");try{return e=D(e),Promise.resolve(this.post(m("eth_getTransactionCount",[t,e]))).then(function(t){return Number(c(t))})}catch(t){return Promise.reject(t)}},e.getBlock=function(t,e){void 0===t&&(t="latest"),void 0===e&&(e=!1);try{var r="Number";return"string"==typeof t&&66===t.length?r="Hash":t=D(t),Promise.resolve(this.post(m("eth_getBlockBy"+r,[t,e]))).then(function(t){return function(t,e){var r=a({},t);return Object.keys(t).forEach(function(e){if(t[e])switch(e){case"difficulty":case"totalDifficulty":case"gasLimit":case"gasUsed":case"size":case"timestamp":case"baseFeePerGas":r[e]=A(c(t[e]));break;case"number":r[e]=Number(c(t[e]));break;case"miner":r[e]=I(t[e])}}),e&&t.transactions.forEach(function(t,e){r.transactions[e]=P(t)}),r}(t,e)})}catch(t){return Promise.reject(t)}},e.getGasPrice=function(){try{return Promise.resolve(this.post(m("eth_gasPrice",[]))).then(function(t){return A(c(t))})}catch(t){return Promise.reject(t)}},e.getBalance=function(t,e){void 0===e&&(e="latest");try{return e=D(e),Promise.resolve(this.post(m("eth_getBalance",[t,e]))).then(function(t){return A(c(t))})}catch(t){return Promise.reject(t)}},e.getCode=function(t,e){void 0===e&&(e="latest");try{return e=D(e),Promise.resolve(this.post(m("eth_getCode",[t,e])))}catch(t){return Promise.reject(t)}},e.estimateGas=function(t){try{var e=q(t);return Promise.resolve(this.post(m("eth_estimateGas",[e]))).then(function(t){return A(c(t))})}catch(t){return Promise.reject(t)}},e.getLogs=function(t){try{var e=t;return e.fromBlock&&(e.fromBlock=D(e.fromBlock)),e.toBlock&&(e.toBlock=D(e.toBlock)),Promise.resolve(this.post(m("eth_getLogs",[t]))).then(function(t){return t.map(function(t){return U(t,!1)})})}catch(t){return Promise.reject(t)}},e.call=function(t,e){void 0===e&&(e="latest");try{t.gasPrice&&(t.maxPriorityFeePerGas||t.maxFeePerGas)&&w.throwError('Cannot specify both "gasPrice" and ("maxPriorityFeePerGas" or "maxFeePerGas")',{gasPrice:t.gasPrice,maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas}),t.maxFeePerGas&&t.maxPriorityFeePerGas&&w.throwError('Cannot specify both "maxFeePerGas" and "maxPriorityFeePerGas"',{maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas}),e=D(e);var r=q(t);return Promise.resolve(this.post(m("eth_call",[r,e])))}catch(t){return Promise.reject(t)}},t}(),K=/*#__PURE__*/function(t){function e(e,r){var n;return void 0===r&&(r={}),Array.isArray(e)||w.throwError("Array required",{rpcUrls:e}),e.length<=1&&w.throwError("More than one rpcUrl is required",{rpcUrls:e}),(n=t.call(this,e)||this).rpcUrlCounter=0,n.timeoutDuration=void 0,n.post=function(t){var e=n.rpcUrlCounter;return function r(){var o,i,s=n.selectRpcUrl();return(o=n._post(t),i=n.timeoutDuration,Promise.race([o,new Promise(function(t,e){return setTimeout(function(){return e("Promise timed out")},i)})])).catch(function(t){if(s===n.selectRpcUrl()&&(n.rpcUrlCounter=(n.rpcUrlCounter+1)%n._rpcUrls.length),n.rpcUrlCounter===e)throw t;return r()})}()},n.timeoutDuration=r.timeoutDuration||8e3,n}return u(e,t),e.prototype.selectRpcUrl=function(){return this._rpcUrls[this.rpcUrlCounter]},e}(z),H=/*#__PURE__*/function(t){u(r,t);var e=r.prototype;function r(e){return void 0===e&&(e="https://free-eth-node.com/api/eth"),t.call(this,[e])||this}return e.selectRpcUrl=function(){return this._rpcUrls[0]},e.post=function(t){return this._post(t)},r}(z);function V(e){var r;return r="string"==typeof e?Buffer.from(e.replace(/^0x/,""),"hex"):Buffer.from(e),"0x"+new t.Keccak(256).update(r).digest("hex")}function W(t){return t=M(t).slice(2),"0x"+n.Point.fromPrivateKey(t).toHex()}function Z(t){return new Uint8Array(Buffer.from(t))}for(var Y=[],J=[],X="undefined"!=typeof Uint8Array?Uint8Array:Array,Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tt=0,et=Q.length;tt<et;++tt)Y[tt]=Q[tt],J[Q.charCodeAt(tt)]=tt;function rt(t,e,r){for(var n,o=[],i=e;i<r;i+=3)o.push(Y[(n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(255&t[i+2]))>>18&63]+Y[n>>12&63]+Y[n>>6&63]+Y[63&n]);return o.join("")}J["-".charCodeAt(0)]=62,J["_".charCodeAt(0)]=63;var nt,ot,it=function(t,e,r,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,f=u>>1,c=-7,h=r?o-1:0,l=r?-1:1,p=t[e+h];for(h+=l,i=p&(1<<-c)-1,p>>=-c,c+=a;c>0;i=256*i+t[e+h],h+=l,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=n;c>0;s=256*s+t[e+h],h+=l,c-=8);if(0===i)i=1-f;else{if(i===u)return s?NaN:Infinity*(p?-1:1);s+=Math.pow(2,n),i-=f}return(p?-1:1)*s*Math.pow(2,i-n)},st=function(t,e,r,n,o,i){var s,a,u,f=8*i-o-1,c=(1<<f)-1,h=c>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,g=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||Infinity===e?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+h>=1?l/u:l*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=c?(a=0,s=c):s+h>=1?(a=(e*u-1)*Math.pow(2,o),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;t[r+p]=255&a,p+=g,a/=256,o-=8);for(s=s<<o|a,f+=o;f>0;t[r+p]=255&s,p+=g,s/=256,f-=8);t[r+p-g]|=128*y},at=(nt=function(t,e){const r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=i,e.SlowBuffer=function(t){return+t!=t&&(t=0),i.alloc(+t)},e.INSPECT_MAX_BYTES=50;const n=2147483647;function o(t){if(t>n)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,i.prototype),e}function i(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return s(t,e,r)}function s(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!i.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|l(t,e);let n=o(r);const s=n.write(t,e);return s!==r&&(n=n.slice(0,s)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(H(t,Uint8Array)){const e=new Uint8Array(t);return c(e.buffer,e.byteOffset,e.byteLength)}return f(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(H(t,ArrayBuffer)||t&&H(t.buffer,ArrayBuffer))return c(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(H(t,SharedArrayBuffer)||t&&H(t.buffer,SharedArrayBuffer)))return c(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return i.from(n,e,r);const s=function(t){if(i.isBuffer(t)){const e=0|h(t.length),r=o(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||V(t.length)?o(0):f(t):"Buffer"===t.type&&Array.isArray(t.data)?f(t.data):void 0}(t);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return i.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return a(t),o(t<0?0:0|h(t))}function f(t){const e=t.length<0?0:0|h(t.length),r=o(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function c(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,i.prototype),n}function h(t){if(t>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return 0|t}function l(t,e){if(i.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||H(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let o=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(o)return n?-1:D(t).length;e=(""+e).toLowerCase(),o=!0}}function p(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return P(this,e,r);case"latin1":case"binary":return k(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),V(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=i.from(e,n)),i.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,o){let i,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){let n=-1;for(i=r;i<a;i++)if(f(t,i)===f(e,-1===n?0:i-n)){if(-1===n&&(n=i),i-n+1===u)return n*s}else-1!==n&&(i-=i-n),n=-1}else for(r+u>a&&(r=a-u),i=r;i>=0;i--){let r=!0;for(let n=0;n<u;n++)if(f(t,i+n)!==f(e,n)){r=!1;break}if(r)return i}return-1}function d(t,e,r,n){r=Number(r)||0;const o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;const i=e.length;let s;for(n>i/2&&(n=i/2),s=0;s<n;++s){const n=parseInt(e.substr(2*s,2),16);if(V(n))return s;t[r+s]=n}return s}function v(t,e,r,n){return K(D(e,t.length-r),t,r,n)}function b(t,e,r,n){return K(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function w(t,e,r,n){return K(z(e),t,r,n)}function x(t,e,r,n){return K(function(t,e){let r,n,o;const i=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function E(t,e,r){return function(t){for(var e,r=t.length,n=r%3,o=[],i=16383,s=0,a=r-n;s<a;s+=i)o.push(rt(t,s,s+i>a?a:s+i));return 1===n?o.push(Y[(e=t[r-1])>>2]+Y[e<<4&63]+"=="):2===n&&o.push(Y[(e=(t[r-2]<<8)+t[r-1])>>10]+Y[e>>4&63]+Y[e<<2&63]+"="),o.join("")}(0===e&&r===t.length?t:t.slice(e,r))}function B(t,e,r){r=Math.min(t.length,r);const n=[];let o=e;for(;o<r;){const e=t[o];let i=null,s=e>239?4:e>223?3:e>191?2:1;if(o+s<=r){let r,n,a,u;switch(s){case 1:e<128&&(i=e);break;case 2:r=t[o+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(i=u));break;case 3:r=t[o+1],n=t[o+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(i=u));break;case 4:r=t[o+1],n=t[o+2],a=t[o+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&a,u>65535&&u<1114112&&(i=u))}}null===i?(i=65533,s=1):i>65535&&(i-=65536,n.push(i>>>10&1023|55296),i=56320|1023&i),n.push(i),o+=s}return function(t){const e=t.length;if(e<=A)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=A));return r}(n)}e.kMaxLength=n,(i.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}())||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}}),i.poolSize=8192,i.from=function(t,e,r){return s(t,e,r)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototypeOf(i,Uint8Array),i.alloc=function(t,e,r){return function(t,e,r){return a(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}(t,e,r)},i.allocUnsafe=function(t){return u(t)},i.allocUnsafeSlow=function(t){return u(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==i.prototype},i.compare=function(t,e){if(H(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),H(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},i.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return i.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=i.allocUnsafe(e);let o=0;for(r=0;r<t.length;++r){let e=t[r];if(H(e,Uint8Array))o+e.length>n.length?(i.isBuffer(e)||(e=i.from(e)),e.copy(n,o)):Uint8Array.prototype.set.call(n,e,o);else{if(!i.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,o)}o+=e.length}return n},i.byteLength=l,i.prototype._isBuffer=!0,i.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)g(this,e,e+1);return this},i.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},i.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},i.prototype.toLocaleString=i.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?B(this,0,t):p.apply(this,arguments)},i.prototype.equals=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===i.compare(this,t)},i.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},r&&(i.prototype[r]=i.prototype.inspect),i.prototype.compare=function(t,e,r,n,o){if(H(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),!i.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;let s=(o>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0);const u=Math.min(s,a),f=this.slice(n,o),c=t.slice(e,r);for(let t=0;t<u;++t)if(f[t]!==c[t]){s=f[t],a=c[t];break}return s<a?-1:a<s?1:0},i.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},i.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},i.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},i.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let i=!1;for(;;)switch(n){case"hex":return d(this,t,e,r);case"utf8":case"utf-8":return v(this,t,e,r);case"ascii":case"latin1":case"binary":return b(this,t,e,r);case"base64":return w(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const A=4096;function P(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function k(t,e,r){let n="";r=Math.min(t.length,r);for(let o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function I(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let o="";for(let n=e;n<r;++n)o+=W[t[n]];return o}function U(t,e,r){const n=t.slice(e,r);let o="";for(let t=0;t<n.length-1;t+=2)o+=String.fromCharCode(n[t]+256*n[t+1]);return o}function S(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function T(t,e,r,n,o,s){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function _(t,e,r,n,o){F(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i,i>>=8,t[r++]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,r}function C(t,e,r,n,o){F(e,n,o,t,r,7);let i=Number(e&BigInt(4294967295));t[r+7]=i,i>>=8,t[r+6]=i,i>>=8,t[r+5]=i,i>>=8,t[r+4]=i;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s>>=8,t[r+2]=s,s>>=8,t[r+1]=s,s>>=8,t[r]=s,r+8}function O(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function R(t,e,r,n,o){return e=+e,r>>>=0,o||O(t,0,r,4),st(t,e,r,n,23,4),r+4}function N(t,e,r,n,o){return e=+e,r>>>=0,o||O(t,0,r,8),st(t,e,r,n,52,8),r+8}i.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,i.prototype),n},i.prototype.readUintLE=i.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return n},i.prototype.readUintBE=i.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);let n=this[t+--e],o=1;for(;e>0&&(o*=256);)n+=this[t+--e]*o;return n},i.prototype.readUint8=i.prototype.readUInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),this[t]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUint32BE=i.prototype.readUInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readBigUInt64LE=Z(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,o=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))}),i.prototype.readBigUInt64BE=Z(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],o=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(o)}),i.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);let n=this[t],o=1,i=0;for(;++i<e&&(o*=256);)n+=this[t+i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);let n=e,o=1,i=this[t+--n];for(;n>0&&(o*=256);)i+=this[t+--n]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},i.prototype.readInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||S(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(t,e){t>>>=0,e||S(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readBigInt64LE=Z(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];return void 0!==e&&void 0!==r||q(t,this.length-8),(BigInt(this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24))<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)}),i.prototype.readBigInt64BE=Z(function(t){G(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)}),i.prototype.readFloatLE=function(t,e){return t>>>=0,e||S(t,4,this.length),it(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||S(t,4,this.length),it(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||S(t,8,this.length),it(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||S(t,8,this.length),it(this,t,!1,52,8)},i.prototype.writeUintLE=i.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||T(this,t,e,r,Math.pow(2,8*r)-1,0);let o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||T(this,t,e,r,Math.pow(2,8*r)-1,0);let o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},i.prototype.writeUint8=i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,1,255,0),this[e]=255&t,e+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeUint16BE=i.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeUint32LE=i.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},i.prototype.writeUint32BE=i.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeBigUInt64LE=Z(function(t,e=0){return _(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeBigUInt64BE=Z(function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),i.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);T(this,t,e,r,n-1,-n)}let o=0,i=1,s=0;for(this[e]=255&t;++o<r&&(i*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);T(this,t,e,r,n-1,-n)}let o=r-1,i=1,s=0;for(this[e+o]=255&t;--o>=0&&(i*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+r},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},i.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},i.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},i.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||T(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},i.prototype.writeBigInt64LE=Z(function(t,e=0){return _(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),i.prototype.writeBigInt64BE=Z(function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),i.prototype.writeFloatLE=function(t,e,r){return R(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return R(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return N(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return N(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(!i.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const o=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),o},i.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{const s=i.isBuffer(t)?t:i.from(t,n),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};const L={};function M(t,e,r){L[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function j(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function F(t,e,r,n,o,i){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let o;throw o=i>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(i+1)}${n}`:`>= -(2${n} ** ${8*(i+1)-1}${n}) and < 2 ** ${8*(i+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new L.ERR_OUT_OF_RANGE("value",o,t)}!function(t,e,r){G(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||q(e,t.length-(r+1))}(n,o,i)}function G(t,e){if("number"!=typeof t)throw new L.ERR_INVALID_ARG_TYPE(e,"number",t)}function q(t,e,r){if(Math.floor(t)!==t)throw G(t,r),new L.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new L.ERR_BUFFER_OUT_OF_BOUNDS;throw new L.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}M("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),M("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),M("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,o=r;return Number.isInteger(r)&&Math.abs(r)>2**32?o=j(String(r)):"bigint"==typeof r&&(o=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(o=j(o)),o+="n"),n+=` It must be ${e}. Received ${o}`,n},RangeError);const $=/[^+/0-9A-Za-z-_]/g;function D(t,e){let r;e=e||Infinity;const n=t.length;let o=null;const i=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function z(t){return function(t){var e,r,n=function(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}(t),o=n[0],i=n[1],s=new X(function(t,e,r){return 3*(e+r)/4-r}(0,o,i)),a=0,u=i>0?o-4:o;for(r=0;r<u;r+=4)e=J[t.charCodeAt(r)]<<18|J[t.charCodeAt(r+1)]<<12|J[t.charCodeAt(r+2)]<<6|J[t.charCodeAt(r+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=255&e;return 2===i&&(e=J[t.charCodeAt(r)]<<2|J[t.charCodeAt(r+1)]>>4,s[a++]=255&e),1===i&&(e=J[t.charCodeAt(r)]<<10|J[t.charCodeAt(r+1)]<<4|J[t.charCodeAt(r+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s}(function(t){if((t=(t=t.split("=")[0]).trim().replace($,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function K(t,e,r,n){let o;for(o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function H(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function V(t){return t!=t}const W=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let o=0;o<16;++o)e[n+o]=t[r]+t[o]}return e}();function Z(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},nt(ot={exports:{}},ot.exports),ot.exports),ut=new RegExp("^bytes([0-9]+)$"),ft=new RegExp("^(u?int)([0-9]*)$"),ct=new RegExp("^(.*)\\[([0-9]*)\\]$");function ht(t,e,r){switch(t){case"address":return r?N(e,32):O(e);case"string":return at.Buffer.from(e);case"bytes":return O(e);case"bool":return e=e?"0x01":"0x00",r?N(e,32):O(e)}var n=t.match(ft);if(n){var o=parseInt(n[2]||"256");return(n[2]&&String(o)!==n[2]||o%8!=0||0===o||o>256)&&w.throwArgumentError("invalid number type","type",t),r&&(o=256),N(M(e=A(e).toTwos(o).toNumber()),o/8)}if(n=t.match(ut)){var i=parseInt(n[1]);return(String(i)!==n[1]||0===i||i>32)&&w.throwArgumentError("invalid bytes type","type",t),O(e).byteLength!==i&&w.throwArgumentError("invalid value for "+t,"value",e),r?O((e+h).substring(0,66)):e}if((n=t.match(ct))&&Array.isArray(e)){var s=n[1];parseInt(n[2]||String(e.length))!=e.length&&w.throwArgumentError("invalid array length for "+t,"value",e);var a=[];return e.forEach(function(t){a.push(ht(s,t,!0))}),R(a)}return w.throwArgumentError("invalid type","type",t)}function lt(t,e){t.length!=e.length&&w.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);var r=[];return t.forEach(function(t,n){r.push(ht(t,e[n]))}),M(R(r))}exports.BaseContract=v,exports.Contract=b,exports.FallthroughProvider=K,exports.JsonRpcProvider=H,exports.TinyBig=B,exports.arrayify=O,exports.computeAddress=function(t){return t.startsWith("0x04")||t.startsWith("0x03")||t.startsWith("0x02")||(t=W(t)),I(j(V(j(t,1)),12))},exports.computePublicKey=W,exports.concat=R,exports.etherToGwei=function(t){k(t,["string","number","object"]);var e=A(t).times("1000000000");return A(e)},exports.etherToWei=function(t){k(t,["string","number","object"]);var e=A(t).times("1000000000000000000");return A(e)},exports.gweiToEther=function(t){k(t,["string","number","object"]);var e=A(t).div("1000000000");return A(e)},exports.hashMessage=function(t){return"string"==typeof t&&(t=Z(t)),V(R([Z("Ethereum Signed Message:\n"),Z(String(t.length)),t]))},exports.hexConcat=function(t){var e="0x";return t.forEach(function(t){e+=M(t).substring(2)}),e},exports.hexDataLength=function(t){if("string"!=typeof t)t=M(t);else if(!L(t)||t.length%2)return null;return(t.length-2)/2},exports.hexDataSlice=j,exports.hexStripZeros=F,exports.hexValue=function(t){var e=F(M(t,{hexPad:"left"}));return"0x"===e?"0x0":e},exports.hexZeroPad=G,exports.hexlify=M,exports.isAddress=function(t){k(t,["string"]);try{return I(t),!0}catch(t){return!1}},exports.isBytes=C,exports.isBytesLike=T,exports.isHexString=L,exports.jsonRpcProvider=function(t){return new H(t)},exports.keccak256=V,exports.pack=lt,exports.solidityKeccak256=function(t,e){return V(lt(t,e))},exports.splitSignature=function(t){var e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(T(t)){var r=O(t);64===r.length?(e.v=27+(r[32]>>7),r[32]&=127,e.r=M(r.slice(0,32)),e.s=M(r.slice(32,64))):65===r.length?(e.r=M(r.slice(0,32)),e.s=M(r.slice(32,64)),e.v=r[64]):w.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:w.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=M(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){var n=N(O(e._vs),32);e._vs=M(n);var o=n[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=o:e.recoveryParam!==o&&w.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),n[0]&=127;var i=M(n);null==e.s?e.s=i:e.s!==i&&w.throwArgumentError("signature v mismatch _vs","signature",t)}null==e.recoveryParam?null==e.v?w.throwArgumentError("signature missing v and recoveryParam","signature",t):e.recoveryParam=0===e.v||1===e.v?e.v:1-e.v%2:null==e.v?e.v=27+e.recoveryParam:e.recoveryParam!==(0===e.v||1===e.v?e.v:1-e.v%2)&&w.throwArgumentError("signature recoveryParam mismatch v","signature",t),null!=e.r&&L(e.r)?e.r=G(e.r,32):w.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&L(e.s)?e.s=G(e.s,32):w.throwArgumentError("signature missing or invalid s","signature",t);var s=O(e.s);s[0]>=128&&w.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(s[0]|=128);var a=M(s);e._vs&&(L(e._vs)||w.throwArgumentError("signature invalid _vs","signature",t),e._vs=G(e._vs,32)),null==e._vs?e._vs=a:e._vs!==a&&w.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e},exports.stripZeros=function(t){var e=O(t);if(0===e.length)return e;for(var r=0;r<e.length&&0===e[r];)r++;return r&&(e=e.slice(r)),e},exports.tinyBig=A,exports.toChecksumAddress=I,exports.toUtf8Bytes=Z,exports.weiToEther=function(t){k(t,["string","number","object"]);try{var e=t;"string"==typeof t&&"0x"===t.slice(0,2)&&(e=BigInt(t).toString());var r=A(e).div("1000000000000000000");return A(r)}catch(t){throw t}},exports.zeroPad=N;
2
+ //# sourceMappingURL=index.cjs.map