essential-eth 0.9.2-beta.2 → 0.9.2-beta.4

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 (105) hide show
  1. package/dist/cjs/classes/Contract.d.ts +81 -11
  2. package/dist/cjs/classes/test/Contract/crv-abi.d.ts +2 -2
  3. package/dist/cjs/classes/test/Contract/ens-abi.d.ts +2 -2
  4. package/dist/cjs/classes/test/Contract/fei-abi.d.ts +2 -2
  5. package/dist/cjs/classes/test/Contract/foo-abi.d.ts +2 -2
  6. package/dist/cjs/classes/test/Contract/uniswap-abi.d.ts +2 -2
  7. package/dist/cjs/classes/utils/clean-block.d.ts +120 -2
  8. package/dist/cjs/classes/utils/clean-log.d.ts +9 -2
  9. package/dist/cjs/classes/utils/clean-transaction-receipt.d.ts +14 -2
  10. package/dist/cjs/classes/utils/clean-transaction.d.ts +14 -2
  11. package/dist/cjs/classes/utils/encode-decode-transaction.d.ts +16 -4
  12. package/dist/cjs/classes/utils/fetchers.d.ts +53 -15
  13. package/dist/cjs/classes/utils/hex-to-decimal.d.ts +18 -1
  14. package/dist/cjs/classes/utils/prepare-transaction.d.ts +6 -2
  15. package/dist/cjs/index.d.ts +24 -25
  16. package/dist/cjs/index.js +21 -19
  17. package/dist/cjs/logger/logger.d.ts +11 -11
  18. package/dist/cjs/logger/package-version.d.ts +1 -1
  19. package/dist/cjs/logger/package-version.js +1 -1
  20. package/dist/cjs/providers/AlchemyProvider.d.ts +4 -4
  21. package/dist/cjs/providers/BaseProvider.d.ts +374 -26
  22. package/dist/cjs/providers/FallthroughProvider.d.ts +24 -11
  23. package/dist/cjs/providers/JsonRpcProvider.d.ts +33 -7
  24. package/dist/cjs/providers/test/json-rpc-provider/get-logs/mocks.d.ts +14 -14
  25. package/dist/cjs/providers/test/mock-of.d.ts +9 -2
  26. package/dist/cjs/providers/test/rpc-urls.d.ts +12 -12
  27. package/dist/cjs/providers/utils/chains-info.d.ts +24 -24
  28. package/dist/cjs/shared/tiny-big/helpers.d.ts +17 -1
  29. package/dist/cjs/shared/tiny-big/tiny-big.d.ts +58 -10
  30. package/dist/cjs/shared/validate-type.d.ts +3 -3
  31. package/dist/cjs/types/Block.types.d.ts +41 -40
  32. package/dist/cjs/types/Contract.types.d.ts +24 -24
  33. package/dist/cjs/types/FeeData.types.d.ts +7 -7
  34. package/dist/cjs/types/Filter.types.d.ts +16 -12
  35. package/dist/cjs/types/Network.types.d.ts +8 -5
  36. package/dist/cjs/types/Transaction.types.d.ts +123 -113
  37. package/dist/cjs/utils/bytes.d.ts +289 -40
  38. package/dist/cjs/utils/compute-address.d.ts +17 -1
  39. package/dist/cjs/utils/compute-public-key.d.ts +18 -2
  40. package/dist/cjs/utils/ether-to-gwei.d.ts +27 -3
  41. package/dist/cjs/utils/ether-to-wei.d.ts +27 -3
  42. package/dist/cjs/utils/gwei-to-ether.d.ts +27 -3
  43. package/dist/cjs/utils/hash-message.d.ts +14 -2
  44. package/dist/cjs/utils/is-address.d.ts +24 -1
  45. package/dist/cjs/utils/keccak256.d.ts +16 -2
  46. package/dist/cjs/utils/solidity-keccak256.d.ts +39 -2
  47. package/dist/cjs/utils/split-signature.d.ts +24 -2
  48. package/dist/cjs/utils/to-checksum-address.d.ts +17 -1
  49. package/dist/cjs/utils/to-utf8-bytes.d.ts +15 -1
  50. package/dist/cjs/utils/wei-to-ether.d.ts +27 -3
  51. package/dist/esm/classes/Contract.d.ts +11 -11
  52. package/dist/esm/classes/test/Contract/crv-abi.d.ts +2 -2
  53. package/dist/esm/classes/test/Contract/ens-abi.d.ts +2 -2
  54. package/dist/esm/classes/test/Contract/fei-abi.d.ts +2 -2
  55. package/dist/esm/classes/test/Contract/foo-abi.d.ts +2 -2
  56. package/dist/esm/classes/test/Contract/uniswap-abi.d.ts +2 -2
  57. package/dist/esm/classes/utils/clean-block.d.ts +2 -2
  58. package/dist/esm/classes/utils/clean-log.d.ts +2 -2
  59. package/dist/esm/classes/utils/clean-transaction-receipt.d.ts +2 -2
  60. package/dist/esm/classes/utils/clean-transaction.d.ts +2 -2
  61. package/dist/esm/classes/utils/encode-decode-transaction.d.ts +4 -4
  62. package/dist/esm/classes/utils/fetchers.d.ts +15 -15
  63. package/dist/esm/classes/utils/hex-to-decimal.d.ts +1 -1
  64. package/dist/esm/classes/utils/prepare-transaction.d.ts +2 -2
  65. package/dist/esm/index.d.ts +24 -25
  66. package/dist/esm/index.js +3 -4
  67. package/dist/esm/logger/logger.d.ts +11 -11
  68. package/dist/esm/logger/package-version.d.ts +1 -1
  69. package/dist/esm/logger/package-version.js +1 -1
  70. package/dist/esm/providers/AlchemyProvider.d.ts +4 -4
  71. package/dist/esm/providers/BaseProvider.d.ts +26 -26
  72. package/dist/esm/providers/FallthroughProvider.d.ts +11 -11
  73. package/dist/esm/providers/JsonRpcProvider.d.ts +7 -7
  74. package/dist/esm/providers/test/json-rpc-provider/get-logs/mocks.d.ts +14 -14
  75. package/dist/esm/providers/test/mock-of.d.ts +2 -2
  76. package/dist/esm/providers/test/rpc-urls.d.ts +12 -12
  77. package/dist/esm/providers/utils/chains-info.d.ts +24 -24
  78. package/dist/esm/shared/tiny-big/helpers.d.ts +1 -1
  79. package/dist/esm/shared/tiny-big/tiny-big.d.ts +10 -10
  80. package/dist/esm/shared/validate-type.d.ts +3 -3
  81. package/dist/esm/types/Block.types.d.ts +40 -40
  82. package/dist/esm/types/Contract.types.d.ts +24 -24
  83. package/dist/esm/types/FeeData.types.d.ts +7 -7
  84. package/dist/esm/types/Filter.types.d.ts +12 -12
  85. package/dist/esm/types/Network.types.d.ts +5 -5
  86. package/dist/esm/types/Transaction.types.d.ts +113 -113
  87. package/dist/esm/utils/bytes.d.ts +40 -40
  88. package/dist/esm/utils/compute-address.d.ts +1 -1
  89. package/dist/esm/utils/compute-public-key.d.ts +2 -2
  90. package/dist/esm/utils/ether-to-gwei.d.ts +3 -3
  91. package/dist/esm/utils/ether-to-wei.d.ts +3 -3
  92. package/dist/esm/utils/gwei-to-ether.d.ts +3 -3
  93. package/dist/esm/utils/hash-message.d.ts +2 -2
  94. package/dist/esm/utils/is-address.d.ts +1 -1
  95. package/dist/esm/utils/keccak256.d.ts +2 -2
  96. package/dist/esm/utils/solidity-keccak256.d.ts +2 -2
  97. package/dist/esm/utils/split-signature.d.ts +2 -2
  98. package/dist/esm/utils/to-checksum-address.d.ts +1 -1
  99. package/dist/esm/utils/to-utf8-bytes.d.ts +1 -1
  100. package/dist/esm/utils/wei-to-ether.d.ts +3 -3
  101. package/dist/{cjs/index.umd.js → essential-eth.umd.js} +2 -2
  102. package/dist/essential-eth.umd.js.map +1 -0
  103. package/package.json +8 -9
  104. package/readme.md +1 -1
  105. package/dist/cjs/index.umd.js.map +0 -1
@@ -1,11 +1,81 @@
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
- }
1
+ import type { JsonRpcProvider } from '../providers/JsonRpcProvider';
2
+ import type { ContractInterface } from '../types/Contract.types';
3
+ export declare class BaseContract {
4
+ /**
5
+ * The URL to your Eth node. Consider POKT or Infura
6
+ */
7
+ private readonly _address;
8
+ private readonly _provider;
9
+ /**
10
+ * @param addressOrName The ethereum address of the smart-contract
11
+ * @param contractInterface The JSON ABI of the smart-contract (like http://api.etherscan.io/api?module=contract&action=getabi&address=0x090d4613473dee047c3f2706764f49e0821d256e&format=raw)
12
+ * @param signerOrProvider An instantiated essential-eth provider
13
+ * @example
14
+ */
15
+ constructor(addressOrName: string, contractInterface: ContractInterface, signerOrProvider: JsonRpcProvider);
16
+ }
17
+ /**
18
+ * Applies the unique contract's methods to the instantiated Contract in the constructor based-upon the provided ABI
19
+ *
20
+ * @param object
21
+ * @param name
22
+ * @param value
23
+ * @internal
24
+ * @example
25
+ */
26
+ export declare function defineReadOnly<T>(object: T, name: string, value: any): void;
27
+ /**
28
+ * @alpha
29
+ * Only accepts ABIS in JSON format. This allows for stronger typing and assurances of data-types
30
+ * Only read-only function calls currently supported.
31
+ * @example
32
+ * ```typescript
33
+ * import { Contract, JsonRpcProvider } from 'essential-eth';
34
+ * // UNI airdrop contract
35
+ * const contractAddress = '0x090D4613473dEE047c3f2706764f49E0821D256e';
36
+ * const provider = new JsonRpcProvider();
37
+ * // for more robust contract calls, provide a fallback:
38
+ * // const provider = new FallthroughProvider(['bad', 'https://free-eth-node.com/api/eth']);
39
+ *
40
+ * const JSONABI = [
41
+ * {
42
+ * inputs: [
43
+ * {
44
+ * internalType: 'uint256',
45
+ * name: 'index',
46
+ * type: 'uint256',
47
+ * },
48
+ * ],
49
+ * name: 'isClaimed',
50
+ * outputs: [
51
+ * {
52
+ * internalType: 'bool',
53
+ * name: '',
54
+ * type: 'bool',
55
+ * },
56
+ * ],
57
+ * stateMutability: 'view',
58
+ * type: 'function',
59
+ * },
60
+ * ]
61
+ *
62
+ * const contract = new Contract(
63
+ * contractAddress,
64
+ * JSONABI,
65
+ * provider,
66
+ * );
67
+ *
68
+ * (async () => {
69
+ * // prints boolean as to whether index 0 has claimed airdrop or not
70
+ * console.log(await contract.isClaimed(0));
71
+ * })()
72
+ *
73
+ *
74
+ * ```
75
+ */
76
+ export declare class Contract extends BaseContract {
77
+ /**
78
+ * The function names on any given contract. Like "isClaimed", "merkleRoot", etc.
79
+ */
80
+ readonly [key: string]: any;
81
+ }
@@ -1,2 +1,2 @@
1
- import type { JSONABI } from '../../../types/Contract.types';
2
- export declare const abi: JSONABI;
1
+ import type { JSONABI } from '../../../types/Contract.types';
2
+ export declare const abi: JSONABI;
@@ -1,2 +1,2 @@
1
- import type { JSONABI } from '../../../types/Contract.types';
2
- export declare const ensABI: JSONABI;
1
+ import type { JSONABI } from '../../../types/Contract.types';
2
+ export declare const ensABI: JSONABI;
@@ -1,2 +1,2 @@
1
- import type { JSONABI } from '../../../types/Contract.types';
2
- export declare const feiABI: JSONABI;
1
+ import type { JSONABI } from '../../../types/Contract.types';
2
+ export declare const feiABI: JSONABI;
@@ -1,2 +1,2 @@
1
- import type { JSONABI } from '../../../types/Contract.types';
2
- export declare const fooABI: JSONABI;
1
+ import type { JSONABI } from '../../../types/Contract.types';
2
+ export declare const fooABI: JSONABI;
@@ -1,2 +1,2 @@
1
- import type { JSONABI } from '../../../types/Contract.types';
2
- export declare const uniswapABI: JSONABI;
1
+ import type { JSONABI } from '../../../types/Contract.types';
2
+ export declare const uniswapABI: JSONABI;
@@ -1,2 +1,120 @@
1
- import type { BlockResponse, RPCBlock } from '../../types/Block.types';
2
- export declare function cleanBlock(block: RPCBlock, returnTransactionObjects: boolean): BlockResponse;
1
+ import type { BlockResponse, RPCBlock } from '../../types/Block.types';
2
+ /**
3
+ * Converts RPC block response to more JS-friendly format
4
+ *
5
+ * @param block the RPCBlock to clean
6
+ * @param returnTransactionObjects whether or not to return the transactions specified in this block
7
+ * @returns a cleaned block
8
+ * @example
9
+ * ```js
10
+ * const rpcBlock = {
11
+ * number: '0x40f9de',
12
+ * hash: '0x4cbaa942e48a91108f38e2a250f6dbaff7fffe3027f5ebf76701929eed2b2970',
13
+ * parentHash: '0xc8de1e513f74cbc5cc77e2a39e4cada6504469a5d0e87200b708319c1e9ef154',
14
+ * sha3Uncles: '0x04d250716296c9662314b37c112e5ce8b1c9ad7fd7820a39482a3688a2078f2b',
15
+ * logsBloom: '0x0000400004000000040010100200000000000000000000000000000000000000001000000001000000000000000000000004010000000000000a800000000000040000000001000400000000000000000000000000000000000002000000000000000000000004000040000000800000000001000000000000000000000000000000000000000001000000000004200000000000000000000000000124400000000000000200100020000000000000000080000000000080001000000000000000000081000000000000000000008000000020000100000000200020100800000000000000000008002000000080001000020c00000000000000200000000000',
16
+ * transactionsRoot: '0xfc79f4f620cb69861ac67ceee5e1ddf3e45da95be230d4064be234f1ee491aa5',
17
+ * stateRoot: '0xfa5ef7e368997d70670b0ea3172aabefc2dee285786ce69c7165d8d854f8b292',
18
+ * receiptsRoot: '0x7fa0679e88fef8a8f7f5865dc4e6000ddcc267b14d2904948e3b1576a18a3bbd',
19
+ * miner: '0x1b7a75ef070ff49e6b9491a26403d799f2099ebd',
20
+ * difficulty: '0x47ede14fcbe635706e',
21
+ * totalDifficulty: '0x139e1de9b8404dedc5d30959',
22
+ * extraData: '0xce018c495249532d62613031656132',
23
+ * size: '0xb4f',
24
+ * gasLimit: '0x67c280',
25
+ * gasUsed: '0x56e2d',
26
+ * timestamp: '0x62648dc2',
27
+ * transactions: [
28
+ * '0xd53800afc69e55cc7a64b927803b46a5b4c5ddccbaafb6b32fe0ec883739b825',
29
+ * '0x4b8b07f35a1f911a80a0ffeebe3d3c41cd393b4d5e1ce0a408026705913d6760',
30
+ * '0xa50eac0ea8005cb1e4b95be4e64c24035d9c41adb164c49477c3169870f02fb1',
31
+ * '0x413e5293786f8b63e73adf0b74ab56067da4b564d01936b88b138d48cc414a42',
32
+ * '0xd4e4969365d144b0b987632dca36ba9e272254bdc687245987a57666d6afa148'
33
+ * ],
34
+ * uncles: [
35
+ * '0x36cd3869fd17a285b984dea8b705d34096e1fbdfe48df69ae530fbe921ba83fa'
36
+ * ],
37
+ * minimumGasPrice: '0x387ee40',
38
+ * bitcoinMergedMiningHeader: '0x0040502d717ae205da048b0ffb8e110603564d8677ca8bd3a54601000000000000000000e722e86bfebcae00bffb46c663fa0241b63a27f0c98fa710e421d5cc1afa2448d08d6462d9f809172f5e30aa',
39
+ * bitcoinMergedMiningCoinbaseTransaction: '0x00000000000001003f8757a906f0159f882f0968788a2e396b7bf8090e1b926fb2bb46789ac32d55082aca4e0800000000000000002b6a2952534b424c4f434b3a831a30935da1bd1e8631942fc7fa78f7a7b11d51ca39a1684d91a81f0040f9de00000000',
40
+ * bitcoinMergedMiningMerkleProof: '0xb53111a4e11bc19bf90268485d1b957d908ebc6a4cd9862aca3fc6ed3dcf3240b14c316de8521369d55dbfeb2b0116bcc10f40e999c4885e1bd2a08691bdea1c43862d590390a227a379d5677b958f1a23eecc16ac590ad675b8a4cea0c10da3ef597acb9ca1fe0a21fc408f09e0c7169d83aca8ddd636d8cc155f922e1d36c74b7cc11e9ee98dd1bf2100a55d59630c65da3db1575d58f165c5753c1779df90efcff9017b73cc32f4c87178bd0eae6a6dd0357047be70d6c4af17fcef097e80a9f1751447f4eee3831fc79f2d894934694149bcb99840a525f5128215eca6b54642af452ee7568a9281f40560afffd35725df31b98155d7813dea12e42f2a8052c7d98bcf62c9cdc66c40fb12b729b685a31aec4970ea5316640691ae5eb616808656a2bde4e9f5920ff178bf9d1f84e96a0d0bd048a3a8ca0d60970d02aacf7ecfb6e7feaec5c4a764873531cfd630e9430840cfe8b88154da25d6b94b706fe678d0efc1ecafed5a1f539e34552bea65622513b663e17e121f3c4548942584',
41
+ * hashForMergedMining: '0x831a30935da1bd1e8631942fc7fa78f7a7b11d51ca39a1684d91a81f0040f9de',
42
+ * paidFees: '0x1fb451615b58',
43
+ * cumulativeDifficulty: '0x8fdbe015f7248cf993'
44
+ * };
45
+ * const returnTransactionObjects = false;
46
+ *
47
+ * await cleanBlock(rpcBlock, returnTransactionObjects);
48
+ * // {
49
+ * // number: 4258270,
50
+ * // hash: '0x4cbaa942e48a91108f38e2a250f6dbaff7fffe3027f5ebf76701929eed2b2970',
51
+ * // parentHash: '0xc8de1e513f74cbc5cc77e2a39e4cada6504469a5d0e87200b708319c1e9ef154',
52
+ * // sha3Uncles: '0x04d250716296c9662314b37c112e5ce8b1c9ad7fd7820a39482a3688a2078f2b',
53
+ * // logsBloom: '0x0000400004000000040010100200000000000000000000000000000000000000001000000001000000000000000000000004010000000000000a800000000000040000000001000400000000000000000000000000000000000002000000000000000000000004000040000000800000000001000000000000000000000000000000000000000001000000000004200000000000000000000000000124400000000000000200100020000000000000000080000000000080001000000000000000000081000000000000000000008000000020000100000000200020100800000000000000000008002000000080001000020c00000000000000200000000000',
54
+ * // transactionsRoot: '0xfc79f4f620cb69861ac67ceee5e1ddf3e45da95be230d4064be234f1ee491aa5',
55
+ * // stateRoot: '0xfa5ef7e368997d70670b0ea3172aabefc2dee285786ce69c7165d8d854f8b292',
56
+ * // receiptsRoot: '0x7fa0679e88fef8a8f7f5865dc4e6000ddcc267b14d2904948e3b1576a18a3bbd',
57
+ * // miner: '0x1b7A75Ef070Ff49E6B9491a26403D799f2099EbD',
58
+ * // difficulty: Big {
59
+ * // s: 1,
60
+ * // e: 21,
61
+ * // c: [Array],
62
+ * // constructor: [Function],
63
+ * // padAndChop: [Function (anonymous)]
64
+ * // },
65
+ * // totalDifficulty: Big {
66
+ * // s: 1,
67
+ * // e: 27,
68
+ * // c: [Array],
69
+ * // constructor: [Function],
70
+ * // padAndChop: [Function (anonymous)]
71
+ * // },
72
+ * // extraData: '0xce018c495249532d62613031656132',
73
+ * // size: Big {
74
+ * // s: 1,
75
+ * // e: 3,
76
+ * // c: [Array],
77
+ * // constructor: [Function],
78
+ * // padAndChop: [Function (anonymous)]
79
+ * // },
80
+ * // gasLimit: Big {
81
+ * // s: 1,
82
+ * // e: 6,
83
+ * // c: [Array],
84
+ * // constructor: [Function],
85
+ * // padAndChop: [Function (anonymous)]
86
+ * // },
87
+ * // gasUsed: Big {
88
+ * // s: 1,
89
+ * // e: 5,
90
+ * // c: [Array],
91
+ * // constructor: [Function],
92
+ * // padAndChop: [Function (anonymous)]
93
+ * // },
94
+ * // timestamp: Big {
95
+ * // s: 1,
96
+ * // e: 9,
97
+ * // c: [Array],
98
+ * // constructor: [Function],
99
+ * // padAndChop: [Function (anonymous)]
100
+ * // },
101
+ * // transactions: [
102
+ * // '0xd53800afc69e55cc7a64b927803b46a5b4c5ddccbaafb6b32fe0ec883739b825',
103
+ * // '0x4b8b07f35a1f911a80a0ffeebe3d3c41cd393b4d5e1ce0a408026705913d6760',
104
+ * // '0xa50eac0ea8005cb1e4b95be4e64c24035d9c41adb164c49477c3169870f02fb1',
105
+ * // '0x413e5293786f8b63e73adf0b74ab56067da4b564d01936b88b138d48cc414a42',
106
+ * // '0xd4e4969365d144b0b987632dca36ba9e272254bdc687245987a57666d6afa148'
107
+ * // ],
108
+ * // uncles: [
109
+ * // '0x36cd3869fd17a285b984dea8b705d34096e1fbdfe48df69ae530fbe921ba83fa'
110
+ * // ],
111
+ * // minimumGasPrice: '0x387ee40',
112
+ * // bitcoinMergedMiningHeader: '0x0040502d717ae205da048b0ffb8e110603564d8677ca8bd3a54601000000000000000000e722e86bfebcae00bffb46c663fa0241b63a27f0c98fa710e421d5cc1afa2448d08d6462d9f809172f5e30aa',
113
+ * // bitcoinMergedMiningCoinbaseTransaction: '0x00000000000001003f8757a906f0159f882f0968788a2e396b7bf8090e1b926fb2bb46789ac32d55082aca4e0800000000000000002b6a2952534b424c4f434b3a831a30935da1bd1e8631942fc7fa78f7a7b11d51ca39a1684d91a81f0040f9de00000000',
114
+ * // bitcoinMergedMiningMerkleProof: '0xb53111a4e11bc19bf90268485d1b957d908ebc6a4cd9862aca3fc6ed3dcf3240b14c316de8521369d55dbfeb2b0116bcc10f40e999c4885e1bd2a08691bdea1c43862d590390a227a379d5677b958f1a23eecc16ac590ad675b8a4cea0c10da3ef597acb9ca1fe0a21fc408f09e0c7169d83aca8ddd636d8cc155f922e1d36c74b7cc11e9ee98dd1bf2100a55d59630c65da3db1575d58f165c5753c1779df90efcff9017b73cc32f4c87178bd0eae6a6dd0357047be70d6c4af17fcef097e80a9f1751447f4eee3831fc79f2d894934694149bcb99840a525f5128215eca6b54642af452ee7568a9281f40560afffd35725df31b98155d7813dea12e42f2a8052c7d98bcf62c9cdc66c40fb12b729b685a31aec4970ea5316640691ae5eb616808656a2bde4e9f5920ff178bf9d1f84e96a0d0bd048a3a8ca0d60970d02aacf7ecfb6e7feaec5c4a764873531cfd630e9430840cfe8b88154da25d6b94b706fe678d0efc1ecafed5a1f539e34552bea65622513b663e17e121f3c4548942584',
115
+ * // hashForMergedMining: '0x831a30935da1bd1e8631942fc7fa78f7a7b11d51ca39a1684d91a81f0040f9de',
116
+ * // paidFees: '0x1fb451615b58',
117
+ * // cumulativeDifficulty: '0x8fdbe015f7248cf993'
118
+ * // }
119
+ */
120
+ export declare function cleanBlock(block: RPCBlock, returnTransactionObjects: boolean): BlockResponse;
@@ -1,2 +1,9 @@
1
- import type { Log, RPCLog } from './../../types/Transaction.types';
2
- export declare function cleanLog(log: RPCLog, receiptLog: boolean): Log;
1
+ import type { Log, RPCLog } from './../../types/Transaction.types';
2
+ /**
3
+ * Converts RPC log receipt response to more JS-friendly format
4
+ *
5
+ * @param log the log to clean
6
+ * @param receiptLog if the log is part of a transaction receipt. Used to remove certain keys from log
7
+ * @example
8
+ */
9
+ export declare function cleanLog(log: RPCLog, receiptLog: boolean): Log;
@@ -1,2 +1,14 @@
1
- import type { RPCTransactionReceipt, TransactionReceipt } from '../../types/Transaction.types';
2
- export declare function cleanTransactionReceipt(transactionReceipt: RPCTransactionReceipt): TransactionReceipt;
1
+ import type { RPCTransactionReceipt, TransactionReceipt } from '../../types/Transaction.types';
2
+ /**
3
+ * Converts RPC transaction receipt response to more JS-friendly format
4
+ *
5
+ * @param transactionReceipt the transaction receipt to clean
6
+ * @returns a cleaned transaction receipt
7
+ * @example
8
+ * ```javascript
9
+ * const RPCTransactionReceipt = { blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: '0xe28f62', contractAddress: null, cumulativeGasUsed: '0x37a2b9', effectiveGasPrice: '0x62df1c62c', from: '0x642824fab1d0141073ed74326332950bec4701e3', gasUsed: '0x1a325', logs: [ { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 84, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x000000000000000000000000000000000000000000000000000000000000074d' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 85, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x000000000000000000000000000000000000000000000000000000000000074e' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 86, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x000000000000000000000000000000000000000000000000000000000000074f' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 87, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x0000000000000000000000000000000000000000000000000000000000000750' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 88, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x0000000000000000000000000000000000000000000000000000000000000751' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 89, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x0000000000000000000000000000000000000000000000000000000000000752' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 90, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x0000000000000000000000000000000000000000000000000000000000000753' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 91, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x0000000000000000000000000000000000000000000000000000000000000754' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 92, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x0000000000000000000000000000000000000000000000000000000000000755' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 93, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x0000000000000000000000000000000000000000000000000000000000000756' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 } ], logsBloom: '0x20000080004000000000000400000000000001000000000400000000000000000000000000000000000000000008000000000000000000000000000000004000000000000008000000000008000000010080000014000004000000000000000000100000020800000000000000001800000080000000002000000010000000000000000000000200000200000000002000000000000400000000000000000000000000000000000000000040000000000000000100000000000000000000040002100002000000000000080000000000000100000002000000040000001220000000000000000000000000000000000000000000000000000000000000004000', status: '0x1', to: '0x84f80ea01e26b7c11bdd241970982c7eeab6ddcc', transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: '0x29', type: '0x2' }
10
+ * cleanTransactionReceipt(RPCTransactionReceipt);
11
+ * // { blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, contractAddress: null, cumulativeGasUsed: Big { s: 1, e: 6, c: [ 3, 6, 4, 6, 1, 3, 7 ], constructor: { [λ: Big] DP: 20, RM: 1, NE: -7, PE: 21, strict: false, roundDown: 0, roundHalfUp: 1, roundHalfEven: 2, roundUp: 3, Big: [Circular], default: [Circular] }, padAndChop: [λ] }, effectiveGasPrice: Big { s: 1, e: 10, c: [ 2, 6, 5, 4, 0, 6, 2, 3, 4, 0, 4 ], constructor: { [λ: Big] DP: 20, RM: 1, NE: -7, PE: 21, strict: false, roundDown: 0, roundHalfUp: 1, roundHalfEven: 2, roundUp: 3, Big: [Circular], default: [Circular] }, padAndChop: [λ] }, from: '0x642824FaB1D0141073ed74326332950bEc4701e3', gasUsed: Big { s: 1, e: 5, c: [ 1, 0, 7, 3, 0, 1 ], constructor: { [λ: Big] DP: 20, RM: 1, NE: -7, PE: 21, strict: false, roundDown: 0, roundHalfUp: 1, roundHalfEven: 2, roundUp: 3, Big: [Circular], default: [Circular] }, padAndChop: [λ] }, logs: [ { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 84, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x000000000000000000000000000000000000000000000000000000000000074d' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 85, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x000000000000000000000000000000000000000000000000000000000000074e' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 86, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x000000000000000000000000000000000000000000000000000000000000074f' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 87, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x0000000000000000000000000000000000000000000000000000000000000750' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 88, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x0000000000000000000000000000000000000000000000000000000000000751' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 89, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x0000000000000000000000000000000000000000000000000000000000000752' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 90, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x0000000000000000000000000000000000000000000000000000000000000753' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 91, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x0000000000000000000000000000000000000000000000000000000000000754' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 92, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x0000000000000000000000000000000000000000000000000000000000000755' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 }, { address: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, data: '0x', logIndex: 93, topics: [ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000642824fab1d0141073ed74326332950bec4701e3', '0x0000000000000000000000000000000000000000000000000000000000000756' ], transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41 } ], logsBloom: '0x20000080004000000000000400000000000001000000000400000000000000000000000000000000000000000008000000000000000000000000000000004000000000000008000000000008000000010080000014000004000000000000000000100000020800000000000000001800000080000000002000000010000000000000000000000200000200000000002000000000000400000000000000000000000000000000000000000040000000000000000100000000000000000000040002100002000000000000080000000000000100000002000000040000001220000000000000000000000000000000000000000000000000000000000000004000', status: 1, to: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', transactionHash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', transactionIndex: 41, type: 2, byzantium: true, confirmations: 40 }
12
+ * ```
13
+ */
14
+ export declare function cleanTransactionReceipt(transactionReceipt: RPCTransactionReceipt): TransactionReceipt;
@@ -1,2 +1,14 @@
1
- import type { RPCTransaction, TransactionResponse } from '../../types/Transaction.types';
2
- export declare function cleanTransaction(transaction: RPCTransaction): TransactionResponse;
1
+ import type { RPCTransaction, TransactionResponse } from '../../types/Transaction.types';
2
+ /**
3
+ * Converts RPC transaction response to more JS-friendly format
4
+ *
5
+ * @param transaction the transaction to clean
6
+ * @returns a cleaned transaction
7
+ * @example
8
+ * ```javascript
9
+ * const RPCTransaction = { accessList: [], blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: '0xe28f62', chainId: '0x1', from: '0x642824fab1d0141073ed74326332950bec4701e3', gas: '0x274b7', gasPrice: '0x62df1c62c', hash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', input: '0xa0712d68000000000000000000000000000000000000000000000000000000000000000a', maxFeePerGas: '0x98808e3f0', maxPriorityFeePerGas: '0x3b9aca00', nonce: '0x42', r: '0x304682f8b22006dd1347c3722f6e43a5ad8e3a1ae51939cc0d6f07981602f5c0', s: '0x207ad110eb5c014cb628814b92396785fabfbe74542293300eeadf156f50f105', to: '0x84f80ea01e26b7c11bdd241970982c7eeab6ddcc', transactionIndex: '0x29', type: '0x2', v: '0x1', value: '0x470de4df820000' }
10
+ * cleanTransaction(RPCTransaction);
11
+ * // { accessList: [], blockHash: '0x03ddc6a835462f750fcaf5ab511d8c48121b0813e3e80de84d7adc3ef192b7bf', blockNumber: 14847842, chainId: 1, from: '0x642824FaB1D0141073ed74326332950bEc4701e3', gas: Big { s: 1, e: 5, c: [ 1, 6, 0, 9, 5, 1 ], constructor: { [λ: Big] DP: 20, RM: 1, NE: -7, PE: 21, strict: false, roundDown: 0, roundHalfUp: 1, roundHalfEven: 2, roundUp: 3, Big: [Circular], default: [Circular] }, padAndChop: [λ] }, gasPrice: Big { s: 1, e: 10, c: [ 2, 6, 5, 4, 0, 6, 2, 3, 4, 0, 4 ], constructor: { [λ: Big] DP: 20, RM: 1, NE: -7, PE: 21, strict: false, roundDown: 0, roundHalfUp: 1, roundHalfEven: 2, roundUp: 3, Big: [Circular], default: [Circular] }, padAndChop: [λ] }, hash: '0xd0befcb9d10a89aba2d488534811bf5c62a889e2499d23cdd83c2a2200cde873', input: '0xa0712d68000000000000000000000000000000000000000000000000000000000000000a', maxFeePerGas: Big { s: 1, e: 10, c: [ 4, 0, 9, 3, 6, 9, 8, 9, 6, 8 ], constructor: { [λ: Big] DP: 20, RM: 1, NE: -7, PE: 21, strict: false, roundDown: 0, roundHalfUp: 1, roundHalfEven: 2, roundUp: 3, Big: [Circular], default: [Circular] }, padAndChop: [λ] }, maxPriorityFeePerGas: Big { s: 1, e: 9, c: [ 1 ], constructor: { [λ: Big] DP: 20, RM: 1, NE: -7, PE: 21, strict: false, roundDown: 0, roundHalfUp: 1, roundHalfEven: 2, roundUp: 3, Big: [Circular], default: [Circular] }, padAndChop: [λ] }, nonce: 66, r: '0x304682f8b22006dd1347c3722f6e43a5ad8e3a1ae51939cc0d6f07981602f5c0', s: '0x207ad110eb5c014cb628814b92396785fabfbe74542293300eeadf156f50f105', to: '0x84F80EA01e26B7C11bdd241970982C7EEAb6DdcC', transactionIndex: 41, type: 2, v: 1, value: Big { s: 1, e: 16, c: [ 2 ], constructor: { [λ: Big] DP: 20, RM: 1, NE: -7, PE: 21, strict: false, roundDown: 0, roundHalfUp: 1, roundHalfEven: 2, roundUp: 3, Big: [Circular], default: [Circular] }, padAndChop: [λ] }, confirmations: 53 }
12
+ * ```
13
+ */
14
+ export declare function cleanTransaction(transaction: RPCTransaction): TransactionResponse;
@@ -1,4 +1,16 @@
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("../../shared/tiny-big/tiny-big").TinyBig | (string | number | boolean | import("../../shared/tiny-big/tiny-big").TinyBig)[];
1
+ import type { JSONABIArgument } from '../../types/Contract.types';
2
+ export declare const hexFalse: string;
3
+ /**
4
+ *
5
+ * @param jsonABIArgument
6
+ * @param args
7
+ * @example
8
+ */
9
+ export declare function encodeData(jsonABIArgument: JSONABIArgument, args: any[]): string;
10
+ /**
11
+ * @internal
12
+ * @param jsonABIArgument
13
+ * @param nodeResponse
14
+ * @example
15
+ */
16
+ export declare function decodeRPCResponse(jsonABIArgument: JSONABIArgument, nodeResponse: string): string | number | boolean | import("../../shared/tiny-big/tiny-big").TinyBig | (string | number | boolean | import("../../shared/tiny-big/tiny-big").TinyBig)[];
@@ -1,15 +1,53 @@
1
- export declare function buildFetchInit<T>(body: T): {
2
- method: string;
3
- headers: {
4
- 'Content-Type': string;
5
- };
6
- body: string;
7
- };
8
- export declare function post(url: string, body: Record<string, unknown>): Promise<any>;
9
- export 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';
10
- export declare function buildRPCPostBody(method: RPCMethodName, params: unknown[]): {
11
- jsonrpc: string;
12
- id: number;
13
- method: RPCMethodName;
14
- params: unknown[];
15
- };
1
+ /**
2
+ * Forms the init field for http fetching
3
+ *
4
+ * @param body
5
+ * @internal
6
+ */
7
+ export declare function buildFetchInit<T>(body: T): {
8
+ method: string;
9
+ headers: {
10
+ 'Content-Type': string;
11
+ };
12
+ body: string;
13
+ };
14
+ /**
15
+ * Makes a post request with the specified JSON data, normally to the a Ethereum JSON RPC API endpoint
16
+ *
17
+ * @internal
18
+ * @param url the URL to send the request to
19
+ * @param body JSON POST body
20
+ * @returns the JSON response from the server
21
+ * @example
22
+ * ```javascript
23
+ * post('https://free-eth-node.com/api/eth', { jsonrpc: '2.0', id: 1, method: 'eth_gasPrice', params: [] });
24
+ * // '0x66fa8dbfd'
25
+ *
26
+ * post('https://free-eth-node.com/api/eth', { jsonrpc: '2.0', id: 1, method: 'eth_getBalance', params: [ '0x4a986a6dCA6dbf99bC3d17F8D71aFb0d60e740f8', 'latest' ] });
27
+ * // '0x312faeb995df61d4'
28
+ * ```
29
+ */
30
+ export declare function post(url: string, body: Record<string, unknown>): Promise<any>;
31
+ export 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';
32
+ /**
33
+ * Prepares data to be sent using the {@link post} function. Data is prepared per the {@link https://en.wikipedia.org/wiki/JSON-RPC#Examples JSON RPC v2 spec}
34
+ *
35
+ * @internal
36
+ * @param method the RPC method to be invoked
37
+ * @param params the parameters to be passed to the defined method
38
+ * @returns a POST method body matching the {@link https://en.wikipedia.org/wiki/JSON-RPC#Examples JSON RPC v2 spec}
39
+ * @example
40
+ * ```javascript
41
+ * buildRPCPostBody('eth_gasPrice', []);
42
+ * // { jsonrpc: '2.0', id: 1, method: 'eth_gasPrice', params: [] }
43
+ *
44
+ * buildRPCPostBody('eth_getBalance', ['0x407d73d8a49eeb85d32cf465507dd71d507100c1', 'latest']);
45
+ * // { jsonrpc: '2.0', id: 1, method: 'eth_getBalance', params: [ '0x4a986a6dCA6dbf99bC3d17F8D71aFb0d60e740f8', 'latest' ] }
46
+ * ```
47
+ */
48
+ export declare function buildRPCPostBody(method: RPCMethodName, params: unknown[]): {
49
+ jsonrpc: string;
50
+ id: number;
51
+ method: RPCMethodName;
52
+ params: unknown[];
53
+ };
@@ -1 +1,18 @@
1
- export declare function hexToDecimal(hex: string): string;
1
+ /**
2
+ * Converts a hexadecimal string it's decimal equivalent.
3
+ * This is needed instead of parseInt because parseInt loses precision.
4
+ *
5
+ * @param hex the hex string to be converted to decimal
6
+ * @returns a decimal value equivalent to the hex string given
7
+ * @example
8
+ * ```javascript
9
+ * hexToDecimal('0x34');
10
+ * // 52
11
+ * ```
12
+ * @example
13
+ * ```javascript
14
+ * hexToDecimal('0x628608');
15
+ * // 6456840
16
+ * ```
17
+ */
18
+ export declare function hexToDecimal(hex: string): string;
@@ -1,2 +1,6 @@
1
- import type { RPCTransactionRequest, TransactionRequest } from './../../types/Transaction.types';
2
- export declare function prepareTransaction(transaction: TransactionRequest): RPCTransactionRequest;
1
+ import type { RPCTransactionRequest, TransactionRequest } from './../../types/Transaction.types';
2
+ /**
3
+ * @param transaction
4
+ * @example
5
+ */
6
+ export declare function prepareTransaction(transaction: TransactionRequest): RPCTransactionRequest;
@@ -1,25 +1,24 @@
1
- export { Contract, BaseContract } from './classes/Contract';
2
- export { AlchemyProvider } from './providers/AlchemyProvider';
3
- export { FallthroughProvider, ConstructorOptions, } from './providers/FallthroughProvider';
4
- export { jsonRpcProvider, JsonRpcProvider } from './providers/JsonRpcProvider';
5
- export { tinyBig, TinyBig } from './shared/tiny-big/tiny-big';
6
- export { BlockResponse, RPCBlock, BlockTag } from './types/Block.types';
7
- export { ContractTypes, JSONABI, JSONABIArgument, } from './types/Contract.types';
8
- export { Filter, FilterByBlockHash } from './types/Filter.types';
9
- export { Network } from './types/Network.types';
10
- export { TransactionResponse, RPCTransaction, RPCTransactionReceipt, TransactionRequest, RPCTransactionRequest, TransactionReceipt, RPCLog, Log, BlockTransactionResponse, } from './types/Transaction.types';
11
- export { computeAddress } from './utils/compute-address';
12
- export { computePublicKey } from './utils/compute-public-key';
13
- export { etherToGwei } from './utils/ether-to-gwei';
14
- export { etherToWei } from './utils/ether-to-wei';
15
- export { gweiToEther } from './utils/gwei-to-ether';
16
- export { hashMessage } from './utils/hash-message';
17
- export { isAddress } from './utils/is-address';
18
- export { splitSignature } from './utils/split-signature';
19
- export { toChecksumAddress } from './utils/to-checksum-address';
20
- export { toUtf8Bytes } from './utils/to-utf8-bytes';
21
- export { weiToEther } from './utils/wei-to-ether';
22
- export * from './utils/bytes';
23
- export * from './utils/hash-message';
24
- export * from './utils/keccak256';
25
- export * from './utils/solidity-keccak256';
1
+ export { Contract, BaseContract } from './classes/Contract';
2
+ export { AlchemyProvider } from './providers/AlchemyProvider';
3
+ export { FallthroughProvider, ConstructorOptions, } from './providers/FallthroughProvider';
4
+ export { jsonRpcProvider, JsonRpcProvider } from './providers/JsonRpcProvider';
5
+ export { tinyBig, TinyBig } from './shared/tiny-big/tiny-big';
6
+ export { BlockResponse, RPCBlock, BlockTag } from './types/Block.types';
7
+ export { ContractTypes, JSONABI, JSONABIArgument, } from './types/Contract.types';
8
+ export { Filter, FilterByBlockHash } from './types/Filter.types';
9
+ export { Network } from './types/Network.types';
10
+ export { TransactionResponse, RPCTransaction, RPCTransactionReceipt, TransactionRequest, RPCTransactionRequest, TransactionReceipt, RPCLog, Log, BlockTransactionResponse, } from './types/Transaction.types';
11
+ export { computeAddress } from './utils/compute-address';
12
+ export { computePublicKey } from './utils/compute-public-key';
13
+ export { etherToGwei } from './utils/ether-to-gwei';
14
+ export { etherToWei } from './utils/ether-to-wei';
15
+ export { gweiToEther } from './utils/gwei-to-ether';
16
+ export { hashMessage } from './utils/hash-message';
17
+ export { isAddress } from './utils/is-address';
18
+ export { splitSignature } from './utils/split-signature';
19
+ export { toChecksumAddress } from './utils/to-checksum-address';
20
+ export { toUtf8Bytes } from './utils/to-utf8-bytes';
21
+ export { weiToEther } from './utils/wei-to-ether';
22
+ export { Bytes, BytesLike, BytesLikeWithNumber, DataOptions, Hexable, SignatureLike, Signature, isBytesLike, isBytes, arrayify, concat, stripZeros, zeroPad, isHexString, hexlify, hexDataLength, hexDataSlice, hexConcat, hexValue, hexStripZeros, hexZeroPad, } from './utils/bytes';
23
+ export { keccak256 } from './utils/keccak256';
24
+ export { pack, solidityKeccak256 } from './utils/solidity-keccak256';
package/dist/cjs/index.js CHANGED
@@ -1,20 +1,6 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.weiToEther = exports.toUtf8Bytes = exports.toChecksumAddress = exports.splitSignature = exports.isAddress = exports.hashMessage = exports.gweiToEther = exports.etherToWei = exports.etherToGwei = exports.computePublicKey = exports.computeAddress = exports.TinyBig = exports.tinyBig = exports.JsonRpcProvider = exports.jsonRpcProvider = exports.FallthroughProvider = exports.AlchemyProvider = exports.BaseContract = exports.Contract = void 0;
3
+ exports.solidityKeccak256 = exports.pack = exports.keccak256 = exports.hexZeroPad = exports.hexStripZeros = exports.hexValue = exports.hexConcat = exports.hexDataSlice = exports.hexDataLength = exports.hexlify = exports.isHexString = exports.zeroPad = exports.stripZeros = exports.concat = exports.arrayify = exports.isBytes = exports.isBytesLike = exports.weiToEther = exports.toUtf8Bytes = exports.toChecksumAddress = exports.splitSignature = exports.isAddress = exports.hashMessage = exports.gweiToEther = exports.etherToWei = exports.etherToGwei = exports.computePublicKey = exports.computeAddress = exports.TinyBig = exports.tinyBig = exports.JsonRpcProvider = exports.jsonRpcProvider = exports.FallthroughProvider = exports.AlchemyProvider = exports.BaseContract = exports.Contract = void 0;
18
4
  var Contract_1 = require("./classes/Contract");
19
5
  Object.defineProperty(exports, "Contract", { enumerable: true, get: function () { return Contract_1.Contract; } });
20
6
  Object.defineProperty(exports, "BaseContract", { enumerable: true, get: function () { return Contract_1.BaseContract; } });
@@ -50,7 +36,23 @@ var to_utf8_bytes_1 = require("./utils/to-utf8-bytes");
50
36
  Object.defineProperty(exports, "toUtf8Bytes", { enumerable: true, get: function () { return to_utf8_bytes_1.toUtf8Bytes; } });
51
37
  var wei_to_ether_1 = require("./utils/wei-to-ether");
52
38
  Object.defineProperty(exports, "weiToEther", { enumerable: true, get: function () { return wei_to_ether_1.weiToEther; } });
53
- __exportStar(require("./utils/bytes"), exports);
54
- __exportStar(require("./utils/hash-message"), exports);
55
- __exportStar(require("./utils/keccak256"), exports);
56
- __exportStar(require("./utils/solidity-keccak256"), exports);
39
+ var bytes_1 = require("./utils/bytes");
40
+ Object.defineProperty(exports, "isBytesLike", { enumerable: true, get: function () { return bytes_1.isBytesLike; } });
41
+ Object.defineProperty(exports, "isBytes", { enumerable: true, get: function () { return bytes_1.isBytes; } });
42
+ Object.defineProperty(exports, "arrayify", { enumerable: true, get: function () { return bytes_1.arrayify; } });
43
+ Object.defineProperty(exports, "concat", { enumerable: true, get: function () { return bytes_1.concat; } });
44
+ Object.defineProperty(exports, "stripZeros", { enumerable: true, get: function () { return bytes_1.stripZeros; } });
45
+ Object.defineProperty(exports, "zeroPad", { enumerable: true, get: function () { return bytes_1.zeroPad; } });
46
+ Object.defineProperty(exports, "isHexString", { enumerable: true, get: function () { return bytes_1.isHexString; } });
47
+ Object.defineProperty(exports, "hexlify", { enumerable: true, get: function () { return bytes_1.hexlify; } });
48
+ Object.defineProperty(exports, "hexDataLength", { enumerable: true, get: function () { return bytes_1.hexDataLength; } });
49
+ Object.defineProperty(exports, "hexDataSlice", { enumerable: true, get: function () { return bytes_1.hexDataSlice; } });
50
+ Object.defineProperty(exports, "hexConcat", { enumerable: true, get: function () { return bytes_1.hexConcat; } });
51
+ Object.defineProperty(exports, "hexValue", { enumerable: true, get: function () { return bytes_1.hexValue; } });
52
+ Object.defineProperty(exports, "hexStripZeros", { enumerable: true, get: function () { return bytes_1.hexStripZeros; } });
53
+ Object.defineProperty(exports, "hexZeroPad", { enumerable: true, get: function () { return bytes_1.hexZeroPad; } });
54
+ var keccak256_1 = require("./utils/keccak256");
55
+ Object.defineProperty(exports, "keccak256", { enumerable: true, get: function () { return keccak256_1.keccak256; } });
56
+ var solidity_keccak256_1 = require("./utils/solidity-keccak256");
57
+ Object.defineProperty(exports, "pack", { enumerable: true, get: function () { return solidity_keccak256_1.pack; } });
58
+ Object.defineProperty(exports, "solidityKeccak256", { enumerable: true, get: function () { return solidity_keccak256_1.solidityKeccak256; } });
@@ -1,11 +1,11 @@
1
- declare class Logger {
2
- private packageVersion;
3
- constructor();
4
- throwError(message: string, args: {
5
- [key: string]: any;
6
- }): never;
7
- throwArgumentError(message: string, arg: string, value: any): never;
8
- checkSafeUint53(value: number, message?: string): void;
9
- }
10
- export declare const logger: Logger;
11
- export {};
1
+ declare class Logger {
2
+ private packageVersion;
3
+ constructor();
4
+ throwError(message: string, args: {
5
+ [key: string]: any;
6
+ }): never;
7
+ throwArgumentError(message: string, arg: string, value: any): never;
8
+ checkSafeUint53(value: number, message?: string): void;
9
+ }
10
+ export declare const logger: Logger;
11
+ export {};
@@ -1 +1 @@
1
- export declare const version = "0.9.2-beta.2";
1
+ export declare const version = "0.9.2-beta.4";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // Generated by genversion.
5
- exports.version = '0.9.2-beta.2';
5
+ exports.version = '0.9.2-beta.4';
@@ -1,4 +1,4 @@
1
- import { JsonRpcProvider } from './JsonRpcProvider';
2
- export declare class AlchemyProvider extends JsonRpcProvider {
3
- constructor(apiKey: string, network?: string);
4
- }
1
+ import { JsonRpcProvider } from './JsonRpcProvider';
2
+ export declare class AlchemyProvider extends JsonRpcProvider {
3
+ constructor(apiKey: string, network?: string);
4
+ }