admin: updated dist files

This commit is contained in:
Richard Moore 2022-10-01 01:34:06 -04:00
parent 55a6c9b715
commit c8f769346f
96 changed files with 1099 additions and 931 deletions

394
dist/ethers.js vendored

@ -1,4 +1,4 @@
const version = "6.0.0-beta-exports.3";
const version = "6.0.0-beta-exports.4";
async function resolveProperties(value) {
const keys = Object.keys(value);
@ -491,6 +491,9 @@ function getBigInt(value, name) {
return BigInt(value);
case "string":
try {
if (value[0] === "-" && value[1] !== "-") {
return -BigInt(value.substring(1));
}
return BigInt(value);
}
catch (e) {
@ -3724,7 +3727,7 @@ randomBytes._ = _randomBytes;
randomBytes.lock = function () { locked = true; };
randomBytes.register = function (func) {
if (locked) {
throw new Error("random is locked");
throw new Error("randomBytes is locked");
}
__randomBytes = func;
};
@ -5569,6 +5572,7 @@ function lock() {
scryptSync.lock();
sha256.lock();
sha512.lock();
randomBytes.lock();
}
const BN_0$5 = BigInt(0);
@ -7246,7 +7250,7 @@ function consumeMutability(tokens) {
}
// ...a parameter list, returning the ParamType list
function consumeParams(tokens, allowIndexed) {
return tokens.popParams().map((t) => ParamType.fromTokens(t, allowIndexed));
return tokens.popParams().map((t) => ParamType.from(t, allowIndexed));
}
// ...a gas limit, returning a BigNumber or null if none
function consumeGas(tokens) {
@ -7296,6 +7300,11 @@ function verifyBasicType(type) {
const _guard$2 = {};
const internal$1 = Symbol.for("_ethers_internal");
const ParamTypeInternal = "_ParamTypeInternal";
const ErrorFragmentInternal = "_ErrorInternal";
const EventFragmentInternal = "_EventInternal";
const ConstructorFragmentInternal = "_ConstructorInternal";
const FunctionFragmentInternal = "_FunctionInternal";
const StructFragmentInternal = "_StructInternal";
class ParamType {
// The local name of the parameter (of "" if unbound)
name;
@ -7493,10 +7502,46 @@ class ParamType {
return obj;
}
if (typeof (obj) === "string") {
return ParamType.fromTokens(lex(obj), allowIndexed);
return ParamType.from(lex(obj), allowIndexed);
}
if (obj instanceof TokenString) {
return ParamType.fromTokens(obj, allowIndexed);
else if (obj instanceof TokenString) {
let type = "", baseType = "";
let comps = null;
if (consumeKeywords(obj, setify(["tuple"])).has("tuple") || obj.peekType("OPEN_PAREN")) {
// Tuple
baseType = "tuple";
comps = obj.popParams().map((t) => ParamType.from(t));
type = `tuple(${comps.map((c) => c.format()).join(",")})`;
}
else {
// Normal
type = verifyBasicType(obj.popType("TYPE"));
baseType = type;
}
// Check for Array
let arrayChildren = null;
let arrayLength = null;
while (obj.length && obj.peekType("BRACKET")) {
const bracket = obj.pop(); //arrays[i];
arrayChildren = new ParamType(_guard$2, "", type, baseType, null, comps, arrayLength, arrayChildren);
arrayLength = bracket.value;
type += bracket.text;
baseType = "array";
comps = null;
}
let indexed = null;
const keywords = consumeKeywords(obj, KwModifiers);
if (keywords.has("indexed")) {
if (!allowIndexed) {
throw new Error("");
}
indexed = true;
}
const name = (obj.peekType("ID") ? obj.pop().text : "");
if (obj.length) {
throw new Error("leftover tokens");
}
return new ParamType(_guard$2, name, type, baseType, indexed, comps, arrayLength, arrayChildren);
}
const name = obj.name;
if (name && (typeof (name) !== "string" || !name.match(regexIdentifier))) {
@ -7528,48 +7573,6 @@ class ParamType {
type = verifyBasicType(obj.type);
return new ParamType(_guard$2, name, type, type, indexed, null, null, null);
}
static fromObject(obj, allowIndexed) {
throw new Error("@TODO");
}
static fromTokens(tokens, allowIndexed) {
let type = "", baseType = "";
let comps = null;
if (consumeKeywords(tokens, setify(["tuple"])).has("tuple") || tokens.peekType("OPEN_PAREN")) {
// Tuple
baseType = "tuple";
comps = tokens.popParams().map((t) => ParamType.from(t));
type = `tuple(${comps.map((c) => c.format()).join(",")})`;
}
else {
// Normal
type = verifyBasicType(tokens.popType("TYPE"));
baseType = type;
}
// Check for Array
let arrayChildren = null;
let arrayLength = null;
while (tokens.length && tokens.peekType("BRACKET")) {
const bracket = tokens.pop(); //arrays[i];
arrayChildren = new ParamType(_guard$2, "", type, baseType, null, comps, arrayLength, arrayChildren);
arrayLength = bracket.value;
type += bracket.text;
baseType = "array";
comps = null;
}
let indexed = null;
const keywords = consumeKeywords(tokens, KwModifiers);
if (keywords.has("indexed")) {
if (!allowIndexed) {
throw new Error("");
}
indexed = true;
}
const name = (tokens.peekType("ID") ? tokens.pop().text : "");
if (tokens.length) {
throw new Error("leftover tokens");
}
return new ParamType(_guard$2, name, type, baseType, indexed, comps, arrayLength, arrayChildren);
}
static isParamType(value) {
return (value && value[internal$1] === ParamTypeInternal);
}
@ -7584,82 +7587,58 @@ class Fragment {
}
static from(obj) {
if (typeof (obj) === "string") {
return this.fromString(obj);
try {
Fragment.from(JSON.parse(obj));
}
catch (e) { }
return Fragment.from(lex(obj));
}
if (obj instanceof TokenString) {
return this.fromTokens(obj);
const type = obj.popKeyword(KwTypes);
switch (type) {
case "constructor": return ConstructorFragment.from(obj);
case "error": return ErrorFragment.from(obj);
case "event": return EventFragment.from(obj);
case "function": return FunctionFragment.from(obj);
case "struct": return StructFragment.from(obj);
}
throw new Error(`unsupported type: ${type}`);
}
if (typeof (obj) === "object") {
return this.fromObject(obj);
switch (obj.type) {
case "constructor": return ConstructorFragment.from(obj);
case "error": return ErrorFragment.from(obj);
case "event": return EventFragment.from(obj);
case "function": return FunctionFragment.from(obj);
case "struct": return StructFragment.from(obj);
}
throw new Error(`not implemented yet: ${obj.type}`);
}
throw new Error(`unsupported type: ${obj}`);
}
static fromObject(obj) {
switch (obj.type) {
case "constructor": return ConstructorFragment.fromObject(obj);
case "error": return ErrorFragment.fromObject(obj);
case "event": return EventFragment.fromObject(obj);
case "function": return FunctionFragment.fromObject(obj);
case "struct": return StructFragment.fromObject(obj);
}
throw new Error(`not implemented yet: ${obj.type}`);
}
static fromString(text) {
try {
Fragment.from(JSON.parse(text));
}
catch (e) { }
return Fragment.fromTokens(lex(text));
}
static fromTokens(tokens) {
const type = tokens.popKeyword(KwTypes);
switch (type) {
case "constructor": return ConstructorFragment.fromTokens(tokens);
case "error": return ErrorFragment.fromTokens(tokens);
case "event": return EventFragment.fromTokens(tokens);
case "function": return FunctionFragment.fromTokens(tokens);
case "struct": return StructFragment.fromTokens(tokens);
}
throw new Error(`unsupported type: ${type}`);
}
/*
static fromTokens(tokens: TokenString): Fragment {
const assertDone = () => {
if (tokens.length) { throw new Error(`unexpected tokens: ${ tokens.toString() }`); }
});
const type = (tokens.length && tokens.peek().type === "KEYWORD") ? tokens.peek().text: "unknown";
const name = consumeName("error", tokens);
const inputs = consumeParams(tokens, type === "event");
switch (type) {
case "event": case "struct":
assertDone();
}
}
*/
static isConstructor(value) {
return (value && value.type === "constructor");
return ConstructorFragment.isFragment(value);
}
static isError(value) {
return (value && value.type === "error");
return ErrorFragment.isFragment(value);
}
static isEvent(value) {
return (value && value.type === "event");
return EventFragment.isFragment(value);
}
static isFunction(value) {
return (value && value.type === "function");
return FunctionFragment.isFragment(value);
}
static isStruct(value) {
return (value && value.type === "struct");
return StructFragment.isFragment(value);
}
}
class NamedFragment extends Fragment {
name;
constructor(guard, type, name, inputs) {
super(guard, type, inputs);
if (typeof (name) !== "string" || !name.match(regexIdentifier)) {
throwArgumentError("invalid identifier", "name", name);
}
inputs = Object.freeze(inputs.slice());
defineProperties(this, { name });
}
@ -7670,6 +7649,7 @@ function joinParams(format, params) {
class ErrorFragment extends NamedFragment {
constructor(guard, name, inputs) {
super(guard, "error", name, inputs);
Object.defineProperty(this, internal$1, { value: ErrorFragmentInternal });
}
get selector() {
return id(this.format("sighash")).substring(0, 10);
@ -7689,23 +7669,30 @@ class ErrorFragment extends NamedFragment {
result.push(this.name + joinParams(format, this.inputs));
return result.join(" ");
}
static fromObject(obj) {
return new ErrorFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map(ParamType.fromObject) : []);
static from(obj) {
if (ErrorFragment.isFragment(obj)) {
return obj;
}
if (typeof (obj) === "string") {
return ErrorFragment.from(lex(obj));
}
else if (obj instanceof TokenString) {
const name = consumeName("error", obj);
const inputs = consumeParams(obj);
consumeEoi(obj);
return new ErrorFragment(_guard$2, name, inputs);
}
return new ErrorFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);
}
static fromString(text) {
return ErrorFragment.fromTokens(lex(text));
}
static fromTokens(tokens) {
const name = consumeName("error", tokens);
const inputs = consumeParams(tokens);
consumeEoi(tokens);
return new ErrorFragment(_guard$2, name, inputs);
static isFragment(value) {
return (value && value[internal$1] === ErrorFragmentInternal);
}
}
class EventFragment extends NamedFragment {
anonymous;
constructor(guard, name, inputs, anonymous) {
super(guard, "event", name, inputs);
Object.defineProperty(this, internal$1, { value: EventFragmentInternal });
defineProperties(this, { anonymous });
}
get topicHash() {
@ -7730,18 +7717,24 @@ class EventFragment extends NamedFragment {
}
return result.join(" ");
}
static fromObject(obj) {
return new EventFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map(ParamType.fromObject) : [], !!obj.anonymous);
static from(obj) {
if (EventFragment.isFragment(obj)) {
return obj;
}
if (typeof (obj) === "string") {
return EventFragment.from(lex(obj));
}
else if (obj instanceof TokenString) {
const name = consumeName("event", obj);
const inputs = consumeParams(obj, true);
const anonymous = !!consumeKeywords(obj, setify(["anonymous"])).has("anonymous");
consumeEoi(obj);
return new EventFragment(_guard$2, name, inputs, anonymous);
}
return new EventFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous);
}
static fromString(text) {
return EventFragment.fromTokens(lex(text));
}
static fromTokens(tokens) {
const name = consumeName("event", tokens);
const inputs = consumeParams(tokens, true);
const anonymous = !!consumeKeywords(tokens, setify(["anonymous"])).has("anonymous");
consumeEoi(tokens);
return new EventFragment(_guard$2, name, inputs, anonymous);
static isFragment(value) {
return (value && value[internal$1] === EventFragmentInternal);
}
}
class ConstructorFragment extends Fragment {
@ -7749,6 +7742,7 @@ class ConstructorFragment extends Fragment {
gas;
constructor(guard, type, inputs, payable, gas) {
super(guard, type, inputs);
Object.defineProperty(this, internal$1, { value: ConstructorFragmentInternal });
defineProperties(this, { payable, gas });
}
format(format = "sighash") {
@ -7773,19 +7767,25 @@ class ConstructorFragment extends Fragment {
}
return result.join(" ");
}
static fromObject(obj) {
return new ConstructorFragment(_guard$2, "constructor", obj.inputs ? obj.inputs.map(ParamType.fromObject) : [], !!obj.payable, (obj.gas != null) ? obj.gas : null);
static from(obj) {
if (ConstructorFragment.isFragment(obj)) {
return obj;
}
if (typeof (obj) === "string") {
return ConstructorFragment.from(lex(obj));
}
else if (obj instanceof TokenString) {
consumeKeywords(obj, setify(["constructor"]));
const inputs = consumeParams(obj);
const payable = !!consumeKeywords(obj, setify(["payable"])).has("payable");
const gas = consumeGas(obj);
consumeEoi(obj);
return new ConstructorFragment(_guard$2, "constructor", inputs, payable, gas);
}
return new ConstructorFragment(_guard$2, "constructor", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, (obj.gas != null) ? obj.gas : null);
}
static fromString(text) {
return ConstructorFragment.fromTokens(lex(text));
}
static fromTokens(tokens) {
consumeKeywords(tokens, setify(["constructor"]));
const inputs = consumeParams(tokens);
const payable = !!consumeKeywords(tokens, setify(["payable"])).has("payable");
const gas = consumeGas(tokens);
consumeEoi(tokens);
return new ConstructorFragment(_guard$2, "constructor", inputs, payable, gas);
static isFragment(value) {
return (value && value[internal$1] === ConstructorFragmentInternal);
}
}
class FunctionFragment extends NamedFragment {
@ -7796,6 +7796,7 @@ class FunctionFragment extends NamedFragment {
gas;
constructor(guard, name, stateMutability, inputs, outputs, gas) {
super(guard, "function", name, inputs);
Object.defineProperty(this, internal$1, { value: FunctionFragmentInternal });
outputs = Object.freeze(outputs.slice());
const constant = (stateMutability === "view" || stateMutability === "pure");
const payable = (stateMutability === "payable");
@ -7836,38 +7837,54 @@ class FunctionFragment extends NamedFragment {
}
return result.join(" ");
}
static fromObject(obj) {
// @TODO: verifyState for stateMutability
return new FunctionFragment(_guard$2, obj.name, obj.stateMutability, obj.inputs ? obj.inputs.map(ParamType.fromObject) : [], obj.outputs ? obj.outputs.map(ParamType.fromObject) : [], (obj.gas != null) ? obj.gas : null);
}
static fromString(text) {
return FunctionFragment.fromTokens(lex(text));
}
static fromTokens(tokens) {
const name = consumeName("function", tokens);
const inputs = consumeParams(tokens);
const mutability = consumeMutability(tokens);
let outputs = [];
if (consumeKeywords(tokens, setify(["returns"])).has("returns")) {
outputs = consumeParams(tokens);
static from(obj) {
if (FunctionFragment.isFragment(obj)) {
return obj;
}
const gas = consumeGas(tokens);
consumeEoi(tokens);
return new FunctionFragment(_guard$2, name, mutability, inputs, outputs, gas);
if (typeof (obj) === "string") {
return FunctionFragment.from(lex(obj));
}
else if (obj instanceof TokenString) {
const name = consumeName("function", obj);
const inputs = consumeParams(obj);
const mutability = consumeMutability(obj);
let outputs = [];
if (consumeKeywords(obj, setify(["returns"])).has("returns")) {
outputs = consumeParams(obj);
}
const gas = consumeGas(obj);
consumeEoi(obj);
return new FunctionFragment(_guard$2, name, mutability, inputs, outputs, gas);
}
// @TODO: verifyState for stateMutability
return new FunctionFragment(_guard$2, obj.name, obj.stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], (obj.gas != null) ? obj.gas : null);
}
static isFragment(value) {
return (value && value[internal$1] === FunctionFragmentInternal);
}
}
class StructFragment extends NamedFragment {
constructor(guard, name, inputs) {
super(guard, "struct", name, inputs);
Object.defineProperty(this, internal$1, { value: StructFragmentInternal });
}
format() {
throw new Error("@TODO");
}
static fromString(text) {
return StructFragment.fromTokens(lex(text));
static from(obj) {
if (typeof (obj) === "string") {
return StructFragment.from(lex(obj));
}
else if (obj instanceof TokenString) {
const name = consumeName("struct", obj);
const inputs = consumeParams(obj);
consumeEoi(obj);
return new StructFragment(_guard$2, name, inputs);
}
return new StructFragment(_guard$2, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);
}
static fromTokens(tokens) {
const name = consumeName("struct", tokens);
const inputs = consumeParams(tokens);
consumeEoi(tokens);
return new StructFragment(_guard$2, "struct", name, inputs);
static isFragment(value) {
return (value && value[internal$1] === StructFragmentInternal);
}
}
@ -7935,7 +7952,7 @@ class AbiCoder {
}
const defaultAbiCoder = new AbiCoder();
function formatBytes32String(text) {
function encodeBytes32String(text) {
// Get the bytes
const bytes = toUtf8Bytes(text);
// Check we have room for null-termination
@ -7945,7 +7962,7 @@ function formatBytes32String(text) {
// Zero-pad (implicitly null-terminates)
return zeroPadBytes(bytes, 32);
}
function parseBytes32String(_bytes) {
function decodeBytes32String(_bytes) {
const data = getBytes(_bytes, "bytes");
// Must be 32 bytes with a null-termination
if (data.length !== 32) {
@ -8079,7 +8096,9 @@ class Interface {
try {
frags.push(Fragment.from(a));
}
catch (error) { }
catch (error) {
console.log("EE", error);
}
}
defineProperties(this, {
fragments: Object.freeze(frags)
@ -8122,7 +8141,7 @@ class Interface {
// If we do not have a constructor add a default
if (!this.deploy) {
defineProperties(this, {
deploy: ConstructorFragment.fromString("constructor()")
deploy: ConstructorFragment.from("constructor()")
});
}
}
@ -8230,7 +8249,7 @@ class Interface {
return matching[0];
}
// Normalize the signature and lookup the function
const result = this.#functions.get(FunctionFragment.fromString(key).format());
const result = this.#functions.get(FunctionFragment.from(key).format());
if (result) {
return result;
}
@ -8309,7 +8328,7 @@ class Interface {
return matching[0];
}
// Normalize the signature and lookup the function
const result = this.#events.get(EventFragment.fromString(key).format());
const result = this.#events.get(EventFragment.from(key).format());
if (result) {
return result;
}
@ -8349,7 +8368,7 @@ class Interface {
if (isHexString(key)) {
const selector = key.toLowerCase();
if (BuiltinErrors[selector]) {
return ErrorFragment.fromString(BuiltinErrors[selector].signature);
return ErrorFragment.from(BuiltinErrors[selector].signature);
}
for (const fragment of this.#errors.values()) {
if (selector === fragment.selector) {
@ -8368,10 +8387,10 @@ class Interface {
}
if (matching.length === 0) {
if (key === "Error") {
return ErrorFragment.fromString("error Error(string)");
return ErrorFragment.from("error Error(string)");
}
if (key === "Panic") {
return ErrorFragment.fromString("error Panic(uint256)");
return ErrorFragment.from("error Panic(uint256)");
}
throwArgumentError("no matching error", "name", key);
}
@ -8382,12 +8401,12 @@ class Interface {
return matching[0];
}
// Normalize the signature and lookup the function
key = ErrorFragment.fromString(key).format();
key = ErrorFragment.from(key).format();
if (key === "Error(string)") {
return ErrorFragment.fromString("error Error(string)");
return ErrorFragment.from("error Error(string)");
}
if (key === "Panic(uint256)") {
return ErrorFragment.fromString("error Panic(uint256)");
return ErrorFragment.from("error Panic(uint256)");
}
const result = this.#errors.get(key);
if (result) {
@ -8748,7 +8767,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string {
eventFragment.inputs.forEach((param, index) => {
if (param.indexed) {
if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") {
indexed.push(ParamType.fromObject({ type: "bytes32", name: param.name }));
indexed.push(ParamType.from({ type: "bytes32", name: param.name }));
dynamic.push(true);
}
else {
@ -14822,6 +14841,7 @@ class SocketProvider extends JsonRpcApiProvider {
}
class WebSocketProvider extends SocketProvider {
#connect;
#websocket;
get websocket() {
if (this.#websocket == null) {
@ -14832,14 +14852,21 @@ class WebSocketProvider extends SocketProvider {
constructor(url, network) {
super(network);
if (typeof (url) === "string") {
this.#websocket = new _WebSocket(url);
this.#connect = () => { return new _WebSocket(url); };
this.#websocket = this.#connect();
}
else if (typeof (url) === "function") {
this.#connect = url;
this.#websocket = url();
}
else {
this.#connect = null;
this.#websocket = url;
}
this.websocket.onopen = async () => {
try {
await this._start();
this.resume();
}
catch (error) {
console.log("failed to start WebsocketProvider", error);
@ -14849,6 +14876,21 @@ class WebSocketProvider extends SocketProvider {
this.websocket.onmessage = (message) => {
this._processMessage(message.data);
};
/*
this.websocket.onclose = (event) => {
// @TODO: What event.code should we reconnect on?
const reconnect = false;
if (reconnect) {
this.pause(true);
if (this.#connect) {
this.#websocket = this.#connect();
this.#websocket.onopen = ...
// @TODO: this requires the super class to rebroadcast; move it there
}
this._reconnect();
}
};
*/
}
async _write(message) {
this.websocket.send(message);
@ -17528,8 +17570,8 @@ class WordlistOwlA extends WordlistOwl {
var ethers = /*#__PURE__*/Object.freeze({
__proto__: null,
version: version,
formatBytes32String: formatBytes32String,
parseBytes32String: parseBytes32String,
decodeBytes32String: decodeBytes32String,
encodeBytes32String: encodeBytes32String,
AbiCoder: AbiCoder,
defaultAbiCoder: defaultAbiCoder,
ConstructorFragment: ConstructorFragment,
@ -17682,5 +17724,5 @@ var ethers = /*#__PURE__*/Object.freeze({
WordlistOwlA: WordlistOwlA
});
export { AbiCoder, AbstractProvider, AlchemyProvider, AnkrProvider, BaseContract, CloudflareProvider, ConstructorFragment, Contract, ContractEventPayload, ContractFactory, ContractTransactionReceipt, ContractTransactionResponse, ErrorFragment, EtherSymbol, EtherscanProvider, EventFragment, EventLog, FallbackProvider, FetchCancelSignal, FetchRequest, FetchResponse, FixedFormat, FixedNumber, Fragment, FunctionFragment, HDNodeVoidWallet, HDNodeWallet, HDNodeWalletManager, Indexed, InfuraProvider, Interface, IpcSocketProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, LangEn, LogDescription, MaxInt256, MaxUint256, MessagePrefix, MinInt256, Mnemonic, N$1 as N, NegativeOne, Network, One, ParamType, Result, Signature, SigningKey, SocketProvider, Transaction, TransactionDescription, Two, Typed, TypedDataEncoder, Utf8ErrorFuncs, Wallet, WebSocketProvider, WeiPerEther, Wordlist, WordlistOwl, WordlistOwlA, Zero, ZeroAddress, ZeroHash, _toEscapedUtf8String, accessListify, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, checkResultErrors, computeAddress, computeHmac, concat, dataLength, dataSlice, decodeBase58, decodeBase64, decodeRlp, decryptCrowdsaleJson, decryptKeystoreJson, decryptKeystoreJsonSync, defaultAbiCoder, defaultPath$1 as defaultPath, dnsEncode, encodeBase58, encodeBase64, encodeRlp, encryptKeystoreJson, ethers, formatBytes32String, formatEther, formatFixed, formatUnits, fromTwos, getAccountPath, getAddress, getBigInt, getBytes, getBytesCopy, getCreate2Address, getCreateAddress, getIcapAddress, getIpfsGatewayFunc, getNumber, hashMessage, hexlify, id, isBytesLike, isCallException, isCrowdsaleJson, isError, isHexString, isKeystoreJson, isValidName, keccak256, langEn, lock, makeError, mask, namehash, parseBytes32String, parseEther, parseFixed, parseUnits, pbkdf2, randomBytes, recoverAddress, ripemd160, scrypt, scryptSync, sha256, sha512, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, stripZerosLeft, throwArgumentError, throwError, toArray, toBigInt, toHex, toNumber, toQuantity, toTwos, toUtf8Bytes, toUtf8CodePoints, toUtf8String, version, wordlists, zeroPadBytes, zeroPadValue };
export { AbiCoder, AbstractProvider, AlchemyProvider, AnkrProvider, BaseContract, CloudflareProvider, ConstructorFragment, Contract, ContractEventPayload, ContractFactory, ContractTransactionReceipt, ContractTransactionResponse, ErrorFragment, EtherSymbol, EtherscanProvider, EventFragment, EventLog, FallbackProvider, FetchCancelSignal, FetchRequest, FetchResponse, FixedFormat, FixedNumber, Fragment, FunctionFragment, HDNodeVoidWallet, HDNodeWallet, HDNodeWalletManager, Indexed, InfuraProvider, Interface, IpcSocketProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, LangEn, LogDescription, MaxInt256, MaxUint256, MessagePrefix, MinInt256, Mnemonic, N$1 as N, NegativeOne, Network, One, ParamType, Result, Signature, SigningKey, SocketProvider, Transaction, TransactionDescription, Two, Typed, TypedDataEncoder, Utf8ErrorFuncs, Wallet, WebSocketProvider, WeiPerEther, Wordlist, WordlistOwl, WordlistOwlA, Zero, ZeroAddress, ZeroHash, _toEscapedUtf8String, accessListify, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, checkResultErrors, computeAddress, computeHmac, concat, dataLength, dataSlice, decodeBase58, decodeBase64, decodeBytes32String, decodeRlp, decryptCrowdsaleJson, decryptKeystoreJson, decryptKeystoreJsonSync, defaultAbiCoder, defaultPath$1 as defaultPath, dnsEncode, encodeBase58, encodeBase64, encodeBytes32String, encodeRlp, encryptKeystoreJson, ethers, formatEther, formatFixed, formatUnits, fromTwos, getAccountPath, getAddress, getBigInt, getBytes, getBytesCopy, getCreate2Address, getCreateAddress, getIcapAddress, getIpfsGatewayFunc, getNumber, hashMessage, hexlify, id, isBytesLike, isCallException, isCrowdsaleJson, isError, isHexString, isKeystoreJson, isValidName, keccak256, langEn, lock, makeError, mask, namehash, parseEther, parseFixed, parseUnits, pbkdf2, randomBytes, recoverAddress, ripemd160, scrypt, scryptSync, sha256, sha512, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, stripZerosLeft, throwArgumentError, throwError, toArray, toBigInt, toHex, toNumber, toQuantity, toTwos, toUtf8Bytes, toUtf8CodePoints, toUtf8String, version, wordlists, zeroPadBytes, zeroPadValue };
//# sourceMappingURL=ethers.js.map

2
dist/ethers.js.map vendored

File diff suppressed because one or more lines are too long

2
dist/ethers.min.js vendored

File diff suppressed because one or more lines are too long

@ -145,7 +145,7 @@ const u64 = {
add, add3L, add3H, add4L, add4H, add5H, add5L,
};
const version = "6.0.0-beta-exports.3";
const version = "6.0.0-beta-exports.4";
function defineReadOnly(object, name, value) {
Object.defineProperty(object, name, {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -43,4 +43,68 @@ describe("Tests ABI Coder", function () {
});
}
});
describe("Test Bytes32 strings", function () {
it("encodes and decodes Bytes32 strings @TODO: exapnd", function () {
const str = "ricmoo.firefly.eth";
const bytes32 = (0, index_js_1.encodeBytes32String)(str);
const str2 = (0, index_js_1.decodeBytes32String)(bytes32);
assert_1.default.equal(bytes32, '0x7269636d6f6f2e66697265666c792e6574680000000000000000000000000000', 'formatted correctly');
assert_1.default.equal(str2, str, "parsed correctly");
});
});
describe("Test Interface", function () {
const iface = new index_js_1.Interface([
"function balanceOf(address owner) returns (uint)",
"event Transfer(address indexed from, address indexed to, uint amount)"
]);
it("does interface stuff; @TODO expand this", function () {
const addr = "0x8ba1f109551bD432803012645Ac136ddd64DBA72";
const addr2 = "0xAC1639CF97a3A46D431e6d1216f576622894cBB5";
const data = iface.encodeFunctionData("balanceOf", [addr]);
assert_1.default.equal(data, "0x70a082310000000000000000000000008ba1f109551bd432803012645ac136ddd64dba72", "encoded");
const decoded = iface.decodeFunctionData("balanceOf", data);
assert_1.default.equal(decoded.length, 1, "decoded.length");
assert_1.default.equal(decoded[0], addr, "decoded[0]");
const tx = iface.parseTransaction({ data, value: 10 });
assert_1.default.ok(tx != null, "tx == null");
assert_1.default.equal(tx.name, "balanceOf", "tx.balanceOf");
assert_1.default.equal(tx.signature, "balanceOf(address)", "tx.balanceOf");
assert_1.default.equal(tx.args.length, 1, "tx.args.length");
assert_1.default.equal(tx.args[0], addr, "tx.args[0]");
assert_1.default.equal(tx.selector, "0x70a08231", "tx.selector");
assert_1.default.equal(tx.value, BigInt(10), "tx.value");
const result = iface.encodeFunctionResult("balanceOf", [123]);
assert_1.default.equal(result, "0x000000000000000000000000000000000000000000000000000000000000007b", "result");
const value = iface.decodeFunctionResult("balanceOf", result);
assert_1.default.equal(value.length, 1, "result.length");
assert_1.default.equal(value[0], BigInt(123), "result.value[0]");
// @TODO: parseResult
const filter = iface.encodeFilterTopics("Transfer", [addr, addr2]);
assert_1.default.equal(filter.length, 3);
assert_1.default.equal(filter[0], "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef");
assert_1.default.equal(filter[1], "0x0000000000000000000000008ba1f109551bd432803012645ac136ddd64dba72");
assert_1.default.equal(filter[2], "0x000000000000000000000000ac1639cf97a3a46d431e6d1216f576622894cbb5");
const eventLog = iface.encodeEventLog("Transfer", [addr, addr2, 234]);
assert_1.default.equal(eventLog.data, "0x00000000000000000000000000000000000000000000000000000000000000ea");
assert_1.default.deepEqual(eventLog.topics, [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000008ba1f109551bd432803012645ac136ddd64dba72",
"0x000000000000000000000000ac1639cf97a3a46d431e6d1216f576622894cbb5"
]);
const values = iface.decodeEventLog("Transfer", eventLog.data, eventLog.topics);
assert_1.default.equal(values.length, 3);
assert_1.default.equal(values[0], addr);
assert_1.default.equal(values[1], addr2);
assert_1.default.equal(values[2], BigInt(234));
const log = iface.parseLog(eventLog);
assert_1.default.ok(log != null);
assert_1.default.equal(log.name, "Transfer");
assert_1.default.equal(log.signature, "Transfer(address,address,uint256)");
assert_1.default.equal(log.topic, "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef");
assert_1.default.equal(log.args.length, 3);
assert_1.default.equal(log.args[0], "0x8ba1f109551bD432803012645Ac136ddd64DBA72");
assert_1.default.equal(log.args[1], "0xAC1639CF97a3A46D431e6d1216f576622894cBB5");
assert_1.default.equal(log.args[2], BigInt(234));
});
});
//# sourceMappingURL=test-abi.js.map

File diff suppressed because one or more lines are too long

@ -1,4 +1,20 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const assert_1 = __importDefault(require("assert"));
const create_provider_js_1 = require("./create-provider.js");
const index_js_1 = require("../index.js");
describe("Test Contract", function () {
it("tests contract @TODO: expand", async function () {
const provider = (0, create_provider_js_1.connect)("mainnet");
const contract = new index_js_1.Contract("dai.tokens.ethers.eth", [
"function balanceOf(address) view returns (uint)"
], provider);
assert_1.default.equal(await contract.balanceOf("ricmoo.firefly.eth"), BigInt("6015089439794538201631"));
});
});
/*
import { Typed } from "../abi/index.js";
import * as providers from "../providers/index.js";

@ -1 +1 @@
{"version":3,"file":"test-contract.js","sourceRoot":"","sources":["../../src.ts/_tests/test-contract.ts"],"names":[],"mappings":";AAAA;;;;;;;EAOE;AACF,4DAA4D;AAC5D,4DAA4D;AAE5D;;;;EAIE;AAEF,QAAQ;AACR;;;;;;;;;;;;;EAaE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDE;AACF;;;;;;;;;;EAUE"}
{"version":3,"file":"test-contract.js","sourceRoot":"","sources":["../../src.ts/_tests/test-contract.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,6DAA+C;AAE/C,0CAAuC;AAGvC,QAAQ,CAAC,eAAe,EAAE;IACtB,EAAE,CAAC,8BAA8B,EAAE,KAAK;QACpC,MAAM,QAAQ,GAAG,IAAA,4BAAO,EAAC,SAAS,CAAC,CAAC;QAEpC,MAAM,QAAQ,GAAG,IAAI,mBAAQ,CAAC,uBAAuB,EAAE;YACnD,iDAAiD;SACpD,EAAE,QAAQ,CAAC,CAAC;QAEb,gBAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,SAAS,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC;IACnG,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH;;;;;;;EAOE;AACF,4DAA4D;AAC5D,4DAA4D;AAE5D;;;;EAIE;AAEF,QAAQ;AACR;;;;;;;;;;;;;EAaE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDE;AACF;;;;;;;;;;EAUE"}

@ -62,15 +62,29 @@ describe("test registration", function () {
hijackTag: 'hijacked computeHmac: ["sha256",{},{}]',
algorithm: index_js_1.computeHmac
},
{
name: "randomBytes",
params: [32],
hijackTag: "hijacked randomBytes: [32]",
algorithm: index_js_1.randomBytes,
postCheck: (value) => {
return (value instanceof Uint8Array && value.length === 32);
}
}
];
tests.forEach(({ name, params, hijackTag, algorithm }) => {
tests.forEach(({ name, params, hijackTag, algorithm, postCheck }) => {
it(`swaps in hijacked callback: ${name}`, async function () {
const initial = await algorithm(...params);
algorithm.register(getHijack(name));
assert_1.default.equal(await algorithm(...params), "0x42");
assert_1.default.equal(hijack, hijackTag);
algorithm.register(algorithm._);
assert_1.default.equal(await algorithm(...params), initial);
if (postCheck) {
assert_1.default.ok(postCheck(await algorithm(...params)));
}
else {
assert_1.default.equal(await algorithm(...params), initial);
}
});
});
it("prevents swapping after locked", function () {

@ -1 +1 @@
{"version":3,"file":"test-crypto-algoswap.js","sourceRoot":"","sources":["../../src.ts/_tests/test-crypto-algoswap.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAQqB;AAkBrB,QAAQ,CAAC,mBAAmB,EAAE;IAE1B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,SAAS,SAAS,CAAC,IAAY;QAC3B,OAAO,UAAS,GAAG,IAAgB;YAC/B,MAAM,GAAG,YAAa,IAAK,KAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAE,EAAE,CAAC;YACzD,OAAO,MAAM,CAAC;QAClB,CAAC,CAAA;IACL,CAAC;IAED,MAAM,KAAK,GAAoB;QAC3B;YACI,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,CAAE,IAAI,CAAE;YAChB,SAAS,EAAE,0BAA0B;YACrC,SAAS,EAAE,oBAAS;SACvB;QACD;YACI,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,CAAE,IAAI,CAAE;YAChB,SAAS,EAAE,uBAAuB;YAClC,SAAS,EAAE,iBAAM;SACpB;QACD;YACI,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,CAAE,IAAI,CAAE;YAChB,SAAS,EAAE,uBAAuB;YAClC,SAAS,EAAE,iBAAM;SACpB;QACD;YACI,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,CAAE,IAAI,CAAE;YAChB,SAAS,EAAE,0BAA0B;YACrC,SAAS,EAAE,oBAAS;SACvB;QACD;YACI,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,CAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,CAAE;YAC1C,SAAS,EAAE,2CAA2C;YACtD,SAAS,EAAE,iBAAM;SACpB;QACD;YACI,IAAI,EAAE,YAAY;YAClB,MAAM,EAAE,CAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAE;YACtC,SAAS,EAAE,0CAA0C;Y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AG,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;YACjD,gBAAM,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;YAEhC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAChC,IAAI,SAAS,EAAE;gBACX,gBAAM,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,SAAS,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;aACpD;iBAAM;gBACH,gBAAM,CAAC,KAAK,CAAC,MAAM,SAAS,CAAC,GAAG,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;aACrD;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE;QACjC,IAAA,eAAI,GAAE,CAAC;QAEP,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE;YACrD,gBAAM,CAAC,MAAM,CAAC;gBACV,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;YAC1C,CAAC,EAAE,UAAS,KAAU;gBAClB,OAAO,CAAC,KAAK,CAAC,OAAO,KAAK,GAAI,IAAK,YAAY,CAAC,CAAC;YACrD,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AAEP,CAAC,CAAC,CAAC"}

@ -79,141 +79,4 @@ describe("test hmac", function () {
});
});
});
/*
describe("test registration", function() {
let hijack = "";
function getHijack(algo: string) {
return function(...args: Array<any>) {
hijack = `hijacked ${ algo }: ${ JSON.stringify(args) }`;
return "0x42";
}
}
it("hijacks keccak256", function() {
const initial = keccak256("0x");
keccak256.register(getHijack("kecak256"));
assert.equal(keccak256("0x"), "0x42");
assert.equal(hijack, 'hijacked kecak256: [{}]');
keccak256.register(keccak256._);
assert.equal(keccak256("0x"), initial);
keccak256.lock();
assert.throws(function() {
keccak256.register(getHijack("test"));
}, function(error) {
return (error.message === "keccak256 is locked");
});
});
it("hijacks sha256", function() {
const initial = sha256("0x");
sha256.register(getHijack("sha256"));
assert.equal(sha256("0x"), "0x42");
assert.equal(hijack, 'hijacked sha256: [{}]');
sha256.register(sha256._);
assert.equal(sha256("0x"), initial);
sha256.lock();
assert.throws(function() {
sha256.register(getHijack("test"));
}, function(error) {
return (error.message === "sha256 is locked");
});
});
it("hijacks sha512", function() {
const initial = sha512("0x");
sha512.register(getHijack("sha512"));
assert.equal(sha512("0x"), "0x42");
assert.equal(hijack, 'hijacked sha512: [{}]');
sha512.register(sha512._);
assert.equal(sha512("0x"), initial);
sha512.lock();
assert.throws(function() {
sha512.register(getHijack("test"));
}, function(error) {
return (error.message === "sha512 is locked");
});
});
it("hijacks pbkdf2", function() {
const initial = pbkdf2("0x", "0x", 1024, 32, "sha256");
pbkdf2.register(getHijack("pbkdf2"));
assert.equal(pbkdf2("0x", "0x", 1024, 32, "sha256"), "0x42");
assert.equal(hijack, 'hijacked pbkdf2: [{},{},1024,32,"sha256"]');
pbkdf2.register(pbkdf2._);
assert.equal(pbkdf2("0x", "0x", 1024, 32, "sha256"), initial);
pbkdf2.lock();
assert.throws(function() {
pbkdf2.register(getHijack("test"));
}, function(error) {
return (error.message === "pbkdf2 is locked");
});
});
it("hijacks scryptSync", function() {
function getHijack(...args: Array<any>) {
hijack = `hijacked scryptSync: ${ JSON.stringify(args) }`;
return new Uint8Array([ 0x42 ]);
}
const initial = scryptSync("0x", "0x", 1024, 8, 1, 32);
scryptSync.register(getHijack);
assert.equal(scryptSync("0x", "0x", 1024, 8, 1, 32), "0x42");
assert.equal(hijack, 'hijacked scryptSync: [{},{},1024,8,1,32]');
scryptSync.register(scryptSync._);
assert.equal(scryptSync("0x", "0x", 1024, 8, 1, 32), initial);
scryptSync.lock();
assert.throws(function() {
scryptSync.register(getHijack);
}, function(error) {
return (error.message === "scryptSync is locked");
});
});
it("hijacks scrypt", async function() {
function getHijack(...args: Array<any>) {
hijack = `hijacked scrypt: ${ JSON.stringify(args) }`;
return Promise.resolve(new Uint8Array([ 0x42 ]));
}
const initial = await scrypt("0x", "0x", 1024, 8, 1, 32);
scrypt.register(getHijack);
assert.equal(await scrypt("0x", "0x", 1024, 8, 1, 32), "0x42");
assert.equal(hijack, 'hijacked scrypt: [{},{},1024,8,1,32,null]');
scrypt.register(scrypt._);
assert.equal(await scrypt("0x", "0x", 1024, 8, 1, 32), initial);
scrypt.lock();
assert.throws(function() {
scrypt.register(getHijack);
}, function(error) {
return (error.message === "scrypt is locked");
});
});
});
*/
//# sourceMappingURL=test-crypto.js.map

@ -1 +1 @@
{"version":3,"file":"test-crypto.js","sourceRoot":"","sources":["../../src.ts/_tests/test-crypto.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,yCAAuC;AAIvC,0CAIqB;AAGrB,QAAQ,CAAC,cAAc,EAAE;IACrB,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAe,QAAQ,CAAC,CAAC;IAEhD,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACnB,EAAE,CAAC,sBAAuB,IAAI,CAAC,IAAK,EAAE,EAAE;YACpC,gBAAM,CAAC,KAAK,CAAC,IAAA,iBAAM,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACnB,EAAE,CAAC,sBAAuB,IAAI,CAAC,IAAK,EAAE,EAAE;YACpC,gBAAM,CAAC,KAAK,CAAC,IAAA,iBAAM,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACnB,E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EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAC1E,IAAI,QAAQ,GAAG,YAAY,EAAE;oBAAE,UAAU,GAAG,KAAK,CAAC;iBAAE;gBACpD,YAAY,GAAG,QAAQ,CAAC;gBACxB,aAAa,EAAE,CAAC;YACpB,CAAC,CAAC,CAAC;YAEH,gBAAM,CAAC,EAAE,CAAC,UAAU,EAAE,2CAA2C,CAAC,CAAC;YACnE,gBAAM,CAAC,EAAE,CAAC,aAAa,GAAG,GAAG,EAAE,gDAAgD,CAAC,CAAC;YACjF,gBAAM,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AAEP,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,WAAW,EAAE;IAClB,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAe,MAAM,CAAC,CAAC;IAE9C,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACnB,EAAE,CAAC,kBAAmB,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK;YACpC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;YACtC,gBAAM,CAAC,KAAK,CAAC,IAAA,sBAAW,EAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}

@ -1,8 +1,12 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const assert_1 = __importDefault(require("assert"));
const index_js_1 = require("../index.js");
const utils_js_1 = require("./utils.js");
/*
import assert from "assert";
import { loadTests } from "./utils.js"
import type { TestCaseNamehash } from "./types.js";
import { dnsEncode, isValidName, namehash } from "../index.js";
@ -109,4 +113,41 @@ describe("Tests DNS Names", function() {
});
*/
describe("Test EIP-191 Personal Message Hash", function () {
const tests = [
{
test: "hello-world",
message: "Hello World",
hash: "0xa1de988600a42c4b4ab089b619297c17d53cffae5d5120d82d8a92d0bb3b78f2"
},
{
test: "binary-message",
message: new Uint8Array([0x42, 0x43]),
hash: "0x0d3abc18ec299cf9b42ba439ac6f7e3e6ec9f5c048943704e30fc2d9c7981438"
},
{
test: "hex-looking-string",
message: "0x4243",
hash: "0x6d91b221f765224b256762dcba32d62209cf78e9bebb0a1b758ca26c76db3af4"
}
];
for (const test of tests) {
it(`tests hashMessage: ${test.test}`, function () {
assert_1.default.equal((0, index_js_1.hashMessage)(test.message), test.hash);
});
}
});
describe("Test Solidity Hash functions", function () {
const tests = (0, utils_js_1.loadTests)("solidity-hashes");
for (const test of tests) {
it(`computes the solidity keccak256: ${test.name}`, function () {
assert_1.default.equal((0, index_js_1.solidityPackedKeccak256)(test.types, test.values), test.keccak256);
});
}
for (const test of tests) {
it(`computes the solidity sha256: ${test.name}`, function () {
assert_1.default.equal((0, index_js_1.solidityPackedSha256)(test.types, test.values), test.sha256);
});
}
});
//# sourceMappingURL=test-hash.js.map

@ -1 +1 @@
{"version":3,"file":"test-hash.js","sourceRoot":"","sources":["../../src.ts/_tests/test-hash.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6GE"}
{"version":3,"file":"test-hash.js","sourceRoot":"","sources":["../../src.ts/_tests/test-hash.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAGqB;AAErB,yCAAsC;AAItC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAC,MAAM,CAAC,CAAC;QAC7E,CAAC,CAAC,CAAC;KACN;AACL,CAAC,CAAC,CAAA"}

@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
const assert_1 = __importDefault(require("assert"));
const create_provider_js_1 = require("./create-provider.js");
const utils_js_1 = require("./utils.js");
const blockchain_data_js_1 = require("./blockchain-data.js");
function forEach(prefix, tests, func) {
for (const networkName of blockchain_data_js_1.networkNames) {
@ -23,7 +24,7 @@ function forEach(prefix, tests, func) {
continue;
}
// Prepare the testcase
it(`${prefix}: ${providerName}:${networkName}.${test.test}`, async function () {
(0, utils_js_1.retryIt)(`Foo ${prefix}: ${providerName}:${networkName}.${test.test}`, async function () {
// Create a provider
const provider = (0, create_provider_js_1.getProvider)(providerName, networkName);
try {

File diff suppressed because one or more lines are too long

@ -0,0 +1,17 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const assert_1 = __importDefault(require("assert"));
const index_js_1 = require("../index.js");
const utils_js_1 = require("./utils.js");
describe("Test Etherscan extra APIs", function () {
(0, utils_js_1.retryIt)("test etherscanProvider.getContract", async function () {
const provider = new index_js_1.EtherscanProvider("mainnet", "FPFGK6JSW2UHJJ2666FG93KP7WC999MNW7");
const contract = await provider.getContract("dai.tokens.ethers.eth");
assert_1.default.ok(contract != null, "contract == null");
assert_1.default.equal(await contract.symbol(), "DAI", "contract.symbol");
});
});
//# sourceMappingURL=test-providers-extra.js.map

@ -0,0 +1 @@
{"version":3,"file":"test-providers-extra.js","sourceRoot":"","sources":["../../src.ts/_tests/test-providers-extra.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAAgD;AAEhD,yCAAqC;AAGrC,QAAQ,CAAC,2BAA2B,EAAE;IAClC,IAAA,kBAAO,EAAC,oCAAoC,EAAE,KAAK;QAC/C,MAAM,QAAQ,GAAG,IAAI,4BAAiB,CAAC,SAAS,EAAE,oCAAoC,CAAC,CAAC;QACxF,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;QACrE,gBAAM,CAAC,EAAE,CAAC,QAAQ,IAAI,IAAI,EAAE,kBAAkB,CAAC,CAAC;QAChD,gBAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}

@ -0,0 +1,31 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const assert_1 = __importDefault(require("assert"));
const index_js_1 = require("../index.js");
describe("Base64 Coding", function () {
const tests = [
{
name: "wikipedia",
plaintext: (0, index_js_1.toUtf8Bytes)("Many hands make light work."),
encoded: "TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcmsu"
}
];
for (const test of tests) {
it(`encodes base64: ${test.name}`, function () {
assert_1.default.equal((0, index_js_1.encodeBase64)(test.plaintext), test.encoded);
});
}
for (const test of tests) {
it(`decodes base64: ${test.name}`, function () {
const decoded = (0, index_js_1.decodeBase64)(test.encoded);
assert_1.default.equal(decoded.length, test.plaintext.length, "data.length");
for (let i = 0; i < decoded.length; i++) {
assert_1.default.equal(decoded[i], test.plaintext[i]);
}
});
}
});
//# sourceMappingURL=test-utils-misc.js.map

@ -0,0 +1 @@
{"version":3,"file":"test-utils-misc.js","sourceRoot":"","sources":["../../src.ts/_tests/test-utils-misc.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAGqB;AAGrB,QAAQ,CAAC,eAAe,EAAE;IACtB,MAAM,KAAK,GAAG;QACV;YACI,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE,IAAA,sBAAW,EAAC,6BAA6B,CAAC;YACrD,OAAO,EAAE,sCAAsC;SAClD;KACJ,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,mBAAoB,IAAI,CAAC,IAAK,EAAE,EAAE;YACjC,gBAAM,CAAC,KAAK,CAAC,IAAA,uBAAY,EAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;KACN;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,mBAAoB,IAAI,CAAC,IAAK,EAAE,EAAE;YACjC,MAAM,OAAO,GAAG,IAAA,uBAAY,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3C,gBAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;YACnE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACrC,gBAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;aAC/C;QACL,CAAC,CAAC,CAAC;KACN;AACL,CAAC,CAAC,CAAA"}

@ -1 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src.ts/_tests/types.ts"],"names":[],"mappings":";;AAiOC,CAAC"}
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src.ts/_tests/types.ts"],"names":[],"mappings":";;AAyOC,CAAC"}

@ -1,5 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = void 0;
exports.version = "6.0.0-beta-exports.3";
exports.version = "6.0.0-beta-exports.4";
//# sourceMappingURL=_version.js.map

@ -1,8 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseBytes32String = exports.formatBytes32String = void 0;
exports.decodeBytes32String = exports.encodeBytes32String = void 0;
const index_js_1 = require("../utils/index.js");
function formatBytes32String(text) {
function encodeBytes32String(text) {
// Get the bytes
const bytes = (0, index_js_1.toUtf8Bytes)(text);
// Check we have room for null-termination
@ -12,8 +12,8 @@ function formatBytes32String(text) {
// Zero-pad (implicitly null-terminates)
return (0, index_js_1.zeroPadBytes)(bytes, 32);
}
exports.formatBytes32String = formatBytes32String;
function parseBytes32String(_bytes) {
exports.encodeBytes32String = encodeBytes32String;
function decodeBytes32String(_bytes) {
const data = (0, index_js_1.getBytes)(_bytes, "bytes");
// Must be 32 bytes with a null-termination
if (data.length !== 32) {
@ -30,5 +30,5 @@ function parseBytes32String(_bytes) {
// Determine the string value
return (0, index_js_1.toUtf8String)(data.slice(0, length));
}
exports.parseBytes32String = parseBytes32String;
exports.decodeBytes32String = decodeBytes32String;
//# sourceMappingURL=bytes32.js.map

@ -1 +1 @@
{"version":3,"file":"bytes32.js","sourceRoot":"","sources":["../../src.ts/abi/bytes32.ts"],"names":[],"mappings":";;;AACA,gDAE2B;AAK3B,SAAgB,mBAAmB,CAAC,IAAY;IAE5C,gBAAgB;IAChB,MAAM,KAAK,GAAG,IAAA,sBAAW,EAAC,IAAI,CAAC,CAAC;IAEhC,0CAA0C;IAC1C,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAAE;IAExF,wCAAwC;IACxC,OAAO,IAAA,uBAAY,EAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC;AAVD,kDAUC;AAED,SAAgB,kBAAkB,CAAC,MAAiB;IAChD,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvC,2CAA2C;IAC3C,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KAAE;IACnF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MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,CAAC;KAAE;IAE5C,6BAA6B;IAC7B,OAAO,IAAA,uBAAY,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/C,CAAC;AAbD,kDAaC"}

@ -281,7 +281,7 @@ function consumeMutability(tokens) {
}
// ...a parameter list, returning the ParamType list
function consumeParams(tokens, allowIndexed) {
return tokens.popParams().map((t) => ParamType.fromTokens(t, allowIndexed));
return tokens.popParams().map((t) => ParamType.from(t, allowIndexed));
}
// ...a gas limit, returning a BigNumber or null if none
function consumeGas(tokens) {
@ -331,6 +331,11 @@ function verifyBasicType(type) {
const _guard = {};
const internal = Symbol.for("_ethers_internal");
const ParamTypeInternal = "_ParamTypeInternal";
const ErrorFragmentInternal = "_ErrorInternal";
const EventFragmentInternal = "_EventInternal";
const ConstructorFragmentInternal = "_ConstructorInternal";
const FunctionFragmentInternal = "_FunctionInternal";
const StructFragmentInternal = "_StructInternal";
class ParamType {
// The local name of the parameter (of "" if unbound)
name;
@ -528,10 +533,46 @@ class ParamType {
return obj;
}
if (typeof (obj) === "string") {
return ParamType.fromTokens(lex(obj), allowIndexed);
return ParamType.from(lex(obj), allowIndexed);
}
if (obj instanceof TokenString) {
return ParamType.fromTokens(obj, allowIndexed);
else if (obj instanceof TokenString) {
let type = "", baseType = "";
let comps = null;
if (consumeKeywords(obj, setify(["tuple"])).has("tuple") || obj.peekType("OPEN_PAREN")) {
// Tuple
baseType = "tuple";
comps = obj.popParams().map((t) => ParamType.from(t));
type = `tuple(${comps.map((c) => c.format()).join(",")})`;
}
else {
// Normal
type = verifyBasicType(obj.popType("TYPE"));
baseType = type;
}
// Check for Array
let arrayChildren = null;
let arrayLength = null;
while (obj.length && obj.peekType("BRACKET")) {
const bracket = obj.pop(); //arrays[i];
arrayChildren = new ParamType(_guard, "", type, baseType, null, comps, arrayLength, arrayChildren);
arrayLength = bracket.value;
type += bracket.text;
baseType = "array";
comps = null;
}
let indexed = null;
const keywords = consumeKeywords(obj, KwModifiers);
if (keywords.has("indexed")) {
if (!allowIndexed) {
throw new Error("");
}
indexed = true;
}
const name = (obj.peekType("ID") ? obj.pop().text : "");
if (obj.length) {
throw new Error("leftover tokens");
}
return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren);
}
const name = obj.name;
if (name && (typeof (name) !== "string" || !name.match(regexIdentifier))) {
@ -563,48 +604,6 @@ class ParamType {
type = verifyBasicType(obj.type);
return new ParamType(_guard, name, type, type, indexed, null, null, null);
}
static fromObject(obj, allowIndexed) {
throw new Error("@TODO");
}
static fromTokens(tokens, allowIndexed) {
let type = "", baseType = "";
let comps = null;
if (consumeKeywords(tokens, setify(["tuple"])).has("tuple") || tokens.peekType("OPEN_PAREN")) {
// Tuple
baseType = "tuple";
comps = tokens.popParams().map((t) => ParamType.from(t));
type = `tuple(${comps.map((c) => c.format()).join(",")})`;
}
else {
// Normal
type = verifyBasicType(tokens.popType("TYPE"));
baseType = type;
}
// Check for Array
let arrayChildren = null;
let arrayLength = null;
while (tokens.length && tokens.peekType("BRACKET")) {
const bracket = tokens.pop(); //arrays[i];
arrayChildren = new ParamType(_guard, "", type, baseType, null, comps, arrayLength, arrayChildren);
arrayLength = bracket.value;
type += bracket.text;
baseType = "array";
comps = null;
}
let indexed = null;
const keywords = consumeKeywords(tokens, KwModifiers);
if (keywords.has("indexed")) {
if (!allowIndexed) {
throw new Error("");
}
indexed = true;
}
const name = (tokens.peekType("ID") ? tokens.pop().text : "");
if (tokens.length) {
throw new Error("leftover tokens");
}
return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren);
}
static isParamType(value) {
return (value && value[internal] === ParamTypeInternal);
}
@ -620,76 +619,49 @@ class Fragment {
}
static from(obj) {
if (typeof (obj) === "string") {
return this.fromString(obj);
try {
Fragment.from(JSON.parse(obj));
}
catch (e) { }
return Fragment.from(lex(obj));
}
if (obj instanceof TokenString) {
return this.fromTokens(obj);
const type = obj.popKeyword(KwTypes);
switch (type) {
case "constructor": return ConstructorFragment.from(obj);
case "error": return ErrorFragment.from(obj);
case "event": return EventFragment.from(obj);
case "function": return FunctionFragment.from(obj);
case "struct": return StructFragment.from(obj);
}
throw new Error(`unsupported type: ${type}`);
}
if (typeof (obj) === "object") {
return this.fromObject(obj);
switch (obj.type) {
case "constructor": return ConstructorFragment.from(obj);
case "error": return ErrorFragment.from(obj);
case "event": return EventFragment.from(obj);
case "function": return FunctionFragment.from(obj);
case "struct": return StructFragment.from(obj);
}
throw new Error(`not implemented yet: ${obj.type}`);
}
throw new Error(`unsupported type: ${obj}`);
}
static fromObject(obj) {
switch (obj.type) {
case "constructor": return ConstructorFragment.fromObject(obj);
case "error": return ErrorFragment.fromObject(obj);
case "event": return EventFragment.fromObject(obj);
case "function": return FunctionFragment.fromObject(obj);
case "struct": return StructFragment.fromObject(obj);
}
throw new Error(`not implemented yet: ${obj.type}`);
}
static fromString(text) {
try {
Fragment.from(JSON.parse(text));
}
catch (e) { }
return Fragment.fromTokens(lex(text));
}
static fromTokens(tokens) {
const type = tokens.popKeyword(KwTypes);
switch (type) {
case "constructor": return ConstructorFragment.fromTokens(tokens);
case "error": return ErrorFragment.fromTokens(tokens);
case "event": return EventFragment.fromTokens(tokens);
case "function": return FunctionFragment.fromTokens(tokens);
case "struct": return StructFragment.fromTokens(tokens);
}
throw new Error(`unsupported type: ${type}`);
}
/*
static fromTokens(tokens: TokenString): Fragment {
const assertDone = () => {
if (tokens.length) { throw new Error(`unexpected tokens: ${ tokens.toString() }`); }
});
const type = (tokens.length && tokens.peek().type === "KEYWORD") ? tokens.peek().text: "unknown";
const name = consumeName("error", tokens);
const inputs = consumeParams(tokens, type === "event");
switch (type) {
case "event": case "struct":
assertDone();
}
}
*/
static isConstructor(value) {
return (value && value.type === "constructor");
return ConstructorFragment.isFragment(value);
}
static isError(value) {
return (value && value.type === "error");
return ErrorFragment.isFragment(value);
}
static isEvent(value) {
return (value && value.type === "event");
return EventFragment.isFragment(value);
}
static isFunction(value) {
return (value && value.type === "function");
return FunctionFragment.isFragment(value);
}
static isStruct(value) {
return (value && value.type === "struct");
return StructFragment.isFragment(value);
}
}
exports.Fragment = Fragment;
@ -697,6 +669,9 @@ class NamedFragment extends Fragment {
name;
constructor(guard, type, name, inputs) {
super(guard, type, inputs);
if (typeof (name) !== "string" || !name.match(regexIdentifier)) {
(0, index_js_1.throwArgumentError)("invalid identifier", "name", name);
}
inputs = Object.freeze(inputs.slice());
(0, index_js_1.defineProperties)(this, { name });
}
@ -708,6 +683,7 @@ function joinParams(format, params) {
class ErrorFragment extends NamedFragment {
constructor(guard, name, inputs) {
super(guard, "error", name, inputs);
Object.defineProperty(this, internal, { value: ErrorFragmentInternal });
}
get selector() {
return (0, index_js_2.id)(this.format("sighash")).substring(0, 10);
@ -727,17 +703,23 @@ class ErrorFragment extends NamedFragment {
result.push(this.name + joinParams(format, this.inputs));
return result.join(" ");
}
static fromObject(obj) {
return new ErrorFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.fromObject) : []);
static from(obj) {
if (ErrorFragment.isFragment(obj)) {
return obj;
}
if (typeof (obj) === "string") {
return ErrorFragment.from(lex(obj));
}
else if (obj instanceof TokenString) {
const name = consumeName("error", obj);
const inputs = consumeParams(obj);
consumeEoi(obj);
return new ErrorFragment(_guard, name, inputs);
}
return new ErrorFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);
}
static fromString(text) {
return ErrorFragment.fromTokens(lex(text));
}
static fromTokens(tokens) {
const name = consumeName("error", tokens);
const inputs = consumeParams(tokens);
consumeEoi(tokens);
return new ErrorFragment(_guard, name, inputs);
static isFragment(value) {
return (value && value[internal] === ErrorFragmentInternal);
}
}
exports.ErrorFragment = ErrorFragment;
@ -745,6 +727,7 @@ class EventFragment extends NamedFragment {
anonymous;
constructor(guard, name, inputs, anonymous) {
super(guard, "event", name, inputs);
Object.defineProperty(this, internal, { value: EventFragmentInternal });
(0, index_js_1.defineProperties)(this, { anonymous });
}
get topicHash() {
@ -769,18 +752,24 @@ class EventFragment extends NamedFragment {
}
return result.join(" ");
}
static fromObject(obj) {
return new EventFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.fromObject) : [], !!obj.anonymous);
static from(obj) {
if (EventFragment.isFragment(obj)) {
return obj;
}
if (typeof (obj) === "string") {
return EventFragment.from(lex(obj));
}
else if (obj instanceof TokenString) {
const name = consumeName("event", obj);
const inputs = consumeParams(obj, true);
const anonymous = !!consumeKeywords(obj, setify(["anonymous"])).has("anonymous");
consumeEoi(obj);
return new EventFragment(_guard, name, inputs, anonymous);
}
return new EventFragment(_guard, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous);
}
static fromString(text) {
return EventFragment.fromTokens(lex(text));
}
static fromTokens(tokens) {
const name = consumeName("event", tokens);
const inputs = consumeParams(tokens, true);
const anonymous = !!consumeKeywords(tokens, setify(["anonymous"])).has("anonymous");
consumeEoi(tokens);
return new EventFragment(_guard, name, inputs, anonymous);
static isFragment(value) {
return (value && value[internal] === EventFragmentInternal);
}
}
exports.EventFragment = EventFragment;
@ -789,6 +778,7 @@ class ConstructorFragment extends Fragment {
gas;
constructor(guard, type, inputs, payable, gas) {
super(guard, type, inputs);
Object.defineProperty(this, internal, { value: ConstructorFragmentInternal });
(0, index_js_1.defineProperties)(this, { payable, gas });
}
format(format = "sighash") {
@ -813,19 +803,25 @@ class ConstructorFragment extends Fragment {
}
return result.join(" ");
}
static fromObject(obj) {
return new ConstructorFragment(_guard, "constructor", obj.inputs ? obj.inputs.map(ParamType.fromObject) : [], !!obj.payable, (obj.gas != null) ? obj.gas : null);
static from(obj) {
if (ConstructorFragment.isFragment(obj)) {
return obj;
}
if (typeof (obj) === "string") {
return ConstructorFragment.from(lex(obj));
}
else if (obj instanceof TokenString) {
consumeKeywords(obj, setify(["constructor"]));
const inputs = consumeParams(obj);
const payable = !!consumeKeywords(obj, setify(["payable"])).has("payable");
const gas = consumeGas(obj);
consumeEoi(obj);
return new ConstructorFragment(_guard, "constructor", inputs, payable, gas);
}
return new ConstructorFragment(_guard, "constructor", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, (obj.gas != null) ? obj.gas : null);
}
static fromString(text) {
return ConstructorFragment.fromTokens(lex(text));
}
static fromTokens(tokens) {
consumeKeywords(tokens, setify(["constructor"]));
const inputs = consumeParams(tokens);
const payable = !!consumeKeywords(tokens, setify(["payable"])).has("payable");
const gas = consumeGas(tokens);
consumeEoi(tokens);
return new ConstructorFragment(_guard, "constructor", inputs, payable, gas);
static isFragment(value) {
return (value && value[internal] === ConstructorFragmentInternal);
}
}
exports.ConstructorFragment = ConstructorFragment;
@ -837,6 +833,7 @@ class FunctionFragment extends NamedFragment {
gas;
constructor(guard, name, stateMutability, inputs, outputs, gas) {
super(guard, "function", name, inputs);
Object.defineProperty(this, internal, { value: FunctionFragmentInternal });
outputs = Object.freeze(outputs.slice());
const constant = (stateMutability === "view" || stateMutability === "pure");
const payable = (stateMutability === "payable");
@ -877,39 +874,55 @@ class FunctionFragment extends NamedFragment {
}
return result.join(" ");
}
static fromObject(obj) {
// @TODO: verifyState for stateMutability
return new FunctionFragment(_guard, obj.name, obj.stateMutability, obj.inputs ? obj.inputs.map(ParamType.fromObject) : [], obj.outputs ? obj.outputs.map(ParamType.fromObject) : [], (obj.gas != null) ? obj.gas : null);
}
static fromString(text) {
return FunctionFragment.fromTokens(lex(text));
}
static fromTokens(tokens) {
const name = consumeName("function", tokens);
const inputs = consumeParams(tokens);
const mutability = consumeMutability(tokens);
let outputs = [];
if (consumeKeywords(tokens, setify(["returns"])).has("returns")) {
outputs = consumeParams(tokens);
static from(obj) {
if (FunctionFragment.isFragment(obj)) {
return obj;
}
const gas = consumeGas(tokens);
consumeEoi(tokens);
return new FunctionFragment(_guard, name, mutability, inputs, outputs, gas);
if (typeof (obj) === "string") {
return FunctionFragment.from(lex(obj));
}
else if (obj instanceof TokenString) {
const name = consumeName("function", obj);
const inputs = consumeParams(obj);
const mutability = consumeMutability(obj);
let outputs = [];
if (consumeKeywords(obj, setify(["returns"])).has("returns")) {
outputs = consumeParams(obj);
}
const gas = consumeGas(obj);
consumeEoi(obj);
return new FunctionFragment(_guard, name, mutability, inputs, outputs, gas);
}
// @TODO: verifyState for stateMutability
return new FunctionFragment(_guard, obj.name, obj.stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], (obj.gas != null) ? obj.gas : null);
}
static isFragment(value) {
return (value && value[internal] === FunctionFragmentInternal);
}
}
exports.FunctionFragment = FunctionFragment;
class StructFragment extends NamedFragment {
constructor(guard, name, inputs) {
super(guard, "struct", name, inputs);
Object.defineProperty(this, internal, { value: StructFragmentInternal });
}
format() {
throw new Error("@TODO");
}
static fromString(text) {
return StructFragment.fromTokens(lex(text));
static from(obj) {
if (typeof (obj) === "string") {
return StructFragment.from(lex(obj));
}
else if (obj instanceof TokenString) {
const name = consumeName("struct", obj);
const inputs = consumeParams(obj);
consumeEoi(obj);
return new StructFragment(_guard, name, inputs);
}
return new StructFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);
}
static fromTokens(tokens) {
const name = consumeName("struct", tokens);
const inputs = consumeParams(tokens);
consumeEoi(tokens);
return new StructFragment(_guard, "struct", name, inputs);
static isFragment(value) {
return (value && value[internal] === StructFragmentInternal);
}
}
exports.StructFragment = StructFragment;

File diff suppressed because one or more lines are too long

@ -1,13 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Typed = exports.Result = exports.TransactionDescription = exports.LogDescription = exports.ErrorDescription = exports.Interface = exports.Indexed = exports.checkResultErrors = exports.StructFragment = exports.ParamType = exports.NamedFragment = exports.FunctionFragment = exports.Fragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.parseBytes32String = exports.formatBytes32String = exports.defaultAbiCoder = exports.AbiCoder = void 0;
exports.Typed = exports.Result = exports.TransactionDescription = exports.LogDescription = exports.ErrorDescription = exports.Interface = exports.Indexed = exports.checkResultErrors = exports.StructFragment = exports.ParamType = exports.NamedFragment = exports.FunctionFragment = exports.Fragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.encodeBytes32String = exports.decodeBytes32String = exports.defaultAbiCoder = exports.AbiCoder = void 0;
//////
var abi_coder_js_1 = require("./abi-coder.js");
Object.defineProperty(exports, "AbiCoder", { enumerable: true, get: function () { return abi_coder_js_1.AbiCoder; } });
Object.defineProperty(exports, "defaultAbiCoder", { enumerable: true, get: function () { return abi_coder_js_1.defaultAbiCoder; } });
var bytes32_js_1 = require("./bytes32.js");
Object.defineProperty(exports, "formatBytes32String", { enumerable: true, get: function () { return bytes32_js_1.formatBytes32String; } });
Object.defineProperty(exports, "parseBytes32String", { enumerable: true, get: function () { return bytes32_js_1.parseBytes32String; } });
Object.defineProperty(exports, "decodeBytes32String", { enumerable: true, get: function () { return bytes32_js_1.decodeBytes32String; } });
Object.defineProperty(exports, "encodeBytes32String", { enumerable: true, get: function () { return bytes32_js_1.encodeBytes32String; } });
var fragments_js_1 = require("./fragments.js");
Object.defineProperty(exports, "ConstructorFragment", { enumerable: true, get: function () { return fragments_js_1.ConstructorFragment; } });
Object.defineProperty(exports, "ErrorFragment", { enumerable: true, get: function () { return fragments_js_1.ErrorFragment; } });

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":";;;AAGA,MAAM;AACN,+CAGwB;AAFpB,wGAAA,QAAQ,OAAA;AACR,+GAAA,eAAe,OAAA;AAGnB,2CAAuE;AAA9D,iHAAA,mBAAmB,OAAA;AAAE,gHAAA,kBAAkB,OAAA;AAEhD,+CAGwB;AAFpB,mHAAA,mBAAmB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,wGAAA,QAAQ,OAAA;AAC3D,gHAAA,gBAAgB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,yGAAA,SAAS,OAAA;AAAE,8GAAA,cAAc,OAAA;AAG9D,+CAMwB;AALpB,iHAAA,iBAAiB,OAAA;AACjB,uGAAA,OAAO,OAAA;AACP,yGAAA,SAAS,OAAA;AACT,gHAAA,gBAAgB,OAAA;AAAE,8GAAA,cAAc,OAAA;AAAE,sHAAA,sBAAsB,OAAA;AACxD,sGAAA,MAAM,OAAA;AAGV,uCAAmC;AAA1B,iGAAA,KAAK,OAAA"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":";;;AAGA,MAAM;AACN,+CAGwB;AAFpB,wGAAA,QAAQ,OAAA;AACR,+GAAA,eAAe,OAAA;AAGnB,2CAAwE;AAA/D,iHAAA,mBAAmB,OAAA;AAAE,iHAAA,mBAAmB,OAAA;AAEjD,+CAGwB;AAFpB,mHAAA,mBAAmB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,wGAAA,QAAQ,OAAA;AAC3D,gHAAA,gBAAgB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,yGAAA,SAAS,OAAA;AAAE,8GAAA,cAAc,OAAA;AAG9D,+CAMwB;AALpB,iHAAA,iBAAiB,OAAA;AACjB,uGAAA,OAAO,OAAA;AACP,yGAAA,SAAS,OAAA;AACT,gHAAA,gBAAgB,OAAA;AAAE,8GAAA,cAAc,OAAA;AAAE,sHAAA,sBAAsB,OAAA;AACxD,sGAAA,MAAM,OAAA;AAGV,uCAAmC;AAA1B,iGAAA,KAAK,OAAA"}

@ -130,7 +130,9 @@ class Interface {
try {
frags.push(fragments_js_1.Fragment.from(a));
}
catch (error) { }
catch (error) {
console.log("EE", error);
}
}
(0, index_js_3.defineProperties)(this, {
fragments: Object.freeze(frags)
@ -173,7 +175,7 @@ class Interface {
// If we do not have a constructor add a default
if (!this.deploy) {
(0, index_js_3.defineProperties)(this, {
deploy: fragments_js_1.ConstructorFragment.fromString("constructor()")
deploy: fragments_js_1.ConstructorFragment.from("constructor()")
});
}
}
@ -281,7 +283,7 @@ class Interface {
return matching[0];
}
// Normalize the signature and lookup the function
const result = this.#functions.get(fragments_js_1.FunctionFragment.fromString(key).format());
const result = this.#functions.get(fragments_js_1.FunctionFragment.from(key).format());
if (result) {
return result;
}
@ -360,7 +362,7 @@ class Interface {
return matching[0];
}
// Normalize the signature and lookup the function
const result = this.#events.get(fragments_js_1.EventFragment.fromString(key).format());
const result = this.#events.get(fragments_js_1.EventFragment.from(key).format());
if (result) {
return result;
}
@ -400,7 +402,7 @@ class Interface {
if ((0, index_js_3.isHexString)(key)) {
const selector = key.toLowerCase();
if (BuiltinErrors[selector]) {
return fragments_js_1.ErrorFragment.fromString(BuiltinErrors[selector].signature);
return fragments_js_1.ErrorFragment.from(BuiltinErrors[selector].signature);
}
for (const fragment of this.#errors.values()) {
if (selector === fragment.selector) {
@ -419,10 +421,10 @@ class Interface {
}
if (matching.length === 0) {
if (key === "Error") {
return fragments_js_1.ErrorFragment.fromString("error Error(string)");
return fragments_js_1.ErrorFragment.from("error Error(string)");
}
if (key === "Panic") {
return fragments_js_1.ErrorFragment.fromString("error Panic(uint256)");
return fragments_js_1.ErrorFragment.from("error Panic(uint256)");
}
(0, index_js_3.throwArgumentError)("no matching error", "name", key);
}
@ -433,12 +435,12 @@ class Interface {
return matching[0];
}
// Normalize the signature and lookup the function
key = fragments_js_1.ErrorFragment.fromString(key).format();
key = fragments_js_1.ErrorFragment.from(key).format();
if (key === "Error(string)") {
return fragments_js_1.ErrorFragment.fromString("error Error(string)");
return fragments_js_1.ErrorFragment.from("error Error(string)");
}
if (key === "Panic(uint256)") {
return fragments_js_1.ErrorFragment.fromString("error Panic(uint256)");
return fragments_js_1.ErrorFragment.from("error Panic(uint256)");
}
const result = this.#errors.get(key);
if (result) {
@ -799,7 +801,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string {
eventFragment.inputs.forEach((param, index) => {
if (param.indexed) {
if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") {
indexed.push(fragments_js_1.ParamType.fromObject({ type: "bytes32", name: param.name }));
indexed.push(fragments_js_1.ParamType.from({ type: "bytes32", name: param.name }));
dynamic.push(true);
}
else {

File diff suppressed because one or more lines are too long

@ -32,6 +32,7 @@ function lock() {
scrypt_js_1.scryptSync.lock();
sha2_js_1.sha256.lock();
sha2_js_1.sha512.lock();
random_js_1.randomBytes.lock();
}
exports.lock = lock;
//# sourceMappingURL=index.js.map

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":";;;AAAA,8CAA8C;AAC9C,uCAAwC;AASpC,4FATK,qBAAW,OASL;AARf,2CAAwC;AAYpC,0FAZK,qBAAS,OAYL;AAXb,iDAA2C;AAYvC,0FAZK,wBAAS,OAYL;AAXb,2CAAqC;AAcjC,uFAdK,kBAAM,OAcL;AAbV,2CAA0C;AAOtC,4FAPK,uBAAW,OAOL;AANf,2CAAiD;AAa7C,uFAbK,kBAAM,OAaL;AAAE,2FAbK,sBAAU,OAaL;AAZtB,uCAA2C;AASvC,uFATK,gBAAM,OASL;AAAE,uFATK,gBAAM,OASL;AAMlB,mDAA8C;AAArC,4GAAA,UAAU,OAAA;AACnB,+CAA2C;AAAlC,yGAAA,SAAS,OAAA;AAElB,SAAS,IAAI;IACT,qBAAW,CAAC,IAAI,EAAE,CAAC;IACnB,qBAAS,CAAC,IAAI,EAAE,CAAC;IACjB,kBAAM,CAAC,IAAI,EAAE,CAAC;IACd,uBAAW,CAAC,IAAI,EAAE,CAAC;IACnB,wBAAS,CAAC,IAAI,EAAE,CAAC;IACjB,kBAAM,CAAC,IAAI,EAAE,CAAC;IACd,sBAAU,CAAC,IAAI,EAAE,CAAC;IAClB,gBAAM,CAAC,IAAI,EAAE,CAAC;IACd,gBAAM,CAAC,IAAI,EAAE,CAAC;AAClB,CAAC;AAEQ,oBAAI"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":";;;AAAA,8CAA8C;AAC9C,uCAAwC;AASpC,4FATK,qBAAW,OASL;AARf,2CAAwC;AAYpC,0FAZK,qBAAS,OAYL;AAXb,iDAA2C;AAYvC,0FAZK,wBAAS,OAYL;AAXb,2CAAqC;AAcjC,uFAdK,kBAAM,OAcL;AAbV,2CAA0C;AAOtC,4FAPK,uBAAW,OAOL;AANf,2CAAiD;AAa7C,uFAbK,kBAAM,OAaL;AAAE,2FAbK,sBAAU,OAaL;AAZtB,uCAA2C;AASvC,uFATK,gBAAM,OASL;AAAE,uFATK,gBAAM,OASL;AAMlB,mDAA8C;AAArC,4GAAA,UAAU,OAAA;AACnB,+CAA2C;AAAlC,yGAAA,SAAS,OAAA;AAElB,SAAS,IAAI;IACT,qBAAW,CAAC,IAAI,EAAE,CAAC;IACnB,qBAAS,CAAC,IAAI,EAAE,CAAC;IACjB,kBAAM,CAAC,IAAI,EAAE,CAAC;IACd,uBAAW,CAAC,IAAI,EAAE,CAAC;IACnB,wBAAS,CAAC,IAAI,EAAE,CAAC;IACjB,kBAAM,CAAC,IAAI,EAAE,CAAC;IACd,sBAAU,CAAC,IAAI,EAAE,CAAC;IAClB,gBAAM,CAAC,IAAI,EAAE,CAAC;IACd,gBAAM,CAAC,IAAI,EAAE,CAAC;IACd,uBAAW,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAEQ,oBAAI"}

@ -15,7 +15,7 @@ randomBytes._ = _randomBytes;
randomBytes.lock = function () { locked = true; };
randomBytes.register = function (func) {
if (locked) {
throw new Error("random is locked");
throw new Error("randomBytes is locked");
}
__randomBytes = func;
};

@ -1 +1 @@
{"version":3,"file":"random.js","sourceRoot":"","sources":["../../src.ts/crypto/random.ts"],"names":[],"mappings":";;;AAAA,2CAA2D;AAE3D,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,YAAY,GAAG,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AAI,CAAC;AACzB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"}

@ -2,15 +2,15 @@
/////////////////////////////
//
Object.defineProperty(exports, "__esModule", { value: true });
exports.scrypt = exports.pbkdf2 = exports.sha512 = exports.sha256 = exports.ripemd160 = exports.keccak256 = exports.randomBytes = exports.computeHmac = exports.EventLog = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.ContractEventPayload = exports.ContractFactory = exports.Contract = exports.BaseContract = exports.MessagePrefix = exports.EtherSymbol = exports.ZeroHash = exports.N = exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.Two = exports.One = exports.Zero = exports.NegativeOne = exports.ZeroAddress = exports.getCreate2Address = exports.getCreateAddress = exports.getIcapAddress = exports.getAddress = exports.Typed = exports.TransactionDescription = exports.Result = exports.LogDescription = exports.Interface = exports.Indexed = exports.checkResultErrors = exports.ParamType = exports.FunctionFragment = exports.Fragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.defaultAbiCoder = exports.AbiCoder = exports.parseBytes32String = exports.formatBytes32String = exports.version = void 0;
exports.scrypt = exports.pbkdf2 = exports.sha512 = exports.sha256 = exports.ripemd160 = exports.keccak256 = exports.randomBytes = exports.computeHmac = exports.EventLog = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.ContractEventPayload = exports.ContractFactory = exports.Contract = exports.BaseContract = exports.MessagePrefix = exports.EtherSymbol = exports.ZeroHash = exports.N = exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.Two = exports.One = exports.Zero = exports.NegativeOne = exports.ZeroAddress = exports.getCreate2Address = exports.getCreateAddress = exports.getIcapAddress = exports.getAddress = exports.Typed = exports.TransactionDescription = exports.Result = exports.LogDescription = exports.Interface = exports.Indexed = exports.checkResultErrors = exports.ParamType = exports.FunctionFragment = exports.Fragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.defaultAbiCoder = exports.AbiCoder = exports.encodeBytes32String = exports.decodeBytes32String = exports.version = void 0;
exports.assertPrivate = exports.assertNormalize = exports.assertArgumentCount = exports.assertArgument = exports.zeroPadValue = exports.zeroPadBytes = exports.stripZerosLeft = exports.isBytesLike = exports.isHexString = exports.hexlify = exports.getBytesCopy = exports.getBytes = exports.dataSlice = exports.dataLength = exports.concat = exports.encodeBase64 = exports.decodeBase64 = exports.encodeBase58 = exports.decodeBase58 = exports.Transaction = exports.recoverAddress = exports.computeAddress = exports.accessListify = exports.Network = exports.WebSocketProvider = exports.SocketProvider = exports.IpcSocketProvider = exports.InfuraProvider = exports.EtherscanProvider = exports.CloudflareProvider = exports.AnkrProvider = exports.AlchemyProvider = exports.JsonRpcSigner = exports.JsonRpcProvider = exports.JsonRpcApiProvider = exports.FallbackProvider = exports.AbstractProvider = exports.TypedDataEncoder = exports.solidityPackedSha256 = exports.solidityPackedKeccak256 = exports.solidityPacked = exports.hashMessage = exports.dnsEncode = exports.namehash = exports.isValidName = exports.id = exports.SigningKey = exports.Signature = exports.lock = exports.scryptSync = void 0;
exports.LangEn = exports.langEn = exports.Wordlist = exports.Wallet = exports.Mnemonic = exports.encryptKeystoreJson = exports.decryptKeystoreJson = exports.decryptKeystoreJsonSync = exports.isKeystoreJson = exports.decryptCrowdsaleJson = exports.isCrowdsaleJson = exports.HDNodeWalletManager = exports.HDNodeVoidWallet = exports.HDNodeWallet = exports.getAccountPath = exports.defaultPath = exports.encodeRlp = exports.decodeRlp = exports.Utf8ErrorFuncs = exports.toUtf8String = exports.toUtf8CodePoints = exports.toUtf8Bytes = exports._toEscapedUtf8String = exports.parseUnits = exports.formatUnits = exports.parseEther = exports.formatEther = exports.mask = exports.toTwos = exports.fromTwos = exports.toQuantity = exports.toNumber = exports.toHex = exports.toBigInt = exports.toArray = exports.getNumber = exports.getBigInt = exports.parseFixed = exports.formatFixed = exports.FixedNumber = exports.FixedFormat = exports.FetchCancelSignal = exports.FetchResponse = exports.FetchRequest = exports.getIpfsGatewayFunc = exports.isError = exports.isCallException = exports.throwError = exports.throwArgumentError = exports.makeError = void 0;
exports.WordlistOwlA = exports.WordlistOwl = exports.wordlists = void 0;
var _version_js_1 = require("./_version.js");
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return _version_js_1.version; } });
var index_js_1 = require("./abi/index.js");
Object.defineProperty(exports, "formatBytes32String", { enumerable: true, get: function () { return index_js_1.formatBytes32String; } });
Object.defineProperty(exports, "parseBytes32String", { enumerable: true, get: function () { return index_js_1.parseBytes32String; } });
Object.defineProperty(exports, "decodeBytes32String", { enumerable: true, get: function () { return index_js_1.decodeBytes32String; } });
Object.defineProperty(exports, "encodeBytes32String", { enumerable: true, get: function () { return index_js_1.encodeBytes32String; } });
Object.defineProperty(exports, "AbiCoder", { enumerable: true, get: function () { return index_js_1.AbiCoder; } });
Object.defineProperty(exports, "defaultAbiCoder", { enumerable: true, get: function () { return index_js_1.defaultAbiCoder; } });
Object.defineProperty(exports, "ConstructorFragment", { enumerable: true, get: function () { return index_js_1.ConstructorFragment; } });

@ -1 +1 @@
{"version":3,"file":"ethers.js","sourceRoot":"","sources":["../src.ts/ethers.ts"],"names":[],"mappings":";AAEA,6BAA6B;AAC7B,EAAE;;;;;;AAEF,6CAAwC;AAA/B,sGAAA,OAAO,OAAA;AAEhB,2CAQwB;AAPpB,+GAAA,mBAAmB,OAAA;AAAE,8GAAA,kBAAkB,OAAA;AAEvC,oGAAA,QAAQ,OAAA;AAAE,2GAAA,eAAe,OAAA;AACzB,+GAAA,mBAAmB,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,qGAAA,SAAS,OAAA;AAExF,6GAAA,iBAAiB,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,0GAAA,cAAc,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,k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ACd,qGAAA,SAAS,OAAA;AAAE,qGAAA,SAAS,OAAA;AAGxB,+CAS2B;AARvB,wGAAA,WAAW,OAAA;AACX,2GAAA,cAAc,OAAA;AACd,yGAAA,YAAY,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AACnD,4GAAA,eAAe,OAAA;AAAE,iHAAA,oBAAoB,OAAA;AACrC,2GAAA,cAAc,OAAA;AAAE,oHAAA,uBAAuB,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAC5D,gHAAA,mBAAmB,OAAA;AACnB,qGAAA,QAAQ,OAAA;AACR,mGAAA,MAAM,OAAA;AAGV,kDAE8B;AAD1B,qGAAA,QAAQ,OAAA;AAAE,mGAAA,MAAM,OAAA;AAAE,mGAAA,MAAM,OAAA;AAAE,sGAAA,SAAS,OAAA;AAAE,wGAAA,WAAW,OAAA;AAAE,yGAAA,YAAY,OAAA"}

@ -4,6 +4,7 @@ exports.WebSocketProvider = void 0;
const ws_js_1 = require("./ws.js"); /*-browser*/
const provider_socket_js_1 = require("./provider-socket.js");
class WebSocketProvider extends provider_socket_js_1.SocketProvider {
#connect;
#websocket;
get websocket() {
if (this.#websocket == null) {
@ -14,14 +15,21 @@ class WebSocketProvider extends provider_socket_js_1.SocketProvider {
constructor(url, network) {
super(network);
if (typeof (url) === "string") {
this.#websocket = new ws_js_1.WebSocket(url);
this.#connect = () => { return new ws_js_1.WebSocket(url); };
this.#websocket = this.#connect();
}
else if (typeof (url) === "function") {
this.#connect = url;
this.#websocket = url();
}
else {
this.#connect = null;
this.#websocket = url;
}
this.websocket.onopen = async () => {
try {
await this._start();
this.resume();
}
catch (error) {
console.log("failed to start WebsocketProvider", error);
@ -31,6 +39,21 @@ class WebSocketProvider extends provider_socket_js_1.SocketProvider {
this.websocket.onmessage = (message) => {
this._processMessage(message.data);
};
/*
this.websocket.onclose = (event) => {
// @TODO: What event.code should we reconnect on?
const reconnect = false;
if (reconnect) {
this.pause(true);
if (this.#connect) {
this.#websocket = this.#connect();
this.#websocket.onopen = ...
// @TODO: this requires the super class to rebroadcast; move it there
}
this._reconnect();
}
};
*/
}
async _write(message) {
this.websocket.send(message);

@ -1 +1 @@
{"version":3,"file":"provider-websocket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-websocket.ts"],"names":[],"mappings":";;;AAEA,mCAAkD,CAAC,YAAY;AAE/D,6DAAsD;AAetD,MAAa,iBAAkB,SAAQ,mCAAc;IACjD,UAAU,CAAuB;IACjC,IAAI,SAAS;QACT,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;SAAE;QACrE,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,YAAY,GAA2B,EAAE,OAAoB;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,OAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE;YAC1B,IAAI,CAAC,UAAU,GAAG,IAAI,iBAAU,CAAC,GAAG,CAAC,CAAC;SACzC;aAAM;YACH,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;SACzB;QAED,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,KAAK,IAAI,EAAE;YAC/B,IAAI;gBACA,MAAM,IAAI,CAAC,MAAM,EAAE,CAAA;aACtB;YAAC,OAAO,KAAK,EAAE;gBACZ,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;gBACxD,sCAAsC;aACzC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,CAAC,OAAyB,EAAE,EAAE;YACrD,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACvC,CAAC,CAAC;IACN,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAe;QACxB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjC,CAA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C,MAAM,EAAE,CAAA;gBACnB,IAAI,CAAC,MAAM,EAAE,CAAC;aACjB;YAAC,OAAO,KAAK,EAAE;gBACZ,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;gBACxD,sCAAsC;aACzC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,CAAC,OAAyB,EAAE,EAAE;YACrD,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACvC,CAAC,CAAC;QACV;;;;;;;;;;;;;;UAcE;IACE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAe;QACxB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,OAAO;QACT,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE;YAAE,OAAO;SAAE;QACxC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IAC3B,CAAC;CACJ;AA7DD,8CA6DC"}

@ -60,6 +60,9 @@ function getBigInt(value, name) {
return BigInt(value);
case "string":
try {
if (value[0] === "-" && value[1] !== "-") {
return -BigInt(value.substring(1));
}
return BigInt(value);
}
catch (e) {

File diff suppressed because one or more lines are too long

@ -28,12 +28,14 @@ function writeVersion(version) {
// Remote pkg
const remotePkgInfo = remoteInfo.versions[remoteVersion];
const remoteGitHead = remotePkgInfo.gitHead;
//const gitHead = await getGitTag(resolve("."));
let gitHead = "";
for (const log of await getGitLog(".")) {
if (log.body.startsWith("admin:")) {
continue;
}
if (log.body.startsWith("tests:")) {
continue;
}
gitHead = log.commit;
break;
}

@ -1 +1 @@
{"version":3,"file":"update-version.js","sourceRoot":"","sources":["../../src.ts/_admin/update-version.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,MAA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AC,EAAE;gBAC/C,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;aAC1C;YACD,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,YAAY,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACpF;aAAM,IAAI,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACrE,0EAA0E;YAC1E,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;SACxD;QAED,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;QAE1B,wBAAwB;QACxB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAEjC,8BAA8B;QAC9B,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KACjC;AAEL,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACjB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACnB,CAAC,CAAC,CAAC"}

@ -1,6 +1,6 @@
import assert from "assert";
import { loadTests } from "./utils.js";
import { defaultAbiCoder } from "../index.js";
import { defaultAbiCoder, Interface, decodeBytes32String, encodeBytes32String } from "../index.js";
function equal(actual, expected) {
switch (expected.type) {
case "address":
@ -38,4 +38,68 @@ describe("Tests ABI Coder", function () {
});
}
});
describe("Test Bytes32 strings", function () {
it("encodes and decodes Bytes32 strings @TODO: exapnd", function () {
const str = "ricmoo.firefly.eth";
const bytes32 = encodeBytes32String(str);
const str2 = decodeBytes32String(bytes32);
assert.equal(bytes32, '0x7269636d6f6f2e66697265666c792e6574680000000000000000000000000000', 'formatted correctly');
assert.equal(str2, str, "parsed correctly");
});
});
describe("Test Interface", function () {
const iface = new Interface([
"function balanceOf(address owner) returns (uint)",
"event Transfer(address indexed from, address indexed to, uint amount)"
]);
it("does interface stuff; @TODO expand this", function () {
const addr = "0x8ba1f109551bD432803012645Ac136ddd64DBA72";
const addr2 = "0xAC1639CF97a3A46D431e6d1216f576622894cBB5";
const data = iface.encodeFunctionData("balanceOf", [addr]);
assert.equal(data, "0x70a082310000000000000000000000008ba1f109551bd432803012645ac136ddd64dba72", "encoded");
const decoded = iface.decodeFunctionData("balanceOf", data);
assert.equal(decoded.length, 1, "decoded.length");
assert.equal(decoded[0], addr, "decoded[0]");
const tx = iface.parseTransaction({ data, value: 10 });
assert.ok(tx != null, "tx == null");
assert.equal(tx.name, "balanceOf", "tx.balanceOf");
assert.equal(tx.signature, "balanceOf(address)", "tx.balanceOf");
assert.equal(tx.args.length, 1, "tx.args.length");
assert.equal(tx.args[0], addr, "tx.args[0]");
assert.equal(tx.selector, "0x70a08231", "tx.selector");
assert.equal(tx.value, BigInt(10), "tx.value");
const result = iface.encodeFunctionResult("balanceOf", [123]);
assert.equal(result, "0x000000000000000000000000000000000000000000000000000000000000007b", "result");
const value = iface.decodeFunctionResult("balanceOf", result);
assert.equal(value.length, 1, "result.length");
assert.equal(value[0], BigInt(123), "result.value[0]");
// @TODO: parseResult
const filter = iface.encodeFilterTopics("Transfer", [addr, addr2]);
assert.equal(filter.length, 3);
assert.equal(filter[0], "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef");
assert.equal(filter[1], "0x0000000000000000000000008ba1f109551bd432803012645ac136ddd64dba72");
assert.equal(filter[2], "0x000000000000000000000000ac1639cf97a3a46d431e6d1216f576622894cbb5");
const eventLog = iface.encodeEventLog("Transfer", [addr, addr2, 234]);
assert.equal(eventLog.data, "0x00000000000000000000000000000000000000000000000000000000000000ea");
assert.deepEqual(eventLog.topics, [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000008ba1f109551bd432803012645ac136ddd64dba72",
"0x000000000000000000000000ac1639cf97a3a46d431e6d1216f576622894cbb5"
]);
const values = iface.decodeEventLog("Transfer", eventLog.data, eventLog.topics);
assert.equal(values.length, 3);
assert.equal(values[0], addr);
assert.equal(values[1], addr2);
assert.equal(values[2], BigInt(234));
const log = iface.parseLog(eventLog);
assert.ok(log != null);
assert.equal(log.name, "Transfer");
assert.equal(log.signature, "Transfer(address,address,uint256)");
assert.equal(log.topic, "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef");
assert.equal(log.args.length, 3);
assert.equal(log.args[0], "0x8ba1f109551bD432803012645Ac136ddd64DBA72");
assert.equal(log.args[1], "0xAC1639CF97a3A46D431e6d1216f576622894cBB5");
assert.equal(log.args[2], BigInt(234));
});
});
//# sourceMappingURL=test-abi.js.map

File diff suppressed because one or more lines are too long

@ -1,4 +1,15 @@
"use strict";
import assert from "assert";
import { connect } from "./create-provider.js";
import { Contract } from "../index.js";
describe("Test Contract", function () {
it("tests contract @TODO: expand", async function () {
const provider = connect("mainnet");
const contract = new Contract("dai.tokens.ethers.eth", [
"function balanceOf(address) view returns (uint)"
], provider);
assert.equal(await contract.balanceOf("ricmoo.firefly.eth"), BigInt("6015089439794538201631"));
});
});
/*
import { Typed } from "../abi/index.js";
import * as providers from "../providers/index.js";

@ -1 +1 @@
{"version":3,"file":"test-contract.js","sourceRoot":"","sources":["../../src.ts/_tests/test-contract.ts"],"names":[],"mappings":";AAAA;;;;;;;EAOE;AACF,4DAA4D;AAC5D,4DAA4D;AAE5D;;;;EAIE;AAEF,QAAQ;AACR;;;;;;;;;;;;;EAaE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDE;AACF;;;;;;;;;;EAUE"}
{"version":3,"file":"test-contract.js","sourceRoot":"","sources":["../../src.ts/_tests/test-contract.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,QAAQ,CAAC,eAAe,EAAE;IACtB,EAAE,CAAC,8BAA8B,EAAE,KAAK;QACpC,MAAM,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QAEpC,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,uBAAuB,EAAE;YACnD,iDAAiD;SACpD,EAAE,QAAQ,CAAC,CAAC;QAEb,MAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,SAAS,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC;IACnG,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH;;;;;;;EAOE;AACF,4DAA4D;AAC5D,4DAA4D;AAE5D;;;;EAIE;AAEF,QAAQ;AACR;;;;;;;;;;;;;EAaE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDE;AACF;;;;;;;;;;EAUE"}

@ -1,5 +1,5 @@
import assert from "assert";
import { lock, computeHmac, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync } from "../index.js";
import { lock, computeHmac, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, randomBytes } from "../index.js";
describe("test registration", function () {
let hijack = "";
function getHijack(algo) {
@ -57,15 +57,29 @@ describe("test registration", function () {
hijackTag: 'hijacked computeHmac: ["sha256",{},{}]',
algorithm: computeHmac
},
{
name: "randomBytes",
params: [32],
hijackTag: "hijacked randomBytes: [32]",
algorithm: randomBytes,
postCheck: (value) => {
return (value instanceof Uint8Array && value.length === 32);
}
}
];
tests.forEach(({ name, params, hijackTag, algorithm }) => {
tests.forEach(({ name, params, hijackTag, algorithm, postCheck }) => {
it(`swaps in hijacked callback: ${name}`, async function () {
const initial = await algorithm(...params);
algorithm.register(getHijack(name));
assert.equal(await algorithm(...params), "0x42");
assert.equal(hijack, hijackTag);
algorithm.register(algorithm._);
assert.equal(await algorithm(...params), initial);
if (postCheck) {
assert.ok(postCheck(await algorithm(...params)));
}
else {
assert.equal(await algorithm(...params), initial);
}
});
});
it("prevents swapping after locked", function () {

@ -1 +1 @@
{"version":3,"file":"test-crypto-algoswap.js","sourceRoot":"","sources":["../../src.ts/_tests/test-crypto-algoswap.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EACH,IAAI,EAEJ,WAAW,EAEX,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAEpC,MAAM,EAAE,MAAM,EAAE,UAAU,EAC7B,MAAM,aAAa,CAAC;AAkBrB,QAAQ,CAAC,mBAAmB,EAAE;IAE1B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,SAAS,SAAS,CAAC,IAAY;QAC3B,OAAO,UAAS,GAAG,IAAgB;YAC/B,MAAM,GAAG,YAAa,IAAK,KAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAE,EAAE,CAAC;YACzD,OAAO,MAAM,CAAC;QAClB,CAAC,CAAA;IACL,CAAC;IAED,MAAM,KAAK,GAAoB;QAC3B;YACI,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,CAAE,IAAI,CAAE;YAChB,SAAS,EAAE,0BAA0B;YACrC,SAAS,EAAE,SAAS;SACvB;QACD;YACI,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,CAAE,IAAI,CAAE;YAChB,SAAS,EAAE,uBAAuB;YAClC,SAAS,EAAE,MAAM;SACpB;QACD;YACI,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,CAAE,IAAI,CAAE;YAChB,SAAS,EAAE,uBAAuB;YAClC,SAAS,EAAE,MAAM;SACpB;QACD;YACI,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,CA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,EAAE,UAAS,KAAU;gBAClB,OAAO,CAAC,KAAK,CAAC,OAAO,KAAK,GAAI,IAAK,YAAY,CAAC,CAAC;YACrD,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AAEP,CAAC,CAAC,CAAC"}

@ -74,141 +74,4 @@ describe("test hmac", function () {
});
});
});
/*
describe("test registration", function() {
let hijack = "";
function getHijack(algo: string) {
return function(...args: Array<any>) {
hijack = `hijacked ${ algo }: ${ JSON.stringify(args) }`;
return "0x42";
}
}
it("hijacks keccak256", function() {
const initial = keccak256("0x");
keccak256.register(getHijack("kecak256"));
assert.equal(keccak256("0x"), "0x42");
assert.equal(hijack, 'hijacked kecak256: [{}]');
keccak256.register(keccak256._);
assert.equal(keccak256("0x"), initial);
keccak256.lock();
assert.throws(function() {
keccak256.register(getHijack("test"));
}, function(error) {
return (error.message === "keccak256 is locked");
});
});
it("hijacks sha256", function() {
const initial = sha256("0x");
sha256.register(getHijack("sha256"));
assert.equal(sha256("0x"), "0x42");
assert.equal(hijack, 'hijacked sha256: [{}]');
sha256.register(sha256._);
assert.equal(sha256("0x"), initial);
sha256.lock();
assert.throws(function() {
sha256.register(getHijack("test"));
}, function(error) {
return (error.message === "sha256 is locked");
});
});
it("hijacks sha512", function() {
const initial = sha512("0x");
sha512.register(getHijack("sha512"));
assert.equal(sha512("0x"), "0x42");
assert.equal(hijack, 'hijacked sha512: [{}]');
sha512.register(sha512._);
assert.equal(sha512("0x"), initial);
sha512.lock();
assert.throws(function() {
sha512.register(getHijack("test"));
}, function(error) {
return (error.message === "sha512 is locked");
});
});
it("hijacks pbkdf2", function() {
const initial = pbkdf2("0x", "0x", 1024, 32, "sha256");
pbkdf2.register(getHijack("pbkdf2"));
assert.equal(pbkdf2("0x", "0x", 1024, 32, "sha256"), "0x42");
assert.equal(hijack, 'hijacked pbkdf2: [{},{},1024,32,"sha256"]');
pbkdf2.register(pbkdf2._);
assert.equal(pbkdf2("0x", "0x", 1024, 32, "sha256"), initial);
pbkdf2.lock();
assert.throws(function() {
pbkdf2.register(getHijack("test"));
}, function(error) {
return (error.message === "pbkdf2 is locked");
});
});
it("hijacks scryptSync", function() {
function getHijack(...args: Array<any>) {
hijack = `hijacked scryptSync: ${ JSON.stringify(args) }`;
return new Uint8Array([ 0x42 ]);
}
const initial = scryptSync("0x", "0x", 1024, 8, 1, 32);
scryptSync.register(getHijack);
assert.equal(scryptSync("0x", "0x", 1024, 8, 1, 32), "0x42");
assert.equal(hijack, 'hijacked scryptSync: [{},{},1024,8,1,32]');
scryptSync.register(scryptSync._);
assert.equal(scryptSync("0x", "0x", 1024, 8, 1, 32), initial);
scryptSync.lock();
assert.throws(function() {
scryptSync.register(getHijack);
}, function(error) {
return (error.message === "scryptSync is locked");
});
});
it("hijacks scrypt", async function() {
function getHijack(...args: Array<any>) {
hijack = `hijacked scrypt: ${ JSON.stringify(args) }`;
return Promise.resolve(new Uint8Array([ 0x42 ]));
}
const initial = await scrypt("0x", "0x", 1024, 8, 1, 32);
scrypt.register(getHijack);
assert.equal(await scrypt("0x", "0x", 1024, 8, 1, 32), "0x42");
assert.equal(hijack, 'hijacked scrypt: [{},{},1024,8,1,32,null]');
scrypt.register(scrypt._);
assert.equal(await scrypt("0x", "0x", 1024, 8, 1, 32), initial);
scrypt.lock();
assert.throws(function() {
scrypt.register(getHijack);
}, function(error) {
return (error.message === "scrypt is locked");
});
});
});
*/
//# sourceMappingURL=test-crypto.js.map

@ -1 +1 @@
{"version":3,"file":"test-crypto.js","sourceRoot":"","sources":["../../src.ts/_tests/test-crypto.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EACH,WAAW,EACX,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EACpC,MAAM,EAAE,MAAM,EAAE,UAAU,EAC7B,MAAM,aAAa,CAAC;AAGrB,QAA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S,CAAe,MAAM,CAAC,CAAC;IAE9C,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACnB,EAAE,CAAC,kBAAmB,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK;YACpC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;YACtC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}

@ -1,8 +1,7 @@
"use strict";
/*
import assert from "assert";
import { loadTests } from "./utils.js"
import type { TestCaseNamehash } from "./types.js";
import { hashMessage, solidityPackedKeccak256, solidityPackedSha256 } from "../index.js";
import { loadTests } from "./utils.js";
/*
import { dnsEncode, isValidName, namehash } from "../index.js";
@ -109,4 +108,41 @@ describe("Tests DNS Names", function() {
});
*/
describe("Test EIP-191 Personal Message Hash", function () {
const tests = [
{
test: "hello-world",
message: "Hello World",
hash: "0xa1de988600a42c4b4ab089b619297c17d53cffae5d5120d82d8a92d0bb3b78f2"
},
{
test: "binary-message",
message: new Uint8Array([0x42, 0x43]),
hash: "0x0d3abc18ec299cf9b42ba439ac6f7e3e6ec9f5c048943704e30fc2d9c7981438"
},
{
test: "hex-looking-string",
message: "0x4243",
hash: "0x6d91b221f765224b256762dcba32d62209cf78e9bebb0a1b758ca26c76db3af4"
}
];
for (const test of tests) {
it(`tests hashMessage: ${test.test}`, function () {
assert.equal(hashMessage(test.message), test.hash);
});
}
});
describe("Test Solidity Hash functions", function () {
const tests = loadTests("solidity-hashes");
for (const test of tests) {
it(`computes the solidity keccak256: ${test.name}`, function () {
assert.equal(solidityPackedKeccak256(test.types, test.values), test.keccak256);
});
}
for (const test of tests) {
it(`computes the solidity sha256: ${test.name}`, function () {
assert.equal(solidityPackedSha256(test.types, test.values), test.sha256);
});
}
});
//# sourceMappingURL=test-hash.js.map

@ -1 +1 @@
{"version":3,"file":"test-hash.js","sourceRoot":"","sources":["../../src.ts/_tests/test-hash.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6GE"}
{"version":3,"file":"test-hash.js","sourceRoot":"","sources":["../../src.ts/_tests/test-hash.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EACH,WAAW,EACX,uBAAuB,EAAE,oBAAoB,EAChD,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAItC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0GE;AAEF,QAAQ,CAAC,oCAAoC,EAAE;IAC3C,MAAM,KAAK,GAAG;QACV;YACI,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,aAAa;YACtB,IAAI,EAAE,oEAAoE;SAC7E;QACD;YACI,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,IAAI,UAAU,CAAC,CAAE,IAAI,EAAE,IAAI,CAAE,CAAC;YACvC,IAAI,EAAE,oEAAoE;SAC7E;QACD;YACI,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,QAAQ;YACjB,IAAI,EAAE,oEAAoE;SAC7E;KACJ,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,sBAAuB,IAAI,CAAC,IAAK,EAAE,EAAE;YACpC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;KACN;AACL,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC,8BAA8B,EAAE;IACrC,MAAM,KAAK,GAAG,SAAS,CAAuB,iBAAiB,CAAC,CAAC;IAEjE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,oCAAqC,IAAI,CAAC,IAAK,EAAE,EAAE;YAClD,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACnF,CAAC,CAAC,CAAC;KACN;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,iCAAkC,IAAI,CAAC,IAAK,EAAE,EAAE;YAC/C,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7E,CAAC,CAAC,CAAC;KACN;AACL,CAAC,CAAC,CAAA"}

@ -1,5 +1,6 @@
import assert from "assert";
import { checkProvider, getProvider, providerNames } from "./create-provider.js";
import { retryIt } from "./utils.js";
import { networkFeatureAtBlock, networkNames, testAddress, testBlock, testReceipt, testTransaction } from "./blockchain-data.js";
function forEach(prefix, tests, func) {
for (const networkName of networkNames) {
@ -18,7 +19,7 @@ function forEach(prefix, tests, func) {
continue;
}
// Prepare the testcase
it(`${prefix}: ${providerName}:${networkName}.${test.test}`, async function () {
retryIt(`Foo ${prefix}: ${providerName}:${networkName}.${test.test}`, async function () {
// Create a provider
const provider = getProvider(providerName, networkName);
try {

File diff suppressed because one or more lines are too long

@ -0,0 +1,12 @@
import assert from "assert";
import { EtherscanProvider } from "../index.js";
import { retryIt } from "./utils.js";
describe("Test Etherscan extra APIs", function () {
retryIt("test etherscanProvider.getContract", async function () {
const provider = new EtherscanProvider("mainnet", "FPFGK6JSW2UHJJ2666FG93KP7WC999MNW7");
const contract = await provider.getContract("dai.tokens.ethers.eth");
assert.ok(contract != null, "contract == null");
assert.equal(await contract.symbol(), "DAI", "contract.symbol");
});
});
//# sourceMappingURL=test-providers-extra.js.map

@ -0,0 +1 @@
{"version":3,"file":"test-providers-extra.js","sourceRoot":"","sources":["../../src.ts/_tests/test-providers-extra.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC,QAAQ,CAAC,2BAA2B,EAAE;IAClC,OAAO,CAAC,oCAAoC,EAAE,KAAK;QAC/C,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC,SAAS,EAAE,oCAAoC,CAAC,CAAC;QACxF,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;QACrE,MAAM,CAAC,EAAE,CAAC,QAAQ,IAAI,IAAI,EAAE,kBAAkB,CAAC,CAAC;QAChD,MAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}

@ -0,0 +1,26 @@
import assert from "assert";
import { decodeBase64, encodeBase64, toUtf8Bytes } from "../index.js";
describe("Base64 Coding", function () {
const tests = [
{
name: "wikipedia",
plaintext: toUtf8Bytes("Many hands make light work."),
encoded: "TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcmsu"
}
];
for (const test of tests) {
it(`encodes base64: ${test.name}`, function () {
assert.equal(encodeBase64(test.plaintext), test.encoded);
});
}
for (const test of tests) {
it(`decodes base64: ${test.name}`, function () {
const decoded = decodeBase64(test.encoded);
assert.equal(decoded.length, test.plaintext.length, "data.length");
for (let i = 0; i < decoded.length; i++) {
assert.equal(decoded[i], test.plaintext[i]);
}
});
}
});
//# sourceMappingURL=test-utils-misc.js.map

@ -0,0 +1 @@
{"version":3,"file":"test-utils-misc.js","sourceRoot":"","sources":["../../src.ts/_tests/test-utils-misc.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EACH,YAAY,EAAE,YAAY,EAC1B,WAAW,EACd,MAAM,aAAa,CAAC;AAGrB,QAAQ,CAAC,eAAe,EAAE;IACtB,MAAM,KAAK,GAAG;QACV;YACI,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE,WAAW,CAAC,6BAA6B,CAAC;YACrD,OAAO,EAAE,sCAAsC;SAClD;KACJ,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,mBAAoB,IAAI,CAAC,IAAK,EAAE,EAAE;YACjC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;KACN;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,mBAAoB,IAAI,CAAC,IAAK,EAAE,EAAE;YACjC,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;YACnE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACrC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;aAC/C;QACL,CAAC,CAAC,CAAC;KACN;AACL,CAAC,CAAC,CAAA"}

@ -1 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src.ts/_tests/types.ts"],"names":[],"mappings":"AAiOC,CAAC"}
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src.ts/_tests/types.ts"],"names":[],"mappings":"AAyOC,CAAC"}

@ -1,2 +1,2 @@
export const version = "6.0.0-beta-exports.3";
export const version = "6.0.0-beta-exports.4";
//# sourceMappingURL=_version.js.map

@ -1,5 +1,5 @@
import { getBytes, toUtf8Bytes, toUtf8String, zeroPadBytes } from "../utils/index.js";
export function formatBytes32String(text) {
export function encodeBytes32String(text) {
// Get the bytes
const bytes = toUtf8Bytes(text);
// Check we have room for null-termination
@ -9,7 +9,7 @@ export function formatBytes32String(text) {
// Zero-pad (implicitly null-terminates)
return zeroPadBytes(bytes, 32);
}
export function parseBytes32String(_bytes) {
export function decodeBytes32String(_bytes) {
const data = getBytes(_bytes, "bytes");
// Must be 32 bytes with a null-termination
if (data.length !== 32) {

@ -1 +1 @@
{"version":3,"file":"bytes32.js","sourceRoot":"","sources":["../../src.ts/abi/bytes32.ts"],"names":[],"mappings":"AACA,OAAO,EACH,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EACpD,MAAM,mBAAmB,CAAC;AAK3B,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAE5C,gBAAgB;IAChB,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAEhC,0CAA0C;IAC1C,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAAE;IAExF,wCAAwC;IACxC,OAAO,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvC,2CAA2C;IAC3C,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE;QAAE,MAAM,I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F,4BAA4B;IAC5B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,CAAC;KAAE;IAE5C,6BAA6B;IAC7B,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/C,CAAC"}

@ -278,7 +278,7 @@ function consumeMutability(tokens) {
}
// ...a parameter list, returning the ParamType list
function consumeParams(tokens, allowIndexed) {
return tokens.popParams().map((t) => ParamType.fromTokens(t, allowIndexed));
return tokens.popParams().map((t) => ParamType.from(t, allowIndexed));
}
// ...a gas limit, returning a BigNumber or null if none
function consumeGas(tokens) {
@ -328,6 +328,11 @@ function verifyBasicType(type) {
const _guard = {};
const internal = Symbol.for("_ethers_internal");
const ParamTypeInternal = "_ParamTypeInternal";
const ErrorFragmentInternal = "_ErrorInternal";
const EventFragmentInternal = "_EventInternal";
const ConstructorFragmentInternal = "_ConstructorInternal";
const FunctionFragmentInternal = "_FunctionInternal";
const StructFragmentInternal = "_StructInternal";
export class ParamType {
// The local name of the parameter (of "" if unbound)
name;
@ -525,10 +530,46 @@ export class ParamType {
return obj;
}
if (typeof (obj) === "string") {
return ParamType.fromTokens(lex(obj), allowIndexed);
return ParamType.from(lex(obj), allowIndexed);
}
if (obj instanceof TokenString) {
return ParamType.fromTokens(obj, allowIndexed);
else if (obj instanceof TokenString) {
let type = "", baseType = "";
let comps = null;
if (consumeKeywords(obj, setify(["tuple"])).has("tuple") || obj.peekType("OPEN_PAREN")) {
// Tuple
baseType = "tuple";
comps = obj.popParams().map((t) => ParamType.from(t));
type = `tuple(${comps.map((c) => c.format()).join(",")})`;
}
else {
// Normal
type = verifyBasicType(obj.popType("TYPE"));
baseType = type;
}
// Check for Array
let arrayChildren = null;
let arrayLength = null;
while (obj.length && obj.peekType("BRACKET")) {
const bracket = obj.pop(); //arrays[i];
arrayChildren = new ParamType(_guard, "", type, baseType, null, comps, arrayLength, arrayChildren);
arrayLength = bracket.value;
type += bracket.text;
baseType = "array";
comps = null;
}
let indexed = null;
const keywords = consumeKeywords(obj, KwModifiers);
if (keywords.has("indexed")) {
if (!allowIndexed) {
throw new Error("");
}
indexed = true;
}
const name = (obj.peekType("ID") ? obj.pop().text : "");
if (obj.length) {
throw new Error("leftover tokens");
}
return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren);
}
const name = obj.name;
if (name && (typeof (name) !== "string" || !name.match(regexIdentifier))) {
@ -560,48 +601,6 @@ export class ParamType {
type = verifyBasicType(obj.type);
return new ParamType(_guard, name, type, type, indexed, null, null, null);
}
static fromObject(obj, allowIndexed) {
throw new Error("@TODO");
}
static fromTokens(tokens, allowIndexed) {
let type = "", baseType = "";
let comps = null;
if (consumeKeywords(tokens, setify(["tuple"])).has("tuple") || tokens.peekType("OPEN_PAREN")) {
// Tuple
baseType = "tuple";
comps = tokens.popParams().map((t) => ParamType.from(t));
type = `tuple(${comps.map((c) => c.format()).join(",")})`;
}
else {
// Normal
type = verifyBasicType(tokens.popType("TYPE"));
baseType = type;
}
// Check for Array
let arrayChildren = null;
let arrayLength = null;
while (tokens.length && tokens.peekType("BRACKET")) {
const bracket = tokens.pop(); //arrays[i];
arrayChildren = new ParamType(_guard, "", type, baseType, null, comps, arrayLength, arrayChildren);
arrayLength = bracket.value;
type += bracket.text;
baseType = "array";
comps = null;
}
let indexed = null;
const keywords = consumeKeywords(tokens, KwModifiers);
if (keywords.has("indexed")) {
if (!allowIndexed) {
throw new Error("");
}
indexed = true;
}
const name = (tokens.peekType("ID") ? tokens.pop().text : "");
if (tokens.length) {
throw new Error("leftover tokens");
}
return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren);
}
static isParamType(value) {
return (value && value[internal] === ParamTypeInternal);
}
@ -616,82 +615,58 @@ export class Fragment {
}
static from(obj) {
if (typeof (obj) === "string") {
return this.fromString(obj);
try {
Fragment.from(JSON.parse(obj));
}
catch (e) { }
return Fragment.from(lex(obj));
}
if (obj instanceof TokenString) {
return this.fromTokens(obj);
const type = obj.popKeyword(KwTypes);
switch (type) {
case "constructor": return ConstructorFragment.from(obj);
case "error": return ErrorFragment.from(obj);
case "event": return EventFragment.from(obj);
case "function": return FunctionFragment.from(obj);
case "struct": return StructFragment.from(obj);
}
throw new Error(`unsupported type: ${type}`);
}
if (typeof (obj) === "object") {
return this.fromObject(obj);
switch (obj.type) {
case "constructor": return ConstructorFragment.from(obj);
case "error": return ErrorFragment.from(obj);
case "event": return EventFragment.from(obj);
case "function": return FunctionFragment.from(obj);
case "struct": return StructFragment.from(obj);
}
throw new Error(`not implemented yet: ${obj.type}`);
}
throw new Error(`unsupported type: ${obj}`);
}
static fromObject(obj) {
switch (obj.type) {
case "constructor": return ConstructorFragment.fromObject(obj);
case "error": return ErrorFragment.fromObject(obj);
case "event": return EventFragment.fromObject(obj);
case "function": return FunctionFragment.fromObject(obj);
case "struct": return StructFragment.fromObject(obj);
}
throw new Error(`not implemented yet: ${obj.type}`);
}
static fromString(text) {
try {
Fragment.from(JSON.parse(text));
}
catch (e) { }
return Fragment.fromTokens(lex(text));
}
static fromTokens(tokens) {
const type = tokens.popKeyword(KwTypes);
switch (type) {
case "constructor": return ConstructorFragment.fromTokens(tokens);
case "error": return ErrorFragment.fromTokens(tokens);
case "event": return EventFragment.fromTokens(tokens);
case "function": return FunctionFragment.fromTokens(tokens);
case "struct": return StructFragment.fromTokens(tokens);
}
throw new Error(`unsupported type: ${type}`);
}
/*
static fromTokens(tokens: TokenString): Fragment {
const assertDone = () => {
if (tokens.length) { throw new Error(`unexpected tokens: ${ tokens.toString() }`); }
});
const type = (tokens.length && tokens.peek().type === "KEYWORD") ? tokens.peek().text: "unknown";
const name = consumeName("error", tokens);
const inputs = consumeParams(tokens, type === "event");
switch (type) {
case "event": case "struct":
assertDone();
}
}
*/
static isConstructor(value) {
return (value && value.type === "constructor");
return ConstructorFragment.isFragment(value);
}
static isError(value) {
return (value && value.type === "error");
return ErrorFragment.isFragment(value);
}
static isEvent(value) {
return (value && value.type === "event");
return EventFragment.isFragment(value);
}
static isFunction(value) {
return (value && value.type === "function");
return FunctionFragment.isFragment(value);
}
static isStruct(value) {
return (value && value.type === "struct");
return StructFragment.isFragment(value);
}
}
export class NamedFragment extends Fragment {
name;
constructor(guard, type, name, inputs) {
super(guard, type, inputs);
if (typeof (name) !== "string" || !name.match(regexIdentifier)) {
throwArgumentError("invalid identifier", "name", name);
}
inputs = Object.freeze(inputs.slice());
defineProperties(this, { name });
}
@ -702,6 +677,7 @@ function joinParams(format, params) {
export class ErrorFragment extends NamedFragment {
constructor(guard, name, inputs) {
super(guard, "error", name, inputs);
Object.defineProperty(this, internal, { value: ErrorFragmentInternal });
}
get selector() {
return id(this.format("sighash")).substring(0, 10);
@ -721,23 +697,30 @@ export class ErrorFragment extends NamedFragment {
result.push(this.name + joinParams(format, this.inputs));
return result.join(" ");
}
static fromObject(obj) {
return new ErrorFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.fromObject) : []);
static from(obj) {
if (ErrorFragment.isFragment(obj)) {
return obj;
}
if (typeof (obj) === "string") {
return ErrorFragment.from(lex(obj));
}
else if (obj instanceof TokenString) {
const name = consumeName("error", obj);
const inputs = consumeParams(obj);
consumeEoi(obj);
return new ErrorFragment(_guard, name, inputs);
}
return new ErrorFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);
}
static fromString(text) {
return ErrorFragment.fromTokens(lex(text));
}
static fromTokens(tokens) {
const name = consumeName("error", tokens);
const inputs = consumeParams(tokens);
consumeEoi(tokens);
return new ErrorFragment(_guard, name, inputs);
static isFragment(value) {
return (value && value[internal] === ErrorFragmentInternal);
}
}
export class EventFragment extends NamedFragment {
anonymous;
constructor(guard, name, inputs, anonymous) {
super(guard, "event", name, inputs);
Object.defineProperty(this, internal, { value: EventFragmentInternal });
defineProperties(this, { anonymous });
}
get topicHash() {
@ -762,18 +745,24 @@ export class EventFragment extends NamedFragment {
}
return result.join(" ");
}
static fromObject(obj) {
return new EventFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.fromObject) : [], !!obj.anonymous);
static from(obj) {
if (EventFragment.isFragment(obj)) {
return obj;
}
if (typeof (obj) === "string") {
return EventFragment.from(lex(obj));
}
else if (obj instanceof TokenString) {
const name = consumeName("event", obj);
const inputs = consumeParams(obj, true);
const anonymous = !!consumeKeywords(obj, setify(["anonymous"])).has("anonymous");
consumeEoi(obj);
return new EventFragment(_guard, name, inputs, anonymous);
}
return new EventFragment(_guard, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous);
}
static fromString(text) {
return EventFragment.fromTokens(lex(text));
}
static fromTokens(tokens) {
const name = consumeName("event", tokens);
const inputs = consumeParams(tokens, true);
const anonymous = !!consumeKeywords(tokens, setify(["anonymous"])).has("anonymous");
consumeEoi(tokens);
return new EventFragment(_guard, name, inputs, anonymous);
static isFragment(value) {
return (value && value[internal] === EventFragmentInternal);
}
}
export class ConstructorFragment extends Fragment {
@ -781,6 +770,7 @@ export class ConstructorFragment extends Fragment {
gas;
constructor(guard, type, inputs, payable, gas) {
super(guard, type, inputs);
Object.defineProperty(this, internal, { value: ConstructorFragmentInternal });
defineProperties(this, { payable, gas });
}
format(format = "sighash") {
@ -805,19 +795,25 @@ export class ConstructorFragment extends Fragment {
}
return result.join(" ");
}
static fromObject(obj) {
return new ConstructorFragment(_guard, "constructor", obj.inputs ? obj.inputs.map(ParamType.fromObject) : [], !!obj.payable, (obj.gas != null) ? obj.gas : null);
static from(obj) {
if (ConstructorFragment.isFragment(obj)) {
return obj;
}
if (typeof (obj) === "string") {
return ConstructorFragment.from(lex(obj));
}
else if (obj instanceof TokenString) {
consumeKeywords(obj, setify(["constructor"]));
const inputs = consumeParams(obj);
const payable = !!consumeKeywords(obj, setify(["payable"])).has("payable");
const gas = consumeGas(obj);
consumeEoi(obj);
return new ConstructorFragment(_guard, "constructor", inputs, payable, gas);
}
return new ConstructorFragment(_guard, "constructor", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, (obj.gas != null) ? obj.gas : null);
}
static fromString(text) {
return ConstructorFragment.fromTokens(lex(text));
}
static fromTokens(tokens) {
consumeKeywords(tokens, setify(["constructor"]));
const inputs = consumeParams(tokens);
const payable = !!consumeKeywords(tokens, setify(["payable"])).has("payable");
const gas = consumeGas(tokens);
consumeEoi(tokens);
return new ConstructorFragment(_guard, "constructor", inputs, payable, gas);
static isFragment(value) {
return (value && value[internal] === ConstructorFragmentInternal);
}
}
export class FunctionFragment extends NamedFragment {
@ -828,6 +824,7 @@ export class FunctionFragment extends NamedFragment {
gas;
constructor(guard, name, stateMutability, inputs, outputs, gas) {
super(guard, "function", name, inputs);
Object.defineProperty(this, internal, { value: FunctionFragmentInternal });
outputs = Object.freeze(outputs.slice());
const constant = (stateMutability === "view" || stateMutability === "pure");
const payable = (stateMutability === "payable");
@ -868,38 +865,54 @@ export class FunctionFragment extends NamedFragment {
}
return result.join(" ");
}
static fromObject(obj) {
// @TODO: verifyState for stateMutability
return new FunctionFragment(_guard, obj.name, obj.stateMutability, obj.inputs ? obj.inputs.map(ParamType.fromObject) : [], obj.outputs ? obj.outputs.map(ParamType.fromObject) : [], (obj.gas != null) ? obj.gas : null);
}
static fromString(text) {
return FunctionFragment.fromTokens(lex(text));
}
static fromTokens(tokens) {
const name = consumeName("function", tokens);
const inputs = consumeParams(tokens);
const mutability = consumeMutability(tokens);
let outputs = [];
if (consumeKeywords(tokens, setify(["returns"])).has("returns")) {
outputs = consumeParams(tokens);
static from(obj) {
if (FunctionFragment.isFragment(obj)) {
return obj;
}
const gas = consumeGas(tokens);
consumeEoi(tokens);
return new FunctionFragment(_guard, name, mutability, inputs, outputs, gas);
if (typeof (obj) === "string") {
return FunctionFragment.from(lex(obj));
}
else if (obj instanceof TokenString) {
const name = consumeName("function", obj);
const inputs = consumeParams(obj);
const mutability = consumeMutability(obj);
let outputs = [];
if (consumeKeywords(obj, setify(["returns"])).has("returns")) {
outputs = consumeParams(obj);
}
const gas = consumeGas(obj);
consumeEoi(obj);
return new FunctionFragment(_guard, name, mutability, inputs, outputs, gas);
}
// @TODO: verifyState for stateMutability
return new FunctionFragment(_guard, obj.name, obj.stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], (obj.gas != null) ? obj.gas : null);
}
static isFragment(value) {
return (value && value[internal] === FunctionFragmentInternal);
}
}
export class StructFragment extends NamedFragment {
constructor(guard, name, inputs) {
super(guard, "struct", name, inputs);
Object.defineProperty(this, internal, { value: StructFragmentInternal });
}
format() {
throw new Error("@TODO");
}
static fromString(text) {
return StructFragment.fromTokens(lex(text));
static from(obj) {
if (typeof (obj) === "string") {
return StructFragment.from(lex(obj));
}
else if (obj instanceof TokenString) {
const name = consumeName("struct", obj);
const inputs = consumeParams(obj);
consumeEoi(obj);
return new StructFragment(_guard, name, inputs);
}
return new StructFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);
}
static fromTokens(tokens) {
const name = consumeName("struct", tokens);
const inputs = consumeParams(tokens);
consumeEoi(tokens);
return new StructFragment(_guard, "struct", name, inputs);
static isFragment(value) {
return (value && value[internal] === StructFragmentInternal);
}
}
//# sourceMappingURL=fragments.js.map

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
//////
export { AbiCoder, defaultAbiCoder } from "./abi-coder.js";
export { formatBytes32String, parseBytes32String } from "./bytes32.js";
export { decodeBytes32String, encodeBytes32String } from "./bytes32.js";
export { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, NamedFragment, ParamType, StructFragment, } from "./fragments.js";
export { checkResultErrors, Indexed, Interface, ErrorDescription, LogDescription, TransactionDescription, Result } from "./interface.js";
export { Typed } from "./typed.js";

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":"AAGA,MAAM;AACN,OAAO,EACH,QAAQ,EACR,eAAe,EAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvE,OAAO,EACH,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAC3D,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,GAC7D,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,gBAAgB,EAAE,cAAc,EAAE,sBAAsB,EACxD,MAAM,EACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":"AAGA,MAAM;AACN,OAAO,EACH,QAAQ,EACR,eAAe,EAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EACH,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAC3D,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,GAC7D,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,gBAAgB,EAAE,cAAc,EAAE,sBAAsB,EACxD,MAAM,EACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}

@ -122,7 +122,9 @@ export class Interface {
try {
frags.push(Fragment.from(a));
}
catch (error) { }
catch (error) {
console.log("EE", error);
}
}
defineProperties(this, {
fragments: Object.freeze(frags)
@ -165,7 +167,7 @@ export class Interface {
// If we do not have a constructor add a default
if (!this.deploy) {
defineProperties(this, {
deploy: ConstructorFragment.fromString("constructor()")
deploy: ConstructorFragment.from("constructor()")
});
}
}
@ -273,7 +275,7 @@ export class Interface {
return matching[0];
}
// Normalize the signature and lookup the function
const result = this.#functions.get(FunctionFragment.fromString(key).format());
const result = this.#functions.get(FunctionFragment.from(key).format());
if (result) {
return result;
}
@ -352,7 +354,7 @@ export class Interface {
return matching[0];
}
// Normalize the signature and lookup the function
const result = this.#events.get(EventFragment.fromString(key).format());
const result = this.#events.get(EventFragment.from(key).format());
if (result) {
return result;
}
@ -392,7 +394,7 @@ export class Interface {
if (isHexString(key)) {
const selector = key.toLowerCase();
if (BuiltinErrors[selector]) {
return ErrorFragment.fromString(BuiltinErrors[selector].signature);
return ErrorFragment.from(BuiltinErrors[selector].signature);
}
for (const fragment of this.#errors.values()) {
if (selector === fragment.selector) {
@ -411,10 +413,10 @@ export class Interface {
}
if (matching.length === 0) {
if (key === "Error") {
return ErrorFragment.fromString("error Error(string)");
return ErrorFragment.from("error Error(string)");
}
if (key === "Panic") {
return ErrorFragment.fromString("error Panic(uint256)");
return ErrorFragment.from("error Panic(uint256)");
}
throwArgumentError("no matching error", "name", key);
}
@ -425,12 +427,12 @@ export class Interface {
return matching[0];
}
// Normalize the signature and lookup the function
key = ErrorFragment.fromString(key).format();
key = ErrorFragment.from(key).format();
if (key === "Error(string)") {
return ErrorFragment.fromString("error Error(string)");
return ErrorFragment.from("error Error(string)");
}
if (key === "Panic(uint256)") {
return ErrorFragment.fromString("error Panic(uint256)");
return ErrorFragment.from("error Panic(uint256)");
}
const result = this.#errors.get(key);
if (result) {
@ -791,7 +793,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string {
eventFragment.inputs.forEach((param, index) => {
if (param.indexed) {
if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") {
indexed.push(ParamType.fromObject({ type: "bytes32", name: param.name }));
indexed.push(ParamType.from({ type: "bytes32", name: param.name }));
dynamic.push(true);
}
else {

File diff suppressed because one or more lines are too long

@ -19,6 +19,7 @@ function lock() {
scryptSync.lock();
sha256.lock();
sha512.lock();
randomBytes.lock();
}
export { lock };
//# sourceMappingURL=index.js.map

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EACH,WAAW,EAEX,WAAW,EAEX,SAAS,EACT,SAAS,EACT,MAAM,EAAE,MAAM,EAEd,MAAM,EACN,MAAM,EAAE,UAAU,EACrB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,SAAS,IAAI;IACT,WAAW,CAAC,IAAI,EAAE,CAAC;IACnB,SAAS,CAAC,IAAI,EAAE,CAAC;IACjB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,WAAW,CAAC,IAAI,EAAE,CAAC;IACnB,SAAS,CAAC,IAAI,EAAE,CAAC;IACjB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,UAAU,CAAC,IAAI,EAAE,CAAC;IAClB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,MAAM,CAAC,IAAI,EAAE,CAAC;AAClB,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EACH,WAAW,EAEX,WAAW,EAEX,SAAS,EACT,SAAS,EACT,MAAM,EAAE,MAAM,EAEd,MAAM,EACN,MAAM,EAAE,UAAU,EACrB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,SAAS,IAAI;IACT,WAAW,CAAC,IAAI,EAAE,CAAC;IACnB,SAAS,CAAC,IAAI,EAAE,CAAC;IACjB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,WAAW,CAAC,IAAI,EAAE,CAAC;IACnB,SAAS,CAAC,IAAI,EAAE,CAAC;IACjB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,UAAU,CAAC,IAAI,EAAE,CAAC;IAClB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,WAAW,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}

@ -11,7 +11,7 @@ randomBytes._ = _randomBytes;
randomBytes.lock = function () { locked = true; };
randomBytes.register = function (func) {
if (locked) {
throw new Error("random is locked");
throw new Error("randomBytes is locked");
}
__randomBytes = func;
};

@ -1 +1 @@
{"version":3,"file":"random.js","sourceRoot":"","sources":["../../src.ts/crypto/random.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,aAAa,E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ChE,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAAE;IACzD,aAAa,GAAG,IAAI,CAAC;AACzB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"}

@ -1,7 +1,7 @@
/////////////////////////////
//
export { version } from "./_version.js";
export { formatBytes32String, parseBytes32String, AbiCoder, defaultAbiCoder, ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType, checkResultErrors, Indexed, Interface, LogDescription, Result, TransactionDescription, Typed, } from "./abi/index.js";
export { decodeBytes32String, encodeBytes32String, AbiCoder, defaultAbiCoder, ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType, checkResultErrors, Indexed, Interface, LogDescription, Result, TransactionDescription, Typed, } from "./abi/index.js";
export { getAddress, getIcapAddress, getCreateAddress, getCreate2Address } from "./address/index.js";
export { ZeroAddress, NegativeOne, Zero, One, Two, WeiPerEther, MaxUint256, MinInt256, MaxInt256, N, ZeroHash, EtherSymbol, MessagePrefix } from "./constants/index.js";
export { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, EventLog, } from "./contract/index.js";

@ -1 +1 @@
{"version":3,"file":"ethers.js","sourceRoot":"","sources":["../src.ts/ethers.ts"],"names":[],"mappings":"AAEA,6BAA6B;AAC7B,EAAE;AAEF,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EACH,mBAAmB,EAAE,kBAAkB,EAEvC,QAAQ,EAAE,eAAe,EACzB,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAExF,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,sBAAsB,EACrF,KAAK,GACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,UAAU,EAAE,cAAc,EAC1B,gBAAgB,E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YAAY,EAAE,YAAY,EACpE,cAAc,EAAE,mBAAmB,EAAE,eAAe,EAAE,aAAa,EACnE,SAAS,EAAE,kBAAkB,EAAE,UAAU,EACzC,eAAe,EAAE,OAAO,EACxB,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAClE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EACjD,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EACpE,QAAQ,EAAE,MAAM,EAAE,IAAI,EACtB,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAChD,oBAAoB,EAAE,WAAW,EAAE,gBAAgB,EAAE,YAAY,EACjE,cAAc,EACd,SAAS,EAAE,SAAS,EACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACH,WAAW,EACX,cAAc,EACd,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EACnD,eAAe,EAAE,oBAAoB,EACrC,cAAc,EAAE,uBAAuB,EAAE,mBAAmB,EAC5D,mBAAmB,EACnB,QAAQ,EACR,MAAM,EACT,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACH,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EACjE,MAAM,sBAAsB,CAAC"}

@ -1,6 +1,7 @@
import { WebSocket as _WebSocket } from "./ws.js"; /*-browser*/
import { SocketProvider } from "./provider-socket.js";
export class WebSocketProvider extends SocketProvider {
#connect;
#websocket;
get websocket() {
if (this.#websocket == null) {
@ -11,14 +12,21 @@ export class WebSocketProvider extends SocketProvider {
constructor(url, network) {
super(network);
if (typeof (url) === "string") {
this.#websocket = new _WebSocket(url);
this.#connect = () => { return new _WebSocket(url); };
this.#websocket = this.#connect();
}
else if (typeof (url) === "function") {
this.#connect = url;
this.#websocket = url();
}
else {
this.#connect = null;
this.#websocket = url;
}
this.websocket.onopen = async () => {
try {
await this._start();
this.resume();
}
catch (error) {
console.log("failed to start WebsocketProvider", error);
@ -28,6 +36,21 @@ export class WebSocketProvider extends SocketProvider {
this.websocket.onmessage = (message) => {
this._processMessage(message.data);
};
/*
this.websocket.onclose = (event) => {
// @TODO: What event.code should we reconnect on?
const reconnect = false;
if (reconnect) {
this.pause(true);
if (this.#connect) {
this.#websocket = this.#connect();
this.#websocket.onopen = ...
// @TODO: this requires the super class to rebroadcast; move it there
}
this._reconnect();
}
};
*/
}
async _write(message) {
this.websocket.send(message);

@ -1 +1 @@
{"version":3,"file":"provider-websocket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-websocket.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,MAAM,SAAS,CAAC,CAAC,YAAY;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAetD,MAAM,OAAO,iBAAkB,SAAQ,cAAc;IACjD,UAAU,CAAuB;IACjC,IAAI,SAAS;QACT,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;SAAE;QACrE,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,YAAY,GAA2B,EAAE,OAAoB;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,OAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE;YAC1B,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;SACzC;aAAM;YACH,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;SACzB;QAED,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,KAAK,IAAI,EAAE;YAC/B,IAAI;gBACA,MAAM,IAAI,CAAC,MAAM,EAAE,CAAA;aACtB;YAAC,OAAO,KAAK,EAAE;gBACZ,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;gBACxD,sCAAsC;a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;SACrC;aAAM,IAAI,OAAM,CAAC,GAAG,CAAC,KAAK,UAAU,EAAE;YACnC,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC;YACpB,IAAI,CAAC,UAAU,GAAG,GAAG,EAAE,CAAC;SAC3B;aAAM;YACH,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACrB,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;SACzB;QAED,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,KAAK,IAAI,EAAE;YAC/B,IAAI;gBACA,MAAM,IAAI,CAAC,MAAM,EAAE,CAAA;gBACnB,IAAI,CAAC,MAAM,EAAE,CAAC;aACjB;YAAC,OAAO,KAAK,EAAE;gBACZ,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;gBACxD,sCAAsC;aACzC;QACL,CAAC,CAAC;QAEF,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,CAAC,OAAyB,EAAE,EAAE;YACrD,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACvC,CAAC,CAAC;QACV;;;;;;;;;;;;;;UAcE;IACE,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAe;QACxB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,OAAO;QACT,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,EAAE;YAAE,OAAO;SAAE;QACxC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IAC3B,CAAC;CACJ"}

@ -54,6 +54,9 @@ export function getBigInt(value, name) {
return BigInt(value);
case "string":
try {
if (value[0] === "-" && value[1] !== "-") {
return -BigInt(value.substring(1));
}
return BigInt(value);
}
catch (e) {

File diff suppressed because one or more lines are too long

@ -104,7 +104,7 @@
"types": "./types/wordlistsindex.d.ts"
}
},
"gitHead": "9771b851f8a1173a2a3474f618e999a7672d2347",
"gitHead": "8bece98e3e025b3ef05c04c56b353fe49ca8e016",
"keywords": [
"ethereum",
"ethers",
@ -137,9 +137,9 @@
"clean": "rm -rf dist lib.esm lib.commonjs types",
"stats": "echo 'Dependencies' && npm ls --all --omit=dev",
"test": "npm run test-esm",
"test-esm": "mocha --reporter ./reporter.cjs ./lib.esm/_tests/test-*.js",
"test-commonjs": "mocha --reporter ./reporter.cjs ./lib.commonjs/_tests/test-*.js",
"test-coverage": "c8 -o output -r lcov -r text mocha --no-color --reporter ./reporter.cjs ./lib.esm/_tests/test-*.js | tee output/summary.txt"
"test-coverage": "c8 -o output -r lcov -r text mocha --no-color --reporter ./reporter.cjs ./lib.esm/_tests/test-*.js | tee output/summary.txt",
"test-esm": "mocha --reporter ./reporter.cjs ./lib.esm/_tests/test-*.js"
},
"sideEffects": false,
"type": "module",

2
types/_version.d.ts vendored

@ -1,2 +1,2 @@
export declare const version = "6.0.0-beta-exports.3";
export declare const version = "6.0.0-beta-exports.4";
//# sourceMappingURL=_version.d.ts.map

@ -1,4 +1,4 @@
import type { BytesLike } from "../utils/index.js";
export declare function formatBytes32String(text: string): string;
export declare function parseBytes32String(_bytes: BytesLike): string;
export declare function encodeBytes32String(text: string): string;
export declare function decodeBytes32String(_bytes: BytesLike): string;
//# sourceMappingURL=bytes32.d.ts.map

@ -1 +1 @@
{"version":3,"file":"bytes32.d.ts","sourceRoot":"","sources":["../../src.ts/abi/bytes32.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAUxD;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAa5D"}
{"version":3,"file":"bytes32.d.ts","sourceRoot":"","sources":["../../src.ts/abi/bytes32.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAUxD;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAa7D"}

@ -17,36 +17,6 @@ export interface JsonFragment {
readonly gas?: string;
}
export declare type FormatType = "sighash" | "minimal" | "full" | "json";
/**
* @ignore:
*/
declare type Token = Readonly<{
type: string;
offset: number;
text: string;
depth: number;
match: number;
linkBack: number;
linkNext: number;
value: number;
}>;
declare class TokenString {
#private;
get offset(): number;
get length(): number;
constructor(tokens: ReadonlyArray<Token>);
clone(): TokenString;
reset(): void;
popKeyword(allowed: ReadonlySet<string>): string;
popType(type: string): string;
popParen(): TokenString;
popParams(): Array<TokenString>;
peek(): Token;
peekKeyword(allowed: ReadonlySet<string>): null | string;
peekType(type: string): null | string;
pop(): Token;
toString(): string;
}
export declare type FragmentWalkFunc = (type: string, value: any) => any;
export declare type FragmentWalkAsyncFunc = (type: string, value: any) => any | Promise<any>;
export declare class ParamType {
@ -76,8 +46,6 @@ export declare class ParamType {
walk(value: any, process: FragmentWalkFunc): any;
walkAsync(value: any, process: (type: string, value: any) => any | Promise<any>): Promise<any>;
static from(obj: any, allowIndexed?: boolean): ParamType;
static fromObject(obj: any, allowIndexed?: boolean): ParamType;
static fromTokens(tokens: TokenString, allowIndexed?: boolean): ParamType;
static isParamType(value: any): value is ParamType;
}
export declare type FragmentType = "constructor" | "error" | "event" | "function" | "struct";
@ -87,9 +55,6 @@ export declare abstract class Fragment {
constructor(guard: any, type: FragmentType, inputs: ReadonlyArray<ParamType>);
abstract format(format?: FormatType): string;
static from(obj: any): Fragment;
static fromObject(obj: any): Fragment;
static fromString(text: string): Fragment;
static fromTokens(tokens: TokenString): Fragment;
static isConstructor(value: any): value is ConstructorFragment;
static isError(value: any): value is ErrorFragment;
static isEvent(value: any): value is EventFragment;
@ -104,27 +69,24 @@ export declare class ErrorFragment extends NamedFragment {
constructor(guard: any, name: string, inputs: ReadonlyArray<ParamType>);
get selector(): string;
format(format?: FormatType): string;
static fromObject(obj: any): ErrorFragment;
static fromString(text: string): ErrorFragment;
static fromTokens(tokens: TokenString): ErrorFragment;
static from(obj: any): ErrorFragment;
static isFragment(value: any): value is ErrorFragment;
}
export declare class EventFragment extends NamedFragment {
readonly anonymous: boolean;
constructor(guard: any, name: string, inputs: ReadonlyArray<ParamType>, anonymous: boolean);
get topicHash(): string;
format(format?: FormatType): string;
static fromObject(obj: any): EventFragment;
static fromString(text: string): EventFragment;
static fromTokens(tokens: TokenString): EventFragment;
static from(obj: any): EventFragment;
static isFragment(value: any): value is EventFragment;
}
export declare class ConstructorFragment extends Fragment {
readonly payable: boolean;
readonly gas: null | bigint;
constructor(guard: any, type: FragmentType, inputs: ReadonlyArray<ParamType>, payable: boolean, gas: null | bigint);
format(format?: FormatType): string;
static fromObject(obj: any): ConstructorFragment;
static fromString(text: string): ConstructorFragment;
static fromTokens(tokens: TokenString): ConstructorFragment;
static from(obj: any): ConstructorFragment;
static isFragment(value: any): value is ConstructorFragment;
}
export declare class FunctionFragment extends NamedFragment {
readonly constant: boolean;
@ -135,14 +97,13 @@ export declare class FunctionFragment extends NamedFragment {
constructor(guard: any, name: string, stateMutability: string, inputs: ReadonlyArray<ParamType>, outputs: ReadonlyArray<ParamType>, gas: null | bigint);
get selector(): string;
format(format?: FormatType): string;
static fromObject(obj: any): FunctionFragment;
static fromString(text: string): FunctionFragment;
static fromTokens(tokens: TokenString): FunctionFragment;
static from(obj: any): FunctionFragment;
static isFragment(value: any): value is FunctionFragment;
}
export declare class StructFragment extends NamedFragment {
constructor(guard: any, name: string, inputs: ReadonlyArray<ParamType>);
format(): string;
static fromString(text: string): StructFragment;
static fromTokens(tokens: TokenString): StructFragment;
static from(obj: any): StructFragment;
static isFragment(value: any): value is FunctionFragment;
}
export {};
//# sourceMappingURL=fragments.d.ts.map

File diff suppressed because one or more lines are too long

@ -1,5 +1,5 @@
export { AbiCoder, defaultAbiCoder } from "./abi-coder.js";
export { formatBytes32String, parseBytes32String } from "./bytes32.js";
export { decodeBytes32String, encodeBytes32String } from "./bytes32.js";
export { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, NamedFragment, ParamType, StructFragment, } from "./fragments.js";
export { checkResultErrors, Indexed, Interface, ErrorDescription, LogDescription, TransactionDescription, Result } from "./interface.js";
export { Typed } from "./typed.js";

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,QAAQ,EACR,eAAe,EAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvE,OAAO,EACH,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAC3D,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,GAC7D,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,gBAAgB,EAAE,cAAc,EAAE,sBAAsB,EACxD,MAAM,EACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,YAAY,EACR,YAAY,EAAE,gBAAgB,EAC9B,UAAU,EAAE,YAAY,EAAE,qBAAqB,EAAE,gBAAgB,EACpE,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACR,YAAY,GACf,MAAM,gBAAgB,CAAC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,QAAQ,EACR,eAAe,EAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EACH,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAC3D,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,GAC7D,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,gBAAgB,EAAE,cAAc,EAAE,sBAAsB,EACxD,MAAM,EACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,YAAY,EACR,YAAY,EAAE,gBAAgB,EAC9B,UAAU,EAAE,YAAY,EAAE,qBAAqB,EAAE,gBAAgB,EACpE,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACR,YAAY,GACf,MAAM,gBAAgB,CAAC"}

@ -170,8 +170,8 @@ export declare class Interface {
* a result from a Contract.
*/
encodeFunctionResult(key: FunctionFragment | string, values?: ReadonlyArray<any>): string;
encodeFilterTopics(eventFragment: EventFragment, values: ReadonlyArray<any>): Array<null | string | Array<string>>;
encodeEventLog(eventFragment: EventFragment, values: ReadonlyArray<any>): {
encodeFilterTopics(eventFragment: EventFragment | string, values: ReadonlyArray<any>): Array<null | string | Array<string>>;
encodeEventLog(eventFragment: EventFragment | string, values: ReadonlyArray<any>): {
data: string;
topics: Array<string>;
};

@ -1 +1 @@
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src.ts/abi/interface.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC1H,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA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AAC;AAKhB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}

2
types/ethers.d.ts vendored

@ -1,5 +1,5 @@
export { version } from "./_version.js";
export { formatBytes32String, parseBytes32String, AbiCoder, defaultAbiCoder, ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType, checkResultErrors, Indexed, Interface, LogDescription, Result, TransactionDescription, Typed, } from "./abi/index.js";
export { decodeBytes32String, encodeBytes32String, AbiCoder, defaultAbiCoder, ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType, checkResultErrors, Indexed, Interface, LogDescription, Result, TransactionDescription, Typed, } from "./abi/index.js";
export { getAddress, getIcapAddress, getCreateAddress, getCreate2Address } from "./address/index.js";
export { ZeroAddress, NegativeOne, Zero, One, Two, WeiPerEther, MaxUint256, MinInt256, MaxInt256, N, ZeroHash, EtherSymbol, MessagePrefix } from "./constants/index.js";
export { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, EventLog, } from "./contract/index.js";

@ -1 +1 @@
{"version":3,"file":"ethers.d.ts","sourceRoot":"","sources":["../src.ts/ethers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EACH,mBAAmB,EAAE,kBAAkB,EAEvC,QAAQ,EAAE,eAAe,EACzB,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAExF,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,sBAAsB,EACrF,KAAK,GACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,UAAU,EAAE,cAAc,EAC1B,gBAAgB,EAAE,iBAAiB,EACtC,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACH,WAAW,EACX,WAAW,EAAE,IA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,EAAE,eAAe,EACrC,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EACR,SAAS,EACT,YAAY,EAAE,OAAO,EACrB,SAAS,EACT,aAAa,EAAE,wBAAwB,EAAE,eAAe,EACxD,iBAAiB,EAEjB,cAAc,EACd,kBAAkB,EAAE,gBAAgB,EAAE,cAAc,EACpD,gBAAgB,EAAE,eAAe,EAEjC,WAAW,EAAE,YAAY,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,YAAY,EACvF,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAC3E,iBAAiB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,uBAAuB,EACtF,kBAAkB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,kBAAkB,EACjF,2BAA2B,EAAE,wBAAwB,EAAE,qBAAqB,EAC5E,0BAA0B,EAAE,mBAAmB,EAC/C,gBAAgB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACR,qBAAqB,EAAE,eAAe,EACtC,cAAc,EACjB,MAAM,mBAAmB,CAAC"}

@ -8,10 +8,11 @@ export interface WebSocketLike {
send(payload: any): void;
close(code?: number, reason?: string): void;
}
export declare type WebSocketCreator = () => WebSocketLike;
export declare class WebSocketProvider extends SocketProvider {
#private;
get websocket(): WebSocketLike;
constructor(url: string | WebSocketLike, network?: Networkish);
constructor(url: string | WebSocketLike | WebSocketCreator, network?: Networkish);
_write(message: string): Promise<void>;
destroy(): Promise<void>;
}

@ -1 +1 @@
{"version":3,"file":"provider-websocket.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-websocket.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,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