essential-eth 0.5.0 → 0.5.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 (77) hide show
  1. package/lib/cjs/classes/Contract.d.ts +3 -2
  2. package/lib/cjs/classes/Contract.js +3 -2
  3. package/lib/cjs/classes/utils/clean-transaction-receipt.d.ts +5 -0
  4. package/lib/cjs/classes/utils/clean-transaction-receipt.js +55 -0
  5. package/lib/cjs/classes/utils/encode-decode-transaction.d.ts +1 -0
  6. package/lib/cjs/classes/utils/encode-decode-transaction.js +4 -4
  7. package/lib/cjs/classes/utils/fetchers.d.ts +1 -1
  8. package/lib/cjs/index.d.ts +7 -2
  9. package/lib/cjs/index.js +24 -3
  10. package/lib/cjs/logger/logger.d.ts +11 -0
  11. package/lib/cjs/logger/logger.js +36 -0
  12. package/lib/cjs/logger/package-version.d.ts +1 -0
  13. package/lib/cjs/logger/package-version.js +5 -0
  14. package/lib/cjs/providers/BaseProvider.d.ts +270 -0
  15. package/lib/cjs/providers/BaseProvider.js +361 -0
  16. package/lib/cjs/providers/FallthroughProvider.d.ts +25 -0
  17. package/lib/cjs/providers/FallthroughProvider.js +65 -0
  18. package/lib/cjs/providers/JsonRpcProvider.d.ts +4 -200
  19. package/lib/cjs/providers/JsonRpcProvider.js +11 -263
  20. package/lib/cjs/providers/test/rpc-urls.d.ts +1 -0
  21. package/lib/cjs/providers/test/rpc-urls.js +1 -0
  22. package/lib/cjs/providers/utils/chains-info.d.ts +8 -0
  23. package/lib/cjs/providers/utils/chains-info.js +24 -0
  24. package/lib/cjs/shared/tiny-big/tiny-big.d.ts +9 -2
  25. package/lib/cjs/shared/tiny-big/tiny-big.js +27 -9
  26. package/lib/cjs/types/Transaction.types.d.ts +53 -0
  27. package/lib/cjs/utils/bytes.d.ts +172 -0
  28. package/lib/cjs/utils/bytes.js +564 -0
  29. package/lib/cjs/utils/hash-message.d.ts +12 -0
  30. package/lib/cjs/utils/hash-message.js +26 -0
  31. package/lib/cjs/utils/keccak256.d.ts +2 -0
  32. package/lib/cjs/utils/keccak256.js +17 -0
  33. package/lib/cjs/utils/solidity-keccak256.d.ts +29 -0
  34. package/lib/cjs/utils/solidity-keccak256.js +118 -0
  35. package/lib/cjs/utils/to-utf8-bytes.d.ts +1 -0
  36. package/lib/cjs/utils/to-utf8-bytes.js +7 -0
  37. package/lib/esm/classes/Contract.js +1 -1
  38. package/lib/esm/classes/utils/clean-transaction-receipt.d.ts +2 -0
  39. package/lib/esm/classes/utils/clean-transaction-receipt.js +48 -0
  40. package/lib/esm/classes/utils/encode-decode-transaction.d.ts +1 -0
  41. package/lib/esm/classes/utils/encode-decode-transaction.js +2 -2
  42. package/lib/esm/classes/utils/fetchers.d.ts +1 -1
  43. package/lib/esm/index.d.ts +7 -2
  44. package/lib/esm/index.js +7 -2
  45. package/lib/esm/logger/logger.d.ts +11 -0
  46. package/lib/esm/logger/logger.js +33 -0
  47. package/lib/esm/logger/package-version.d.ts +1 -0
  48. package/lib/esm/logger/package-version.js +1 -0
  49. package/lib/esm/providers/BaseProvider.d.ts +18 -0
  50. package/lib/esm/providers/BaseProvider.js +101 -0
  51. package/lib/esm/providers/FallthroughProvider.d.ts +12 -0
  52. package/lib/esm/providers/FallthroughProvider.js +41 -0
  53. package/lib/esm/providers/JsonRpcProvider.d.ts +4 -12
  54. package/lib/esm/providers/JsonRpcProvider.js +8 -69
  55. package/lib/esm/providers/test/rpc-urls.d.ts +1 -0
  56. package/lib/esm/providers/test/rpc-urls.js +1 -0
  57. package/lib/esm/providers/utils/chains-info.d.ts +8 -0
  58. package/lib/esm/providers/utils/chains-info.js +24 -0
  59. package/lib/esm/shared/tiny-big/tiny-big.d.ts +2 -0
  60. package/lib/esm/shared/tiny-big/tiny-big.js +20 -7
  61. package/lib/esm/types/Transaction.types.d.ts +45 -0
  62. package/lib/esm/utils/bytes.d.ts +40 -0
  63. package/lib/esm/utils/bytes.js +245 -0
  64. package/lib/esm/utils/hash-message.d.ts +2 -0
  65. package/lib/esm/utils/hash-message.js +12 -0
  66. package/lib/esm/utils/keccak256.d.ts +2 -0
  67. package/lib/esm/utils/keccak256.js +13 -0
  68. package/lib/esm/utils/solidity-keccak256.d.ts +2 -0
  69. package/lib/esm/utils/solidity-keccak256.js +85 -0
  70. package/lib/esm/utils/to-utf8-bytes.d.ts +1 -0
  71. package/lib/esm/utils/to-utf8-bytes.js +3 -0
  72. package/package.json +19 -19
  73. package/readme.md +36 -5
  74. package/lib/cjs/utils/hex-zero-pad.d.ts +0 -32
  75. package/lib/cjs/utils/hex-zero-pad.js +0 -52
  76. package/lib/esm/utils/hex-zero-pad.d.ts +0 -1
  77. package/lib/esm/utils/hex-zero-pad.js +0 -17
@@ -18,8 +18,9 @@ export declare class BaseContract {
18
18
  */
19
19
  export declare function defineReadOnly<T>(object: T, name: string, value: any): void;
20
20
  /**
21
+ * @alpha
21
22
  * Only accepts ABIS in JSON format. This allows for stronger typing and assurances of data-types
22
- *
23
+ * * Only read-only function calls currently supported.
23
24
  * @example
24
25
  * ```typescript
25
26
  * import { Contract, JsonRpcProvider } from 'essential-eth';
@@ -65,7 +66,7 @@ export declare function defineReadOnly<T>(object: T, name: string, value: any):
65
66
  */
66
67
  export declare class Contract extends BaseContract {
67
68
  /**
68
- * The dynamic contract calls on any given contract. Like "isClaimed", "merkleRoot", etc.
69
+ * The function names on any given contract. Like "isClaimed", "merkleRoot", etc.
69
70
  */
70
71
  readonly [key: string]: any;
71
72
  }
@@ -51,7 +51,7 @@ class BaseContract {
51
51
  ? estimateGas(data)
52
52
  : null;
53
53
  const req = () => __awaiter(this, void 0, void 0, function* () {
54
- return yield (0, fetchers_1.post)(this._provider._rpcUrl, (0, fetchers_1.buildRPCPostBody)('eth_call', [
54
+ return yield (0, fetchers_1.post)(this._provider.selectRpcUrl(), (0, fetchers_1.buildRPCPostBody)('eth_call', [
55
55
  Object.assign({ to: this._address.toLowerCase(), data }, (decimalGas
56
56
  ? { gas: `0x${decimalGas.toString(16)}` }
57
57
  : {})),
@@ -78,8 +78,9 @@ function defineReadOnly(object, name, value) {
78
78
  }
79
79
  exports.defineReadOnly = defineReadOnly;
80
80
  /**
81
+ * @alpha
81
82
  * Only accepts ABIS in JSON format. This allows for stronger typing and assurances of data-types
82
- *
83
+ * * Only read-only function calls currently supported.
83
84
  * @example
84
85
  * ```typescript
85
86
  * import { Contract, JsonRpcProvider } from 'essential-eth';
@@ -0,0 +1,5 @@
1
+ import { RPCTransactionReceipt, TransactionReceipt } from '../../types/Transaction.types';
2
+ /**
3
+ * Converts RPC transaction receipt response to more JS-friendly format
4
+ */
5
+ export declare function cleanTransactionReceipt(transactionReceipt: RPCTransactionReceipt): TransactionReceipt;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cleanTransactionReceipt = void 0;
4
+ const __1 = require("../..");
5
+ const clean_transaction_1 = require("./clean-transaction");
6
+ const hex_to_decimal_1 = require("./hex-to-decimal");
7
+ /**
8
+ * Converts RPC transaction receipt response to more JS-friendly format
9
+ */
10
+ function cleanTransactionReceipt(transactionReceipt) {
11
+ const cleanedTransaction = (0, clean_transaction_1.cleanTransaction)(transactionReceipt);
12
+ const cleanedTransactionReceipt = Object.assign({}, cleanedTransaction);
13
+ Object.keys(transactionReceipt).forEach((key) => {
14
+ if (!transactionReceipt[key])
15
+ return;
16
+ switch (key) {
17
+ case 'status':
18
+ cleanedTransactionReceipt[key] = Number((0, hex_to_decimal_1.hexToDecimal)(transactionReceipt[key]));
19
+ break;
20
+ case 'contractAddress':
21
+ if (transactionReceipt[key]) {
22
+ cleanedTransactionReceipt[key] = (0, __1.toChecksumAddress)(transactionReceipt[key]);
23
+ }
24
+ break;
25
+ case 'cumulativeGasUsed':
26
+ case 'effectiveGasPrice':
27
+ case 'gasUsed':
28
+ cleanedTransactionReceipt[key] = (0, __1.tinyBig)((0, hex_to_decimal_1.hexToDecimal)(transactionReceipt[key]));
29
+ break;
30
+ case 'logs':
31
+ transactionReceipt[key].forEach((log, index) => {
32
+ Object.keys(log).forEach((logKey) => {
33
+ switch (logKey) {
34
+ case 'address':
35
+ cleanedTransactionReceipt[key][index][logKey] =
36
+ (0, __1.toChecksumAddress)(log[logKey]);
37
+ break;
38
+ case 'blockNumber':
39
+ case 'logIndex':
40
+ case 'transactionIndex':
41
+ cleanedTransactionReceipt[key][index][logKey] = Number((0, hex_to_decimal_1.hexToDecimal)(log[logKey]));
42
+ break;
43
+ case 'removed':
44
+ delete log[logKey];
45
+ break;
46
+ }
47
+ });
48
+ });
49
+ }
50
+ });
51
+ cleanedTransactionReceipt.byzantium =
52
+ cleanedTransactionReceipt.blockNumber >= 4370000;
53
+ return cleanedTransactionReceipt;
54
+ }
55
+ exports.cleanTransactionReceipt = cleanTransactionReceipt;
@@ -1,3 +1,4 @@
1
1
  import { JSONABIArgument } from '../../types/Contract.types';
2
+ export declare const hexFalse: string;
2
3
  export declare function encodeData(jsonABIArgument: JSONABIArgument, args: any[]): string;
3
4
  export declare function decodeRPCResponse(jsonABIArgument: JSONABIArgument, nodeResponse: string): string | number | boolean | import("../..").TinyBig | (string | number | boolean | import("../..").TinyBig)[];
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.decodeRPCResponse = exports.encodeData = void 0;
3
+ exports.decodeRPCResponse = exports.encodeData = exports.hexFalse = void 0;
4
4
  const sha3_1 = require("sha3");
5
5
  const __1 = require("../..");
6
6
  const hex_to_decimal_1 = require("./hex-to-decimal");
7
- const hexTrue = '0000000000000000000000000000000000000000000000000000000000000001';
8
- const hexFalse = '0000000000000000000000000000000000000000000000000000000000000000';
7
+ exports.hexFalse = '0'.repeat(64);
8
+ const hexTrue = '0'.repeat(63) + '1';
9
9
  function expandType(type) {
10
10
  // https://docs.soliditylang.org/en/v0.8.7/types.html#integers
11
11
  if (type === 'uint[]') {
@@ -50,7 +50,7 @@ function encodeData(jsonABIArgument, args) {
50
50
  let rawArg = arg;
51
51
  switch (inputType) {
52
52
  case 'bool':
53
- return arg ? hexTrue : hexFalse;
53
+ return arg ? hexTrue : exports.hexFalse;
54
54
  case 'address':
55
55
  // remove leading "0x"
56
56
  rawArg = arg.replace(/^0x/g, '').toLowerCase();
@@ -1,5 +1,5 @@
1
1
  export declare function post(url: string, body: Record<string, unknown>): Promise<any>;
2
- declare type RPCMethodName = 'eth_getBlockByNumber' | 'eth_call' | 'eth_chainId' | 'eth_gasPrice' | 'eth_getBalance' | 'eth_getTransactionByHash';
2
+ declare type RPCMethodName = 'eth_getBlockByNumber' | 'eth_getBlockByHash' | 'eth_call' | 'eth_chainId' | 'eth_gasPrice' | 'eth_getBalance' | 'eth_getTransactionByHash' | 'eth_getTransactionReceipt' | 'eth_getTransactionCount';
3
3
  export declare function buildRPCPostBody(method: RPCMethodName, params: unknown[]): {
4
4
  jsonrpc: string;
5
5
  id: number;
@@ -1,4 +1,5 @@
1
1
  import { Contract } from './classes/Contract';
2
+ import { FallthroughProvider } from './providers/FallthroughProvider';
2
3
  import { JsonRpcProvider, jsonRpcProvider } from './providers/JsonRpcProvider';
3
4
  import { tinyBig, TinyBig } from './shared/tiny-big/tiny-big';
4
5
  import { BlockResponse } from './types/Block.types';
@@ -8,8 +9,12 @@ import { TransactionResponse } from './types/Transaction.types';
8
9
  import { etherToGwei } from './utils/ether-to-gwei';
9
10
  import { etherToWei } from './utils/ether-to-wei';
10
11
  import { gweiToEther } from './utils/gwei-to-ether';
11
- import { hexZeroPad } from './utils/hex-zero-pad';
12
12
  import { isAddress } from './utils/is-address';
13
13
  import { toChecksumAddress } from './utils/to-checksum-address';
14
+ import { toUtf8Bytes } from './utils/to-utf8-bytes';
14
15
  import { weiToEther } from './utils/wei-to-ether';
15
- export { etherToWei, etherToGwei, isAddress, jsonRpcProvider, JsonRpcProvider, tinyBig, toChecksumAddress, weiToEther, gweiToEther, hexZeroPad, Contract, TinyBig, BlockResponse, ContractTypes, JSONABI, JSONABIArgument, Network, TransactionResponse, };
16
+ export * from './utils/bytes';
17
+ export * from './utils/hash-message';
18
+ export * from './utils/keccak256';
19
+ export * from './utils/solidity-keccak256';
20
+ export { etherToWei, etherToGwei, isAddress, jsonRpcProvider, JsonRpcProvider, FallthroughProvider, tinyBig, toChecksumAddress, weiToEther, gweiToEther, toUtf8Bytes, Contract, TinyBig, BlockResponse, ContractTypes, JSONABI, JSONABIArgument, Network, TransactionResponse, };
package/lib/cjs/index.js CHANGED
@@ -1,8 +1,24 @@
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
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TinyBig = exports.Contract = exports.hexZeroPad = exports.gweiToEther = exports.weiToEther = exports.toChecksumAddress = exports.tinyBig = exports.JsonRpcProvider = exports.jsonRpcProvider = exports.isAddress = exports.etherToGwei = exports.etherToWei = void 0;
17
+ exports.TinyBig = exports.Contract = exports.toUtf8Bytes = exports.gweiToEther = exports.weiToEther = exports.toChecksumAddress = exports.tinyBig = exports.FallthroughProvider = exports.JsonRpcProvider = exports.jsonRpcProvider = exports.isAddress = exports.etherToGwei = exports.etherToWei = void 0;
4
18
  const Contract_1 = require("./classes/Contract");
5
19
  Object.defineProperty(exports, "Contract", { enumerable: true, get: function () { return Contract_1.Contract; } });
20
+ const FallthroughProvider_1 = require("./providers/FallthroughProvider");
21
+ Object.defineProperty(exports, "FallthroughProvider", { enumerable: true, get: function () { return FallthroughProvider_1.FallthroughProvider; } });
6
22
  const JsonRpcProvider_1 = require("./providers/JsonRpcProvider");
7
23
  Object.defineProperty(exports, "JsonRpcProvider", { enumerable: true, get: function () { return JsonRpcProvider_1.JsonRpcProvider; } });
8
24
  Object.defineProperty(exports, "jsonRpcProvider", { enumerable: true, get: function () { return JsonRpcProvider_1.jsonRpcProvider; } });
@@ -15,11 +31,16 @@ const ether_to_wei_1 = require("./utils/ether-to-wei");
15
31
  Object.defineProperty(exports, "etherToWei", { enumerable: true, get: function () { return ether_to_wei_1.etherToWei; } });
16
32
  const gwei_to_ether_1 = require("./utils/gwei-to-ether");
17
33
  Object.defineProperty(exports, "gweiToEther", { enumerable: true, get: function () { return gwei_to_ether_1.gweiToEther; } });
18
- const hex_zero_pad_1 = require("./utils/hex-zero-pad");
19
- Object.defineProperty(exports, "hexZeroPad", { enumerable: true, get: function () { return hex_zero_pad_1.hexZeroPad; } });
20
34
  const is_address_1 = require("./utils/is-address");
21
35
  Object.defineProperty(exports, "isAddress", { enumerable: true, get: function () { return is_address_1.isAddress; } });
22
36
  const to_checksum_address_1 = require("./utils/to-checksum-address");
23
37
  Object.defineProperty(exports, "toChecksumAddress", { enumerable: true, get: function () { return to_checksum_address_1.toChecksumAddress; } });
38
+ // import { verifyMessage } from './utils/verify-message';
39
+ const to_utf8_bytes_1 = require("./utils/to-utf8-bytes");
40
+ Object.defineProperty(exports, "toUtf8Bytes", { enumerable: true, get: function () { return to_utf8_bytes_1.toUtf8Bytes; } });
24
41
  const wei_to_ether_1 = require("./utils/wei-to-ether");
25
42
  Object.defineProperty(exports, "weiToEther", { enumerable: true, get: function () { return wei_to_ether_1.weiToEther; } });
43
+ __exportStar(require("./utils/bytes"), exports);
44
+ __exportStar(require("./utils/hash-message"), exports);
45
+ __exportStar(require("./utils/keccak256"), exports);
46
+ __exportStar(require("./utils/solidity-keccak256"), exports);
@@ -0,0 +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 {};
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logger = void 0;
4
+ const package_version_1 = require("./package-version");
5
+ class Logger {
6
+ constructor() {
7
+ this.packageVersion = package_version_1.version;
8
+ }
9
+ throwError(message, args) {
10
+ const argsLength = Object.keys(args).length;
11
+ throw new Error(`${message} (${Object.entries(args).map(([key, value], index) => `${key}=${value}${index < argsLength - 1 && ', '}`)}, version=essential-eth@${this.packageVersion})`);
12
+ }
13
+ throwArgumentError(message, arg, value) {
14
+ throw new Error(`${message} (argument="${arg}" value=${value}, version=essential-eth@${this.packageVersion})`);
15
+ }
16
+ checkSafeUint53(value, message = 'value not safe') {
17
+ if (typeof value !== 'number') {
18
+ return;
19
+ }
20
+ if (value < 0 || value >= 0x1fffffffffffff) {
21
+ this.throwError(message, {
22
+ operation: 'checkSafeInteger',
23
+ fault: 'out-of-safe-range',
24
+ value: value,
25
+ });
26
+ }
27
+ if (value % 1) {
28
+ this.throwError(message, {
29
+ operation: 'checkSafeInteger',
30
+ fault: 'non-integer',
31
+ value: value,
32
+ });
33
+ }
34
+ }
35
+ }
36
+ exports.logger = new Logger();
@@ -0,0 +1 @@
1
+ export declare const version = "0.5.4";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.version = void 0;
4
+ // Generated by genversion.
5
+ exports.version = '0.5.4';
@@ -0,0 +1,270 @@
1
+ import { TinyBig } from '../shared/tiny-big/tiny-big';
2
+ import { BlockResponse, BlockTag } from '../types/Block.types';
3
+ import { Network } from '../types/Network.types';
4
+ import { TransactionReceipt, TransactionResponse } from '../types/Transaction.types';
5
+ export declare abstract class BaseProvider {
6
+ /**
7
+ * ignore
8
+ */
9
+ abstract selectRpcUrl(): string;
10
+ abstract post(body: Record<string, unknown>): Promise<any>;
11
+ /**
12
+ * @ignore
13
+ */
14
+ readonly _rpcUrls: string[];
15
+ /**
16
+ * @ignore
17
+ */
18
+ protected _post: (body: Record<string, unknown>) => Promise<any>;
19
+ /**
20
+ * @param rpcUrl The URL to your Eth node. Consider POKT or Infura
21
+ */
22
+ constructor(rpcUrls: string[]);
23
+ /**
24
+ * Returns the network this provider is connected to
25
+ */
26
+ getNetwork(): Promise<Network>;
27
+ /**
28
+ * * Similar to [`ethers.provider.getTransaction`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getTransaction), some information not included
29
+ *
30
+ * @returns information about one transaction
31
+ * @example
32
+ * ```js
33
+ * await provider.getTransaction('0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789');
34
+ * {
35
+ * accessList: [],
36
+ * blockHash: '0x876810a013dbcd140f6fd6048c1dc33abbb901f1f96b394c2fa63aef3cb40b5d',
37
+ * blockNumber: 14578286,
38
+ * chainId: 1,
39
+ * from: '0xdfD9dE5f6FA60BD70636c0900752E93a6144AEd4',
40
+ * gas: Big {
41
+ * s: 1,
42
+ * e: 5,
43
+ * c: [ 1, 1, 2, 1, 6, 3 ],
44
+ * constructor: <ref *1> [Function: Big] {
45
+ * DP: 20,
46
+ * RM: 1,
47
+ * NE: -7,
48
+ * PE: 21,
49
+ * strict: false,
50
+ * roundDown: 0,
51
+ * roundHalfUp: 1,
52
+ * roundHalfEven: 2,
53
+ * roundUp: 3,
54
+ * Big: [Circular *1],
55
+ * default: [Circular *1]
56
+ * }
57
+ * },
58
+ * gasPrice: Big {
59
+ * s: 1,
60
+ * e: 10,
61
+ * c: [
62
+ * 4, 8, 5, 9, 2,
63
+ * 4, 2, 6, 8, 5,
64
+ * 8
65
+ * ],
66
+ * constructor: <ref *1> [Function: Big] {
67
+ * DP: 20,
68
+ * RM: 1,
69
+ * NE: -7,
70
+ * PE: 21,
71
+ * strict: false,
72
+ * roundDown: 0,
73
+ * roundHalfUp: 1,
74
+ * roundHalfEven: 2,
75
+ * roundUp: 3,
76
+ * Big: [Circular *1],
77
+ * default: [Circular *1]
78
+ * }
79
+ * },
80
+ * hash: '0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789',
81
+ * input: '0x83259f170000000000000000000000000000000000000000000000000000000000000080000000000000000000000000dfd9de5f6fa60bd70636c0900752e93a6144aed400000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000009e99ad11a214fd016b19dc3648678c5944859ae292b21c24ca94f857836c4596f1950c82dd0c23dd621af4763edc2f66466e63c5df9de0c1107b1cd16bf460fe93e43fd308e3444bc79c3d88a4cb961dc8367ab6ad048867afc76d193bca99cf3a068864ed4a7df1dbf1d4c52238eced3e5e05644b4040fc2b3ccb8557b0e99fff6131305a0ea2b8061b90bd418db5bbdd2e92129f52d93f90531465e309c4caec5b85285822b6196398d36f16f511811b61bbda6461e80e29210cd303118bdcee8df6fa0505ffbe8642094fd2ba4dd458496fe3b459ac880bbf71877c713e969ccf5ed7efab8a84ebc07e3939901371ca427e1192e455a8f35a6a1d7ad09e1475dd1758b36fa631dab5d70e99316b23c4c43094188d360cd9c3457355904e07c00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000162074a7047f',
82
+ * maxFeePerGas: Big {
83
+ * s: 1,
84
+ * e: 10,
85
+ * c: [
86
+ * 6, 7, 6, 8, 1,
87
+ * 2, 6, 1, 6, 1,
88
+ * 8
89
+ * ],
90
+ * constructor: <ref *1> [Function: Big] {
91
+ * DP: 20,
92
+ * RM: 1,
93
+ * NE: -7,
94
+ * PE: 21,
95
+ * strict: false,
96
+ * roundDown: 0,
97
+ * roundHalfUp: 1,
98
+ * roundHalfEven: 2,
99
+ * roundUp: 3,
100
+ * Big: [Circular *1],
101
+ * default: [Circular *1]
102
+ * }
103
+ * },
104
+ * maxPriorityFeePerGas: Big {
105
+ * s: 1,
106
+ * e: 9,
107
+ * c: [ 1, 5 ],
108
+ * constructor: <ref *1> [Function: Big] {
109
+ * DP: 20,
110
+ * RM: 1,
111
+ * NE: -7,
112
+ * PE: 21,
113
+ * strict: false,
114
+ * roundDown: 0,
115
+ * roundHalfUp: 1,
116
+ * roundHalfEven: 2,
117
+ * roundUp: 3,
118
+ * Big: [Circular *1],
119
+ * default: [Circular *1]
120
+ * }
121
+ * },
122
+ * nonce: 129,
123
+ * r: '0x59a7c15b12c18cd68d6c440963d959bff3e73831ffc938e75ecad07f7ee43fbc',
124
+ * s: '0x1ebaf05f0d9273b16c2a7748b150a79d22533a8cd74552611cbe620fee3dcf1c',
125
+ * to: '0x39B72d136ba3e4ceF35F48CD09587ffaB754DD8B',
126
+ * transactionIndex: 29,
127
+ * type: 2,
128
+ * v: 0,
129
+ * value: Big {
130
+ * s: 1,
131
+ * e: 0,
132
+ * c: [ 0 ],
133
+ * constructor: <ref *1> [Function: Big] {
134
+ * DP: 20,
135
+ * RM: 1,
136
+ * NE: -7,
137
+ * PE: 21,
138
+ * strict: false,
139
+ * roundDown: 0,
140
+ * roundHalfUp: 1,
141
+ * roundHalfEven: 2,
142
+ * roundUp: 3,
143
+ * Big: [Circular *1],
144
+ * default: [Circular *1]
145
+ * }
146
+ * },
147
+ * confirmations: 1210
148
+ * }
149
+ * ```
150
+ */
151
+ getTransaction(transactionHash: string): Promise<TransactionResponse>;
152
+ /**
153
+ * Gives information about a transaction that has already been mined. Includes additional information beyond what's provided by `getTransaction()`
154
+ *
155
+ * * Similar to [`ethers.provider.getTransactionReceipt`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getTransactionReceipt), some information not included
156
+ *
157
+ * @param transactionHash the hash of the transaction to get information about
158
+ *
159
+ */
160
+ getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
161
+ /**
162
+ * Returns the transaction count from genesis up to specified blockTag
163
+ *
164
+ * * Same as `ethers.provider.getTransactionCount`
165
+ * * Same as `web3.eth.getTransactionCount`
166
+ *
167
+ * @example
168
+ * ```js
169
+ * const address = '0x71660c4005ba85c37ccec55d0c4493e66fe775d3';
170
+ * await provider
171
+ * .getTransactionCount(address, 'latest')
172
+ * // 1060000
173
+ * ```
174
+ *
175
+ * @example
176
+ * ```js
177
+ * await provider
178
+ * .getTransactionCount(address)
179
+ * // 1053312
180
+ * ```
181
+ *
182
+ * @example
183
+ * ```js
184
+ * await provider
185
+ * .getTransactionCount(address, 14649390)
186
+ * // 1053312
187
+ * ```
188
+ */
189
+ getTransactionCount(address: string, blockTag?: BlockTag): Promise<number>;
190
+ /**
191
+ * Gets information about a certain block.
192
+ * Same as `web3.eth.getBlock` and `ethers.providers.getBlock`
193
+ *
194
+ * @param timeFrame The number, hash, or text-based description ('latest', 'earliest', or 'pending') of the block to collect information on.
195
+ *
196
+ * @param returnTransactionObjects Whether to also return data about the transactions on the block.
197
+ *
198
+ * @returns A BlockResponse object with information about the specified block
199
+ *
200
+ * @example
201
+ * ```js
202
+ * await provider.getBlock(14645431);
203
+ * ```
204
+ *
205
+ * @example
206
+ * ```js
207
+ * await provider.getBlock('0x3e5cea9c2be7e0ab4b0aa04c24dafddc37571db2d2d345caf7f88b3366ece0cf');
208
+ * ```
209
+ *
210
+ * @example
211
+ * ```js
212
+ * await provider.getBlock('latest');
213
+ * {
214
+ * number: 4232826,
215
+ * hash: '0x93211a1cd17e154b183565ec685254a03f844a8e34824a46ce1bdd6753dcb669',
216
+ * parentHash: '0x1b32bfcba1bb2a57f56e166a3bb06875a1978992999dfc8828397b4c1526f472',
217
+ * sha3Uncles: '0x0fb399c67bb5a071ec8a22549223215ab76b7d4009941c9c37aa3c3936010463',
218
+ * logsBloom: '0x00000000000000000000101000000000020000000000000000000000000000000000400000010000000000000000000000000000010000000008800000000800000000200000000000000000000000000000000000000000000002000000000000000000000000000040000000000040000000000000000000000000000000000000000000000001000000000004000000000010000000000000000020000000000000000200100020000000000000000080000000000080001000000000000000000001040000000000000000008000000020010100000000200000100000000000000000000000002000000080000000020400000000002000200000000000',
219
+ * transactionsRoot: '0xc43b3f13e1fe810e34d3a26ffe465b72c7063a5c70a02de2c78e91e4d10bd9fb',
220
+ * stateRoot: '0x04d7bc816537ea7ef3a16e76c9879d29f34f99d4154273c2e98e012a31bad745',
221
+ * receiptsRoot: '0x89c6f781ceac0bd49c4d9aa9115df4a5d4dd0e0220ff7668012f15bc04222c6b',
222
+ * miner: '0x31fe561eb2c628cD32Ec52573D7c4b7E4C278Bfa',
223
+ * difficulty: '1300907486001755331049',
224
+ * totalDifficulty: '5989929395521171616186006183',
225
+ * extraData: '0xce018c495249532d62613031656132',
226
+ * size: 5416,
227
+ * gasLimit: 6800000,
228
+ * gasUsed: 202955,
229
+ * timestamp: 1649884910,
230
+ * transactions: [
231
+ * '0x6b34a59c7b9aead24fa6dad782f8a3ad84ed4a23ee09bcbf0bcf880840fbbe20',
232
+ * '0x9a3851ca24d5336c6a0d48aba2c4b4769d7a672c9b01729c5eb9924efd1b19a7',
233
+ * '0xc3ed3d198b62f2f3427ebfa3bbd0fcada4e3c0c189e4464e7eeceb403c75981e'
234
+ * ],
235
+ * uncles: [
236
+ * '0x0c567c054e98153f10d651fbbc018891c1dd9d62a9ffd998e87678803e95b6ed',
237
+ * '0xb7d69389dbfb057c6fcb4bc0582d46a2ba01170703f0dadf8cd1462b83e88753',
238
+ * '0xd5f74ccd0ad4c58b3161e8c2c507c264231e5f28925061b809c02e5e4bb6db28'
239
+ * ],
240
+ * minimumGasPrice: '0x387ee40',
241
+ * bitcoinMergedMiningHeader: '0x04000020e8567ed3d2480e15a1dd1b4335e4732ae343c037e4fd03000000000000000000ed10a8340d163d3e813bdd430f902f4e5a56828dc62313b2e23797c0be6b8516eb3e576297d8091735884f42',
242
+ * bitcoinMergedMiningCoinbaseTransaction: '0x0000000000000140e910128fda7bac502dc5e0573bbaf12de8e2524f70c22f7bd160dedcb19a2521002b6a2952534b424c4f434b3ae493303f597fa368c0ccc4f8aceabf1c315bb7c9a07605c073a89f260040967aace6a7d9',
243
+ * bitcoinMergedMiningMerkleProof: '0xdf63a3d7eb6fbcfb301311faa46e9a15b0408bb1a04e284daee86c273c1dfd65ede23f3170f806e9e0f4cef7ba6b56aa37470d9c23f96ec8e43d08b58645919c5e10bcb892897a731f8f9ce79c72dc0e390896bcd6c67bb38c0bdb72982b6cf05519968d76673572c3f3ef3a08b0ddb464863f1788f7cdbaad3fe44a8a8af576d430ac282fe28852c16df198ca96cc5f71a50695912efe1a836e8442be69e31b6d6f973da2818bce9a3a1c2d9be0671aee9a7776e398d6a03d1e178e20d84646004a3d03c0501334e629d9146aa6a01316dcbaa289df6e6c5e3090cadaddff22699cfc7ff09512fc0d65c5062f17c98561ce3c9510de210d9d654cf99f8d756ff37c9fa21e7122ee8cadb923341690845d572921425f2bd7e044558b7e07983ac4df28928028b0c13c3624dc7a965af8091b0cecc845bf7da5308c03b2c97d607f6706a599f802025894435f1d76ea4e67cc2fc4e1559f1206f559a24633de0f',
244
+ * hashForMergedMining: '0xe493303f597fa368c0ccc4f8aceabf1c315bb7c9a07605c073a89f260040967a',
245
+ * paidFees: '0xc0744dcb7a0',
246
+ * cumulativeDifficulty: '0x1190930db285269e582'
247
+ * }
248
+ *```
249
+ */
250
+ getBlock(timeFrame?: BlockTag, returnTransactionObjects?: boolean): Promise<BlockResponse>;
251
+ /**
252
+ * Returns the current gas price in wei as TinyBig
253
+ * Same as `ethers.provider.getGasPrice`
254
+ */
255
+ getGasPrice(): Promise<TinyBig>;
256
+ /**
257
+ * Returns the balance of the account in wei as TinyBig
258
+ * * Same as [`ethers.provider.getBalance`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getBalance)
259
+ * * Same as `web3.eth.getBalance`
260
+ *
261
+ * @example
262
+ * ```js
263
+ * await provider
264
+ * .getBalance('0x7cB57B5A97eAbe94205C07890BE4c1aD31E486A8')
265
+ * .then((balance) => console.log(balance.toString()));
266
+ * // "28798127851528138"
267
+ * ```
268
+ */
269
+ getBalance(address: string, blockTag?: BlockTag): Promise<TinyBig>;
270
+ }