diff --git a/scripts/replace_hash_sign.sh b/scripts/replace_hash_sign.sh new file mode 100755 index 00000000..58fe300f --- /dev/null +++ b/scripts/replace_hash_sign.sh @@ -0,0 +1,85 @@ +#!/bin/sh + +# This script replaces the private function and property names in a file with a new name +# so that Android devices with browsers that supports old javascript syntax can run the code + +# Check if filename is provided as argument +if [ $# -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +filename="$1" + +# Check if the file exists +if [ ! -f "$filename" ]; then + echo "Error: File '$filename' not found." + exit 1 +fi + +# create an empty array to store the names +functionNames=() +propertyNames=() + +# Read the file line by line and print each line +while IFS= read -r line; do + # " #name(....) {" + if [[ $line =~ ^\ \ \ \ \#.*\{$ ]]; then + # extract the string beween # and (, and remove the rest + name=`echo "${line#*#}" | sed 's/(.*//'` + # add the name to the names array + functionNames+=("$name") + fi + + # " async #name(....) {" + if [[ $line =~ ^\ \ \ \ \async\ #.*\{$ ]]; then + # extract the string beween # and (, and remove the rest + name=`echo "${line#*#}" | sed 's/(.*//'` + # add the name to the names array + functionNames+=("$name") + fi + + # " static async #name(....) {" + if [[ $line =~ ^\ \ \ \ \static\ async\ #.*\{$ ]]; then + # extract the string beween # and (, and remove the rest + name=`echo "${line#*#}" | sed 's/(.*//'` + # add the name to the names array + functionNames+=("$name") + fi + + if [[ $line =~ ^\ \ \ \ \static\ #.*\{$ ]]; then + # extract the string beween # and (, and remove the rest + name=`echo "${line#*#}" | sed 's/(.*//'` + # add the name to the names array + functionNames+=("$name") + fi + + if [[ $line =~ ^\ \ \ \ \#.*\;$ ]]; then + # extract the string beween # and ;, and remove the rest + name=`echo "${line#*#}" | sed 's/;.*//'` + propertyNames+=("$name") + fi +done < "$filename" + +# remove duplicates from the array +functionNames=($(echo "${functionNames[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')) +propertyNames=($(echo "${propertyNames[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')) + +# replace the names in the file +for name in "${functionNames[@]}"; do + echo "Replacing function name: #$name" + before="#$name(" + after="___$name(" + # replace the before string with the after string in the file + sed -i '' "s/$before/$after/g" $filename +done + +for name in "${propertyNames[@]}"; do + echo "Replacing property name: #$name" + before="\ #$name" + after="\ ___$name" + sed -i '' "s/$before/$after/g" $filename + before="\.#$name" + after="\.___$name" + sed -i '' "s/$before/$after/g" $filename +done \ No newline at end of file diff --git a/scripts/update_client_api.sh b/scripts/update_client_api.sh index 3c796764..17b2272b 100755 --- a/scripts/update_client_api.sh +++ b/scripts/update_client_api.sh @@ -44,3 +44,6 @@ if [ -d "$TARGET_DIR" ]; then else echo "Target directory $TARGET_DIR does not exist. File not copied." fi + +# Replace private functions and properties that start with # +${ORIG_DIR}/replace_hash_sign.sh "$TARGET_DIR/v4-native-client.js" diff --git a/v4/integration/cosmos/src/main/assets/v4-native-client.js b/v4/integration/cosmos/src/main/assets/v4-native-client.js index 61c8089a..199b9332 100644 --- a/v4/integration/cosmos/src/main/assets/v4-native-client.js +++ b/v4/integration/cosmos/src/main/assets/v4-native-client.js @@ -11384,7 +11384,7 @@ class SocketWrapper { throw new Error("Socket was closed, so no data can be sent anymore."); } // this exception should be thrown by send() automatically according to - // https://developer.mozilla.org/de/docs/Web/API/WebSocket#send() but it does not work in browsers + // https://developer.mozilla.org/de/docs/Web/API/WebSocket___send() but it does not work in browsers if (this.socket.readyState !== isomorphic_ws_1.default.OPEN) { throw new Error("Websocket is not open"); } @@ -219048,12 +219048,12 @@ function getBuiltinCallException(action, tx, data, abiCoder) { * values into binary data and decoding binary data into JavaScript values. */ class AbiCoder { - #getCoder(param) { + ___getCoder(param) { if (param.isArray()) { - return new array_js_1.ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name); + return new array_js_1.ArrayCoder(this.___getCoder(param.arrayChildren), param.arrayLength, param.name); } if (param.isTuple()) { - return new tuple_js_1.TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name); + return new tuple_js_1.TupleCoder(param.components.map((c) => this.___getCoder(c)), param.name); } switch (param.baseType) { case "address": @@ -219090,7 +219090,7 @@ class AbiCoder { * is by default ``false``. */ getDefaultValue(types) { - const coders = types.map((type) => this.#getCoder(fragments_js_1.ParamType.from(type))); + const coders = types.map((type) => this.___getCoder(fragments_js_1.ParamType.from(type))); const coder = new tuple_js_1.TupleCoder(coders, "_"); return coder.defaultValue(); } @@ -219101,7 +219101,7 @@ class AbiCoder { */ encode(types, values) { (0, index_js_1.assertArgumentCount)(values.length, types.length, "types/values length mismatch"); - const coders = types.map((type) => this.#getCoder(fragments_js_1.ParamType.from(type))); + const coders = types.map((type) => this.___getCoder(fragments_js_1.ParamType.from(type))); const coder = (new tuple_js_1.TupleCoder(coders, "_")); const writer = new abstract_coder_js_1.Writer(); coder.encode(writer, values); @@ -219115,7 +219115,7 @@ class AbiCoder { * padded event data emitted from ``external`` functions. */ decode(types, data, loose) { - const coders = types.map((type) => this.#getCoder(fragments_js_1.ParamType.from(type))); + const coders = types.map((type) => this.___getCoder(fragments_js_1.ParamType.from(type))); const coder = new tuple_js_1.TupleCoder(coders, "_"); return coder.decode(new abstract_coder_js_1.Reader(data, loose)); } @@ -219232,7 +219232,7 @@ function throwError(name, error) { * @_docloc: api/abi */ class Result extends Array { - #names; + ___names; /** * @private */ @@ -219264,7 +219264,7 @@ class Result extends Array { return accum; }, (new Map())); // Remove any key thats not unique - this.#names = Object.freeze(items.map((item, index) => { + this.___names = Object.freeze(items.map((item, index) => { const name = names[index]; if (name != null && nameCounts.get(name) === 1) { return name; @@ -219336,7 +219336,7 @@ class Result extends Array { * any outstanding deferred errors. */ toObject() { - return this.#names.reduce((accum, name, index) => { + return this.___names.reduce((accum, name, index) => { (0, index_js_1.assert)(name != null, "value at index ${ index } unnamed", "UNSUPPORTED_OPERATION", { operation: "toObject()" }); @@ -219375,7 +219375,7 @@ class Result extends Array { const result = [], names = []; for (let i = start; i < end; i++) { result.push(this[i]); - names.push(this.#names[i]); + names.push(this.___names[i]); } return new Result(_guard, result, names); } @@ -219391,7 +219391,7 @@ class Result extends Array { } if (callback.call(thisArg, item, i, this)) { result.push(item); - names.push(this.#names[i]); + names.push(this.___names[i]); } } return new Result(_guard, result, names); @@ -219419,7 +219419,7 @@ class Result extends Array { * accessible by name. */ getValue(name) { - const index = this.#names.indexOf(name); + const index = this.___names.indexOf(name); if (index === -1) { return undefined; } @@ -219513,23 +219513,23 @@ exports.Coder = Coder; */ class Writer { // An array of WordSize lengthed objects to concatenation - #data; - #dataLength; + ___data; + ___dataLength; constructor() { - this.#data = []; - this.#dataLength = 0; + this.___data = []; + this.___dataLength = 0; } get data() { - return (0, index_js_1.concat)(this.#data); + return (0, index_js_1.concat)(this.___data); } - get length() { return this.#dataLength; } - #writeData(data) { - this.#data.push(data); - this.#dataLength += data.length; + get length() { return this.___dataLength; } + ___writeData(data) { + this.___data.push(data); + this.___dataLength += data.length; return data.length; } appendWriter(writer) { - return this.#writeData((0, index_js_1.getBytesCopy)(writer.data)); + return this.___writeData((0, index_js_1.getBytesCopy)(writer.data)); } // Arrayish item; pad on the right to *nearest* WordSize writeBytes(value) { @@ -219538,20 +219538,20 @@ class Writer { if (paddingOffset) { bytes = (0, index_js_1.getBytesCopy)((0, index_js_1.concat)([bytes, Padding.slice(paddingOffset)])); } - return this.#writeData(bytes); + return this.___writeData(bytes); } // Numeric item; pad on the left *to* WordSize writeValue(value) { - return this.#writeData(getValue(value)); + return this.___writeData(getValue(value)); } // Inserts a numeric place-holder, returning a callback that can // be used to asjust the value later writeUpdatableValue() { - const offset = this.#data.length; - this.#data.push(Padding); - this.#dataLength += exports.WordSize; + const offset = this.___data.length; + this.___data.push(Padding); + this.___dataLength += exports.WordSize; return (value) => { - this.#data[offset] = getValue(value); + this.___data[offset] = getValue(value); }; } } @@ -219565,41 +219565,41 @@ class Reader { // to deal with an old Solidity bug, in which event data for // external (not public thoguh) was tightly packed. allowLoose; - #data; - #offset; + ___data; + ___offset; constructor(data, allowLoose) { (0, index_js_1.defineProperties)(this, { allowLoose: !!allowLoose }); - this.#data = (0, index_js_1.getBytesCopy)(data); - this.#offset = 0; - } - get data() { return (0, index_js_1.hexlify)(this.#data); } - get dataLength() { return this.#data.length; } - get consumed() { return this.#offset; } - get bytes() { return new Uint8Array(this.#data); } - #peekBytes(offset, length, loose) { + this.___data = (0, index_js_1.getBytesCopy)(data); + this.___offset = 0; + } + get data() { return (0, index_js_1.hexlify)(this.___data); } + get dataLength() { return this.___data.length; } + get consumed() { return this.___offset; } + get bytes() { return new Uint8Array(this.___data); } + ___peekBytes(offset, length, loose) { let alignedLength = Math.ceil(length / exports.WordSize) * exports.WordSize; - if (this.#offset + alignedLength > this.#data.length) { - if (this.allowLoose && loose && this.#offset + length <= this.#data.length) { + if (this.___offset + alignedLength > this.___data.length) { + if (this.allowLoose && loose && this.___offset + length <= this.___data.length) { alignedLength = length; } else { (0, index_js_1.assert)(false, "data out-of-bounds", "BUFFER_OVERRUN", { - buffer: (0, index_js_1.getBytesCopy)(this.#data), - length: this.#data.length, - offset: this.#offset + alignedLength + buffer: (0, index_js_1.getBytesCopy)(this.___data), + length: this.___data.length, + offset: this.___offset + alignedLength }); } } - return this.#data.slice(this.#offset, this.#offset + alignedLength); + return this.___data.slice(this.___offset, this.___offset + alignedLength); } // Create a sub-reader with the same underlying data, but offset subReader(offset) { - return new Reader(this.#data.slice(this.#offset + offset), this.allowLoose); + return new Reader(this.___data.slice(this.___offset + offset), this.allowLoose); } // Read bytes readBytes(length, loose) { - let bytes = this.#peekBytes(0, length, !!loose); - this.#offset += bytes.length; + let bytes = this.___peekBytes(0, length, !!loose); + this.___offset += bytes.length; // @TODO: Make sure the length..end bytes are all 0? return bytes.slice(0, length); } @@ -220263,18 +220263,18 @@ const regexIdPrefix = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"); const regexId = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"); const regexType = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"); class TokenString { - #offset; - #tokens; - get offset() { return this.#offset; } - get length() { return this.#tokens.length - this.#offset; } + ___offset; + ___tokens; + get offset() { return this.___offset; } + get length() { return this.___tokens.length - this.___offset; } constructor(tokens) { - this.#offset = 0; - this.#tokens = tokens.slice(); + this.___offset = 0; + this.___tokens = tokens.slice(); } - clone() { return new TokenString(this.#tokens); } - reset() { this.#offset = 0; } - #subTokenString(from = 0, to = 0) { - return new TokenString(this.#tokens.slice(from, to).map((t) => { + clone() { return new TokenString(this.___tokens); } + reset() { this.___offset = 0; } + ___subTokenString(from = 0, to = 0) { + return new TokenString(this.___tokens.slice(from, to).map((t) => { return Object.freeze(Object.assign({}, t, { match: (t.match - from), linkBack: (t.linkBack - from), @@ -220303,8 +220303,8 @@ class TokenString { if (top.type !== "OPEN_PAREN") { throw new Error("bad start"); } - const result = this.#subTokenString(this.#offset + 1, top.match + 1); - this.#offset = top.match + 1; + const result = this.___subTokenString(this.___offset + 1, top.match + 1); + this.___offset = top.match + 1; return result; } // Pops and returns the items within "(" ITEM1 "," ITEM2 "," ... ")" @@ -220314,20 +220314,20 @@ class TokenString { throw new Error("bad start"); } const result = []; - while (this.#offset < top.match - 1) { + while (this.___offset < top.match - 1) { const link = this.peek().linkNext; - result.push(this.#subTokenString(this.#offset + 1, link)); - this.#offset = link; + result.push(this.___subTokenString(this.___offset + 1, link)); + this.___offset = link; } - this.#offset = top.match + 1; + this.___offset = top.match + 1; return result; } // Returns the top Token, throwing if out of tokens peek() { - if (this.#offset >= this.#tokens.length) { + if (this.___offset >= this.___tokens.length) { throw new Error("out-of-bounds"); } - return this.#tokens[this.#offset]; + return this.___tokens[this.___offset]; } // Returns the next value, if it is a keyword in `allowed` peekKeyword(allowed) { @@ -220345,13 +220345,13 @@ class TokenString { // Returns the next token; throws if out of tokens pop() { const result = this.peek(); - this.#offset++; + this.___offset++; return result; } toString() { const tokens = []; - for (let i = this.#offset; i < this.#tokens.length; i++) { - const token = this.#tokens[i]; + for (let i = this.___offset; i < this.___tokens.length; i++) { + const token = this.___tokens[i]; tokens.push(`${token.type}:${token.text}`); } return ``; @@ -220746,7 +220746,7 @@ class ParamType { } return process(this.type, value); } - #walkAsync(promises, value, process, setValue) { + ___walkAsync(promises, value, process, setValue) { if (this.isArray()) { if (!Array.isArray(value)) { throw new Error("invalid array value"); @@ -220757,7 +220757,7 @@ class ParamType { const childType = this.arrayChildren; const result = value.slice(); result.forEach((value, index) => { - childType.#walkAsync(promises, value, process, (value) => { + childType.___walkAsync(promises, value, process, (value) => { result[index] = value; }); }); @@ -220789,7 +220789,7 @@ class ParamType { throw new Error("array is wrong length"); } result.forEach((value, index) => { - components[index].#walkAsync(promises, value, process, (value) => { + components[index].___walkAsync(promises, value, process, (value) => { result[index] = value; }); }); @@ -220814,7 +220814,7 @@ class ParamType { async walkAsync(value, process) { const promises = []; const result = [value]; - this.#walkAsync(promises, value, process, (value) => { + this.___walkAsync(promises, value, process, (value) => { result[0] = value; }); if (promises.length) { @@ -221833,11 +221833,11 @@ class Interface { * If receiving ether is supported. */ receive; - #errors; - #events; - #functions; - // #structs: Map; - #abiCoder; + ___errors; + ___events; + ___functions; + // ___structs: Map; + ___abiCoder; /** * Create a new Interface for the %%fragments%%. */ @@ -221849,10 +221849,10 @@ class Interface { else { abi = fragments; } - this.#functions = new Map(); - this.#errors = new Map(); - this.#events = new Map(); - // this.#structs = new Map(); + this.___functions = new Map(); + this.___errors = new Map(); + this.___events = new Map(); + // this.___structs = new Map(); const frags = []; for (const a of abi) { try { @@ -221867,7 +221867,7 @@ class Interface { }); let fallback = null; let receive = false; - this.#abiCoder = this.getAbiCoder(); + this.___abiCoder = this.getAbiCoder(); // Add all fragments by their signature this.fragments.forEach((fragment, index) => { let bucket; @@ -221893,14 +221893,14 @@ class Interface { case "function": //checkNames(fragment, "input", fragment.inputs); //checkNames(fragment, "output", (fragment).outputs); - bucket = this.#functions; + bucket = this.___functions; break; case "event": //checkNames(fragment, "input", fragment.inputs); - bucket = this.#events; + bucket = this.___events; break; case "error": - bucket = this.#errors; + bucket = this.___errors; break; default: return; @@ -221947,11 +221947,11 @@ class Interface { return abi_coder_js_1.AbiCoder.defaultAbiCoder(); } // Find a function definition by any means necessary (unless it is ambiguous) - #getFunction(key, values, forceUnique) { + ___getFunction(key, values, forceUnique) { // Selector if ((0, index_js_3.isHexString)(key)) { const selector = key.toLowerCase(); - for (const fragment of this.#functions.values()) { + for (const fragment of this.___functions.values()) { if (selector === fragment.selector) { return fragment; } @@ -221961,7 +221961,7 @@ class Interface { // It is a bare name, look up the function (will return null if ambiguous) if (key.indexOf("(") === -1) { const matching = []; - for (const [name, fragment] of this.#functions) { + for (const [name, fragment] of this.___functions) { if (name.split("(" /* fix:) */)[0] === key) { matching.push(fragment); } @@ -222024,7 +222024,7 @@ class Interface { return matching[0]; } // Normalize the signature and lookup the function - const result = this.#functions.get(fragments_js_1.FunctionFragment.from(key).format()); + const result = this.___functions.get(fragments_js_1.FunctionFragment.from(key).format()); if (result) { return result; } @@ -222035,7 +222035,7 @@ class Interface { * function name or function signature that belongs to the ABI. */ getFunctionName(key) { - const fragment = this.#getFunction(key, null, false); + const fragment = this.___getFunction(key, null, false); (0, index_js_3.assertArgument)(fragment, "no matching function", "key", key); return fragment.name; } @@ -222047,7 +222047,7 @@ class Interface { * accessing the [[FunctionFragment]] may require refinement. */ hasFunction(key) { - return !!this.#getFunction(key, null, false); + return !!this.___getFunction(key, null, false); } /** * Get the [[FunctionFragment]] for %%key%%, which may be a function @@ -222060,25 +222060,25 @@ class Interface { * the ABI, this will throw. */ getFunction(key, values) { - return this.#getFunction(key, values || null, true); + return this.___getFunction(key, values || null, true); } /** * Iterate over all functions, calling %%callback%%, sorted by their name. */ forEachFunction(callback) { - const names = Array.from(this.#functions.keys()); + const names = Array.from(this.___functions.keys()); names.sort((a, b) => a.localeCompare(b)); for (let i = 0; i < names.length; i++) { const name = names[i]; - callback((this.#functions.get(name)), i); + callback((this.___functions.get(name)), i); } } // Find an event definition by any means necessary (unless it is ambiguous) - #getEvent(key, values, forceUnique) { + ___getEvent(key, values, forceUnique) { // EventTopic if ((0, index_js_3.isHexString)(key)) { const eventTopic = key.toLowerCase(); - for (const fragment of this.#events.values()) { + for (const fragment of this.___events.values()) { if (eventTopic === fragment.topicHash) { return fragment; } @@ -222088,7 +222088,7 @@ class Interface { // It is a bare name, look up the function (will return null if ambiguous) if (key.indexOf("(") === -1) { const matching = []; - for (const [name, fragment] of this.#events) { + for (const [name, fragment] of this.___events) { if (name.split("(" /* fix:) */)[0] === key) { matching.push(fragment); } @@ -222126,7 +222126,7 @@ class Interface { return matching[0]; } // Normalize the signature and lookup the function - const result = this.#events.get(fragments_js_1.EventFragment.from(key).format()); + const result = this.___events.get(fragments_js_1.EventFragment.from(key).format()); if (result) { return result; } @@ -222137,7 +222137,7 @@ class Interface { * event name or event signature that belongs to the ABI. */ getEventName(key) { - const fragment = this.#getEvent(key, null, false); + const fragment = this.___getEvent(key, null, false); (0, index_js_3.assertArgument)(fragment, "no matching event", "key", key); return fragment.name; } @@ -222149,7 +222149,7 @@ class Interface { * accessing the [[EventFragment]] may require refinement. */ hasEvent(key) { - return !!this.#getEvent(key, null, false); + return !!this.___getEvent(key, null, false); } /** * Get the [[EventFragment]] for %%key%%, which may be a topic hash, @@ -222162,17 +222162,17 @@ class Interface { * the ABI, this will throw. */ getEvent(key, values) { - return this.#getEvent(key, values || null, true); + return this.___getEvent(key, values || null, true); } /** * Iterate over all events, calling %%callback%%, sorted by their name. */ forEachEvent(callback) { - const names = Array.from(this.#events.keys()); + const names = Array.from(this.___events.keys()); names.sort((a, b) => a.localeCompare(b)); for (let i = 0; i < names.length; i++) { const name = names[i]; - callback((this.#events.get(name)), i); + callback((this.___events.get(name)), i); } } /** @@ -222191,7 +222191,7 @@ class Interface { if (BuiltinErrors[selector]) { return fragments_js_1.ErrorFragment.from(BuiltinErrors[selector].signature); } - for (const fragment of this.#errors.values()) { + for (const fragment of this.___errors.values()) { if (selector === fragment.selector) { return fragment; } @@ -222201,7 +222201,7 @@ class Interface { // It is a bare name, look up the function (will return null if ambiguous) if (key.indexOf("(") === -1) { const matching = []; - for (const [name, fragment] of this.#errors) { + for (const [name, fragment] of this.___errors) { if (name.split("(" /* fix:) */)[0] === key) { matching.push(fragment); } @@ -222229,7 +222229,7 @@ class Interface { if (key === "Panic(uint256)") { return fragments_js_1.ErrorFragment.from("error Panic(uint256)"); } - const result = this.#errors.get(key); + const result = this.___errors.get(key); if (result) { return result; } @@ -222239,11 +222239,11 @@ class Interface { * Iterate over all errors, calling %%callback%%, sorted by their name. */ forEachError(callback) { - const names = Array.from(this.#errors.keys()); + const names = Array.from(this.___errors.keys()); names.sort((a, b) => a.localeCompare(b)); for (let i = 0; i < names.length; i++) { const name = names[i]; - callback((this.#errors.get(name)), i); + callback((this.___errors.get(name)), i); } } // Get the 4-byte selector used by Solidity to identify a function @@ -222275,10 +222275,10 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string { } */ _decodeParams(params, data) { - return this.#abiCoder.decode(params, data); + return this.___abiCoder.decode(params, data); } _encodeParams(params, values) { - return this.#abiCoder.encode(params, values); + return this.___abiCoder.encode(params, values); } /** * Encodes a ``tx.data`` object for deploying the Contract with @@ -222376,7 +222376,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string { const bytes = (0, index_js_3.getBytesCopy)(data); if ((bytes.length % 32) === 0) { try { - return this.#abiCoder.decode(fragment.outputs, bytes); + return this.___abiCoder.decode(fragment.outputs, bytes); } catch (error) { message = "could not decode result data"; @@ -222398,7 +222398,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string { const ef = this.getError(selector); if (ef) { try { - const args = this.#abiCoder.decode(ef.inputs, data.slice(4)); + const args = this.___abiCoder.decode(ef.inputs, data.slice(4)); error.revert = { name: ef.name, signature: ef.format(), args }; @@ -222435,7 +222435,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string { (0, index_js_3.assertArgument)(f, "unknown function", "fragment", fragment); fragment = f; } - return (0, index_js_3.hexlify)(this.#abiCoder.encode(fragment.outputs, values || [])); + return (0, index_js_3.hexlify)(this.___abiCoder.encode(fragment.outputs, values || [])); } /* spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> { @@ -222498,7 +222498,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string { } else if (param.type === "address") { // Check addresses are valid - this.#abiCoder.encode(["address"], [value]); + this.___abiCoder.encode(["address"], [value]); } return (0, index_js_3.zeroPadValue)((0, index_js_3.hexlify)(value), 32); }; @@ -222554,7 +222554,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string { throw new Error("not implemented"); } else { - topics.push(this.#abiCoder.encode([param.type], [value])); + topics.push(this.___abiCoder.encode([param.type], [value])); } } else { @@ -222563,7 +222563,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string { } }); return { - data: this.#abiCoder.encode(dataTypes, dataValues), + data: this.___abiCoder.encode(dataTypes, dataValues), topics: topics }; } @@ -222598,8 +222598,8 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string { dynamic.push(false); } }); - const resultIndexed = (topics != null) ? this.#abiCoder.decode(indexed, (0, index_js_3.concat)(topics)) : null; - const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true); + const resultIndexed = (topics != null) ? this.___abiCoder.decode(indexed, (0, index_js_3.concat)(topics)) : null; + const resultNonIndexed = this.___abiCoder.decode(nonIndexed, data, true); //const result: (Array & { [ key: string ]: any }) = [ ]; const values = []; const keys = []; @@ -222648,7 +222648,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string { if (!fragment) { return null; } - const args = this.#abiCoder.decode(fragment.inputs, data.slice(4)); + const args = this.___abiCoder.decode(fragment.inputs, data.slice(4)); return new TransactionDescription(fragment, fragment.selector, args, value); } parseCallResult(data) { @@ -222682,7 +222682,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string { if (!fragment) { return null; } - const args = this.#abiCoder.decode(fragment.inputs, (0, index_js_3.dataSlice)(hexData, 4)); + const args = this.___abiCoder.decode(fragment.inputs, (0, index_js_3.dataSlice)(hexData, 4)); return new ErrorDescription(fragment, fragment.selector, args); } /** @@ -222765,7 +222765,7 @@ class Typed { * The actual value. */ value; - #options; + ___options; /** * @_ignore: */ @@ -222779,7 +222779,7 @@ class Typed { } (0, index_js_1.assertPrivate)(_gaurd, gaurd, "Typed"); (0, index_js_1.defineProperties)(this, { _typedSymbol, type, value }); - this.#options = options; + this.___options = options; // Check the value is valid this.format(); } @@ -222841,7 +222841,7 @@ class Typed { if (this.type !== "tuple") { throw TypeError("not a tuple"); } - return this.#options; + return this.___options; } // Returns the length of this type as an array // - `null` indicates the length is unforced, it could be dynamic @@ -222856,10 +222856,10 @@ class Typed { if (this.type !== "array") { throw TypeError("not an array"); } - if (this.#options === true) { + if (this.___options === true) { return -1; } - if (this.#options === false) { + if (this.___options === false) { return (this.value).length; } return null; @@ -223938,7 +223938,7 @@ function getResolver(value) { return undefined; } class PreparedTopicFilter { - #filter; + ___filter; fragment; constructor(contract, fragment, args) { (0, index_js_3.defineProperties)(this, { fragment }); @@ -223948,7 +223948,7 @@ class PreparedTopicFilter { // Recursively descend into args and resolve any addresses const runner = getRunner(contract.runner, "resolveName"); const resolver = canResolve(runner) ? runner : null; - this.#filter = (async function () { + this.___filter = (async function () { const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => { const arg = args[index]; if (arg == null) { @@ -223968,7 +223968,7 @@ class PreparedTopicFilter { })(); } getTopicFilter() { - return this.#filter; + return this.___filter; } } // A = Arguments passed in as a tuple @@ -225096,13 +225096,13 @@ exports.UndecodedEventLog = UndecodedEventLog; * [[TransactionReceipt]]. */ class ContractTransactionReceipt extends provider_js_1.TransactionReceipt { - #iface; + ___iface; /** * @_ignore: */ constructor(iface, provider, tx) { super(tx, provider); - this.#iface = iface; + this.___iface = iface; } /** * The parsed logs for any [[Log]] which has a matching event in the @@ -225110,10 +225110,10 @@ class ContractTransactionReceipt extends provider_js_1.TransactionReceipt { */ get logs() { return super.logs.map((log) => { - const fragment = log.topics.length ? this.#iface.getEvent(log.topics[0]) : null; + const fragment = log.topics.length ? this.___iface.getEvent(log.topics[0]) : null; if (fragment) { try { - return new EventLog(log, this.#iface, fragment); + return new EventLog(log, this.___iface, fragment); } catch (error) { return new UndecodedEventLog(log, error); @@ -225129,13 +225129,13 @@ exports.ContractTransactionReceipt = ContractTransactionReceipt; * [[ContractTransactionReceipt]] when waited on. */ class ContractTransactionResponse extends provider_js_1.TransactionResponse { - #iface; + ___iface; /** * @_ignore: */ constructor(iface, provider, tx) { super(tx, provider); - this.#iface = iface; + this.___iface = iface; } /** * Resolves once this transaction has been mined and has @@ -225151,7 +225151,7 @@ class ContractTransactionResponse extends provider_js_1.TransactionResponse { if (receipt == null) { return null; } - return new ContractTransactionReceipt(this.#iface, this.provider, receipt); + return new ContractTransactionReceipt(this.___iface, this.provider, receipt); } } exports.ContractTransactionResponse = ContractTransactionResponse; @@ -225862,30 +225862,30 @@ function toUint256(value) { * @_docloc: api/crypto:Signing */ class Signature { - #r; - #s; - #v; - #networkV; + ___r; + ___s; + ___v; + ___networkV; /** * The ``r`` value for a signautre. * * This represents the ``x`` coordinate of a "reference" or * challenge point, from which the ``y`` can be computed. */ - get r() { return this.#r; } + get r() { return this.___r; } set r(value) { (0, index_js_2.assertArgument)((0, index_js_2.dataLength)(value) === 32, "invalid r", "value", value); - this.#r = (0, index_js_2.hexlify)(value); + this.___r = (0, index_js_2.hexlify)(value); } /** * The ``s`` value for a signature. */ - get s() { return this.#s; } + get s() { return this.___s; } set s(_value) { (0, index_js_2.assertArgument)((0, index_js_2.dataLength)(_value) === 32, "invalid s", "value", _value); const value = (0, index_js_2.hexlify)(_value); (0, index_js_2.assertArgument)(parseInt(value.substring(0, 3)) < 8, "non-canonical s", "value", value); - this.#s = value; + this.___s = value; } /** * The ``v`` value for a signature. @@ -225897,17 +225897,17 @@ class Signature { * It is normalized to the values ``27`` or ``28`` for legacy * purposes. */ - get v() { return this.#v; } + get v() { return this.___v; } set v(value) { const v = (0, index_js_2.getNumber)(value, "value"); (0, index_js_2.assertArgument)(v === 27 || v === 28, "invalid v", "v", value); - this.#v = v; + this.___v = v; } /** * The EIP-155 ``v`` for legacy transactions. For non-legacy * transactions, this value is ``null``. */ - get networkV() { return this.#networkV; } + get networkV() { return this.___networkV; } /** * The chain ID for EIP-155 legacy transactions. For non-legacy * transactions, this value is ``null``. @@ -225956,10 +225956,10 @@ class Signature { */ constructor(guard, r, s, v) { (0, index_js_2.assertPrivate)(guard, _guard, "Signature"); - this.#r = r; - this.#s = s; - this.#v = v; - this.#networkV = null; + this.___r = r; + this.___s = s; + this.___v = v; + this.___networkV = null; } [Symbol.for('nodejs.util.inspect.custom')]() { return `Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`; @@ -225970,7 +225970,7 @@ class Signature { clone() { const clone = new Signature(_guard, this.r, this.s, this.v); if (this.networkV) { - clone.#networkV = this.networkV; + clone.___networkV = this.networkV; } return clone; } @@ -226134,7 +226134,7 @@ class Signature { })(sig.v, sig.yParityAndS, sig.yParity); const result = new Signature(_guard, r, s, v); if (networkV) { - result.#networkV = networkV; + result.___networkV = networkV; } // If multiple of v, yParity, yParityAndS we given, check they match assertError(sig.yParity == null || (0, index_js_2.getNumber)(sig.yParity, "sig.yParity") === result.yParity, "yParity mismatch"); @@ -226170,25 +226170,25 @@ const signature_js_1 = __webpack_require__(/*! ./signature.js */ "./node_modules * cryptography (ECC) operations and key management. */ class SigningKey { - #privateKey; + ___privateKey; /** * Creates a new **SigningKey** for %%privateKey%%. */ constructor(privateKey) { (0, index_js_1.assertArgument)((0, index_js_1.dataLength)(privateKey) === 32, "invalid private key", "privateKey", "[REDACTED]"); - this.#privateKey = (0, index_js_1.hexlify)(privateKey); + this.___privateKey = (0, index_js_1.hexlify)(privateKey); } /** * The private key. */ - get privateKey() { return this.#privateKey; } + get privateKey() { return this.___privateKey; } /** * The uncompressed public key. * * This will always begin with the prefix ``0x04`` and be 132 * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). */ - get publicKey() { return SigningKey.computePublicKey(this.#privateKey); } + get publicKey() { return SigningKey.computePublicKey(this.___privateKey); } /** * The compressed public key. * @@ -226196,13 +226196,13 @@ class SigningKey { * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal * nibbles) */ - get compressedPublicKey() { return SigningKey.computePublicKey(this.#privateKey, true); } + get compressedPublicKey() { return SigningKey.computePublicKey(this.___privateKey, true); } /** * Return the signature of the signed %%digest%%. */ sign(digest) { (0, index_js_1.assertArgument)((0, index_js_1.dataLength)(digest) === 32, "invalid digest length", "digest", digest); - const sig = secp256k1_1.secp256k1.sign((0, index_js_1.getBytesCopy)(digest), (0, index_js_1.getBytesCopy)(this.#privateKey), { + const sig = secp256k1_1.secp256k1.sign((0, index_js_1.getBytesCopy)(digest), (0, index_js_1.getBytesCopy)(this.___privateKey), { lowS: true }); return signature_js_1.Signature.from({ @@ -226235,7 +226235,7 @@ class SigningKey { */ computeSharedSecret(other) { const pubKey = SigningKey.computePublicKey(other); - return (0, index_js_1.hexlify)(secp256k1_1.secp256k1.getSharedSecret((0, index_js_1.getBytesCopy)(this.#privateKey), (0, index_js_1.getBytes)(pubKey), false)); + return (0, index_js_1.hexlify)(secp256k1_1.secp256k1.getSharedSecret((0, index_js_1.getBytesCopy)(this.___privateKey), (0, index_js_1.getBytes)(pubKey), false)); } /** * Compute the public key for %%key%%, optionally %%compressed%%. @@ -227042,15 +227042,15 @@ class TypedDataEncoder { * no parent nodes. */ primaryType; - #types; + ___types; /** * The types. */ get types() { - return JSON.parse(this.#types); + return JSON.parse(this.___types); } - #fullTypes; - #encoderCache; + ___fullTypes; + ___encoderCache; /** * Create a new **TypedDataEncoder** for %%types%%. * @@ -227059,9 +227059,9 @@ class TypedDataEncoder { * well as computes the [[primaryType]]. */ constructor(types) { - this.#types = JSON.stringify(types); - this.#fullTypes = new Map(); - this.#encoderCache = new Map(); + this.___types = JSON.stringify(types); + this.___fullTypes = new Map(); + this.___encoderCache = new Map(); // Link struct types to their direct child structs const links = new Map(); // Link structs to structs which contain them as a child @@ -227120,21 +227120,21 @@ class TypedDataEncoder { for (const [name, set] of subtypes) { const st = Array.from(set); st.sort(); - this.#fullTypes.set(name, encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join("")); + this.___fullTypes.set(name, encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join("")); } } /** * Returnthe encoder for the specific %%type%%. */ getEncoder(type) { - let encoder = this.#encoderCache.get(type); + let encoder = this.___encoderCache.get(type); if (!encoder) { - encoder = this.#getEncoder(type); - this.#encoderCache.set(type, encoder); + encoder = this.___getEncoder(type); + this.___encoderCache.set(type, encoder); } return encoder; } - #getEncoder(type) { + ___getEncoder(type) { // Basic encoder type (address, bool, uint256, etc) { const encoder = getBaseEncoder(type); @@ -227150,7 +227150,7 @@ class TypedDataEncoder { return (value) => { (0, index_js_4.assertArgument)(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, "value", value); let result = value.map(subEncoder); - if (this.#fullTypes.has(subtype)) { + if (this.___fullTypes.has(subtype)) { result = result.map(index_js_2.keccak256); } return (0, index_js_2.keccak256)((0, index_js_4.concat)(result)); @@ -227159,11 +227159,11 @@ class TypedDataEncoder { // Struct const fields = this.types[type]; if (fields) { - const encodedType = (0, id_js_1.id)(this.#fullTypes.get(type)); + const encodedType = (0, id_js_1.id)(this.___fullTypes.get(type)); return (value) => { const values = fields.map(({ name, type }) => { const result = this.getEncoder(type)(value[name]); - if (this.#fullTypes.has(type)) { + if (this.___fullTypes.has(type)) { return (0, index_js_2.keccak256)(result); } return result; @@ -227178,7 +227178,7 @@ class TypedDataEncoder { * Return the full type for %%name%%. */ encodeType(name) { - const result = this.#fullTypes.get(name); + const result = this.___fullTypes.get(name); (0, index_js_4.assertArgument)(result, `unknown type: ${JSON.stringify(name)}`, "name", name); return result; } @@ -227602,52 +227602,52 @@ const defaultOptions = { * behaviour on an eventually-consistent network. */ class AbstractProvider { - #subs; - #plugins; + ___subs; + ___plugins; // null=unpaused, true=paused+dropWhilePaused, false=paused - #pausedState; - #destroyed; - #networkPromise; - #anyNetwork; - #performCache; + ___pausedState; + ___destroyed; + ___networkPromise; + ___anyNetwork; + ___performCache; // The most recent block number if running an event or -1 if no "block" event - #lastBlockNumber; - #nextTimer; - #timers; - #disableCcipRead; - #options; + ___lastBlockNumber; + ___nextTimer; + ___timers; + ___disableCcipRead; + ___options; /** * Create a new **AbstractProvider** connected to %%network%%, or * use the various network detection capabilities to discover the * [[Network]] if necessary. */ constructor(_network, options) { - this.#options = Object.assign({}, defaultOptions, options || {}); + this.___options = Object.assign({}, defaultOptions, options || {}); if (_network === "any") { - this.#anyNetwork = true; - this.#networkPromise = null; + this.___anyNetwork = true; + this.___networkPromise = null; } else if (_network) { const network = network_js_1.Network.from(_network); - this.#anyNetwork = false; - this.#networkPromise = Promise.resolve(network); + this.___anyNetwork = false; + this.___networkPromise = Promise.resolve(network); setTimeout(() => { this.emit("network", network, null); }, 0); } else { - this.#anyNetwork = false; - this.#networkPromise = null; + this.___anyNetwork = false; + this.___networkPromise = null; } - this.#lastBlockNumber = -1; - this.#performCache = new Map(); - this.#subs = new Map(); - this.#plugins = new Map(); - this.#pausedState = null; - this.#destroyed = false; - this.#nextTimer = 1; - this.#timers = new Map(); - this.#disableCcipRead = false; + this.___lastBlockNumber = -1; + this.___performCache = new Map(); + this.___subs = new Map(); + this.___plugins = new Map(); + this.___pausedState = null; + this.___destroyed = false; + this.___nextTimer = 1; + this.___timers = new Map(); + this.___disableCcipRead = false; } - get pollingInterval() { return this.#options.pollingInterval; } + get pollingInterval() { return this.___options.pollingInterval; } /** * Returns ``this``, to allow an **AbstractProvider** to implement * the [[ContractRunner]] interface. @@ -227657,46 +227657,46 @@ class AbstractProvider { * Returns all the registered plug-ins. */ get plugins() { - return Array.from(this.#plugins.values()); + return Array.from(this.___plugins.values()); } /** * Attach a new plug-in. */ attachPlugin(plugin) { - if (this.#plugins.get(plugin.name)) { + if (this.___plugins.get(plugin.name)) { throw new Error(`cannot replace existing plugin: ${plugin.name} `); } - this.#plugins.set(plugin.name, plugin.connect(this)); + this.___plugins.set(plugin.name, plugin.connect(this)); return this; } /** * Get a plugin by name. */ getPlugin(name) { - return (this.#plugins.get(name)) || null; + return (this.___plugins.get(name)) || null; } /** * Prevent any CCIP-read operation, regardless of whether requested * in a [[call]] using ``enableCcipRead``. */ - get disableCcipRead() { return this.#disableCcipRead; } - set disableCcipRead(value) { this.#disableCcipRead = !!value; } + get disableCcipRead() { return this.___disableCcipRead; } + set disableCcipRead(value) { this.___disableCcipRead = !!value; } // Shares multiple identical requests made during the same 250ms - async #perform(req) { - const timeout = this.#options.cacheTimeout; + async ___perform(req) { + const timeout = this.___options.cacheTimeout; // Caching disabled if (timeout < 0) { return await this._perform(req); } // Create a tag const tag = getTag(req.method, req); - let perform = this.#performCache.get(tag); + let perform = this.___performCache.get(tag); if (!perform) { perform = this._perform(req); - this.#performCache.set(tag, perform); + this.___performCache.set(tag, perform); setTimeout(() => { - if (this.#performCache.get(tag) === perform) { - this.#performCache.delete(tag); + if (this.___performCache.get(tag) === perform) { + this.___performCache.delete(tag); } }, timeout); } @@ -227808,9 +227808,9 @@ class AbstractProvider { } // State async getBlockNumber() { - const blockNumber = (0, index_js_6.getNumber)(await this.#perform({ method: "getBlockNumber" }), "%response"); - if (this.#lastBlockNumber >= 0) { - this.#lastBlockNumber = blockNumber; + const blockNumber = (0, index_js_6.getNumber)(await this.___perform({ method: "getBlockNumber" }), "%response"); + if (this.___lastBlockNumber >= 0) { + this.___lastBlockNumber = blockNumber; } return blockNumber; } @@ -227852,8 +227852,8 @@ class AbstractProvider { if (blockTag >= 0) { return (0, index_js_6.toQuantity)(blockTag); } - if (this.#lastBlockNumber >= 0) { - return (0, index_js_6.toQuantity)(this.#lastBlockNumber + blockTag); + if (this.___lastBlockNumber >= 0) { + return (0, index_js_6.toQuantity)(this.___lastBlockNumber + blockTag); } return this.getBlockNumber().then((b) => (0, index_js_6.toQuantity)(b + blockTag)); } @@ -227978,33 +227978,33 @@ class AbstractProvider { } async getNetwork() { // No explicit network was set and this is our first time - if (this.#networkPromise == null) { + if (this.___networkPromise == null) { // Detect the current network (shared with all calls) const detectNetwork = this._detectNetwork().then((network) => { this.emit("network", network, null); return network; }, (error) => { // Reset the networkPromise on failure, so we will try again - if (this.#networkPromise === detectNetwork) { - this.#networkPromise = null; + if (this.___networkPromise === detectNetwork) { + this.___networkPromise = null; } throw error; }); - this.#networkPromise = detectNetwork; + this.___networkPromise = detectNetwork; return (await detectNetwork).clone(); } - const networkPromise = this.#networkPromise; + const networkPromise = this.___networkPromise; const [expected, actual] = await Promise.all([ networkPromise, this._detectNetwork() // The actual connected network ]); if (expected.chainId !== actual.chainId) { - if (this.#anyNetwork) { + if (this.___anyNetwork) { // The "any" network can change, so notify listeners this.emit("network", actual, expected); // Update the network if something else hasn't already changed it - if (this.#networkPromise === networkPromise) { - this.#networkPromise = Promise.resolve(actual); + if (this.___networkPromise === networkPromise) { + this.___networkPromise = Promise.resolve(actual); } } else { @@ -228020,10 +228020,10 @@ class AbstractProvider { const network = await this.getNetwork(); const getFeeDataFunc = async () => { const { _block, gasPrice } = await (0, index_js_6.resolveProperties)({ - _block: this.#getBlock("latest", false), + _block: this.___getBlock("latest", false), gasPrice: ((async () => { try { - const gasPrice = await this.#perform({ method: "getGasPrice" }); + const gasPrice = await this.___perform({ method: "getGasPrice" }); return (0, index_js_6.getBigInt)(gasPrice, "%response"); } catch (error) { } @@ -228054,11 +228054,11 @@ class AbstractProvider { if (isPromise(tx)) { tx = await tx; } - return (0, index_js_6.getBigInt)(await this.#perform({ + return (0, index_js_6.getBigInt)(await this.___perform({ method: "estimateGas", transaction: tx }), "%response"); } - async #call(tx, blockTag, attempt) { + async ___call(tx, blockTag, attempt) { (0, index_js_6.assert)(attempt < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", { reason: "TOO_MANY_REDIRECTS", transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true }) @@ -228106,7 +228106,7 @@ class AbstractProvider { }; this.emit("debug", { action: "sendCcipReadCall", transaction: tx }); try { - const result = await this.#call(tx, blockTag, attempt + 1); + const result = await this.___call(tx, blockTag, attempt + 1); this.emit("debug", { action: "receiveCcipReadCallResult", transaction: Object.assign({}, tx), result }); return result; } @@ -228118,7 +228118,7 @@ class AbstractProvider { throw error; } } - async #checkNetwork(promise) { + async ___checkNetwork(promise) { const { value } = await (0, index_js_6.resolveProperties)({ network: this.getNetwork(), value: promise @@ -228130,29 +228130,29 @@ class AbstractProvider { tx: this._getTransactionRequest(_tx), blockTag: this._getBlockTag(_tx.blockTag) }); - return await this.#checkNetwork(this.#call(tx, blockTag, _tx.enableCcipRead ? 0 : -1)); + return await this.___checkNetwork(this.___call(tx, blockTag, _tx.enableCcipRead ? 0 : -1)); } // Account - async #getAccountValue(request, _address, _blockTag) { + async ___getAccountValue(request, _address, _blockTag) { let address = this._getAddress(_address); let blockTag = this._getBlockTag(_blockTag); if (typeof (address) !== "string" || typeof (blockTag) !== "string") { [address, blockTag] = await Promise.all([address, blockTag]); } - return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag }))); + return await this.___checkNetwork(this.___perform(Object.assign(request, { address, blockTag }))); } async getBalance(address, blockTag) { - return (0, index_js_6.getBigInt)(await this.#getAccountValue({ method: "getBalance" }, address, blockTag), "%response"); + return (0, index_js_6.getBigInt)(await this.___getAccountValue({ method: "getBalance" }, address, blockTag), "%response"); } async getTransactionCount(address, blockTag) { - return (0, index_js_6.getNumber)(await this.#getAccountValue({ method: "getTransactionCount" }, address, blockTag), "%response"); + return (0, index_js_6.getNumber)(await this.___getAccountValue({ method: "getTransactionCount" }, address, blockTag), "%response"); } async getCode(address, blockTag) { - return (0, index_js_6.hexlify)(await this.#getAccountValue({ method: "getCode" }, address, blockTag)); + return (0, index_js_6.hexlify)(await this.___getAccountValue({ method: "getCode" }, address, blockTag)); } async getStorage(address, _position, blockTag) { const position = (0, index_js_6.getBigInt)(_position, "position"); - return (0, index_js_6.hexlify)(await this.#getAccountValue({ method: "getStorage", position }, address, blockTag)); + return (0, index_js_6.hexlify)(await this.___getAccountValue({ method: "getStorage", position }, address, blockTag)); } // Write async broadcastTransaction(signedTx) { @@ -228170,10 +228170,10 @@ class AbstractProvider { } return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber); } - async #getBlock(block, includeTransactions) { + async ___getBlock(block, includeTransactions) { // @TODO: Add CustomBlockPlugin check if ((0, index_js_6.isHexString)(block, 32)) { - return await this.#perform({ + return await this.___perform({ method: "getBlock", blockHash: block, includeTransactions }); } @@ -228181,7 +228181,7 @@ class AbstractProvider { if (typeof (blockTag) !== "string") { blockTag = await blockTag; } - return await this.#perform({ + return await this.___perform({ method: "getBlock", blockTag, includeTransactions }); } @@ -228189,7 +228189,7 @@ class AbstractProvider { async getBlock(block, prefetchTxs) { const { network, params } = await (0, index_js_6.resolveProperties)({ network: this.getNetwork(), - params: this.#getBlock(block, !!prefetchTxs) + params: this.___getBlock(block, !!prefetchTxs) }); if (params == null) { return null; @@ -228199,7 +228199,7 @@ class AbstractProvider { async getTransaction(hash) { const { network, params } = await (0, index_js_6.resolveProperties)({ network: this.getNetwork(), - params: this.#perform({ method: "getTransaction", hash }) + params: this.___perform({ method: "getTransaction", hash }) }); if (params == null) { return null; @@ -228209,7 +228209,7 @@ class AbstractProvider { async getTransactionReceipt(hash) { const { network, params } = await (0, index_js_6.resolveProperties)({ network: this.getNetwork(), - params: this.#perform({ method: "getTransactionReceipt", hash }) + params: this.___perform({ method: "getTransactionReceipt", hash }) }); if (params == null) { return null; @@ -228217,7 +228217,7 @@ class AbstractProvider { // Some backends did not backfill the effectiveGasPrice into old transactions // in the receipt, so we look it up manually and inject it. if (params.gasPrice == null && params.effectiveGasPrice == null) { - const tx = await this.#perform({ method: "getTransaction", hash }); + const tx = await this.___perform({ method: "getTransaction", hash }); if (tx == null) { throw new Error("report this; could not find tx or effectiveGasPrice"); } @@ -228228,7 +228228,7 @@ class AbstractProvider { async getTransactionResult(hash) { const { result } = await (0, index_js_6.resolveProperties)({ network: this.getNetwork(), - result: this.#perform({ method: "getTransactionResult", hash }) + result: this.___perform({ method: "getTransactionResult", hash }) }); if (result == null) { return null; @@ -228243,7 +228243,7 @@ class AbstractProvider { } const { network, params } = await (0, index_js_6.resolveProperties)({ network: this.getNetwork(), - params: this.#perform({ method: "getLogs", filter }) + params: this.___perform({ method: "getLogs", filter }) }); return params.map((p) => this._wrapLog(p, network)); } @@ -228355,14 +228355,14 @@ class AbstractProvider { * Clear a timer created using the [[_setTimeout]] method. */ _clearTimeout(timerId) { - const timer = this.#timers.get(timerId); + const timer = this.___timers.get(timerId); if (!timer) { return; } if (timer.timer) { clearTimeout(timer.timer); } - this.#timers.delete(timerId); + this.___timers.delete(timerId); } /** * Create a timer that will execute %%func%% after at least %%timeout%% @@ -228376,17 +228376,17 @@ class AbstractProvider { if (timeout == null) { timeout = 0; } - const timerId = this.#nextTimer++; + const timerId = this.___nextTimer++; const func = () => { - this.#timers.delete(timerId); + this.___timers.delete(timerId); _func(); }; if (this.paused) { - this.#timers.set(timerId, { timer: null, func, time: timeout }); + this.___timers.set(timerId, { timer: null, func, time: timeout }); } else { const timer = setTimeout(func, timeout); - this.#timers.set(timerId, { timer, func, time: getTime() }); + this.___timers.set(timerId, { timer, func, time: getTime() }); } return timerId; } @@ -228394,7 +228394,7 @@ class AbstractProvider { * Perform %%func%% on each subscriber. */ _forEachSubscriber(func) { - for (const sub of this.#subs.values()) { + for (const sub of this.___subs.values()) { func(sub.subscriber); } } @@ -228432,7 +228432,7 @@ class AbstractProvider { * to swap in a [[PollingEventSubscriber]]. */ _recoverSubscriber(oldSub, newSub) { - for (const sub of this.#subs.values()) { + for (const sub of this.___subs.values()) { if (sub.subscriber === oldSub) { if (sub.started) { sub.subscriber.stop(); @@ -228441,62 +228441,62 @@ class AbstractProvider { if (sub.started) { newSub.start(); } - if (this.#pausedState != null) { - newSub.pause(this.#pausedState); + if (this.___pausedState != null) { + newSub.pause(this.___pausedState); } break; } } } - async #hasSub(event, emitArgs) { + async ___hasSub(event, emitArgs) { let sub = await getSubscription(event, this); // This is a log that is removing an existing log; we actually want // to emit an orphan event for the removed log if (sub.type === "event" && emitArgs && emitArgs.length > 0 && emitArgs[0].removed === true) { sub = await getSubscription({ orphan: "drop-log", log: emitArgs[0] }, this); } - return this.#subs.get(sub.tag) || null; + return this.___subs.get(sub.tag) || null; } - async #getSub(event) { + async ___getSub(event) { const subscription = await getSubscription(event, this); // Prevent tampering with our tag in any subclass' _getSubscriber const tag = subscription.tag; - let sub = this.#subs.get(tag); + let sub = this.___subs.get(tag); if (!sub) { const subscriber = this._getSubscriber(subscription); const addressableMap = new WeakMap(); const nameMap = new Map(); sub = { subscriber, tag, addressableMap, nameMap, started: false, listeners: [] }; - this.#subs.set(tag, sub); + this.___subs.set(tag, sub); } return sub; } async on(event, listener) { - const sub = await this.#getSub(event); + const sub = await this.___getSub(event); sub.listeners.push({ listener, once: false }); if (!sub.started) { sub.subscriber.start(); sub.started = true; - if (this.#pausedState != null) { - sub.subscriber.pause(this.#pausedState); + if (this.___pausedState != null) { + sub.subscriber.pause(this.___pausedState); } } return this; } async once(event, listener) { - const sub = await this.#getSub(event); + const sub = await this.___getSub(event); sub.listeners.push({ listener, once: true }); if (!sub.started) { sub.subscriber.start(); sub.started = true; - if (this.#pausedState != null) { - sub.subscriber.pause(this.#pausedState); + if (this.___pausedState != null) { + sub.subscriber.pause(this.___pausedState); } } return this; } async emit(event, ...args) { - const sub = await this.#hasSub(event, args); + const sub = await this.___hasSub(event, args); // If there is not subscription or if a recent emit removed // the last of them (which also deleted the sub) do nothing if (!sub || sub.listeners.length === 0) { @@ -228516,40 +228516,40 @@ class AbstractProvider { if (sub.started) { sub.subscriber.stop(); } - this.#subs.delete(sub.tag); + this.___subs.delete(sub.tag); } return (count > 0); } async listenerCount(event) { if (event) { - const sub = await this.#hasSub(event); + const sub = await this.___hasSub(event); if (!sub) { return 0; } return sub.listeners.length; } let total = 0; - for (const { listeners } of this.#subs.values()) { + for (const { listeners } of this.___subs.values()) { total += listeners.length; } return total; } async listeners(event) { if (event) { - const sub = await this.#hasSub(event); + const sub = await this.___hasSub(event); if (!sub) { return []; } return sub.listeners.map(({ listener }) => listener); } let result = []; - for (const { listeners } of this.#subs.values()) { + for (const { listeners } of this.___subs.values()) { result = result.concat(listeners.map(({ listener }) => listener)); } return result; } async off(event, listener) { - const sub = await this.#hasSub(event); + const sub = await this.___hasSub(event); if (!sub) { return this; } @@ -228563,24 +228563,24 @@ class AbstractProvider { if (sub.started) { sub.subscriber.stop(); } - this.#subs.delete(sub.tag); + this.___subs.delete(sub.tag); } return this; } async removeAllListeners(event) { if (event) { - const { tag, started, subscriber } = await this.#getSub(event); + const { tag, started, subscriber } = await this.___getSub(event); if (started) { subscriber.stop(); } - this.#subs.delete(tag); + this.___subs.delete(tag); } else { - for (const [tag, { started, subscriber }] of this.#subs) { + for (const [tag, { started, subscriber }] of this.___subs) { if (started) { subscriber.stop(); } - this.#subs.delete(tag); + this.___subs.delete(tag); } } return this; @@ -228601,7 +228601,7 @@ class AbstractProvider { * the provider. */ get destroyed() { - return this.#destroyed; + return this.___destroyed; } /** * Sub-classes may use this to shutdown any sockets or release their @@ -228613,10 +228613,10 @@ class AbstractProvider { // Stop all listeners this.removeAllListeners(); // Shut down all tiemrs - for (const timerId of this.#timers.keys()) { + for (const timerId of this.___timers.keys()) { this._clearTimeout(timerId); } - this.#destroyed = true; + this.___destroyed = true; } /** * Whether the provider is currently paused. @@ -228629,7 +228629,7 @@ class AbstractProvider { * which will buffer any events that occur while paused until the * provider is unpaused. */ - get paused() { return (this.#pausedState != null); } + get paused() { return (this.___pausedState != null); } set paused(pause) { if (!!pause === this.paused) { return; @@ -228647,9 +228647,9 @@ class AbstractProvider { * the provider is unpaused. */ pause(dropWhilePaused) { - this.#lastBlockNumber = -1; - if (this.#pausedState != null) { - if (this.#pausedState == !!dropWhilePaused) { + this.___lastBlockNumber = -1; + if (this.___pausedState != null) { + if (this.___pausedState == !!dropWhilePaused) { return; } (0, index_js_6.assert)(false, "cannot change pause type; resume first", "UNSUPPORTED_OPERATION", { @@ -228657,8 +228657,8 @@ class AbstractProvider { }); } this._forEachSubscriber((s) => s.pause(dropWhilePaused)); - this.#pausedState = !!dropWhilePaused; - for (const timer of this.#timers.values()) { + this.___pausedState = !!dropWhilePaused; + for (const timer of this.___timers.values()) { // Clear the timer if (timer.timer) { clearTimeout(timer.timer); @@ -228671,12 +228671,12 @@ class AbstractProvider { * Resume the provider. */ resume() { - if (this.#pausedState == null) { + if (this.___pausedState == null) { return; } this._forEachSubscriber((s) => s.resume()); - this.#pausedState = null; - for (const timer of this.#timers.values()) { + this.___pausedState = null; + for (const timer of this.___timers.values()) { // Remaining time when we were paused let timeout = timer.time; if (timeout < 0) { @@ -229041,17 +229041,17 @@ class VoidSigner extends AbstractSigner { connect(provider) { return new VoidSigner(this.address, provider); } - #throwUnsupported(suffix, operation) { + ___throwUnsupported(suffix, operation) { (0, index_js_3.assert)(false, `VoidSigner cannot sign ${suffix}`, "UNSUPPORTED_OPERATION", { operation }); } async signTransaction(tx) { - this.#throwUnsupported("transactions", "signTransaction"); + this.___throwUnsupported("transactions", "signTransaction"); } async signMessage(message) { - this.#throwUnsupported("messages", "signMessage"); + this.___throwUnsupported("messages", "signMessage"); } async signTypedData(domain, types, value) { - this.#throwUnsupported("typed-data", "signTypedData"); + this.___throwUnsupported("typed-data", "signTypedData"); } } exports.VoidSigner = VoidSigner; @@ -229414,12 +229414,12 @@ class EnsResolver { */ name; // For EIP-2544 names, the ancestor that provided the resolver - #supports2544; - #resolver; + ___supports2544; + ___resolver; constructor(provider, address, name) { (0, index_js_5.defineProperties)(this, { provider, address, name }); - this.#supports2544 = null; - this.#resolver = new index_js_3.Contract(address, [ + this.___supports2544 = null; + this.___resolver = new index_js_3.Contract(address, [ "function supportsInterface(bytes4) view returns (bool)", "function resolve(bytes, bytes) view returns (bytes)", "function addr(bytes32) view returns (address)", @@ -229432,10 +229432,10 @@ class EnsResolver { * Resolves to true if the resolver supports wildcard resolution. */ async supportsWildcard() { - if (this.#supports2544 == null) { - this.#supports2544 = (async () => { + if (this.___supports2544 == null) { + this.___supports2544 = (async () => { try { - return await this.#resolver.supportsInterface("0x9061b923"); + return await this.___resolver.supportsInterface("0x9061b923"); } catch (error) { // Wildcard resolvers must understand supportsInterface @@ -229444,16 +229444,16 @@ class EnsResolver { return false; } // Let future attempts try again... - this.#supports2544 = null; + this.___supports2544 = null; throw error; } })(); } - return await this.#supports2544; + return await this.___supports2544; } - async #fetch(funcName, params) { + async ___fetch(funcName, params) { params = (params || []).slice(); - const iface = this.#resolver.interface; + const iface = this.___resolver.interface; // The first parameters is always the nodehash params.unshift((0, index_js_4.namehash)(this.name)); let fragment = null; @@ -229472,7 +229472,7 @@ class EnsResolver { enableCcipRead: true }); try { - const result = await this.#resolver[funcName](...params); + const result = await this.___resolver[funcName](...params); if (fragment) { return iface.decodeFunctionResult(fragment, result)[0]; } @@ -229495,7 +229495,7 @@ class EnsResolver { } if (coinType === 60) { try { - const result = await this.#fetch("addr(bytes32)"); + const result = await this.___fetch("addr(bytes32)"); // No address if (result == null || result === index_js_2.ZeroAddress) { return null; @@ -229512,7 +229512,7 @@ class EnsResolver { // Try decoding its EVM canonical chain as an EVM chain address first if (coinType >= 0 && coinType < 0x80000000) { let ethCoinType = coinType + 0x80000000; - const data = await this.#fetch("addr(bytes32,uint)", [ethCoinType]); + const data = await this.___fetch("addr(bytes32,uint)", [ethCoinType]); if ((0, index_js_5.isHexString)(data, 20)) { return (0, index_js_1.getAddress)(data); } @@ -229531,7 +229531,7 @@ class EnsResolver { return null; } // keccak256("addr(bytes32,uint256") - const data = await this.#fetch("addr(bytes32,uint)", [coinType]); + const data = await this.___fetch("addr(bytes32,uint)", [coinType]); // No address if (data == null || data === "0x") { return null; @@ -229551,7 +229551,7 @@ class EnsResolver { * if unconfigured. */ async getText(key) { - const data = await this.#fetch("text(bytes32,string)", [key]); + const data = await this.___fetch("text(bytes32,string)", [key]); if (data == null || data === "0x") { return null; } @@ -229562,7 +229562,7 @@ class EnsResolver { */ async getContentHash() { // keccak256("contenthash()") - const data = await this.#fetch("contenthash(bytes32)"); + const data = await this.___fetch("contenthash(bytes32)"); // No contenthash if (data == null || data === "0x") { return null; @@ -229755,7 +229755,7 @@ class EnsResolver { }); return ensPlugin.address; } - static async #getResolver(provider, name) { + static async ___getResolver(provider, name) { const ensAddr = await EnsResolver.getEnsAddress(provider); try { const contract = new index_js_3.Contract(ensAddr, [ @@ -229792,7 +229792,7 @@ class EnsResolver { return null; } // Check the current node for a resolver - const addr = await EnsResolver.#getResolver(provider, currentName); + const addr = await EnsResolver.___getResolver(provider, currentName); // Found a resolver! if (addr != null) { const resolver = new EnsResolver(provider, addr, name); @@ -230227,16 +230227,16 @@ const Networks = new Map(); * for plug-ins to extend functionality. */ class Network { - #name; - #chainId; - #plugins; + ___name; + ___chainId; + ___plugins; /** * Creates a new **Network** for %%name%% and %%chainId%%. */ constructor(name, chainId) { - this.#name = name; - this.#chainId = (0, index_js_2.getBigInt)(chainId); - this.#plugins = new Map(); + this.___name = name; + this.___chainId = (0, index_js_2.getBigInt)(chainId); + this.___plugins = new Map(); } /** * Returns a JSON-compatible representation of a Network. @@ -230250,13 +230250,13 @@ class Network { * This is the canonical name, as networks migh have multiple * names. */ - get name() { return this.#name; } - set name(value) { this.#name = value; } + get name() { return this.___name; } + set name(value) { this.___name = value; } /** * The network chain ID. */ - get chainId() { return this.#chainId; } - set chainId(value) { this.#chainId = (0, index_js_2.getBigInt)(value, "chainId"); } + get chainId() { return this.___chainId; } + set chainId(value) { this.___chainId = (0, index_js_2.getBigInt)(value, "chainId"); } /** * Returns true if %%other%% matches this network. Any chain ID * must match, and if no chain ID is present, the name must match. @@ -230301,17 +230301,17 @@ class Network { * Returns the list of plugins currently attached to this Network. */ get plugins() { - return Array.from(this.#plugins.values()); + return Array.from(this.___plugins.values()); } /** * Attach a new %%plugin%% to this Network. The network name * must be unique, excluding any fragment. */ attachPlugin(plugin) { - if (this.#plugins.get(plugin.name)) { + if (this.___plugins.get(plugin.name)) { throw new Error(`cannot replace existing plugin: ${plugin.name} `); } - this.#plugins.set(plugin.name, plugin.clone()); + this.___plugins.set(plugin.name, plugin.clone()); return this; } /** @@ -230320,7 +230320,7 @@ class Network { * a fragment. */ getPlugin(name) { - return (this.#plugins.get(name)) || null; + return (this.___plugins.get(name)) || null; } /** * Gets a list of all plugins that match %%name%%, with otr without @@ -230722,50 +230722,50 @@ exports.EnsPlugin = EnsPlugin; * choose to use a Gas Station site to approximate the gas price. */ class FeeDataNetworkPlugin extends NetworkPlugin { - #feeDataFunc; + ___feeDataFunc; /** * The fee data function provided to the constructor. */ get feeDataFunc() { - return this.#feeDataFunc; + return this.___feeDataFunc; } /** * Creates a new **FeeDataNetworkPlugin**. */ constructor(feeDataFunc) { super("org.ethers.plugins.network.FeeData"); - this.#feeDataFunc = feeDataFunc; + this.___feeDataFunc = feeDataFunc; } /** * Resolves to the fee data. */ async getFeeData(provider) { - return await this.#feeDataFunc(provider); + return await this.___feeDataFunc(provider); } clone() { - return new FeeDataNetworkPlugin(this.#feeDataFunc); + return new FeeDataNetworkPlugin(this.___feeDataFunc); } } exports.FeeDataNetworkPlugin = FeeDataNetworkPlugin; class FetchUrlFeeDataNetworkPlugin extends NetworkPlugin { - #url; - #processFunc; + ___url; + ___processFunc; /** * The URL to initialize the FetchRequest with in %%processFunc%%. */ - get url() { return this.#url; } + get url() { return this.___url; } /** * The callback to use when computing the FeeData. */ - get processFunc() { return this.#processFunc; } + get processFunc() { return this.___processFunc; } /** * Creates a new **FetchUrlFeeDataNetworkPlugin** which will * be used when computing the fee data for the network. */ constructor(url, processFunc) { super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); - this.#url = url; - this.#processFunc = processFunc; + this.___url = url; + this.___processFunc = processFunc; } // We are immutable, so we can serve as our own clone clone() { return this; } @@ -231065,14 +231065,14 @@ const provider_jsonrpc_js_1 = __webpack_require__(/*! ./provider-jsonrpc.js */ " * currently do. */ class BrowserProvider extends provider_jsonrpc_js_1.JsonRpcApiPollingProvider { - #request; + ___request; /** * Connnect to the %%ethereum%% provider, optionally forcing the * %%network%%. */ constructor(ethereum, network) { super(network, { batchMaxCount: 1 }); - this.#request = async (method, params) => { + this.___request = async (method, params) => { const payload = { method, params }; this.emit("debug", { action: "sendEip1193Request", payload }); try { @@ -231097,7 +231097,7 @@ class BrowserProvider extends provider_jsonrpc_js_1.JsonRpcApiPollingProvider { async _send(payload) { (0, index_js_1.assertArgument)(!Array.isArray(payload), "EIP-1193 does not support batch request", "payload", payload); try { - const result = await this.#request(payload.method, payload.params || []); + const result = await this.___request(payload.method, payload.params || []); return [{ id: payload.id, result }]; } catch (e) { @@ -231142,7 +231142,7 @@ class BrowserProvider extends provider_jsonrpc_js_1.JsonRpcApiPollingProvider { if (!(await this.hasSigner(address))) { try { //const resp = - await this.#request("eth_requestAccounts", []); + await this.___request("eth_requestAccounts", []); //console.log("RESP", resp); } catch (error) { @@ -231281,7 +231281,7 @@ class EtherscanProvider extends abstract_provider_js_1.AbstractProvider { * The API key or null if using the community provided bandwidth. */ apiKey; - #plugin; + ___plugin; /** * Creates a new **EtherscanBaseProvider**. */ @@ -231289,7 +231289,7 @@ class EtherscanProvider extends abstract_provider_js_1.AbstractProvider { const apiKey = (_apiKey != null) ? _apiKey : null; super(); const network = network_js_1.Network.from(_network); - this.#plugin = network.getPlugin(EtherscanPluginId); + this.___plugin = network.getPlugin(EtherscanPluginId); (0, index_js_4.defineProperties)(this, { apiKey, network }); // Test that the network is supported by Etherscan this.getBaseUrl(); @@ -231302,8 +231302,8 @@ class EtherscanProvider extends abstract_provider_js_1.AbstractProvider { * baseUrl. */ getBaseUrl() { - if (this.#plugin) { - return this.#plugin.baseUrl; + if (this.___plugin) { + return this.___plugin.baseUrl; } switch (this.network.name) { case "mainnet": @@ -231961,9 +231961,9 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider { * @_ignore: */ eventWorkers; - #configs; - #height; - #initialSyncPromise; + ___configs; + ___height; + ___initialSyncPromise; /** * Creates a new **FallbackProvider** with %%providers%% connected to * %%network%%. @@ -231973,7 +231973,7 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider { */ constructor(providers, network, options) { super(network, options); - this.#configs = providers.map((p) => { + this.___configs = providers.map((p) => { if (p instanceof abstract_provider_js_1.AbstractProvider) { return Object.assign({ provider: p }, defaultConfig, defaultState); } @@ -231981,23 +231981,23 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider { return Object.assign({}, defaultConfig, p, defaultState); } }); - this.#height = -2; - this.#initialSyncPromise = null; + this.___height = -2; + this.___initialSyncPromise = null; if (options && options.quorum != null) { this.quorum = options.quorum; } else { - this.quorum = Math.ceil(this.#configs.reduce((accum, config) => { + this.quorum = Math.ceil(this.___configs.reduce((accum, config) => { accum += config.weight; return accum; }, 0) / 2); } this.eventQuorum = 1; this.eventWorkers = 1; - (0, index_js_1.assertArgument)(this.quorum <= this.#configs.reduce((a, c) => (a + c.weight), 0), "quorum exceed provider wieght", "quorum", this.quorum); + (0, index_js_1.assertArgument)(this.quorum <= this.___configs.reduce((a, c) => (a + c.weight), 0), "quorum exceed provider wieght", "quorum", this.quorum); } get providerConfigs() { - return this.#configs.map((c) => { + return this.___configs.map((c) => { const result = Object.assign({}, c); for (const key in result) { if (key[0] === "_") { @@ -232055,13 +232055,13 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider { } // Grab the next (random) config that is not already part of // the running set - #getNextConfig(running) { + ___getNextConfig(running) { // @TODO: Maybe do a check here to favour (heavily) providers that // do not require waitForSync and disfavour providers that // seem down-ish or are behaving slowly const configs = Array.from(running).map((r) => r.config); // Shuffle the states, sorted by priority - const allConfigs = this.#configs.slice(); + const allConfigs = this.___configs.slice(); shuffle(allConfigs); allConfigs.sort((a, b) => (a.priority - b.priority)); for (const config of allConfigs) { @@ -232075,8 +232075,8 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider { return null; } // Adds a new runner (if available) to running. - #addRunner(running, req) { - const config = this.#getNextConfig(running); + ___addRunner(running, req) { + const config = this.___getNextConfig(running); // No runners available if (config == null) { return null; @@ -232114,11 +232114,11 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider { } // Initializes the blockNumber and network for each runner and // blocks until initialized - async #initialSync() { - let initialSync = this.#initialSyncPromise; + async ___initialSync() { + let initialSync = this.___initialSyncPromise; if (!initialSync) { const promises = []; - this.#configs.forEach((config) => { + this.___configs.forEach((config) => { promises.push((async () => { await waitForSync(config, 0); if (!config._lastFatalError) { @@ -232126,12 +232126,12 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider { } })()); }); - this.#initialSyncPromise = initialSync = (async () => { + this.___initialSyncPromise = initialSync = (async () => { // Wait for all providers to have a block number and network await Promise.all(promises); // Check all the networks match let chainId = null; - for (const config of this.#configs) { + for (const config of this.___configs) { if (config._lastFatalError) { continue; } @@ -232149,7 +232149,7 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider { } await initialSync; } - async #checkQuorum(running, req) { + async ___checkQuorum(running, req) { // Get all the result objects const results = []; for (const runner of running) { @@ -232165,8 +232165,8 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider { switch (req.method) { case "getBlockNumber": { // We need to get the bootstrap block height - if (this.#height === -2) { - this.#height = Math.ceil((0, index_js_1.getNumber)(getMedian(this.quorum, this.#configs.filter((c) => (!c._lastFatalError)).map((c) => ({ + if (this.___height === -2) { + this.___height = Math.ceil((0, index_js_1.getNumber)(getMedian(this.quorum, this.___configs.filter((c) => (!c._lastFatalError)).map((c) => ({ value: c.blockNumber, tag: (0, index_js_1.getNumber)(c.blockNumber).toString(), weight: c.weight @@ -232178,10 +232178,10 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider { if (mode === undefined) { return undefined; } - if (mode > this.#height) { - this.#height = mode; + if (mode > this.___height) { + this.___height = mode; } - return this.#height; + return this.___height; } case "getGasPrice": case "estimateGas": @@ -232210,7 +232210,7 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider { operation: `_perform(${stringify(req.method)})` }); } - async #waitForQuorum(running, req) { + async ___waitForQuorum(running, req) { if (running.size === 0) { throw new Error("no runners?!"); } @@ -232237,7 +232237,7 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider { newRunners++; } // Check if we have reached quorum on a result (or error) - const value = await this.#checkQuorum(running, req); + const value = await this.___checkQuorum(running, req); if (value !== undefined) { if (value instanceof Error) { throw value; @@ -232247,7 +232247,7 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider { // Add any new runners, because a staller timed out or a result // or error response came in. for (let i = 0; i < newRunners; i++) { - this.#addRunner(running, req); + this.___addRunner(running, req); } // All providers have returned, and we have no result (0, index_js_1.assert)(interesting.length > 0, "quorum not met", "SERVER_ERROR", { @@ -232258,14 +232258,14 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider { await Promise.race(interesting); // This is recursive, but at worst case the depth is 2x the // number of providers (each has a perform and a staller) - return await this.#waitForQuorum(running, req); + return await this.___waitForQuorum(running, req); } async _perform(req) { // Broadcasting a transaction is rare (ish) and already incurs // a cost on the user, so spamming is safe-ish. Just send it to // every backend. if (req.method === "broadcastTransaction") { - const results = await Promise.all(this.#configs.map(async ({ provider, weight }) => { + const results = await Promise.all(this.___configs.map(async ({ provider, weight }) => { try { const result = await provider._perform(req); return Object.assign(normalizeResult({ result }), { weight }); @@ -232284,13 +232284,13 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider { } return result; } - await this.#initialSync(); + await this.___initialSync(); // Bootstrap enough runners to meet quorum const running = new Set(); for (let i = 0; i < this.quorum; i++) { - this.#addRunner(running, req); + this.___addRunner(running, req); } - const result = await this.#waitForQuorum(running, req); + const result = await this.___waitForQuorum(running, req); // Track requests sent to a provider that are still // outstanding after quorum has been otherwise found for (const runner of running) { @@ -232301,7 +232301,7 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider { return result; } async destroy() { - for (const { provider } of this.#configs) { + for (const { provider } of this.___configs) { provider.destroy(); } super.destroy(); @@ -232730,34 +232730,34 @@ exports.JsonRpcSigner = JsonRpcSigner; * - a sub-class MUST call the `_start()` method once connected */ class JsonRpcApiProvider extends abstract_provider_js_1.AbstractProvider { - #options; + ___options; // The next ID to use for the JSON-RPC ID field - #nextId; + ___nextId; // Payloads are queued and triggered in batches using the drainTimer - #payloads; - #drainTimer; - #notReady; - #network; - #scheduleDrain() { - if (this.#drainTimer) { + ___payloads; + ___drainTimer; + ___notReady; + ___network; + ___scheduleDrain() { + if (this.___drainTimer) { return; } // If we aren't using batching, no hard in sending it immeidately const stallTime = (this._getOption("batchMaxCount") === 1) ? 0 : this._getOption("batchStallTime"); - this.#drainTimer = setTimeout(() => { - this.#drainTimer = null; - const payloads = this.#payloads; - this.#payloads = []; + this.___drainTimer = setTimeout(() => { + this.___drainTimer = null; + const payloads = this.___payloads; + this.___payloads = []; while (payloads.length) { // Create payload batches that satisfy our batch constraints const batch = [(payloads.shift())]; while (payloads.length) { - if (batch.length === this.#options.batchMaxCount) { + if (batch.length === this.___options.batchMaxCount) { break; } batch.push((payloads.shift())); const bytes = JSON.stringify(batch.map((p) => p.payload)); - if (bytes.length > this.#options.batchMaxSize) { + if (bytes.length > this.___options.batchMaxSize) { payloads.unshift((batch.pop())); break; } @@ -232808,23 +232808,23 @@ class JsonRpcApiProvider extends abstract_provider_js_1.AbstractProvider { } constructor(network, options) { super(network, options); - this.#nextId = 1; - this.#options = Object.assign({}, defaultOptions, options || {}); - this.#payloads = []; - this.#drainTimer = null; - this.#network = null; + this.___nextId = 1; + this.___options = Object.assign({}, defaultOptions, options || {}); + this.___payloads = []; + this.___drainTimer = null; + this.___network = null; { let resolve = null; const promise = new Promise((_resolve) => { resolve = _resolve; }); - this.#notReady = { promise, resolve }; + this.___notReady = { promise, resolve }; } // Make sure any static network is compatbile with the provided netwrok const staticNetwork = this._getOption("staticNetwork"); if (staticNetwork) { (0, index_js_5.assertArgument)(network == null || staticNetwork.matches(network), "staticNetwork MUST match network object", "options", options); - this.#network = staticNetwork; + this.___network = staticNetwork; } } /** @@ -232833,15 +232833,15 @@ class JsonRpcApiProvider extends abstract_provider_js_1.AbstractProvider { * Sub-classes can use this to inquire about configuration options. */ _getOption(key) { - return this.#options[key]; + return this.___options[key]; } /** * Gets the [[Network]] this provider has committed to. On each call, the network * is detected, and if it has changed, the call will reject. */ get _network() { - (0, index_js_5.assert)(this.#network, "network is not available yet", "NETWORK_ERROR"); - return this.#network; + (0, index_js_5.assert)(this.___network, "network is not available yet", "NETWORK_ERROR"); + return this.___network; } /** * Resolves to the non-normalized value by performing %%req%%. @@ -232891,7 +232891,7 @@ class JsonRpcApiProvider extends abstract_provider_js_1.AbstractProvider { } // We are not ready yet; use the primitive _send const payload = { - id: this.#nextId++, method: "eth_chainId", params: [], jsonrpc: "2.0" + id: this.___nextId++, method: "eth_chainId", params: [], jsonrpc: "2.0" }; this.emit("debug", { action: "sendRpcPayload", payload }); let result; @@ -232916,16 +232916,16 @@ class JsonRpcApiProvider extends abstract_provider_js_1.AbstractProvider { * Calling it multiple times is safe and has no effect. */ _start() { - if (this.#notReady == null || this.#notReady.resolve == null) { + if (this.___notReady == null || this.___notReady.resolve == null) { return; } - this.#notReady.resolve(); - this.#notReady = null; + this.___notReady.resolve(); + this.___notReady = null; (async () => { // Bootstrap the network - while (this.#network == null && !this.destroyed) { + while (this.___network == null && !this.destroyed) { try { - this.#network = await this._detectNetwork(); + this.___network = await this._detectNetwork(); } catch (error) { if (this.destroyed) { @@ -232937,7 +232937,7 @@ class JsonRpcApiProvider extends abstract_provider_js_1.AbstractProvider { } } // Start dispatching requests - this.#scheduleDrain(); + this.___scheduleDrain(); })(); } /** @@ -232946,10 +232946,10 @@ class JsonRpcApiProvider extends abstract_provider_js_1.AbstractProvider { * established. */ async _waitUntilReady() { - if (this.#notReady == null) { + if (this.___notReady == null) { return; } - return await this.#notReady.promise; + return await this.___notReady.promise; } /** * Return a Subscriber that will manage the %%sub%%. @@ -232978,7 +232978,7 @@ class JsonRpcApiProvider extends abstract_provider_js_1.AbstractProvider { /** * Returns true only if the [[_start]] has been called. */ - get ready() { return this.#notReady == null; } + get ready() { return this.___notReady == null; } /** * Returns %%tx%% as a normalized JSON-RPC transaction request, * which has all values hexlified and any numeric values converted @@ -233194,15 +233194,15 @@ class JsonRpcApiProvider extends abstract_provider_js_1.AbstractProvider { if (this.destroyed) { return Promise.reject((0, index_js_5.makeError)("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: method })); } - const id = this.#nextId++; + const id = this.___nextId++; const promise = new Promise((resolve, reject) => { - this.#payloads.push({ + this.___payloads.push({ resolve, reject, payload: { method, params, id, jsonrpc: "2.0" } }); }); // If there is not a pending drainTimer, set one - this.#scheduleDrain(); + this.___scheduleDrain(); return promise; } /** @@ -233249,15 +233249,15 @@ class JsonRpcApiProvider extends abstract_provider_js_1.AbstractProvider { } destroy() { // Stop processing requests - if (this.#drainTimer) { - clearTimeout(this.#drainTimer); - this.#drainTimer = null; + if (this.___drainTimer) { + clearTimeout(this.___drainTimer); + this.___drainTimer = null; } // Cancel all pending requests - for (const { payload, reject } of this.#payloads) { + for (const { payload, reject } of this.___payloads) { reject((0, index_js_5.makeError)("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload.method })); } - this.#payloads = []; + this.___payloads = []; // Parent clean-up super.destroy(); } @@ -233270,30 +233270,30 @@ exports.JsonRpcApiProvider = JsonRpcApiProvider; * @_ignore: */ class JsonRpcApiPollingProvider extends JsonRpcApiProvider { - #pollingInterval; + ___pollingInterval; constructor(network, options) { super(network, options); - this.#pollingInterval = 4000; + this.___pollingInterval = 4000; } _getSubscriber(sub) { const subscriber = super._getSubscriber(sub); if (isPollable(subscriber)) { - subscriber.pollingInterval = this.#pollingInterval; + subscriber.pollingInterval = this.___pollingInterval; } return subscriber; } /** * The polling interval (default: 4000 ms) */ - get pollingInterval() { return this.#pollingInterval; } + get pollingInterval() { return this.___pollingInterval; } set pollingInterval(value) { if (!Number.isInteger(value) || value < 0) { throw new Error("invalid interval"); } - this.#pollingInterval = value; + this.___pollingInterval = value; this._forEachSubscriber((sub) => { if (isPollable(sub)) { - sub.pollingInterval = this.#pollingInterval; + sub.pollingInterval = this.___pollingInterval; } }); } @@ -233308,21 +233308,21 @@ exports.JsonRpcApiPollingProvider = JsonRpcApiPollingProvider; * for updates. */ class JsonRpcProvider extends JsonRpcApiPollingProvider { - #connect; + ___connect; constructor(url, network, options) { if (url == null) { url = "http:/\/localhost:8545"; } super(network, options); if (typeof (url) === "string") { - this.#connect = new index_js_5.FetchRequest(url); + this.___connect = new index_js_5.FetchRequest(url); } else { - this.#connect = url.clone(); + this.___connect = url.clone(); } } _getConnection() { - return this.#connect.clone(); + return this.___connect.clone(); } async send(method, params) { // All requests are over HTTP, so we can just start handling requests @@ -233670,68 +233670,68 @@ const provider_jsonrpc_js_1 = __webpack_require__(/*! ./provider-jsonrpc.js */ " * should use [[_emit]] to manage the events. */ class SocketSubscriber { - #provider; - #filter; + ___provider; + ___filter; /** * The filter. */ - get filter() { return JSON.parse(this.#filter); } - #filterId; - #paused; - #emitPromise; + get filter() { return JSON.parse(this.___filter); } + ___filterId; + ___paused; + ___emitPromise; /** * Creates a new **SocketSubscriber** attached to %%provider%% listening * to %%filter%%. */ constructor(provider, filter) { - this.#provider = provider; - this.#filter = JSON.stringify(filter); - this.#filterId = null; - this.#paused = null; - this.#emitPromise = null; + this.___provider = provider; + this.___filter = JSON.stringify(filter); + this.___filterId = null; + this.___paused = null; + this.___emitPromise = null; } start() { - this.#filterId = this.#provider.send("eth_subscribe", this.filter).then((filterId) => { + this.___filterId = this.___provider.send("eth_subscribe", this.filter).then((filterId) => { ; - this.#provider._register(filterId, this); + this.___provider._register(filterId, this); return filterId; }); } stop() { - (this.#filterId).then((filterId) => { - this.#provider.send("eth_unsubscribe", [filterId]); + (this.___filterId).then((filterId) => { + this.___provider.send("eth_unsubscribe", [filterId]); }); - this.#filterId = null; + this.___filterId = null; } // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs // and resume pause(dropWhilePaused) { (0, index_js_1.assert)(dropWhilePaused, "preserve logs while paused not supported by SocketSubscriber yet", "UNSUPPORTED_OPERATION", { operation: "pause(false)" }); - this.#paused = !!dropWhilePaused; + this.___paused = !!dropWhilePaused; } resume() { - this.#paused = null; + this.___paused = null; } /** * @_ignore: */ _handleMessage(message) { - if (this.#filterId == null) { + if (this.___filterId == null) { return; } - if (this.#paused === null) { - let emitPromise = this.#emitPromise; + if (this.___paused === null) { + let emitPromise = this.___emitPromise; if (emitPromise == null) { - emitPromise = this._emit(this.#provider, message); + emitPromise = this._emit(this.___provider, message); } else { emitPromise = emitPromise.then(async () => { - await this._emit(this.#provider, message); + await this._emit(this.___provider, message); }); } - this.#emitPromise = emitPromise.then(() => { - if (this.#emitPromise === emitPromise) { - this.#emitPromise = null; + this.___emitPromise = emitPromise.then(() => { + if (this.___emitPromise === emitPromise) { + this.___emitPromise = null; } }); } @@ -233781,17 +233781,17 @@ exports.SocketPendingSubscriber = SocketPendingSubscriber; * A **SocketEventSubscriber** listens for event logs. */ class SocketEventSubscriber extends SocketSubscriber { - #logFilter; + ___logFilter; /** * The filter. */ - get logFilter() { return JSON.parse(this.#logFilter); } + get logFilter() { return JSON.parse(this.___logFilter); } /** * @_ignore: */ constructor(provider, filter) { super(provider, ["logs", filter]); - this.#logFilter = JSON.stringify(filter); + this.___logFilter = JSON.stringify(filter); } async _emit(provider, message) { provider.emit(this.logFilter, provider._wrapLog(message, provider._network)); @@ -233804,12 +233804,12 @@ exports.SocketEventSubscriber = SocketEventSubscriber; * its communication channel. */ class SocketProvider extends provider_jsonrpc_js_1.JsonRpcApiProvider { - #callbacks; + ___callbacks; // Maps each filterId to its subscriber - #subs; + ___subs; // If any events come in before a subscriber has finished // registering, queue them - #pending; + ___pending; /** * Creates a new **SocketProvider** connected to %%network%%. * @@ -233817,17 +233817,17 @@ class SocketProvider extends provider_jsonrpc_js_1.JsonRpcApiProvider { */ constructor(network) { super(network, { batchMaxCount: 1 }); - this.#callbacks = new Map(); - this.#subs = new Map(); - this.#pending = new Map(); + this.___callbacks = new Map(); + this.___subs = new Map(); + this.___pending = new Map(); } // This value is only valid after _start has been called /* get _network(): Network { - if (this.#network == null) { + if (this.___network == null) { throw new Error("this shouldn't happen"); } - return this.#network.clone(); + return this.___network.clone(); } */ _getSubscriber(sub) { @@ -233854,13 +233854,13 @@ class SocketProvider extends provider_jsonrpc_js_1.JsonRpcApiProvider { * and generally is unecessary unless extending capabilities. */ _register(filterId, subscriber) { - this.#subs.set(filterId, subscriber); - const pending = this.#pending.get(filterId); + this.___subs.set(filterId, subscriber); + const pending = this.___pending.get(filterId); if (pending) { for (const message of pending) { subscriber._handleMessage(message); } - this.#pending.delete(filterId); + this.___pending.delete(filterId); } } async _send(payload) { @@ -233869,7 +233869,7 @@ class SocketProvider extends provider_jsonrpc_js_1.JsonRpcApiProvider { // @TODO: stringify payloads here and store to prevent mutations // Prepare a promise to respond to const promise = new Promise((resolve, reject) => { - this.#callbacks.set(payload.id, { payload, resolve, reject }); + this.___callbacks.set(payload.id, { payload, resolve, reject }); }); // Wait until the socket is connected before writing to it await this._waitUntilReady(); @@ -233880,13 +233880,13 @@ class SocketProvider extends provider_jsonrpc_js_1.JsonRpcApiProvider { // Sub-classes must call this once they are connected /* async _start(): Promise { - if (this.#ready) { return; } + if (this.___ready) { return; } - for (const { payload } of this.#callbacks.values()) { + for (const { payload } of this.___callbacks.values()) { await this._write(JSON.stringify(payload)); } - this.#ready = (async function() { + this.___ready = (async function() { await super._start(); })(); } @@ -233898,7 +233898,7 @@ class SocketProvider extends provider_jsonrpc_js_1.JsonRpcApiProvider { async _processMessage(message) { const result = (JSON.parse(message)); if (result && typeof (result) === "object" && "id" in result) { - const callback = this.#callbacks.get(result.id); + const callback = this.___callbacks.get(result.id); if (callback == null) { this.emit("error", (0, index_js_1.makeError)("received result for unknown id", "UNKNOWN_ERROR", { reasonCode: "UNKNOWN_ID", @@ -233906,20 +233906,20 @@ class SocketProvider extends provider_jsonrpc_js_1.JsonRpcApiProvider { })); return; } - this.#callbacks.delete(result.id); + this.___callbacks.delete(result.id); callback.resolve(result); } else if (result && result.method === "eth_subscription") { const filterId = result.params.subscription; - const subscriber = this.#subs.get(filterId); + const subscriber = this.___subs.get(filterId); if (subscriber) { subscriber._handleMessage(result.params.result); } else { - let pending = this.#pending.get(filterId); + let pending = this.___pending.get(filterId); if (pending == null) { pending = []; - this.#pending.set(filterId, pending); + this.___pending.set(filterId, pending); } pending.push(result.params.result); } @@ -233968,27 +233968,27 @@ const provider_socket_js_1 = __webpack_require__(/*! ./provider-socket.js */ "./ * third-party services charge additional fees for WebSocket endpoints. */ class WebSocketProvider extends provider_socket_js_1.SocketProvider { - #connect; - #websocket; + ___connect; + ___websocket; get websocket() { - if (this.#websocket == null) { + if (this.___websocket == null) { throw new Error("websocket closed"); } - return this.#websocket; + return this.___websocket; } constructor(url, network) { super(network); if (typeof (url) === "string") { - this.#connect = () => { return new ws_js_1.WebSocket(url); }; - this.#websocket = this.#connect(); + this.___connect = () => { return new ws_js_1.WebSocket(url); }; + this.___websocket = this.___connect(); } else if (typeof (url) === "function") { - this.#connect = url; - this.#websocket = url(); + this.___connect = url; + this.___websocket = url(); } else { - this.#connect = null; - this.#websocket = url; + this.___connect = null; + this.___websocket = url; } this.websocket.onopen = async () => { try { @@ -234009,9 +234009,9 @@ class WebSocketProvider extends provider_socket_js_1.SocketProvider { const reconnect = false; if (reconnect) { this.pause(true); - if (this.#connect) { - this.#websocket = this.#connect(); - this.#websocket.onopen = ... + if (this.___connect) { + this.___websocket = this.___connect(); + this.___websocket.onopen = ... // @TODO: this requires the super class to rebroadcast; move it there } this._reconnect(); @@ -234023,9 +234023,9 @@ class WebSocketProvider extends provider_socket_js_1.SocketProvider { this.websocket.send(message); } async destroy() { - if (this.#websocket != null) { - this.#websocket.close(); - this.#websocket = null; + if (this.___websocket != null) { + this.___websocket.close(); + this.___websocket = null; } super.destroy(); } @@ -234239,7 +234239,7 @@ class Block { * is. */ baseFeePerGas; - #transactions; + ___transactions; /** * Create a new **Block** object. * @@ -234247,7 +234247,7 @@ class Block { * low-level library. */ constructor(block, provider) { - this.#transactions = block.transactions.map((tx) => { + this.___transactions = block.transactions.map((tx) => { if (typeof (tx) !== "string") { return new TransactionResponse(tx, provider); } @@ -234273,7 +234273,7 @@ class Block { * they were executed within the block. */ get transactions() { - return this.#transactions.map((tx) => { + return this.___transactions.map((tx) => { if (typeof (tx) === "string") { return tx; } @@ -234289,7 +234289,7 @@ class Block { * into [[Provider-getBlock]]. */ get prefetchedTransactions() { - const txs = this.#transactions.slice(); + const txs = this.___transactions.slice(); // Doesn't matter... if (txs.length === 0) { return []; @@ -234333,7 +234333,7 @@ class Block { /** * The number of transactions in this block. */ - get length() { return this.#transactions.length; } + get length() { return this.___transactions.length; } /** * The [[link-js-date]] this block was included at. */ @@ -234350,11 +234350,11 @@ class Block { // Find the internal value by its index or hash let tx = undefined; if (typeof (indexOrHash) === "number") { - tx = this.#transactions[indexOrHash]; + tx = this.___transactions[indexOrHash]; } else { const hash = indexOrHash.toLowerCase(); - for (const v of this.#transactions) { + for (const v of this.___transactions) { if (typeof (v) === "string") { if (v !== hash) { continue; @@ -234653,12 +234653,12 @@ class TransactionReceipt { * could be used to validate certain parts of the receipt. */ root; - #logs; + ___logs; /** * @_ignore: */ constructor(tx, provider) { - this.#logs = Object.freeze(tx.logs.map((log) => { + this.___logs = Object.freeze(tx.logs.map((log) => { return new Log(log, provider); })); let gasPrice = BN_0; @@ -234690,7 +234690,7 @@ class TransactionReceipt { /** * The logs for this transaction. */ - get logs() { return this.#logs; } + get logs() { return this.___logs; } /** * Returns a JSON-compatible representation. */ @@ -234896,7 +234896,7 @@ class TransactionResponse { * support it, otherwise ``null``. */ accessList; - #startBlock; + ___startBlock; /** * @_ignore: */ @@ -234919,7 +234919,7 @@ class TransactionResponse { this.chainId = tx.chainId; this.signature = tx.signature; this.accessList = (tx.accessList != null) ? tx.accessList : null; - this.#startBlock = -1; + this.___startBlock = -1; } /** * Returns a JSON-compatible representation of this transaction. @@ -235000,7 +235000,7 @@ class TransactionResponse { async wait(_confirms, _timeout) { const confirms = (_confirms == null) ? 1 : _confirms; const timeout = (_timeout == null) ? 0 : _timeout; - let startBlock = this.#startBlock; + let startBlock = this.___startBlock; let nextScan = -1; let stopScanning = (startBlock === -1) ? true : false; const checkReplacement = async () => { @@ -235030,8 +235030,8 @@ class TransactionResponse { // Starting to scan; look back a few extra blocks for safety if (nextScan === -1) { nextScan = startBlock - 3; - if (nextScan < this.#startBlock) { - nextScan = this.#startBlock; + if (nextScan < this.___startBlock) { + nextScan = this.___startBlock; } } while (nextScan <= blockNumber) { @@ -235246,7 +235246,7 @@ class TransactionResponse { replaceableTransaction(startBlock) { (0, index_js_1.assertArgument)(Number.isInteger(startBlock) && startBlock >= 0, "invalid startBlock", "startBlock", startBlock); const tx = new TransactionResponse(this, this.provider); - tx.#startBlock = startBlock; + tx.___startBlock = startBlock; return tx; } } @@ -235297,16 +235297,16 @@ class NonceManager extends abstract_signer_js_1.AbstractSigner { * The Signer being managed. */ signer; - #noncePromise; - #delta; + ___noncePromise; + ___delta; /** * Creates a new **NonceManager** to manage %%signer%%. */ constructor(signer) { super(signer.provider); (0, index_js_1.defineProperties)(this, { signer }); - this.#noncePromise = null; - this.#delta = 0; + this.___noncePromise = null; + this.___delta = 0; } async getAddress() { return this.signer.getAddress(); @@ -235316,11 +235316,11 @@ class NonceManager extends abstract_signer_js_1.AbstractSigner { } async getNonce(blockTag) { if (blockTag === "pending") { - if (this.#noncePromise == null) { - this.#noncePromise = super.getNonce("pending"); + if (this.___noncePromise == null) { + this.___noncePromise = super.getNonce("pending"); } - const delta = this.#delta; - return (await this.#noncePromise) + delta; + const delta = this.___delta; + return (await this.___noncePromise) + delta; } return super.getNonce(blockTag); } @@ -235329,15 +235329,15 @@ class NonceManager extends abstract_signer_js_1.AbstractSigner { * offline transactions. */ increment() { - this.#delta++; + this.___delta++; } /** * Resets the nonce, causing the **NonceManager** to reload the current * nonce from the blockchain on the next transaction. */ reset() { - this.#delta = 0; - this.#noncePromise = null; + this.___delta = 0; + this.___noncePromise = null; } async sendTransaction(tx) { const noncePromise = this.getNonce("pending"); @@ -235389,24 +235389,24 @@ function copy(obj) { * @_docloc: api/providers/abstract-provider */ class FilterIdSubscriber { - #provider; - #filterIdPromise; - #poller; - #running; - #network; - #hault; + ___provider; + ___filterIdPromise; + ___poller; + ___running; + ___network; + ___hault; /** * Creates a new **FilterIdSubscriber** which will used [[_subscribe]] * and [[_emitResults]] to setup the subscription and provide the event * to the %%provider%%. */ constructor(provider) { - this.#provider = provider; - this.#filterIdPromise = null; - this.#poller = this.#poll.bind(this); - this.#running = false; - this.#network = null; - this.#hault = false; + this.___provider = provider; + this.___filterIdPromise = null; + this.___poller = this.___poll.bind(this); + this.___running = false; + this.___network = null; + this.___hault = false; } /** * Sub-classes **must** override this to begin the subscription. @@ -235426,16 +235426,16 @@ class FilterIdSubscriber { _recover(provider) { throw new Error("subclasses must override this"); } - async #poll(blockNumber) { + async ___poll(blockNumber) { try { // Subscribe if necessary - if (this.#filterIdPromise == null) { - this.#filterIdPromise = this._subscribe(this.#provider); + if (this.___filterIdPromise == null) { + this.___filterIdPromise = this._subscribe(this.___provider); } // Get the Filter ID let filterId = null; try { - filterId = await this.#filterIdPromise; + filterId = await this.___filterIdPromise; } catch (error) { if (!(0, index_js_1.isError)(error, "UNSUPPORTED_OPERATION") || error.operation !== "eth_newFilter") { @@ -235445,58 +235445,58 @@ class FilterIdSubscriber { // The backend does not support Filter ID; downgrade to // polling if (filterId == null) { - this.#filterIdPromise = null; - this.#provider._recoverSubscriber(this, this._recover(this.#provider)); + this.___filterIdPromise = null; + this.___provider._recoverSubscriber(this, this._recover(this.___provider)); return; } - const network = await this.#provider.getNetwork(); - if (!this.#network) { - this.#network = network; + const network = await this.___provider.getNetwork(); + if (!this.___network) { + this.___network = network; } - if (this.#network.chainId !== network.chainId) { + if (this.___network.chainId !== network.chainId) { throw new Error("chaid changed"); } - if (this.#hault) { + if (this.___hault) { return; } - const result = await this.#provider.send("eth_getFilterChanges", [filterId]); - await this._emitResults(this.#provider, result); + const result = await this.___provider.send("eth_getFilterChanges", [filterId]); + await this._emitResults(this.___provider, result); } catch (error) { console.log("@TODO", error); } - this.#provider.once("block", this.#poller); + this.___provider.once("block", this.___poller); } - #teardown() { - const filterIdPromise = this.#filterIdPromise; + ___teardown() { + const filterIdPromise = this.___filterIdPromise; if (filterIdPromise) { - this.#filterIdPromise = null; + this.___filterIdPromise = null; filterIdPromise.then((filterId) => { - this.#provider.send("eth_uninstallFilter", [filterId]); + this.___provider.send("eth_uninstallFilter", [filterId]); }); } } start() { - if (this.#running) { + if (this.___running) { return; } - this.#running = true; - this.#poll(-2); + this.___running = true; + this.___poll(-2); } stop() { - if (!this.#running) { + if (!this.___running) { return; } - this.#running = false; - this.#hault = true; - this.#teardown(); - this.#provider.off("block", this.#poller); + this.___running = false; + this.___hault = true; + this.___teardown(); + this.___provider.off("block", this.___poller); } pause(dropWhilePaused) { if (dropWhilePaused) { - this.#teardown(); + this.___teardown(); } - this.#provider.off("block", this.#poller); + this.___provider.off("block", this.___poller); } resume() { this.start(); } } @@ -235507,25 +235507,25 @@ exports.FilterIdSubscriber = FilterIdSubscriber; * @_docloc: api/providers/abstract-provider */ class FilterIdEventSubscriber extends FilterIdSubscriber { - #event; + ___event; /** * Creates a new **FilterIdEventSubscriber** attached to %%provider%% * listening for %%filter%%. */ constructor(provider, filter) { super(provider); - this.#event = copy(filter); + this.___event = copy(filter); } _recover(provider) { - return new subscriber_polling_js_1.PollingEventSubscriber(provider, this.#event); + return new subscriber_polling_js_1.PollingEventSubscriber(provider, this.___event); } async _subscribe(provider) { - const filterId = await provider.send("eth_newFilter", [this.#event]); + const filterId = await provider.send("eth_newFilter", [this.___event]); return filterId; } async _emitResults(provider, results) { for (const result of results) { - provider.emit(this.#event, provider._wrapLog(result, provider._network)); + provider.emit(this.___event, provider._wrapLog(result, provider._network)); } } } @@ -235589,44 +235589,44 @@ exports.getPollingSubscriber = getPollingSubscriber; * @_docloc: api/providers/abstract-provider */ class PollingBlockSubscriber { - #provider; - #poller; - #interval; + ___provider; + ___poller; + ___interval; // The most recent block we have scanned for events. The value -2 // indicates we still need to fetch an initial block number - #blockNumber; + ___blockNumber; /** * Create a new **PollingBlockSubscriber** attached to %%provider%%. */ constructor(provider) { - this.#provider = provider; - this.#poller = null; - this.#interval = 4000; - this.#blockNumber = -2; + this.___provider = provider; + this.___poller = null; + this.___interval = 4000; + this.___blockNumber = -2; } /** * The polling interval. */ - get pollingInterval() { return this.#interval; } - set pollingInterval(value) { this.#interval = value; } - async #poll() { + get pollingInterval() { return this.___interval; } + set pollingInterval(value) { this.___interval = value; } + async ___poll() { try { - const blockNumber = await this.#provider.getBlockNumber(); + const blockNumber = await this.___provider.getBlockNumber(); // Bootstrap poll to setup our initial block number - if (this.#blockNumber === -2) { - this.#blockNumber = blockNumber; + if (this.___blockNumber === -2) { + this.___blockNumber = blockNumber; return; } // @TODO: Put a cap on the maximum number of events per loop? - if (blockNumber !== this.#blockNumber) { - for (let b = this.#blockNumber + 1; b <= blockNumber; b++) { + if (blockNumber !== this.___blockNumber) { + for (let b = this.___blockNumber + 1; b <= blockNumber; b++) { // We have been stopped - if (this.#poller == null) { + if (this.___poller == null) { return; } - await this.#provider.emit("block", b); + await this.___provider.emit("block", b); } - this.#blockNumber = blockNumber; + this.___blockNumber = blockNumber; } } catch (error) { @@ -235635,29 +235635,29 @@ class PollingBlockSubscriber { //console.log(error); } // We have been stopped - if (this.#poller == null) { + if (this.___poller == null) { return; } - this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); + this.___poller = this.___provider._setTimeout(this.___poll.bind(this), this.___interval); } start() { - if (this.#poller) { + if (this.___poller) { return; } - this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval); - this.#poll(); + this.___poller = this.___provider._setTimeout(this.___poll.bind(this), this.___interval); + this.___poll(); } stop() { - if (!this.#poller) { + if (!this.___poller) { return; } - this.#provider._clearTimeout(this.#poller); - this.#poller = null; + this.___provider._clearTimeout(this.___poller); + this.___poller = null; } pause(dropWhilePaused) { this.stop(); if (dropWhilePaused) { - this.#blockNumber = -2; + this.___blockNumber = -2; } } resume() { @@ -235672,17 +235672,17 @@ exports.PollingBlockSubscriber = PollingBlockSubscriber; * @_docloc: api/providers/abstract-provider */ class OnBlockSubscriber { - #provider; - #poll; - #running; + ___provider; + ___poll; + ___running; /** * Create a new **OnBlockSubscriber** attached to %%provider%%. */ constructor(provider) { - this.#provider = provider; - this.#running = false; - this.#poll = (blockNumber) => { - this._poll(blockNumber, this.#provider); + this.___provider = provider; + this.___running = false; + this.___poll = (blockNumber) => { + this._poll(blockNumber, this.___provider); }; } /** @@ -235692,19 +235692,19 @@ class OnBlockSubscriber { throw new Error("sub-classes must override this"); } start() { - if (this.#running) { + if (this.___running) { return; } - this.#running = true; - this.#poll(-2); - this.#provider.on("block", this.#poll); + this.___running = true; + this.___poll(-2); + this.___provider.on("block", this.___poll); } stop() { - if (!this.#running) { + if (!this.___running) { return; } - this.#running = false; - this.#provider.off("block", this.#poll); + this.___running = false; + this.___provider.off("block", this.___poll); } pause(dropWhilePaused) { this.stop(); } resume() { this.start(); } @@ -235716,14 +235716,14 @@ exports.OnBlockSubscriber = OnBlockSubscriber; * @_docloc: api/providers/abstract-provider */ class PollingOrphanSubscriber extends OnBlockSubscriber { - #filter; + ___filter; constructor(provider, filter) { super(provider); - this.#filter = copy(filter); + this.___filter = copy(filter); } async _poll(blockNumber, provider) { throw new Error("@TODO"); - console.log(this.#filter); + console.log(this.___filter); } } exports.PollingOrphanSubscriber = PollingOrphanSubscriber; @@ -235734,19 +235734,19 @@ exports.PollingOrphanSubscriber = PollingOrphanSubscriber; * @_docloc: api/providers/abstract-provider */ class PollingTransactionSubscriber extends OnBlockSubscriber { - #hash; + ___hash; /** * Create a new **PollingTransactionSubscriber** attached to * %%provider%%, listening for %%hash%%. */ constructor(provider, hash) { super(provider); - this.#hash = hash; + this.___hash = hash; } async _poll(blockNumber, provider) { - const tx = await provider.getTransactionReceipt(this.#hash); + const tx = await provider.getTransactionReceipt(this.___hash); if (tx) { - provider.emit(this.#hash, tx); + provider.emit(this.___hash, tx); } } } @@ -235757,72 +235757,72 @@ exports.PollingTransactionSubscriber = PollingTransactionSubscriber; * @_docloc: api/providers/abstract-provider */ class PollingEventSubscriber { - #provider; - #filter; - #poller; - #running; + ___provider; + ___filter; + ___poller; + ___running; // The most recent block we have scanned for events. The value -2 // indicates we still need to fetch an initial block number - #blockNumber; + ___blockNumber; /** * Create a new **PollingTransactionSubscriber** attached to * %%provider%%, listening for %%filter%%. */ constructor(provider, filter) { - this.#provider = provider; - this.#filter = copy(filter); - this.#poller = this.#poll.bind(this); - this.#running = false; - this.#blockNumber = -2; + this.___provider = provider; + this.___filter = copy(filter); + this.___poller = this.___poll.bind(this); + this.___running = false; + this.___blockNumber = -2; } - async #poll(blockNumber) { + async ___poll(blockNumber) { // The initial block hasn't been determined yet - if (this.#blockNumber === -2) { + if (this.___blockNumber === -2) { return; } - const filter = copy(this.#filter); - filter.fromBlock = this.#blockNumber + 1; + const filter = copy(this.___filter); + filter.fromBlock = this.___blockNumber + 1; filter.toBlock = blockNumber; - const logs = await this.#provider.getLogs(filter); + const logs = await this.___provider.getLogs(filter); // No logs could just mean the node has not indexed them yet, // so we keep a sliding window of 60 blocks to keep scanning if (logs.length === 0) { - if (this.#blockNumber < blockNumber - 60) { - this.#blockNumber = blockNumber - 60; + if (this.___blockNumber < blockNumber - 60) { + this.___blockNumber = blockNumber - 60; } return; } for (const log of logs) { - this.#provider.emit(this.#filter, log); + this.___provider.emit(this.___filter, log); // Only advance the block number when logs were found to // account for networks (like BNB and Polygon) which may // sacrifice event consistency for block event speed - this.#blockNumber = log.blockNumber; + this.___blockNumber = log.blockNumber; } } start() { - if (this.#running) { + if (this.___running) { return; } - this.#running = true; - if (this.#blockNumber === -2) { - this.#provider.getBlockNumber().then((blockNumber) => { - this.#blockNumber = blockNumber; + this.___running = true; + if (this.___blockNumber === -2) { + this.___provider.getBlockNumber().then((blockNumber) => { + this.___blockNumber = blockNumber; }); } - this.#provider.on("block", this.#poller); + this.___provider.on("block", this.___poller); } stop() { - if (!this.#running) { + if (!this.___running) { return; } - this.#running = false; - this.#provider.off("block", this.#poller); + this.___running = false; + this.___provider.off("block", this.___poller); } pause(dropWhilePaused) { this.stop(); if (dropWhilePaused) { - this.#blockNumber = -2; + this.___blockNumber = -2; } } resume() { @@ -236247,43 +236247,43 @@ function _serializeEip2930(tx, sig) { * //_result: */ class Transaction { - #type; - #to; - #data; - #nonce; - #gasLimit; - #gasPrice; - #maxPriorityFeePerGas; - #maxFeePerGas; - #value; - #chainId; - #sig; - #accessList; + ___type; + ___to; + ___data; + ___nonce; + ___gasLimit; + ___gasPrice; + ___maxPriorityFeePerGas; + ___maxFeePerGas; + ___value; + ___chainId; + ___sig; + ___accessList; /** * The transaction type. * * If null, the type will be automatically inferred based on * explicit properties. */ - get type() { return this.#type; } + get type() { return this.___type; } set type(value) { switch (value) { case null: - this.#type = null; + this.___type = null; break; case 0: case "legacy": - this.#type = 0; + this.___type = 0; break; case 1: case "berlin": case "eip-2930": - this.#type = 1; + this.___type = 1; break; case 2: case "london": case "eip-1559": - this.#type = 2; + this.___type = 2; break; default: (0, index_js_3.assertArgument)(false, "unsupported transaction type", "type", value); @@ -236304,20 +236304,20 @@ class Transaction { * The ``to`` address for the transaction or ``null`` if the * transaction is an ``init`` transaction. */ - get to() { return this.#to; } + get to() { return this.___to; } set to(value) { - this.#to = (value == null) ? null : (0, index_js_1.getAddress)(value); + this.___to = (value == null) ? null : (0, index_js_1.getAddress)(value); } /** * The transaction nonce. */ - get nonce() { return this.#nonce; } - set nonce(value) { this.#nonce = (0, index_js_3.getNumber)(value, "value"); } + get nonce() { return this.___nonce; } + set nonce(value) { this.___nonce = (0, index_js_3.getNumber)(value, "value"); } /** * The gas limit. */ - get gasLimit() { return this.#gasLimit; } - set gasLimit(value) { this.#gasLimit = (0, index_js_3.getBigInt)(value); } + get gasLimit() { return this.___gasLimit; } + set gasLimit(value) { this.___gasLimit = (0, index_js_3.getBigInt)(value); } /** * The gas price. * @@ -236325,21 +236325,21 @@ class Transaction { * EIP-1559 networks, this should be ``null``. */ get gasPrice() { - const value = this.#gasPrice; + const value = this.___gasPrice; if (value == null && (this.type === 0 || this.type === 1)) { return BN_0; } return value; } set gasPrice(value) { - this.#gasPrice = (value == null) ? null : (0, index_js_3.getBigInt)(value, "gasPrice"); + this.___gasPrice = (value == null) ? null : (0, index_js_3.getBigInt)(value, "gasPrice"); } /** * The maximum priority fee per unit of gas to pay. On legacy * networks this should be ``null``. */ get maxPriorityFeePerGas() { - const value = this.#maxPriorityFeePerGas; + const value = this.___maxPriorityFeePerGas; if (value == null) { if (this.type === 2) { return BN_0; @@ -236349,14 +236349,14 @@ class Transaction { return value; } set maxPriorityFeePerGas(value) { - this.#maxPriorityFeePerGas = (value == null) ? null : (0, index_js_3.getBigInt)(value, "maxPriorityFeePerGas"); + this.___maxPriorityFeePerGas = (value == null) ? null : (0, index_js_3.getBigInt)(value, "maxPriorityFeePerGas"); } /** * The maximum total fee per unit of gas to pay. On legacy * networks this should be ``null``. */ get maxFeePerGas() { - const value = this.#maxFeePerGas; + const value = this.___maxFeePerGas; if (value == null) { if (this.type === 2) { return BN_0; @@ -236366,32 +236366,32 @@ class Transaction { return value; } set maxFeePerGas(value) { - this.#maxFeePerGas = (value == null) ? null : (0, index_js_3.getBigInt)(value, "maxFeePerGas"); + this.___maxFeePerGas = (value == null) ? null : (0, index_js_3.getBigInt)(value, "maxFeePerGas"); } /** * The transaction data. For ``init`` transactions this is the * deployment code. */ - get data() { return this.#data; } - set data(value) { this.#data = (0, index_js_3.hexlify)(value); } + get data() { return this.___data; } + set data(value) { this.___data = (0, index_js_3.hexlify)(value); } /** * The amount of ether (in wei) to send in this transactions. */ - get value() { return this.#value; } + get value() { return this.___value; } set value(value) { - this.#value = (0, index_js_3.getBigInt)(value, "value"); + this.___value = (0, index_js_3.getBigInt)(value, "value"); } /** * The chain ID this transaction is valid on. */ - get chainId() { return this.#chainId; } - set chainId(value) { this.#chainId = (0, index_js_3.getBigInt)(value); } + get chainId() { return this.___chainId; } + set chainId(value) { this.___chainId = (0, index_js_3.getBigInt)(value); } /** * If signed, the signature for this transaction. */ - get signature() { return this.#sig || null; } + get signature() { return this.___sig || null; } set signature(value) { - this.#sig = (value == null) ? null : index_js_2.Signature.from(value); + this.___sig = (value == null) ? null : index_js_2.Signature.from(value); } /** * The access list. @@ -236400,7 +236400,7 @@ class Transaction { * bytecode and state variable access within contract execution. */ get accessList() { - const value = this.#accessList || null; + const value = this.___accessList || null; if (value == null) { if (this.type === 1 || this.type === 2) { return []; @@ -236410,24 +236410,24 @@ class Transaction { return value; } set accessList(value) { - this.#accessList = (value == null) ? null : (0, accesslist_js_1.accessListify)(value); + this.___accessList = (value == null) ? null : (0, accesslist_js_1.accessListify)(value); } /** * Creates a new Transaction with default values. */ constructor() { - this.#type = null; - this.#to = null; - this.#nonce = 0; - this.#gasLimit = BigInt(0); - this.#gasPrice = null; - this.#maxPriorityFeePerGas = null; - this.#maxFeePerGas = null; - this.#data = "0x"; - this.#value = BigInt(0); - this.#chainId = BigInt(0); - this.#sig = null; - this.#accessList = null; + this.___type = null; + this.___to = null; + this.___nonce = 0; + this.___gasLimit = BigInt(0); + this.___gasPrice = null; + this.___maxPriorityFeePerGas = null; + this.___maxFeePerGas = null; + this.___data = "0x"; + this.___value = BigInt(0); + this.___chainId = BigInt(0); + this.___sig = null; + this.___accessList = null; } /** * The transaction hash, if signed. Otherwise, ``null``. @@ -237274,23 +237274,23 @@ class EventPayload { * The **EventEmitterable**. */ emitter; - #listener; + ___listener; /** * Create a new **EventPayload** for %%emitter%% with * the %%listener%% and for %%filter%%. */ constructor(emitter, listener, filter) { - this.#listener = listener; + this.___listener = listener; (0, properties_js_1.defineProperties)(this, { emitter, filter }); } /** * Unregister the triggered listener for future events. */ async removeListener() { - if (this.#listener == null) { + if (this.___listener == null) { return; } - await this.emitter.off(this.filter, this.#listener); + await this.emitter.off(this.filter, this.___listener); } } exports.EventPayload = EventPayload; @@ -237384,29 +237384,29 @@ const fetchSignals = new WeakMap(); * @_ignore */ class FetchCancelSignal { - #listeners; - #cancelled; + ___listeners; + ___cancelled; constructor(request) { - this.#listeners = []; - this.#cancelled = false; + this.___listeners = []; + this.___cancelled = false; fetchSignals.set(request, () => { - if (this.#cancelled) { + if (this.___cancelled) { return; } - this.#cancelled = true; - for (const listener of this.#listeners) { + this.___cancelled = true; + for (const listener of this.___listeners) { setTimeout(() => { listener(); }, 0); } - this.#listeners = []; + this.___listeners = []; }); } addListener(listener) { - (0, errors_js_1.assert)(!this.#cancelled, "singal already cancelled", "UNSUPPORTED_OPERATION", { + (0, errors_js_1.assert)(!this.___cancelled, "singal already cancelled", "UNSUPPORTED_OPERATION", { operation: "fetchCancelSignal.addCancelListener" }); - this.#listeners.push(listener); + this.___listeners.push(listener); } - get cancelled() { return this.#cancelled; } + get cancelled() { return this.___cancelled; } checkSignal() { (0, errors_js_1.assert)(!this.cancelled, "cancelled", "CANCELLED", {}); } @@ -237435,28 +237435,28 @@ function checkSignal(signal) { * //_result: */ class FetchRequest { - #allowInsecure; - #gzip; - #headers; - #method; - #timeout; - #url; - #body; - #bodyType; - #creds; + ___allowInsecure; + ___gzip; + ___headers; + ___method; + ___timeout; + ___url; + ___body; + ___bodyType; + ___creds; // Hooks - #preflight; - #process; - #retry; - #signal; - #throttle; - #getUrlFunc; + ___preflight; + ___process; + ___retry; + ___signal; + ___throttle; + ___getUrlFunc; /** * The fetch URI to requrest. */ - get url() { return this.#url; } + get url() { return this.___url; } set url(url) { - this.#url = String(url); + this.___url = String(url); } /** * The fetch body, if any, to send as the request body. //(default: null)// @@ -237478,27 +237478,27 @@ class FetchRequest { * set to ``application/json``. */ get body() { - if (this.#body == null) { + if (this.___body == null) { return null; } - return new Uint8Array(this.#body); + return new Uint8Array(this.___body); } set body(body) { if (body == null) { - this.#body = undefined; - this.#bodyType = undefined; + this.___body = undefined; + this.___bodyType = undefined; } else if (typeof (body) === "string") { - this.#body = (0, utf8_js_1.toUtf8Bytes)(body); - this.#bodyType = "text/plain"; + this.___body = (0, utf8_js_1.toUtf8Bytes)(body); + this.___bodyType = "text/plain"; } else if (body instanceof Uint8Array) { - this.#body = body; - this.#bodyType = "application/octet-stream"; + this.___body = body; + this.___bodyType = "application/octet-stream"; } else if (typeof (body) === "object") { - this.#body = (0, utf8_js_1.toUtf8Bytes)(JSON.stringify(body)); - this.#bodyType = "application/json"; + this.___body = (0, utf8_js_1.toUtf8Bytes)(JSON.stringify(body)); + this.___bodyType = "application/json"; } else { throw new Error("invalid body"); @@ -237508,7 +237508,7 @@ class FetchRequest { * Returns true if the request has a body. */ hasBody() { - return (this.#body != null); + return (this.___body != null); } /** * The HTTP method to use when requesting the URI. If no method @@ -237516,8 +237516,8 @@ class FetchRequest { * null and ``POST`` otherwise. */ get method() { - if (this.#method) { - return this.#method; + if (this.___method) { + return this.___method; } if (this.hasBody()) { return "POST"; @@ -237528,7 +237528,7 @@ class FetchRequest { if (method == null) { method = ""; } - this.#method = String(method).toUpperCase(); + this.___method = String(method).toUpperCase(); } /** * The headers that will be used when requesting the URI. All @@ -237540,16 +237540,16 @@ class FetchRequest { * To set a header entry, use the ``setHeader`` method. */ get headers() { - const headers = Object.assign({}, this.#headers); - if (this.#creds) { - headers["authorization"] = `Basic ${(0, base64_js_1.encodeBase64)((0, utf8_js_1.toUtf8Bytes)(this.#creds))}`; + const headers = Object.assign({}, this.___headers); + if (this.___creds) { + headers["authorization"] = `Basic ${(0, base64_js_1.encodeBase64)((0, utf8_js_1.toUtf8Bytes)(this.___creds))}`; } ; if (this.allowGzip) { headers["accept-encoding"] = "gzip"; } - if (headers["content-type"] == null && this.#bodyType) { - headers["content-type"] = this.#bodyType; + if (headers["content-type"] == null && this.___bodyType) { + headers["content-type"] = this.___bodyType; } if (this.body) { headers["content-length"] = String(this.body.length); @@ -237567,13 +237567,13 @@ class FetchRequest { * to a string. */ setHeader(key, value) { - this.#headers[String(key).toLowerCase()] = String(value); + this.___headers[String(key).toLowerCase()] = String(value); } /** * Clear all headers, resetting all intrinsic headers. */ clearHeaders() { - this.#headers = {}; + this.___headers = {}; } [Symbol.iterator]() { const headers = this.headers; @@ -237597,43 +237597,43 @@ class FetchRequest { * To set the credentials, use the ``setCredentials`` method. */ get credentials() { - return this.#creds || null; + return this.___creds || null; } /** * Sets an ``Authorization`` for %%username%% with %%password%%. */ setCredentials(username, password) { (0, errors_js_1.assertArgument)(!username.match(/:/), "invalid basic authentication username", "username", "[REDACTED]"); - this.#creds = `${username}:${password}`; + this.___creds = `${username}:${password}`; } /** * Enable and request gzip-encoded responses. The response will * automatically be decompressed. //(default: true)// */ get allowGzip() { - return this.#gzip; + return this.___gzip; } set allowGzip(value) { - this.#gzip = !!value; + this.___gzip = !!value; } /** * Allow ``Authentication`` credentials to be sent over insecure * channels. //(default: false)// */ get allowInsecureAuthentication() { - return !!this.#allowInsecure; + return !!this.___allowInsecure; } set allowInsecureAuthentication(value) { - this.#allowInsecure = !!value; + this.___allowInsecure = !!value; } /** * The timeout (in milliseconds) to wait for a complere response. * //(default: 5 minutes)// */ - get timeout() { return this.#timeout; } + get timeout() { return this.___timeout; } set timeout(timeout) { (0, errors_js_1.assertArgument)(timeout >= 0, "timeout must be non-zero", "timeout", timeout); - this.#timeout = timeout; + this.___timeout = timeout; } /** * This function is called prior to each request, for example @@ -237643,10 +237643,10 @@ class FetchRequest { * content before sending a request. */ get preflightFunc() { - return this.#preflight || null; + return this.___preflight || null; } set preflightFunc(preflight) { - this.#preflight = preflight; + this.___preflight = preflight; } /** * This function is called after each response, offering an @@ -237659,19 +237659,19 @@ class FetchRequest { * has not been reached), use [[response.throwThrottleError]]. */ get processFunc() { - return this.#process || null; + return this.___process || null; } set processFunc(process) { - this.#process = process; + this.___process = process; } /** * This function is called on each retry attempt. */ get retryFunc() { - return this.#retry || null; + return this.___retry || null; } set retryFunc(retry) { - this.#retry = retry; + this.___retry = retry; } /** * This function is called to fetch content from HTTP and @@ -237689,10 +237689,10 @@ class FetchRequest { * configurege a proxy or other agent. */ get getUrlFunc() { - return this.#getUrlFunc || defaultGetUrlFunc; + return this.___getUrlFunc || defaultGetUrlFunc; } set getUrlFunc(value) { - this.#getUrlFunc = value; + this.___getUrlFunc = value; } /** * Create a new FetchRequest instance with default values. @@ -237701,20 +237701,20 @@ class FetchRequest { * ``.send()`` to make the request. */ constructor(url) { - this.#url = String(url); - this.#allowInsecure = false; - this.#gzip = true; - this.#headers = {}; - this.#method = ""; - this.#timeout = 300000; - this.#throttle = { + this.___url = String(url); + this.___allowInsecure = false; + this.___gzip = true; + this.___headers = {}; + this.___method = ""; + this.___timeout = 300000; + this.___throttle = { slotInterval: SLOT_INTERVAL, maxAttempts: MAX_ATTEMPTS }; - this.#getUrlFunc = null; + this.___getUrlFunc = null; } toString() { - return ``; + return ``; } /** * Update the throttle parameters used to determine maximum @@ -237722,14 +237722,14 @@ class FetchRequest { */ setThrottleParams(params) { if (params.slotInterval != null) { - this.#throttle.slotInterval = params.slotInterval; + this.___throttle.slotInterval = params.slotInterval; } if (params.maxAttempts != null) { - this.#throttle.maxAttempts = params.maxAttempts; + this.___throttle.maxAttempts = params.maxAttempts; } } - async #send(attempt, expires, delay, _request, _response) { - if (attempt >= this.#throttle.maxAttempts) { + async ___send(attempt, expires, delay, _request, _response) { + if (attempt >= this.___throttle.maxAttempts) { return _response.makeServerError("exceeded maximum retry limit"); } (0, errors_js_1.assert)(getTime() <= expires, "timeout", "TIMEOUT", { @@ -237742,11 +237742,11 @@ class FetchRequest { const scheme = (req.url.split(":")[0] || "").toLowerCase(); // Process any Gateways if (scheme in Gateways) { - const result = await Gateways[scheme](req.url, checkSignal(_request.#signal)); + const result = await Gateways[scheme](req.url, checkSignal(_request.___signal)); if (result instanceof FetchResponse) { let response = result; if (this.processFunc) { - checkSignal(_request.#signal); + checkSignal(_request.___signal); try { response = await this.processFunc(req, response); } @@ -237766,13 +237766,13 @@ class FetchRequest { if (this.preflightFunc) { req = await this.preflightFunc(req); } - const resp = await this.getUrlFunc(req, checkSignal(_request.#signal)); + const resp = await this.getUrlFunc(req, checkSignal(_request.___signal)); let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request); if (response.statusCode === 301 || response.statusCode === 302) { // Redirect try { const location = response.headers.location || ""; - return req.redirect(location).#send(attempt + 1, expires, 0, _request, response); + return req.redirect(location).___send(attempt + 1, expires, 0, _request, response); } catch (error) { } // Things won't get any better on another attempt; abort @@ -237782,15 +237782,15 @@ class FetchRequest { // Throttle if (this.retryFunc == null || (await this.retryFunc(req, response, attempt))) { const retryAfter = response.headers["retry-after"]; - let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); + let delay = this.___throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { delay = parseInt(retryAfter); } - return req.clone().#send(attempt + 1, expires, delay, _request, response); + return req.clone().___send(attempt + 1, expires, delay, _request, response); } } if (this.processFunc) { - checkSignal(_request.#signal); + checkSignal(_request.___signal); try { response = await this.processFunc(req, response); } @@ -237800,12 +237800,12 @@ class FetchRequest { response.makeServerError("error in post-processing function", error).assertOk(); } // Throttle - let delay = this.#throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); + let delay = this.___throttle.slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); ; if (error.stall >= 0) { delay = error.stall; } - return req.clone().#send(attempt + 1, expires, delay, _request, response); + return req.clone().___send(attempt + 1, expires, delay, _request, response); } } return response; @@ -237814,16 +237814,16 @@ class FetchRequest { * Resolves to the response by sending the request. */ send() { - (0, errors_js_1.assert)(this.#signal == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }); - this.#signal = new FetchCancelSignal(this); - return this.#send(0, getTime() + this.timeout, 0, this, new FetchResponse(0, "", {}, null, this)); + (0, errors_js_1.assert)(this.___signal == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }); + this.___signal = new FetchCancelSignal(this); + return this.___send(0, getTime() + this.timeout, 0, this, new FetchResponse(0, "", {}, null, this)); } /** * Cancels the inflight response, causing a ``CANCELLED`` * error to be rejected from the [[send]]. */ cancel() { - (0, errors_js_1.assert)(this.#signal != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" }); + (0, errors_js_1.assert)(this.___signal != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" }); const signal = fetchSignals.get(this); if (!signal) { throw new Error("missing signal; should not happen"); @@ -237850,11 +237850,11 @@ class FetchRequest { req.method = "GET"; req.allowGzip = this.allowGzip; req.timeout = this.timeout; - req.#headers = Object.assign({}, this.#headers); - if (this.#body) { - req.#body = new Uint8Array(this.#body); + req.___headers = Object.assign({}, this.___headers); + if (this.___body) { + req.___body = new Uint8Array(this.___body); } - req.#bodyType = this.#bodyType; + req.___bodyType = this.___bodyType; // Do not forward credentials unless on the same domain; only absolute //req.allowInsecure = false; // paths are currently supported; may want a way to specify to forward? @@ -237867,16 +237867,16 @@ class FetchRequest { clone() { const clone = new FetchRequest(this.url); // Preserve "default method" (i.e. null) - clone.#method = this.#method; + clone.___method = this.___method; // Preserve "default body" with type, copying the Uint8Array is present - if (this.#body) { - clone.#body = this.#body; + if (this.___body) { + clone.___body = this.___body; } - clone.#bodyType = this.#bodyType; + clone.___bodyType = this.___bodyType; // Preserve "default headers" - clone.#headers = Object.assign({}, this.#headers); + clone.___headers = Object.assign({}, this.___headers); // Credentials is readonly, so we copy internally - clone.#creds = this.#creds; + clone.___creds = this.___creds; if (this.allowGzip) { clone.allowGzip = true; } @@ -237884,10 +237884,10 @@ class FetchRequest { if (this.allowInsecureAuthentication) { clone.allowInsecureAuthentication = true; } - clone.#preflight = this.#preflight; - clone.#process = this.#process; - clone.#retry = this.#retry; - clone.#getUrlFunc = this.#getUrlFunc; + clone.___preflight = this.___preflight; + clone.___process = this.___process; + clone.___retry = this.___retry; + clone.___getUrlFunc = this.___getUrlFunc; return clone; } /** @@ -237978,32 +237978,32 @@ exports.FetchRequest = FetchRequest; * The response for a FetchREquest. */ class FetchResponse { - #statusCode; - #statusMessage; - #headers; - #body; - #request; - #error; + ___statusCode; + ___statusMessage; + ___headers; + ___body; + ___request; + ___error; toString() { - return ``; + return ``; } /** * The response status code. */ - get statusCode() { return this.#statusCode; } + get statusCode() { return this.___statusCode; } /** * The response status message. */ - get statusMessage() { return this.#statusMessage; } + get statusMessage() { return this.___statusMessage; } /** * The response headers. All keys are lower-case. */ - get headers() { return Object.assign({}, this.#headers); } + get headers() { return Object.assign({}, this.___headers); } /** * The response body, or ``null`` if there was no body. */ get body() { - return (this.#body == null) ? null : new Uint8Array(this.#body); + return (this.___body == null) ? null : new Uint8Array(this.___body); } /** * The response body as a UTF-8 encoded string, or the empty @@ -238013,7 +238013,7 @@ class FetchResponse { */ get bodyText() { try { - return (this.#body == null) ? "" : (0, utf8_js_1.toUtf8String)(this.#body); + return (this.___body == null) ? "" : (0, utf8_js_1.toUtf8String)(this.___body); } catch (error) { (0, errors_js_1.assert)(false, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", { @@ -238054,15 +238054,15 @@ class FetchResponse { }; } constructor(statusCode, statusMessage, headers, body, request) { - this.#statusCode = statusCode; - this.#statusMessage = statusMessage; - this.#headers = Object.keys(headers).reduce((accum, k) => { + this.___statusCode = statusCode; + this.___statusMessage = statusMessage; + this.___headers = Object.keys(headers).reduce((accum, k) => { accum[k.toLowerCase()] = String(headers[k]); return accum; }, {}); - this.#body = ((body == null) ? null : new Uint8Array(body)); - this.#request = (request || null); - this.#error = { message: "" }; + this.___body = ((body == null) ? null : new Uint8Array(body)); + this.___request = (request || null); + this.___error = { message: "" }; } /** * Return a Response with matching headers and body, but with @@ -238078,8 +238078,8 @@ class FetchResponse { else { statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`; } - const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.#request || undefined); - response.#error = { message, error }; + const response = new FetchResponse(599, statusMessage, this.headers, this.body, this.___request || undefined); + response.___error = { message, error }; return response; } /** @@ -238108,17 +238108,17 @@ class FetchResponse { * Returns true of the response has a body. */ hasBody() { - return (this.#body != null); + return (this.___body != null); } /** * The request made for this response. */ - get request() { return this.#request; } + get request() { return this.___request; } /** * Returns true if this response was a success statusCode. */ ok() { - return (this.#error.message === "" && this.statusCode >= 200 && this.statusCode < 300); + return (this.___error.message === "" && this.statusCode >= 200 && this.statusCode < 300); } /** * Throws a ``SERVER_ERROR`` if this response is not ok. @@ -238127,7 +238127,7 @@ class FetchResponse { if (this.ok()) { return; } - let { message, error } = this.#error; + let { message, error } = this.___error; if (message === "") { message = `server response ${this.statusCode} ${this.statusMessage}`; } @@ -238325,11 +238325,11 @@ class FixedNumber { * The specific fixed-point arithmetic field for this value. */ format; - #format; + ___format; // The actual value (accounting for decimals) - #val; + ___val; // A base-10 value to multiple values by to maintain the magnitude - #tens; + ___tens; /** * This is a property so console.log shows a human-meaningful value. * @@ -238344,34 +238344,34 @@ class FixedNumber { */ constructor(guard, value, format) { (0, errors_js_1.assertPrivate)(guard, _guard, "FixedNumber"); - this.#val = value; - this.#format = format; + this.___val = value; + this.___format = format; const _value = toString(value, format.decimals); (0, properties_js_1.defineProperties)(this, { format: format.name, _value }); - this.#tens = getTens(format.decimals); + this.___tens = getTens(format.decimals); } /** * If true, negative values are permitted, otherwise only * positive values and zero are allowed. */ - get signed() { return this.#format.signed; } + get signed() { return this.___format.signed; } /** * The number of bits available to store the value. */ - get width() { return this.#format.width; } + get width() { return this.___format.width; } /** * The number of decimal places in the fixed-point arithment field. */ - get decimals() { return this.#format.decimals; } + get decimals() { return this.___format.decimals; } /** * The value as an integer, based on the smallest unit the * [[decimals]] allow. */ - get value() { return this.#val; } - #checkFormat(other) { + get value() { return this.___val; } + ___checkFormat(other) { (0, errors_js_1.assertArgument)(this.format === other.format, "incompatible format; use fixedNumber.toFormat", "other", other); } - #checkValue(val, safeOp) { + ___checkValue(val, safeOp) { /* const width = BigInt(this.width); if (this.signed) { @@ -238394,101 +238394,101 @@ class FixedNumber { val = masked; } */ - val = checkValue(val, this.#format, safeOp); - return new FixedNumber(_guard, val, this.#format); + val = checkValue(val, this.___format, safeOp); + return new FixedNumber(_guard, val, this.___format); } - #add(o, safeOp) { - this.#checkFormat(o); - return this.#checkValue(this.#val + o.#val, safeOp); + ___add(o, safeOp) { + this.___checkFormat(o); + return this.___checkValue(this.___val + o.___val, safeOp); } /** * Returns a new [[FixedNumber]] with the result of %%this%% added * to %%other%%, ignoring overflow. */ - addUnsafe(other) { return this.#add(other); } + addUnsafe(other) { return this.___add(other); } /** * Returns a new [[FixedNumber]] with the result of %%this%% added * to %%other%%. A [[NumericFaultError]] is thrown if overflow * occurs. */ - add(other) { return this.#add(other, "add"); } - #sub(o, safeOp) { - this.#checkFormat(o); - return this.#checkValue(this.#val - o.#val, safeOp); + add(other) { return this.___add(other, "add"); } + ___sub(o, safeOp) { + this.___checkFormat(o); + return this.___checkValue(this.___val - o.___val, safeOp); } /** * Returns a new [[FixedNumber]] with the result of %%other%% subtracted * from %%this%%, ignoring overflow. */ - subUnsafe(other) { return this.#sub(other); } + subUnsafe(other) { return this.___sub(other); } /** * Returns a new [[FixedNumber]] with the result of %%other%% subtracted * from %%this%%. A [[NumericFaultError]] is thrown if overflow * occurs. */ - sub(other) { return this.#sub(other, "sub"); } - #mul(o, safeOp) { - this.#checkFormat(o); - return this.#checkValue((this.#val * o.#val) / this.#tens, safeOp); + sub(other) { return this.___sub(other, "sub"); } + ___mul(o, safeOp) { + this.___checkFormat(o); + return this.___checkValue((this.___val * o.___val) / this.___tens, safeOp); } /** * Returns a new [[FixedNumber]] with the result of %%this%% multiplied * by %%other%%, ignoring overflow and underflow (precision loss). */ - mulUnsafe(other) { return this.#mul(other); } + mulUnsafe(other) { return this.___mul(other); } /** * Returns a new [[FixedNumber]] with the result of %%this%% multiplied * by %%other%%. A [[NumericFaultError]] is thrown if overflow * occurs. */ - mul(other) { return this.#mul(other, "mul"); } + mul(other) { return this.___mul(other, "mul"); } /** * Returns a new [[FixedNumber]] with the result of %%this%% multiplied * by %%other%%. A [[NumericFaultError]] is thrown if overflow * occurs or if underflow (precision loss) occurs. */ mulSignal(other) { - this.#checkFormat(other); - const value = this.#val * other.#val; - (0, errors_js_1.assert)((value % this.#tens) === BN_0, "precision lost during signalling mul", "NUMERIC_FAULT", { + this.___checkFormat(other); + const value = this.___val * other.___val; + (0, errors_js_1.assert)((value % this.___tens) === BN_0, "precision lost during signalling mul", "NUMERIC_FAULT", { operation: "mulSignal", fault: "underflow", value: this }); - return this.#checkValue(value / this.#tens, "mulSignal"); + return this.___checkValue(value / this.___tens, "mulSignal"); } - #div(o, safeOp) { - (0, errors_js_1.assert)(o.#val !== BN_0, "division by zero", "NUMERIC_FAULT", { + ___div(o, safeOp) { + (0, errors_js_1.assert)(o.___val !== BN_0, "division by zero", "NUMERIC_FAULT", { operation: "div", fault: "divide-by-zero", value: this }); - this.#checkFormat(o); - return this.#checkValue((this.#val * this.#tens) / o.#val, safeOp); + this.___checkFormat(o); + return this.___checkValue((this.___val * this.___tens) / o.___val, safeOp); } /** * Returns a new [[FixedNumber]] with the result of %%this%% divided * by %%other%%, ignoring underflow (precision loss). A * [[NumericFaultError]] is thrown if overflow occurs. */ - divUnsafe(other) { return this.#div(other); } + divUnsafe(other) { return this.___div(other); } /** * Returns a new [[FixedNumber]] with the result of %%this%% divided * by %%other%%, ignoring underflow (precision loss). A * [[NumericFaultError]] is thrown if overflow occurs. */ - div(other) { return this.#div(other, "div"); } + div(other) { return this.___div(other, "div"); } /** * Returns a new [[FixedNumber]] with the result of %%this%% divided * by %%other%%. A [[NumericFaultError]] is thrown if underflow * (precision loss) occurs. */ divSignal(other) { - (0, errors_js_1.assert)(other.#val !== BN_0, "division by zero", "NUMERIC_FAULT", { + (0, errors_js_1.assert)(other.___val !== BN_0, "division by zero", "NUMERIC_FAULT", { operation: "div", fault: "divide-by-zero", value: this }); - this.#checkFormat(other); - const value = (this.#val * this.#tens); - (0, errors_js_1.assert)((value % other.#val) === BN_0, "precision lost during signalling div", "NUMERIC_FAULT", { + this.___checkFormat(other); + const value = (this.___val * this.___tens); + (0, errors_js_1.assert)((value % other.___val) === BN_0, "precision lost during signalling div", "NUMERIC_FAULT", { operation: "divSignal", fault: "underflow", value: this }); - return this.#checkValue(value / other.#val, "divSignal"); + return this.___checkValue(value / other.___val, "divSignal"); } /** * Returns a comparison result between %%this%% and %%other%%. @@ -238543,12 +238543,12 @@ class FixedNumber { * The decimal component of the result will always be ``0``. */ floor() { - let val = this.#val; - if (this.#val < BN_0) { - val -= this.#tens - BN_1; + let val = this.___val; + if (this.___val < BN_0) { + val -= this.___tens - BN_1; } - val = (this.#val / this.#tens) * this.#tens; - return this.#checkValue(val, "floor"); + val = (this.___val / this.___tens) * this.___tens; + return this.___checkValue(val, "floor"); } /** * Returns a new [[FixedNumber]] which is the smallest **integer** @@ -238557,12 +238557,12 @@ class FixedNumber { * The decimal component of the result will always be ``0``. */ ceiling() { - let val = this.#val; - if (this.#val > BN_0) { - val += this.#tens - BN_1; + let val = this.___val; + if (this.___val > BN_0) { + val += this.___tens - BN_1; } - val = (this.#val / this.#tens) * this.#tens; - return this.#checkValue(val, "ceiling"); + val = (this.___val / this.___tens) * this.___tens; + return this.___checkValue(val, "ceiling"); } /** * Returns a new [[FixedNumber]] with the decimal component @@ -238581,17 +238581,17 @@ class FixedNumber { let value = this.value + bump; const tens = getTens(delta); value = (value / tens) * tens; - checkValue(value, this.#format, "round"); - return new FixedNumber(_guard, value, this.#format); + checkValue(value, this.___format, "round"); + return new FixedNumber(_guard, value, this.___format); } /** * Returns true if %%this%% is equal to ``0``. */ - isZero() { return (this.#val === BN_0); } + isZero() { return (this.___val === BN_0); } /** * Returns true if %%this%% is less than ``0``. */ - isNegative() { return (this.#val < BN_0); } + isNegative() { return (this.___val < BN_0); } /** * Returns the string representation of %%this%%. */ @@ -239713,7 +239713,7 @@ class BaseWallet extends index_js_3.AbstractSigner { * The wallet address. */ address; - #signingKey; + ___signingKey; /** * Creates a new BaseWallet for %%privateKey%%, optionally * connected to %%provider%%. @@ -239724,7 +239724,7 @@ class BaseWallet extends index_js_3.AbstractSigner { constructor(privateKey, provider) { super(provider); (0, index_js_5.assertArgument)(privateKey && typeof (privateKey.sign) === "function", "invalid private key", "privateKey", "[ REDACTED ]"); - this.#signingKey = privateKey; + this.___signingKey = privateKey; const address = (0, index_js_4.computeAddress)(this.signingKey.publicKey); (0, index_js_5.defineProperties)(this, { address }); } @@ -239733,14 +239733,14 @@ class BaseWallet extends index_js_3.AbstractSigner { /** * The [[SigningKey]] used for signing payloads. */ - get signingKey() { return this.#signingKey; } + get signingKey() { return this.___signingKey; } /** * The private key for this wallet. */ get privateKey() { return this.signingKey.privateKey; } async getAddress() { return this.address; } connect(provider) { - return new BaseWallet(this.#signingKey, provider); + return new BaseWallet(this.___signingKey, provider); } async signTransaction(tx) { // Replace any Addressable or ENS name with an address @@ -239964,7 +239964,7 @@ class HDNodeWallet extends base_wallet_js_1.BaseWallet { connect(provider) { return new HDNodeWallet(_guard, this.signingKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.mnemonic, provider); } - #account() { + ___account() { const account = { address: this.address, privateKey: this.privateKey }; const m = this.mnemonic; if (this.path && m && m.wordlist.locale === "en" && m.password === "") { @@ -239984,7 +239984,7 @@ class HDNodeWallet extends base_wallet_js_1.BaseWallet { * updates as the encryption process progreses. */ async encrypt(password, progressCallback) { - return await (0, json_keystore_js_1.encryptKeystoreJson)(this.#account(), password, { progressCallback }); + return await (0, json_keystore_js_1.encryptKeystoreJson)(this.___account(), password, { progressCallback }); } /** * Returns a [JSON Keystore Wallet](json-wallets) encryped with @@ -239997,7 +239997,7 @@ class HDNodeWallet extends base_wallet_js_1.BaseWallet { * it is complete, which may be a non-trivial duration. */ encryptSync(password) { - return (0, json_keystore_js_1.encryptKeystoreJsonSync)(this.#account(), password); + return (0, json_keystore_js_1.encryptKeystoreJsonSync)(this.___account(), password); } /** * The extended key. @@ -240057,7 +240057,7 @@ class HDNodeWallet extends base_wallet_js_1.BaseWallet { derivePath(path) { return derivePath(this, path); } - static #fromSeed(_seed, mnemonic) { + static ___fromSeed(_seed, mnemonic) { (0, index_js_4.assertArgument)((0, index_js_4.isBytesLike)(_seed), "invalid seed", "seed", "[REDACTED]"); const seed = (0, index_js_4.getBytes)(_seed, "seed"); (0, index_js_4.assertArgument)(seed.length >= 16 && seed.length <= 64, "invalid seed", "seed", "[REDACTED]"); @@ -240111,7 +240111,7 @@ class HDNodeWallet extends base_wallet_js_1.BaseWallet { wordlist = lang_en_js_1.LangEn.wordlist(); } const mnemonic = mnemonic_js_1.Mnemonic.fromEntropy((0, index_js_1.randomBytes)(16), password, wordlist); - return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + return HDNodeWallet.___fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); } /** * Create an HD Node from %%mnemonic%%. @@ -240120,7 +240120,7 @@ class HDNodeWallet extends base_wallet_js_1.BaseWallet { if (!path) { path = exports.defaultPath; } - return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + return HDNodeWallet.___fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); } /** * Creates an HD Node from a mnemonic %%phrase%%. @@ -240136,13 +240136,13 @@ class HDNodeWallet extends base_wallet_js_1.BaseWallet { wordlist = lang_en_js_1.LangEn.wordlist(); } const mnemonic = mnemonic_js_1.Mnemonic.fromPhrase(phrase, password, wordlist); - return HDNodeWallet.#fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); + return HDNodeWallet.___fromSeed(mnemonic.computeSeed(), mnemonic).derivePath(path); } /** * Creates an HD Node from a %%seed%%. */ static fromSeed(seed) { - return HDNodeWallet.#fromSeed(seed, null); + return HDNodeWallet.___fromSeed(seed, null); } } exports.HDNodeWallet = HDNodeWallet; @@ -240265,17 +240265,17 @@ class HDNodeVoidWallet extends index_js_2.VoidSigner { exports.HDNodeVoidWallet = HDNodeVoidWallet; /* export class HDNodeWalletManager { - #root: HDNodeWallet; + ___root: HDNodeWallet; constructor(phrase: string, password?: null | string, path?: null | string, locale?: null | Wordlist) { if (password == null) { password = ""; } if (path == null) { path = "m/44'/60'/0'/0"; } if (locale == null) { locale = LangEn.wordlist(); } - this.#root = HDNodeWallet.fromPhrase(phrase, password, path, locale); + this.___root = HDNodeWallet.fromPhrase(phrase, password, path, locale); } getSigner(index?: number): HDNodeWallet { - return this.#root.deriveChild((index == null) ? 0: index); + return this.___root.deriveChild((index == null) ? 0: index); } } */ @@ -241148,7 +241148,7 @@ class Wallet extends base_wallet_js_1.BaseWallet { const account = { address: this.address, privateKey: this.privateKey }; return (0, json_keystore_js_1.encryptKeystoreJsonSync)(account, password); } - static #fromAccount(account) { + static ___fromAccount(account) { (0, index_js_2.assertArgument)(account, "invalid JSON wallet", "json", "[ REDACTED ]"); if ("mnemonic" in account && account.mnemonic && account.mnemonic.locale === "en") { const mnemonic = mnemonic_js_1.Mnemonic.fromEntropy(account.mnemonic.entropy); @@ -241185,7 +241185,7 @@ class Wallet extends base_wallet_js_1.BaseWallet { await stall(0); } } - return Wallet.#fromAccount(account); + return Wallet.___fromAccount(account); } /** * Creates a **Wallet** by decrypting the %%json%% with %%password%%. @@ -241205,7 +241205,7 @@ class Wallet extends base_wallet_js_1.BaseWallet { else { (0, index_js_2.assertArgument)(false, "invalid JSON wallet", "json", "[ REDACTED ]"); } - return Wallet.#fromAccount(account); + return Wallet.___fromAccount(account); } /** * Creates a new random [[HDNodeWallet]] using the avavilable @@ -241511,50 +241511,50 @@ const wordlist_js_1 = __webpack_require__(/*! ./wordlist.js */ "./node_modules/e * to create the necessary data. */ class WordlistOwl extends wordlist_js_1.Wordlist { - #data; - #checksum; + ___data; + ___checksum; /** * Creates a new Wordlist for %%locale%% using the OWL %%data%% * and validated against the %%checksum%%. */ constructor(locale, data, checksum) { super(locale); - this.#data = data; - this.#checksum = checksum; - this.#words = null; + this.___data = data; + this.___checksum = checksum; + this.___words = null; } /** * The OWL-encoded data. */ - get _data() { return this.#data; } + get _data() { return this.___data; } /** * Decode all the words for the wordlist. */ _decodeWords() { - return (0, decode_owl_js_1.decodeOwl)(this.#data); + return (0, decode_owl_js_1.decodeOwl)(this.___data); } - #words; - #loadWords() { - if (this.#words == null) { + ___words; + ___loadWords() { + if (this.___words == null) { const words = this._decodeWords(); // Verify the computed list matches the official list const checksum = (0, index_js_1.id)(words.join("\n") + "\n"); /* c8 ignore start */ - if (checksum !== this.#checksum) { + if (checksum !== this.___checksum) { throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`); } /* c8 ignore stop */ - this.#words = words; + this.___words = words; } - return this.#words; + return this.___words; } getWord(index) { - const words = this.#loadWords(); + const words = this.___loadWords(); (0, index_js_2.assertArgument)(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); return words[index]; } getWordIndex(word) { - return this.#loadWords().indexOf(word); + return this.___loadWords().indexOf(word); } } exports.WordlistOwl = WordlistOwl; @@ -241587,19 +241587,19 @@ const decode_owla_js_1 = __webpack_require__(/*! ./decode-owla.js */ "./node_mod * to create the necessary data. */ class WordlistOwlA extends wordlist_owl_js_1.WordlistOwl { - #accent; + ___accent; /** * Creates a new Wordlist for %%locale%% using the OWLA %%data%% * and %%accent%% data and validated against the %%checksum%%. */ constructor(locale, data, accent, checksum) { super(locale, data, checksum); - this.#accent = accent; + this.___accent = accent; } /** * The OWLA-encoded accent data. */ - get _accent() { return this.#accent; } + get _accent() { return this.___accent; } /** * Decode all the words for the wordlist. */