@waku/rln 0.1.4-d27db21.0 → 0.1.5-76f86de.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/CHANGELOG.md +19 -0
- package/README.md +5 -0
- package/bundle/index.js +1 -1
- package/bundle/node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js +1 -1
- package/bundle/node_modules/@ethersproject/abi/lib.esm/interface.js +1 -1
- package/bundle/node_modules/@ethersproject/abstract-provider/lib.esm/index.js +1 -1
- package/bundle/node_modules/@ethersproject/abstract-signer/lib.esm/index.js +11 -11
- package/bundle/node_modules/@ethersproject/bytes/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/contracts/lib.esm/index.js +7 -7
- package/bundle/node_modules/@ethersproject/hash/lib.esm/ens-normalize/lib.js +2 -2
- package/bundle/node_modules/@ethersproject/hash/lib.esm/typed-data.js +2 -2
- package/bundle/node_modules/@ethersproject/keccak256/node_modules/js-sha3/src/sha3.js +1 -1
- package/bundle/node_modules/@ethersproject/logger/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/properties/lib.esm/index.js +1 -1
- package/bundle/node_modules/@ethersproject/providers/lib.esm/base-provider.js +44 -44
- package/bundle/node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js +8 -8
- package/bundle/node_modules/@ethersproject/rlp/lib.esm/_version.js +1 -1
- package/bundle/node_modules/@ethersproject/transactions/lib.esm/index.js +1 -1
- package/bundle/node_modules/@ethersproject/web/lib.esm/geturl.js +1 -1
- package/bundle/node_modules/@ethersproject/web/lib.esm/index.js +2 -2
- package/bundle/node_modules/@multiformats/multiaddr/dist/src/multiaddr.js +1 -0
- package/bundle/node_modules/@noble/hashes/esm/sha3.js +1 -1
- package/bundle/node_modules/bn.js/lib/bn.js +1 -1
- package/bundle/packages/core/dist/lib/connection_manager/connection_manager.js +6 -6
- package/bundle/packages/rln/dist/contract/abi.js +502 -248
- package/bundle/packages/rln/dist/contract/constants.js +4 -5
- package/bundle/packages/rln/dist/contract/rln_contract.js +121 -37
- package/bundle/packages/rln/dist/keystore/keystore.js +2 -1
- package/bundle/packages/rln/dist/rln.js +4 -4
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/checksum.js +2 -2
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/cipher.js +3 -3
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/class.js +4 -4
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/functional.js +4 -4
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/kdf.js +4 -4
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/password.js +1 -1
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/schema-validation-generated.js +1 -1
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/lib/schema-validation.js +1 -1
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/aes.js +1 -1
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/pbkdf2.js +1 -1
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/random.js +1 -1
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/scrypt.js +1 -1
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/sha256.js +1 -1
- package/bundle/packages/rln/node_modules/@chainsafe/bls-keystore/node_modules/ethereum-cryptography/utils.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/_assert.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/_sha2.js +2 -2
- package/bundle/packages/rln/node_modules/@noble/hashes/_u64.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/cryptoBrowser.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/hmac.js +2 -2
- package/bundle/packages/rln/node_modules/@noble/hashes/pbkdf2.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/scrypt.js +2 -2
- package/bundle/packages/rln/node_modules/@noble/hashes/sha256.js +1 -1
- package/bundle/packages/rln/node_modules/@noble/hashes/sha512.js +2 -2
- package/bundle/packages/rln/node_modules/@noble/hashes/utils.js +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/codec.test-utils.d.ts +36 -0
- package/dist/codec.test-utils.js +56 -0
- package/dist/codec.test-utils.js.map +1 -0
- package/dist/contract/abi.d.ts +21 -17
- package/dist/contract/abi.js +502 -248
- package/dist/contract/abi.js.map +1 -1
- package/dist/contract/constants.d.ts +22 -18
- package/dist/contract/constants.js +3 -3
- package/dist/contract/constants.js.map +1 -1
- package/dist/contract/rln_contract.d.ts +10 -3
- package/dist/contract/rln_contract.js +120 -36
- package/dist/contract/rln_contract.js.map +1 -1
- package/dist/contract/test-setup.d.ts +26 -0
- package/dist/contract/test-setup.js +56 -0
- package/dist/contract/test-setup.js.map +1 -0
- package/dist/contract/test-utils.d.ts +39 -0
- package/dist/contract/test-utils.js +118 -0
- package/dist/contract/test-utils.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/keystore/keystore.js +2 -1
- package/dist/keystore/keystore.js.map +1 -1
- package/dist/keystore/types.d.ts +1 -0
- package/dist/rln.d.ts +1 -1
- package/dist/rln.js +4 -4
- package/dist/rln.js.map +1 -1
- package/package.json +1 -1
- package/src/codec.test-utils.ts +80 -0
- package/src/contract/abi.ts +502 -248
- package/src/contract/constants.ts +3 -3
- package/src/contract/rln_contract.ts +158 -46
- package/src/contract/test-setup.ts +86 -0
- package/src/contract/test-utils.ts +179 -0
- package/src/index.ts +13 -2
- package/src/keystore/keystore.ts +2 -1
- package/src/keystore/types.ts +1 -0
- package/src/rln.ts +5 -5
package/CHANGELOG.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [0.1.4](https://github.com/waku-org/js-waku/compare/rln-v0.1.3...rln-v0.1.4) (2025-03-24)
|
4
|
+
|
5
|
+
|
6
|
+
### Features
|
7
|
+
|
8
|
+
* @waku/rln ([#2244](https://github.com/waku-org/js-waku/issues/2244)) ([0a0a92b](https://github.com/waku-org/js-waku/commit/0a0a92bccb02fdf9b927bee928b040ff5d624b67))
|
9
|
+
* **rln:** Migrate from v1 to v2, rate limiting, memberships, test coverage ([#2262](https://github.com/waku-org/js-waku/issues/2262)) ([6fc6bf3](https://github.com/waku-org/js-waku/commit/6fc6bf3916d6dad3d516a5769331245f1b6d55e8))
|
10
|
+
|
11
|
+
|
12
|
+
### Dependencies
|
13
|
+
|
14
|
+
* The following workspace dependencies were updated
|
15
|
+
* dependencies
|
16
|
+
* @waku/core bumped from ^0.0.33 to ^0.0.34
|
17
|
+
* @waku/utils bumped from ^0.0.21 to ^0.0.22
|
18
|
+
* devDependencies
|
19
|
+
* @waku/message-encryption bumped from ^0.0.31 to ^0.0.32
|
package/README.md
CHANGED
@@ -20,6 +20,11 @@ import { RLN } from '@waku/rln';
|
|
20
20
|
// Usage examples coming soon
|
21
21
|
```
|
22
22
|
|
23
|
+
## Constants
|
24
|
+
|
25
|
+
- Implementation contract: 0xde2260ca49300357d5af4153cda0d18f7b3ea9b3
|
26
|
+
- Proxy contract: 0xb9cd878c90e49f797b4431fbf4fb333108cb90e6
|
27
|
+
|
23
28
|
## License
|
24
29
|
|
25
30
|
MIT OR Apache-2.0
|
package/bundle/index.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
export { RLNDecoder, RLNEncoder } from './packages/rln/dist/codec.js';
|
2
2
|
export { RLN_ABI } from './packages/rln/dist/contract/abi.js';
|
3
3
|
export { RLNContract } from './packages/rln/dist/contract/rln_contract.js';
|
4
|
-
export {
|
4
|
+
export { LINEA_CONTRACT } from './packages/rln/dist/contract/constants.js';
|
5
5
|
export { createRLN } from './packages/rln/dist/create.js';
|
6
6
|
export { IdentityCredential } from './packages/rln/dist/identity.js';
|
7
7
|
export { Keystore } from './packages/rln/dist/keystore/keystore.js';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { arrayify, hexlify, hexConcat, concat } from '../../../bytes/lib.esm/index.js';
|
2
2
|
import { defineReadOnly } from '../../../properties/lib.esm/index.js';
|
3
3
|
import { Logger } from '../../../logger/lib.esm/index.js';
|
4
4
|
import { version } from '../_version.js';
|
@@ -2,7 +2,7 @@ import { getAddress } from '../../address/lib.esm/index.js';
|
|
2
2
|
import { hexDataSlice, isHexString, arrayify, hexlify, concat, hexZeroPad } from '../../bytes/lib.esm/index.js';
|
3
3
|
import { id } from '../../hash/lib.esm/id.js';
|
4
4
|
import { keccak256 } from '../../keccak256/lib.esm/index.js';
|
5
|
-
import {
|
5
|
+
import { defineReadOnly, getStatic, Description } from '../../properties/lib.esm/index.js';
|
6
6
|
import { defaultAbiCoder } from './abi-coder.js';
|
7
7
|
import { Fragment, ConstructorFragment, FormatTypes, FunctionFragment, EventFragment, ParamType } from './fragments.js';
|
8
8
|
import { Logger } from '../../logger/lib.esm/index.js';
|
@@ -29,7 +29,7 @@ class Provider {
|
|
29
29
|
defineReadOnly(this, "_isProvider", true);
|
30
30
|
}
|
31
31
|
getFeeData() {
|
32
|
-
return __awaiter(this,
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
33
33
|
const { block, gasPrice } = yield resolveProperties({
|
34
34
|
block: this.getBlock("latest"),
|
35
35
|
gasPrice: this.getGasPrice().catch((error) => {
|
@@ -30,20 +30,20 @@ class Signer {
|
|
30
30
|
///////////////////
|
31
31
|
// Sub-classes MAY override these
|
32
32
|
getBalance(blockTag) {
|
33
|
-
return __awaiter(this,
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
34
34
|
this._checkProvider("getBalance");
|
35
35
|
return yield this.provider.getBalance(this.getAddress(), blockTag);
|
36
36
|
});
|
37
37
|
}
|
38
38
|
getTransactionCount(blockTag) {
|
39
|
-
return __awaiter(this,
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
40
40
|
this._checkProvider("getTransactionCount");
|
41
41
|
return yield this.provider.getTransactionCount(this.getAddress(), blockTag);
|
42
42
|
});
|
43
43
|
}
|
44
44
|
// Populates "from" if unspecified, and estimates the gas for the transaction
|
45
45
|
estimateGas(transaction) {
|
46
|
-
return __awaiter(this,
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
47
47
|
this._checkProvider("estimateGas");
|
48
48
|
const tx = yield resolveProperties(this.checkTransaction(transaction));
|
49
49
|
return yield this.provider.estimateGas(tx);
|
@@ -51,7 +51,7 @@ class Signer {
|
|
51
51
|
}
|
52
52
|
// Populates "from" if unspecified, and calls with the transaction
|
53
53
|
call(transaction, blockTag) {
|
54
|
-
return __awaiter(this,
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
55
55
|
this._checkProvider("call");
|
56
56
|
const tx = yield resolveProperties(this.checkTransaction(transaction));
|
57
57
|
return yield this.provider.call(tx, blockTag);
|
@@ -59,7 +59,7 @@ class Signer {
|
|
59
59
|
}
|
60
60
|
// Populates all fields in a transaction, signs it and sends it to the network
|
61
61
|
sendTransaction(transaction) {
|
62
|
-
return __awaiter(this,
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
63
63
|
this._checkProvider("sendTransaction");
|
64
64
|
const tx = yield this.populateTransaction(transaction);
|
65
65
|
const signedTx = yield this.signTransaction(tx);
|
@@ -67,26 +67,26 @@ class Signer {
|
|
67
67
|
});
|
68
68
|
}
|
69
69
|
getChainId() {
|
70
|
-
return __awaiter(this,
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
71
71
|
this._checkProvider("getChainId");
|
72
72
|
const network = yield this.provider.getNetwork();
|
73
73
|
return network.chainId;
|
74
74
|
});
|
75
75
|
}
|
76
76
|
getGasPrice() {
|
77
|
-
return __awaiter(this,
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
78
78
|
this._checkProvider("getGasPrice");
|
79
79
|
return yield this.provider.getGasPrice();
|
80
80
|
});
|
81
81
|
}
|
82
82
|
getFeeData() {
|
83
|
-
return __awaiter(this,
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
84
84
|
this._checkProvider("getFeeData");
|
85
85
|
return yield this.provider.getFeeData();
|
86
86
|
});
|
87
87
|
}
|
88
88
|
resolveName(name) {
|
89
|
-
return __awaiter(this,
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
90
90
|
this._checkProvider("resolveName");
|
91
91
|
return yield this.provider.resolveName(name);
|
92
92
|
});
|
@@ -132,10 +132,10 @@ class Signer {
|
|
132
132
|
// Notes:
|
133
133
|
// - We allow gasPrice for EIP-1559 as long as it matches maxFeePerGas
|
134
134
|
populateTransaction(transaction) {
|
135
|
-
return __awaiter(this,
|
135
|
+
return __awaiter(this, void 0, void 0, function* () {
|
136
136
|
const tx = yield resolveProperties(this.checkTransaction(transaction));
|
137
137
|
if (tx.to != null) {
|
138
|
-
tx.to = Promise.resolve(tx.to).then((to) => __awaiter(this,
|
138
|
+
tx.to = Promise.resolve(tx.to).then((to) => __awaiter(this, void 0, void 0, function* () {
|
139
139
|
if (to == null) {
|
140
140
|
return null;
|
141
141
|
}
|
@@ -21,7 +21,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
|
|
21
21
|
};
|
22
22
|
const logger = new Logger(version);
|
23
23
|
function resolveName(resolver, nameOrPromise) {
|
24
|
-
return __awaiter(this,
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
25
25
|
const name = yield nameOrPromise;
|
26
26
|
if (typeof (name) !== "string") {
|
27
27
|
logger.throwArgumentError("invalid address or ENS name", "name", name);
|
@@ -45,7 +45,7 @@ function resolveName(resolver, nameOrPromise) {
|
|
45
45
|
}
|
46
46
|
// Recursively replaces ENS names with promises to resolve the name and resolves all properties
|
47
47
|
function resolveAddresses(resolver, value, paramType) {
|
48
|
-
return __awaiter(this,
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
49
49
|
if (Array.isArray(paramType)) {
|
50
50
|
return yield Promise.all(paramType.map((paramType, index) => {
|
51
51
|
return resolveAddresses(resolver, ((Array.isArray(value)) ? value[index] : value[paramType.name]), paramType);
|
@@ -70,7 +70,7 @@ function resolveAddresses(resolver, value, paramType) {
|
|
70
70
|
});
|
71
71
|
}
|
72
72
|
function populateTransaction(contract, fragment, args) {
|
73
|
-
return __awaiter(this,
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
74
74
|
// If an extra argument is given, it is overrides
|
75
75
|
let overrides = {};
|
76
76
|
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") {
|
@@ -86,7 +86,7 @@ function populateTransaction(contract, fragment, args) {
|
|
86
86
|
overrides.from = resolveProperties({
|
87
87
|
override: resolveName(contract.signer, overrides.from),
|
88
88
|
signer: contract.signer.getAddress()
|
89
|
-
}).then((check) => __awaiter(this,
|
89
|
+
}).then((check) => __awaiter(this, void 0, void 0, function* () {
|
90
90
|
if (getAddress(check.signer) !== check.override) {
|
91
91
|
logger.throwError("Contract with a Signer cannot override from", Logger.errors.UNSUPPORTED_OPERATION, {
|
92
92
|
operation: "overrides.from"
|
@@ -211,7 +211,7 @@ function buildPopulate(contract, fragment) {
|
|
211
211
|
function buildEstimate(contract, fragment) {
|
212
212
|
const signerOrProvider = (contract.signer || contract.provider);
|
213
213
|
return function (...args) {
|
214
|
-
return __awaiter(this,
|
214
|
+
return __awaiter(this, void 0, void 0, function* () {
|
215
215
|
if (!signerOrProvider) {
|
216
216
|
logger.throwError("estimate require a provider or signer", Logger.errors.UNSUPPORTED_OPERATION, {
|
217
217
|
operation: "estimateGas"
|
@@ -262,7 +262,7 @@ function addContractWait(contract, tx) {
|
|
262
262
|
function buildCall(contract, fragment, collapseSimple) {
|
263
263
|
const signerOrProvider = (contract.signer || contract.provider);
|
264
264
|
return function (...args) {
|
265
|
-
return __awaiter(this,
|
265
|
+
return __awaiter(this, void 0, void 0, function* () {
|
266
266
|
// Extract the "blockTag" override if present
|
267
267
|
let blockTag = undefined;
|
268
268
|
if (args.length === fragment.inputs.length + 1 && typeof (args[args.length - 1]) === "object") {
|
@@ -300,7 +300,7 @@ function buildCall(contract, fragment, collapseSimple) {
|
|
300
300
|
}
|
301
301
|
function buildSend(contract, fragment) {
|
302
302
|
return function (...args) {
|
303
|
-
return __awaiter(this,
|
303
|
+
return __awaiter(this, void 0, void 0, function* () {
|
304
304
|
if (!contract.signer) {
|
305
305
|
logger.throwError("sending a transaction requires a signer", Logger.errors.UNSUPPORTED_OPERATION, {
|
306
306
|
operation: "sendTransaction"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { toUtf8CodePoints } from '../../../strings/lib.esm/utf8.js';
|
2
2
|
import { getData } from './include.js';
|
3
|
-
import {
|
3
|
+
import { read_mapped_map, read_emoji_trie, read_member_array } from './decoder.js';
|
4
4
|
|
5
5
|
/**
|
6
6
|
* MIT License
|
@@ -106,7 +106,7 @@ function consume_emoji_reversed(cps, eaten) {
|
|
106
106
|
let pos = cps.length;
|
107
107
|
while (pos) {
|
108
108
|
let cp = cps[--pos];
|
109
|
-
node = (_a = node.branches.find(x => x.set.has(cp))) === null || _a ===
|
109
|
+
node = (_a = node.branches.find(x => x.set.has(cp))) === null || _a === void 0 ? void 0 : _a.node;
|
110
110
|
if (!node)
|
111
111
|
break;
|
112
112
|
if (node.save) { // remember
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { getAddress } from '../../address/lib.esm/index.js';
|
2
|
-
import {
|
2
|
+
import { hexConcat, isHexString, hexlify, arrayify, hexZeroPad } from '../../bytes/lib.esm/index.js';
|
3
3
|
import { keccak256 } from '../../keccak256/lib.esm/index.js';
|
4
4
|
import { defineReadOnly, deepCopy, shallowCopy } from '../../properties/lib.esm/index.js';
|
5
5
|
import { Logger } from '../../logger/lib.esm/index.js';
|
@@ -350,7 +350,7 @@ class TypedDataEncoder {
|
|
350
350
|
}
|
351
351
|
// Replaces all address types with ENS names with their looked up address
|
352
352
|
static resolveNames(domain, types, value, resolveName) {
|
353
|
-
return __awaiter(this,
|
353
|
+
return __awaiter(this, void 0, void 0, function* () {
|
354
354
|
// Make a copy to isolate it from the object passed in
|
355
355
|
domain = shallowCopy(domain);
|
356
356
|
// Look up all ENS names
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { getDefaultExportFromCjs, commonjsGlobal } from '../../../../../../_virtual/_commonjsHelpers.js';
|
2
2
|
import { __module as sha3$1 } from '../../../../../../_virtual/sha3.js';
|
3
3
|
|
4
4
|
/**
|
@@ -32,7 +32,7 @@ function getStatic(ctor, key) {
|
|
32
32
|
return null;
|
33
33
|
}
|
34
34
|
function resolveProperties(object) {
|
35
|
-
return __awaiter(this,
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
36
36
|
const promises = Object.keys(object).map((key) => {
|
37
37
|
const value = object[key];
|
38
38
|
return Promise.resolve(value).then((v) => ({ key: key, value: v }));
|
@@ -284,7 +284,7 @@ class Resolver {
|
|
284
284
|
return this._supportsEip2544;
|
285
285
|
}
|
286
286
|
_fetch(selector, parameters) {
|
287
|
-
return __awaiter(this,
|
287
|
+
return __awaiter(this, void 0, void 0, function* () {
|
288
288
|
// e.g. keccak256("addr(bytes32,uint256)")
|
289
289
|
const tx = {
|
290
290
|
to: this.address,
|
@@ -319,7 +319,7 @@ class Resolver {
|
|
319
319
|
});
|
320
320
|
}
|
321
321
|
_fetchBytes(selector, parameters) {
|
322
|
-
return __awaiter(this,
|
322
|
+
return __awaiter(this, void 0, void 0, function* () {
|
323
323
|
const result = yield this._fetch(selector, parameters);
|
324
324
|
if (result != null) {
|
325
325
|
return _parseBytes(result, 0);
|
@@ -380,7 +380,7 @@ class Resolver {
|
|
380
380
|
return null;
|
381
381
|
}
|
382
382
|
getAddress(coinType) {
|
383
|
-
return __awaiter(this,
|
383
|
+
return __awaiter(this, void 0, void 0, function* () {
|
384
384
|
if (coinType == null) {
|
385
385
|
coinType = 60;
|
386
386
|
}
|
@@ -421,7 +421,7 @@ class Resolver {
|
|
421
421
|
});
|
422
422
|
}
|
423
423
|
getAvatar() {
|
424
|
-
return __awaiter(this,
|
424
|
+
return __awaiter(this, void 0, void 0, function* () {
|
425
425
|
const linkage = [{ type: "name", content: this.name }];
|
426
426
|
try {
|
427
427
|
// test data for ricmoo.eth
|
@@ -534,7 +534,7 @@ class Resolver {
|
|
534
534
|
});
|
535
535
|
}
|
536
536
|
getContentHash() {
|
537
|
-
return __awaiter(this,
|
537
|
+
return __awaiter(this, void 0, void 0, function* () {
|
538
538
|
// keccak256("contenthash()")
|
539
539
|
const hexBytes = yield this._fetchBytes("0xbc1c58d1");
|
540
540
|
// No contenthash
|
@@ -580,7 +580,7 @@ class Resolver {
|
|
580
580
|
});
|
581
581
|
}
|
582
582
|
getText(key) {
|
583
|
-
return __awaiter(this,
|
583
|
+
return __awaiter(this, void 0, void 0, function* () {
|
584
584
|
// The key encoded as parameter to fetchBytes
|
585
585
|
let keyBytes = toUtf8Bytes(key);
|
586
586
|
// The nodehash consumes the first slot, so the string pointer targets
|
@@ -648,7 +648,7 @@ class BaseProvider extends Provider {
|
|
648
648
|
this._fastQueryDate = 0;
|
649
649
|
}
|
650
650
|
_ready() {
|
651
|
-
return __awaiter(this,
|
651
|
+
return __awaiter(this, void 0, void 0, function* () {
|
652
652
|
if (this._network == null) {
|
653
653
|
let network = null;
|
654
654
|
if (this._networkPromise) {
|
@@ -708,7 +708,7 @@ class BaseProvider extends Provider {
|
|
708
708
|
return getNetwork((network == null) ? "homestead" : network);
|
709
709
|
}
|
710
710
|
ccipReadFetch(tx, calldata, urls) {
|
711
|
-
return __awaiter(this,
|
711
|
+
return __awaiter(this, void 0, void 0, function* () {
|
712
712
|
if (this.disableCcipRead || urls.length === 0) {
|
713
713
|
return null;
|
714
714
|
}
|
@@ -744,7 +744,7 @@ class BaseProvider extends Provider {
|
|
744
744
|
// Fetches the blockNumber, but will reuse any result that is less
|
745
745
|
// than maxAge old or has been requested since the last request
|
746
746
|
_getInternalBlockNumber(maxAge) {
|
747
|
-
return __awaiter(this,
|
747
|
+
return __awaiter(this, void 0, void 0, function* () {
|
748
748
|
yield this._ready();
|
749
749
|
// Allowing stale data up to maxAge old
|
750
750
|
if (maxAge > 0) {
|
@@ -805,7 +805,7 @@ class BaseProvider extends Provider {
|
|
805
805
|
});
|
806
806
|
}
|
807
807
|
poll() {
|
808
|
-
return __awaiter(this,
|
808
|
+
return __awaiter(this, void 0, void 0, function* () {
|
809
809
|
const pollId = nextPollId++;
|
810
810
|
// Track all running promises, so we can trigger a post-poll once they are complete
|
811
811
|
const runners = [];
|
@@ -961,14 +961,14 @@ class BaseProvider extends Provider {
|
|
961
961
|
// This method should query the network if the underlying network
|
962
962
|
// can change, such as when connected to a JSON-RPC backend
|
963
963
|
detectNetwork() {
|
964
|
-
return __awaiter(this,
|
964
|
+
return __awaiter(this, void 0, void 0, function* () {
|
965
965
|
return logger.throwError("provider does not support network detection", Logger.errors.UNSUPPORTED_OPERATION, {
|
966
966
|
operation: "provider.detectNetwork"
|
967
967
|
});
|
968
968
|
});
|
969
969
|
}
|
970
970
|
getNetwork() {
|
971
|
-
return __awaiter(this,
|
971
|
+
return __awaiter(this, void 0, void 0, function* () {
|
972
972
|
const network = yield this._ready();
|
973
973
|
// Make sure we are still connected to the same network; this is
|
974
974
|
// only an external call for backends which can have the underlying
|
@@ -1080,12 +1080,12 @@ class BaseProvider extends Provider {
|
|
1080
1080
|
}
|
1081
1081
|
}
|
1082
1082
|
waitForTransaction(transactionHash, confirmations, timeout) {
|
1083
|
-
return __awaiter(this,
|
1083
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1084
1084
|
return this._waitForTransaction(transactionHash, (confirmations == null) ? 1 : confirmations, timeout || 0, null);
|
1085
1085
|
});
|
1086
1086
|
}
|
1087
1087
|
_waitForTransaction(transactionHash, confirmations, timeout, replaceable) {
|
1088
|
-
return __awaiter(this,
|
1088
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1089
1089
|
const receipt = yield this.getTransactionReceipt(transactionHash);
|
1090
1090
|
// Receipt is already good
|
1091
1091
|
if ((receipt ? receipt.confirmations : 0) >= confirmations) {
|
@@ -1117,7 +1117,7 @@ class BaseProvider extends Provider {
|
|
1117
1117
|
if (replaceable) {
|
1118
1118
|
let lastBlockNumber = replaceable.startBlock;
|
1119
1119
|
let scannedBlock = null;
|
1120
|
-
const replaceHandler = (blockNumber) => __awaiter(this,
|
1120
|
+
const replaceHandler = (blockNumber) => __awaiter(this, void 0, void 0, function* () {
|
1121
1121
|
if (done) {
|
1122
1122
|
return;
|
1123
1123
|
}
|
@@ -1125,7 +1125,7 @@ class BaseProvider extends Provider {
|
|
1125
1125
|
// we will trade off a little bit of latency for more consistent
|
1126
1126
|
// results and fewer JSON-RPC calls
|
1127
1127
|
yield stall(1000);
|
1128
|
-
this.getTransactionCount(replaceable.from).then((nonce) => __awaiter(this,
|
1128
|
+
this.getTransactionCount(replaceable.from).then((nonce) => __awaiter(this, void 0, void 0, function* () {
|
1129
1129
|
if (done) {
|
1130
1130
|
return;
|
1131
1131
|
}
|
@@ -1229,12 +1229,12 @@ class BaseProvider extends Provider {
|
|
1229
1229
|
});
|
1230
1230
|
}
|
1231
1231
|
getBlockNumber() {
|
1232
|
-
return __awaiter(this,
|
1232
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1233
1233
|
return this._getInternalBlockNumber(0);
|
1234
1234
|
});
|
1235
1235
|
}
|
1236
1236
|
getGasPrice() {
|
1237
|
-
return __awaiter(this,
|
1237
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1238
1238
|
yield this.getNetwork();
|
1239
1239
|
const result = yield this.perform("getGasPrice", {});
|
1240
1240
|
try {
|
@@ -1249,7 +1249,7 @@ class BaseProvider extends Provider {
|
|
1249
1249
|
});
|
1250
1250
|
}
|
1251
1251
|
getBalance(addressOrName, blockTag) {
|
1252
|
-
return __awaiter(this,
|
1252
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1253
1253
|
yield this.getNetwork();
|
1254
1254
|
const params = yield resolveProperties({
|
1255
1255
|
address: this._getAddress(addressOrName),
|
@@ -1268,7 +1268,7 @@ class BaseProvider extends Provider {
|
|
1268
1268
|
});
|
1269
1269
|
}
|
1270
1270
|
getTransactionCount(addressOrName, blockTag) {
|
1271
|
-
return __awaiter(this,
|
1271
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1272
1272
|
yield this.getNetwork();
|
1273
1273
|
const params = yield resolveProperties({
|
1274
1274
|
address: this._getAddress(addressOrName),
|
@@ -1287,7 +1287,7 @@ class BaseProvider extends Provider {
|
|
1287
1287
|
});
|
1288
1288
|
}
|
1289
1289
|
getCode(addressOrName, blockTag) {
|
1290
|
-
return __awaiter(this,
|
1290
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1291
1291
|
yield this.getNetwork();
|
1292
1292
|
const params = yield resolveProperties({
|
1293
1293
|
address: this._getAddress(addressOrName),
|
@@ -1306,7 +1306,7 @@ class BaseProvider extends Provider {
|
|
1306
1306
|
});
|
1307
1307
|
}
|
1308
1308
|
getStorageAt(addressOrName, position, blockTag) {
|
1309
|
-
return __awaiter(this,
|
1309
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1310
1310
|
yield this.getNetwork();
|
1311
1311
|
const params = yield resolveProperties({
|
1312
1312
|
address: this._getAddress(addressOrName),
|
@@ -1335,7 +1335,7 @@ class BaseProvider extends Provider {
|
|
1335
1335
|
if (hash != null && tx.hash !== hash) {
|
1336
1336
|
logger.throwError("Transaction hash mismatch from Provider.sendTransaction.", Logger.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });
|
1337
1337
|
}
|
1338
|
-
result.wait = (confirms, timeout) => __awaiter(this,
|
1338
|
+
result.wait = (confirms, timeout) => __awaiter(this, void 0, void 0, function* () {
|
1339
1339
|
if (confirms == null) {
|
1340
1340
|
confirms = 1;
|
1341
1341
|
}
|
@@ -1372,7 +1372,7 @@ class BaseProvider extends Provider {
|
|
1372
1372
|
return result;
|
1373
1373
|
}
|
1374
1374
|
sendTransaction(signedTransaction) {
|
1375
|
-
return __awaiter(this,
|
1375
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1376
1376
|
yield this.getNetwork();
|
1377
1377
|
const hexTx = yield Promise.resolve(signedTransaction).then(t => hexlify(t));
|
1378
1378
|
const tx = this.formatter.transaction(signedTransaction);
|
@@ -1392,7 +1392,7 @@ class BaseProvider extends Provider {
|
|
1392
1392
|
});
|
1393
1393
|
}
|
1394
1394
|
_getTransactionRequest(transaction) {
|
1395
|
-
return __awaiter(this,
|
1395
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1396
1396
|
const values = yield transaction;
|
1397
1397
|
const tx = {};
|
1398
1398
|
["from", "to"].forEach((key) => {
|
@@ -1426,7 +1426,7 @@ class BaseProvider extends Provider {
|
|
1426
1426
|
});
|
1427
1427
|
}
|
1428
1428
|
_getFilter(filter) {
|
1429
|
-
return __awaiter(this,
|
1429
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1430
1430
|
filter = yield filter;
|
1431
1431
|
const result = {};
|
1432
1432
|
if (filter.address != null) {
|
@@ -1448,7 +1448,7 @@ class BaseProvider extends Provider {
|
|
1448
1448
|
});
|
1449
1449
|
}
|
1450
1450
|
_call(transaction, blockTag, attempt) {
|
1451
|
-
return __awaiter(this,
|
1451
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1452
1452
|
if (attempt >= MAX_CCIP_REDIRECTS) {
|
1453
1453
|
logger.throwError("CCIP read exceeded maximum redirections", Logger.errors.SERVER_ERROR, {
|
1454
1454
|
redirects: attempt, transaction
|
@@ -1530,7 +1530,7 @@ class BaseProvider extends Provider {
|
|
1530
1530
|
});
|
1531
1531
|
}
|
1532
1532
|
call(transaction, blockTag) {
|
1533
|
-
return __awaiter(this,
|
1533
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1534
1534
|
yield this.getNetwork();
|
1535
1535
|
const resolved = yield resolveProperties({
|
1536
1536
|
transaction: this._getTransactionRequest(transaction),
|
@@ -1541,7 +1541,7 @@ class BaseProvider extends Provider {
|
|
1541
1541
|
});
|
1542
1542
|
}
|
1543
1543
|
estimateGas(transaction) {
|
1544
|
-
return __awaiter(this,
|
1544
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1545
1545
|
yield this.getNetwork();
|
1546
1546
|
const params = yield resolveProperties({
|
1547
1547
|
transaction: this._getTransactionRequest(transaction)
|
@@ -1559,7 +1559,7 @@ class BaseProvider extends Provider {
|
|
1559
1559
|
});
|
1560
1560
|
}
|
1561
1561
|
_getAddress(addressOrName) {
|
1562
|
-
return __awaiter(this,
|
1562
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1563
1563
|
addressOrName = yield addressOrName;
|
1564
1564
|
if (typeof (addressOrName) !== "string") {
|
1565
1565
|
logger.throwArgumentError("invalid address or ENS name", "name", addressOrName);
|
@@ -1574,7 +1574,7 @@ class BaseProvider extends Provider {
|
|
1574
1574
|
});
|
1575
1575
|
}
|
1576
1576
|
_getBlock(blockHashOrBlockTag, includeTransactions) {
|
1577
|
-
return __awaiter(this,
|
1577
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1578
1578
|
yield this.getNetwork();
|
1579
1579
|
blockHashOrBlockTag = yield blockHashOrBlockTag;
|
1580
1580
|
// If blockTag is a number (not "latest", etc), this is the block number
|
@@ -1596,7 +1596,7 @@ class BaseProvider extends Provider {
|
|
1596
1596
|
logger.throwArgumentError("invalid block hash or block tag", "blockHashOrBlockTag", blockHashOrBlockTag);
|
1597
1597
|
}
|
1598
1598
|
}
|
1599
|
-
return poll(() => __awaiter(this,
|
1599
|
+
return poll(() => __awaiter(this, void 0, void 0, function* () {
|
1600
1600
|
const block = yield this.perform("getBlock", params);
|
1601
1601
|
// Block was not found
|
1602
1602
|
if (block == null) {
|
@@ -1652,11 +1652,11 @@ class BaseProvider extends Provider {
|
|
1652
1652
|
return (this._getBlock(blockHashOrBlockTag, true));
|
1653
1653
|
}
|
1654
1654
|
getTransaction(transactionHash) {
|
1655
|
-
return __awaiter(this,
|
1655
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1656
1656
|
yield this.getNetwork();
|
1657
1657
|
transactionHash = yield transactionHash;
|
1658
1658
|
const params = { transactionHash: this.formatter.hash(transactionHash, true) };
|
1659
|
-
return poll(() => __awaiter(this,
|
1659
|
+
return poll(() => __awaiter(this, void 0, void 0, function* () {
|
1660
1660
|
const result = yield this.perform("getTransaction", params);
|
1661
1661
|
if (result == null) {
|
1662
1662
|
if (this._emitted["t:" + transactionHash] == null) {
|
@@ -1682,11 +1682,11 @@ class BaseProvider extends Provider {
|
|
1682
1682
|
});
|
1683
1683
|
}
|
1684
1684
|
getTransactionReceipt(transactionHash) {
|
1685
|
-
return __awaiter(this,
|
1685
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1686
1686
|
yield this.getNetwork();
|
1687
1687
|
transactionHash = yield transactionHash;
|
1688
1688
|
const params = { transactionHash: this.formatter.hash(transactionHash, true) };
|
1689
|
-
return poll(() => __awaiter(this,
|
1689
|
+
return poll(() => __awaiter(this, void 0, void 0, function* () {
|
1690
1690
|
const result = yield this.perform("getTransactionReceipt", params);
|
1691
1691
|
if (result == null) {
|
1692
1692
|
if (this._emitted["t:" + transactionHash] == null) {
|
@@ -1716,7 +1716,7 @@ class BaseProvider extends Provider {
|
|
1716
1716
|
});
|
1717
1717
|
}
|
1718
1718
|
getLogs(filter) {
|
1719
|
-
return __awaiter(this,
|
1719
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1720
1720
|
yield this.getNetwork();
|
1721
1721
|
const params = yield resolveProperties({ filter: this._getFilter(filter) });
|
1722
1722
|
const logs = yield this.perform("getLogs", params);
|
@@ -1729,13 +1729,13 @@ class BaseProvider extends Provider {
|
|
1729
1729
|
});
|
1730
1730
|
}
|
1731
1731
|
getEtherPrice() {
|
1732
|
-
return __awaiter(this,
|
1732
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1733
1733
|
yield this.getNetwork();
|
1734
1734
|
return this.perform("getEtherPrice", {});
|
1735
1735
|
});
|
1736
1736
|
}
|
1737
1737
|
_getBlockTag(blockTag) {
|
1738
|
-
return __awaiter(this,
|
1738
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1739
1739
|
blockTag = yield blockTag;
|
1740
1740
|
if (typeof (blockTag) === "number" && blockTag < 0) {
|
1741
1741
|
if (blockTag % 1) {
|
@@ -1752,7 +1752,7 @@ class BaseProvider extends Provider {
|
|
1752
1752
|
});
|
1753
1753
|
}
|
1754
1754
|
getResolver(name) {
|
1755
|
-
return __awaiter(this,
|
1755
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1756
1756
|
let currentName = name;
|
1757
1757
|
while (true) {
|
1758
1758
|
if (currentName === "" || currentName === ".") {
|
@@ -1780,7 +1780,7 @@ class BaseProvider extends Provider {
|
|
1780
1780
|
});
|
1781
1781
|
}
|
1782
1782
|
_getResolver(name, operation) {
|
1783
|
-
return __awaiter(this,
|
1783
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1784
1784
|
if (operation == null) {
|
1785
1785
|
operation = "ENS";
|
1786
1786
|
}
|
@@ -1804,7 +1804,7 @@ class BaseProvider extends Provider {
|
|
1804
1804
|
});
|
1805
1805
|
}
|
1806
1806
|
resolveName(name) {
|
1807
|
-
return __awaiter(this,
|
1807
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1808
1808
|
name = yield name;
|
1809
1809
|
// If it is already an address, nothing to resolve
|
1810
1810
|
try {
|
@@ -1828,7 +1828,7 @@ class BaseProvider extends Provider {
|
|
1828
1828
|
});
|
1829
1829
|
}
|
1830
1830
|
lookupAddress(address) {
|
1831
|
-
return __awaiter(this,
|
1831
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1832
1832
|
address = yield address;
|
1833
1833
|
address = this.formatter.address(address);
|
1834
1834
|
const node = address.substring(2).toLowerCase() + ".addr.reverse";
|
@@ -1849,7 +1849,7 @@ class BaseProvider extends Provider {
|
|
1849
1849
|
});
|
1850
1850
|
}
|
1851
1851
|
getAvatar(nameOrAddress) {
|
1852
|
-
return __awaiter(this,
|
1852
|
+
return __awaiter(this, void 0, void 0, function* () {
|
1853
1853
|
let resolver = null;
|
1854
1854
|
if (isHexString(nameOrAddress)) {
|
1855
1855
|
// Address; reverse lookup
|