Updated dist files.

This commit is contained in:
Richard Moore 2020-07-30 17:04:53 -04:00
parent e2d6f281d5
commit c414a45825
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
55 changed files with 471 additions and 306 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -17884,7 +17884,7 @@ var aesJs = createCommonjsModule(function (module, exports) {
})(commonjsGlobal);
});
const version$i = "json-wallets/5.0.3";
const version$i = "json-wallets/5.0.4";
"use strict";
function looseArrayify(hexString) {
@ -19216,7 +19216,7 @@ var browser$2 = /*#__PURE__*/Object.freeze({
encode: encode$1
});
const version$l = "web/5.0.2";
const version$l = "web/5.0.3";
"use strict";
var __awaiter$4 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
@ -19244,7 +19244,7 @@ function getUrl(href, options) {
referrer: "client",
};
const response = yield fetch(href, request);
const body = yield response.text();
const body = yield response.arrayBuffer();
const headers = {};
if (response.headers.forEach) {
response.headers.forEach((value, key) => {
@ -19260,7 +19260,7 @@ function getUrl(href, options) {
headers: headers,
statusCode: response.status,
statusMessage: response.statusText,
body: body,
body: arrayify(new Uint8Array(body)),
};
});
}
@ -19281,7 +19281,7 @@ function staller(duration) {
setTimeout(resolve, duration);
});
}
function fetchJson(connection, json, processFunc) {
function fetchData(connection, body, processFunc) {
// How many times to retry in the event of a throttle
const attemptLimit = (typeof (connection) === "object" && connection.throttleLimit != null) ? connection.throttleLimit : 12;
logger$p.assertArgument((attemptLimit > 0 && (attemptLimit % 1) === 0), "invalid connection throttle limit", "connection.throttleLimit", attemptLimit);
@ -19326,10 +19326,12 @@ function fetchJson(connection, json, processFunc) {
};
}
}
if (json) {
if (body) {
options.method = "POST";
options.body = json;
headers["content-type"] = { key: "Content-Type", value: "application/json" };
options.body = body;
if (headers["content-type"] == null) {
headers["content-type"] = { key: "Content-Type", value: "application/octet-stream" };
}
}
const flatHeaders = {};
Object.keys(headers).forEach((key) => {
@ -19385,6 +19387,7 @@ function fetchJson(connection, json, processFunc) {
else {
stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt)));
}
//console.log("Stalling 429");
yield staller(stall);
continue;
}
@ -19417,25 +19420,11 @@ function fetchJson(connection, json, processFunc) {
url: url
});
}
let json = null;
if (body != null) {
try {
json = JSON.parse(body);
}
catch (error) {
runningTimeout.cancel();
logger$p.throwError("invalid JSON", Logger.errors.SERVER_ERROR, {
body: body,
error: error,
requestBody: (options.body || null),
requestMethod: options.method,
url: url
});
}
}
if (processFunc) {
try {
json = yield processFunc(json, response);
const result = yield processFunc(body, response);
runningTimeout.cancel();
return result;
}
catch (error) {
// Allow the processFunc to trigger a throttle
@ -19446,13 +19435,14 @@ function fetchJson(connection, json, processFunc) {
}
if (tryAgain) {
const timeout = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt)));
//console.log("Stalling callback");
yield staller(timeout);
continue;
}
}
runningTimeout.cancel();
logger$p.throwError("processing response error", Logger.errors.SERVER_ERROR, {
body: json,
body: body,
error: error,
requestBody: (options.body || null),
requestMethod: options.method,
@ -19461,12 +19451,60 @@ function fetchJson(connection, json, processFunc) {
}
}
runningTimeout.cancel();
return json;
// If we had a processFunc, it eitehr returned a T or threw above.
// The "body" is now a Uint8Array.
return body;
}
return logger$p.throwError("failed response", Logger.errors.SERVER_ERROR, {
requestBody: (options.body || null),
requestMethod: options.method,
url: url
});
});
})();
return Promise.race([runningTimeout.promise, runningFetch]);
}
function fetchJson(connection, json, processFunc) {
let processJsonFunc = (value, response) => {
let result = null;
if (value != null) {
try {
result = JSON.parse(toUtf8String(value));
}
catch (error) {
logger$p.throwError("invalid JSON", Logger.errors.SERVER_ERROR, {
body: value,
error: error
});
}
}
if (processFunc) {
result = processFunc(result, response);
}
return result;
};
// If we have json to send, we must
// - add content-type of application/json (unless already overridden)
// - convert the json to bytes
let body = null;
if (json != null) {
body = toUtf8Bytes(json);
// Create a connection with the content-type set for JSON
const updated = (typeof (connection) === "string") ? ({ url: connection }) : connection;
if (updated.headers) {
const hasContentType = (Object.keys(updated.headers).filter((k) => (k.toLowerCase() === "content-type")).length) !== 0;
if (!hasContentType) {
updated.headers = shallowCopy(updated.headers);
updated.headers["content-type"] = "application/json";
}
}
else {
updated.headers = { "content-type": "application/json" };
}
connection = updated;
}
return fetchData(connection, body, processJsonFunc);
}
function poll(func, options) {
if (!options) {
options = {};
@ -23338,6 +23376,7 @@ var utils$1 = /*#__PURE__*/Object.freeze({
checkResultErrors: checkResultErrors,
Logger: Logger,
RLP: index,
fetchData: fetchData,
fetchJson: fetchJson,
poll: poll,
checkProperties: checkProperties,
@ -23358,6 +23397,7 @@ var utils$1 = /*#__PURE__*/Object.freeze({
Interface: Interface,
LogDescription: LogDescription,
TransactionDescription: TransactionDescription,
base58: Base58,
base64: browser$2,
hexlify: hexlify,
isHexString: isHexString,
@ -23418,7 +23458,7 @@ var utils$1 = /*#__PURE__*/Object.freeze({
Indexed: Indexed
});
const version$o = "ethers/5.0.7";
const version$o = "ethers/5.0.8";
"use strict";
const logger$E = new Logger(version$o);

File diff suppressed because one or more lines are too long

View File

@ -19374,7 +19374,7 @@
var _version$A = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "json-wallets/5.0.3";
exports.version = "json-wallets/5.0.4";
});
@ -20990,7 +20990,7 @@
var _version$G = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "web/5.0.2";
exports.version = "web/5.0.3";
});
@ -21036,6 +21036,7 @@
}
};
Object.defineProperty(exports, "__esModule", { value: true });
function getUrl(href, options) {
return __awaiter(this, void 0, void 0, function () {
var request, response, body, headers;
@ -21058,7 +21059,7 @@
return [4 /*yield*/, fetch(href, request)];
case 1:
response = _a.sent();
return [4 /*yield*/, response.text()];
return [4 /*yield*/, response.arrayBuffer()];
case 2:
body = _a.sent();
headers = {};
@ -21076,7 +21077,7 @@
headers: headers,
statusCode: response.status,
statusMessage: response.statusText,
body: body,
body: lib$1.arrayify(new Uint8Array(body)),
}];
}
});
@ -21140,7 +21141,7 @@
setTimeout(resolve, duration);
});
}
function fetchJson(connection, json, processFunc) {
function fetchData(connection, body, processFunc) {
// How many times to retry in the event of a throttle
var attemptLimit = (typeof (connection) === "object" && connection.throttleLimit != null) ? connection.throttleLimit : 12;
logger.assertArgument((attemptLimit > 0 && (attemptLimit % 1) === 0), "invalid connection throttle limit", "connection.throttleLimit", attemptLimit);
@ -21185,10 +21186,12 @@
};
}
}
if (json) {
if (body) {
options.method = "POST";
options.body = json;
headers["content-type"] = { key: "Content-Type", value: "application/json" };
options.body = body;
if (headers["content-type"] == null) {
headers["content-type"] = { key: "Content-Type", value: "application/octet-stream" };
}
}
var flatHeaders = {};
Object.keys(headers).forEach(function (key) {
@ -21225,7 +21228,7 @@
})();
var runningFetch = (function () {
return __awaiter(this, void 0, void 0, function () {
var attempt, response, tryAgain, stall, retryAfter, error_1, body, json_1, error_2, tryAgain, timeout_1;
var attempt, response, tryAgain, stall, retryAfter, error_1, body_1, result, error_2, tryAgain, timeout_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
@ -21257,8 +21260,10 @@
else {
stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt)));
}
//console.log("Stalling 429");
return [4 /*yield*/, staller(stall)];
case 6:
//console.log("Stalling 429");
_a.sent();
return [3 /*break*/, 18];
case 7: return [3 /*break*/, 9];
@ -21276,45 +21281,30 @@
}
return [3 /*break*/, 9];
case 9:
body = response.body;
body_1 = response.body;
if (allow304 && response.statusCode === 304) {
body = null;
body_1 = null;
}
else if (response.statusCode < 200 || response.statusCode >= 300) {
runningTimeout.cancel();
logger.throwError("bad response", lib.Logger.errors.SERVER_ERROR, {
status: response.statusCode,
headers: response.headers,
body: body,
body: body_1,
requestBody: (options.body || null),
requestMethod: options.method,
url: url
});
}
json_1 = null;
if (body != null) {
try {
json_1 = JSON.parse(body);
}
catch (error) {
runningTimeout.cancel();
logger.throwError("invalid JSON", lib.Logger.errors.SERVER_ERROR, {
body: body,
error: error,
requestBody: (options.body || null),
requestMethod: options.method,
url: url
});
}
}
if (!processFunc) return [3 /*break*/, 17];
_a.label = 10;
case 10:
_a.trys.push([10, 12, , 17]);
return [4 /*yield*/, processFunc(json_1, response)];
return [4 /*yield*/, processFunc(body_1, response)];
case 11:
json_1 = _a.sent();
return [3 /*break*/, 17];
result = _a.sent();
runningTimeout.cancel();
return [2 /*return*/, result];
case 12:
error_2 = _a.sent();
if (!(error_2.throttleRetry && attempt < attemptLimit)) return [3 /*break*/, 16];
@ -21327,14 +21317,16 @@
case 14:
if (!tryAgain) return [3 /*break*/, 16];
timeout_1 = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt)));
//console.log("Stalling callback");
return [4 /*yield*/, staller(timeout_1)];
case 15:
//console.log("Stalling callback");
_a.sent();
return [3 /*break*/, 18];
case 16:
runningTimeout.cancel();
logger.throwError("processing response error", lib.Logger.errors.SERVER_ERROR, {
body: json_1,
body: body_1,
error: error_2,
requestBody: (options.body || null),
requestMethod: options.method,
@ -21343,17 +21335,65 @@
return [3 /*break*/, 17];
case 17:
runningTimeout.cancel();
return [2 /*return*/, json_1];
// If we had a processFunc, it eitehr returned a T or threw above.
// The "body" is now a Uint8Array.
return [2 /*return*/, body_1];
case 18:
attempt++;
return [3 /*break*/, 1];
case 19: return [2 /*return*/];
case 19: return [2 /*return*/, logger.throwError("failed response", lib.Logger.errors.SERVER_ERROR, {
requestBody: (options.body || null),
requestMethod: options.method,
url: url
})];
}
});
});
})();
return Promise.race([runningTimeout.promise, runningFetch]);
}
exports.fetchData = fetchData;
function fetchJson(connection, json, processFunc) {
var processJsonFunc = function (value, response) {
var result = null;
if (value != null) {
try {
result = JSON.parse(lib$8.toUtf8String(value));
}
catch (error) {
logger.throwError("invalid JSON", lib.Logger.errors.SERVER_ERROR, {
body: value,
error: error
});
}
}
if (processFunc) {
result = processFunc(result, response);
}
return result;
};
// If we have json to send, we must
// - add content-type of application/json (unless already overridden)
// - convert the json to bytes
var body = null;
if (json != null) {
body = lib$8.toUtf8Bytes(json);
// Create a connection with the content-type set for JSON
var updated = (typeof (connection) === "string") ? ({ url: connection }) : connection;
if (updated.headers) {
var hasContentType = (Object.keys(updated.headers).filter(function (k) { return (k.toLowerCase() === "content-type"); }).length) !== 0;
if (!hasContentType) {
updated.headers = lib$3.shallowCopy(updated.headers);
updated.headers["content-type"] = "application/json";
}
}
else {
updated.headers = { "content-type": "application/json" };
}
connection = updated;
}
return fetchData(connection, body, processJsonFunc);
}
exports.fetchJson = fetchJson;
function poll(func, options) {
if (!options) {
@ -21439,8 +21479,9 @@
});
var index$l = unwrapExports(lib$l);
var lib_1$l = lib$l.fetchJson;
var lib_2$j = lib$l.poll;
var lib_1$l = lib$l.fetchData;
var lib_2$j = lib$l.fetchJson;
var lib_3$f = lib$l.poll;
var _version$I = createCommonjsModule(function (module, exports) {
"use strict";
@ -26181,7 +26222,7 @@
var index$m = unwrapExports(lib$m);
var lib_1$m = lib$m.Provider;
var lib_2$k = lib$m.getNetwork;
var lib_3$f = lib$m.BaseProvider;
var lib_3$g = lib$m.BaseProvider;
var lib_4$c = lib$m.AlchemyProvider;
var lib_5$b = lib$m.CloudflareProvider;
var lib_6$7 = lib$m.EtherscanProvider;
@ -26296,7 +26337,7 @@
var index$n = unwrapExports(lib$n);
var lib_1$n = lib$n.pack;
var lib_2$l = lib$n.keccak256;
var lib_3$g = lib$n.sha256;
var lib_3$h = lib$n.sha256;
var _version$K = createCommonjsModule(function (module, exports) {
"use strict";
@ -26401,7 +26442,7 @@
var index$o = unwrapExports(lib$o);
var lib_1$o = lib$o.commify;
var lib_2$m = lib$o.formatUnits;
var lib_3$h = lib$o.parseUnits;
var lib_3$i = lib$o.parseUnits;
var lib_4$d = lib$o.formatEther;
var lib_5$c = lib$o.parseEther;
@ -26437,6 +26478,8 @@
var base64 = __importStar(browser$8);
exports.base64 = base64;
exports.base58 = lib$e.Base58;
exports.arrayify = lib$1.arrayify;
exports.concat = lib$1.concat;
exports.hexDataSlice = lib$1.hexDataSlice;
@ -26518,6 +26561,7 @@
exports.verifyMessage = lib$j.verifyMessage;
exports.fetchData = lib$l.fetchData;
exports.fetchJson = lib$l.fetchJson;
exports.poll = lib$l.poll;
////////////////////////
@ -26549,81 +26593,83 @@
var utils_16 = utils$3.getIcapAddress;
var utils_17 = utils$3.isAddress;
var utils_18 = utils$3.base64;
var utils_19 = utils$3.arrayify;
var utils_20 = utils$3.concat;
var utils_21 = utils$3.hexDataSlice;
var utils_22 = utils$3.hexDataLength;
var utils_23 = utils$3.hexlify;
var utils_24 = utils$3.hexStripZeros;
var utils_25 = utils$3.hexValue;
var utils_26 = utils$3.hexZeroPad;
var utils_27 = utils$3.isBytes;
var utils_28 = utils$3.isBytesLike;
var utils_29 = utils$3.isHexString;
var utils_30 = utils$3.joinSignature;
var utils_31 = utils$3.zeroPad;
var utils_32 = utils$3.splitSignature;
var utils_33 = utils$3.stripZeros;
var utils_34 = utils$3.hashMessage;
var utils_35 = utils$3.id;
var utils_36 = utils$3.isValidName;
var utils_37 = utils$3.namehash;
var utils_38 = utils$3.defaultPath;
var utils_39 = utils$3.entropyToMnemonic;
var utils_40 = utils$3.HDNode;
var utils_41 = utils$3.isValidMnemonic;
var utils_42 = utils$3.mnemonicToEntropy;
var utils_43 = utils$3.mnemonicToSeed;
var utils_44 = utils$3.getJsonWalletAddress;
var utils_45 = utils$3.keccak256;
var utils_46 = utils$3.Logger;
var utils_47 = utils$3.computeHmac;
var utils_48 = utils$3.ripemd160;
var utils_49 = utils$3.sha256;
var utils_50 = utils$3.sha512;
var utils_51 = utils$3.solidityKeccak256;
var utils_52 = utils$3.solidityPack;
var utils_53 = utils$3.soliditySha256;
var utils_54 = utils$3.randomBytes;
var utils_55 = utils$3.shuffled;
var utils_56 = utils$3.checkProperties;
var utils_57 = utils$3.deepCopy;
var utils_58 = utils$3.defineReadOnly;
var utils_59 = utils$3.getStatic;
var utils_60 = utils$3.resolveProperties;
var utils_61 = utils$3.shallowCopy;
var utils_62 = utils$3.RLP;
var utils_63 = utils$3.computePublicKey;
var utils_64 = utils$3.recoverPublicKey;
var utils_65 = utils$3.SigningKey;
var utils_66 = utils$3.formatBytes32String;
var utils_67 = utils$3.nameprep;
var utils_68 = utils$3.parseBytes32String;
var utils_69 = utils$3._toEscapedUtf8String;
var utils_70 = utils$3.toUtf8Bytes;
var utils_71 = utils$3.toUtf8CodePoints;
var utils_72 = utils$3.toUtf8String;
var utils_73 = utils$3.Utf8ErrorFuncs;
var utils_74 = utils$3.computeAddress;
var utils_75 = utils$3.parseTransaction;
var utils_76 = utils$3.recoverAddress;
var utils_77 = utils$3.serializeTransaction;
var utils_78 = utils$3.commify;
var utils_79 = utils$3.formatEther;
var utils_80 = utils$3.parseEther;
var utils_81 = utils$3.formatUnits;
var utils_82 = utils$3.parseUnits;
var utils_83 = utils$3.verifyMessage;
var utils_84 = utils$3.fetchJson;
var utils_85 = utils$3.poll;
var utils_86 = utils$3.SupportedAlgorithm;
var utils_87 = utils$3.UnicodeNormalizationForm;
var utils_88 = utils$3.Utf8ErrorReason;
var utils_19 = utils$3.base58;
var utils_20 = utils$3.arrayify;
var utils_21 = utils$3.concat;
var utils_22 = utils$3.hexDataSlice;
var utils_23 = utils$3.hexDataLength;
var utils_24 = utils$3.hexlify;
var utils_25 = utils$3.hexStripZeros;
var utils_26 = utils$3.hexValue;
var utils_27 = utils$3.hexZeroPad;
var utils_28 = utils$3.isBytes;
var utils_29 = utils$3.isBytesLike;
var utils_30 = utils$3.isHexString;
var utils_31 = utils$3.joinSignature;
var utils_32 = utils$3.zeroPad;
var utils_33 = utils$3.splitSignature;
var utils_34 = utils$3.stripZeros;
var utils_35 = utils$3.hashMessage;
var utils_36 = utils$3.id;
var utils_37 = utils$3.isValidName;
var utils_38 = utils$3.namehash;
var utils_39 = utils$3.defaultPath;
var utils_40 = utils$3.entropyToMnemonic;
var utils_41 = utils$3.HDNode;
var utils_42 = utils$3.isValidMnemonic;
var utils_43 = utils$3.mnemonicToEntropy;
var utils_44 = utils$3.mnemonicToSeed;
var utils_45 = utils$3.getJsonWalletAddress;
var utils_46 = utils$3.keccak256;
var utils_47 = utils$3.Logger;
var utils_48 = utils$3.computeHmac;
var utils_49 = utils$3.ripemd160;
var utils_50 = utils$3.sha256;
var utils_51 = utils$3.sha512;
var utils_52 = utils$3.solidityKeccak256;
var utils_53 = utils$3.solidityPack;
var utils_54 = utils$3.soliditySha256;
var utils_55 = utils$3.randomBytes;
var utils_56 = utils$3.shuffled;
var utils_57 = utils$3.checkProperties;
var utils_58 = utils$3.deepCopy;
var utils_59 = utils$3.defineReadOnly;
var utils_60 = utils$3.getStatic;
var utils_61 = utils$3.resolveProperties;
var utils_62 = utils$3.shallowCopy;
var utils_63 = utils$3.RLP;
var utils_64 = utils$3.computePublicKey;
var utils_65 = utils$3.recoverPublicKey;
var utils_66 = utils$3.SigningKey;
var utils_67 = utils$3.formatBytes32String;
var utils_68 = utils$3.nameprep;
var utils_69 = utils$3.parseBytes32String;
var utils_70 = utils$3._toEscapedUtf8String;
var utils_71 = utils$3.toUtf8Bytes;
var utils_72 = utils$3.toUtf8CodePoints;
var utils_73 = utils$3.toUtf8String;
var utils_74 = utils$3.Utf8ErrorFuncs;
var utils_75 = utils$3.computeAddress;
var utils_76 = utils$3.parseTransaction;
var utils_77 = utils$3.recoverAddress;
var utils_78 = utils$3.serializeTransaction;
var utils_79 = utils$3.commify;
var utils_80 = utils$3.formatEther;
var utils_81 = utils$3.parseEther;
var utils_82 = utils$3.formatUnits;
var utils_83 = utils$3.parseUnits;
var utils_84 = utils$3.verifyMessage;
var utils_85 = utils$3.fetchData;
var utils_86 = utils$3.fetchJson;
var utils_87 = utils$3.poll;
var utils_88 = utils$3.SupportedAlgorithm;
var utils_89 = utils$3.UnicodeNormalizationForm;
var utils_90 = utils$3.Utf8ErrorReason;
var _version$M = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "ethers/5.0.7";
exports.version = "ethers/5.0.8";
});
@ -26737,7 +26783,7 @@
var index$p = unwrapExports(lib$p);
var lib_1$p = lib$p.ethers;
var lib_2$n = lib$p.Signer;
var lib_3$i = lib$p.Wallet;
var lib_3$j = lib$p.Wallet;
var lib_4$e = lib$p.VoidSigner;
var lib_5$d = lib$p.getDefaultProvider;
var lib_6$8 = lib$p.providers;
@ -26759,7 +26805,7 @@
exports.FixedNumber = lib_10$4;
exports.Signer = lib_2$n;
exports.VoidSigner = lib_4$e;
exports.Wallet = lib_3$i;
exports.Wallet = lib_3$j;
exports.Wordlist = lib_17$1;
exports.constants = lib_11$3;
exports.default = index$p;

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
export declare const version = "ethers/5.0.7";
export declare const version = "ethers/5.0.8";

View File

@ -1,2 +1,2 @@
export const version = "ethers/5.0.7";
export const version = "ethers/5.0.8";
//# sourceMappingURL=_version.js.map

View File

@ -1,6 +1,7 @@
import { AbiCoder, checkResultErrors, defaultAbiCoder, EventFragment, FormatTypes, Fragment, FunctionFragment, Indexed, Interface, LogDescription, ParamType, Result, TransactionDescription } from "@ethersproject/abi";
import { getAddress, getCreate2Address, getContractAddress, getIcapAddress, isAddress } from "@ethersproject/address";
import * as base64 from "@ethersproject/base64";
import { Base58 as base58 } from "@ethersproject/basex";
import { arrayify, concat, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexValue, hexZeroPad, isBytes, isBytesLike, isHexString, joinSignature, zeroPad, splitSignature, stripZeros } from "@ethersproject/bytes";
import { hashMessage, id, isValidName, namehash } from "@ethersproject/hash";
import { defaultPath, entropyToMnemonic, HDNode, isValidMnemonic, mnemonicToEntropy, mnemonicToSeed } from "@ethersproject/hdnode";
@ -17,7 +18,7 @@ import { formatBytes32String, nameprep, parseBytes32String, _toEscapedUtf8String
import { computeAddress, parse as parseTransaction, recoverAddress, serialize as serializeTransaction } from "@ethersproject/transactions";
import { commify, formatEther, parseEther, formatUnits, parseUnits } from "@ethersproject/units";
import { verifyMessage } from "@ethersproject/wallet";
import { fetchJson, poll } from "@ethersproject/web";
import { fetchData, fetchJson, poll } from "@ethersproject/web";
import { SupportedAlgorithm } from "@ethersproject/sha2";
import { UnicodeNormalizationForm, Utf8ErrorReason } from "@ethersproject/strings";
import { UnsignedTransaction } from "@ethersproject/transactions";
@ -28,4 +29,4 @@ import { EncryptOptions, ProgressCallback } from "@ethersproject/json-wallets";
import { Deferrable } from "@ethersproject/properties";
import { Utf8ErrorFunc } from "@ethersproject/strings";
import { ConnectionInfo, FetchJsonResponse, OnceBlockable, OncePollable, PollOptions } from "@ethersproject/web";
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, checkResultErrors, Result, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, LogDescription, TransactionDescription, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Bytes, BytesLike, Hexable, UnsignedTransaction, CoerceFunc, Indexed, Mnemonic, Deferrable, Utf8ErrorFunc, ConnectionInfo, OnceBlockable, OncePollable, PollOptions, FetchJsonResponse, EncryptOptions, ProgressCallback };
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, checkResultErrors, Result, Logger, RLP, fetchData, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, LogDescription, TransactionDescription, base58, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Bytes, BytesLike, Hexable, UnsignedTransaction, CoerceFunc, Indexed, Mnemonic, Deferrable, Utf8ErrorFunc, ConnectionInfo, OnceBlockable, OncePollable, PollOptions, FetchJsonResponse, EncryptOptions, ProgressCallback };

View File

@ -2,6 +2,7 @@
import { AbiCoder, checkResultErrors, defaultAbiCoder, EventFragment, FormatTypes, Fragment, FunctionFragment, Indexed, Interface, LogDescription, ParamType, TransactionDescription } from "@ethersproject/abi";
import { getAddress, getCreate2Address, getContractAddress, getIcapAddress, isAddress } from "@ethersproject/address";
import * as base64 from "@ethersproject/base64";
import { Base58 as base58 } from "@ethersproject/basex";
import { arrayify, concat, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexValue, hexZeroPad, isBytes, isBytesLike, isHexString, joinSignature, zeroPad, splitSignature, stripZeros } from "@ethersproject/bytes";
import { hashMessage, id, isValidName, namehash } from "@ethersproject/hash";
import { defaultPath, entropyToMnemonic, HDNode, isValidMnemonic, mnemonicToEntropy, mnemonicToSeed } from "@ethersproject/hdnode";
@ -18,14 +19,14 @@ import { formatBytes32String, nameprep, parseBytes32String, _toEscapedUtf8String
import { computeAddress, parse as parseTransaction, recoverAddress, serialize as serializeTransaction } from "@ethersproject/transactions";
import { commify, formatEther, parseEther, formatUnits, parseUnits } from "@ethersproject/units";
import { verifyMessage } from "@ethersproject/wallet";
import { fetchJson, poll } from "@ethersproject/web";
import { fetchData, fetchJson, poll } from "@ethersproject/web";
////////////////////////
// Enums
import { SupportedAlgorithm } from "@ethersproject/sha2";
import { UnicodeNormalizationForm, Utf8ErrorReason } from "@ethersproject/strings";
////////////////////////
// Exports
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, checkResultErrors, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, LogDescription, TransactionDescription, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed,
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, checkResultErrors, Logger, RLP, fetchData, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, LogDescription, TransactionDescription, base58, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed,
////////////////////////
// Enums
SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Indexed };

View File

@ -1 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src.ts/utils.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,EAAU,sBAAsB,EAAE,MAAK,oBAAoB,CAAC;AACxN,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACtH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE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const version = "ethers/5.0.8";

View File

@ -1,4 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "ethers/5.0.7";
exports.version = "ethers/5.0.8";
//# sourceMappingURL=_version.js.map

View File

@ -1,6 +1,7 @@
import { AbiCoder, checkResultErrors, defaultAbiCoder, EventFragment, FormatTypes, Fragment, FunctionFragment, Indexed, Interface, LogDescription, ParamType, Result, TransactionDescription } from "@ethersproject/abi";
import { getAddress, getCreate2Address, getContractAddress, getIcapAddress, isAddress } from "@ethersproject/address";
import * as base64 from "@ethersproject/base64";
import { Base58 as base58 } from "@ethersproject/basex";
import { arrayify, concat, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexValue, hexZeroPad, isBytes, isBytesLike, isHexString, joinSignature, zeroPad, splitSignature, stripZeros } from "@ethersproject/bytes";
import { hashMessage, id, isValidName, namehash } from "@ethersproject/hash";
import { defaultPath, entropyToMnemonic, HDNode, isValidMnemonic, mnemonicToEntropy, mnemonicToSeed } from "@ethersproject/hdnode";
@ -17,7 +18,7 @@ import { formatBytes32String, nameprep, parseBytes32String, _toEscapedUtf8String
import { computeAddress, parse as parseTransaction, recoverAddress, serialize as serializeTransaction } from "@ethersproject/transactions";
import { commify, formatEther, parseEther, formatUnits, parseUnits } from "@ethersproject/units";
import { verifyMessage } from "@ethersproject/wallet";
import { fetchJson, poll } from "@ethersproject/web";
import { fetchData, fetchJson, poll } from "@ethersproject/web";
import { SupportedAlgorithm } from "@ethersproject/sha2";
import { UnicodeNormalizationForm, Utf8ErrorReason } from "@ethersproject/strings";
import { UnsignedTransaction } from "@ethersproject/transactions";
@ -28,4 +29,4 @@ import { EncryptOptions, ProgressCallback } from "@ethersproject/json-wallets";
import { Deferrable } from "@ethersproject/properties";
import { Utf8ErrorFunc } from "@ethersproject/strings";
import { ConnectionInfo, FetchJsonResponse, OnceBlockable, OncePollable, PollOptions } from "@ethersproject/web";
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, checkResultErrors, Result, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, LogDescription, TransactionDescription, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Bytes, BytesLike, Hexable, UnsignedTransaction, CoerceFunc, Indexed, Mnemonic, Deferrable, Utf8ErrorFunc, ConnectionInfo, OnceBlockable, OncePollable, PollOptions, FetchJsonResponse, EncryptOptions, ProgressCallback };
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, checkResultErrors, Result, Logger, RLP, fetchData, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, LogDescription, TransactionDescription, base58, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Bytes, BytesLike, Hexable, UnsignedTransaction, CoerceFunc, Indexed, Mnemonic, Deferrable, Utf8ErrorFunc, ConnectionInfo, OnceBlockable, OncePollable, PollOptions, FetchJsonResponse, EncryptOptions, ProgressCallback };

View File

@ -28,6 +28,8 @@ exports.getIcapAddress = address_1.getIcapAddress;
exports.isAddress = address_1.isAddress;
var base64 = __importStar(require("@ethersproject/base64"));
exports.base64 = base64;
var basex_1 = require("@ethersproject/basex");
exports.base58 = basex_1.Base58;
var bytes_1 = require("@ethersproject/bytes");
exports.arrayify = bytes_1.arrayify;
exports.concat = bytes_1.concat;
@ -110,6 +112,7 @@ exports.parseUnits = units_1.parseUnits;
var wallet_1 = require("@ethersproject/wallet");
exports.verifyMessage = wallet_1.verifyMessage;
var web_1 = require("@ethersproject/web");
exports.fetchData = web_1.fetchData;
exports.fetchJson = web_1.fetchJson;
exports.poll = web_1.poll;
////////////////////////

View File

@ -1 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src.ts/utils.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;AAEb,0CAAwN;AA2CpN,mBA3CK,cAAQ,CA2CL;AASR,4BApDe,uBAAiB,CAoDf;AARjB,0BA5CkC,qBAAe,CA4ClC;AAGf,wBA/CmD,mBAAa,CA+CnD;AAGb,sBAlDkE,iBAAW,CAkDlE;AAJX,mBA9C+E,cAAQ,CA8C/E;AAER,2BAhDyF,sBAAgB,CAgDzF;AAoIhB,kBApL2G,aAAO,CAoL3G;AAlGP,oBAl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base64": "^5.0.0",
"@ethersproject/basex": "^5.0.0",
"@ethersproject/bignumber": "^5.0.0",
"@ethersproject/bytes": "^5.0.0",
"@ethersproject/constants": "^5.0.0",
@ -49,7 +50,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x17ba6d6f28b5eddd096e17f9c1c855d4c9559f25de72246080f61ea22ca640a1",
"tarballHash": "0x0e595ef116eb4da86ea0a69cb271653d195d50b807553439d9ad7f28320f22de",
"types": "./lib/index.d.ts",
"version": "5.0.7"
"version": "5.0.8"
}

View File

@ -1 +1 @@
export const version = "ethers/5.0.7";
export const version = "ethers/5.0.8";

View File

@ -3,6 +3,7 @@
import { AbiCoder, checkResultErrors, defaultAbiCoder, EventFragment, FormatTypes, Fragment, FunctionFragment, Indexed, Interface, LogDescription, ParamType, Result, TransactionDescription }from "@ethersproject/abi";
import { getAddress, getCreate2Address, getContractAddress, getIcapAddress, isAddress } from "@ethersproject/address";
import * as base64 from "@ethersproject/base64";
import { Base58 as base58 } from "@ethersproject/basex";
import { arrayify, concat, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexValue, hexZeroPad, isBytes, isBytesLike, isHexString, joinSignature, zeroPad, splitSignature, stripZeros } from "@ethersproject/bytes";
import { hashMessage, id, isValidName, namehash } from "@ethersproject/hash";
import { defaultPath, entropyToMnemonic, HDNode, isValidMnemonic, mnemonicToEntropy, mnemonicToSeed } from "@ethersproject/hdnode";
@ -19,7 +20,7 @@ import { formatBytes32String, nameprep, parseBytes32String, _toEscapedUtf8String
import { computeAddress, parse as parseTransaction, recoverAddress, serialize as serializeTransaction } from "@ethersproject/transactions";
import { commify, formatEther, parseEther, formatUnits, parseUnits } from "@ethersproject/units";
import { verifyMessage } from "@ethersproject/wallet";
import { fetchJson, poll } from "@ethersproject/web";
import { fetchData, fetchJson, poll } from "@ethersproject/web";
////////////////////////
// Enums
@ -59,6 +60,7 @@ export {
RLP,
fetchData,
fetchJson,
poll,
@ -87,6 +89,7 @@ export {
LogDescription,
TransactionDescription,
base58,
base64,
hexlify,

View File

@ -1 +1 @@
export declare const version = "json-wallets/5.0.3";
export declare const version = "json-wallets/5.0.4";

View File

@ -1,2 +1,2 @@
export const version = "json-wallets/5.0.3";
export const version = "json-wallets/5.0.4";
//# sourceMappingURL=_version.js.map

View File

@ -1 +1 @@
export declare const version = "json-wallets/5.0.3";
export declare const version = "json-wallets/5.0.4";

View File

@ -1,4 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "json-wallets/5.0.3";
exports.version = "json-wallets/5.0.4";
//# sourceMappingURL=_version.js.map

View File

@ -35,7 +35,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x4a441a1d1289da6181565c45bd43c8636a15488ab9aafb2bc5c0e8d6c0c87376",
"tarballHash": "0x541b93a8a82058ac96f8c7f06bed6c8322af119ff03d440cc17dfa521ba68796",
"types": "./lib/index.d.ts",
"version": "5.0.3"
"version": "5.0.4"
}

View File

@ -1 +1 @@
export const version = "json-wallets/5.0.3";
export const version = "json-wallets/5.0.4";

View File

@ -1 +1 @@
export declare const version = "web/5.0.2";
export declare const version = "web/5.0.3";

View File

@ -1,2 +1,2 @@
export const version = "web/5.0.2";
export const version = "web/5.0.3";
//# sourceMappingURL=_version.js.map

View File

@ -1,16 +1,3 @@
export declare type GetUrlResponse = {
statusCode: number;
statusMessage: string;
headers: {
[key: string]: string;
};
body: string;
};
export declare type Options = {
method?: string;
body?: string;
headers?: {
[key: string]: string;
};
};
import type { GetUrlResponse, Options } from "./types";
export { GetUrlResponse, Options };
export declare function getUrl(href: string, options?: Options): Promise<GetUrlResponse>;

View File

@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { arrayify } from "@ethersproject/bytes";
export function getUrl(href, options) {
return __awaiter(this, void 0, void 0, function* () {
if (options == null) {
@ -24,7 +25,7 @@ export function getUrl(href, options) {
referrer: "client",
};
const response = yield fetch(href, request);
const body = yield response.text();
const body = yield response.arrayBuffer();
const headers = {};
if (response.headers.forEach) {
response.headers.forEach((value, key) => {
@ -40,7 +41,7 @@ export function getUrl(href, options) {
headers: headers,
statusCode: response.status,
statusMessage: response.statusText,
body: body,
body: arrayify(new Uint8Array(body)),
};
});
}

View File

@ -1 +1 @@
{"version":3,"file":"browser-geturl.js","sourceRoot":"","sources":["../src.ts/browser-geturl.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;AAeb,MAAM,UAAgB,MAAM,CAAC,IAAY,EAAE,OAAiB;;QACxD,IAAI,OAAO,IAAI,IAAI,EAAE;YAAE,OAAO,GAAG,EAAG,CAAC;SAAE;QAEvC,MAAM,OAAO,GAAG;YACZ,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC;YACjC,OAAO,EAAE,CAAC,OAAO,CAAC,OAAO,IAAI,EAAG,CAAC;YACjC,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,SAAS,CAAC;YAEjC,IAAI,EAAe,MAAM;YACzB,KAAK,EAAgB,UAAU;YAC/B,WAAW,EAAsB,aAAa;YAC9C,QAAQ,EAAmB,QAAQ;YACnC,QAAQ,EAAE,QAAQ;SACrB,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5C,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAEnC,MAAM,OAAO,GAAiC,EAAG,CAAC;QAClD,IAAI,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE;YAC1B,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;gBACpC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;YACvC,CAAC,CAAC,CAAC;SACN;aAAM;YACmB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AAC,OAAO,CAAC,OAAO,EAAE;YAC1B,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;gBACpC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;YACvC,CAAC,CAAC,CAAC;SACN;aAAM;YACmB,CAAO,CAAC,QAAQ,CAAC,OAAO,CAAE,CAAC,IAAI,CAAE,EAAE,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBACtE,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC3D,CAAC,CAAC,CAAC;SACN;QAED,OAAO;YACH,OAAO,EAAE,OAAO;YAChB,UAAU,EAAE,QAAQ,CAAC,MAAM;YAC3B,aAAa,EAAE,QAAQ,CAAC,UAAU;YAClC,IAAI,EAAE,QAAQ,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;SACvC,CAAA;IACL,CAAC;CAAA"}

View File

@ -1,16 +1,3 @@
export declare type GetUrlResponse = {
statusCode: number;
statusMessage: string;
headers: {
[key: string]: string;
};
body: string;
};
export declare type Options = {
method?: string;
body?: string;
headers?: {
[key: string]: string;
};
};
import type { GetUrlResponse, Options } from "./types";
export { GetUrlResponse, Options };
export declare function getUrl(href: string, options?: Options): Promise<GetUrlResponse>;

View File

@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
import http from "http";
import https from "https";
import { parse } from "url";
import { concat } from "@ethersproject/bytes";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
@ -30,12 +31,12 @@ function getResponse(request) {
}, {}),
body: null
};
resp.setEncoding("utf8");
//resp.setEncoding("utf8");
resp.on("data", (chunk) => {
if (response.body == null) {
response.body = "";
response.body = new Uint8Array(0);
}
response.body += chunk;
response.body = concat([response.body, chunk]);
});
resp.on("end", () => {
resolve(response);
@ -89,7 +90,7 @@ export function getUrl(href, options) {
});
}
if (options.body) {
req.write(options.body);
req.write(Buffer.from(options.body));
}
req.end();
const response = yield getResponse(req);

View File

@ -1 +1 @@
{"version":3,"file":"geturl.js","sourceRoot":"","sources":["../src.ts/geturl.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AAE3B,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;AAenC,SAAS,WAAW,CAAC,OAA2B;IAC5C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACnC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,IAA0B,EAAE,EAAE;YACpD,MAAM,QAAQ,GAAmB;gBAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,aAAa,EAAE,IAAI,CAAC,aAAa;gBACjC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;oBACtD,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;oBAC/B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;wBACtB,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;qBAC5B;oBACD,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;oBACpB,OAAO,KAAK,CAAC;gBACjB,CAAC,EAAgC,EAAG,CAAC;gBACrC,IAAI,EAAE,IAAI;a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AQ,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAEnD,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC;YACjC,OAAO,EAAE,CAAC,OAAO,CAAC,OAAO,IAAI,EAAG,CAAC;SACpC,CAAC;QAEF,IAAI,GAAG,GAAuB,IAAI,CAAC;QACnC,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAC3B,KAAK,OAAO;gBACR,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAC5B,MAAM;YACV,KAAK,QAAQ;gBACT,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAC7B,MAAM;YACV;gBACI,0BAA0B;gBAC1B,MAAM,CAAC,UAAU,CAAC,wBAAyB,GAAG,CAAC,QAAS,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE;oBAC7F,QAAQ,EAAE,GAAG,CAAC,QAAQ;oBACtB,SAAS,EAAE,SAAS;iBACvB,CAAC,CAAC;SACV;QAED,IAAI,OAAO,CAAC,IAAI,EAAE;YACd,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;SACxC;QACD,GAAG,CAAC,GAAG,EAAE,CAAC;QAEV,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,CAAC;QACxC,OAAO,QAAQ,CAAC;IACpB,CAAC;CAAA"}

View File

@ -32,5 +32,6 @@ export declare type FetchJsonResponse = {
[header: string]: string;
};
};
export declare function fetchData<T = Uint8Array>(connection: string | ConnectionInfo, body?: Uint8Array, processFunc?: (value: Uint8Array, response: FetchJsonResponse) => T): Promise<T>;
export declare function fetchJson(connection: string | ConnectionInfo, json?: string, processFunc?: (value: any, response: FetchJsonResponse) => any): Promise<any>;
export declare function poll<T>(func: () => Promise<T>, options?: PollOptions): Promise<T>;

View File

@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
import { encode as base64Encode } from "@ethersproject/base64";
import { shallowCopy } from "@ethersproject/properties";
import { toUtf8Bytes } from "@ethersproject/strings";
import { toUtf8Bytes, toUtf8String } from "@ethersproject/strings";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
@ -20,7 +20,7 @@ function staller(duration) {
setTimeout(resolve, duration);
});
}
export function fetchJson(connection, json, processFunc) {
export function fetchData(connection, body, processFunc) {
// How many times to retry in the event of a throttle
const attemptLimit = (typeof (connection) === "object" && connection.throttleLimit != null) ? connection.throttleLimit : 12;
logger.assertArgument((attemptLimit > 0 && (attemptLimit % 1) === 0), "invalid connection throttle limit", "connection.throttleLimit", attemptLimit);
@ -65,10 +65,12 @@ export function fetchJson(connection, json, processFunc) {
};
}
}
if (json) {
if (body) {
options.method = "POST";
options.body = json;
headers["content-type"] = { key: "Content-Type", value: "application/json" };
options.body = body;
if (headers["content-type"] == null) {
headers["content-type"] = { key: "Content-Type", value: "application/octet-stream" };
}
}
const flatHeaders = {};
Object.keys(headers).forEach((key) => {
@ -124,6 +126,7 @@ export function fetchJson(connection, json, processFunc) {
else {
stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt)));
}
//console.log("Stalling 429");
yield staller(stall);
continue;
}
@ -156,25 +159,11 @@ export function fetchJson(connection, json, processFunc) {
url: url
});
}
let json = null;
if (body != null) {
try {
json = JSON.parse(body);
}
catch (error) {
runningTimeout.cancel();
logger.throwError("invalid JSON", Logger.errors.SERVER_ERROR, {
body: body,
error: error,
requestBody: (options.body || null),
requestMethod: options.method,
url: url
});
}
}
if (processFunc) {
try {
json = yield processFunc(json, response);
const result = yield processFunc(body, response);
runningTimeout.cancel();
return result;
}
catch (error) {
// Allow the processFunc to trigger a throttle
@ -185,13 +174,14 @@ export function fetchJson(connection, json, processFunc) {
}
if (tryAgain) {
const timeout = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt)));
//console.log("Stalling callback");
yield staller(timeout);
continue;
}
}
runningTimeout.cancel();
logger.throwError("processing response error", Logger.errors.SERVER_ERROR, {
body: json,
body: body,
error: error,
requestBody: (options.body || null),
requestMethod: options.method,
@ -200,12 +190,60 @@ export function fetchJson(connection, json, processFunc) {
}
}
runningTimeout.cancel();
return json;
// If we had a processFunc, it eitehr returned a T or threw above.
// The "body" is now a Uint8Array.
return body;
}
return logger.throwError("failed response", Logger.errors.SERVER_ERROR, {
requestBody: (options.body || null),
requestMethod: options.method,
url: url
});
});
})();
return Promise.race([runningTimeout.promise, runningFetch]);
}
export function fetchJson(connection, json, processFunc) {
let processJsonFunc = (value, response) => {
let result = null;
if (value != null) {
try {
result = JSON.parse(toUtf8String(value));
}
catch (error) {
logger.throwError("invalid JSON", Logger.errors.SERVER_ERROR, {
body: value,
error: error
});
}
}
if (processFunc) {
result = processFunc(result, response);
}
return result;
};
// If we have json to send, we must
// - add content-type of application/json (unless already overridden)
// - convert the json to bytes
let body = null;
if (json != null) {
body = toUtf8Bytes(json);
// Create a connection with the content-type set for JSON
const updated = (typeof (connection) === "string") ? ({ url: connection }) : connection;
if (updated.headers) {
const hasContentType = (Object.keys(updated.headers).filter((k) => (k.toLowerCase() === "content-type")).length) !== 0;
if (!hasContentType) {
updated.headers = shallowCopy(updated.headers);
updated.headers["content-type"] = "application/json";
}
}
else {
updated.headers = { "content-type": "application/json" };
}
connection = updated;
}
return fetchData(connection, body, processJsonFunc);
}
export function poll(func, options) {
if (!options) {
options = {};

File diff suppressed because one or more lines are too long

15
packages/web/lib.esm/types.d.ts vendored Normal file
View File

@ -0,0 +1,15 @@
export declare type GetUrlResponse = {
statusCode: number;
statusMessage: string;
headers: {
[key: string]: string;
};
body: Uint8Array;
};
export declare type Options = {
method?: string;
body?: Uint8Array;
headers?: {
[key: string]: string;
};
};

View File

@ -0,0 +1,2 @@
"use strict";
//# sourceMappingURL=types.js.map

View File

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

View File

@ -1 +1 @@
export declare const version = "web/5.0.2";
export declare const version = "web/5.0.3";

View File

@ -1,4 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "web/5.0.2";
exports.version = "web/5.0.3";
//# sourceMappingURL=_version.js.map

View File

@ -1,16 +1,3 @@
export declare type GetUrlResponse = {
statusCode: number;
statusMessage: string;
headers: {
[key: string]: string;
};
body: string;
};
export declare type Options = {
method?: string;
body?: string;
headers?: {
[key: string]: string;
};
};
import type { GetUrlResponse, Options } from "./types";
export { GetUrlResponse, Options };
export declare function getUrl(href: string, options?: Options): Promise<GetUrlResponse>;

View File

@ -36,6 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
}
};
Object.defineProperty(exports, "__esModule", { value: true });
var bytes_1 = require("@ethersproject/bytes");
function getUrl(href, options) {
return __awaiter(this, void 0, void 0, function () {
var request, response, body, headers;
@ -58,7 +59,7 @@ function getUrl(href, options) {
return [4 /*yield*/, fetch(href, request)];
case 1:
response = _a.sent();
return [4 /*yield*/, response.text()];
return [4 /*yield*/, response.arrayBuffer()];
case 2:
body = _a.sent();
headers = {};
@ -76,7 +77,7 @@ function getUrl(href, options) {
headers: headers,
statusCode: response.status,
statusMessage: response.statusText,
body: body,
body: bytes_1.arrayify(new Uint8Array(body)),
}];
}
});

View File

@ -1 +1 @@
{"version":3,"file":"browser-geturl.js","sourceRoot":"","sources":["../src.ts/browser-geturl.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeb,SAAsB,MAAM,CAAC,IAAY,EAAE,OAAiB;;;;;;oBACxD,IAAI,OAAO,IAAI,IAAI,EAAE;wBAAE,OAAO,GAAG,EAAG,CAAC;qBAAE;oBAEjC,OAAO,GAAG;wBACZ,MAAM,EAAE,CAAC,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BACH,OAAO,EAAE,OAAO;4BAChB,UAAU,EAAE,QAAQ,CAAC,MAAM;4BAC3B,aAAa,EAAE,QAAQ,CAAC,UAAU;4BAClC,IAAI,EAAE,gBAAQ,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;yBACvC,EAAA;;;;CACJ;AAnCD,wBAmCC"}

View File

@ -1,16 +1,3 @@
export declare type GetUrlResponse = {
statusCode: number;
statusMessage: string;
headers: {
[key: string]: string;
};
body: string;
};
export declare type Options = {
method?: string;
body?: string;
headers?: {
[key: string]: string;
};
};
import type { GetUrlResponse, Options } from "./types";
export { GetUrlResponse, Options };
export declare function getUrl(href: string, options?: Options): Promise<GetUrlResponse>;

View File

@ -42,6 +42,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var http_1 = __importDefault(require("http"));
var https_1 = __importDefault(require("https"));
var url_1 = require("url");
var bytes_1 = require("@ethersproject/bytes");
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version);
@ -61,12 +62,12 @@ function getResponse(request) {
}, {}),
body: null
};
resp.setEncoding("utf8");
//resp.setEncoding("utf8");
resp.on("data", function (chunk) {
if (response.body == null) {
response.body = "";
response.body = new Uint8Array(0);
}
response.body += chunk;
response.body = bytes_1.concat([response.body, chunk]);
});
resp.on("end", function () {
resolve(response);
@ -121,7 +122,7 @@ function getUrl(href, options) {
});
}
if (options.body) {
req.write(options.body);
req.write(Buffer.from(options.body));
}
req.end();
return [4 /*yield*/, getResponse(req)];

View File

@ -1 +1 @@
{"version":3,"file":"geturl.js","sourceRoot":"","sources":["../src.ts/geturl.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,8CAAwB;AACxB,gDAA0B;AAC1B,2BAA2B;AAE3B,gDAA+C;AAC/C,uCAAqC;AACrC,IAAM,MAAM,GAAG,IAAI,eAAM,CAAC,kBAAO,CAAC,CAAC;AAen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AAA;;oBAAjC,QAAQ,GAAG,SAAsB;oBACvC,sBAAO,QAAQ,EAAC;;;;CACnB;AAzCD,wBAyCC"}

View File

@ -32,5 +32,6 @@ export declare type FetchJsonResponse = {
[header: string]: string;
};
};
export declare function fetchData<T = Uint8Array>(connection: string | ConnectionInfo, body?: Uint8Array, processFunc?: (value: Uint8Array, response: FetchJsonResponse) => T): Promise<T>;
export declare function fetchJson(connection: string | ConnectionInfo, json?: string, processFunc?: (value: any, response: FetchJsonResponse) => any): Promise<any>;
export declare function poll<T>(func: () => Promise<T>, options?: PollOptions): Promise<T>;

View File

@ -48,7 +48,7 @@ function staller(duration) {
setTimeout(resolve, duration);
});
}
function fetchJson(connection, json, processFunc) {
function fetchData(connection, body, processFunc) {
// How many times to retry in the event of a throttle
var attemptLimit = (typeof (connection) === "object" && connection.throttleLimit != null) ? connection.throttleLimit : 12;
logger.assertArgument((attemptLimit > 0 && (attemptLimit % 1) === 0), "invalid connection throttle limit", "connection.throttleLimit", attemptLimit);
@ -93,10 +93,12 @@ function fetchJson(connection, json, processFunc) {
};
}
}
if (json) {
if (body) {
options.method = "POST";
options.body = json;
headers["content-type"] = { key: "Content-Type", value: "application/json" };
options.body = body;
if (headers["content-type"] == null) {
headers["content-type"] = { key: "Content-Type", value: "application/octet-stream" };
}
}
var flatHeaders = {};
Object.keys(headers).forEach(function (key) {
@ -133,7 +135,7 @@ function fetchJson(connection, json, processFunc) {
})();
var runningFetch = (function () {
return __awaiter(this, void 0, void 0, function () {
var attempt, response, tryAgain, stall, retryAfter, error_1, body, json_1, error_2, tryAgain, timeout_1;
var attempt, response, tryAgain, stall, retryAfter, error_1, body_1, result, error_2, tryAgain, timeout_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
@ -165,8 +167,10 @@ function fetchJson(connection, json, processFunc) {
else {
stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt)));
}
//console.log("Stalling 429");
return [4 /*yield*/, staller(stall)];
case 6:
//console.log("Stalling 429");
_a.sent();
return [3 /*break*/, 18];
case 7: return [3 /*break*/, 9];
@ -184,45 +188,30 @@ function fetchJson(connection, json, processFunc) {
}
return [3 /*break*/, 9];
case 9:
body = response.body;
body_1 = response.body;
if (allow304 && response.statusCode === 304) {
body = null;
body_1 = null;
}
else if (response.statusCode < 200 || response.statusCode >= 300) {
runningTimeout.cancel();
logger.throwError("bad response", logger_1.Logger.errors.SERVER_ERROR, {
status: response.statusCode,
headers: response.headers,
body: body,
body: body_1,
requestBody: (options.body || null),
requestMethod: options.method,
url: url
});
}
json_1 = null;
if (body != null) {
try {
json_1 = JSON.parse(body);
}
catch (error) {
runningTimeout.cancel();
logger.throwError("invalid JSON", logger_1.Logger.errors.SERVER_ERROR, {
body: body,
error: error,
requestBody: (options.body || null),
requestMethod: options.method,
url: url
});
}
}
if (!processFunc) return [3 /*break*/, 17];
_a.label = 10;
case 10:
_a.trys.push([10, 12, , 17]);
return [4 /*yield*/, processFunc(json_1, response)];
return [4 /*yield*/, processFunc(body_1, response)];
case 11:
json_1 = _a.sent();
return [3 /*break*/, 17];
result = _a.sent();
runningTimeout.cancel();
return [2 /*return*/, result];
case 12:
error_2 = _a.sent();
if (!(error_2.throttleRetry && attempt < attemptLimit)) return [3 /*break*/, 16];
@ -235,14 +224,16 @@ function fetchJson(connection, json, processFunc) {
case 14:
if (!tryAgain) return [3 /*break*/, 16];
timeout_1 = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt)));
//console.log("Stalling callback");
return [4 /*yield*/, staller(timeout_1)];
case 15:
//console.log("Stalling callback");
_a.sent();
return [3 /*break*/, 18];
case 16:
runningTimeout.cancel();
logger.throwError("processing response error", logger_1.Logger.errors.SERVER_ERROR, {
body: json_1,
body: body_1,
error: error_2,
requestBody: (options.body || null),
requestMethod: options.method,
@ -251,17 +242,65 @@ function fetchJson(connection, json, processFunc) {
return [3 /*break*/, 17];
case 17:
runningTimeout.cancel();
return [2 /*return*/, json_1];
// If we had a processFunc, it eitehr returned a T or threw above.
// The "body" is now a Uint8Array.
return [2 /*return*/, body_1];
case 18:
attempt++;
return [3 /*break*/, 1];
case 19: return [2 /*return*/];
case 19: return [2 /*return*/, logger.throwError("failed response", logger_1.Logger.errors.SERVER_ERROR, {
requestBody: (options.body || null),
requestMethod: options.method,
url: url
})];
}
});
});
})();
return Promise.race([runningTimeout.promise, runningFetch]);
}
exports.fetchData = fetchData;
function fetchJson(connection, json, processFunc) {
var processJsonFunc = function (value, response) {
var result = null;
if (value != null) {
try {
result = JSON.parse(strings_1.toUtf8String(value));
}
catch (error) {
logger.throwError("invalid JSON", logger_1.Logger.errors.SERVER_ERROR, {
body: value,
error: error
});
}
}
if (processFunc) {
result = processFunc(result, response);
}
return result;
};
// If we have json to send, we must
// - add content-type of application/json (unless already overridden)
// - convert the json to bytes
var body = null;
if (json != null) {
body = strings_1.toUtf8Bytes(json);
// Create a connection with the content-type set for JSON
var updated = (typeof (connection) === "string") ? ({ url: connection }) : connection;
if (updated.headers) {
var hasContentType = (Object.keys(updated.headers).filter(function (k) { return (k.toLowerCase() === "content-type"); }).length) !== 0;
if (!hasContentType) {
updated.headers = properties_1.shallowCopy(updated.headers);
updated.headers["content-type"] = "application/json";
}
}
else {
updated.headers = { "content-type": "application/json" };
}
connection = updated;
}
return fetchData(connection, body, processJsonFunc);
}
exports.fetchJson = fetchJson;
function poll(func, options) {
if (!options) {

File diff suppressed because one or more lines are too long

15
packages/web/lib/types.d.ts vendored Normal file
View File

@ -0,0 +1,15 @@
export declare type GetUrlResponse = {
statusCode: number;
statusMessage: string;
headers: {
[key: string]: string;
};
body: Uint8Array;
};
export declare type Options = {
method?: string;
body?: Uint8Array;
headers?: {
[key: string]: string;
};
};

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

View File

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

View File

@ -11,6 +11,7 @@
},
"dependencies": {
"@ethersproject/base64": "^5.0.0",
"@ethersproject/bytes": "^5.0.0",
"@ethersproject/logger": "^5.0.0",
"@ethersproject/properties": "^5.0.0",
"@ethersproject/strings": "^5.0.0"
@ -35,7 +36,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x706e9cf2a72162332269c71f0e1c5ca6dbaa252e627710ed676fd342dbe89e40",
"tarballHash": "0x2aaeadaeffd9b91cc53a54957aef410745a16c20af755cb66e5d188d2be8a814",
"types": "./lib/index.d.ts",
"version": "5.0.2"
"version": "5.0.3"
}

View File

@ -1 +1 @@
export const version = "web/5.0.2";
export const version = "web/5.0.3";