admin: updated dist files

This commit is contained in:
Richard Moore 2023-10-09 20:27:56 -04:00
parent aca848f772
commit 3644140861
106 changed files with 6066 additions and 3820 deletions

View File

@ -3,6 +3,16 @@ Change Log
This change log is maintained by `src.ts/_admin/update-changelog.ts` but may also be manually updated. This change log is maintained by `src.ts/_admin/update-changelog.ts` but may also be manually updated.
ethers/v6.8.0 (2023-10-09 20:22)
--------------------------------
- Initial shortMessage support for errors ([#4241](https://github.com/ethers-io/ethers.js/issues/4241); [d6a8c14](https://github.com/ethers-io/ethers.js/commit/d6a8c14d907cf8b90347444c0186b83a5db2e293)).
- Fixed resolving ENS addresses used as from parameters ([#3961](https://github.com/ethers-io/ethers.js/issues/3961); [2616f4c](https://github.com/ethers-io/ethers.js/commit/2616f4c30c82bd45449b73fa37ef269d60a07d80)).
- Allow more loose input format for RLP encoder ([#4402](https://github.com/ethers-io/ethers.js/issues/4402); [9a4b753](https://github.com/ethers-io/ethers.js/commit/9a4b7534458fc79a0654b0eb57fc956bffa02a2f)).
- Update to latest noble crypto libraries ([#3975](https://github.com/ethers-io/ethers.js/issues/3975); [b27faa0](https://github.com/ethers-io/ethers.js/commit/b27faa02ac8f90e2e54b188e8139c59d98c469e3)).
- More robust configuration options for FetchRequest getUrl functions ([#4353](https://github.com/ethers-io/ethers.js/issues/4353); [9541f2f](https://github.com/ethers-io/ethers.js/commit/9541f2f70cd7f5c6f3caf93f5a3d5e34eae5281a)).
- Ignore blockTag when calling Etherscan if it is the default block tag ([dcea9b3](https://github.com/ethers-io/ethers.js/commit/dcea9b353619d85878ad2ba340ae17e5c285d558)).
ethers/v6.7.1 (2023-08-15 03:08) ethers/v6.7.1 (2023-08-15 03:08)
-------------------------------- --------------------------------

4247
dist/ethers.js vendored

File diff suppressed because one or more lines are too long

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

4247
dist/ethers.umd.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,21 +2,11 @@ function number(n) {
if (!Number.isSafeInteger(n) || n < 0) if (!Number.isSafeInteger(n) || n < 0)
throw new Error(`Wrong positive integer: ${n}`); throw new Error(`Wrong positive integer: ${n}`);
} }
function bool(b) {
if (typeof b !== 'boolean')
throw new Error(`Expected boolean, not ${b}`);
}
function bytes(b, ...lengths) { function bytes(b, ...lengths) {
if (!(b instanceof Uint8Array)) if (!(b instanceof Uint8Array))
throw new TypeError('Expected Uint8Array'); throw new Error('Expected Uint8Array');
if (lengths.length > 0 && !lengths.includes(b.length)) if (lengths.length > 0 && !lengths.includes(b.length))
throw new TypeError(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`); throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
}
function hash(hash) {
if (typeof hash !== 'function' || typeof hash.create !== 'function')
throw new Error('Hash should be wrapped by utils.wrapConstructor');
number(hash.outputLen);
number(hash.blockLen);
} }
function exists(instance, checkFinished = true) { function exists(instance, checkFinished = true) {
if (instance.destroyed) if (instance.destroyed)
@ -31,36 +21,39 @@ function output(out, instance) {
throw new Error(`digestInto() expects output buffer of length at least ${min}`); throw new Error(`digestInto() expects output buffer of length at least ${min}`);
} }
} }
const assert$1 = {
number,
bool,
bytes,
hash,
exists,
output,
};
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
// The import here is via the package name. This is to ensure // We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
// that exports mapping/resolution does fall into place. // node.js versions earlier than v19 don't declare it in global scope.
// For node.js, package.json#exports field mapping rewrites import
// from `crypto` to `cryptoNode`, which imports native module.
// Makes the utils un-importable in browsers without a bundler.
// Once node.js 18 is deprecated, we can just drop the import.
const u8a = (a) => a instanceof Uint8Array;
const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
// big-endian hardware is rare. Just in case someone still decides to run hashes:
// early-throw an error because we don't support BE yet.
const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44; const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;
// There is almost no big endian hardware, but js typed arrays uses platform specific endianness.
// So, just to be sure not to corrupt anything.
if (!isLE) if (!isLE)
throw new Error('Non little-endian hardware is not supported'); throw new Error('Non little-endian hardware is not supported');
Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '0')); /**
* @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
*/
function utf8ToBytes(str) { function utf8ToBytes(str) {
if (typeof str !== 'string') { if (typeof str !== 'string')
throw new TypeError(`utf8ToBytes expected string, got ${typeof str}`); throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
} return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
return new TextEncoder().encode(str);
} }
/**
* Normalizes (non-hex) string or Uint8Array to Uint8Array.
* Warning: when Uint8Array is passed, it would NOT get copied.
* Keep in mind for future mutable operations.
*/
function toBytes(data) { function toBytes(data) {
if (typeof data === 'string') if (typeof data === 'string')
data = utf8ToBytes(data); data = utf8ToBytes(data);
if (!(data instanceof Uint8Array)) if (!u8a(data))
throw new TypeError(`Expected input type is Uint8Array (got ${typeof data})`); throw new Error(`expected Uint8Array, got ${typeof data}`);
return data; return data;
} }
// For runtime check if class implements interface // For runtime check if class implements interface
@ -70,25 +63,17 @@ class Hash {
return this._cloneInto(); return this._cloneInto();
} }
} }
function wrapConstructor(hashConstructor) { function wrapConstructor(hashCons) {
const hashC = (message) => hashConstructor().update(toBytes(message)).digest(); const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
const tmp = hashConstructor(); const tmp = hashCons();
hashC.outputLen = tmp.outputLen; hashC.outputLen = tmp.outputLen;
hashC.blockLen = tmp.blockLen; hashC.blockLen = tmp.blockLen;
hashC.create = () => hashConstructor(); hashC.create = () => hashCons();
return hashC;
}
function wrapConstructorWithOpts(hashCons) {
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
const tmp = hashCons({});
hashC.outputLen = tmp.outputLen;
hashC.blockLen = tmp.blockLen;
hashC.create = (opts) => hashCons(opts);
return hashC; return hashC;
} }
const U32_MASK64 = BigInt(2 ** 32 - 1); const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
const _32n = BigInt(32); const _32n = /* @__PURE__ */ BigInt(32);
// We are not using BigUint64Array, because they are extremely slow as per 2022 // We are not using BigUint64Array, because they are extremely slow as per 2022
function fromBig(n, le = false) { function fromBig(n, le = false) {
if (le) if (le)
@ -104,54 +89,18 @@ function split(lst, le = false) {
} }
return [Ah, Al]; return [Ah, Al];
} }
const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);
// for Shift in [0, 32)
const shrSH = (h, l, s) => h >>> s;
const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
// Right rotate for Shift in [1, 32)
const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));
const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);
// Right rotate for Shift in (32, 64), NOTE: 32 is special case.
const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));
const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));
// Right rotate for shift===32 (just swaps l&h)
const rotr32H = (h, l) => l;
const rotr32L = (h, l) => h;
// Left rotate for Shift in [1, 32) // Left rotate for Shift in [1, 32)
const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s)); const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s)); const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
// Left rotate for Shift in (32, 64), NOTE: 32 is special case. // Left rotate for Shift in (32, 64), NOTE: 32 is special case.
const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s)); const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s)); const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
// JS uses 32-bit signed integers for bitwise operations which means we cannot
// simple take carry out of low bit sum by shift, we need to use division.
// Removing "export" has 5% perf penalty -_-
function add(Ah, Al, Bh, Bl) {
const l = (Al >>> 0) + (Bl >>> 0);
return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };
}
// Addition with more than 2 elements
const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;
const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;
const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;
// prettier-ignore
const u64 = {
fromBig, split, toBig,
shrSH, shrSL,
rotrSH, rotrSL, rotrBH, rotrBL,
rotr32H, rotr32L,
rotlSH, rotlSL, rotlBH, rotlBL,
add, add3L, add3H, add4L, add4H, add5H, add5L,
};
/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */ /* Do NOT modify this file; see /src.ts/_admin/update-version.ts */
/** /**
* The current version of Ethers. * The current version of Ethers.
*/ */
const version = "6.7.1"; const version = "6.8.0";
/** /**
* Property helper functions. * Property helper functions.
@ -252,6 +201,7 @@ function stringify(value) {
* ethers version, %%code%% and all aditional properties, serialized. * ethers version, %%code%% and all aditional properties, serialized.
*/ */
function makeError(message, code, info) { function makeError(message, code, info) {
let shortMessage = message;
{ {
const details = []; const details = [];
if (info) { if (info) {
@ -259,6 +209,9 @@ function makeError(message, code, info) {
throw new Error(`value will overwrite populated values: ${stringify(info)}`); throw new Error(`value will overwrite populated values: ${stringify(info)}`);
} }
for (const key in info) { for (const key in info) {
if (key === "shortMessage") {
continue;
}
const value = (info[key]); const value = (info[key]);
// try { // try {
details.push(key + "=" + stringify(value)); details.push(key + "=" + stringify(value));
@ -290,6 +243,9 @@ function makeError(message, code, info) {
if (info) { if (info) {
Object.assign(error, info); Object.assign(error, info);
} }
if (error.shortMessage == null) {
defineProperties(error, { shortMessage });
}
return error; return error;
} }
/** /**
@ -601,14 +557,16 @@ function toUtf8String(bytes, onError) {
return _toUtf8String(getUtf8CodePoints(bytes, onError)); return _toUtf8String(getUtf8CodePoints(bytes, onError));
} }
// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.
// It's called a sponge function.
// Various per round constants calculations // Various per round constants calculations
const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []]; const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];
const _0n = BigInt(0); const _0n = /* @__PURE__ */ BigInt(0);
const _1n = BigInt(1); const _1n = /* @__PURE__ */ BigInt(1);
const _2n = BigInt(2); const _2n = /* @__PURE__ */ BigInt(2);
const _7n = BigInt(7); const _7n = /* @__PURE__ */ BigInt(7);
const _256n = BigInt(256); const _256n = /* @__PURE__ */ BigInt(256);
const _0x71n = BigInt(0x71); const _0x71n = /* @__PURE__ */ BigInt(0x71);
for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
// Pi // Pi
[x, y] = [y, (2 * x + 3 * y) % 5]; [x, y] = [y, (2 * x + 3 * y) % 5];
@ -620,14 +578,14 @@ for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
for (let j = 0; j < 7; j++) { for (let j = 0; j < 7; j++) {
R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n; R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;
if (R & _2n) if (R & _2n)
t ^= _1n << ((_1n << BigInt(j)) - _1n); t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);
} }
_SHA3_IOTA.push(t); _SHA3_IOTA.push(t);
} }
const [SHA3_IOTA_H, SHA3_IOTA_L] = u64.split(_SHA3_IOTA, true); const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
// Left rotation (without 0, 32, 64) // Left rotation (without 0, 32, 64)
const rotlH = (h, l, s) => s > 32 ? u64.rotlBH(h, l, s) : u64.rotlSH(h, l, s); const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));
const rotlL = (h, l, s) => s > 32 ? u64.rotlBL(h, l, s) : u64.rotlSL(h, l, s); const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));
// Same as keccakf1600, but allows to skip some rounds // Same as keccakf1600, but allows to skip some rounds
function keccakP(s, rounds = 24) { function keccakP(s, rounds = 24) {
const B = new Uint32Array(5 * 2); const B = new Uint32Array(5 * 2);
@ -688,7 +646,7 @@ class Keccak extends Hash {
this.finished = false; this.finished = false;
this.destroyed = false; this.destroyed = false;
// Can be passed from user as dkLen // Can be passed from user as dkLen
assert$1.number(outputLen); number(outputLen);
// 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
if (0 >= this.blockLen || this.blockLen >= 200) if (0 >= this.blockLen || this.blockLen >= 200)
throw new Error('Sha3 supports only keccak-f1600 function'); throw new Error('Sha3 supports only keccak-f1600 function');
@ -701,7 +659,7 @@ class Keccak extends Hash {
this.pos = 0; this.pos = 0;
} }
update(data) { update(data) {
assert$1.exists(this); exists(this);
const { blockLen, state } = this; const { blockLen, state } = this;
data = toBytes(data); data = toBytes(data);
const len = data.length; const len = data.length;
@ -727,8 +685,8 @@ class Keccak extends Hash {
this.keccak(); this.keccak();
} }
writeInto(out) { writeInto(out) {
assert$1.exists(this, false); exists(this, false);
assert$1.bytes(out); bytes(out);
this.finish(); this.finish();
const bufferOut = this.state; const bufferOut = this.state;
const { blockLen } = this; const { blockLen } = this;
@ -749,11 +707,11 @@ class Keccak extends Hash {
return this.writeInto(out); return this.writeInto(out);
} }
xof(bytes) { xof(bytes) {
assert$1.number(bytes); number(bytes);
return this.xofInto(new Uint8Array(bytes)); return this.xofInto(new Uint8Array(bytes));
} }
digestInto(out) { digestInto(out) {
assert$1.output(out, this); output(out, this);
if (this.finished) if (this.finished)
throw new Error('digest() was already called'); throw new Error('digest() was already called');
this.writeInto(out); this.writeInto(out);
@ -784,25 +742,11 @@ class Keccak extends Hash {
} }
} }
const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen)); const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
gen(0x06, 144, 224 / 8);
/**
* SHA3-256 hash function
* @param message - that would be hashed
*/
gen(0x06, 136, 256 / 8);
gen(0x06, 104, 384 / 8);
gen(0x06, 72, 512 / 8);
gen(0x01, 144, 224 / 8);
/** /**
* keccak-256 hash function. Different from SHA3-256. * keccak-256 hash function. Different from SHA3-256.
* @param message - that would be hashed * @param message - that would be hashed
*/ */
const keccak_256 = gen(0x01, 136, 256 / 8); const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);
gen(0x01, 104, 384 / 8);
gen(0x01, 72, 512 / 8);
const genShake = (suffix, blockLen, outputLen) => wrapConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));
genShake(0x1f, 168, 128 / 8);
genShake(0x1f, 136, 256 / 8);
/** /**
* Cryptographic hashing functions * Cryptographic hashing functions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,5 +5,5 @@ exports.version = void 0;
/** /**
* The current version of Ethers. * The current version of Ethers.
*/ */
exports.version = "6.7.1"; exports.version = "6.8.0";
//# sourceMappingURL=_version.js.map //# sourceMappingURL=_version.js.map

View File

@ -368,7 +368,7 @@ export declare class Interface {
* Parses a revert data, finding the matching error and extracts * Parses a revert data, finding the matching error and extracts
* the parameter values along with other useful error details. * the parameter values along with other useful error details.
* *
* If the matching event cannot be found, returns null. * If the matching error cannot be found, returns null.
*/ */
parseError(data: BytesLike): null | ErrorDescription; parseError(data: BytesLike): null | ErrorDescription;
/** /**

View File

@ -1068,7 +1068,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string {
* Parses a revert data, finding the matching error and extracts * Parses a revert data, finding the matching error and extracts
* the parameter values along with other useful error details. * the parameter values along with other useful error details.
* *
* If the matching event cannot be found, returns null. * If the matching error cannot be found, returns null.
*/ */
parseError(data) { parseError(data) {
const hexData = (0, index_js_3.hexlify)(data); const hexData = (0, index_js_3.hexlify)(data);

View File

@ -1 +1 @@
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src.ts/contract/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAS,MAAM,iBAAiB,CAAC;AAInD,OAAO,EAAe,GAAG,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAMjF,OAAO,EAEH,2BAA2B,EAC3B,QAAQ,EACX,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAU,MAAM,iBAAiB,CAAC;AACxG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EACR,QAAQ,EAAE,cAAc,EAC3B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAER,iB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M,CAAC,EAAE,IAAI,GAAG,cAAc,KAAK,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;IAS3K;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,YAAY,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc,GAAG,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;CAKhK;;AAMD;;GAEG;AACH,qBAAa,QAAS,SAAQ,aAAe;CAAI"}

View File

@ -21,6 +21,17 @@ function canResolve(value) {
function canSend(value) { function canSend(value) {
return (value && typeof (value.sendTransaction) === "function"); return (value && typeof (value.sendTransaction) === "function");
} }
function getResolver(value) {
if (value != null) {
if (canResolve(value)) {
return value;
}
if (value.provider) {
return value.provider;
}
}
return undefined;
}
class PreparedTopicFilter { class PreparedTopicFilter {
#filter; #filter;
fragment; fragment;
@ -92,7 +103,7 @@ async function copyOverrides(arg, allowed) {
(0, index_js_3.assertArgument)(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data); (0, index_js_3.assertArgument)(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data);
// Resolve any from // Resolve any from
if (overrides.from) { if (overrides.from) {
overrides.from = await (0, index_js_2.resolveAddress)(overrides.from); overrides.from = overrides.from;
} }
return overrides; return overrides;
} }
@ -120,6 +131,9 @@ function buildWrappedFallback(contract) {
// If an overrides was passed in, copy it and normalize the values // If an overrides was passed in, copy it and normalize the values
const tx = (await copyOverrides(overrides, ["data"])); const tx = (await copyOverrides(overrides, ["data"]));
tx.to = await contract.getAddress(); tx.to = await contract.getAddress();
if (tx.from) {
tx.from = await (0, index_js_2.resolveAddress)(tx.from, getResolver(contract.runner));
}
const iface = contract.interface; const iface = contract.interface;
const noValue = ((0, index_js_3.getBigInt)((tx.value || BN_0), "overrides.value") === BN_0); const noValue = ((0, index_js_3.getBigInt)((tx.value || BN_0), "overrides.value") === BN_0);
const noData = ((tx.data || "0x") === "0x"); const noData = ((tx.data || "0x") === "0x");
@ -188,6 +202,9 @@ function buildWrappedMethod(contract, key) {
let overrides = {}; let overrides = {};
if (fragment.inputs.length + 1 === args.length) { if (fragment.inputs.length + 1 === args.length) {
overrides = await copyOverrides(args.pop()); overrides = await copyOverrides(args.pop());
if (overrides.from) {
overrides.from = await (0, index_js_2.resolveAddress)(overrides.from, getResolver(contract.runner));
}
} }
if (fragment.inputs.length !== args.length) { if (fragment.inputs.length !== args.length) {
throw new Error("internal error: fragment inputs doesn't match arguments; should not happen"); throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"version":3,"file":"signing-key.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAUhD;;;GAGG;AACH,qBAAa,UAAU;;IAGnB;;OAEG;gBACS,UAAU,EAAE,SAAS;IAKjC;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAA6B;IAErD;;;;;OAKG;IACH,IAAI,SAAS,IAAI,MAAM,CAA0D;IAEjF;;;;;;OAMG;IACH,IAAI,mBAAmB,IAAI,MAAM,CAAgE;IAEjG;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS;IAgBlC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAK7C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,SAAS,E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C,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;CAK/E"}

View File

@ -6,16 +6,9 @@
*/ */
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.SigningKey = void 0; exports.SigningKey = void 0;
const tslib_1 = require("tslib"); const secp256k1_1 = require("@noble/curves/secp256k1");
const secp256k1 = tslib_1.__importStar(require("@noble/secp256k1"));
const index_js_1 = require("../utils/index.js"); const index_js_1 = require("../utils/index.js");
const hmac_js_1 = require("./hmac.js");
const signature_js_1 = require("./signature.js"); const signature_js_1 = require("./signature.js");
//const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
// Make noble-secp256k1 sync
secp256k1.utils.hmacSha256Sync = function (key, ...messages) {
return (0, index_js_1.getBytes)((0, hmac_js_1.computeHmac)("sha256", key, (0, index_js_1.concat)(messages)));
};
/** /**
* A **SigningKey** provides high-level access to the elliptic curve * A **SigningKey** provides high-level access to the elliptic curve
* cryptography (ECC) operations and key management. * cryptography (ECC) operations and key management.
@ -53,15 +46,13 @@ class SigningKey {
*/ */
sign(digest) { sign(digest) {
(0, index_js_1.assertArgument)((0, index_js_1.dataLength)(digest) === 32, "invalid digest length", "digest", digest); (0, index_js_1.assertArgument)((0, index_js_1.dataLength)(digest) === 32, "invalid digest length", "digest", digest);
const [sigDer, recid] = secp256k1.signSync((0, index_js_1.getBytesCopy)(digest), (0, index_js_1.getBytesCopy)(this.#privateKey), { const sig = secp256k1_1.secp256k1.sign((0, index_js_1.getBytesCopy)(digest), (0, index_js_1.getBytesCopy)(this.#privateKey), {
recovered: true, lowS: true
canonical: true
}); });
const sig = secp256k1.Signature.fromHex(sigDer);
return signature_js_1.Signature.from({ return signature_js_1.Signature.from({
r: (0, index_js_1.toBeHex)("0x" + sig.r.toString(16), 32), r: (0, index_js_1.toBeHex)(sig.r, 32),
s: (0, index_js_1.toBeHex)("0x" + sig.s.toString(16), 32), s: (0, index_js_1.toBeHex)(sig.s, 32),
v: (recid ? 0x1c : 0x1b) v: (sig.recovery ? 0x1c : 0x1b)
}); });
} }
/** /**
@ -88,7 +79,7 @@ class SigningKey {
*/ */
computeSharedSecret(other) { computeSharedSecret(other) {
const pubKey = SigningKey.computePublicKey(other); const pubKey = SigningKey.computePublicKey(other);
return (0, index_js_1.hexlify)(secp256k1.getSharedSecret((0, index_js_1.getBytesCopy)(this.#privateKey), (0, index_js_1.getBytes)(pubKey))); return (0, index_js_1.hexlify)(secp256k1_1.secp256k1.getSharedSecret((0, index_js_1.getBytesCopy)(this.#privateKey), (0, index_js_1.getBytes)(pubKey), false));
} }
/** /**
* Compute the public key for %%key%%, optionally %%compressed%%. * Compute the public key for %%key%%, optionally %%compressed%%.
@ -119,7 +110,7 @@ class SigningKey {
let bytes = (0, index_js_1.getBytes)(key, "key"); let bytes = (0, index_js_1.getBytes)(key, "key");
// private key // private key
if (bytes.length === 32) { if (bytes.length === 32) {
const pubKey = secp256k1.getPublicKey(bytes, !!compressed); const pubKey = secp256k1_1.secp256k1.getPublicKey(bytes, !!compressed);
return (0, index_js_1.hexlify)(pubKey); return (0, index_js_1.hexlify)(pubKey);
} }
// raw public key; use uncompressed key with 0x04 prefix // raw public key; use uncompressed key with 0x04 prefix
@ -129,7 +120,7 @@ class SigningKey {
pub.set(bytes, 1); pub.set(bytes, 1);
bytes = pub; bytes = pub;
} }
const point = secp256k1.Point.fromHex(bytes); const point = secp256k1_1.secp256k1.ProjectivePoint.fromHex(bytes);
return (0, index_js_1.hexlify)(point.toRawBytes(compressed)); return (0, index_js_1.hexlify)(point.toRawBytes(compressed));
} }
/** /**
@ -153,10 +144,11 @@ class SigningKey {
static recoverPublicKey(digest, signature) { static recoverPublicKey(digest, signature) {
(0, index_js_1.assertArgument)((0, index_js_1.dataLength)(digest) === 32, "invalid digest length", "digest", digest); (0, index_js_1.assertArgument)((0, index_js_1.dataLength)(digest) === 32, "invalid digest length", "digest", digest);
const sig = signature_js_1.Signature.from(signature); const sig = signature_js_1.Signature.from(signature);
const der = secp256k1.Signature.fromCompact((0, index_js_1.getBytesCopy)((0, index_js_1.concat)([sig.r, sig.s]))).toDERRawBytes(); let secpSig = secp256k1_1.secp256k1.Signature.fromCompact((0, index_js_1.getBytesCopy)((0, index_js_1.concat)([sig.r, sig.s])));
const pubKey = secp256k1.recoverPublicKey((0, index_js_1.getBytesCopy)(digest), der, sig.yParity); secpSig = secpSig.addRecoveryBit(sig.yParity);
(0, index_js_1.assertArgument)(pubKey != null, "invalid signature for digest", "signature", signature); const pubKey = secpSig.recoverPublicKey((0, index_js_1.getBytesCopy)(digest));
return (0, index_js_1.hexlify)(pubKey); (0, index_js_1.assertArgument)(pubKey != null, "invalid signautre for digest", "signature", signature);
return "0x" + pubKey.toHex(false);
} }
/** /**
* Returns the point resulting from adding the ellipic curve points * Returns the point resulting from adding the ellipic curve points
@ -169,8 +161,8 @@ class SigningKey {
* addresses from parent public keys and chain codes. * addresses from parent public keys and chain codes.
*/ */
static addPoints(p0, p1, compressed) { static addPoints(p0, p1, compressed) {
const pub0 = secp256k1.Point.fromHex(SigningKey.computePublicKey(p0).substring(2)); const pub0 = secp256k1_1.secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2));
const pub1 = secp256k1.Point.fromHex(SigningKey.computePublicKey(p1).substring(2)); const pub1 = secp256k1_1.secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2));
return "0x" + pub0.add(pub1).toHex(!!compressed); return "0x" + pub0.add(pub1).toHex(!!compressed);
} }
} }

View File

@ -1 +1 @@
{"version":3,"file":"signing-key.js","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;AAEH,oEAA8C;AAE9C,gDAG2B;AAE3B,uCAAwC;AACxC,iDAA2C;AAO3C,yFAAyF;AAEzF,4BAA4B;AAC5B,SAAS,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Aa,EAAE,UAAoB;QAC/D,MAAM,IAAI,GAAG,qBAAS,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7F,MAAM,IAAI,GAAG,qBAAS,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7F,OAAO,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;IACpD,CAAC;CACJ;AA1KD,gCA0KC"}

View File

@ -17,6 +17,6 @@ export type { ProgressCallback, SignatureLike } from "./crypto/index.js";
export type { TypedDataDomain, TypedDataField } from "./hash/index.js"; export type { TypedDataDomain, TypedDataField } from "./hash/index.js";
export type { Provider, Signer, AbstractProviderOptions, FallbackProviderOptions, AbstractProviderPlugin, BlockParams, BlockTag, ContractRunner, DebugEventBrowserProvider, Eip1193Provider, EventFilter, Filter, FilterByBlockHash, GasCostParameters, JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcTransactionRequest, LogParams, MinedBlock, MinedTransactionResponse, Networkish, OrphanFilter, PerformActionFilter, PerformActionRequest, PerformActionTransaction, PreparedTransactionRequest, ProviderEvent, Subscriber, Subscription, TopicFilter, TransactionReceiptParams, TransactionRequest, TransactionResponseParams, WebSocketCreator, WebSocketLike } from "./providers/index.js"; export type { Provider, Signer, AbstractProviderOptions, FallbackProviderOptions, AbstractProviderPlugin, BlockParams, BlockTag, ContractRunner, DebugEventBrowserProvider, Eip1193Provider, EventFilter, Filter, FilterByBlockHash, GasCostParameters, JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcTransactionRequest, LogParams, MinedBlock, MinedTransactionResponse, Networkish, OrphanFilter, PerformActionFilter, PerformActionRequest, PerformActionTransaction, PreparedTransactionRequest, ProviderEvent, Subscriber, Subscription, TopicFilter, TransactionReceiptParams, TransactionRequest, TransactionResponseParams, WebSocketCreator, WebSocketLike } from "./providers/index.js";
export type { AccessList, AccessListish, AccessListEntry, TransactionLike } from "./transaction/index.js"; export type { AccessList, AccessListish, AccessListEntry, TransactionLike } from "./transaction/index.js";
export type { BytesLike, BigNumberish, Numeric, ErrorCode, FixedFormat, Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason, RlpStructuredData, GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc, EthersError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CodedEthersError, CallExceptionAction, CallExceptionTransaction, EventEmitterable, Listener } from "./utils/index.js"; export type { BytesLike, BigNumberish, Numeric, ErrorCode, FixedFormat, Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason, RlpStructuredData, RlpStructuredDataish, GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc, EthersError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CodedEthersError, CallExceptionAction, CallExceptionTransaction, EventEmitterable, Listener } from "./utils/index.js";
export type { CrowdsaleAccount, KeystoreAccount, EncryptOptions } from "./wallet/index.js"; export type { CrowdsaleAccount, KeystoreAccount, EncryptOptions } from "./wallet/index.js";
//# sourceMappingURL=ethers.d.ts.map //# sourceMappingURL=ethers.d.ts.map

View File

@ -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,mBAAmB,EAExC,QAAQ,EACR,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAEzI,iBAAiB,EAAE,gBAAgB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,sBAAsB,EACvG,KAAK,GACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,UAAU,EAAE,cAAc,EAC1B,gBAAgB,EAAE,iBAAiB,EACnC,aAAa,EAAE,SAAS,EAAE,cAAc,EAC3C,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACH,WAAW,EACX,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,EAChD,QAAQ,EACR,WAAW,EAAE,aAAa,EAC7B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACH,YAAY,EAAE,QAAQ,EACtB,eAAe,EACf,oBAAoB,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,QAAQ,EAAE,iBAAiB,EAC1I,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACH,WAAW,EACX,WAAW,EACX,SAAS,EACT,SAAS,EACT,MAAM,EAAE,MAAM,EACd,MAAM,EACN,MAAM,EAAE,UAAU,EAClB,IAAI,EACJ,SAAS,EAAE,UAAU,EACxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACH,EAAE,EACF,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAC9C,WAAW,EAAE,aAAa,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,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EACtE,yBAAyB,EAAE,SAAS,EAAE,UAAU,EAAE,wBAAwB,EAAE,UAAU,EACtF,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,wBAAwB,EACjF,0BAA0B,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAChF,wBAAwB,EAAE,kBAAkB,EAAE,yBAAyB,EACvE,gBAAgB,EAAE,aAAa,EAClC,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACR,UAAU,EAAE,aAAa,EAAE,eAAe,EAC1C,eAAe,EAClB,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EACR,SAAS,EACT,YAAY,EAAE,OAAO,EACrB,SAAS,EACT,WAAW,EACX,aAAa,EAAE,wBAAwB,EAAE,eAAe,EACxD,iBAAiB,EAAE,oBAAoB,EAEvC,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,mBAAmB,EACnB,gBAAgB,EAEhB,mBAAmB,EAAE,wBAAwB,EAC7C,gBAAgB,EAAE,QAAQ,EAC7B,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACR,gBAAgB,EAAE,eAAe,EAAE,cAAc,EACpD,MAAM,mBAAmB,CAAC"}

View File

@ -513,7 +513,7 @@ class AbstractProvider {
if (request[key] == null) { if (request[key] == null) {
return; return;
} }
const addr = (0, index_js_1.resolveAddress)(request[key]); const addr = (0, index_js_1.resolveAddress)(request[key], this);
if (isPromise(addr)) { if (isPromise(addr)) {
promises.push((async function () { request[key] = await addr; })()); promises.push((async function () { request[key] = await addr; })());
} }

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,48 @@
import type { AbstractProvider } from "./abstract-provider.js"; import type { AbstractProvider } from "./abstract-provider.js";
import type { Networkish } from "./network.js"; import type { Networkish } from "./network.js";
import { WebSocketLike } from "./provider-websocket.js"; import { WebSocketLike } from "./provider-websocket.js";
/**
* Returns a default provider for %%network%%.
*
* If %%network%% is a [[WebSocketLike]] or string that begins with
* ``"ws:"`` or ``"wss:"``, a [[WebSocketProvider]] is returned backed
* by that WebSocket or URL.
*
* If %%network%% is a string that begins with ``"HTTP:"`` or ``"HTTPS:"``,
* a [[JsonRpcProvider]] is returned connected to that URL.
*
* Otherwise, a default provider is created backed by well-known public
* Web3 backends (such as [[link-infura]]) using community-provided API
* keys.
*
* The %%options%% allows specifying custom API keys per backend (setting
* an API key to ``"-"`` will omit that provider) and ``options.exclusive``
* can be set to either a backend name or and array of backend names, which
* will whitelist **only** those backends.
*
* Current backend strings supported are:
* - ``"alchemy"``
* - ``"ankr"``
* - ``"cloudflare"``
* - ``"etherscan"``
* - ``"infura"``
* - ``"publicPolygon"``
* - ``"quicknode"``
*
* @example:
* // Connect to a local Geth node
* provider = getDefaultProvider("http://localhost:8545/");
*
* // Connect to Ethereum mainnet with any current and future
* // third-party services available
* provider = getDefaultProvider("mainnet");
*
* // Connect to Polygoin, but only allow Etherscan and
* // INFURA and use "MY_API_KEY" in calls to Etherscan.
* provider = getDefaultProvider("matic", {
* etherscan: "MY_API_KEY",
* exclusive: [ "etherscan", "infura" ]
* });
*/
export declare function getDefaultProvider(network: string | Networkish | WebSocketLike, options?: any): AbstractProvider; export declare function getDefaultProvider(network: string | Networkish | WebSocketLike, options?: any): AbstractProvider;
//# sourceMappingURL=default-provider.d.ts.map //# sourceMappingURL=default-provider.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"default-provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AASxD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,gBAAgB,CAkHhH"} {"version":3,"file":"default-provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AASxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,gBAAgB,CAkHhH"}

View File

@ -18,6 +18,49 @@ function isWebSocketLike(value) {
typeof (value.close) === "function"); typeof (value.close) === "function");
} }
const Testnets = "goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" "); const Testnets = "goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" ");
/**
* Returns a default provider for %%network%%.
*
* If %%network%% is a [[WebSocketLike]] or string that begins with
* ``"ws:"`` or ``"wss:"``, a [[WebSocketProvider]] is returned backed
* by that WebSocket or URL.
*
* If %%network%% is a string that begins with ``"HTTP:"`` or ``"HTTPS:"``,
* a [[JsonRpcProvider]] is returned connected to that URL.
*
* Otherwise, a default provider is created backed by well-known public
* Web3 backends (such as [[link-infura]]) using community-provided API
* keys.
*
* The %%options%% allows specifying custom API keys per backend (setting
* an API key to ``"-"`` will omit that provider) and ``options.exclusive``
* can be set to either a backend name or and array of backend names, which
* will whitelist **only** those backends.
*
* Current backend strings supported are:
* - ``"alchemy"``
* - ``"ankr"``
* - ``"cloudflare"``
* - ``"etherscan"``
* - ``"infura"``
* - ``"publicPolygon"``
* - ``"quicknode"``
*
* @example:
* // Connect to a local Geth node
* provider = getDefaultProvider("http://localhost:8545/");
*
* // Connect to Ethereum mainnet with any current and future
* // third-party services available
* provider = getDefaultProvider("mainnet");
*
* // Connect to Polygoin, but only allow Etherscan and
* // INFURA and use "MY_API_KEY" in calls to Etherscan.
* provider = getDefaultProvider("matic", {
* etherscan: "MY_API_KEY",
* exclusive: [ "etherscan", "infura" ]
* });
*/
function getDefaultProvider(network, options) { function getDefaultProvider(network, options) {
if (options == null) { if (options == null) {
options = {}; options = {};

View File

@ -1 +1 @@
{"version":3,"file":"default-provider.js","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":";;;AACA,gDAA2C;AAE3C,yDAAkD;AAClD,+DAAwD;AACxD,qEAA8D;AAC9D,mEAA4D;AAC5D,6DAAsD;AACtD,wDAAwD;AACxD,mEAA4D;AAE5D,iEAA0D;AAC1D,+DAAwD;AACxD,6CAAuC;AACvC,mEAA4D;AAM5D,SAAS,eAAe,CAAC,KAAU;IAC/B,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU;QAC9C,OAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,QAAQ,GAAG,qFAAqF,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAElH,SAAgB,kBAAkB,CAAC,OAA4C,EAAE,OAAa;IAC1F,IAAI,OAAO,IAAI,IAAI,EAAE;QAAE,OAAO,GAAG,EAAG,CAAC;KAAE;IAEvC,MAAM,YAAY,GAAG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AC,OAAO,CAAC;IAIlC,QAAQ,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;IAiKjD,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAIpC;;;;OAIG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAKtC;;;OAGG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAC;IAc7D,mBAAmB,IAAI,OAAO;CAGjC"}

View File

@ -255,6 +255,9 @@ class EtherscanProvider extends abstract_provider_js_1.AbstractProvider {
if (key === "type" && value === 0) { if (key === "type" && value === 0) {
continue; continue;
} }
if (key === "blockTag" && value === "latest") {
continue;
}
// Quantity-types require no leading zero, unless 0 // Quantity-types require no leading zero, unless 0
if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) { if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) {
value = (0, index_js_4.toQuantity)(value); value = (0, index_js_4.toQuantity)(value);

File diff suppressed because one or more lines are too long

View File

@ -343,12 +343,16 @@ export declare class Block implements BlockParams, Iterable<string> {
*/ */
constructor(block: BlockParams, provider: Provider); constructor(block: BlockParams, provider: Provider);
/** /**
* Returns the list of transaction hashes. * Returns the list of transaction hashes, in the order
* they were executed within the block.
*/ */
get transactions(): ReadonlyArray<string>; get transactions(): ReadonlyArray<string>;
/** /**
* Returns the complete transactions for blocks which * Returns the complete transactions, in the order they
* prefetched them, by passing ``true`` to %%prefetchTxs%% * were executed within the block.
*
* This is only available for blocks which prefetched
* transactions, by passing ``true`` to %%prefetchTxs%%
* into [[Provider-getBlock]]. * into [[Provider-getBlock]].
*/ */
get prefetchedTransactions(): Array<TransactionResponse>; get prefetchedTransactions(): Array<TransactionResponse>;

File diff suppressed because one or more lines are too long

View File

@ -225,7 +225,8 @@ class Block {
}); });
} }
/** /**
* Returns the list of transaction hashes. * Returns the list of transaction hashes, in the order
* they were executed within the block.
*/ */
get transactions() { get transactions() {
return this.#transactions.map((tx) => { return this.#transactions.map((tx) => {
@ -236,8 +237,11 @@ class Block {
}); });
} }
/** /**
* Returns the complete transactions for blocks which * Returns the complete transactions, in the order they
* prefetched them, by passing ``true`` to %%prefetchTxs%% * were executed within the block.
*
* This is only available for blocks which prefetched
* transactions, by passing ``true`` to %%prefetchTxs%%
* into [[Provider-getBlock]]. * into [[Provider-getBlock]].
*/ */
get prefetchedTransactions() { get prefetchedTransactions() {

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,9 @@ import type { FetchRequest, FetchResponse } from "./fetch.js";
* An error may contain additional properties, but those must not * An error may contain additional properties, but those must not
* conflict with any impliciat properties. * conflict with any impliciat properties.
*/ */
export type ErrorInfo<T> = Omit<T, "code" | "name" | "message">; export type ErrorInfo<T> = Omit<T, "code" | "name" | "message" | "shortMessage"> & {
shortMessage?: string;
};
/** /**
* All errors emitted by ethers have an **ErrorCode** to help * All errors emitted by ethers have an **ErrorCode** to help
* identify and coalesce errors to simplfy programatic analysis. * identify and coalesce errors to simplfy programatic analysis.
@ -85,6 +87,11 @@ export interface EthersError<T extends ErrorCode = ErrorCode> extends Error {
* The string error code. * The string error code.
*/ */
code: ErrorCode; code: ErrorCode;
/**
* A short message describing the error, with minimal additional
* details.
*/
shortMessage: string;
/** /**
* Additional info regarding the error that may be useful. * Additional info regarding the error that may be useful.
* *

File diff suppressed because one or more lines are too long

View File

@ -90,6 +90,7 @@ exports.isCallException = isCallException;
* ethers version, %%code%% and all aditional properties, serialized. * ethers version, %%code%% and all aditional properties, serialized.
*/ */
function makeError(message, code, info) { function makeError(message, code, info) {
let shortMessage = message;
{ {
const details = []; const details = [];
if (info) { if (info) {
@ -97,6 +98,9 @@ function makeError(message, code, info) {
throw new Error(`value will overwrite populated values: ${stringify(info)}`); throw new Error(`value will overwrite populated values: ${stringify(info)}`);
} }
for (const key in info) { for (const key in info) {
if (key === "shortMessage") {
continue;
}
const value = (info[key]); const value = (info[key]);
// try { // try {
details.push(key + "=" + stringify(value)); details.push(key + "=" + stringify(value));
@ -128,6 +132,9 @@ function makeError(message, code, info) {
if (info) { if (info) {
Object.assign(error, info); Object.assign(error, info);
} }
if (error.shortMessage == null) {
(0, properties_js_1.defineProperties)(error, { shortMessage });
}
return error; return error;
} }
exports.makeError = makeError; exports.makeError = makeError;

File diff suppressed because one or more lines are too long

View File

@ -181,6 +181,23 @@ export declare class FetchRequest implements Iterable<[key: string, value: strin
*/ */
get retryFunc(): null | FetchRetryFunc; get retryFunc(): null | FetchRetryFunc;
set retryFunc(retry: null | FetchRetryFunc); set retryFunc(retry: null | FetchRetryFunc);
/**
* This function is called to fetch content from HTTP and
* HTTPS URLs and is platform specific (e.g. nodejs vs
* browsers).
*
* This is by default the currently registered global getUrl
* function, which can be changed using [[registerGetUrl]].
* If this has been set, setting is to ``null`` will cause
* this FetchRequest (and any future clones) to revert back to
* using the currently registered global getUrl function.
*
* Setting this is generally not necessary, but may be useful
* for developers that wish to intercept requests or to
* configurege a proxy or other agent.
*/
get getUrlFunc(): FetchGetUrlFunc;
set getUrlFunc(value: null | FetchGetUrlFunc);
/** /**
* Create a new FetchRequest instance with default values. * Create a new FetchRequest instance with default values.
* *
@ -239,6 +256,18 @@ export declare class FetchRequest implements Iterable<[key: string, value: strin
* throws. * throws.
*/ */
static registerGetUrl(getUrl: FetchGetUrlFunc): void; static registerGetUrl(getUrl: FetchGetUrlFunc): void;
/**
* Creates a getUrl function that fetches content from HTTP and
* HTTPS URLs.
*
* The available %%options%% are dependent on the platform
* implementation of the default getUrl function.
*
* This is not generally something that is needed, but is useful
* when trying to customize simple behaviour when fetching HTTP
* content.
*/
static createGetUrlFunc(options?: Record<string, any>): FetchGetUrlFunc;
/** /**
* Creates a function that can "fetch" data URIs. * Creates a function that can "fetch" data URIs.
* *

View File

@ -1 +1 @@
{"version":3,"file":"fetch.d.ts","sourceRoot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U,CAAC,CAEtC;IAED;;;;;OAKG;IACH,IAAI,QAAQ,IAAI,MAAM,CAQrB;IAED;;;;;OAKG;IACH,IAAI,QAAQ,IAAI,GAAG,CAQlB;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,CAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAE,CAAC;gBAiBjD,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,UAAU,EAAE,OAAO,CAAC,EAAE,YAAY;IAajJ;;;;OAIG;IACH,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,aAAa;IAc/D;;;;OAIG;IACH,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK;IAc3D;;OAEG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAI9B;;OAEG;IACH,OAAO,IAAI,IAAI,IAAI,CAAC,aAAa,GAAG;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC;IAIzD;;OAEG;IACH,IAAI,OAAO,IAAI,IAAI,GAAG,YAAY,CAA0B;IAE5D;;OAEG;IACH,EAAE,IAAI,OAAO;IAIb;;OAEG;IACH,QAAQ,IAAI,IAAI;CAUnB"}

View File

@ -29,7 +29,7 @@ const geturl_js_1 = require("./geturl.js");
const MAX_ATTEMPTS = 12; const MAX_ATTEMPTS = 12;
const SLOT_INTERVAL = 250; const SLOT_INTERVAL = 250;
// The global FetchGetUrlFunc implementation. // The global FetchGetUrlFunc implementation.
let getUrlFunc = geturl_js_1.getUrl; let defaultGetUrlFunc = (0, geturl_js_1.createGetUrl)();
const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"); const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i");
const reIpfs = new RegExp("^ipfs:/\/(ipfs/)?(.*)$", "i"); const reIpfs = new RegExp("^ipfs:/\/(ipfs/)?(.*)$", "i");
// If locked, new Gateways cannot be added // If locked, new Gateways cannot be added
@ -143,6 +143,7 @@ class FetchRequest {
#retry; #retry;
#signal; #signal;
#throttle; #throttle;
#getUrlFunc;
/** /**
* The fetch URI to requrest. * The fetch URI to requrest.
*/ */
@ -365,6 +366,27 @@ class FetchRequest {
set retryFunc(retry) { set retryFunc(retry) {
this.#retry = retry; this.#retry = retry;
} }
/**
* This function is called to fetch content from HTTP and
* HTTPS URLs and is platform specific (e.g. nodejs vs
* browsers).
*
* This is by default the currently registered global getUrl
* function, which can be changed using [[registerGetUrl]].
* If this has been set, setting is to ``null`` will cause
* this FetchRequest (and any future clones) to revert back to
* using the currently registered global getUrl function.
*
* Setting this is generally not necessary, but may be useful
* for developers that wish to intercept requests or to
* configurege a proxy or other agent.
*/
get getUrlFunc() {
return this.#getUrlFunc || defaultGetUrlFunc;
}
set getUrlFunc(value) {
this.#getUrlFunc = value;
}
/** /**
* Create a new FetchRequest instance with default values. * Create a new FetchRequest instance with default values.
* *
@ -382,6 +404,7 @@ class FetchRequest {
slotInterval: SLOT_INTERVAL, slotInterval: SLOT_INTERVAL,
maxAttempts: MAX_ATTEMPTS maxAttempts: MAX_ATTEMPTS
}; };
this.#getUrlFunc = null;
} }
toString() { toString() {
return `<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${this.#body ? (0, data_js_1.hexlify)(this.#body) : "null"}>`; return `<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${this.#body ? (0, data_js_1.hexlify)(this.#body) : "null"}>`;
@ -436,7 +459,7 @@ class FetchRequest {
if (this.preflightFunc) { if (this.preflightFunc) {
req = await this.preflightFunc(req); req = await this.preflightFunc(req);
} }
const resp = await getUrlFunc(req, checkSignal(_request.#signal)); const resp = await this.getUrlFunc(req, checkSignal(_request.#signal));
let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request); let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request);
if (response.statusCode === 301 || response.statusCode === 302) { if (response.statusCode === 301 || response.statusCode === 302) {
// Redirect // Redirect
@ -557,6 +580,7 @@ class FetchRequest {
clone.#preflight = this.#preflight; clone.#preflight = this.#preflight;
clone.#process = this.#process; clone.#process = this.#process;
clone.#retry = this.#retry; clone.#retry = this.#retry;
clone.#getUrlFunc = this.#getUrlFunc;
return clone; return clone;
} }
/** /**
@ -602,7 +626,21 @@ class FetchRequest {
if (locked) { if (locked) {
throw new Error("gateways locked"); throw new Error("gateways locked");
} }
getUrlFunc = getUrl; defaultGetUrlFunc = getUrl;
}
/**
* Creates a getUrl function that fetches content from HTTP and
* HTTPS URLs.
*
* The available %%options%% are dependent on the platform
* implementation of the default getUrl function.
*
* This is not generally something that is needed, but is useful
* when trying to customize simple behaviour when fetching HTTP
* content.
*/
static createGetUrlFunc(options) {
return (0, geturl_js_1.createGetUrl)(options);
} }
/** /**
* Creates a function that can "fetch" data URIs. * Creates a function that can "fetch" data URIs.

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
import type { FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js"; import type { FetchGetUrlFunc, FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js";
declare global { declare global {
class Headers { class Headers {
constructor(values: Array<[string, string]>); constructor(values: Array<[string, string]>);
@ -17,5 +17,6 @@ declare global {
}; };
function fetch(url: string, init: FetchInit): Promise<Response>; function fetch(url: string, init: FetchInit): Promise<Response>;
} }
export declare function createGetUrl(options?: Record<string, any>): FetchGetUrlFunc;
export declare function getUrl(req: FetchRequest, _signal?: FetchCancelSignal): Promise<GetUrlResponse>; export declare function getUrl(req: FetchRequest, _signal?: FetchCancelSignal): Promise<GetUrlResponse>;
//# sourceMappingURL=geturl-browser.d.ts.map //# sourceMappingURL=geturl-browser.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"geturl-browser.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl-browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGlF,OAAO,CAAC,MAAM,CAAC;IACX,MAAM,OAAO;oBACG,MAAM,EAAE,KAAK,CAAC,CAAE,MAAM,EAAE,MAAM,CAAE,CAAC;QAC7C,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;KACtD;IAED,MAAM,QAAQ;QACV,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;KACtC;IAED,KAAK,SAAS,GAAG;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,UAAU,CAAA;KACpB,CAAC;IAEF,SAAS,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACnE;AAID,wBAAsB,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAyCpG"} {"version":3,"file":"geturl-browser.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl-browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EACnE,MAAM,YAAY,CAAC;AAGpB,OAAO,CAAC,MAAM,CAAC;IACX,MAAM,OAAO;oBACG,MAAM,EAAE,KAAK,CAAC,CAAE,MAAM,EAAE,MAAM,CAAE,CAAC;QAC7C,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;KACtD;IAED,MAAM,QAAQ;QACV,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;KACtC;IAED,KAAK,SAAS,GAAG;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,UAAU,CAAA;KACpB,CAAC;IAEF,SAAS,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACnE;AAID,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,CA8C3E;AAKD,wBAAsB,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAEpG"}

View File

@ -1,41 +1,50 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getUrl = void 0; exports.getUrl = exports.createGetUrl = void 0;
const errors_js_1 = require("./errors.js"); const errors_js_1 = require("./errors.js");
// @TODO: timeout is completely ignored; start a Promise.any with a reject? // @TODO: timeout is completely ignored; start a Promise.any with a reject?
async function getUrl(req, _signal) { function createGetUrl(options) {
const protocol = req.url.split(":")[0].toLowerCase(); async function getUrl(req, _signal) {
(0, errors_js_1.assert)(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { const protocol = req.url.split(":")[0].toLowerCase();
info: { protocol }, (0, errors_js_1.assert)(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", {
operation: "request" info: { protocol },
}); operation: "request"
(0, errors_js_1.assert)(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { });
operation: "request" (0, errors_js_1.assert)(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", {
}); operation: "request"
let signal = undefined; });
if (_signal) { let signal = undefined;
const controller = new AbortController(); if (_signal) {
signal = controller.signal; const controller = new AbortController();
_signal.addListener(() => { controller.abort(); }); signal = controller.signal;
_signal.addListener(() => { controller.abort(); });
}
const init = {
method: req.method,
headers: new Headers(Array.from(req)),
body: req.body || undefined,
signal
};
const resp = await fetch(req.url, init);
const headers = {};
resp.headers.forEach((value, key) => {
headers[key.toLowerCase()] = value;
});
const respBody = await resp.arrayBuffer();
const body = (respBody == null) ? null : new Uint8Array(respBody);
return {
statusCode: resp.status,
statusMessage: resp.statusText,
headers, body
};
} }
const init = { return getUrl;
method: req.method, }
headers: new Headers(Array.from(req)), exports.createGetUrl = createGetUrl;
body: req.body || undefined, // @TODO: remove in v7; provided for backwards compat
signal const defaultGetUrl = createGetUrl({});
}; async function getUrl(req, _signal) {
const resp = await fetch(req.url, init); return defaultGetUrl(req, _signal);
const headers = {};
resp.headers.forEach((value, key) => {
headers[key.toLowerCase()] = value;
});
const respBody = await resp.arrayBuffer();
const body = (respBody == null) ? null : new Uint8Array(respBody);
return {
statusCode: resp.status,
statusMessage: resp.statusText,
headers, body
};
} }
exports.getUrl = getUrl; exports.getUrl = getUrl;
//# sourceMappingURL=geturl-browser.js.map //# sourceMappingURL=geturl-browser.js.map

View File

@ -1 +1 @@
{"version":3,"file":"geturl-browser.js","sourceRoot":"","sources":["../../src.ts/utils/geturl-browser.ts"],"names":[],"mappings":";;;AAAA,2CAAqC;AA2BrC,2EAA2E;AAEpE,KAAK,UAA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etchCancelSignal, GetUrlResponse } from "./fetch.js"; import type { FetchGetUrlFunc, FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js";
/**
* @_ignore:
*/
export declare function createGetUrl(options?: Record<string, any>): FetchGetUrlFunc;
/** /**
* @_ignore: * @_ignore:
*/ */

View File

@ -1 +1 @@
{"version":3,"file":"geturl.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAElF;;GAEG;AACH,wBAAsB,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAkFnG"} {"version":3,"file":"geturl.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EACnE,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,CA0F3E;AAKD;;GAEG;AACH,wBAAsB,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAEnG"}

View File

@ -1,6 +1,6 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.getUrl = void 0; exports.getUrl = exports.createGetUrl = void 0;
const tslib_1 = require("tslib"); const tslib_1 = require("tslib");
const http_1 = tslib_1.__importDefault(require("http")); const http_1 = tslib_1.__importDefault(require("http"));
const https_1 = tslib_1.__importDefault(require("https")); const https_1 = tslib_1.__importDefault(require("https"));
@ -10,74 +10,91 @@ const data_js_1 = require("./data.js");
/** /**
* @_ignore: * @_ignore:
*/ */
async function getUrl(req, signal) { function createGetUrl(options) {
const protocol = req.url.split(":")[0].toLowerCase(); async function getUrl(req, signal) {
(0, errors_js_1.assert)(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { const protocol = req.url.split(":")[0].toLowerCase();
info: { protocol }, (0, errors_js_1.assert)(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", {
operation: "request" info: { protocol },
}); operation: "request"
(0, errors_js_1.assert)(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", {
operation: "request"
});
const method = req.method;
const headers = Object.assign({}, req.headers);
const options = { method, headers };
const request = ((protocol === "http") ? http_1.default : https_1.default).request(req.url, options);
request.setTimeout(req.timeout);
const body = req.body;
if (body) {
request.write(Buffer.from(body));
}
request.end();
return new Promise((resolve, reject) => {
// @TODO: Node 15 added AbortSignal; once we drop support for
// Node14, we can add that in here too
request.once("response", (resp) => {
const statusCode = resp.statusCode || 0;
const statusMessage = resp.statusMessage || "";
const headers = Object.keys(resp.headers || {}).reduce((accum, name) => {
let value = resp.headers[name] || "";
if (Array.isArray(value)) {
value = value.join(", ");
}
accum[name] = value;
return accum;
}, {});
let body = null;
//resp.setEncoding("utf8");
resp.on("data", (chunk) => {
if (signal) {
try {
signal.checkSignal();
}
catch (error) {
return reject(error);
}
}
if (body == null) {
body = chunk;
}
else {
const newBody = new Uint8Array(body.length + chunk.length);
newBody.set(body, 0);
newBody.set(chunk, body.length);
body = newBody;
}
});
resp.on("end", () => {
if (headers["content-encoding"] === "gzip" && body) {
body = (0, data_js_1.getBytes)((0, zlib_1.gunzipSync)(body));
}
resolve({ statusCode, statusMessage, headers, body });
});
resp.on("error", (error) => {
//@TODO: Should this just return nornal response with a server error?
error.response = { statusCode, statusMessage, headers, body };
reject(error);
});
}); });
request.on("error", (error) => { reject(error); }); (0, errors_js_1.assert)(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", {
}); operation: "request"
});
const method = req.method;
const headers = Object.assign({}, req.headers);
const reqOptions = { method, headers };
if (options) {
if (options.agent) {
reqOptions.agent = options.agent;
}
}
const request = ((protocol === "http") ? http_1.default : https_1.default).request(req.url, reqOptions);
request.setTimeout(req.timeout);
const body = req.body;
if (body) {
request.write(Buffer.from(body));
}
request.end();
return new Promise((resolve, reject) => {
// @TODO: Node 15 added AbortSignal; once we drop support for
// Node14, we can add that in here too
request.once("response", (resp) => {
const statusCode = resp.statusCode || 0;
const statusMessage = resp.statusMessage || "";
const headers = Object.keys(resp.headers || {}).reduce((accum, name) => {
let value = resp.headers[name] || "";
if (Array.isArray(value)) {
value = value.join(", ");
}
accum[name] = value;
return accum;
}, {});
let body = null;
//resp.setEncoding("utf8");
resp.on("data", (chunk) => {
if (signal) {
try {
signal.checkSignal();
}
catch (error) {
return reject(error);
}
}
if (body == null) {
body = chunk;
}
else {
const newBody = new Uint8Array(body.length + chunk.length);
newBody.set(body, 0);
newBody.set(chunk, body.length);
body = newBody;
}
});
resp.on("end", () => {
if (headers["content-encoding"] === "gzip" && body) {
body = (0, data_js_1.getBytes)((0, zlib_1.gunzipSync)(body));
}
resolve({ statusCode, statusMessage, headers, body });
});
resp.on("error", (error) => {
//@TODO: Should this just return nornal response with a server error?
error.response = { statusCode, statusMessage, headers, body };
reject(error);
});
});
request.on("error", (error) => { reject(error); });
});
}
return getUrl;
}
exports.createGetUrl = createGetUrl;
// @TODO: remove in v7; provided for backwards compat
const defaultGetUrl = createGetUrl({});
/**
* @_ignore:
*/
async function getUrl(req, signal) {
return defaultGetUrl(req, signal);
} }
exports.getUrl = getUrl; exports.getUrl = getUrl;
//# sourceMappingURL=geturl.js.map //# sourceMappingURL=geturl.js.map

View File

@ -1 +1 @@
{"version":3,"file":"geturl.js","sourceRoot":"","sources":["../../src.ts/utils/geturl.ts"],"names":[],"mappings":";;;;AAAA,wDAAw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GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc } from "./fetch.js"; export type { GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc } from "./fetch.js";
export type { FixedFormat } from "./fixednumber.js"; export type { FixedFormat } from "./fixednumber.js";
export type { BigNumberish, Numeric } from "./maths.js"; export type { BigNumberish, Numeric } from "./maths.js";
export type { RlpStructuredData } from "./rlp.js"; export type { RlpStructuredData, RlpStructuredDataish } from "./rlp.js";
export type { Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason } from "./utf8.js"; export type { Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason } from "./utf8.js";
//# sourceMappingURL=index.d.ts.map //# sourceMappingURL=index.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EACH,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EACxF,cAAc,EAAE,YAAY,EAAE,YAAY,EAC7C,MAAM,WAAW,CAAC;AAEnB,OAAO,EACH,eAAe,EAAE,OAAO,EACxB,MAAM,EAAE,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,EACzF,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EACH,YAAY,EAAE,aAAa,EAAE,iBAAiB,GACjD,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9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AO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE9E,OAAO,EACH,WAAW,EACX,gBAAgB,EAChB,YAAY,EAEZ,cAAc,GACjB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAKnC,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,YAAY,EAKR,SAAS,EAET,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,mBAAmB,EAEnB,mBAAmB,EAAE,wBAAwB,EAE7C,gBAAgB,EACnB,MAAM,aAAa,CAAA;AAEpB,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE9D,YAAY,EACR,cAAc,EACd,kBAAkB,EAAE,gBAAgB,EAAE,cAAc,EACpD,gBAAgB,EAAE,eAAe,EACpC,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAExD,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAExE,YAAY,EACR,aAAa,EACb,wBAAwB,EACxB,eAAe,EAClB,MAAM,WAAW,CAAC"}

View File

@ -1,6 +1,6 @@
import type { RlpStructuredData } from "./rlp.js"; import type { RlpStructuredDataish } from "./rlp.js";
/** /**
* Encodes %%object%% as an RLP-encoded [[DataHexString]]. * Encodes %%object%% as an RLP-encoded [[DataHexString]].
*/ */
export declare function encodeRlp(object: RlpStructuredData): string; export declare function encodeRlp(object: RlpStructuredDataish): string;
//# sourceMappingURL=rlp-encode.d.ts.map //# sourceMappingURL=rlp-encode.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"rlp-encode.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp-encode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAiDlD;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAO3D"} {"version":3,"file":"rlp-encode.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp-encode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAiDrD;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAO9D"}

View File

@ -1 +1 @@
{"version":3,"file":"rlp-encode.js","sourceRoot":"","sources":["../../src.ts/utils/rlp-encode.ts"],"names":[],"mappings":";AAAA,gDAAgD;;;AAEhD,uCAAqC;AAKrC,SAAS,eAAe,CAAC,KAAa;IAClC,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,OAAO,KAAK,EAAE;QACV,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;QAC7B,KAAK,KAAK,CAAC,CAAC;KACf;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,OAAO,CAAC,MAA2B;IACxC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACvB,IAAI,OAAO,GAAkB,EAAE,CAAC;QAChC,MAAM,CAAC,OAAO,CAAC,UAAS,KAAK;YACzB,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC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;QACtC,OAAO,IAAI,CAAC;KAEf;SAAM,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE;QAC1B,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC;KACf;IAED,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,CAAC,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAErC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,OAAO,GAAG,kBAAkB,CAAC;AAEnC;;GAEG;AACH,SAAgB,SAAS,CAAC,MAA4B;IAClD,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE;QAC7B,MAAM,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1B,MAAM,IAAI,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;KAC9B;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAPD,8BAOC"}

View File

@ -10,4 +10,8 @@ export { encodeRlp } from "./rlp-encode.js";
* An RLP-encoded structure. * An RLP-encoded structure.
*/ */
export type RlpStructuredData = string | Array<RlpStructuredData>; export type RlpStructuredData = string | Array<RlpStructuredData>;
/**
* An RLP-encoded structure, which allows Uint8Array.
*/
export type RlpStructuredDataish = string | Uint8Array | Array<RlpStructuredDataish>;
//# sourceMappingURL=rlp.d.ts.map //# sourceMappingURL=rlp.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"rlp.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC"} {"version":3,"file":"rlp.d.ts","sourceRoot":"","sources":["../../src.ts/utils/rlp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC,oBAAoB,CAAC,CAAC"}

View File

@ -2,5 +2,5 @@
/** /**
* The current version of Ethers. * The current version of Ethers.
*/ */
export const version = "6.7.1"; export const version = "6.8.0";
//# sourceMappingURL=_version.js.map //# sourceMappingURL=_version.js.map

View File

@ -368,7 +368,7 @@ export declare class Interface {
* Parses a revert data, finding the matching error and extracts * Parses a revert data, finding the matching error and extracts
* the parameter values along with other useful error details. * the parameter values along with other useful error details.
* *
* If the matching event cannot be found, returns null. * If the matching error cannot be found, returns null.
*/ */
parseError(data: BytesLike): null | ErrorDescription; parseError(data: BytesLike): null | ErrorDescription;
/** /**

View File

@ -1060,7 +1060,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string {
* Parses a revert data, finding the matching error and extracts * Parses a revert data, finding the matching error and extracts
* the parameter values along with other useful error details. * the parameter values along with other useful error details.
* *
* If the matching event cannot be found, returns null. * If the matching error cannot be found, returns null.
*/ */
parseError(data) { parseError(data) {
const hexData = hexlify(data); const hexData = hexlify(data);

View File

@ -1 +1 @@
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src.ts/contract/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAS,MAAM,iBAAiB,CAAC;AAInD,OAAO,EAAe,GA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G,kBAAkB,CAAC,KAAK,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBlE;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9E;;OAEG;IACG,cAAc,CAAC,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjF;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,iBAAiB,EAAE,GAAG,EAAE,SAAS,GAAG,YAAY,GAAG,KAAK,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc,KAAK,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;IAS3K;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,YAAY,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc,GAAG,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;CAKhK;;AAMD;;GAEG;AACH,qBAAa,QAAS,SAAQ,aAAe;CAAI"}

View File

@ -18,6 +18,17 @@ function canResolve(value) {
function canSend(value) { function canSend(value) {
return (value && typeof (value.sendTransaction) === "function"); return (value && typeof (value.sendTransaction) === "function");
} }
function getResolver(value) {
if (value != null) {
if (canResolve(value)) {
return value;
}
if (value.provider) {
return value.provider;
}
}
return undefined;
}
class PreparedTopicFilter { class PreparedTopicFilter {
#filter; #filter;
fragment; fragment;
@ -89,7 +100,7 @@ export async function copyOverrides(arg, allowed) {
assertArgument(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data); assertArgument(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data);
// Resolve any from // Resolve any from
if (overrides.from) { if (overrides.from) {
overrides.from = await resolveAddress(overrides.from); overrides.from = overrides.from;
} }
return overrides; return overrides;
} }
@ -115,6 +126,9 @@ function buildWrappedFallback(contract) {
// If an overrides was passed in, copy it and normalize the values // If an overrides was passed in, copy it and normalize the values
const tx = (await copyOverrides(overrides, ["data"])); const tx = (await copyOverrides(overrides, ["data"]));
tx.to = await contract.getAddress(); tx.to = await contract.getAddress();
if (tx.from) {
tx.from = await resolveAddress(tx.from, getResolver(contract.runner));
}
const iface = contract.interface; const iface = contract.interface;
const noValue = (getBigInt((tx.value || BN_0), "overrides.value") === BN_0); const noValue = (getBigInt((tx.value || BN_0), "overrides.value") === BN_0);
const noData = ((tx.data || "0x") === "0x"); const noData = ((tx.data || "0x") === "0x");
@ -183,6 +197,9 @@ function buildWrappedMethod(contract, key) {
let overrides = {}; let overrides = {};
if (fragment.inputs.length + 1 === args.length) { if (fragment.inputs.length + 1 === args.length) {
overrides = await copyOverrides(args.pop()); overrides = await copyOverrides(args.pop());
if (overrides.from) {
overrides.from = await resolveAddress(overrides.from, getResolver(contract.runner));
}
} }
if (fragment.inputs.length !== args.length) { if (fragment.inputs.length !== args.length) {
throw new Error("internal error: fragment inputs doesn't match arguments; should not happen"); throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"version":3,"file":"signing-key.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAUhD;;;GAGG;AACH,qBAAa,UAAU;;IAGnB;;OAEG;gBACS,UAAU,EAAE,SAAS;IAKjC;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAA6B;IAErD;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;OAqBG;IACH,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAK7C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;IAqBrE;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM;IAc5E;;;;;;;;;OASG;IACH,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;CAK/E"}

View File

@ -3,15 +3,9 @@
* *
* @_subsection: api/crypto:Signing [about-signing] * @_subsection: api/crypto:Signing [about-signing]
*/ */
import * as secp256k1 from "@noble/secp256k1"; import { secp256k1 } from "@noble/curves/secp256k1";
import { concat, dataLength, getBytes, getBytesCopy, hexlify, toBeHex, assertArgument } from "../utils/index.js"; import { concat, dataLength, getBytes, getBytesCopy, hexlify, toBeHex, assertArgument } from "../utils/index.js";
import { computeHmac } from "./hmac.js";
import { Signature } from "./signature.js"; import { Signature } from "./signature.js";
//const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
// Make noble-secp256k1 sync
secp256k1.utils.hmacSha256Sync = function (key, ...messages) {
return getBytes(computeHmac("sha256", key, concat(messages)));
};
/** /**
* A **SigningKey** provides high-level access to the elliptic curve * A **SigningKey** provides high-level access to the elliptic curve
* cryptography (ECC) operations and key management. * cryptography (ECC) operations and key management.
@ -49,15 +43,13 @@ export class SigningKey {
*/ */
sign(digest) { sign(digest) {
assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest);
const [sigDer, recid] = secp256k1.signSync(getBytesCopy(digest), getBytesCopy(this.#privateKey), { const sig = secp256k1.sign(getBytesCopy(digest), getBytesCopy(this.#privateKey), {
recovered: true, lowS: true
canonical: true
}); });
const sig = secp256k1.Signature.fromHex(sigDer);
return Signature.from({ return Signature.from({
r: toBeHex("0x" + sig.r.toString(16), 32), r: toBeHex(sig.r, 32),
s: toBeHex("0x" + sig.s.toString(16), 32), s: toBeHex(sig.s, 32),
v: (recid ? 0x1c : 0x1b) v: (sig.recovery ? 0x1c : 0x1b)
}); });
} }
/** /**
@ -84,7 +76,7 @@ export class SigningKey {
*/ */
computeSharedSecret(other) { computeSharedSecret(other) {
const pubKey = SigningKey.computePublicKey(other); const pubKey = SigningKey.computePublicKey(other);
return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey))); return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey), false));
} }
/** /**
* Compute the public key for %%key%%, optionally %%compressed%%. * Compute the public key for %%key%%, optionally %%compressed%%.
@ -125,7 +117,7 @@ export class SigningKey {
pub.set(bytes, 1); pub.set(bytes, 1);
bytes = pub; bytes = pub;
} }
const point = secp256k1.Point.fromHex(bytes); const point = secp256k1.ProjectivePoint.fromHex(bytes);
return hexlify(point.toRawBytes(compressed)); return hexlify(point.toRawBytes(compressed));
} }
/** /**
@ -149,10 +141,11 @@ export class SigningKey {
static recoverPublicKey(digest, signature) { static recoverPublicKey(digest, signature) {
assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest); assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest);
const sig = Signature.from(signature); const sig = Signature.from(signature);
const der = secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r, sig.s]))).toDERRawBytes(); let secpSig = secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r, sig.s])));
const pubKey = secp256k1.recoverPublicKey(getBytesCopy(digest), der, sig.yParity); secpSig = secpSig.addRecoveryBit(sig.yParity);
assertArgument(pubKey != null, "invalid signature for digest", "signature", signature); const pubKey = secpSig.recoverPublicKey(getBytesCopy(digest));
return hexlify(pubKey); assertArgument(pubKey != null, "invalid signautre for digest", "signature", signature);
return "0x" + pubKey.toHex(false);
} }
/** /**
* Returns the point resulting from adding the ellipic curve points * Returns the point resulting from adding the ellipic curve points
@ -165,8 +158,8 @@ export class SigningKey {
* addresses from parent public keys and chain codes. * addresses from parent public keys and chain codes.
*/ */
static addPoints(p0, p1, compressed) { static addPoints(p0, p1, compressed) {
const pub0 = secp256k1.Point.fromHex(SigningKey.computePublicKey(p0).substring(2)); const pub0 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2));
const pub1 = secp256k1.Point.fromHex(SigningKey.computePublicKey(p1).substring(2)); const pub1 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2));
return "0x" + pub0.add(pub1).toHex(!!compressed); return "0x" + pub0.add(pub1).toHex(!!compressed);
} }
} }

View File

@ -1 +1 @@
{"version":3,"file":"signing-key.js","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EACH,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAC5D,cAAc,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAO3C,yFAAyF;AAEzF,4BAA4B;AAC5B,SAAS,CAAC,KAAK,CAAC,cAAc,GAAG,UAAS,GAAe,EAAE,GAAG,QAA2B;IACrF,OAAO,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,OAAO,UAAU;IACnB,WAAW,CAAS;IAEpB;;OAEG;IACH,YAAY,U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lib.esm/ethers.d.ts vendored
View File

@ -17,6 +17,6 @@ export type { ProgressCallback, SignatureLike } from "./crypto/index.js";
export type { TypedDataDomain, TypedDataField } from "./hash/index.js"; export type { TypedDataDomain, TypedDataField } from "./hash/index.js";
export type { Provider, Signer, AbstractProviderOptions, FallbackProviderOptions, AbstractProviderPlugin, BlockParams, BlockTag, ContractRunner, DebugEventBrowserProvider, Eip1193Provider, EventFilter, Filter, FilterByBlockHash, GasCostParameters, JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcTransactionRequest, LogParams, MinedBlock, MinedTransactionResponse, Networkish, OrphanFilter, PerformActionFilter, PerformActionRequest, PerformActionTransaction, PreparedTransactionRequest, ProviderEvent, Subscriber, Subscription, TopicFilter, TransactionReceiptParams, TransactionRequest, TransactionResponseParams, WebSocketCreator, WebSocketLike } from "./providers/index.js"; export type { Provider, Signer, AbstractProviderOptions, FallbackProviderOptions, AbstractProviderPlugin, BlockParams, BlockTag, ContractRunner, DebugEventBrowserProvider, Eip1193Provider, EventFilter, Filter, FilterByBlockHash, GasCostParameters, JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcTransactionRequest, LogParams, MinedBlock, MinedTransactionResponse, Networkish, OrphanFilter, PerformActionFilter, PerformActionRequest, PerformActionTransaction, PreparedTransactionRequest, ProviderEvent, Subscriber, Subscription, TopicFilter, TransactionReceiptParams, TransactionRequest, TransactionResponseParams, WebSocketCreator, WebSocketLike } from "./providers/index.js";
export type { AccessList, AccessListish, AccessListEntry, TransactionLike } from "./transaction/index.js"; export type { AccessList, AccessListish, AccessListEntry, TransactionLike } from "./transaction/index.js";
export type { BytesLike, BigNumberish, Numeric, ErrorCode, FixedFormat, Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason, RlpStructuredData, GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc, EthersError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CodedEthersError, CallExceptionAction, CallExceptionTransaction, EventEmitterable, Listener } from "./utils/index.js"; export type { BytesLike, BigNumberish, Numeric, ErrorCode, FixedFormat, Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason, RlpStructuredData, RlpStructuredDataish, GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc, EthersError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CodedEthersError, CallExceptionAction, CallExceptionTransaction, EventEmitterable, Listener } from "./utils/index.js";
export type { CrowdsaleAccount, KeystoreAccount, EncryptOptions } from "./wallet/index.js"; export type { CrowdsaleAccount, KeystoreAccount, EncryptOptions } from "./wallet/index.js";
//# sourceMappingURL=ethers.d.ts.map //# sourceMappingURL=ethers.d.ts.map

View File

@ -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,mBAAmB,EAExC,QAAQ,EACR,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAEzI,iBAAiB,EAAE,gBAAgB,EAAE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,EACT,YAAY,EAAE,OAAO,EACrB,SAAS,EACT,WAAW,EACX,aAAa,EAAE,wBAAwB,EAAE,eAAe,EACxD,iBAAiB,EAAE,oBAAoB,EAEvC,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,mBAAmB,EACnB,gBAAgB,EAEhB,mBAAmB,EAAE,wBAAwB,EAC7C,gBAAgB,EAAE,QAAQ,EAC7B,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACR,gBAAgB,EAAE,eAAe,EAAE,cAAc,EACpD,MAAM,mBAAmB,CAAC"}

View File

@ -509,7 +509,7 @@ export class AbstractProvider {
if (request[key] == null) { if (request[key] == null) {
return; return;
} }
const addr = resolveAddress(request[key]); const addr = resolveAddress(request[key], this);
if (isPromise(addr)) { if (isPromise(addr)) {
promises.push((async function () { request[key] = await addr; })()); promises.push((async function () { request[key] = await addr; })());
} }

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,48 @@
import type { AbstractProvider } from "./abstract-provider.js"; import type { AbstractProvider } from "./abstract-provider.js";
import type { Networkish } from "./network.js"; import type { Networkish } from "./network.js";
import { WebSocketLike } from "./provider-websocket.js"; import { WebSocketLike } from "./provider-websocket.js";
/**
* Returns a default provider for %%network%%.
*
* If %%network%% is a [[WebSocketLike]] or string that begins with
* ``"ws:"`` or ``"wss:"``, a [[WebSocketProvider]] is returned backed
* by that WebSocket or URL.
*
* If %%network%% is a string that begins with ``"HTTP:"`` or ``"HTTPS:"``,
* a [[JsonRpcProvider]] is returned connected to that URL.
*
* Otherwise, a default provider is created backed by well-known public
* Web3 backends (such as [[link-infura]]) using community-provided API
* keys.
*
* The %%options%% allows specifying custom API keys per backend (setting
* an API key to ``"-"`` will omit that provider) and ``options.exclusive``
* can be set to either a backend name or and array of backend names, which
* will whitelist **only** those backends.
*
* Current backend strings supported are:
* - ``"alchemy"``
* - ``"ankr"``
* - ``"cloudflare"``
* - ``"etherscan"``
* - ``"infura"``
* - ``"publicPolygon"``
* - ``"quicknode"``
*
* @example:
* // Connect to a local Geth node
* provider = getDefaultProvider("http://localhost:8545/");
*
* // Connect to Ethereum mainnet with any current and future
* // third-party services available
* provider = getDefaultProvider("mainnet");
*
* // Connect to Polygoin, but only allow Etherscan and
* // INFURA and use "MY_API_KEY" in calls to Etherscan.
* provider = getDefaultProvider("matic", {
* etherscan: "MY_API_KEY",
* exclusive: [ "etherscan", "infura" ]
* });
*/
export declare function getDefaultProvider(network: string | Networkish | WebSocketLike, options?: any): AbstractProvider; export declare function getDefaultProvider(network: string | Networkish | WebSocketLike, options?: any): AbstractProvider;
//# sourceMappingURL=default-provider.d.ts.map //# sourceMappingURL=default-provider.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"default-provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AASxD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,gBAAgB,CAkHhH"} {"version":3,"file":"default-provider.d.ts","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AASxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,gBAAgB,CAkHhH"}

View File

@ -15,6 +15,49 @@ function isWebSocketLike(value) {
typeof (value.close) === "function"); typeof (value.close) === "function");
} }
const Testnets = "goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" "); const Testnets = "goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" ");
/**
* Returns a default provider for %%network%%.
*
* If %%network%% is a [[WebSocketLike]] or string that begins with
* ``"ws:"`` or ``"wss:"``, a [[WebSocketProvider]] is returned backed
* by that WebSocket or URL.
*
* If %%network%% is a string that begins with ``"HTTP:"`` or ``"HTTPS:"``,
* a [[JsonRpcProvider]] is returned connected to that URL.
*
* Otherwise, a default provider is created backed by well-known public
* Web3 backends (such as [[link-infura]]) using community-provided API
* keys.
*
* The %%options%% allows specifying custom API keys per backend (setting
* an API key to ``"-"`` will omit that provider) and ``options.exclusive``
* can be set to either a backend name or and array of backend names, which
* will whitelist **only** those backends.
*
* Current backend strings supported are:
* - ``"alchemy"``
* - ``"ankr"``
* - ``"cloudflare"``
* - ``"etherscan"``
* - ``"infura"``
* - ``"publicPolygon"``
* - ``"quicknode"``
*
* @example:
* // Connect to a local Geth node
* provider = getDefaultProvider("http://localhost:8545/");
*
* // Connect to Ethereum mainnet with any current and future
* // third-party services available
* provider = getDefaultProvider("mainnet");
*
* // Connect to Polygoin, but only allow Etherscan and
* // INFURA and use "MY_API_KEY" in calls to Etherscan.
* provider = getDefaultProvider("matic", {
* etherscan: "MY_API_KEY",
* exclusive: [ "etherscan", "infura" ]
* });
*/
export function getDefaultProvider(network, options) { export function getDefaultProvider(network, options) {
if (options == null) { if (options == null) {
options = {}; options = {};

View File

@ -1 +1 @@
{"version":3,"file":"default-provider.js","sourceRoot":"","sources":["../../src.ts/providers/default-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,wDAAwD;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAM5D,SAAS,eAAe,CAAC,KAAU;IAC/B,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU;QAC9C,OAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,QAAQ,GAAG,qFAAqF,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAElH,MAAM,UAAU,kBAAkB,CAAC,OAA4C,EAAE,OAAa;IAC1F,IAAI,OAAO,IAAI,IAAI,EAAE;QAAE,OAAO,GAAG,EAAG,CAAC;KAAE;IAEvC,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,EAAE;QAClC,IAAI,O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AAG,CAAC,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAsFtF;;OAEG;IACH,uBAAuB,CAAC,WAAW,EAAE,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAyBhF;;OAEG;IACH,WAAW,CAAC,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,GAAG,KAAK;IAiEvE,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAIlC,QAAQ,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;IAiKjD,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAIpC;;;;OAIG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAKtC;;;OAGG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAC;IAc7D,mBAAmB,IAAI,OAAO;CAGjC"}

View File

@ -251,6 +251,9 @@ export class EtherscanProvider extends AbstractProvider {
if (key === "type" && value === 0) { if (key === "type" && value === 0) {
continue; continue;
} }
if (key === "blockTag" && value === "latest") {
continue;
}
// Quantity-types require no leading zero, unless 0 // Quantity-types require no leading zero, unless 0
if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) { if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) {
value = toQuantity(value); value = toQuantity(value);

File diff suppressed because one or more lines are too long

View File

@ -343,12 +343,16 @@ export declare class Block implements BlockParams, Iterable<string> {
*/ */
constructor(block: BlockParams, provider: Provider); constructor(block: BlockParams, provider: Provider);
/** /**
* Returns the list of transaction hashes. * Returns the list of transaction hashes, in the order
* they were executed within the block.
*/ */
get transactions(): ReadonlyArray<string>; get transactions(): ReadonlyArray<string>;
/** /**
* Returns the complete transactions for blocks which * Returns the complete transactions, in the order they
* prefetched them, by passing ``true`` to %%prefetchTxs%% * were executed within the block.
*
* This is only available for blocks which prefetched
* transactions, by passing ``true`` to %%prefetchTxs%%
* into [[Provider-getBlock]]. * into [[Provider-getBlock]].
*/ */
get prefetchedTransactions(): Array<TransactionResponse>; get prefetchedTransactions(): Array<TransactionResponse>;

File diff suppressed because one or more lines are too long

View File

@ -220,7 +220,8 @@ export class Block {
}); });
} }
/** /**
* Returns the list of transaction hashes. * Returns the list of transaction hashes, in the order
* they were executed within the block.
*/ */
get transactions() { get transactions() {
return this.#transactions.map((tx) => { return this.#transactions.map((tx) => {
@ -231,8 +232,11 @@ export class Block {
}); });
} }
/** /**
* Returns the complete transactions for blocks which * Returns the complete transactions, in the order they
* prefetched them, by passing ``true`` to %%prefetchTxs%% * were executed within the block.
*
* This is only available for blocks which prefetched
* transactions, by passing ``true`` to %%prefetchTxs%%
* into [[Provider-getBlock]]. * into [[Provider-getBlock]].
*/ */
get prefetchedTransactions() { get prefetchedTransactions() {

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,9 @@ import type { FetchRequest, FetchResponse } from "./fetch.js";
* An error may contain additional properties, but those must not * An error may contain additional properties, but those must not
* conflict with any impliciat properties. * conflict with any impliciat properties.
*/ */
export type ErrorInfo<T> = Omit<T, "code" | "name" | "message">; export type ErrorInfo<T> = Omit<T, "code" | "name" | "message" | "shortMessage"> & {
shortMessage?: string;
};
/** /**
* All errors emitted by ethers have an **ErrorCode** to help * All errors emitted by ethers have an **ErrorCode** to help
* identify and coalesce errors to simplfy programatic analysis. * identify and coalesce errors to simplfy programatic analysis.
@ -85,6 +87,11 @@ export interface EthersError<T extends ErrorCode = ErrorCode> extends Error {
* The string error code. * The string error code.
*/ */
code: ErrorCode; code: ErrorCode;
/**
* A short message describing the error, with minimal additional
* details.
*/
shortMessage: string;
/** /**
* Additional info regarding the error that may be useful. * Additional info regarding the error that may be useful.
* *

File diff suppressed because one or more lines are too long

View File

@ -85,6 +85,7 @@ export function isCallException(error) {
* ethers version, %%code%% and all aditional properties, serialized. * ethers version, %%code%% and all aditional properties, serialized.
*/ */
export function makeError(message, code, info) { export function makeError(message, code, info) {
let shortMessage = message;
{ {
const details = []; const details = [];
if (info) { if (info) {
@ -92,6 +93,9 @@ export function makeError(message, code, info) {
throw new Error(`value will overwrite populated values: ${stringify(info)}`); throw new Error(`value will overwrite populated values: ${stringify(info)}`);
} }
for (const key in info) { for (const key in info) {
if (key === "shortMessage") {
continue;
}
const value = (info[key]); const value = (info[key]);
// try { // try {
details.push(key + "=" + stringify(value)); details.push(key + "=" + stringify(value));
@ -123,6 +127,9 @@ export function makeError(message, code, info) {
if (info) { if (info) {
Object.assign(error, info); Object.assign(error, info);
} }
if (error.shortMessage == null) {
defineProperties(error, { shortMessage });
}
return error; return error;
} }
/** /**

File diff suppressed because one or more lines are too long

View File

@ -181,6 +181,23 @@ export declare class FetchRequest implements Iterable<[key: string, value: strin
*/ */
get retryFunc(): null | FetchRetryFunc; get retryFunc(): null | FetchRetryFunc;
set retryFunc(retry: null | FetchRetryFunc); set retryFunc(retry: null | FetchRetryFunc);
/**
* This function is called to fetch content from HTTP and
* HTTPS URLs and is platform specific (e.g. nodejs vs
* browsers).
*
* This is by default the currently registered global getUrl
* function, which can be changed using [[registerGetUrl]].
* If this has been set, setting is to ``null`` will cause
* this FetchRequest (and any future clones) to revert back to
* using the currently registered global getUrl function.
*
* Setting this is generally not necessary, but may be useful
* for developers that wish to intercept requests or to
* configurege a proxy or other agent.
*/
get getUrlFunc(): FetchGetUrlFunc;
set getUrlFunc(value: null | FetchGetUrlFunc);
/** /**
* Create a new FetchRequest instance with default values. * Create a new FetchRequest instance with default values.
* *
@ -239,6 +256,18 @@ export declare class FetchRequest implements Iterable<[key: string, value: strin
* throws. * throws.
*/ */
static registerGetUrl(getUrl: FetchGetUrlFunc): void; static registerGetUrl(getUrl: FetchGetUrlFunc): void;
/**
* Creates a getUrl function that fetches content from HTTP and
* HTTPS URLs.
*
* The available %%options%% are dependent on the platform
* implementation of the default getUrl function.
*
* This is not generally something that is needed, but is useful
* when trying to customize simple behaviour when fetching HTTP
* content.
*/
static createGetUrlFunc(options?: Record<string, any>): FetchGetUrlFunc;
/** /**
* Creates a function that can "fetch" data URIs. * Creates a function that can "fetch" data URIs.
* *

View File

@ -1 +1 @@
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src.ts/utils/fetch.ts"],"names":[],"mappings":"AA2BA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,IAAI,GAAG,UAAU,CAAA;CAC1B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;AAElG;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAE3G;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,iBAAiB,KAAK,OAAO,CAAC,YAAY,GAAG,aAAa,CAAC,CAAC;AAElH;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EA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ertArgument } from "./errors.js"; import { assert, assertArgument } from "./errors.js";
import { defineProperties } from "./properties.js"; import { defineProperties } from "./properties.js";
import { toUtf8Bytes, toUtf8String } from "./utf8.js"; import { toUtf8Bytes, toUtf8String } from "./utf8.js";
import { getUrl } from "./geturl.js"; import { createGetUrl } from "./geturl.js";
const MAX_ATTEMPTS = 12; const MAX_ATTEMPTS = 12;
const SLOT_INTERVAL = 250; const SLOT_INTERVAL = 250;
// The global FetchGetUrlFunc implementation. // The global FetchGetUrlFunc implementation.
let getUrlFunc = getUrl; let defaultGetUrlFunc = createGetUrl();
const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"); const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i");
const reIpfs = new RegExp("^ipfs:/\/(ipfs/)?(.*)$", "i"); const reIpfs = new RegExp("^ipfs:/\/(ipfs/)?(.*)$", "i");
// If locked, new Gateways cannot be added // If locked, new Gateways cannot be added
@ -139,6 +139,7 @@ export class FetchRequest {
#retry; #retry;
#signal; #signal;
#throttle; #throttle;
#getUrlFunc;
/** /**
* The fetch URI to requrest. * The fetch URI to requrest.
*/ */
@ -361,6 +362,27 @@ export class FetchRequest {
set retryFunc(retry) { set retryFunc(retry) {
this.#retry = retry; this.#retry = retry;
} }
/**
* This function is called to fetch content from HTTP and
* HTTPS URLs and is platform specific (e.g. nodejs vs
* browsers).
*
* This is by default the currently registered global getUrl
* function, which can be changed using [[registerGetUrl]].
* If this has been set, setting is to ``null`` will cause
* this FetchRequest (and any future clones) to revert back to
* using the currently registered global getUrl function.
*
* Setting this is generally not necessary, but may be useful
* for developers that wish to intercept requests or to
* configurege a proxy or other agent.
*/
get getUrlFunc() {
return this.#getUrlFunc || defaultGetUrlFunc;
}
set getUrlFunc(value) {
this.#getUrlFunc = value;
}
/** /**
* Create a new FetchRequest instance with default values. * Create a new FetchRequest instance with default values.
* *
@ -378,6 +400,7 @@ export class FetchRequest {
slotInterval: SLOT_INTERVAL, slotInterval: SLOT_INTERVAL,
maxAttempts: MAX_ATTEMPTS maxAttempts: MAX_ATTEMPTS
}; };
this.#getUrlFunc = null;
} }
toString() { toString() {
return `<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${this.#body ? hexlify(this.#body) : "null"}>`; return `<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${this.#body ? hexlify(this.#body) : "null"}>`;
@ -432,7 +455,7 @@ export class FetchRequest {
if (this.preflightFunc) { if (this.preflightFunc) {
req = await this.preflightFunc(req); req = await this.preflightFunc(req);
} }
const resp = await getUrlFunc(req, checkSignal(_request.#signal)); const resp = await this.getUrlFunc(req, checkSignal(_request.#signal));
let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request); let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request);
if (response.statusCode === 301 || response.statusCode === 302) { if (response.statusCode === 301 || response.statusCode === 302) {
// Redirect // Redirect
@ -553,6 +576,7 @@ export class FetchRequest {
clone.#preflight = this.#preflight; clone.#preflight = this.#preflight;
clone.#process = this.#process; clone.#process = this.#process;
clone.#retry = this.#retry; clone.#retry = this.#retry;
clone.#getUrlFunc = this.#getUrlFunc;
return clone; return clone;
} }
/** /**
@ -598,7 +622,21 @@ export class FetchRequest {
if (locked) { if (locked) {
throw new Error("gateways locked"); throw new Error("gateways locked");
} }
getUrlFunc = getUrl; defaultGetUrlFunc = getUrl;
}
/**
* Creates a getUrl function that fetches content from HTTP and
* HTTPS URLs.
*
* The available %%options%% are dependent on the platform
* implementation of the default getUrl function.
*
* This is not generally something that is needed, but is useful
* when trying to customize simple behaviour when fetching HTTP
* content.
*/
static createGetUrlFunc(options) {
return createGetUrl(options);
} }
/** /**
* Creates a function that can "fetch" data URIs. * Creates a function that can "fetch" data URIs.

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
import type { FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js"; import type { FetchGetUrlFunc, FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js";
declare global { declare global {
class Headers { class Headers {
constructor(values: Array<[string, string]>); constructor(values: Array<[string, string]>);
@ -17,5 +17,6 @@ declare global {
}; };
function fetch(url: string, init: FetchInit): Promise<Response>; function fetch(url: string, init: FetchInit): Promise<Response>;
} }
export declare function createGetUrl(options?: Record<string, any>): FetchGetUrlFunc;
export declare function getUrl(req: FetchRequest, _signal?: FetchCancelSignal): Promise<GetUrlResponse>; export declare function getUrl(req: FetchRequest, _signal?: FetchCancelSignal): Promise<GetUrlResponse>;
//# sourceMappingURL=geturl-browser.d.ts.map //# sourceMappingURL=geturl-browser.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"geturl-browser.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl-browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGlF,OAAO,CAAC,MAAM,CAAC;IACX,MAAM,OAAO;oBACG,MAAM,EAAE,KAAK,CAAC,CAAE,MAAM,EAAE,MAAM,CAAE,CAAC;QAC7C,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;KACtD;IAED,MAAM,QAAQ;QACV,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;KACtC;IAED,KAAK,SAAS,GAAG;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,UAAU,CAAA;KACpB,CAAC;IAEF,SAAS,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACnE;AAID,wBAAsB,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAyCpG"} {"version":3,"file":"geturl-browser.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl-browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EACnE,MAAM,YAAY,CAAC;AAGpB,OAAO,CAAC,MAAM,CAAC;IACX,MAAM,OAAO;oBACG,MAAM,EAAE,KAAK,CAAC,CAAE,MAAM,EAAE,MAAM,CAAE,CAAC;QAC7C,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;KACtD;IAED,MAAM,QAAQ;QACV,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;KACtC;IAED,KAAK,SAAS,GAAG;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,UAAU,CAAA;KACpB,CAAC;IAEF,SAAS,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACnE;AAID,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,CA8C3E;AAKD,wBAAsB,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAEpG"}

View File

@ -1,37 +1,45 @@
import { assert } from "./errors.js"; import { assert } from "./errors.js";
// @TODO: timeout is completely ignored; start a Promise.any with a reject? // @TODO: timeout is completely ignored; start a Promise.any with a reject?
export async function getUrl(req, _signal) { export function createGetUrl(options) {
const protocol = req.url.split(":")[0].toLowerCase(); async function getUrl(req, _signal) {
assert(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { const protocol = req.url.split(":")[0].toLowerCase();
info: { protocol }, assert(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", {
operation: "request" info: { protocol },
}); operation: "request"
assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { });
operation: "request" assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", {
}); operation: "request"
let signal = undefined; });
if (_signal) { let signal = undefined;
const controller = new AbortController(); if (_signal) {
signal = controller.signal; const controller = new AbortController();
_signal.addListener(() => { controller.abort(); }); signal = controller.signal;
_signal.addListener(() => { controller.abort(); });
}
const init = {
method: req.method,
headers: new Headers(Array.from(req)),
body: req.body || undefined,
signal
};
const resp = await fetch(req.url, init);
const headers = {};
resp.headers.forEach((value, key) => {
headers[key.toLowerCase()] = value;
});
const respBody = await resp.arrayBuffer();
const body = (respBody == null) ? null : new Uint8Array(respBody);
return {
statusCode: resp.status,
statusMessage: resp.statusText,
headers, body
};
} }
const init = { return getUrl;
method: req.method, }
headers: new Headers(Array.from(req)), // @TODO: remove in v7; provided for backwards compat
body: req.body || undefined, const defaultGetUrl = createGetUrl({});
signal export async function getUrl(req, _signal) {
}; return defaultGetUrl(req, _signal);
const resp = await fetch(req.url, init);
const headers = {};
resp.headers.forEach((value, key) => {
headers[key.toLowerCase()] = value;
});
const respBody = await resp.arrayBuffer();
const body = (respBody == null) ? null : new Uint8Array(respBody);
return {
statusCode: resp.status,
statusMessage: resp.statusText,
headers, body
};
} }
//# sourceMappingURL=geturl-browser.js.map //# sourceMappingURL=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AC,CAAC;AAEzD,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,GAAiB,EAAE,OAA2B;IACvE,OAAO,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC"}

View File

@ -1,4 +1,8 @@
import type { FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js"; import type { FetchGetUrlFunc, FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js";
/**
* @_ignore:
*/
export declare function createGetUrl(options?: Record<string, any>): FetchGetUrlFunc;
/** /**
* @_ignore: * @_ignore:
*/ */

View File

@ -1 +1 @@
{"version":3,"file":"geturl.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAElF;;GAEG;AACH,wBAAsB,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAkFnG"} {"version":3,"file":"geturl.d.ts","sourceRoot":"","sources":["../../src.ts/utils/geturl.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EACnE,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,CA0F3E;AAKD;;GAEG;AACH,wBAAsB,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAEnG"}

View File

@ -6,73 +6,89 @@ import { getBytes } from "./data.js";
/** /**
* @_ignore: * @_ignore:
*/ */
export async function getUrl(req, signal) { export function createGetUrl(options) {
const protocol = req.url.split(":")[0].toLowerCase(); async function getUrl(req, signal) {
assert(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { const protocol = req.url.split(":")[0].toLowerCase();
info: { protocol }, assert(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", {
operation: "request" info: { protocol },
}); operation: "request"
assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", {
operation: "request"
});
const method = req.method;
const headers = Object.assign({}, req.headers);
const options = { method, headers };
const request = ((protocol === "http") ? http : https).request(req.url, options);
request.setTimeout(req.timeout);
const body = req.body;
if (body) {
request.write(Buffer.from(body));
}
request.end();
return new Promise((resolve, reject) => {
// @TODO: Node 15 added AbortSignal; once we drop support for
// Node14, we can add that in here too
request.once("response", (resp) => {
const statusCode = resp.statusCode || 0;
const statusMessage = resp.statusMessage || "";
const headers = Object.keys(resp.headers || {}).reduce((accum, name) => {
let value = resp.headers[name] || "";
if (Array.isArray(value)) {
value = value.join(", ");
}
accum[name] = value;
return accum;
}, {});
let body = null;
//resp.setEncoding("utf8");
resp.on("data", (chunk) => {
if (signal) {
try {
signal.checkSignal();
}
catch (error) {
return reject(error);
}
}
if (body == null) {
body = chunk;
}
else {
const newBody = new Uint8Array(body.length + chunk.length);
newBody.set(body, 0);
newBody.set(chunk, body.length);
body = newBody;
}
});
resp.on("end", () => {
if (headers["content-encoding"] === "gzip" && body) {
body = getBytes(gunzipSync(body));
}
resolve({ statusCode, statusMessage, headers, body });
});
resp.on("error", (error) => {
//@TODO: Should this just return nornal response with a server error?
error.response = { statusCode, statusMessage, headers, body };
reject(error);
});
}); });
request.on("error", (error) => { reject(error); }); assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", {
}); operation: "request"
});
const method = req.method;
const headers = Object.assign({}, req.headers);
const reqOptions = { method, headers };
if (options) {
if (options.agent) {
reqOptions.agent = options.agent;
}
}
const request = ((protocol === "http") ? http : https).request(req.url, reqOptions);
request.setTimeout(req.timeout);
const body = req.body;
if (body) {
request.write(Buffer.from(body));
}
request.end();
return new Promise((resolve, reject) => {
// @TODO: Node 15 added AbortSignal; once we drop support for
// Node14, we can add that in here too
request.once("response", (resp) => {
const statusCode = resp.statusCode || 0;
const statusMessage = resp.statusMessage || "";
const headers = Object.keys(resp.headers || {}).reduce((accum, name) => {
let value = resp.headers[name] || "";
if (Array.isArray(value)) {
value = value.join(", ");
}
accum[name] = value;
return accum;
}, {});
let body = null;
//resp.setEncoding("utf8");
resp.on("data", (chunk) => {
if (signal) {
try {
signal.checkSignal();
}
catch (error) {
return reject(error);
}
}
if (body == null) {
body = chunk;
}
else {
const newBody = new Uint8Array(body.length + chunk.length);
newBody.set(body, 0);
newBody.set(chunk, body.length);
body = newBody;
}
});
resp.on("end", () => {
if (headers["content-encoding"] === "gzip" && body) {
body = getBytes(gunzipSync(body));
}
resolve({ statusCode, statusMessage, headers, body });
});
resp.on("error", (error) => {
//@TODO: Should this just return nornal response with a server error?
error.response = { statusCode, statusMessage, headers, body };
reject(error);
});
});
request.on("error", (error) => { reject(error); });
});
}
return getUrl;
}
// @TODO: remove in v7; provided for backwards compat
const defaultGetUrl = createGetUrl({});
/**
* @_ignore:
*/
export async function getUrl(req, signal) {
return defaultGetUrl(req, signal);
} }
//# sourceMappingURL=geturl.js.map //# sourceMappingURL=geturl.js.map

View File

@ -1 +1 @@
{"version":3,"file":"geturl.js","sourceRoot":"","sources":["../../src.ts/utils/geturl.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAIrC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,GAAiB,EAAE,MA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B,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;wBAChC,IAAI,GAAG,OAAO,CAAC;qBAClB;gBACL,CAAC,CAAC,CAAC;gBAEH,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;oBAChB,IAAI,OAAO,CAAC,kBAAkB,CAAC,KAAK,MAAM,IAAI,IAAI,EAAE;wBAChD,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;qBACrC;oBAED,OAAO,CAAC,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC1D,CAAC,CAAC,CAAC;gBAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;oBAC3B,qEAAqE;oBAC3D,KAAM,CAAC,QAAQ,GAAG,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oBACrE,MAAM,CAAC,KAAK,CAAC,CAAC;gBAClB,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACP,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,qDAAqD;AACrD,MAAM,aAAa,GAAoB,YAAY,CAAC,EAAG,CAAC,CAAC;AAEzD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,GAAiB,EAAE,MAA0B;IACtE,OAAO,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACtC,CAAC"}

View File

@ -25,6 +25,6 @@ export type { EventEmitterable, Listener } from "./events.js";
export type { GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc } from "./fetch.js"; export type { GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc } from "./fetch.js";
export type { FixedFormat } from "./fixednumber.js"; export type { FixedFormat } from "./fixednumber.js";
export type { BigNumberish, Numeric } from "./maths.js"; export type { BigNumberish, Numeric } from "./maths.js";
export type { RlpStructuredData } from "./rlp.js"; export type { RlpStructuredData, RlpStructuredDataish } from "./rlp.js";
export type { Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason } from "./utf8.js"; export type { Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason } from "./utf8.js";
//# sourceMappingURL=index.d.ts.map //# sourceMappingURL=index.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EACH,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EACxF,cAAc,EAAE,YAAY,EAAE,YAAY,EAC7C,MAAM,WAAW,CAAC;AAEnB,OAAO,EACH,eAAe,EAAE,OAAO,EACxB,MAAM,EAAE,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,EACzF,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EACH,YAAY,EAAE,aAAa,EAAE,iBAAiB,GACjD,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EACH,QAAQ,EAAE,MAAM,EAAE,IAAI,EACtB,SAAS,EAAE,S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YAAY,CAAC;AAE9E,OAAO,EACH,WAAW,EACX,gBAAgB,EAChB,YAAY,EAEZ,cAAc,GACjB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAKnC,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,YAAY,EAKR,SAAS,EAET,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,mBAAmB,EAEnB,mBAAmB,EAAE,wBAAwB,EAE7C,gBAAgB,EACnB,MAAM,aAAa,CAAA;AAEpB,YAAY,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE9D,YAAY,EACR,cAAc,EACd,kBAAkB,EAAE,gBAAgB,EAAE,cAAc,EACpD,gBAAgB,EAAE,eAAe,EACpC,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAExD,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAExE,YAAY,EACR,aAAa,EACb,wBAAwB,EACxB,eAAe,EAClB,MAAM,WAAW,CAAC"}

View File

@ -1,6 +1,6 @@
import type { RlpStructuredData } from "./rlp.js"; import type { RlpStructuredDataish } from "./rlp.js";
/** /**
* Encodes %%object%% as an RLP-encoded [[DataHexString]]. * Encodes %%object%% as an RLP-encoded [[DataHexString]].
*/ */
export declare function encodeRlp(object: RlpStructuredData): string; export declare function encodeRlp(object: RlpStructuredDataish): string;
//# sourceMappingURL=rlp-encode.d.ts.map //# sourceMappingURL=rlp-encode.d.ts.map

Some files were not shown because too many files have changed in this diff Show More