essential-eth 0.8.0 → 0.9.1-next.0
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/dist/cjs/classes/Contract.js +38 -34
- package/dist/cjs/classes/test/Contract/crv.test.js +146 -339
- package/dist/cjs/classes/test/Contract/ens-abi.d.ts +1 -1
- package/dist/cjs/classes/test/Contract/ens.test.js +9 -66
- package/dist/cjs/classes/test/Contract/fei.test.js +11 -11
- package/dist/cjs/classes/test/Contract/foo-abi.d.ts +1 -1
- package/dist/cjs/classes/test/Contract/uni.test.js +66 -164
- package/dist/cjs/classes/utils/clean-block.js +4 -4
- package/dist/cjs/classes/utils/clean-log.js +4 -4
- package/dist/cjs/classes/utils/clean-transaction-receipt.js +4 -4
- package/dist/cjs/classes/utils/clean-transaction.js +4 -4
- package/dist/cjs/classes/utils/encode-decode-transaction.js +10 -10
- package/dist/cjs/classes/utils/fetchers.d.ts +8 -2
- package/dist/cjs/classes/utils/fetchers.js +20 -12
- package/dist/cjs/classes/utils/prepare-transaction.js +4 -4
- package/dist/cjs/index.d.ts +21 -21
- package/dist/cjs/index.js +21 -21
- package/dist/cjs/index.umd.js +1 -1
- package/dist/cjs/index.umd.js.map +1 -1
- package/dist/cjs/logger/logger.js +79 -41
- package/dist/cjs/logger/package-version.d.ts +1 -1
- package/dist/cjs/logger/package-version.js +1 -1
- package/dist/cjs/providers/AlchemyProvider.d.ts +4 -0
- package/dist/cjs/providers/AlchemyProvider.js +84 -0
- package/dist/cjs/providers/BaseProvider.js +471 -404
- package/dist/cjs/providers/FallthroughProvider.js +74 -38
- package/dist/cjs/providers/JsonRpcProvider.js +52 -31
- package/dist/cjs/providers/test/fallthrough-provider/get-gas-price.test.js +9 -9
- package/dist/cjs/providers/test/get-transaction-count.test.js +54 -91
- package/dist/cjs/providers/test/json-rpc-provider/call.test.js +87 -148
- package/dist/cjs/providers/test/json-rpc-provider/estimate-gas.test.js +45 -116
- package/dist/cjs/providers/test/json-rpc-provider/get-balance.test.js +36 -74
- package/dist/cjs/providers/test/json-rpc-provider/get-block-number.test.js +27 -94
- package/dist/cjs/providers/test/json-rpc-provider/get-block.test.js +191 -278
- package/dist/cjs/providers/test/json-rpc-provider/get-code.test.js +106 -135
- package/dist/cjs/providers/test/json-rpc-provider/get-fee-data.test.js +48 -73
- package/dist/cjs/providers/test/json-rpc-provider/get-gas-price.test.js +29 -64
- package/dist/cjs/providers/test/json-rpc-provider/get-logs/get-logs.test.js +219 -0
- package/dist/cjs/providers/test/json-rpc-provider/get-logs/mocks.d.ts +14 -0
- package/dist/cjs/providers/test/json-rpc-provider/get-logs/mocks.js +149 -0
- package/dist/cjs/providers/test/json-rpc-provider/get-network.test.js +37 -79
- package/dist/cjs/providers/test/json-rpc-provider/get-transaction-receipt.test.js +136 -157
- package/dist/cjs/providers/test/json-rpc-provider/get-transaction.test.js +121 -162
- package/dist/cjs/providers/test/mock-of.d.ts +2 -0
- package/dist/cjs/providers/test/mock-of.js +9 -0
- package/dist/cjs/providers/test/rpc-urls.d.ts +1 -0
- package/dist/cjs/providers/test/rpc-urls.js +12 -6
- package/dist/cjs/providers/test/test-alchemy-provider.test.js +151 -0
- package/dist/cjs/providers/utils/chains-info.d.ts +5 -448
- package/dist/cjs/providers/utils/chains-info.js +13 -1344
- package/dist/cjs/shared/tiny-big/helpers.js +18 -18
- package/dist/cjs/shared/tiny-big/tiny-big.js +96 -56
- package/dist/cjs/shared/tiny-big/tiny-big.test.js +2 -2
- package/dist/cjs/shared/validate-type.d.ts +1 -1
- package/dist/cjs/shared/validate-type.js +4 -4
- package/dist/cjs/types/Block.types.d.ts +3 -3
- package/dist/cjs/types/Contract.types.d.ts +4 -4
- package/dist/cjs/types/Transaction.types.d.ts +5 -5
- package/dist/cjs/utils/bytes.d.ts +4 -4
- package/dist/cjs/utils/bytes.js +3 -3
- package/dist/cjs/utils/tests/bytes/arrayify.test.js +48 -24
- package/dist/cjs/utils/tests/bytes/concat.test.js +5 -3
- package/dist/cjs/utils/tests/bytes/hex-concat.test.js +15 -13
- package/dist/cjs/utils/tests/bytes/hex-data-length.test.js +49 -32
- package/dist/cjs/utils/tests/bytes/hex-data-slice.test.js +15 -16
- package/dist/cjs/utils/tests/bytes/hex-strip-zeros.test.js +57 -40
- package/dist/cjs/utils/tests/bytes/hex-value.test.js +118 -62
- package/dist/cjs/utils/tests/bytes/hex-zero-pad.test.js +71 -33
- package/dist/cjs/utils/tests/bytes/hexlify.test.js +45 -29
- package/dist/cjs/utils/tests/bytes/is-bytes-like.test.js +10 -11
- package/dist/cjs/utils/tests/bytes/is-bytes.test.js +70 -27
- package/dist/cjs/utils/tests/bytes/is-hex-string.test.js +37 -28
- package/dist/cjs/utils/tests/bytes/strip-zeros.test.js +94 -45
- package/dist/cjs/utils/tests/bytes/zero-pad.test.js +98 -34
- package/dist/cjs/utils/tests/compute-address.test.js +42 -20
- package/dist/cjs/utils/tests/compute-public-key.test.js +20 -9
- package/dist/cjs/utils/tests/ether-to-wei.test.js +5 -13
- package/dist/cjs/utils/tests/hash-message.test.js +26 -15
- package/dist/cjs/utils/tests/is-address.test.js +2 -9
- package/dist/cjs/utils/tests/keccak256.test.js +36 -12
- package/dist/cjs/utils/tests/solidity-keccak256.test.js +43 -42
- package/dist/cjs/utils/tests/split-signature.test.js +29 -8
- package/dist/cjs/utils/tests/to-checksum-address.test.js +1 -4
- package/dist/cjs/utils/tests/to-utf8-bytes.test.js +28 -8
- package/dist/cjs/utils/tests/wei-to-ether.test.js +10 -20
- package/dist/esm/classes/test/Contract/ens-abi.d.ts +1 -1
- package/dist/esm/classes/test/Contract/foo-abi.d.ts +1 -1
- package/dist/esm/classes/utils/fetchers.d.ts +8 -2
- package/dist/esm/classes/utils/fetchers.js +6 -3
- package/dist/esm/index.d.ts +21 -21
- package/dist/esm/index.js +16 -16
- package/dist/esm/logger/package-version.d.ts +1 -1
- package/dist/esm/logger/package-version.js +1 -1
- package/dist/esm/providers/AlchemyProvider.d.ts +4 -0
- package/dist/esm/providers/AlchemyProvider.js +7 -0
- package/dist/esm/providers/FallthroughProvider.js +15 -7
- package/dist/esm/providers/test/json-rpc-provider/get-logs/mocks.d.ts +14 -0
- package/dist/esm/providers/test/json-rpc-provider/get-logs/mocks.js +142 -0
- package/dist/esm/providers/test/mock-of.d.ts +2 -0
- package/dist/esm/providers/test/mock-of.js +1 -0
- package/dist/esm/providers/test/rpc-urls.d.ts +1 -0
- package/dist/esm/providers/test/rpc-urls.js +14 -6
- package/dist/esm/providers/utils/chains-info.d.ts +5 -448
- package/dist/esm/providers/utils/chains-info.js +13 -1344
- package/dist/esm/shared/validate-type.d.ts +1 -1
- package/dist/esm/types/Block.types.d.ts +3 -3
- package/dist/esm/types/Contract.types.d.ts +4 -4
- package/dist/esm/types/Transaction.types.d.ts +5 -5
- package/dist/esm/utils/bytes.d.ts +4 -4
- package/package.json +23 -51
- package/readme.md +16 -38
- package/dist/cjs/providers/test/json-rpc-provider/get-logs.test.js +0 -361
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import Big from "big.js";
|
|
2
|
-
import * as ethers from "ethers";
|
|
3
|
-
import web3 from "web3";
|
|
4
2
|
import { tinyBig, weiToEther } from "../../index";
|
|
5
3
|
describe("wei-to-ether", function() {
|
|
6
4
|
it("happy path", function() {
|
|
@@ -13,26 +11,18 @@ describe("wei-to-ether", function() {
|
|
|
13
11
|
expect(weiToEther(Big("1000000000000000000000.0")).toNumber()).toBe(1000);
|
|
14
12
|
expect(weiToEther(Big(1000000000000000000000.0)).toNumber()).toBe(1000);
|
|
15
13
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/* easy */ expect(weiToEther("9").toNumber()).toStrictEqual(Number(ethers.utils.formatEther("9")));
|
|
25
|
-
// expect(weiToEther("9").toNumber()).toStrictEqual(
|
|
26
|
-
// Number(ethers.utils.formatEther("9")),
|
|
27
|
-
// );
|
|
28
|
-
expect(weiToEther("9").toNumber()).toStrictEqual(Number(web3.utils.fromWei("9", "ether")));
|
|
29
|
-
/* hard because they respond with scientific notation or overflowing */ expect(weiToEther("999999").toNumber()).toStrictEqual(Number(ethers.utils.formatEther("999999")));
|
|
30
|
-
expect(weiToEther("999999").toNumber()).toStrictEqual(Number(web3.utils.fromWei("999999", "ether")));
|
|
31
|
-
});
|
|
14
|
+
it("matches expected value toString", function() {
|
|
15
|
+
expect(weiToEther("10").toString()).toBe("0.00000000000000001");
|
|
16
|
+
expect(weiToEther("1000000000000000000000").toString()).toBe("1000");
|
|
17
|
+
});
|
|
18
|
+
it("matches expected value toNumber", function() {
|
|
19
|
+
/* easy */ expect(weiToEther("9").toNumber()).toBe(9e-18);
|
|
20
|
+
expect(weiToEther("9").toNumber()).toBe(9e-18);
|
|
21
|
+
/* harder */ expect(weiToEther("999999").toNumber()).toBe(9.99999e-13);
|
|
32
22
|
});
|
|
33
23
|
it("support hex", function() {
|
|
34
|
-
expect(weiToEther("0x14").toString()).
|
|
35
|
-
expect(weiToEther(0x14).toString()).
|
|
24
|
+
expect(weiToEther("0x14").toString()).toBe("0.00000000000000002");
|
|
25
|
+
expect(weiToEther(0x14).toString()).toBe("0.00000000000000002");
|
|
36
26
|
});
|
|
37
27
|
it("wrong types", function() {
|
|
38
28
|
expect(function() {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { JSONABI } from '
|
|
1
|
+
import type { JSONABI } from '../../../types/Contract.types';
|
|
2
2
|
export declare const ensABI: JSONABI;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { JSONABI } from '
|
|
1
|
+
import type { JSONABI } from '../../../types/Contract.types';
|
|
2
2
|
export declare const fooABI: JSONABI;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
export declare function buildFetchInit<T>(body: T): {
|
|
2
|
+
method: string;
|
|
3
|
+
headers: {
|
|
4
|
+
'Content-Type': string;
|
|
5
|
+
};
|
|
6
|
+
body: string;
|
|
7
|
+
};
|
|
1
8
|
export declare function post(url: string, body: Record<string, unknown>): Promise<any>;
|
|
2
|
-
|
|
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';
|
|
3
10
|
export declare function buildRPCPostBody(method: RPCMethodName, params: unknown[]): {
|
|
4
11
|
jsonrpc: string;
|
|
5
12
|
id: number;
|
|
6
13
|
method: RPCMethodName;
|
|
7
14
|
params: unknown[];
|
|
8
15
|
};
|
|
9
|
-
export {};
|
|
@@ -8,14 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import unfetch from 'isomorphic-unfetch';
|
|
11
|
-
export function
|
|
12
|
-
return
|
|
11
|
+
export function buildFetchInit(body) {
|
|
12
|
+
return {
|
|
13
13
|
method: 'POST',
|
|
14
14
|
headers: {
|
|
15
15
|
'Content-Type': 'application/json',
|
|
16
16
|
},
|
|
17
17
|
body: JSON.stringify(body),
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function post(url, body) {
|
|
21
|
+
return unfetch(url, buildFetchInit(body))
|
|
19
22
|
.then((r) => __awaiter(this, void 0, void 0, function* () {
|
|
20
23
|
const t = yield r.text();
|
|
21
24
|
try {
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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';
|
|
21
22
|
export * from './utils/bytes';
|
|
22
23
|
export * from './utils/hash-message';
|
|
23
24
|
export * from './utils/keccak256';
|
|
24
25
|
export * from './utils/solidity-keccak256';
|
|
25
|
-
export { etherToWei, etherToGwei, isAddress, jsonRpcProvider, JsonRpcProvider, FallthroughProvider, tinyBig, toChecksumAddress, weiToEther, gweiToEther, hashMessage, splitSignature, toUtf8Bytes, computeAddress, computePublicKey, Contract, TinyBig, BaseContract, BlockResponse, ContractTypes, Filter, FilterByBlockHash, JSONABI, JSONABIArgument, Network, TransactionResponse, RPCBlock, RPCTransaction, RPCTransactionReceipt, TransactionRequest, RPCTransactionRequest, TransactionReceipt, BlockTag, RPCLog, Log, BlockTransactionResponse, ConstructorOptions, };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
export { Contract, BaseContract } from './classes/Contract';
|
|
2
|
+
export { AlchemyProvider } from './providers/AlchemyProvider';
|
|
3
|
+
export { FallthroughProvider, } from './providers/FallthroughProvider';
|
|
4
|
+
export { jsonRpcProvider, JsonRpcProvider } from './providers/JsonRpcProvider';
|
|
5
|
+
export { tinyBig, TinyBig } from './shared/tiny-big/tiny-big';
|
|
6
|
+
export { computeAddress } from './utils/compute-address';
|
|
7
|
+
export { computePublicKey } from './utils/compute-public-key';
|
|
8
|
+
export { etherToGwei } from './utils/ether-to-gwei';
|
|
9
|
+
export { etherToWei } from './utils/ether-to-wei';
|
|
10
|
+
export { gweiToEther } from './utils/gwei-to-ether';
|
|
11
|
+
export { hashMessage } from './utils/hash-message';
|
|
12
|
+
export { isAddress } from './utils/is-address';
|
|
13
|
+
export { splitSignature } from './utils/split-signature';
|
|
14
|
+
export { toChecksumAddress } from './utils/to-checksum-address';
|
|
15
|
+
export { toUtf8Bytes } from './utils/to-utf8-bytes';
|
|
16
|
+
export { weiToEther } from './utils/wei-to-ether';
|
|
16
17
|
export * from './utils/bytes';
|
|
17
18
|
export * from './utils/hash-message';
|
|
18
19
|
export * from './utils/keccak256';
|
|
19
20
|
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, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.
|
|
1
|
+
export declare const version = "0.9.1-next.0";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.
|
|
1
|
+
export const version = '0.9.1-next.0';
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { logger } from '../logger/logger';
|
|
2
2
|
import { BaseProvider } from './BaseProvider';
|
|
3
|
-
const promiseTimeout = (prom, time) => Promise
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const promiseTimeout = (prom, time) => new Promise((resolve, reject) => {
|
|
4
|
+
const timeout = setTimeout(() => reject(new Error('Promise timed out')), time);
|
|
5
|
+
prom
|
|
6
|
+
.then((result) => {
|
|
7
|
+
clearTimeout(timeout);
|
|
8
|
+
resolve(result);
|
|
9
|
+
})
|
|
10
|
+
.catch((error) => {
|
|
11
|
+
clearTimeout(timeout);
|
|
12
|
+
reject(error);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
7
15
|
const DEFAULT_TIMEOUT_DURATION = 8000;
|
|
8
16
|
export class FallthroughProvider extends BaseProvider {
|
|
17
|
+
selectRpcUrl() {
|
|
18
|
+
return this._rpcUrls[this.rpcUrlCounter];
|
|
19
|
+
}
|
|
9
20
|
constructor(rpcUrls, options = {}) {
|
|
10
21
|
if (!Array.isArray(rpcUrls)) {
|
|
11
22
|
logger.throwError('Array required', { rpcUrls });
|
|
@@ -35,7 +46,4 @@ export class FallthroughProvider extends BaseProvider {
|
|
|
35
46
|
};
|
|
36
47
|
this.timeoutDuration = options.timeoutDuration || DEFAULT_TIMEOUT_DURATION;
|
|
37
48
|
}
|
|
38
|
-
selectRpcUrl() {
|
|
39
|
-
return this._rpcUrls[this.rpcUrlCounter];
|
|
40
|
-
}
|
|
41
49
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Filter } from '../../../../types/Filter.types';
|
|
2
|
+
import type { RPCLog } from '../../../../types/Transaction.types';
|
|
3
|
+
export declare const STRONGBLOCK_ADDRESS = "0xfbddadd80fe7bda00b901fbaf73803f2238ae655";
|
|
4
|
+
export declare const filterAddressFromTo: Filter;
|
|
5
|
+
export declare const RARELAND_ADDRESS = "0x596a0f276ee432d8a28441e55737ff55cf30d0f7";
|
|
6
|
+
export declare const filterAddressTopics: Filter;
|
|
7
|
+
export declare const WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
|
|
8
|
+
export declare const filterAll: Filter;
|
|
9
|
+
export declare const mockfilterAddressFromToLogs: RPCLog[];
|
|
10
|
+
export declare const mockfilterAddressTopicsLogs: RPCLog[];
|
|
11
|
+
export declare const mockfilterAllLogs: RPCLog[];
|
|
12
|
+
export declare const mockRpcAddressFromToResponse: string;
|
|
13
|
+
export declare const mockRpcAddressTopicsResponse: string;
|
|
14
|
+
export declare const mockRpcAllResponse: string;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
export const STRONGBLOCK_ADDRESS = '0xfbddadd80fe7bda00b901fbaf73803f2238ae655';
|
|
2
|
+
export const filterAddressFromTo = {
|
|
3
|
+
address: STRONGBLOCK_ADDRESS,
|
|
4
|
+
fromBlock: '0xE1F8F1',
|
|
5
|
+
toBlock: '0xE1F8F1',
|
|
6
|
+
};
|
|
7
|
+
export const RARELAND_ADDRESS = '0x596a0f276ee432d8a28441e55737ff55cf30d0f7';
|
|
8
|
+
export const filterAddressTopics = {
|
|
9
|
+
address: RARELAND_ADDRESS,
|
|
10
|
+
topics: [
|
|
11
|
+
'0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925',
|
|
12
|
+
],
|
|
13
|
+
};
|
|
14
|
+
export const WETH_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
|
|
15
|
+
export const filterAll = {
|
|
16
|
+
address: WETH_ADDRESS,
|
|
17
|
+
topics: [
|
|
18
|
+
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
|
|
19
|
+
'0x00000000000000000000000021b8065d10f73ee2e260e5b47d3344d3ced7596e',
|
|
20
|
+
],
|
|
21
|
+
fromBlock: 14825027,
|
|
22
|
+
toBlock: 14825039,
|
|
23
|
+
};
|
|
24
|
+
export const mockfilterAddressFromToLogs = [
|
|
25
|
+
{
|
|
26
|
+
address: '0xfbddadd80fe7bda00b901fbaf73803f2238ae655',
|
|
27
|
+
topics: [
|
|
28
|
+
'0xd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a',
|
|
29
|
+
'0x00000000000000000000000028c2e3e17f8c61a9b7515f7bb1e1347846588b82',
|
|
30
|
+
],
|
|
31
|
+
data: '0x0000000000000000000000000000000000000000000000001dbaed81bf64db6d',
|
|
32
|
+
blockNumber: '0xe1f8f1',
|
|
33
|
+
transactionHash: '0x5dec3a55b87edac0af5c4a9afdd015bb04303fdf86525dd1cc4e7aa7653b6301',
|
|
34
|
+
transactionIndex: '0x29',
|
|
35
|
+
blockHash: '0x343ead2d84a53b054bc191fe00807d59b40094bb0cbc49b3ba550169b046d4b8',
|
|
36
|
+
logIndex: '0x88',
|
|
37
|
+
removed: false,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
address: '0xfbddadd80fe7bda00b901fbaf73803f2238ae655',
|
|
41
|
+
topics: [
|
|
42
|
+
'0xd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a',
|
|
43
|
+
'0x000000000000000000000000c3b80d78bb52fd734c4f730dad5e190ba4ecb830',
|
|
44
|
+
],
|
|
45
|
+
data: '0x0000000000000000000000000000000000000000000000001c277de315af8924',
|
|
46
|
+
blockNumber: '0xe1f8f1',
|
|
47
|
+
transactionHash: '0xae04b63efd57852e34bdc84e257bb413f9f942288f63a131d4b7071c8ee0b896',
|
|
48
|
+
transactionIndex: '0x2f',
|
|
49
|
+
blockHash: '0x343ead2d84a53b054bc191fe00807d59b40094bb0cbc49b3ba550169b046d4b8',
|
|
50
|
+
logIndex: '0x95',
|
|
51
|
+
removed: false,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
address: '0xfbddadd80fe7bda00b901fbaf73803f2238ae655',
|
|
55
|
+
topics: [
|
|
56
|
+
'0xd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a',
|
|
57
|
+
'0x000000000000000000000000f1a192063f0a2b2be0cbcb2978b13e95e7f35f6b',
|
|
58
|
+
],
|
|
59
|
+
data: '0x00000000000000000000000000000000000000000000000018ecfa70ea275b6d',
|
|
60
|
+
blockNumber: '0xe1f8f1',
|
|
61
|
+
transactionHash: '0xbdba7260507b4ca24757809ac9a23e5225e80a491475ccf89a04c1894a693c77',
|
|
62
|
+
transactionIndex: '0x30',
|
|
63
|
+
blockHash: '0x343ead2d84a53b054bc191fe00807d59b40094bb0cbc49b3ba550169b046d4b8',
|
|
64
|
+
logIndex: '0x97',
|
|
65
|
+
removed: false,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
address: '0xfbddadd80fe7bda00b901fbaf73803f2238ae655',
|
|
69
|
+
topics: [
|
|
70
|
+
'0xd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a',
|
|
71
|
+
'0x000000000000000000000000c78dc12c9b04858d57a108ae948020344895e910',
|
|
72
|
+
],
|
|
73
|
+
data: '0x0000000000000000000000000000000000000000000000000da5142efe16e492',
|
|
74
|
+
blockNumber: '0xe1f8f1',
|
|
75
|
+
transactionHash: '0xdcf29bd8a44ec89a3b53488dd60b76bd7f1c532db76f88e166f3de1ab216537e',
|
|
76
|
+
transactionIndex: '0x31',
|
|
77
|
+
blockHash: '0x343ead2d84a53b054bc191fe00807d59b40094bb0cbc49b3ba550169b046d4b8',
|
|
78
|
+
logIndex: '0x99',
|
|
79
|
+
removed: false,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
address: '0xfbddadd80fe7bda00b901fbaf73803f2238ae655',
|
|
83
|
+
topics: [
|
|
84
|
+
'0xd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a',
|
|
85
|
+
'0x000000000000000000000000aaf5c3760f4a77bdf23974f98d69f9ccfd778aea',
|
|
86
|
+
],
|
|
87
|
+
data: '0x0000000000000000000000000000000000000000000000001086ed3d87034000',
|
|
88
|
+
blockNumber: '0xe1f8f1',
|
|
89
|
+
transactionHash: '0x56130c6e8fdafd0e08411b21ce984eeb56dc61d99a91f03efc7edde748d7ad81',
|
|
90
|
+
transactionIndex: '0x35',
|
|
91
|
+
blockHash: '0x343ead2d84a53b054bc191fe00807d59b40094bb0cbc49b3ba550169b046d4b8',
|
|
92
|
+
logIndex: '0xac',
|
|
93
|
+
removed: false,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
address: '0xfbddadd80fe7bda00b901fbaf73803f2238ae655',
|
|
97
|
+
topics: [
|
|
98
|
+
'0x39b0a0620bb668047ab7248973ddfd93d53dff1d4952bd2d56bbf5934edc1fd0',
|
|
99
|
+
'0x0000000000000000000000001753de22132990dd5ab35f13a5951431c8ba08ea',
|
|
100
|
+
],
|
|
101
|
+
data: '0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000e3203b',
|
|
102
|
+
blockNumber: '0xe1f8f1',
|
|
103
|
+
transactionHash: '0xf5a77d85296cc670d577d3c9a76b1fa18be77239a4cb4c05493530866d60c36f',
|
|
104
|
+
transactionIndex: '0x3a',
|
|
105
|
+
blockHash: '0x343ead2d84a53b054bc191fe00807d59b40094bb0cbc49b3ba550169b046d4b8',
|
|
106
|
+
logIndex: '0xb5',
|
|
107
|
+
removed: false,
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
export const mockfilterAddressTopicsLogs = [];
|
|
111
|
+
export const mockfilterAllLogs = [
|
|
112
|
+
{
|
|
113
|
+
address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
114
|
+
topics: [
|
|
115
|
+
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
|
|
116
|
+
'0x00000000000000000000000021b8065d10f73ee2e260e5b47d3344d3ced7596e',
|
|
117
|
+
'0x00000000000000000000000068b3465833fb72a70ecdf485e0e4c7bd8665fc45',
|
|
118
|
+
],
|
|
119
|
+
data: '0x000000000000000000000000000000000000000000000000005f862ee352a38a',
|
|
120
|
+
blockNumber: '0xe23645',
|
|
121
|
+
transactionHash: '0xbd49031be16f8fd1775f4e0fe79b408ffd8ae9c65b2827ee47e3238e3f51f4c0',
|
|
122
|
+
transactionIndex: '0xe2',
|
|
123
|
+
blockHash: '0x8e0dfac2f704851960f866c8708b3bef2f66c0fee0329cf25ff0261b264ca6bc',
|
|
124
|
+
logIndex: '0x180',
|
|
125
|
+
removed: false,
|
|
126
|
+
},
|
|
127
|
+
];
|
|
128
|
+
export const mockRpcAddressFromToResponse = JSON.stringify({
|
|
129
|
+
jsonrpc: '2.0',
|
|
130
|
+
id: 1,
|
|
131
|
+
result: mockfilterAddressFromToLogs,
|
|
132
|
+
});
|
|
133
|
+
export const mockRpcAddressTopicsResponse = JSON.stringify({
|
|
134
|
+
jsonrpc: '2.0',
|
|
135
|
+
id: 1,
|
|
136
|
+
result: mockfilterAddressTopicsLogs,
|
|
137
|
+
});
|
|
138
|
+
export const mockRpcAllResponse = JSON.stringify({
|
|
139
|
+
jsonrpc: '2.0',
|
|
140
|
+
id: 1,
|
|
141
|
+
result: mockfilterAllLogs,
|
|
142
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const mockOf = (fn) => fn;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
import z from 'zod';
|
|
1
2
|
export const fakeUrls = {
|
|
2
3
|
notRPCButRealHttp: 'https://httpstat.us/200',
|
|
3
4
|
};
|
|
5
|
+
const RPC_ORIGIN = 'https://free-eth-node.com';
|
|
6
|
+
z.string({
|
|
7
|
+
required_error: '"RPC_ORIGIN" required but not found',
|
|
8
|
+
})
|
|
9
|
+
.url('Expected url for "RPC_ORIGIN"')
|
|
10
|
+
.parse(RPC_ORIGIN);
|
|
4
11
|
export const rpcUrls = {
|
|
5
|
-
mainnet: `${
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
mainnet: `${RPC_ORIGIN}/api/eth`,
|
|
13
|
+
oeth: `${RPC_ORIGIN}/api/oeth`,
|
|
14
|
+
matic: `${RPC_ORIGIN}/api/MATIC`,
|
|
15
|
+
gno: `${RPC_ORIGIN}/api/gno`,
|
|
16
|
+
bnb: `${RPC_ORIGIN}/api/bnb`,
|
|
17
|
+
arb1: `${RPC_ORIGIN}/api/arb1`,
|
|
18
|
+
gor: `${RPC_ORIGIN}/api/gor`,
|
|
11
19
|
};
|