essential-eth 0.5.9 → 0.5.10
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.
- package/{lib/esm → dist}/classes/Contract.d.ts +11 -11
- package/dist/classes/test/Contract/crv-abi.d.ts +2 -0
- package/dist/classes/test/Contract/ens-abi.d.ts +2 -0
- package/dist/classes/test/Contract/fei-abi.d.ts +2 -0
- package/dist/classes/test/Contract/foo-abi.d.ts +2 -0
- package/dist/classes/test/Contract/uniswap-abi.d.ts +2 -0
- package/dist/classes/utils/clean-block.d.ts +3 -0
- package/{lib/esm → dist}/classes/utils/clean-log.d.ts +2 -2
- package/{lib/esm → dist}/classes/utils/clean-transaction-receipt.d.ts +2 -2
- package/{lib/esm → dist}/classes/utils/clean-transaction.d.ts +2 -2
- package/{lib/esm → dist}/classes/utils/encode-decode-transaction.d.ts +4 -4
- package/{lib/esm → dist}/classes/utils/fetchers.d.ts +9 -9
- package/{lib/esm → dist}/classes/utils/hex-to-decimal.d.ts +1 -1
- package/{lib/esm → dist}/classes/utils/prepare-transaction.d.ts +2 -2
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/{lib/esm → dist}/index.d.ts +25 -25
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.modern.js +2 -0
- package/dist/index.modern.js.map +1 -0
- package/dist/index.modern.mjs +2 -0
- package/dist/index.modern.mjs.map +1 -0
- package/dist/index.module.js +2 -0
- package/dist/index.module.js.map +1 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.map +1 -0
- package/{lib/esm → dist}/logger/logger.d.ts +11 -11
- package/dist/logger/package-version.d.ts +1 -0
- package/{lib/esm → dist}/providers/BaseProvider.d.ts +24 -24
- package/{lib/esm → dist}/providers/FallthroughProvider.d.ts +11 -11
- package/{lib/esm → dist}/providers/JsonRpcProvider.d.ts +7 -7
- package/{lib/cjs → dist}/providers/test/rpc-urls.d.ts +11 -11
- package/{lib/cjs → dist}/providers/utils/chains-info.d.ts +467 -423
- package/{lib/esm → dist}/shared/tiny-big/helpers.d.ts +1 -1
- package/{lib/esm → dist}/shared/tiny-big/tiny-big.d.ts +10 -10
- package/{lib/cjs → dist}/shared/validate-type.d.ts +3 -3
- package/{lib/cjs → dist}/types/Block.types.d.ts +40 -41
- package/{lib/cjs → dist}/types/Contract.types.d.ts +24 -24
- package/{lib/esm → dist}/types/Filter.types.d.ts +12 -12
- package/{lib/esm → dist}/types/Network.types.d.ts +5 -5
- package/{lib/esm → dist}/types/Transaction.types.d.ts +113 -113
- package/{lib/esm → dist}/utils/bytes.d.ts +40 -40
- package/{lib/esm → dist}/utils/compute-address.d.ts +1 -1
- package/{lib/esm → dist}/utils/compute-public-key.d.ts +2 -2
- package/{lib/esm → dist}/utils/ether-to-gwei.d.ts +3 -3
- package/dist/utils/ether-to-wei.d.ts +3 -0
- package/dist/utils/gwei-to-ether.d.ts +3 -0
- package/{lib/esm → dist}/utils/hash-message.d.ts +2 -2
- package/{lib/esm → dist}/utils/is-address.d.ts +1 -1
- package/{lib/esm → dist}/utils/keccak256.d.ts +2 -2
- package/{lib/esm → dist}/utils/solidity-keccak256.d.ts +2 -2
- package/{lib/esm → dist}/utils/split-signature.d.ts +2 -2
- package/{lib/esm → dist}/utils/to-checksum-address.d.ts +1 -1
- package/{lib/esm → dist}/utils/to-utf8-bytes.d.ts +1 -1
- package/dist/utils/wei-to-ether.d.ts +3 -0
- package/package.json +42 -19
- package/lib/cjs/classes/Contract.d.ts +0 -78
- package/lib/cjs/classes/Contract.js +0 -140
- package/lib/cjs/classes/test/Contract/crv-abi.d.ts +0 -2
- package/lib/cjs/classes/test/Contract/crv-abi.js +0 -488
- package/lib/cjs/classes/test/Contract/ens-abi.d.ts +0 -2
- package/lib/cjs/classes/test/Contract/ens-abi.js +0 -453
- package/lib/cjs/classes/test/Contract/fei-abi.d.ts +0 -2
- package/lib/cjs/classes/test/Contract/fei-abi.js +0 -526
- package/lib/cjs/classes/test/Contract/foo-abi.d.ts +0 -2
- package/lib/cjs/classes/test/Contract/foo-abi.js +0 -42
- package/lib/cjs/classes/test/Contract/uniswap-abi.d.ts +0 -2
- package/lib/cjs/classes/test/Contract/uniswap-abi.js +0 -121
- package/lib/cjs/classes/utils/clean-block.d.ts +0 -121
- package/lib/cjs/classes/utils/clean-block.js +0 -160
- package/lib/cjs/classes/utils/clean-log.d.ts +0 -9
- package/lib/cjs/classes/utils/clean-log.js +0 -37
- package/lib/cjs/classes/utils/clean-transaction-receipt.d.ts +0 -14
- package/lib/cjs/classes/utils/clean-transaction-receipt.js +0 -50
- package/lib/cjs/classes/utils/clean-transaction.d.ts +0 -14
- package/lib/cjs/classes/utils/clean-transaction.js +0 -51
- package/lib/cjs/classes/utils/encode-decode-transaction.d.ts +0 -16
- package/lib/cjs/classes/utils/encode-decode-transaction.js +0 -137
- package/lib/cjs/classes/utils/fetchers.d.ts +0 -39
- package/lib/cjs/classes/utils/fetchers.js +0 -81
- package/lib/cjs/classes/utils/hex-to-decimal.d.ts +0 -18
- package/lib/cjs/classes/utils/hex-to-decimal.js +0 -24
- package/lib/cjs/classes/utils/prepare-transaction.d.ts +0 -6
- package/lib/cjs/classes/utils/prepare-transaction.js +0 -45
- package/lib/cjs/index.d.ts +0 -25
- package/lib/cjs/index.js +0 -54
- package/lib/cjs/logger/logger.d.ts +0 -11
- package/lib/cjs/logger/logger.js +0 -36
- package/lib/cjs/logger/package-version.d.ts +0 -1
- package/lib/cjs/logger/package-version.js +0 -5
- package/lib/cjs/providers/BaseProvider.d.ts +0 -353
- package/lib/cjs/providers/BaseProvider.js +0 -512
- package/lib/cjs/providers/FallthroughProvider.d.ts +0 -24
- package/lib/cjs/providers/FallthroughProvider.js +0 -65
- package/lib/cjs/providers/JsonRpcProvider.d.ts +0 -33
- package/lib/cjs/providers/JsonRpcProvider.js +0 -46
- package/lib/cjs/providers/test/rpc-urls.js +0 -14
- package/lib/cjs/providers/utils/chains-info.js +0 -1270
- package/lib/cjs/shared/tiny-big/helpers.d.ts +0 -17
- package/lib/cjs/shared/tiny-big/helpers.js +0 -97
- package/lib/cjs/shared/tiny-big/tiny-big.d.ts +0 -58
- package/lib/cjs/shared/tiny-big/tiny-big.js +0 -101
- package/lib/cjs/shared/validate-type.js +0 -9
- package/lib/cjs/types/Block.types.js +0 -2
- package/lib/cjs/types/Contract.types.js +0 -2
- package/lib/cjs/types/Filter.types.d.ts +0 -16
- package/lib/cjs/types/Filter.types.js +0 -2
- package/lib/cjs/types/Network.types.d.ts +0 -8
- package/lib/cjs/types/Network.types.js +0 -2
- package/lib/cjs/types/Transaction.types.d.ts +0 -123
- package/lib/cjs/types/Transaction.types.js +0 -2
- package/lib/cjs/utils/bytes.d.ts +0 -289
- package/lib/cjs/utils/bytes.js +0 -711
- package/lib/cjs/utils/compute-address.d.ts +0 -17
- package/lib/cjs/utils/compute-address.js +0 -33
- package/lib/cjs/utils/compute-public-key.d.ts +0 -18
- package/lib/cjs/utils/compute-public-key.js +0 -26
- package/lib/cjs/utils/ether-to-gwei.d.ts +0 -27
- package/lib/cjs/utils/ether-to-gwei.js +0 -35
- package/lib/cjs/utils/ether-to-wei.d.ts +0 -27
- package/lib/cjs/utils/ether-to-wei.js +0 -35
- package/lib/cjs/utils/gwei-to-ether.d.ts +0 -27
- package/lib/cjs/utils/gwei-to-ether.js +0 -35
- package/lib/cjs/utils/hash-message.d.ts +0 -14
- package/lib/cjs/utils/hash-message.js +0 -28
- package/lib/cjs/utils/is-address.d.ts +0 -24
- package/lib/cjs/utils/is-address.js +0 -39
- package/lib/cjs/utils/keccak256.d.ts +0 -16
- package/lib/cjs/utils/keccak256.js +0 -31
- package/lib/cjs/utils/solidity-keccak256.d.ts +0 -39
- package/lib/cjs/utils/solidity-keccak256.js +0 -138
- package/lib/cjs/utils/split-signature.d.ts +0 -24
- package/lib/cjs/utils/split-signature.js +0 -163
- package/lib/cjs/utils/to-checksum-address.d.ts +0 -17
- package/lib/cjs/utils/to-checksum-address.js +0 -46
- package/lib/cjs/utils/to-utf8-bytes.d.ts +0 -15
- package/lib/cjs/utils/to-utf8-bytes.js +0 -21
- package/lib/cjs/utils/wei-to-ether.d.ts +0 -27
- package/lib/cjs/utils/wei-to-ether.js +0 -45
- package/lib/esm/classes/Contract.js +0 -65
- package/lib/esm/classes/test/Contract/crv-abi.d.ts +0 -2
- package/lib/esm/classes/test/Contract/crv-abi.js +0 -470
- package/lib/esm/classes/test/Contract/ens-abi.d.ts +0 -2
- package/lib/esm/classes/test/Contract/ens-abi.js +0 -435
- package/lib/esm/classes/test/Contract/fei-abi.d.ts +0 -2
- package/lib/esm/classes/test/Contract/fei-abi.js +0 -521
- package/lib/esm/classes/test/Contract/foo-abi.d.ts +0 -2
- package/lib/esm/classes/test/Contract/foo-abi.js +0 -33
- package/lib/esm/classes/test/Contract/uniswap-abi.d.ts +0 -2
- package/lib/esm/classes/test/Contract/uniswap-abi.js +0 -116
- package/lib/esm/classes/utils/clean-block.d.ts +0 -3
- package/lib/esm/classes/utils/clean-block.js +0 -35
- package/lib/esm/classes/utils/clean-log.js +0 -26
- package/lib/esm/classes/utils/clean-transaction-receipt.js +0 -34
- package/lib/esm/classes/utils/clean-transaction.js +0 -33
- package/lib/esm/classes/utils/encode-decode-transaction.js +0 -98
- package/lib/esm/classes/utils/fetchers.js +0 -43
- package/lib/esm/classes/utils/hex-to-decimal.js +0 -3
- package/lib/esm/classes/utils/prepare-transaction.js +0 -34
- package/lib/esm/index.js +0 -20
- package/lib/esm/logger/logger.js +0 -33
- package/lib/esm/logger/package-version.d.ts +0 -1
- package/lib/esm/logger/package-version.js +0 -1
- package/lib/esm/providers/BaseProvider.js +0 -157
- package/lib/esm/providers/FallthroughProvider.js +0 -41
- package/lib/esm/providers/JsonRpcProvider.js +0 -15
- package/lib/esm/providers/test/rpc-urls.d.ts +0 -11
- package/lib/esm/providers/test/rpc-urls.js +0 -11
- package/lib/esm/providers/utils/chains-info.d.ts +0 -423
- package/lib/esm/providers/utils/chains-info.js +0 -1266
- package/lib/esm/shared/tiny-big/helpers.js +0 -58
- package/lib/esm/shared/tiny-big/tiny-big.js +0 -45
- package/lib/esm/shared/validate-type.d.ts +0 -3
- package/lib/esm/shared/validate-type.js +0 -5
- package/lib/esm/types/Block.types.d.ts +0 -40
- package/lib/esm/types/Block.types.js +0 -1
- package/lib/esm/types/Contract.types.d.ts +0 -24
- package/lib/esm/types/Contract.types.js +0 -1
- package/lib/esm/types/Filter.types.js +0 -1
- package/lib/esm/types/Network.types.js +0 -1
- package/lib/esm/types/Transaction.types.js +0 -1
- package/lib/esm/utils/bytes.js +0 -245
- package/lib/esm/utils/compute-address.js +0 -11
- package/lib/esm/utils/compute-public-key.js +0 -6
- package/lib/esm/utils/ether-to-gwei.js +0 -7
- package/lib/esm/utils/ether-to-wei.d.ts +0 -3
- package/lib/esm/utils/ether-to-wei.js +0 -7
- package/lib/esm/utils/gwei-to-ether.d.ts +0 -3
- package/lib/esm/utils/gwei-to-ether.js +0 -7
- package/lib/esm/utils/hash-message.js +0 -12
- package/lib/esm/utils/is-address.js +0 -12
- package/lib/esm/utils/keccak256.js +0 -13
- package/lib/esm/utils/solidity-keccak256.js +0 -85
- package/lib/esm/utils/split-signature.js +0 -126
- package/lib/esm/utils/to-checksum-address.js +0 -25
- package/lib/esm/utils/to-utf8-bytes.js +0 -3
- package/lib/esm/utils/wei-to-ether.d.ts +0 -3
- package/lib/esm/utils/wei-to-ether.js +0 -16
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { toChecksumAddress } from '../..';
|
|
2
|
-
import { tinyBig } from '../../shared/tiny-big/tiny-big';
|
|
3
|
-
import { cleanTransaction } from './clean-transaction';
|
|
4
|
-
import { hexToDecimal } from './hex-to-decimal';
|
|
5
|
-
export function cleanBlock(block, returnTransactionObjects) {
|
|
6
|
-
const cleanedBlock = Object.assign({}, block);
|
|
7
|
-
Object.keys(block).forEach((key) => {
|
|
8
|
-
if (!block[key])
|
|
9
|
-
return;
|
|
10
|
-
switch (key) {
|
|
11
|
-
case 'difficulty':
|
|
12
|
-
case 'totalDifficulty':
|
|
13
|
-
case 'gasLimit':
|
|
14
|
-
case 'gasUsed':
|
|
15
|
-
case 'size':
|
|
16
|
-
case 'timestamp':
|
|
17
|
-
case 'baseFeePerGas':
|
|
18
|
-
cleanedBlock[key] = tinyBig(hexToDecimal(block[key]));
|
|
19
|
-
break;
|
|
20
|
-
case 'number':
|
|
21
|
-
cleanedBlock[key] = Number(hexToDecimal(block[key]));
|
|
22
|
-
break;
|
|
23
|
-
case 'miner':
|
|
24
|
-
cleanedBlock[key] = toChecksumAddress(block[key]);
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
if (returnTransactionObjects) {
|
|
29
|
-
const txns = block.transactions;
|
|
30
|
-
txns.forEach((transaction, index) => {
|
|
31
|
-
cleanedBlock.transactions[index] = cleanTransaction(transaction);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
return cleanedBlock;
|
|
35
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { toChecksumAddress } from '../../utils/to-checksum-address';
|
|
2
|
-
import { hexToDecimal } from './hex-to-decimal';
|
|
3
|
-
export function cleanLog(log, receiptLog) {
|
|
4
|
-
const cleanedLog = Object.assign({}, log);
|
|
5
|
-
Object.keys(log).forEach((key) => {
|
|
6
|
-
switch (key) {
|
|
7
|
-
case 'address':
|
|
8
|
-
cleanedLog[key] = toChecksumAddress(log[key]);
|
|
9
|
-
break;
|
|
10
|
-
case 'blockNumber':
|
|
11
|
-
case 'logIndex':
|
|
12
|
-
case 'transactionIndex':
|
|
13
|
-
cleanedLog[key] = Number(hexToDecimal(log[key]));
|
|
14
|
-
break;
|
|
15
|
-
case 'removed':
|
|
16
|
-
if (receiptLog) {
|
|
17
|
-
delete cleanedLog[key];
|
|
18
|
-
}
|
|
19
|
-
else if (log[key] == null) {
|
|
20
|
-
cleanedLog[key] === false;
|
|
21
|
-
}
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
return cleanedLog;
|
|
26
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { tinyBig, toChecksumAddress } from '../..';
|
|
2
|
-
import { cleanLog } from './clean-log';
|
|
3
|
-
import { cleanTransaction } from './clean-transaction';
|
|
4
|
-
import { hexToDecimal } from './hex-to-decimal';
|
|
5
|
-
export function cleanTransactionReceipt(transactionReceipt) {
|
|
6
|
-
const cleanedTransaction = cleanTransaction(transactionReceipt);
|
|
7
|
-
const cleanedTransactionReceipt = Object.assign({}, cleanedTransaction);
|
|
8
|
-
Object.keys(transactionReceipt).forEach((key) => {
|
|
9
|
-
if (!transactionReceipt[key])
|
|
10
|
-
return;
|
|
11
|
-
switch (key) {
|
|
12
|
-
case 'status':
|
|
13
|
-
cleanedTransactionReceipt[key] = Number(hexToDecimal(transactionReceipt[key]));
|
|
14
|
-
break;
|
|
15
|
-
case 'contractAddress':
|
|
16
|
-
if (transactionReceipt[key]) {
|
|
17
|
-
cleanedTransactionReceipt[key] = toChecksumAddress(transactionReceipt[key]);
|
|
18
|
-
}
|
|
19
|
-
break;
|
|
20
|
-
case 'cumulativeGasUsed':
|
|
21
|
-
case 'effectiveGasPrice':
|
|
22
|
-
case 'gasUsed':
|
|
23
|
-
cleanedTransactionReceipt[key] = tinyBig(hexToDecimal(transactionReceipt[key]));
|
|
24
|
-
break;
|
|
25
|
-
case 'logs':
|
|
26
|
-
transactionReceipt[key].forEach((log, index) => {
|
|
27
|
-
cleanedTransactionReceipt[key][index] = cleanLog(log, true);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
cleanedTransactionReceipt.byzantium =
|
|
32
|
-
cleanedTransactionReceipt.blockNumber >= 4370000;
|
|
33
|
-
return cleanedTransactionReceipt;
|
|
34
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { tinyBig, toChecksumAddress } from '../..';
|
|
2
|
-
import { hexToDecimal } from './hex-to-decimal';
|
|
3
|
-
export function cleanTransaction(transaction) {
|
|
4
|
-
const cleanedTransaction = Object.assign({}, transaction);
|
|
5
|
-
Object.keys(transaction).forEach((key) => {
|
|
6
|
-
if (!transaction[key])
|
|
7
|
-
return;
|
|
8
|
-
switch (key) {
|
|
9
|
-
case 'blockNumber':
|
|
10
|
-
case 'chainId':
|
|
11
|
-
case 'transactionIndex':
|
|
12
|
-
case 'type':
|
|
13
|
-
case 'v':
|
|
14
|
-
cleanedTransaction[key] = Number(hexToDecimal(transaction[key]));
|
|
15
|
-
break;
|
|
16
|
-
case 'from':
|
|
17
|
-
case 'to':
|
|
18
|
-
if (transaction[key]) {
|
|
19
|
-
cleanedTransaction[key] = toChecksumAddress(transaction[key]);
|
|
20
|
-
}
|
|
21
|
-
break;
|
|
22
|
-
case 'value':
|
|
23
|
-
case 'gas':
|
|
24
|
-
case 'gasPrice':
|
|
25
|
-
case 'maxFeePerGas':
|
|
26
|
-
case 'maxPriorityFeePerGas':
|
|
27
|
-
case 'nonce':
|
|
28
|
-
cleanedTransaction[key] = tinyBig(hexToDecimal(transaction[key]));
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
return cleanedTransaction;
|
|
33
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { Keccak } from 'sha3';
|
|
2
|
-
import { tinyBig, toChecksumAddress } from '../..';
|
|
3
|
-
import { hexToDecimal } from './hex-to-decimal';
|
|
4
|
-
export const hexFalse = '0'.repeat(64);
|
|
5
|
-
const hexTrue = '0'.repeat(63) + '1';
|
|
6
|
-
function expandType(type) {
|
|
7
|
-
if (type === 'uint[]') {
|
|
8
|
-
return 'uint256[]';
|
|
9
|
-
}
|
|
10
|
-
else if (type === 'int[]') {
|
|
11
|
-
return 'int256[]';
|
|
12
|
-
}
|
|
13
|
-
return type;
|
|
14
|
-
}
|
|
15
|
-
export function encodeData(jsonABIArgument, args) {
|
|
16
|
-
const hash = new Keccak(256);
|
|
17
|
-
const functionString = `${jsonABIArgument.name}(${jsonABIArgument.inputs.map((input) => expandType(input.type))})`;
|
|
18
|
-
const functionHash = hash.update(functionString).digest('hex');
|
|
19
|
-
const jsonABIInputsLength = jsonABIArgument.inputs.length;
|
|
20
|
-
let shouldValidateInputLength = true;
|
|
21
|
-
if (jsonABIArgument.inputs.find((input) => input.type.includes('['))) {
|
|
22
|
-
shouldValidateInputLength = false;
|
|
23
|
-
}
|
|
24
|
-
if (shouldValidateInputLength && args.length !== jsonABIInputsLength) {
|
|
25
|
-
throw new Error(`args inputs of "${args.length}" does not match expected length of "${jsonABIArgument.inputs.length}"`);
|
|
26
|
-
}
|
|
27
|
-
const argsWithTypes = (jsonABIArgument.inputs || []).reduce((acc, input, i) => {
|
|
28
|
-
var _a;
|
|
29
|
-
if (input.type.includes('[')) {
|
|
30
|
-
const basicType = (_a = /([^[]*)\[.*$/g.exec(input.type)) === null || _a === void 0 ? void 0 : _a[1];
|
|
31
|
-
args.forEach((arg) => {
|
|
32
|
-
acc = acc.concat([[arg, basicType]]);
|
|
33
|
-
});
|
|
34
|
-
return acc;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
return acc.concat([[args[i], input.type]]);
|
|
38
|
-
}
|
|
39
|
-
}, []);
|
|
40
|
-
const encodedArgs = argsWithTypes.map(([arg, inputType]) => {
|
|
41
|
-
let rawArg = arg;
|
|
42
|
-
switch (inputType) {
|
|
43
|
-
case 'bool':
|
|
44
|
-
return arg ? hexTrue : hexFalse;
|
|
45
|
-
case 'address':
|
|
46
|
-
rawArg = arg.replace(/^0x/g, '').toLowerCase();
|
|
47
|
-
break;
|
|
48
|
-
default:
|
|
49
|
-
if (inputType.startsWith('bytes')) {
|
|
50
|
-
const argEncoded = rawArg
|
|
51
|
-
.split('')
|
|
52
|
-
.map((character) => character.charCodeAt(0).toString(16))
|
|
53
|
-
.join('');
|
|
54
|
-
const paddedEncodedArg = argEncoded.padEnd(64, '0');
|
|
55
|
-
return paddedEncodedArg;
|
|
56
|
-
}
|
|
57
|
-
else if (inputType === 'uint256') {
|
|
58
|
-
const argEncoded = BigInt(arg).toString(16);
|
|
59
|
-
const paddedEncodedArg = argEncoded.padStart(64, '0');
|
|
60
|
-
return paddedEncodedArg;
|
|
61
|
-
}
|
|
62
|
-
else if (inputType.startsWith('uint')) {
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
throw new Error(`essential-eth does not yet support "${inputType}" inputs. Make a PR today!"`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
const argEncoded = rawArg.toString(16);
|
|
70
|
-
const paddedEncodedArg = argEncoded.padStart(64, '0');
|
|
71
|
-
return paddedEncodedArg;
|
|
72
|
-
});
|
|
73
|
-
const functionEncoded = functionHash.slice(0, 8);
|
|
74
|
-
const data = `0x${functionEncoded}${encodedArgs.join('')}`;
|
|
75
|
-
return data;
|
|
76
|
-
}
|
|
77
|
-
export function decodeRPCResponse(jsonABIArgument, nodeResponse) {
|
|
78
|
-
const rawOutputs = jsonABIArgument.outputs;
|
|
79
|
-
const encodedOutputs = nodeResponse.slice(2).match(/.{1,64}/g);
|
|
80
|
-
const outputs = (encodedOutputs || []).map((output, i) => {
|
|
81
|
-
const outputType = (rawOutputs || [])[i].type;
|
|
82
|
-
switch (outputType) {
|
|
83
|
-
case 'bool':
|
|
84
|
-
return output === hexTrue;
|
|
85
|
-
case 'address':
|
|
86
|
-
return toChecksumAddress(`0x${output.slice(24)}`);
|
|
87
|
-
case 'uint256':
|
|
88
|
-
return tinyBig(hexToDecimal(`0x${output}`));
|
|
89
|
-
case 'bytes32':
|
|
90
|
-
return `0x${output}`;
|
|
91
|
-
case 'uint8':
|
|
92
|
-
return Number(hexToDecimal(`0x${output}`));
|
|
93
|
-
default:
|
|
94
|
-
throw new Error(`essential-eth does not yet support "${outputType}" outputs. Make a PR today!"`);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
return outputs.length === 1 ? outputs[0] : outputs;
|
|
98
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import unfetch from 'isomorphic-unfetch';
|
|
11
|
-
export function post(url, body) {
|
|
12
|
-
return unfetch(url, {
|
|
13
|
-
method: 'POST',
|
|
14
|
-
headers: {
|
|
15
|
-
'Content-Type': 'application/json',
|
|
16
|
-
},
|
|
17
|
-
body: JSON.stringify(body),
|
|
18
|
-
})
|
|
19
|
-
.then((r) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const t = yield r.text();
|
|
21
|
-
try {
|
|
22
|
-
return JSON.parse(t);
|
|
23
|
-
}
|
|
24
|
-
catch (_a) {
|
|
25
|
-
throw new Error(`Invalid JSON RPC response: "${t}"`);
|
|
26
|
-
}
|
|
27
|
-
}))
|
|
28
|
-
.then((response) => {
|
|
29
|
-
const result = response === null || response === void 0 ? void 0 : response.result;
|
|
30
|
-
if (!result) {
|
|
31
|
-
throw new Error(`Invalid JSON RPC response: ${JSON.stringify(response)}`);
|
|
32
|
-
}
|
|
33
|
-
return response.result;
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
export function buildRPCPostBody(method, params) {
|
|
37
|
-
return {
|
|
38
|
-
jsonrpc: '2.0',
|
|
39
|
-
id: 1,
|
|
40
|
-
method,
|
|
41
|
-
params,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import Big from 'big.js';
|
|
2
|
-
import { TinyBig } from '../../shared/tiny-big/tiny-big';
|
|
3
|
-
import { hexlify } from '../../utils/bytes';
|
|
4
|
-
export function prepareTransaction(transaction) {
|
|
5
|
-
const preparedTransaction = Object.assign({}, transaction);
|
|
6
|
-
Object.keys(transaction).forEach((key) => {
|
|
7
|
-
switch (key) {
|
|
8
|
-
case 'gas':
|
|
9
|
-
case 'gasPrice':
|
|
10
|
-
case 'nonce':
|
|
11
|
-
case 'maxFeePerGas':
|
|
12
|
-
case 'maxPriorityFeePerGas':
|
|
13
|
-
case 'value': {
|
|
14
|
-
const value = transaction[key];
|
|
15
|
-
if (value instanceof TinyBig) {
|
|
16
|
-
preparedTransaction[key] = value.toHexString();
|
|
17
|
-
}
|
|
18
|
-
else if (value instanceof Big) {
|
|
19
|
-
preparedTransaction[key] = `0x${BigInt(value.toString()).toString(16)}`;
|
|
20
|
-
}
|
|
21
|
-
else if (typeof transaction[key] === 'number')
|
|
22
|
-
preparedTransaction[key] =
|
|
23
|
-
'0x' + transaction[key].toString(16);
|
|
24
|
-
else
|
|
25
|
-
preparedTransaction[key] = transaction[key].toString();
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
28
|
-
case 'data':
|
|
29
|
-
preparedTransaction[key] = hexlify(transaction[key]);
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
return preparedTransaction;
|
|
34
|
-
}
|
package/lib/esm/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { BaseContract, Contract } from './classes/Contract';
|
|
2
|
-
import { FallthroughProvider, } from './providers/FallthroughProvider';
|
|
3
|
-
import { JsonRpcProvider, jsonRpcProvider } from './providers/JsonRpcProvider';
|
|
4
|
-
import { tinyBig, TinyBig } from './shared/tiny-big/tiny-big';
|
|
5
|
-
import { computeAddress } from './utils/compute-address';
|
|
6
|
-
import { computePublicKey } from './utils/compute-public-key';
|
|
7
|
-
import { etherToGwei } from './utils/ether-to-gwei';
|
|
8
|
-
import { etherToWei } from './utils/ether-to-wei';
|
|
9
|
-
import { gweiToEther } from './utils/gwei-to-ether';
|
|
10
|
-
import { hashMessage } from './utils/hash-message';
|
|
11
|
-
import { isAddress } from './utils/is-address';
|
|
12
|
-
import { splitSignature } from './utils/split-signature';
|
|
13
|
-
import { toChecksumAddress } from './utils/to-checksum-address';
|
|
14
|
-
import { toUtf8Bytes } from './utils/to-utf8-bytes';
|
|
15
|
-
import { weiToEther } from './utils/wei-to-ether';
|
|
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, hashMessage, splitSignature, toUtf8Bytes, computeAddress, computePublicKey, Contract, TinyBig, BaseContract, };
|
package/lib/esm/logger/logger.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { version } from './package-version';
|
|
2
|
-
class Logger {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.packageVersion = version;
|
|
5
|
-
}
|
|
6
|
-
throwError(message, args) {
|
|
7
|
-
const argsLength = Object.keys(args).length;
|
|
8
|
-
throw new Error(`${message} (${Object.entries(args).map(([key, value], index) => `${key}=${value}${index < argsLength - 1 && ', '}`)}, version=essential-eth@${this.packageVersion})`);
|
|
9
|
-
}
|
|
10
|
-
throwArgumentError(message, arg, value) {
|
|
11
|
-
throw new Error(`${message} (argument="${arg}" value=${value}, version=essential-eth@${this.packageVersion})`);
|
|
12
|
-
}
|
|
13
|
-
checkSafeUint53(value, message = 'value not safe') {
|
|
14
|
-
if (typeof value !== 'number') {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
if (value < 0 || value >= 0x1fffffffffffff) {
|
|
18
|
-
this.throwError(message, {
|
|
19
|
-
operation: 'checkSafeInteger',
|
|
20
|
-
fault: 'out-of-safe-range',
|
|
21
|
-
value: value,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
if (value % 1) {
|
|
25
|
-
this.throwError(message, {
|
|
26
|
-
operation: 'checkSafeInteger',
|
|
27
|
-
fault: 'non-integer',
|
|
28
|
-
value: value,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export const logger = new Logger();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const version = "0.5.9";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const version = '0.5.9';
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { cleanBlock } from '../classes/utils/clean-block';
|
|
11
|
-
import { cleanLog } from '../classes/utils/clean-log';
|
|
12
|
-
import { cleanTransaction } from '../classes/utils/clean-transaction';
|
|
13
|
-
import { cleanTransactionReceipt } from '../classes/utils/clean-transaction-receipt';
|
|
14
|
-
import { buildRPCPostBody, post } from '../classes/utils/fetchers';
|
|
15
|
-
import { hexToDecimal } from '../classes/utils/hex-to-decimal';
|
|
16
|
-
import { prepareTransaction } from '../classes/utils/prepare-transaction';
|
|
17
|
-
import { logger } from '../logger/logger';
|
|
18
|
-
import { tinyBig } from '../shared/tiny-big/tiny-big';
|
|
19
|
-
import chainsInfo from './utils/chains-info';
|
|
20
|
-
function prepBlockTag(blockTag) {
|
|
21
|
-
return typeof blockTag === 'number'
|
|
22
|
-
? tinyBig(blockTag).toHexString()
|
|
23
|
-
: blockTag;
|
|
24
|
-
}
|
|
25
|
-
export class BaseProvider {
|
|
26
|
-
constructor(rpcUrls) {
|
|
27
|
-
this._rpcUrls = [];
|
|
28
|
-
this._post = (body) => post(this.selectRpcUrl(), body);
|
|
29
|
-
this._rpcUrls = rpcUrls;
|
|
30
|
-
}
|
|
31
|
-
getNetwork() {
|
|
32
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
const hexChainId = (yield this.post(buildRPCPostBody('eth_chainId', [])));
|
|
34
|
-
const chainId = hexToDecimal(hexChainId);
|
|
35
|
-
const info = chainsInfo[chainId];
|
|
36
|
-
return {
|
|
37
|
-
chainId: Number(chainId),
|
|
38
|
-
name: info[0] || 'unknown',
|
|
39
|
-
ensAddress: info[1] || null,
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
getBlockNumber() {
|
|
44
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const currentBlockNumber = (yield this.post(buildRPCPostBody('eth_blockNumber', [])));
|
|
46
|
-
return Number(hexToDecimal(currentBlockNumber));
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
getTransaction(transactionHash) {
|
|
50
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
const [rpcTransaction, blockNumber] = yield Promise.all([
|
|
52
|
-
this.post(buildRPCPostBody('eth_getTransactionByHash', [transactionHash])),
|
|
53
|
-
this.getBlock('latest'),
|
|
54
|
-
]);
|
|
55
|
-
const cleanedTransaction = cleanTransaction(rpcTransaction);
|
|
56
|
-
cleanedTransaction.confirmations =
|
|
57
|
-
blockNumber.number - cleanedTransaction.blockNumber + 1;
|
|
58
|
-
return cleanedTransaction;
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
getTransactionReceipt(transactionHash) {
|
|
62
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
const [rpcTransaction, blockNumber] = yield Promise.all([
|
|
64
|
-
this.post(buildRPCPostBody('eth_getTransactionReceipt', [transactionHash])),
|
|
65
|
-
this.getBlock('latest'),
|
|
66
|
-
]);
|
|
67
|
-
const cleanedTransactionReceipt = cleanTransactionReceipt(rpcTransaction);
|
|
68
|
-
cleanedTransactionReceipt.confirmations =
|
|
69
|
-
blockNumber.number - cleanedTransactionReceipt.blockNumber + 1;
|
|
70
|
-
return cleanedTransactionReceipt;
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
getTransactionCount(address, blockTag = 'latest') {
|
|
74
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
-
blockTag = prepBlockTag(blockTag);
|
|
76
|
-
const transactionCount = (yield this.post(buildRPCPostBody('eth_getTransactionCount', [address, blockTag])));
|
|
77
|
-
return Number(hexToDecimal(transactionCount));
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
getBlock(timeFrame = 'latest', returnTransactionObjects = false) {
|
|
81
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
-
let type = 'Number';
|
|
83
|
-
if (typeof timeFrame === 'string' && timeFrame.length === 66) {
|
|
84
|
-
type = 'Hash';
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
timeFrame = prepBlockTag(timeFrame);
|
|
88
|
-
}
|
|
89
|
-
const rpcBlock = (yield this.post(buildRPCPostBody(`eth_getBlockBy${type}`, [
|
|
90
|
-
timeFrame,
|
|
91
|
-
returnTransactionObjects,
|
|
92
|
-
])));
|
|
93
|
-
return cleanBlock(rpcBlock, returnTransactionObjects);
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
getGasPrice() {
|
|
97
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
const hexGasPrice = (yield this.post(buildRPCPostBody('eth_gasPrice', [])));
|
|
99
|
-
return tinyBig(hexToDecimal(hexGasPrice));
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
getBalance(address, blockTag = 'latest') {
|
|
103
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
blockTag = prepBlockTag(blockTag);
|
|
105
|
-
const hexBalance = (yield this.post(buildRPCPostBody('eth_getBalance', [address, blockTag])));
|
|
106
|
-
return tinyBig(hexToDecimal(hexBalance));
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
getCode(address, blockTag = 'latest') {
|
|
110
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
-
blockTag = prepBlockTag(blockTag);
|
|
112
|
-
const contractCode = (yield this.post(buildRPCPostBody('eth_getCode', [address, blockTag])));
|
|
113
|
-
return contractCode;
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
estimateGas(transaction) {
|
|
117
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
const rpcTransaction = prepareTransaction(transaction);
|
|
119
|
-
const gasUsed = (yield this.post(buildRPCPostBody('eth_estimateGas', [rpcTransaction])));
|
|
120
|
-
return tinyBig(hexToDecimal(gasUsed));
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
getLogs(filter) {
|
|
124
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
const filterByRange = filter;
|
|
126
|
-
if (filterByRange.fromBlock)
|
|
127
|
-
filterByRange.fromBlock = prepBlockTag(filterByRange.fromBlock);
|
|
128
|
-
if (filterByRange.toBlock)
|
|
129
|
-
filterByRange.toBlock = prepBlockTag(filterByRange.toBlock);
|
|
130
|
-
const rpcLogs = (yield this.post(buildRPCPostBody('eth_getLogs', [filter])));
|
|
131
|
-
const logs = rpcLogs.map((log) => cleanLog(log, false));
|
|
132
|
-
return logs;
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
call(transaction, blockTag = 'latest') {
|
|
136
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
-
if (transaction.gasPrice &&
|
|
138
|
-
(transaction.maxPriorityFeePerGas || transaction.maxFeePerGas)) {
|
|
139
|
-
logger.throwError('Cannot specify both "gasPrice" and ("maxPriorityFeePerGas" or "maxFeePerGas")', {
|
|
140
|
-
gasPrice: transaction.gasPrice,
|
|
141
|
-
maxFeePerGas: transaction.maxFeePerGas,
|
|
142
|
-
maxPriorityFeePerGas: transaction.maxPriorityFeePerGas,
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
if (transaction.maxFeePerGas && transaction.maxPriorityFeePerGas) {
|
|
146
|
-
logger.throwError('Cannot specify both "maxFeePerGas" and "maxPriorityFeePerGas"', {
|
|
147
|
-
maxFeePerGas: transaction.maxFeePerGas,
|
|
148
|
-
maxPriorityFeePerGas: transaction.maxPriorityFeePerGas,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
blockTag = prepBlockTag(blockTag);
|
|
152
|
-
const rpcTransaction = prepareTransaction(transaction);
|
|
153
|
-
const transactionRes = (yield this.post(buildRPCPostBody('eth_call', [rpcTransaction, blockTag])));
|
|
154
|
-
return transactionRes;
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { logger } from '../logger/logger';
|
|
2
|
-
import { BaseProvider } from './BaseProvider';
|
|
3
|
-
const promiseTimeout = (prom, time) => Promise.race([
|
|
4
|
-
prom,
|
|
5
|
-
new Promise((_r, reject) => setTimeout(() => reject('Promise timed out'), time)),
|
|
6
|
-
]);
|
|
7
|
-
const DEFAULT_TIMEOUT_DURATION = 8000;
|
|
8
|
-
export class FallthroughProvider extends BaseProvider {
|
|
9
|
-
constructor(rpcUrls, options = {}) {
|
|
10
|
-
if (!Array.isArray(rpcUrls)) {
|
|
11
|
-
logger.throwError('Array required', { rpcUrls });
|
|
12
|
-
}
|
|
13
|
-
if (rpcUrls.length <= 1) {
|
|
14
|
-
logger.throwError('More than one rpcUrl is required', { rpcUrls });
|
|
15
|
-
}
|
|
16
|
-
super(rpcUrls);
|
|
17
|
-
this.rpcUrlCounter = 0;
|
|
18
|
-
this.post = (body) => {
|
|
19
|
-
const genesisCount = this.rpcUrlCounter;
|
|
20
|
-
const recursivePostRetry = () => {
|
|
21
|
-
const genesisRpcUrl = this.selectRpcUrl();
|
|
22
|
-
const res = promiseTimeout(this._post(body), this.timeoutDuration).catch((e) => {
|
|
23
|
-
if (genesisRpcUrl === this.selectRpcUrl()) {
|
|
24
|
-
this.rpcUrlCounter =
|
|
25
|
-
(this.rpcUrlCounter + 1) % this._rpcUrls.length;
|
|
26
|
-
}
|
|
27
|
-
if (this.rpcUrlCounter === genesisCount) {
|
|
28
|
-
throw e;
|
|
29
|
-
}
|
|
30
|
-
return recursivePostRetry();
|
|
31
|
-
});
|
|
32
|
-
return res;
|
|
33
|
-
};
|
|
34
|
-
return recursivePostRetry();
|
|
35
|
-
};
|
|
36
|
-
this.timeoutDuration = options.timeoutDuration || DEFAULT_TIMEOUT_DURATION;
|
|
37
|
-
}
|
|
38
|
-
selectRpcUrl() {
|
|
39
|
-
return this._rpcUrls[this.rpcUrlCounter];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BaseProvider } from './BaseProvider';
|
|
2
|
-
export class JsonRpcProvider extends BaseProvider {
|
|
3
|
-
selectRpcUrl() {
|
|
4
|
-
return this._rpcUrls[0];
|
|
5
|
-
}
|
|
6
|
-
post(body) {
|
|
7
|
-
return this._post(body);
|
|
8
|
-
}
|
|
9
|
-
constructor(rpcUrl = 'https://free-eth-node.com/api/eth') {
|
|
10
|
-
super([rpcUrl]);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export function jsonRpcProvider(rpcUrl) {
|
|
14
|
-
return new JsonRpcProvider(rpcUrl);
|
|
15
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const fakeUrls = {
|
|
2
|
-
notRPCButRealHttp: 'https://httpstat.us/200',
|
|
3
|
-
};
|
|
4
|
-
export const rpcUrls = {
|
|
5
|
-
mainnet: `${process.env.RPC_ORIGIN}/api/eth`,
|
|
6
|
-
matic: `${process.env.RPC_ORIGIN}/api/MATIC`,
|
|
7
|
-
gno: `${process.env.RPC_ORIGIN}/api/gno`,
|
|
8
|
-
bnb: `${process.env.RPC_ORIGIN}/api/bnb`,
|
|
9
|
-
arb1: `${process.env.RPC_ORIGIN}/api/arb1`,
|
|
10
|
-
gor: `${process.env.RPC_ORIGIN}/api/gor`,
|
|
11
|
-
};
|