admin: updated dist files
This commit is contained in:
parent
7c37182d03
commit
7acee913e5
731
dist/ethers.js
vendored
731
dist/ethers.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/ethers.js.map
vendored
2
dist/ethers.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/ethers.min.js
vendored
2
dist/ethers.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/wordlists-extra.js
vendored
2
dist/wordlists-extra.js
vendored
@ -145,7 +145,7 @@ const u64 = {
|
|||||||
add, add3L, add3H, add4L, add4H, add5H, add5L,
|
add, add3L, add3H, add4L, add4H, add5H, add5L,
|
||||||
};
|
};
|
||||||
|
|
||||||
const version = "6.0.0-beta-exports.15";
|
const version = "6.0.0-beta-exports.16";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property helper functions.
|
* Property helper functions.
|
||||||
|
2
dist/wordlists-extra.js.map
vendored
2
dist/wordlists-extra.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/wordlists-extra.min.js
vendored
2
dist/wordlists-extra.min.js
vendored
File diff suppressed because one or more lines are too long
@ -50,21 +50,13 @@ const ProviderCreators = [
|
|||||||
return index_js_1.InfuraProvider.getWebSocketProvider(network, "49a0efa3aaee4fd99797bfa94d8ce2f1");
|
return index_js_1.InfuraProvider.getWebSocketProvider(network, "49a0efa3aaee4fd99797bfa94d8ce2f1");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
{
|
{
|
||||||
name: "PocketProvider",
|
name: "PocketProvider",
|
||||||
networks: ethNetworks,
|
networks: ethNetworks,
|
||||||
create: function(network: string) {
|
create: function (network) {
|
||||||
const apiKeys: Record<string, string> = {
|
return new index_js_1.PocketProvider(network);
|
||||||
mainnet: "6004bcd10040261633ade990",
|
|
||||||
ropsten: "6004bd4d0040261633ade991",
|
|
||||||
rinkeby: "6004bda20040261633ade994",
|
|
||||||
goerli: "6004bd860040261633ade992",
|
|
||||||
};
|
|
||||||
return new PocketProvider(network, apiKeys[network]);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
name: "QuickNodeProvider",
|
name: "QuickNodeProvider",
|
||||||
networks: ethNetworks,
|
networks: ethNetworks,
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"create-provider.js","sourceRoot":"","sources":["../../src.ts/_tests/create-provider.ts"],"names":[],"mappings":";;;AAAA,0CAWqB;AAQpB,CAAC;AAEF,MAAM,WAAW,GAAG,CAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAE,CAAC;AACvD,gDAAgD;AAEhD,MAAM,gBAAgB,GAA2B;IAC7C;QACI,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,UAAS,OAAe;YAC5B,OAAO,IAAI,0BAAe,CAAC,OAAO,EAAE,kCAAkC,CAAC,CAAC;QAC5E,CAAC;KACJ;IACD;QACI,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAE,OAAO,EAAE,UAAU,CAAE,CAAC;QACrD,MAAM,EAAE,UAAS,OAAe;YAC5B,OAAO,IAAI,uBAAY,CAAC,OAAO,CAAC,CAAC;QACrC,CAAC;KACJ;IACD;;;;;;;;MAQE;IACF;QACI,IAAI,EAAE,mBAAmB;QACzB,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,UAAS,OAAe;YAC5B,OAAO,IAAI,4BAAiB,CAAC,OAAO,EAAE,oCAAoC,CAAC,CAAC;QAChF,CAAC;KACJ;IACD;QACI,IAAI,EAAE,gBAAgB;QACtB,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,UAAS,OAAe;YAC5B,OAAO,IAAI,yBAAc,CAAC,OAAO,EAAE,kCAAkC,CAAC,CAAC;QAC3E,CAAC;KACJ;IACD;QACI,IAAI,EAAE,yBAAyB;QAC/B,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,UAAS,OAAe;YAC5B,OAAO,yBAAc,CA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AC,CAAC,CAAC,CAAC,CAAC;aAC/C;YACD,OAAO,QAAQ,CAAC;SACnB;KACJ;IAAC,OAAO,KAAK,EAAE;QACZ,IAAI,CAAC,IAAA,kBAAO,EAAC,KAAK,EAAE,kBAAkB,CAAC,EAAE;YAAE,MAAM,KAAK,CAAC;SAAE;KAC5D;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAhBD,kCAgBC;AAED,SAAgB,aAAa,CAAC,QAAgB,EAAE,OAAe;IAC3D,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IACrC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;AAC7B,CAAC;AAHD,sCAGC;AAED,SAAgB,OAAO,CAAC,OAAe;IACnC,MAAM,QAAQ,GAAG,WAAW,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACxD,IAAI,QAAQ,IAAI,IAAI,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,wBAAyB,OAAQ,EAAE,CAAC,CAAC;KAAE;IAC/E,OAAO,QAAQ,CAAC;AACpB,CAAC;AAJD,0BAIC"}
|
@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const assert_1 = __importDefault(require("assert"));
|
const assert_1 = __importDefault(require("assert"));
|
||||||
const create_provider_js_1 = require("./create-provider.js");
|
const create_provider_js_1 = require("./create-provider.js");
|
||||||
|
(0, create_provider_js_1.setupProviders)();
|
||||||
describe("Resolve ENS avatar", function () {
|
describe("Resolve ENS avatar", function () {
|
||||||
[
|
[
|
||||||
{ title: "data", name: "data-avatar.tests.ethers.eth", value: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAMAAACeL25MAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyVpVFh0WE1MOmNvbS5hZG9iZS54bXAAAA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;QACnD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACP;;;;;;;;;;;;;MAaE;AACF,CAAC,CAAC,CAAC"}
|
{"version":3,"file":"test-providers-avatar.js","sourceRoot":"","sources":["../../src.ts/_tests/test-providers-avatar.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,6DAA+D;AAE/D,IAAA,mCAAc,GAAE,CAAC;AAEjB,QAAQ,CAAC,oBAAoB,EAAE;IAC3B;QACI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B,EAAE,KAAK,EAAE,owCAAowC,EAAE;QACp0C,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B,EAAE,KAAK,EAAE,8EAA8E,EAAE;QAC9I,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,6BAA6B,EAAE,KAAK,EAAE,qCAAqC,EAAE;KACtG,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACf,EAAE,CAAC,uBAAwB,IAAI,CAAC,KAAM,EAAE,EAAE,KAAK;YAC3C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,QAAQ,GAAG,IAAA,4BAAO,EAAC,QAAQ,CAAC,CAAC;YACnC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnD,gBAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACP;;;;;;;;;;;;;MAaE;AACF,CAAC,CAAC,CAAC"}
|
@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||||||
const assert_1 = __importDefault(require("assert"));
|
const assert_1 = __importDefault(require("assert"));
|
||||||
const index_js_1 = require("../index.js");
|
const index_js_1 = require("../index.js");
|
||||||
const create_provider_js_1 = require("./create-provider.js");
|
const create_provider_js_1 = require("./create-provider.js");
|
||||||
|
(0, create_provider_js_1.setupProviders)();
|
||||||
describe("Test CCIP execution", function () {
|
describe("Test CCIP execution", function () {
|
||||||
// This matches the verify method in the Solidity contract against the
|
// This matches the verify method in the Solidity contract against the
|
||||||
// processed data from the endpoint
|
// processed data from the endpoint
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"test-providers-ccip.js","sourceRoot":"","sources":["../../src.ts/_tests/test-providers-ccip.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAKqB;AAErB,6DAA+C;AAE/C,QAAQ,CAAC,qBAAqB,EAAE;IAE5B,sEAAsE;IACtE,mCAAmC;IACnC,MAAM,MAAM,GAAG,UAAS,MAAc,EAAE,IAAY,EAAE,MAAc;QAChE,MAAM,KAAK,GAAG,IAAA,iBAAM,EAAC;YACjB,IAAA,oBAAS,EAAC,IAAA,qBAAU,EAAC,MAAM,CAAC,CAAC,EAAE,MAAM;YACrC,IAAA,oBAAS,EAAC,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC,EAAE,IAAI;SACpC,CAAC,CAAC;QACH,gBAAM,CAAC,KAAK,CAAC,MAAM,EAAE,IAAA,oBAAS,EAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC,CAAC;IAChE,CAAC,CAAA;IAED,MAAM,OAAO,GAAG,4CAA4C,CAAC;IAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC;IAE1B,EAAE,CAAC,uCAAuC,EAAE,KAAK;QAC7C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAEpB,MAAM,QAAQ,GAAG,IAAA,4BAAO,EAAC,QAAQ,CAAC,CAAC;QAEnC,qCAAqC;QACrC,MAAM,EAAE,GAAG;YACP,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI;YACjC,IAAI,EAAE,4MAA4M;SACrN,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAA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EAAE,OAAO,EAAE,cAAc,EAAE,IAAI;YACjC,IAAI,EAAE,4MAA4M;SACrN,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,KAAK;QAC9C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAEpB,MAAM,QAAQ,GAAG,IAAA,4BAAO,EAAC,QAAQ,CAAC,CAAC;QAEnC,sCAAsC;QACtC,MAAM,EAAE,GAAG;YACP,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI;YACjC,IAAI,EAAE,4MAA4M;SACrN,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAA"}
|
@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const assert_1 = __importDefault(require("assert"));
|
const assert_1 = __importDefault(require("assert"));
|
||||||
const create_provider_js_1 = require("./create-provider.js");
|
const create_provider_js_1 = require("./create-provider.js");
|
||||||
|
(0, create_provider_js_1.setupProviders)();
|
||||||
describe("Test EIP-2544 ENS wildcards", function () {
|
describe("Test EIP-2544 ENS wildcards", function () {
|
||||||
const provider = (0, create_provider_js_1.connect)("goerli");
|
const provider = (0, create_provider_js_1.connect)("goerli");
|
||||||
it("Resolves recursively", async function () {
|
it("Resolves recursively", async function () {
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"test-providers-wildcard.js","sourceRoot":"","sources":["../../src.ts/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wBAAwB,CAAC,CAAC;QAE9C,gBAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,4CAA4C,EAAE,SAAS,CAAC,CAAC;QACxF,gBAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,oBAAoB,CAAC,CAAC;QAE5E,2BAA2B;QAC3B,gBAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,SAAS,EAAE,EAAE,6DAA6D,EAAE,aAAa,CAAC,CAAC;QAEvH,gBAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,UAAU,EAAE,EAAE,4CAA4C,EAAE,cAAc,CAAC,CAAC;IAC5G,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
@ -1,5 +1,5 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.version = void 0;
|
exports.version = void 0;
|
||||||
exports.version = "6.0.0-beta-exports.15";
|
exports.version = "6.0.0-beta-exports.16";
|
||||||
//# sourceMappingURL=_version.js.map
|
//# sourceMappingURL=_version.js.map
|
@ -904,6 +904,11 @@ class EventFragment extends NamedFragment {
|
|||||||
}
|
}
|
||||||
return result.join(" ");
|
return result.join(" ");
|
||||||
}
|
}
|
||||||
|
static getTopicHash(name, params) {
|
||||||
|
params = (params || []).map((p) => ParamType.from(p));
|
||||||
|
const fragment = new EventFragment(_guard, name, params, false);
|
||||||
|
return fragment.topicHash;
|
||||||
|
}
|
||||||
static from(obj) {
|
static from(obj) {
|
||||||
if (EventFragment.isFragment(obj)) {
|
if (EventFragment.isFragment(obj)) {
|
||||||
return obj;
|
return obj;
|
||||||
@ -1130,6 +1135,11 @@ class FunctionFragment extends NamedFragment {
|
|||||||
}
|
}
|
||||||
return result.join(" ");
|
return result.join(" ");
|
||||||
}
|
}
|
||||||
|
static getSelector(name, params) {
|
||||||
|
params = (params || []).map((p) => ParamType.from(p));
|
||||||
|
const fragment = new FunctionFragment(_guard, name, "view", params, [], null);
|
||||||
|
return fragment.selector;
|
||||||
|
}
|
||||||
static from(obj) {
|
static from(obj) {
|
||||||
if (FunctionFragment.isFragment(obj)) {
|
if (FunctionFragment.isFragment(obj)) {
|
||||||
return obj;
|
return obj;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -3,9 +3,9 @@
|
|||||||
//
|
//
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.lock = exports.scryptSync = exports.scrypt = exports.pbkdf2 = exports.sha512 = exports.sha256 = exports.ripemd160 = exports.keccak256 = exports.randomBytes = exports.computeHmac = exports.EventLog = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.ContractEventPayload = exports.ContractFactory = exports.Contract = exports.BaseContract = exports.MessagePrefix = exports.EtherSymbol = exports.ZeroHash = exports.N = exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.ZeroAddress = exports.resolveAddress = exports.isAddress = exports.isAddressable = exports.getCreate2Address = exports.getCreateAddress = exports.getIcapAddress = exports.getAddress = exports.Typed = exports.TransactionDescription = exports.Result = exports.LogDescription = exports.Interface = exports.Indexed = exports.checkResultErrors = exports.ParamType = exports.FunctionFragment = exports.Fragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.AbiCoder = exports.encodeBytes32String = exports.decodeBytes32String = exports.version = void 0;
|
exports.lock = exports.scryptSync = exports.scrypt = exports.pbkdf2 = exports.sha512 = exports.sha256 = exports.ripemd160 = exports.keccak256 = exports.randomBytes = exports.computeHmac = exports.EventLog = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.ContractEventPayload = exports.ContractFactory = exports.Contract = exports.BaseContract = exports.MessagePrefix = exports.EtherSymbol = exports.ZeroHash = exports.N = exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.ZeroAddress = exports.resolveAddress = exports.isAddress = exports.isAddressable = exports.getCreate2Address = exports.getCreateAddress = exports.getIcapAddress = exports.getAddress = exports.Typed = exports.TransactionDescription = exports.Result = exports.LogDescription = exports.Interface = exports.Indexed = exports.checkResultErrors = exports.ParamType = exports.FunctionFragment = exports.Fragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.AbiCoder = exports.encodeBytes32String = exports.decodeBytes32String = exports.version = void 0;
|
||||||
exports.getBytes = exports.dataSlice = exports.dataLength = exports.concat = exports.encodeBase64 = exports.decodeBase64 = exports.encodeBase58 = exports.decodeBase58 = exports.Transaction = exports.recoverAddress = exports.computeAddress = exports.accessListify = exports.Network = exports.EnsResolver = exports.WebSocketProvider = exports.SocketProvider = exports.IpcSocketProvider = exports.QuickNodeProvider = exports.InfuraProvider = exports.EtherscanProvider = exports.CloudflareProvider = exports.AnkrProvider = exports.AlchemyProvider = exports.BrowserProvider = exports.JsonRpcSigner = exports.JsonRpcProvider = exports.JsonRpcApiProvider = exports.FallbackProvider = exports.AbstractProvider = exports.VoidSigner = exports.AbstractSigner = exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.FeeData = exports.Block = exports.getDefaultProvider = exports.TypedDataEncoder = exports.solidityPackedSha256 = exports.solidityPackedKeccak256 = exports.solidityPacked = exports.verifyMessage = exports.hashMessage = exports.dnsEncode = exports.namehash = exports.isValidName = exports.ensNormalize = exports.id = exports.SigningKey = exports.Signature = void 0;
|
exports.dataLength = exports.concat = exports.encodeBase64 = exports.decodeBase64 = exports.encodeBase58 = exports.decodeBase58 = exports.Transaction = exports.recoverAddress = exports.computeAddress = exports.accessListify = exports.Network = exports.EnsResolver = exports.WebSocketProvider = exports.SocketProvider = exports.IpcSocketProvider = exports.QuickNodeProvider = exports.PocketProvider = exports.InfuraProvider = exports.EtherscanProvider = exports.CloudflareProvider = exports.AnkrProvider = exports.AlchemyProvider = exports.BrowserProvider = exports.JsonRpcSigner = exports.JsonRpcProvider = exports.JsonRpcApiProvider = exports.FallbackProvider = exports.AbstractProvider = exports.VoidSigner = exports.NonceManager = exports.AbstractSigner = exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.FeeData = exports.Block = exports.getDefaultProvider = exports.TypedDataEncoder = exports.solidityPackedSha256 = exports.solidityPackedKeccak256 = exports.solidityPacked = exports.verifyMessage = exports.hashMessage = exports.dnsEncode = exports.namehash = exports.isValidName = exports.ensNormalize = exports.id = exports.SigningKey = exports.Signature = void 0;
|
||||||
exports.isKeystoreJson = exports.isCrowdsaleJson = exports.getAccountPath = exports.defaultPath = exports.Wallet = exports.HDNodeVoidWallet = exports.HDNodeWallet = exports.BaseWallet = exports.Mnemonic = exports.encodeRlp = exports.decodeRlp = exports.Utf8ErrorFuncs = exports.toUtf8String = exports.toUtf8CodePoints = exports.toUtf8Bytes = exports.parseUnits = exports.formatUnits = exports.parseEther = exports.formatEther = exports.mask = exports.toTwos = exports.fromTwos = exports.toQuantity = exports.toNumber = exports.toBeHex = exports.toBigInt = exports.toBeArray = exports.getUint = exports.getNumber = exports.getBigInt = exports.FixedNumber = exports.FetchCancelSignal = exports.FetchResponse = exports.FetchRequest = exports.isError = exports.isCallException = exports.makeError = exports.assertPrivate = exports.assertNormalize = exports.assertArgumentCount = exports.assertArgument = exports.assert = exports.defineProperties = exports.zeroPadValue = exports.zeroPadBytes = exports.stripZerosLeft = exports.isBytesLike = exports.isHexString = exports.hexlify = exports.getBytesCopy = void 0;
|
exports.getAccountPath = exports.defaultPath = exports.Wallet = exports.HDNodeVoidWallet = exports.HDNodeWallet = exports.BaseWallet = exports.Mnemonic = exports.encodeRlp = exports.decodeRlp = exports.Utf8ErrorFuncs = exports.toUtf8String = exports.toUtf8CodePoints = exports.toUtf8Bytes = exports.parseUnits = exports.formatUnits = exports.parseEther = exports.formatEther = exports.mask = exports.toTwos = exports.fromTwos = exports.toQuantity = exports.toNumber = exports.toBeHex = exports.toBigInt = exports.toBeArray = exports.getUint = exports.getNumber = exports.getBigInt = exports.FixedNumber = exports.FetchCancelSignal = exports.FetchResponse = exports.FetchRequest = exports.isError = exports.isCallException = exports.makeError = exports.assertPrivate = exports.assertNormalize = exports.assertArgumentCount = exports.assertArgument = exports.assert = exports.defineProperties = exports.zeroPadValue = exports.zeroPadBytes = exports.stripZerosLeft = exports.isBytesLike = exports.isHexString = exports.hexlify = exports.getBytesCopy = exports.getBytes = exports.dataSlice = void 0;
|
||||||
exports.WordlistOwlA = exports.WordlistOwl = exports.LangEn = exports.Wordlist = exports.encryptKeystoreJsonSync = exports.encryptKeystoreJson = exports.decryptKeystoreJson = exports.decryptKeystoreJsonSync = exports.decryptCrowdsaleJson = void 0;
|
exports.WordlistOwlA = exports.WordlistOwl = exports.LangEn = exports.Wordlist = exports.encryptKeystoreJsonSync = exports.encryptKeystoreJson = exports.decryptKeystoreJson = exports.decryptKeystoreJsonSync = exports.decryptCrowdsaleJson = exports.isKeystoreJson = exports.isCrowdsaleJson = void 0;
|
||||||
var _version_js_1 = require("./_version.js");
|
var _version_js_1 = require("./_version.js");
|
||||||
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return _version_js_1.version; } });
|
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return _version_js_1.version; } });
|
||||||
var index_js_1 = require("./abi/index.js");
|
var index_js_1 = require("./abi/index.js");
|
||||||
@ -84,6 +84,7 @@ Object.defineProperty(exports, "Log", { enumerable: true, get: function () { ret
|
|||||||
Object.defineProperty(exports, "TransactionReceipt", { enumerable: true, get: function () { return index_js_7.TransactionReceipt; } });
|
Object.defineProperty(exports, "TransactionReceipt", { enumerable: true, get: function () { return index_js_7.TransactionReceipt; } });
|
||||||
Object.defineProperty(exports, "TransactionResponse", { enumerable: true, get: function () { return index_js_7.TransactionResponse; } });
|
Object.defineProperty(exports, "TransactionResponse", { enumerable: true, get: function () { return index_js_7.TransactionResponse; } });
|
||||||
Object.defineProperty(exports, "AbstractSigner", { enumerable: true, get: function () { return index_js_7.AbstractSigner; } });
|
Object.defineProperty(exports, "AbstractSigner", { enumerable: true, get: function () { return index_js_7.AbstractSigner; } });
|
||||||
|
Object.defineProperty(exports, "NonceManager", { enumerable: true, get: function () { return index_js_7.NonceManager; } });
|
||||||
Object.defineProperty(exports, "VoidSigner", { enumerable: true, get: function () { return index_js_7.VoidSigner; } });
|
Object.defineProperty(exports, "VoidSigner", { enumerable: true, get: function () { return index_js_7.VoidSigner; } });
|
||||||
Object.defineProperty(exports, "AbstractProvider", { enumerable: true, get: function () { return index_js_7.AbstractProvider; } });
|
Object.defineProperty(exports, "AbstractProvider", { enumerable: true, get: function () { return index_js_7.AbstractProvider; } });
|
||||||
Object.defineProperty(exports, "FallbackProvider", { enumerable: true, get: function () { return index_js_7.FallbackProvider; } });
|
Object.defineProperty(exports, "FallbackProvider", { enumerable: true, get: function () { return index_js_7.FallbackProvider; } });
|
||||||
@ -96,8 +97,8 @@ Object.defineProperty(exports, "AnkrProvider", { enumerable: true, get: function
|
|||||||
Object.defineProperty(exports, "CloudflareProvider", { enumerable: true, get: function () { return index_js_7.CloudflareProvider; } });
|
Object.defineProperty(exports, "CloudflareProvider", { enumerable: true, get: function () { return index_js_7.CloudflareProvider; } });
|
||||||
Object.defineProperty(exports, "EtherscanProvider", { enumerable: true, get: function () { return index_js_7.EtherscanProvider; } });
|
Object.defineProperty(exports, "EtherscanProvider", { enumerable: true, get: function () { return index_js_7.EtherscanProvider; } });
|
||||||
Object.defineProperty(exports, "InfuraProvider", { enumerable: true, get: function () { return index_js_7.InfuraProvider; } });
|
Object.defineProperty(exports, "InfuraProvider", { enumerable: true, get: function () { return index_js_7.InfuraProvider; } });
|
||||||
|
Object.defineProperty(exports, "PocketProvider", { enumerable: true, get: function () { return index_js_7.PocketProvider; } });
|
||||||
Object.defineProperty(exports, "QuickNodeProvider", { enumerable: true, get: function () { return index_js_7.QuickNodeProvider; } });
|
Object.defineProperty(exports, "QuickNodeProvider", { enumerable: true, get: function () { return index_js_7.QuickNodeProvider; } });
|
||||||
//PocketProvider } from "./provider-pocket.js";
|
|
||||||
Object.defineProperty(exports, "IpcSocketProvider", { enumerable: true, get: function () { return index_js_7.IpcSocketProvider; } });
|
Object.defineProperty(exports, "IpcSocketProvider", { enumerable: true, get: function () { return index_js_7.IpcSocketProvider; } });
|
||||||
Object.defineProperty(exports, "SocketProvider", { enumerable: true, get: function () { return index_js_7.SocketProvider; } });
|
Object.defineProperty(exports, "SocketProvider", { enumerable: true, get: function () { return index_js_7.SocketProvider; } });
|
||||||
Object.defineProperty(exports, "WebSocketProvider", { enumerable: true, get: function () { return index_js_7.WebSocketProvider; } });
|
Object.defineProperty(exports, "WebSocketProvider", { enumerable: true, get: function () { return index_js_7.WebSocketProvider; } });
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"ethers.js","sourceRoot":"","sources":["../src.ts/ethers.ts"],"names":[],"mappings":";AAEA,6BAA6B;AAC7B,EAAE;;;;;;AAEF,6CAAwC;AAA/B,sGAAA,OAAO,OAAA;AAEhB,2CAQwB;AAPpB,+GAAA,mBAAmB,OAAA;AAAE,+GAAA,mBAAmB,OAAA;AAExC,oGAAA,QAAQ,OAAA;AACR,+GAAA,mBAAmB,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,qGAAA,SAAS,OAAA;AAExF,6GAAA,iBAAiB,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,0GAAA,cAAc,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,kHAAA,sBAAsB,OAAA;AACrF,iGAAA,KAAK,OAAA;AAGT,+CAI4B;AAHxB,sGAAA,UAAU,OAAA;AAAE,0GAAA,cAAc,OAAA;AAC1B,4GAAA,gBAAgB,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AACnC,yGAAA,aAAa,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,0GAAA,cA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AAA;AAAE,sGAAA,UAAU,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,sGAAA,UAAU,OAAA;AAChD,uGAAA,WAAW,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,wGAAA,YAAY,OAAA;AAC3C,0GAAA,cAAc,OAAA;AACd,qGAAA,SAAS,OAAA;AAAE,qGAAA,SAAS,OAAA;AAGxB,+CAY2B;AAXvB,qGAAA,QAAQ,OAAA;AACR,uGAAA,UAAU,OAAA;AAAE,yGAAA,YAAY,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAC1C,mGAAA,MAAM,OAAA;AAEN,wGAAA,WAAW,OAAA;AAEX,2GAAA,cAAc,OAAA;AACd,4GAAA,eAAe,OAAA;AAAE,2GAAA,cAAc,OAAA;AAE/B,iHAAA,oBAAoB,OAAA;AAAE,oHAAA,uBAAuB,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAClE,gHAAA,mBAAmB,OAAA;AAAE,oHAAA,uBAAuB,OAAA;AAGhD,kDAE8B;AAD1B,qGAAA,QAAQ,OAAA;AAAE,mGAAA,MAAM,OAAA;AAAE,wGAAA,WAAW,OAAA;AAAE,yGAAA,YAAY,OAAA"}
|
@ -14,8 +14,11 @@ exports.AbstractProvider = exports.UnmanagedSubscriber = void 0;
|
|||||||
// migrate the listener to the static event. We also need to maintain a map
|
// migrate the listener to the static event. We also need to maintain a map
|
||||||
// of Signer/ENS name to address so we can sync respond to listenerCount.
|
// of Signer/ENS name to address so we can sync respond to listenerCount.
|
||||||
const index_js_1 = require("../address/index.js");
|
const index_js_1 = require("../address/index.js");
|
||||||
const index_js_2 = require("../transaction/index.js");
|
const index_js_2 = require("../constants/index.js");
|
||||||
const index_js_3 = require("../utils/index.js");
|
const index_js_3 = require("../contract/index.js");
|
||||||
|
const index_js_4 = require("../hash/index.js");
|
||||||
|
const index_js_5 = require("../transaction/index.js");
|
||||||
|
const index_js_6 = require("../utils/index.js");
|
||||||
const ens_resolver_js_1 = require("./ens-resolver.js");
|
const ens_resolver_js_1 = require("./ens-resolver.js");
|
||||||
const format_js_1 = require("./format.js");
|
const format_js_1 = require("./format.js");
|
||||||
const network_js_1 = require("./network.js");
|
const network_js_1 = require("./network.js");
|
||||||
@ -52,7 +55,7 @@ function getTag(prefix, value) {
|
|||||||
}
|
}
|
||||||
class UnmanagedSubscriber {
|
class UnmanagedSubscriber {
|
||||||
name;
|
name;
|
||||||
constructor(name) { (0, index_js_3.defineProperties)(this, { name }); }
|
constructor(name) { (0, index_js_6.defineProperties)(this, { name }); }
|
||||||
start() { }
|
start() { }
|
||||||
stop() { }
|
stop() { }
|
||||||
pause(dropWhilePaused) { }
|
pause(dropWhilePaused) { }
|
||||||
@ -85,7 +88,7 @@ async function getSubscription(_event, provider) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((0, index_js_3.isHexString)(_event, 32)) {
|
if ((0, index_js_6.isHexString)(_event, 32)) {
|
||||||
const hash = _event.toLowerCase();
|
const hash = _event.toLowerCase();
|
||||||
return { type: "transaction", tag: getTag("tx", { hash }), hash };
|
return { type: "transaction", tag: getTag("tx", { hash }), hash };
|
||||||
}
|
}
|
||||||
@ -111,7 +114,7 @@ async function getSubscription(_event, provider) {
|
|||||||
const addresses = [];
|
const addresses = [];
|
||||||
const promises = [];
|
const promises = [];
|
||||||
const addAddress = (addr) => {
|
const addAddress = (addr) => {
|
||||||
if ((0, index_js_3.isHexString)(addr)) {
|
if ((0, index_js_6.isHexString)(addr)) {
|
||||||
addresses.push(addr);
|
addresses.push(addr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -133,7 +136,7 @@ async function getSubscription(_event, provider) {
|
|||||||
}
|
}
|
||||||
return { filter, tag: getTag("event", filter), type: "event" };
|
return { filter, tag: getTag("event", filter), type: "event" };
|
||||||
}
|
}
|
||||||
(0, index_js_3.assertArgument)(false, "unknown ProviderEvent", "event", _event);
|
(0, index_js_6.assertArgument)(false, "unknown ProviderEvent", "event", _event);
|
||||||
}
|
}
|
||||||
function getTime() { return (new Date()).getTime(); }
|
function getTime() { return (new Date()).getTime(); }
|
||||||
class AbstractProvider {
|
class AbstractProvider {
|
||||||
@ -171,7 +174,7 @@ class AbstractProvider {
|
|||||||
this.#subs = new Map();
|
this.#subs = new Map();
|
||||||
this.#plugins = new Map();
|
this.#plugins = new Map();
|
||||||
this.#pausedState = null;
|
this.#pausedState = null;
|
||||||
this.#nextTimer = 0;
|
this.#nextTimer = 1;
|
||||||
this.#timers = new Map();
|
this.#timers = new Map();
|
||||||
this.#disableCcipRead = false;
|
this.#disableCcipRead = false;
|
||||||
}
|
}
|
||||||
@ -224,7 +227,7 @@ class AbstractProvider {
|
|||||||
// value.status = response.statusCode;
|
// value.status = response.statusCode;
|
||||||
// return value;
|
// return value;
|
||||||
//});
|
//});
|
||||||
const request = new index_js_3.FetchRequest(href);
|
const request = new index_js_6.FetchRequest(href);
|
||||||
if (url.indexOf("{data}") === -1) {
|
if (url.indexOf("{data}") === -1) {
|
||||||
request.body = { data, sender };
|
request.body = { data, sender };
|
||||||
}
|
}
|
||||||
@ -244,11 +247,11 @@ class AbstractProvider {
|
|||||||
}
|
}
|
||||||
catch (error) { }
|
catch (error) { }
|
||||||
// 4xx indicates the result is not present; stop
|
// 4xx indicates the result is not present; stop
|
||||||
(0, index_js_3.assert)(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${errorMessage}`, "OFFCHAIN_FAULT", { reason: "404_MISSING_RESOURCE", transaction: tx, info: { url, errorMessage } });
|
(0, index_js_6.assert)(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${errorMessage}`, "OFFCHAIN_FAULT", { reason: "404_MISSING_RESOURCE", transaction: tx, info: { url, errorMessage } });
|
||||||
// 5xx indicates server issue; try the next url
|
// 5xx indicates server issue; try the next url
|
||||||
errorMessages.push(errorMessage);
|
errorMessages.push(errorMessage);
|
||||||
}
|
}
|
||||||
(0, index_js_3.assert)(false, `error encountered during CCIP fetch: ${errorMessages.map((m) => JSON.stringify(m)).join(", ")}`, "OFFCHAIN_FAULT", {
|
(0, index_js_6.assert)(false, `error encountered during CCIP fetch: ${errorMessages.map((m) => JSON.stringify(m)).join(", ")}`, "OFFCHAIN_FAULT", {
|
||||||
reason: "500_SERVER_ERROR",
|
reason: "500_SERVER_ERROR",
|
||||||
transaction: tx, info: { urls, errorMessages }
|
transaction: tx, info: { urls, errorMessages }
|
||||||
});
|
});
|
||||||
@ -266,21 +269,21 @@ class AbstractProvider {
|
|||||||
return new provider_js_1.TransactionResponse(tx, this);
|
return new provider_js_1.TransactionResponse(tx, this);
|
||||||
}
|
}
|
||||||
_detectNetwork() {
|
_detectNetwork() {
|
||||||
(0, index_js_3.assert)(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", {
|
(0, index_js_6.assert)(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", {
|
||||||
operation: "_detectNetwork"
|
operation: "_detectNetwork"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Sub-classes should override this and handle PerformActionRequest requests, calling
|
// Sub-classes should override this and handle PerformActionRequest requests, calling
|
||||||
// the super for any unhandled actions.
|
// the super for any unhandled actions.
|
||||||
async _perform(req) {
|
async _perform(req) {
|
||||||
(0, index_js_3.assert)(false, `unsupported method: ${req.method}`, "UNSUPPORTED_OPERATION", {
|
(0, index_js_6.assert)(false, `unsupported method: ${req.method}`, "UNSUPPORTED_OPERATION", {
|
||||||
operation: req.method,
|
operation: req.method,
|
||||||
info: req
|
info: req
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// State
|
// State
|
||||||
async getBlockNumber() {
|
async getBlockNumber() {
|
||||||
const blockNumber = (0, index_js_3.getNumber)(await this.#perform({ method: "getBlockNumber" }), "%response");
|
const blockNumber = (0, index_js_6.getNumber)(await this.#perform({ method: "getBlockNumber" }), "%response");
|
||||||
if (this.#lastBlockNumber >= 0) {
|
if (this.#lastBlockNumber >= 0) {
|
||||||
this.#lastBlockNumber = blockNumber;
|
this.#lastBlockNumber = blockNumber;
|
||||||
}
|
}
|
||||||
@ -302,22 +305,22 @@ class AbstractProvider {
|
|||||||
case "finalized":
|
case "finalized":
|
||||||
return blockTag;
|
return blockTag;
|
||||||
}
|
}
|
||||||
if ((0, index_js_3.isHexString)(blockTag)) {
|
if ((0, index_js_6.isHexString)(blockTag)) {
|
||||||
if ((0, index_js_3.isHexString)(blockTag, 32)) {
|
if ((0, index_js_6.isHexString)(blockTag, 32)) {
|
||||||
return blockTag;
|
return blockTag;
|
||||||
}
|
}
|
||||||
return (0, index_js_3.toQuantity)(blockTag);
|
return (0, index_js_6.toQuantity)(blockTag);
|
||||||
}
|
}
|
||||||
if (typeof (blockTag) === "number") {
|
if (typeof (blockTag) === "number") {
|
||||||
if (blockTag >= 0) {
|
if (blockTag >= 0) {
|
||||||
return (0, index_js_3.toQuantity)(blockTag);
|
return (0, index_js_6.toQuantity)(blockTag);
|
||||||
}
|
}
|
||||||
if (this.#lastBlockNumber >= 0) {
|
if (this.#lastBlockNumber >= 0) {
|
||||||
return (0, index_js_3.toQuantity)(this.#lastBlockNumber + blockTag);
|
return (0, index_js_6.toQuantity)(this.#lastBlockNumber + blockTag);
|
||||||
}
|
}
|
||||||
return this.getBlockNumber().then((b) => (0, index_js_3.toQuantity)(b + blockTag));
|
return this.getBlockNumber().then((b) => (0, index_js_6.toQuantity)(b + blockTag));
|
||||||
}
|
}
|
||||||
(0, index_js_3.assertArgument)(false, "invalid blockTag", "blockTag", blockTag);
|
(0, index_js_6.assertArgument)(false, "invalid blockTag", "blockTag", blockTag);
|
||||||
}
|
}
|
||||||
_getFilter(filter) {
|
_getFilter(filter) {
|
||||||
// Create a canonical representation of the topics
|
// Create a canonical representation of the topics
|
||||||
@ -459,7 +462,7 @@ class AbstractProvider {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Otherwise, we do not allow changes to the underlying network
|
// Otherwise, we do not allow changes to the underlying network
|
||||||
(0, index_js_3.assert)(false, `network changed: ${expected.chainId} => ${actual.chainId} `, "NETWORK_ERROR", {
|
(0, index_js_6.assert)(false, `network changed: ${expected.chainId} => ${actual.chainId} `, "NETWORK_ERROR", {
|
||||||
event: "changed"
|
event: "changed"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -467,12 +470,12 @@ class AbstractProvider {
|
|||||||
return expected.clone();
|
return expected.clone();
|
||||||
}
|
}
|
||||||
async getFeeData() {
|
async getFeeData() {
|
||||||
const { block, gasPrice } = await (0, index_js_3.resolveProperties)({
|
const { block, gasPrice } = await (0, index_js_6.resolveProperties)({
|
||||||
block: this.getBlock("latest"),
|
block: this.getBlock("latest"),
|
||||||
gasPrice: ((async () => {
|
gasPrice: ((async () => {
|
||||||
try {
|
try {
|
||||||
const gasPrice = await this.#perform({ method: "getGasPrice" });
|
const gasPrice = await this.#perform({ method: "getGasPrice" });
|
||||||
return (0, index_js_3.getBigInt)(gasPrice, "%response");
|
return (0, index_js_6.getBigInt)(gasPrice, "%response");
|
||||||
}
|
}
|
||||||
catch (error) { }
|
catch (error) { }
|
||||||
return null;
|
return null;
|
||||||
@ -483,7 +486,7 @@ class AbstractProvider {
|
|||||||
// We may want to compute this more accurately in the future,
|
// We may want to compute this more accurately in the future,
|
||||||
// using the formula "check if the base fee is correct".
|
// using the formula "check if the base fee is correct".
|
||||||
// See: https://eips.ethereum.org/EIPS/eip-1559
|
// See: https://eips.ethereum.org/EIPS/eip-1559
|
||||||
maxPriorityFeePerGas = BigInt("1500000000");
|
maxPriorityFeePerGas = BigInt("1000000000");
|
||||||
// Allow a network to override their maximum priority fee per gas
|
// Allow a network to override their maximum priority fee per gas
|
||||||
//const priorityFeePlugin = (await this.getNetwork()).getPlugin<MaxPriorityFeePlugin>("org.ethers.plugins.max-priority-fee");
|
//const priorityFeePlugin = (await this.getNetwork()).getPlugin<MaxPriorityFeePlugin>("org.ethers.plugins.max-priority-fee");
|
||||||
//if (priorityFeePlugin) {
|
//if (priorityFeePlugin) {
|
||||||
@ -498,37 +501,37 @@ class AbstractProvider {
|
|||||||
if (isPromise(tx)) {
|
if (isPromise(tx)) {
|
||||||
tx = await tx;
|
tx = await tx;
|
||||||
}
|
}
|
||||||
return (0, index_js_3.getBigInt)(await this.#perform({
|
return (0, index_js_6.getBigInt)(await this.#perform({
|
||||||
method: "estimateGas", transaction: tx
|
method: "estimateGas", transaction: tx
|
||||||
}), "%response");
|
}), "%response");
|
||||||
}
|
}
|
||||||
async #call(tx, blockTag, attempt) {
|
async #call(tx, blockTag, attempt) {
|
||||||
(0, index_js_3.assert)(attempt < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", {
|
(0, index_js_6.assert)(attempt < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", {
|
||||||
reason: "TOO_MANY_REDIRECTS",
|
reason: "TOO_MANY_REDIRECTS",
|
||||||
transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true })
|
transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true })
|
||||||
});
|
});
|
||||||
// This came in as a PerformActionTransaction, so to/from are safe; we can cast
|
// This came in as a PerformActionTransaction, so to/from are safe; we can cast
|
||||||
const transaction = (0, provider_js_1.copyRequest)(tx);
|
const transaction = (0, provider_js_1.copyRequest)(tx);
|
||||||
try {
|
try {
|
||||||
return (0, index_js_3.hexlify)(await this._perform({ method: "call", transaction, blockTag }));
|
return (0, index_js_6.hexlify)(await this._perform({ method: "call", transaction, blockTag }));
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
// CCIP Read OffchainLookup
|
// CCIP Read OffchainLookup
|
||||||
if (!this.disableCcipRead && (0, index_js_3.isCallException)(error) && error.data && attempt >= 0 && blockTag === "latest" && transaction.to != null && (0, index_js_3.dataSlice)(error.data, 0, 4) === "0x556f1830") {
|
if (!this.disableCcipRead && (0, index_js_6.isCallException)(error) && error.data && attempt >= 0 && blockTag === "latest" && transaction.to != null && (0, index_js_6.dataSlice)(error.data, 0, 4) === "0x556f1830") {
|
||||||
const data = error.data;
|
const data = error.data;
|
||||||
const txSender = await (0, index_js_1.resolveAddress)(transaction.to, this);
|
const txSender = await (0, index_js_1.resolveAddress)(transaction.to, this);
|
||||||
// Parse the CCIP Read Arguments
|
// Parse the CCIP Read Arguments
|
||||||
let ccipArgs;
|
let ccipArgs;
|
||||||
try {
|
try {
|
||||||
ccipArgs = parseOffchainLookup((0, index_js_3.dataSlice)(error.data, 4));
|
ccipArgs = parseOffchainLookup((0, index_js_6.dataSlice)(error.data, 4));
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
(0, index_js_3.assert)(false, error.message, "OFFCHAIN_FAULT", {
|
(0, index_js_6.assert)(false, error.message, "OFFCHAIN_FAULT", {
|
||||||
reason: "BAD_DATA", transaction, info: { data }
|
reason: "BAD_DATA", transaction, info: { data }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Check the sender of the OffchainLookup matches the transaction
|
// Check the sender of the OffchainLookup matches the transaction
|
||||||
(0, index_js_3.assert)(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), "CCIP Read sender mismatch", "CALL_EXCEPTION", {
|
(0, index_js_6.assert)(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), "CCIP Read sender mismatch", "CALL_EXCEPTION", {
|
||||||
action: "call",
|
action: "call",
|
||||||
data,
|
data,
|
||||||
reason: "OffchainLookup",
|
reason: "OffchainLookup",
|
||||||
@ -541,12 +544,12 @@ class AbstractProvider {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls);
|
const ccipResult = await this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls);
|
||||||
(0, index_js_3.assert)(ccipResult != null, "CCIP Read failed to fetch data", "OFFCHAIN_FAULT", {
|
(0, index_js_6.assert)(ccipResult != null, "CCIP Read failed to fetch data", "OFFCHAIN_FAULT", {
|
||||||
reason: "FETCH_FAILED", transaction, info: { data: error.data, errorArgs: ccipArgs.errorArgs }
|
reason: "FETCH_FAILED", transaction, info: { data: error.data, errorArgs: ccipArgs.errorArgs }
|
||||||
});
|
});
|
||||||
const tx = {
|
const tx = {
|
||||||
to: txSender,
|
to: txSender,
|
||||||
data: (0, index_js_3.concat)([ccipArgs.selector, encodeBytes([ccipResult, ccipArgs.extraData])])
|
data: (0, index_js_6.concat)([ccipArgs.selector, encodeBytes([ccipResult, ccipArgs.extraData])])
|
||||||
};
|
};
|
||||||
this.emit("debug", { action: "sendCcipReadCall", transaction: tx });
|
this.emit("debug", { action: "sendCcipReadCall", transaction: tx });
|
||||||
try {
|
try {
|
||||||
@ -563,14 +566,14 @@ class AbstractProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
async #checkNetwork(promise) {
|
async #checkNetwork(promise) {
|
||||||
const { value } = await (0, index_js_3.resolveProperties)({
|
const { value } = await (0, index_js_6.resolveProperties)({
|
||||||
network: this.getNetwork(),
|
network: this.getNetwork(),
|
||||||
value: promise
|
value: promise
|
||||||
});
|
});
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
async call(_tx) {
|
async call(_tx) {
|
||||||
const { tx, blockTag } = await (0, index_js_3.resolveProperties)({
|
const { tx, blockTag } = await (0, index_js_6.resolveProperties)({
|
||||||
tx: this._getTransactionRequest(_tx),
|
tx: this._getTransactionRequest(_tx),
|
||||||
blockTag: this._getBlockTag(_tx.blockTag)
|
blockTag: this._getBlockTag(_tx.blockTag)
|
||||||
});
|
});
|
||||||
@ -586,21 +589,21 @@ class AbstractProvider {
|
|||||||
return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag })));
|
return await this.#checkNetwork(this.#perform(Object.assign(request, { address, blockTag })));
|
||||||
}
|
}
|
||||||
async getBalance(address, blockTag) {
|
async getBalance(address, blockTag) {
|
||||||
return (0, index_js_3.getBigInt)(await this.#getAccountValue({ method: "getBalance" }, address, blockTag), "%response");
|
return (0, index_js_6.getBigInt)(await this.#getAccountValue({ method: "getBalance" }, address, blockTag), "%response");
|
||||||
}
|
}
|
||||||
async getTransactionCount(address, blockTag) {
|
async getTransactionCount(address, blockTag) {
|
||||||
return (0, index_js_3.getNumber)(await this.#getAccountValue({ method: "getTransactionCount" }, address, blockTag), "%response");
|
return (0, index_js_6.getNumber)(await this.#getAccountValue({ method: "getTransactionCount" }, address, blockTag), "%response");
|
||||||
}
|
}
|
||||||
async getCode(address, blockTag) {
|
async getCode(address, blockTag) {
|
||||||
return (0, index_js_3.hexlify)(await this.#getAccountValue({ method: "getCode" }, address, blockTag));
|
return (0, index_js_6.hexlify)(await this.#getAccountValue({ method: "getCode" }, address, blockTag));
|
||||||
}
|
}
|
||||||
async getStorage(address, _position, blockTag) {
|
async getStorage(address, _position, blockTag) {
|
||||||
const position = (0, index_js_3.getBigInt)(_position, "position");
|
const position = (0, index_js_6.getBigInt)(_position, "position");
|
||||||
return (0, index_js_3.hexlify)(await this.#getAccountValue({ method: "getStorage", position }, address, blockTag));
|
return (0, index_js_6.hexlify)(await this.#getAccountValue({ method: "getStorage", position }, address, blockTag));
|
||||||
}
|
}
|
||||||
// Write
|
// Write
|
||||||
async broadcastTransaction(signedTx) {
|
async broadcastTransaction(signedTx) {
|
||||||
const { blockNumber, hash, network } = await (0, index_js_3.resolveProperties)({
|
const { blockNumber, hash, network } = await (0, index_js_6.resolveProperties)({
|
||||||
blockNumber: this.getBlockNumber(),
|
blockNumber: this.getBlockNumber(),
|
||||||
hash: this._perform({
|
hash: this._perform({
|
||||||
method: "broadcastTransaction",
|
method: "broadcastTransaction",
|
||||||
@ -608,7 +611,7 @@ class AbstractProvider {
|
|||||||
}),
|
}),
|
||||||
network: this.getNetwork()
|
network: this.getNetwork()
|
||||||
});
|
});
|
||||||
const tx = index_js_2.Transaction.from(signedTx);
|
const tx = index_js_5.Transaction.from(signedTx);
|
||||||
if (tx.hash !== hash) {
|
if (tx.hash !== hash) {
|
||||||
throw new Error("@TODO: the returned hash did not match");
|
throw new Error("@TODO: the returned hash did not match");
|
||||||
}
|
}
|
||||||
@ -616,7 +619,7 @@ class AbstractProvider {
|
|||||||
}
|
}
|
||||||
async #getBlock(block, includeTransactions) {
|
async #getBlock(block, includeTransactions) {
|
||||||
// @TODO: Add CustomBlockPlugin check
|
// @TODO: Add CustomBlockPlugin check
|
||||||
if ((0, index_js_3.isHexString)(block, 32)) {
|
if ((0, index_js_6.isHexString)(block, 32)) {
|
||||||
return await this.#perform({
|
return await this.#perform({
|
||||||
method: "getBlock", blockHash: block, includeTransactions
|
method: "getBlock", blockHash: block, includeTransactions
|
||||||
});
|
});
|
||||||
@ -631,7 +634,7 @@ class AbstractProvider {
|
|||||||
}
|
}
|
||||||
// Queries
|
// Queries
|
||||||
async getBlock(block, prefetchTxs) {
|
async getBlock(block, prefetchTxs) {
|
||||||
const { network, params } = await (0, index_js_3.resolveProperties)({
|
const { network, params } = await (0, index_js_6.resolveProperties)({
|
||||||
network: this.getNetwork(),
|
network: this.getNetwork(),
|
||||||
params: this.#getBlock(block, !!prefetchTxs)
|
params: this.#getBlock(block, !!prefetchTxs)
|
||||||
});
|
});
|
||||||
@ -641,7 +644,7 @@ class AbstractProvider {
|
|||||||
return this._wrapBlock((0, format_js_1.formatBlock)(params), network);
|
return this._wrapBlock((0, format_js_1.formatBlock)(params), network);
|
||||||
}
|
}
|
||||||
async getTransaction(hash) {
|
async getTransaction(hash) {
|
||||||
const { network, params } = await (0, index_js_3.resolveProperties)({
|
const { network, params } = await (0, index_js_6.resolveProperties)({
|
||||||
network: this.getNetwork(),
|
network: this.getNetwork(),
|
||||||
params: this.#perform({ method: "getTransaction", hash })
|
params: this.#perform({ method: "getTransaction", hash })
|
||||||
});
|
});
|
||||||
@ -651,7 +654,7 @@ class AbstractProvider {
|
|||||||
return this._wrapTransactionResponse((0, format_js_1.formatTransactionResponse)(params), network);
|
return this._wrapTransactionResponse((0, format_js_1.formatTransactionResponse)(params), network);
|
||||||
}
|
}
|
||||||
async getTransactionReceipt(hash) {
|
async getTransactionReceipt(hash) {
|
||||||
const { network, params } = await (0, index_js_3.resolveProperties)({
|
const { network, params } = await (0, index_js_6.resolveProperties)({
|
||||||
network: this.getNetwork(),
|
network: this.getNetwork(),
|
||||||
params: this.#perform({ method: "getTransactionReceipt", hash })
|
params: this.#perform({ method: "getTransactionReceipt", hash })
|
||||||
});
|
});
|
||||||
@ -670,14 +673,14 @@ class AbstractProvider {
|
|||||||
return this._wrapTransactionReceipt((0, format_js_1.formatTransactionReceipt)(params), network);
|
return this._wrapTransactionReceipt((0, format_js_1.formatTransactionReceipt)(params), network);
|
||||||
}
|
}
|
||||||
async getTransactionResult(hash) {
|
async getTransactionResult(hash) {
|
||||||
const { result } = await (0, index_js_3.resolveProperties)({
|
const { result } = await (0, index_js_6.resolveProperties)({
|
||||||
network: this.getNetwork(),
|
network: this.getNetwork(),
|
||||||
result: this.#perform({ method: "getTransactionResult", hash })
|
result: this.#perform({ method: "getTransactionResult", hash })
|
||||||
});
|
});
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return (0, index_js_3.hexlify)(result);
|
return (0, index_js_6.hexlify)(result);
|
||||||
}
|
}
|
||||||
// Bloom-filter Queries
|
// Bloom-filter Queries
|
||||||
async getLogs(_filter) {
|
async getLogs(_filter) {
|
||||||
@ -685,7 +688,7 @@ class AbstractProvider {
|
|||||||
if (isPromise(filter)) {
|
if (isPromise(filter)) {
|
||||||
filter = await filter;
|
filter = await filter;
|
||||||
}
|
}
|
||||||
const { network, params } = await (0, index_js_3.resolveProperties)({
|
const { network, params } = await (0, index_js_6.resolveProperties)({
|
||||||
network: this.getNetwork(),
|
network: this.getNetwork(),
|
||||||
params: this.#perform({ method: "getLogs", filter })
|
params: this.#perform({ method: "getLogs", filter })
|
||||||
});
|
});
|
||||||
@ -693,7 +696,7 @@ class AbstractProvider {
|
|||||||
}
|
}
|
||||||
// ENS
|
// ENS
|
||||||
_getProvider(chainId) {
|
_getProvider(chainId) {
|
||||||
(0, index_js_3.assert)(false, "provider cannot connect to target network", "UNSUPPORTED_OPERATION", {
|
(0, index_js_6.assert)(false, "provider cannot connect to target network", "UNSUPPORTED_OPERATION", {
|
||||||
operation: "_getProvider()"
|
operation: "_getProvider()"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -708,28 +711,38 @@ class AbstractProvider {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
async resolveName(name) {
|
async resolveName(name) {
|
||||||
if ((0, index_js_3.isHexString)(name, 20)) {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
//if (typeof(name) === "string") {
|
|
||||||
const resolver = await this.getResolver(name);
|
const resolver = await this.getResolver(name);
|
||||||
if (resolver) {
|
if (resolver) {
|
||||||
return await resolver.getAddress();
|
return await resolver.getAddress();
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
} else {
|
|
||||||
const address = await name.getAddress();
|
|
||||||
if (address == null) {
|
|
||||||
return logger.throwArgumentError("Addressable returned no address", "name", name);
|
|
||||||
}
|
|
||||||
return address;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
async lookupAddress(address) {
|
async lookupAddress(address) {
|
||||||
throw new Error();
|
address = (0, index_js_1.getAddress)(address);
|
||||||
//return "TODO";
|
const node = (0, index_js_4.namehash)(address.substring(2).toLowerCase() + ".addr.reverse");
|
||||||
|
try {
|
||||||
|
const ensAddr = await ens_resolver_js_1.EnsResolver.getEnsAddress(this);
|
||||||
|
const ensContract = new index_js_3.Contract(ensAddr, [
|
||||||
|
"function resolver(bytes32) view returns (address)"
|
||||||
|
], this);
|
||||||
|
const resolver = await ensContract.resolver(node);
|
||||||
|
if (resolver == null || resolver === index_js_2.ZeroHash) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const resolverContract = new index_js_3.Contract(resolver, [
|
||||||
|
"function name(bytes32) view returns (string)"
|
||||||
|
], this);
|
||||||
|
const name = await resolverContract.name(node);
|
||||||
|
const check = await this.resolveName(name);
|
||||||
|
if (check !== address) {
|
||||||
|
console.log("FAIL", address, check);
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.log("TEMP", error);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
async waitForTransaction(hash, _confirms, timeout) {
|
async waitForTransaction(hash, _confirms, timeout) {
|
||||||
const confirms = (_confirms != null) ? _confirms : 1;
|
const confirms = (_confirms != null) ? _confirms : 1;
|
||||||
@ -765,15 +778,16 @@ class AbstractProvider {
|
|||||||
}
|
}
|
||||||
timer = null;
|
timer = null;
|
||||||
this.off("block", listener);
|
this.off("block", listener);
|
||||||
reject((0, index_js_3.makeError)("timeout", "TIMEOUT", { reason: "timeout" }));
|
reject((0, index_js_6.makeError)("timeout", "TIMEOUT", { reason: "timeout" }));
|
||||||
}, timeout);
|
}, timeout);
|
||||||
}
|
}
|
||||||
listener(await this.getBlockNumber());
|
listener(await this.getBlockNumber());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async waitForBlock(blockTag) {
|
async waitForBlock(blockTag) {
|
||||||
throw new Error();
|
(0, index_js_6.assert)(false, "not implemented yet", "NOT_IMPLEMENTED", {
|
||||||
//return new Block(<any><unknown>{ }, this);
|
operation: "waitForBlock"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
_clearTimeout(timerId) {
|
_clearTimeout(timerId) {
|
||||||
const timer = this.#timers.get(timerId);
|
const timer = this.#timers.get(timerId);
|
||||||
@ -892,13 +906,15 @@ class AbstractProvider {
|
|||||||
}
|
}
|
||||||
async emit(event, ...args) {
|
async emit(event, ...args) {
|
||||||
const sub = await this.#hasSub(event, args);
|
const sub = await this.#hasSub(event, args);
|
||||||
if (!sub) {
|
// If there is not subscription or if a recent emit removed
|
||||||
|
// the last of them (which also deleted the sub) do nothing
|
||||||
|
if (!sub || sub.listeners.length === 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
const count = sub.listeners.length;
|
const count = sub.listeners.length;
|
||||||
sub.listeners = sub.listeners.filter(({ listener, once }) => {
|
sub.listeners = sub.listeners.filter(({ listener, once }) => {
|
||||||
const payload = new index_js_3.EventPayload(this, (once ? null : listener), event);
|
const payload = new index_js_6.EventPayload(this, (once ? null : listener), event);
|
||||||
try {
|
try {
|
||||||
listener.call(this, ...args, payload);
|
listener.call(this, ...args, payload);
|
||||||
}
|
}
|
||||||
@ -1014,7 +1030,7 @@ class AbstractProvider {
|
|||||||
if (this.#pausedState == !!dropWhilePaused) {
|
if (this.#pausedState == !!dropWhilePaused) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(0, index_js_3.assert)(false, "cannot change pause type; resume first", "UNSUPPORTED_OPERATION", {
|
(0, index_js_6.assert)(false, "cannot change pause type; resume first", "UNSUPPORTED_OPERATION", {
|
||||||
operation: "pause"
|
operation: "pause"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1053,7 +1069,7 @@ function _parseString(result, start) {
|
|||||||
try {
|
try {
|
||||||
const bytes = _parseBytes(result, start);
|
const bytes = _parseBytes(result, start);
|
||||||
if (bytes) {
|
if (bytes) {
|
||||||
return (0, index_js_3.toUtf8String)(bytes);
|
return (0, index_js_6.toUtf8String)(bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) { }
|
catch (error) { }
|
||||||
@ -1064,15 +1080,15 @@ function _parseBytes(result, start) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const offset = (0, index_js_3.getNumber)((0, index_js_3.dataSlice)(result, start, start + 32));
|
const offset = (0, index_js_6.getNumber)((0, index_js_6.dataSlice)(result, start, start + 32));
|
||||||
const length = (0, index_js_3.getNumber)((0, index_js_3.dataSlice)(result, offset, offset + 32));
|
const length = (0, index_js_6.getNumber)((0, index_js_6.dataSlice)(result, offset, offset + 32));
|
||||||
return (0, index_js_3.dataSlice)(result, offset + 32, offset + 32 + length);
|
return (0, index_js_6.dataSlice)(result, offset + 32, offset + 32 + length);
|
||||||
}
|
}
|
||||||
catch (error) { }
|
catch (error) { }
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
function numPad(value) {
|
function numPad(value) {
|
||||||
const result = (0, index_js_3.toBeArray)(value);
|
const result = (0, index_js_6.toBeArray)(value);
|
||||||
if (result.length > 32) {
|
if (result.length > 32) {
|
||||||
throw new Error("internal; should not happen");
|
throw new Error("internal; should not happen");
|
||||||
}
|
}
|
||||||
@ -1099,7 +1115,7 @@ function encodeBytes(datas) {
|
|||||||
byteCount += 32;
|
byteCount += 32;
|
||||||
}
|
}
|
||||||
for (let i = 0; i < datas.length; i++) {
|
for (let i = 0; i < datas.length; i++) {
|
||||||
const data = (0, index_js_3.getBytes)(datas[i]);
|
const data = (0, index_js_6.getBytes)(datas[i]);
|
||||||
// Update the bytes offset
|
// Update the bytes offset
|
||||||
result[i] = numPad(byteCount);
|
result[i] = numPad(byteCount);
|
||||||
// The length and padded value of data
|
// The length and padded value of data
|
||||||
@ -1107,27 +1123,27 @@ function encodeBytes(datas) {
|
|||||||
result.push(bytesPad(data));
|
result.push(bytesPad(data));
|
||||||
byteCount += 32 + Math.ceil(data.length / 32) * 32;
|
byteCount += 32 + Math.ceil(data.length / 32) * 32;
|
||||||
}
|
}
|
||||||
return (0, index_js_3.concat)(result);
|
return (0, index_js_6.concat)(result);
|
||||||
}
|
}
|
||||||
const zeros = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
const zeros = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
||||||
function parseOffchainLookup(data) {
|
function parseOffchainLookup(data) {
|
||||||
const result = {
|
const result = {
|
||||||
sender: "", urls: [], calldata: "", selector: "", extraData: "", errorArgs: []
|
sender: "", urls: [], calldata: "", selector: "", extraData: "", errorArgs: []
|
||||||
};
|
};
|
||||||
(0, index_js_3.assert)((0, index_js_3.dataLength)(data) >= 5 * 32, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", {
|
(0, index_js_6.assert)((0, index_js_6.dataLength)(data) >= 5 * 32, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", {
|
||||||
reason: "insufficient OffchainLookup data"
|
reason: "insufficient OffchainLookup data"
|
||||||
});
|
});
|
||||||
const sender = (0, index_js_3.dataSlice)(data, 0, 32);
|
const sender = (0, index_js_6.dataSlice)(data, 0, 32);
|
||||||
(0, index_js_3.assert)((0, index_js_3.dataSlice)(sender, 0, 12) === (0, index_js_3.dataSlice)(zeros, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", {
|
(0, index_js_6.assert)((0, index_js_6.dataSlice)(sender, 0, 12) === (0, index_js_6.dataSlice)(zeros, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", {
|
||||||
reason: "corrupt OffchainLookup sender"
|
reason: "corrupt OffchainLookup sender"
|
||||||
});
|
});
|
||||||
result.sender = (0, index_js_3.dataSlice)(sender, 12);
|
result.sender = (0, index_js_6.dataSlice)(sender, 12);
|
||||||
// Read the URLs from the response
|
// Read the URLs from the response
|
||||||
try {
|
try {
|
||||||
const urls = [];
|
const urls = [];
|
||||||
const urlsOffset = (0, index_js_3.getNumber)((0, index_js_3.dataSlice)(data, 32, 64));
|
const urlsOffset = (0, index_js_6.getNumber)((0, index_js_6.dataSlice)(data, 32, 64));
|
||||||
const urlsLength = (0, index_js_3.getNumber)((0, index_js_3.dataSlice)(data, urlsOffset, urlsOffset + 32));
|
const urlsLength = (0, index_js_6.getNumber)((0, index_js_6.dataSlice)(data, urlsOffset, urlsOffset + 32));
|
||||||
const urlsData = (0, index_js_3.dataSlice)(data, urlsOffset + 32);
|
const urlsData = (0, index_js_6.dataSlice)(data, urlsOffset + 32);
|
||||||
for (let u = 0; u < urlsLength; u++) {
|
for (let u = 0; u < urlsLength; u++) {
|
||||||
const url = _parseString(urlsData, u * 32);
|
const url = _parseString(urlsData, u * 32);
|
||||||
if (url == null) {
|
if (url == null) {
|
||||||
@ -1138,7 +1154,7 @@ function parseOffchainLookup(data) {
|
|||||||
result.urls = urls;
|
result.urls = urls;
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
(0, index_js_3.assert)(false, "corrupt OffchainLookup urls", "OFFCHAIN_FAULT", {
|
(0, index_js_6.assert)(false, "corrupt OffchainLookup urls", "OFFCHAIN_FAULT", {
|
||||||
reason: "corrupt OffchainLookup urls"
|
reason: "corrupt OffchainLookup urls"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1151,15 +1167,15 @@ function parseOffchainLookup(data) {
|
|||||||
result.calldata = calldata;
|
result.calldata = calldata;
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
(0, index_js_3.assert)(false, "corrupt OffchainLookup calldata", "OFFCHAIN_FAULT", {
|
(0, index_js_6.assert)(false, "corrupt OffchainLookup calldata", "OFFCHAIN_FAULT", {
|
||||||
reason: "corrupt OffchainLookup calldata"
|
reason: "corrupt OffchainLookup calldata"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Get the callbackSelector (bytes4)
|
// Get the callbackSelector (bytes4)
|
||||||
(0, index_js_3.assert)((0, index_js_3.dataSlice)(data, 100, 128) === (0, index_js_3.dataSlice)(zeros, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", {
|
(0, index_js_6.assert)((0, index_js_6.dataSlice)(data, 100, 128) === (0, index_js_6.dataSlice)(zeros, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", {
|
||||||
reason: "corrupt OffchainLookup callbaackSelector"
|
reason: "corrupt OffchainLookup callbaackSelector"
|
||||||
});
|
});
|
||||||
result.selector = (0, index_js_3.dataSlice)(data, 96, 100);
|
result.selector = (0, index_js_6.dataSlice)(data, 96, 100);
|
||||||
// Get the extra data to send back to the contract as context
|
// Get the extra data to send back to the contract as context
|
||||||
try {
|
try {
|
||||||
const extraData = _parseBytes(data, 128);
|
const extraData = _parseBytes(data, 128);
|
||||||
@ -1169,7 +1185,7 @@ function parseOffchainLookup(data) {
|
|||||||
result.extraData = extraData;
|
result.extraData = extraData;
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
(0, index_js_3.assert)(false, "corrupt OffchainLookup extraData", "OFFCHAIN_FAULT", {
|
(0, index_js_6.assert)(false, "corrupt OffchainLookup extraData", "OFFCHAIN_FAULT", {
|
||||||
reason: "corrupt OffchainLookup extraData"
|
reason: "corrupt OffchainLookup extraData"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.WrappedSigner = exports.VoidSigner = exports.AbstractSigner = void 0;
|
exports.VoidSigner = exports.AbstractSigner = void 0;
|
||||||
/**
|
/**
|
||||||
* About Abstract Signer and subclassing
|
* About Abstract Signer and subclassing
|
||||||
*
|
*
|
||||||
@ -10,47 +10,47 @@ const index_js_1 = require("../address/index.js");
|
|||||||
const index_js_2 = require("../transaction/index.js");
|
const index_js_2 = require("../transaction/index.js");
|
||||||
const index_js_3 = require("../utils/index.js");
|
const index_js_3 = require("../utils/index.js");
|
||||||
const provider_js_1 = require("./provider.js");
|
const provider_js_1 = require("./provider.js");
|
||||||
class AbstractSigner {
|
function checkProvider(signer, operation) {
|
||||||
provider;
|
if (signer.provider) {
|
||||||
constructor(provider) {
|
return signer.provider;
|
||||||
(0, index_js_3.defineProperties)(this, { provider: (provider || null) });
|
|
||||||
}
|
|
||||||
#checkProvider(operation) {
|
|
||||||
if (this.provider) {
|
|
||||||
return this.provider;
|
|
||||||
}
|
}
|
||||||
(0, index_js_3.assert)(false, "missing provider", "UNSUPPORTED_OPERATION", { operation });
|
(0, index_js_3.assert)(false, "missing provider", "UNSUPPORTED_OPERATION", { operation });
|
||||||
}
|
}
|
||||||
async getNonce(blockTag) {
|
async function populate(signer, tx) {
|
||||||
return this.#checkProvider("getTransactionCount").getTransactionCount(await this.getAddress(), blockTag);
|
|
||||||
}
|
|
||||||
async #populate(tx) {
|
|
||||||
let pop = (0, provider_js_1.copyRequest)(tx);
|
let pop = (0, provider_js_1.copyRequest)(tx);
|
||||||
if (pop.to != null) {
|
if (pop.to != null) {
|
||||||
pop.to = (0, index_js_1.resolveAddress)(pop.to, this);
|
pop.to = (0, index_js_1.resolveAddress)(pop.to, signer);
|
||||||
}
|
}
|
||||||
if (pop.from != null) {
|
if (pop.from != null) {
|
||||||
const from = pop.from;
|
const from = pop.from;
|
||||||
pop.from = Promise.all([
|
pop.from = Promise.all([
|
||||||
this.getAddress(),
|
signer.getAddress(),
|
||||||
(0, index_js_1.resolveAddress)(from, this)
|
(0, index_js_1.resolveAddress)(from, signer)
|
||||||
]).then(([address, from]) => {
|
]).then(([address, from]) => {
|
||||||
(0, index_js_3.assertArgument)(address.toLowerCase() === from.toLowerCase(), "transaction from mismatch", "tx.from", from);
|
(0, index_js_3.assertArgument)(address.toLowerCase() === from.toLowerCase(), "transaction from mismatch", "tx.from", from);
|
||||||
return address;
|
return address;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pop.from = this.getAddress();
|
pop.from = signer.getAddress();
|
||||||
}
|
}
|
||||||
return await (0, index_js_3.resolveProperties)(pop);
|
return await (0, index_js_3.resolveProperties)(pop);
|
||||||
}
|
}
|
||||||
|
class AbstractSigner {
|
||||||
|
provider;
|
||||||
|
constructor(provider) {
|
||||||
|
(0, index_js_3.defineProperties)(this, { provider: (provider || null) });
|
||||||
|
}
|
||||||
|
async getNonce(blockTag) {
|
||||||
|
return checkProvider(this, "getTransactionCount").getTransactionCount(await this.getAddress(), blockTag);
|
||||||
|
}
|
||||||
async populateCall(tx) {
|
async populateCall(tx) {
|
||||||
const pop = await this.#populate(tx);
|
const pop = await populate(this, tx);
|
||||||
return pop;
|
return pop;
|
||||||
}
|
}
|
||||||
async populateTransaction(tx) {
|
async populateTransaction(tx) {
|
||||||
const provider = this.#checkProvider("populateTransaction");
|
const provider = checkProvider(this, "populateTransaction");
|
||||||
const pop = await this.#populate(tx);
|
const pop = await populate(this, tx);
|
||||||
if (pop.nonce == null) {
|
if (pop.nonce == null) {
|
||||||
pop.nonce = await this.getNonce("pending");
|
pop.nonce = await this.getNonce("pending");
|
||||||
}
|
}
|
||||||
@ -154,17 +154,17 @@ class AbstractSigner {
|
|||||||
return await (0, index_js_3.resolveProperties)(pop);
|
return await (0, index_js_3.resolveProperties)(pop);
|
||||||
}
|
}
|
||||||
async estimateGas(tx) {
|
async estimateGas(tx) {
|
||||||
return this.#checkProvider("estimateGas").estimateGas(await this.populateCall(tx));
|
return checkProvider(this, "estimateGas").estimateGas(await this.populateCall(tx));
|
||||||
}
|
}
|
||||||
async call(tx) {
|
async call(tx) {
|
||||||
return this.#checkProvider("call").call(await this.populateCall(tx));
|
return checkProvider(this, "call").call(await this.populateCall(tx));
|
||||||
}
|
}
|
||||||
async resolveName(name) {
|
async resolveName(name) {
|
||||||
const provider = this.#checkProvider("resolveName");
|
const provider = checkProvider(this, "resolveName");
|
||||||
return await provider.resolveName(name);
|
return await provider.resolveName(name);
|
||||||
}
|
}
|
||||||
async sendTransaction(tx) {
|
async sendTransaction(tx) {
|
||||||
const provider = this.#checkProvider("sendTransaction");
|
const provider = checkProvider(this, "sendTransaction");
|
||||||
const pop = await this.populateTransaction(tx);
|
const pop = await this.populateTransaction(tx);
|
||||||
delete pop.from;
|
delete pop.from;
|
||||||
const txObj = index_js_2.Transaction.from(pop);
|
const txObj = index_js_2.Transaction.from(pop);
|
||||||
@ -196,48 +196,4 @@ class VoidSigner extends AbstractSigner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.VoidSigner = VoidSigner;
|
exports.VoidSigner = VoidSigner;
|
||||||
class WrappedSigner extends AbstractSigner {
|
|
||||||
#signer;
|
|
||||||
constructor(signer) {
|
|
||||||
super(signer.provider);
|
|
||||||
this.#signer = signer;
|
|
||||||
}
|
|
||||||
async getAddress() {
|
|
||||||
return await this.#signer.getAddress();
|
|
||||||
}
|
|
||||||
connect(provider) {
|
|
||||||
return new WrappedSigner(this.#signer.connect(provider));
|
|
||||||
}
|
|
||||||
async getNonce(blockTag) {
|
|
||||||
return await this.#signer.getNonce(blockTag);
|
|
||||||
}
|
|
||||||
async populateCall(tx) {
|
|
||||||
return await this.#signer.populateCall(tx);
|
|
||||||
}
|
|
||||||
async populateTransaction(tx) {
|
|
||||||
return await this.#signer.populateTransaction(tx);
|
|
||||||
}
|
|
||||||
async estimateGas(tx) {
|
|
||||||
return await this.#signer.estimateGas(tx);
|
|
||||||
}
|
|
||||||
async call(tx) {
|
|
||||||
return await this.#signer.call(tx);
|
|
||||||
}
|
|
||||||
async resolveName(name) {
|
|
||||||
return this.#signer.resolveName(name);
|
|
||||||
}
|
|
||||||
async signTransaction(tx) {
|
|
||||||
return await this.#signer.signTransaction(tx);
|
|
||||||
}
|
|
||||||
async sendTransaction(tx) {
|
|
||||||
return await this.#signer.sendTransaction(tx);
|
|
||||||
}
|
|
||||||
async signMessage(message) {
|
|
||||||
return await this.#signer.signMessage(message);
|
|
||||||
}
|
|
||||||
async signTypedData(domain, types, value) {
|
|
||||||
return await this.#signer.signTypedData(domain, types, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.WrappedSigner = WrappedSigner;
|
|
||||||
//# sourceMappingURL=abstract-signer.js.map
|
//# sourceMappingURL=abstract-signer.js.map
|
File diff suppressed because one or more lines are too long
@ -6,71 +6,10 @@
|
|||||||
*/
|
*/
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.EnsResolver = exports.BasicMulticoinProviderPlugin = exports.MulticoinProviderPlugin = void 0;
|
exports.EnsResolver = exports.BasicMulticoinProviderPlugin = exports.MulticoinProviderPlugin = void 0;
|
||||||
const index_js_1 = require("../address/index.js");
|
const index_js_1 = require("../constants/index.js");
|
||||||
const index_js_2 = require("../constants/index.js");
|
const index_js_2 = require("../contract/index.js");
|
||||||
const index_js_3 = require("../hash/index.js");
|
const index_js_3 = require("../hash/index.js");
|
||||||
const index_js_4 = require("../utils/index.js");
|
const index_js_4 = require("../utils/index.js");
|
||||||
const BN_1 = BigInt(1);
|
|
||||||
const Empty = new Uint8Array([]);
|
|
||||||
function parseBytes(result, start) {
|
|
||||||
if (result === "0x") {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const offset = (0, index_js_4.toNumber)((0, index_js_4.dataSlice)(result, start, start + 32));
|
|
||||||
const length = (0, index_js_4.toNumber)((0, index_js_4.dataSlice)(result, offset, offset + 32));
|
|
||||||
return (0, index_js_4.dataSlice)(result, offset + 32, offset + 32 + length);
|
|
||||||
}
|
|
||||||
function parseString(result, start) {
|
|
||||||
try {
|
|
||||||
const bytes = parseBytes(result, start);
|
|
||||||
if (bytes != null) {
|
|
||||||
return (0, index_js_4.toUtf8String)(bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (error) { }
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
function numPad(value) {
|
|
||||||
const result = (0, index_js_4.toBeArray)(value);
|
|
||||||
if (result.length > 32) {
|
|
||||||
throw new Error("internal; should not happen");
|
|
||||||
}
|
|
||||||
const padded = new Uint8Array(32);
|
|
||||||
padded.set(result, 32 - result.length);
|
|
||||||
return padded;
|
|
||||||
}
|
|
||||||
function bytesPad(value) {
|
|
||||||
if ((value.length % 32) === 0) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
const result = new Uint8Array(Math.ceil(value.length / 32) * 32);
|
|
||||||
result.set(value);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
// ABI Encodes a series of (bytes, bytes, ...)
|
|
||||||
function encodeBytes(datas) {
|
|
||||||
const result = [];
|
|
||||||
let byteCount = 0;
|
|
||||||
// Add place-holders for pointers as we add items
|
|
||||||
for (let i = 0; i < datas.length; i++) {
|
|
||||||
result.push(Empty);
|
|
||||||
byteCount += 32;
|
|
||||||
}
|
|
||||||
for (let i = 0; i < datas.length; i++) {
|
|
||||||
const data = (0, index_js_4.getBytes)(datas[i]);
|
|
||||||
// Update the bytes offset
|
|
||||||
result[i] = numPad(byteCount);
|
|
||||||
// The length and padded value of data
|
|
||||||
result.push(numPad(data.length));
|
|
||||||
result.push(bytesPad(data));
|
|
||||||
byteCount += 32 + Math.ceil(data.length / 32) * 32;
|
|
||||||
}
|
|
||||||
return (0, index_js_4.concat)(result);
|
|
||||||
}
|
|
||||||
function callAddress(value) {
|
|
||||||
(0, index_js_4.assertArgument)(value.length === 66 && (0, index_js_4.dataSlice)(value, 0, 12) === "0x000000000000000000000000", "invalid call address", "value", value);
|
|
||||||
return (0, index_js_1.getAddress)("0x" + value.substring(26));
|
|
||||||
}
|
|
||||||
// @TODO: This should use the fetch-data:ipfs gateway
|
// @TODO: This should use the fetch-data:ipfs gateway
|
||||||
// Trim off the ipfs:// prefix and return the default gateway URL
|
// Trim off the ipfs:// prefix and return the default gateway URL
|
||||||
function getIpfsLink(link) {
|
function getIpfsLink(link) {
|
||||||
@ -109,7 +48,7 @@ class MulticoinProviderPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.MulticoinProviderPlugin = MulticoinProviderPlugin;
|
exports.MulticoinProviderPlugin = MulticoinProviderPlugin;
|
||||||
const BasicMulticoinPluginId = "org.ethers.plugins.BasicMulticoinProviderPlugin";
|
const BasicMulticoinPluginId = "org.ethers.plugins.provider.BasicMulticoin";
|
||||||
/**
|
/**
|
||||||
* A basic multicoin provider plugin.
|
* A basic multicoin provider plugin.
|
||||||
*/
|
*/
|
||||||
@ -145,68 +84,71 @@ class EnsResolver {
|
|||||||
name;
|
name;
|
||||||
// For EIP-2544 names, the ancestor that provided the resolver
|
// For EIP-2544 names, the ancestor that provided the resolver
|
||||||
#supports2544;
|
#supports2544;
|
||||||
|
#resolver;
|
||||||
constructor(provider, address, name) {
|
constructor(provider, address, name) {
|
||||||
(0, index_js_4.defineProperties)(this, { provider, address, name });
|
(0, index_js_4.defineProperties)(this, { provider, address, name });
|
||||||
this.#supports2544 = null;
|
this.#supports2544 = null;
|
||||||
|
this.#resolver = new index_js_2.Contract(address, [
|
||||||
|
"function supportsInterface(bytes4) view returns (bool)",
|
||||||
|
"function resolve(bytes, bytes) view returns (bytes)",
|
||||||
|
"function addr(bytes32) view returns (address)",
|
||||||
|
"function addr(bytes32, uint) view returns (address)",
|
||||||
|
"function text(bytes32, string) view returns (string)",
|
||||||
|
"function contenthash() view returns (bytes)",
|
||||||
|
], provider);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Resolves to true if the resolver supports wildcard resolution.
|
* Resolves to true if the resolver supports wildcard resolution.
|
||||||
*/
|
*/
|
||||||
async supportsWildcard() {
|
async supportsWildcard() {
|
||||||
if (!this.#supports2544) {
|
if (this.#supports2544 == null) {
|
||||||
// supportsInterface(bytes4 = selector("resolve(bytes,bytes)"))
|
this.#supports2544 = (async () => {
|
||||||
this.#supports2544 = this.provider.call({
|
try {
|
||||||
to: this.address,
|
return await this.#resolver.supportsInterface("0x9061b923");
|
||||||
data: "0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"
|
}
|
||||||
}).then((result) => {
|
catch (error) {
|
||||||
return ((0, index_js_4.getBigInt)(result) === BN_1);
|
// Wildcard resolvers must understand supportsInterface
|
||||||
}).catch((error) => {
|
// and return true.
|
||||||
if (error.code === "CALL_EXCEPTION") {
|
if ((0, index_js_4.isError)(error, "CALL_EXCEPTION")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Rethrow the error: link is down, etc. Let future attempts retry.
|
// Let future attempts try again...
|
||||||
this.#supports2544 = null;
|
this.#supports2544 = null;
|
||||||
throw error;
|
throw error;
|
||||||
});
|
}
|
||||||
|
})();
|
||||||
}
|
}
|
||||||
return await this.#supports2544;
|
return await this.#supports2544;
|
||||||
}
|
}
|
||||||
/**
|
async #fetch(funcName, params) {
|
||||||
* Fetch the %%selector%% with %%parameters%% using call, resolving
|
params = (params || []).slice();
|
||||||
* recursively if the resolver supports it.
|
const iface = this.#resolver.interface;
|
||||||
*/
|
// The first parameters is always the nodehash
|
||||||
async _fetch(selector, parameters) {
|
params.unshift((0, index_js_3.namehash)(this.name));
|
||||||
if (parameters == null) {
|
let fragment = null;
|
||||||
parameters = "0x";
|
|
||||||
}
|
|
||||||
// e.g. keccak256("addr(bytes32,uint256)")
|
|
||||||
const addrData = (0, index_js_4.concat)([selector, (0, index_js_3.namehash)(this.name), parameters]);
|
|
||||||
const tx = {
|
|
||||||
to: this.address,
|
|
||||||
from: index_js_2.ZeroAddress,
|
|
||||||
enableCcipRead: true,
|
|
||||||
data: addrData
|
|
||||||
};
|
|
||||||
// Wildcard support; use EIP-2544 to resolve the request
|
|
||||||
let wrapped = false;
|
|
||||||
if (await this.supportsWildcard()) {
|
if (await this.supportsWildcard()) {
|
||||||
wrapped = true;
|
fragment = iface.getFunction(funcName);
|
||||||
// selector("resolve(bytes,bytes)")
|
(0, index_js_4.assert)(fragment, "missing fragment", "UNKNOWN_ERROR", {
|
||||||
tx.data = (0, index_js_4.concat)(["0x9061b923", encodeBytes([(0, index_js_3.dnsEncode)(this.name), addrData])]);
|
info: { funcName }
|
||||||
}
|
|
||||||
try {
|
|
||||||
let data = await this.provider.call(tx);
|
|
||||||
(0, index_js_4.assert)(((0, index_js_4.getBytes)(data).length % 32) !== 4, "execution reverted during JSON-RPC call (could not parse reason; invalid data length)", "CALL_EXCEPTION", {
|
|
||||||
action: "call", data, reason: null, transaction: tx,
|
|
||||||
invocation: null, revert: null
|
|
||||||
});
|
});
|
||||||
if (wrapped) {
|
params = [
|
||||||
return parseBytes(data, 0);
|
(0, index_js_3.dnsEncode)(this.name),
|
||||||
|
iface.encodeFunctionData(fragment, params)
|
||||||
|
];
|
||||||
|
funcName = "resolve(bytes,bytes)";
|
||||||
}
|
}
|
||||||
return data;
|
params.push({
|
||||||
|
ccipReadEnable: true
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
const result = await this.#resolver[funcName](...params);
|
||||||
|
if (fragment) {
|
||||||
|
return iface.decodeFunctionResult(fragment, result)[0];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
if (error.code !== "CALL_EXCEPTION") {
|
if (!(0, index_js_4.isError)(error, "CALL_EXCEPTION")) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -222,16 +164,15 @@ class EnsResolver {
|
|||||||
}
|
}
|
||||||
if (coinType === 60) {
|
if (coinType === 60) {
|
||||||
try {
|
try {
|
||||||
// keccak256("addr(bytes32)")
|
const result = await this.#fetch("addr(bytes32)");
|
||||||
const result = await this._fetch("0x3b3b57de");
|
|
||||||
// No address
|
// No address
|
||||||
if (result == null || result === "0x" || result === index_js_2.ZeroHash) {
|
if (result == null || result === index_js_1.ZeroAddress) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return callAddress(result);
|
return result;
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
if (error.code === "CALL_EXCEPTION") {
|
if ((0, index_js_4.isError)(error, "CALL_EXCEPTION")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
@ -251,7 +192,7 @@ class EnsResolver {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// keccak256("addr(bytes32,uint256")
|
// keccak256("addr(bytes32,uint256")
|
||||||
const data = parseBytes((await this._fetch("0xf1cb7e06", numPad(coinType))) || "0x", 0);
|
const data = await this.#fetch("addr(bytes32,uint)", [coinType]);
|
||||||
// No address
|
// No address
|
||||||
if (data == null || data === "0x") {
|
if (data == null || data === "0x") {
|
||||||
return null;
|
return null;
|
||||||
@ -271,29 +212,24 @@ class EnsResolver {
|
|||||||
* if unconfigured.
|
* if unconfigured.
|
||||||
*/
|
*/
|
||||||
async getText(key) {
|
async getText(key) {
|
||||||
// The key encoded as parameter to fetchBytes
|
const data = await this.#fetch("text(bytes32,string)", [key]);
|
||||||
let keyBytes = (0, index_js_4.toUtf8Bytes)(key);
|
if (data == null || data === "0x") {
|
||||||
// The nodehash consumes the first slot, so the string pointer targets
|
|
||||||
// offset 64, with the length at offset 64 and data starting at offset 96
|
|
||||||
const calldata = (0, index_js_4.getBytes)((0, index_js_4.concat)([numPad(64), numPad(keyBytes.length), keyBytes]));
|
|
||||||
const hexBytes = parseBytes((await this._fetch("0x59d1d43c", bytesPad(calldata))) || "0x", 0);
|
|
||||||
if (hexBytes == null || hexBytes === "0x") {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return (0, index_js_4.toUtf8String)(hexBytes);
|
return data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Rsolves to the content-hash or ``null`` if unconfigured.
|
* Rsolves to the content-hash or ``null`` if unconfigured.
|
||||||
*/
|
*/
|
||||||
async getContentHash() {
|
async getContentHash() {
|
||||||
// keccak256("contenthash()")
|
// keccak256("contenthash()")
|
||||||
const hexBytes = parseBytes((await this._fetch("0xbc1c58d1")) || "0x", 0);
|
const data = await this.#fetch("contenthash()");
|
||||||
// No contenthash
|
// No contenthash
|
||||||
if (hexBytes == null || hexBytes === "0x") {
|
if (data == null || data === "0x") {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// IPFS (CID: 1, Type: 70=DAG-PB, 72=libp2p-key)
|
// IPFS (CID: 1, Type: 70=DAG-PB, 72=libp2p-key)
|
||||||
const ipfs = hexBytes.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);
|
const ipfs = data.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);
|
||||||
if (ipfs) {
|
if (ipfs) {
|
||||||
const scheme = (ipfs[1] === "e3010170") ? "ipfs" : "ipns";
|
const scheme = (ipfs[1] === "e3010170") ? "ipfs" : "ipns";
|
||||||
const length = parseInt(ipfs[4], 16);
|
const length = parseInt(ipfs[4], 16);
|
||||||
@ -302,13 +238,13 @@ class EnsResolver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32)
|
// Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32)
|
||||||
const swarm = hexBytes.match(/^0xe40101fa011b20([0-9a-f]*)$/);
|
const swarm = data.match(/^0xe40101fa011b20([0-9a-f]*)$/);
|
||||||
if (swarm && swarm[1].length === 64) {
|
if (swarm && swarm[1].length === 64) {
|
||||||
return `bzz:/\/${swarm[1]}`;
|
return `bzz:/\/${swarm[1]}`;
|
||||||
}
|
}
|
||||||
(0, index_js_4.assert)(false, `invalid or unsupported content hash data`, "UNSUPPORTED_OPERATION", {
|
(0, index_js_4.assert)(false, `invalid or unsupported content hash data`, "UNSUPPORTED_OPERATION", {
|
||||||
operation: "getContentHash()",
|
operation: "getContentHash()",
|
||||||
info: { data: hexBytes }
|
info: { data }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -320,7 +256,8 @@ class EnsResolver {
|
|||||||
* method may be useful.
|
* method may be useful.
|
||||||
*/
|
*/
|
||||||
async getAvatar() {
|
async getAvatar() {
|
||||||
return (await this._getAvatar()).url;
|
const avatar = await this._getAvatar();
|
||||||
|
return avatar.url;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* When resolving an avatar, there are many steps involved, such
|
* When resolving an avatar, there are many steps involved, such
|
||||||
@ -338,7 +275,7 @@ class EnsResolver {
|
|||||||
const avatar = await this.getText("avatar");
|
const avatar = await this.getText("avatar");
|
||||||
if (avatar == null) {
|
if (avatar == null) {
|
||||||
linkage.push({ type: "!avatar", value: "" });
|
linkage.push({ type: "!avatar", value: "" });
|
||||||
throw new Error("!avatar");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
linkage.push({ type: "avatar", value: avatar });
|
linkage.push({ type: "avatar", value: avatar });
|
||||||
for (let i = 0; i < matchers.length; i++) {
|
for (let i = 0; i < matchers.length; i++) {
|
||||||
@ -361,58 +298,55 @@ class EnsResolver {
|
|||||||
case "erc721":
|
case "erc721":
|
||||||
case "erc1155": {
|
case "erc1155": {
|
||||||
// Depending on the ERC type, use tokenURI(uint256) or url(uint256)
|
// Depending on the ERC type, use tokenURI(uint256) or url(uint256)
|
||||||
const selector = (scheme === "erc721") ? "0xc87b56dd" : "0x0e89341c";
|
const selector = (scheme === "erc721") ? "tokenURI(uint256)" : "uri(uint256)";
|
||||||
linkage.push({ type: scheme, value: avatar });
|
linkage.push({ type: scheme, value: avatar });
|
||||||
// The owner of this name
|
// The owner of this name
|
||||||
const owner = await this.getAddress();
|
const owner = await this.getAddress();
|
||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
linkage.push({ type: "!owner", value: "" });
|
linkage.push({ type: "!owner", value: "" });
|
||||||
throw new Error("!owner");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
const comps = (match[2] || "").split("/");
|
const comps = (match[2] || "").split("/");
|
||||||
if (comps.length !== 2) {
|
if (comps.length !== 2) {
|
||||||
linkage.push({ type: `!${scheme}caip`, value: (match[2] || "") });
|
linkage.push({ type: `!${scheme}caip`, value: (match[2] || "") });
|
||||||
throw new Error("!caip");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
const addr = (0, index_js_1.getAddress)(comps[0]);
|
const tokenId = comps[1];
|
||||||
const tokenId = numPad(comps[1]);
|
const contract = new index_js_2.Contract(comps[0], [
|
||||||
|
// ERC-721
|
||||||
|
"function tokenURI(uint) view returns (string)",
|
||||||
|
"function ownerOf(uint) view returns (address)",
|
||||||
|
// ERC-1155
|
||||||
|
"function uri(uint) view returns (string)",
|
||||||
|
"function balanceOf(address, uint256) view returns (uint)"
|
||||||
|
], this.provider);
|
||||||
// Check that this account owns the token
|
// Check that this account owns the token
|
||||||
if (scheme === "erc721") {
|
if (scheme === "erc721") {
|
||||||
// ownerOf(uint256 tokenId)
|
const tokenOwner = await contract.ownerOf(tokenId);
|
||||||
const tokenOwner = callAddress(await this.provider.call({
|
|
||||||
to: addr, data: (0, index_js_4.concat)(["0x6352211e", tokenId])
|
|
||||||
}));
|
|
||||||
if (owner !== tokenOwner) {
|
if (owner !== tokenOwner) {
|
||||||
linkage.push({ type: "!owner", value: tokenOwner });
|
linkage.push({ type: "!owner", value: tokenOwner });
|
||||||
throw new Error("!owner");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
linkage.push({ type: "owner", value: tokenOwner });
|
linkage.push({ type: "owner", value: tokenOwner });
|
||||||
}
|
}
|
||||||
else if (scheme === "erc1155") {
|
else if (scheme === "erc1155") {
|
||||||
// balanceOf(address owner, uint256 tokenId)
|
const balance = await contract.balanceOf(owner, tokenId);
|
||||||
const balance = (0, index_js_4.getBigInt)(await this.provider.call({
|
|
||||||
to: addr, data: (0, index_js_4.concat)(["0x00fdd58e", (0, index_js_4.zeroPadValue)(owner, 32), tokenId])
|
|
||||||
}));
|
|
||||||
if (!balance) {
|
if (!balance) {
|
||||||
linkage.push({ type: "!balance", value: "0" });
|
linkage.push({ type: "!balance", value: "0" });
|
||||||
throw new Error("!balance");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
linkage.push({ type: "balance", value: balance.toString() });
|
linkage.push({ type: "balance", value: balance.toString() });
|
||||||
}
|
}
|
||||||
// Call the token contract for the metadata URL
|
// Call the token contract for the metadata URL
|
||||||
const tx = {
|
let metadataUrl = await contract[selector](tokenId);
|
||||||
to: comps[0],
|
if (metadataUrl == null || metadataUrl === "0x") {
|
||||||
data: (0, index_js_4.concat)([selector, tokenId])
|
|
||||||
};
|
|
||||||
let metadataUrl = parseString(await this.provider.call(tx), 0);
|
|
||||||
if (metadataUrl == null) {
|
|
||||||
linkage.push({ type: "!metadata-url", value: "" });
|
linkage.push({ type: "!metadata-url", value: "" });
|
||||||
throw new Error("!metadata-url");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
linkage.push({ type: "metadata-url-base", value: metadataUrl });
|
linkage.push({ type: "metadata-url-base", value: metadataUrl });
|
||||||
// ERC-1155 allows a generic {id} in the URL
|
// ERC-1155 allows a generic {id} in the URL
|
||||||
if (scheme === "erc1155") {
|
if (scheme === "erc1155") {
|
||||||
metadataUrl = metadataUrl.replace("{id}", (0, index_js_4.hexlify)(tokenId).substring(2));
|
metadataUrl = metadataUrl.replace("{id}", (0, index_js_4.toBeHex)(tokenId, 32).substring(2));
|
||||||
linkage.push({ type: "metadata-url-expanded", value: metadataUrl });
|
linkage.push({ type: "metadata-url-expanded", value: metadataUrl });
|
||||||
}
|
}
|
||||||
// Transform IPFS metadata links
|
// Transform IPFS metadata links
|
||||||
@ -436,20 +370,20 @@ class EnsResolver {
|
|||||||
if (bytes) {
|
if (bytes) {
|
||||||
linkage.push({ type: "!metadata", value: (0, index_js_4.hexlify)(bytes) });
|
linkage.push({ type: "!metadata", value: (0, index_js_4.hexlify)(bytes) });
|
||||||
}
|
}
|
||||||
throw error;
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
throw error;
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
if (!metadata) {
|
if (!metadata) {
|
||||||
linkage.push({ type: "!metadata", value: "" });
|
linkage.push({ type: "!metadata", value: "" });
|
||||||
throw new Error("!metadata");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
linkage.push({ type: "metadata", value: JSON.stringify(metadata) });
|
linkage.push({ type: "metadata", value: JSON.stringify(metadata) });
|
||||||
// Pull the image URL out
|
// Pull the image URL out
|
||||||
let imageUrl = metadata.image;
|
let imageUrl = metadata.image;
|
||||||
if (typeof (imageUrl) !== "string") {
|
if (typeof (imageUrl) !== "string") {
|
||||||
linkage.push({ type: "!imageUrl", value: "" });
|
linkage.push({ type: "!imageUrl", value: "" });
|
||||||
throw new Error("!imageUrl");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
if (imageUrl.match(/^(https:\/\/|data:)/i)) {
|
if (imageUrl.match(/^(https:\/\/|data:)/i)) {
|
||||||
// Allow
|
// Allow
|
||||||
@ -459,7 +393,7 @@ class EnsResolver {
|
|||||||
const ipfs = imageUrl.match(matcherIpfs);
|
const ipfs = imageUrl.match(matcherIpfs);
|
||||||
if (ipfs == null) {
|
if (ipfs == null) {
|
||||||
linkage.push({ type: "!imageUrl-ipfs", value: imageUrl });
|
linkage.push({ type: "!imageUrl-ipfs", value: imageUrl });
|
||||||
throw new Error("!imageUrl-ipfs");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
linkage.push({ type: "imageUrl-ipfs", value: imageUrl });
|
linkage.push({ type: "imageUrl-ipfs", value: imageUrl });
|
||||||
imageUrl = getIpfsLink(imageUrl);
|
imageUrl = getIpfsLink(imageUrl);
|
||||||
@ -470,27 +404,28 @@ class EnsResolver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) { }
|
||||||
console.log("EE", error);
|
|
||||||
}
|
|
||||||
return { linkage, url: null };
|
return { linkage, url: null };
|
||||||
}
|
}
|
||||||
static async #getResolver(provider, name) {
|
static async getEnsAddress(provider) {
|
||||||
const network = await provider.getNetwork();
|
const network = await provider.getNetwork();
|
||||||
const ensPlugin = network.getPlugin("org.ethers.network-plugins.ens");
|
const ensPlugin = network.getPlugin("org.ethers.plugins.network.Ens");
|
||||||
// No ENS...
|
// No ENS...
|
||||||
(0, index_js_4.assert)(ensPlugin, "network does not support ENS", "UNSUPPORTED_OPERATION", {
|
(0, index_js_4.assert)(ensPlugin, "network does not support ENS", "UNSUPPORTED_OPERATION", {
|
||||||
operation: "getResolver", info: { network: network.name }
|
operation: "getEnsAddress", info: { network }
|
||||||
});
|
});
|
||||||
|
return ensPlugin.address;
|
||||||
|
}
|
||||||
|
static async #getResolver(provider, name) {
|
||||||
|
const ensAddr = await EnsResolver.getEnsAddress(provider);
|
||||||
try {
|
try {
|
||||||
// keccak256("resolver(bytes32)")
|
const contract = new index_js_2.Contract(ensAddr, [
|
||||||
const addrData = await provider.call({
|
"function resolver(bytes32) view returns (address)"
|
||||||
to: ensPlugin.address,
|
], provider);
|
||||||
data: (0, index_js_4.concat)(["0x0178b8bf", (0, index_js_3.namehash)(name)]),
|
const addr = await contract.resolver((0, index_js_3.namehash)(name), {
|
||||||
enableCcipRead: true
|
enableCcipRead: true
|
||||||
});
|
});
|
||||||
const addr = callAddress(addrData);
|
if (addr === index_js_1.ZeroAddress) {
|
||||||
if (addr === (0, index_js_4.dataSlice)(index_js_2.ZeroHash, 0, 20)) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return addr;
|
return addr;
|
||||||
@ -504,7 +439,7 @@ class EnsResolver {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Resolve to the ENS resolver for %%name%% using %%provider%% or
|
* Resolve to the ENS resolver for %%name%% using %%provider%% or
|
||||||
* ``null`` if uncinfigured.
|
* ``null`` if unconfigured.
|
||||||
*/
|
*/
|
||||||
static async fromName(provider, name) {
|
static async fromName(provider, name) {
|
||||||
let currentName = name;
|
let currentName = name;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -5,14 +5,13 @@
|
|||||||
* @_section: api/providers:Providers [providers]
|
* @_section: api/providers:Providers [providers]
|
||||||
*/
|
*/
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.SocketEventSubscriber = exports.SocketPendingSubscriber = exports.SocketBlockSubscriber = exports.SocketSubscriber = exports.WebSocketProvider = exports.SocketProvider = exports.IpcSocketProvider = exports.QuickNodeProvider = exports.InfuraWebSocketProvider = exports.InfuraProvider = exports.EtherscanProvider = exports.EtherscanPlugin = exports.BaseEtherscanProvider = exports.CloudflareProvider = exports.AnkrProvider = exports.AlchemyProvider = exports.BrowserProvider = exports.JsonRpcSigner = exports.JsonRpcProvider = exports.JsonRpcApiProvider = exports.FallbackProvider = exports.copyRequest = exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.FeeData = exports.Block = exports.FeeDataNetworkPlugin = exports.EnsPlugin = exports.GasCostPlugin = exports.NetworkPlugin = exports.Network = exports.EnsResolver = exports.getDefaultProvider = exports.showThrottleMessage = exports.WrappedSigner = exports.VoidSigner = exports.AbstractSigner = exports.UnmanagedSubscriber = exports.AbstractProvider = void 0;
|
exports.SocketEventSubscriber = exports.SocketPendingSubscriber = exports.SocketBlockSubscriber = exports.SocketSubscriber = exports.WebSocketProvider = exports.SocketProvider = exports.IpcSocketProvider = exports.QuickNodeProvider = exports.PocketProvider = exports.InfuraWebSocketProvider = exports.InfuraProvider = exports.EtherscanPlugin = exports.EtherscanProvider = exports.CloudflareProvider = exports.AnkrProvider = exports.AlchemyProvider = exports.BrowserProvider = exports.JsonRpcSigner = exports.JsonRpcProvider = exports.JsonRpcApiProvider = exports.FallbackProvider = exports.copyRequest = exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.FeeData = exports.Block = exports.FeeDataNetworkPlugin = exports.EnsPlugin = exports.GasCostPlugin = exports.NetworkPlugin = exports.NonceManager = exports.Network = exports.EnsResolver = exports.getDefaultProvider = exports.showThrottleMessage = exports.VoidSigner = exports.AbstractSigner = exports.UnmanagedSubscriber = exports.AbstractProvider = void 0;
|
||||||
var abstract_provider_js_1 = require("./abstract-provider.js");
|
var abstract_provider_js_1 = require("./abstract-provider.js");
|
||||||
Object.defineProperty(exports, "AbstractProvider", { enumerable: true, get: function () { return abstract_provider_js_1.AbstractProvider; } });
|
Object.defineProperty(exports, "AbstractProvider", { enumerable: true, get: function () { return abstract_provider_js_1.AbstractProvider; } });
|
||||||
Object.defineProperty(exports, "UnmanagedSubscriber", { enumerable: true, get: function () { return abstract_provider_js_1.UnmanagedSubscriber; } });
|
Object.defineProperty(exports, "UnmanagedSubscriber", { enumerable: true, get: function () { return abstract_provider_js_1.UnmanagedSubscriber; } });
|
||||||
var abstract_signer_js_1 = require("./abstract-signer.js");
|
var abstract_signer_js_1 = require("./abstract-signer.js");
|
||||||
Object.defineProperty(exports, "AbstractSigner", { enumerable: true, get: function () { return abstract_signer_js_1.AbstractSigner; } });
|
Object.defineProperty(exports, "AbstractSigner", { enumerable: true, get: function () { return abstract_signer_js_1.AbstractSigner; } });
|
||||||
Object.defineProperty(exports, "VoidSigner", { enumerable: true, get: function () { return abstract_signer_js_1.VoidSigner; } });
|
Object.defineProperty(exports, "VoidSigner", { enumerable: true, get: function () { return abstract_signer_js_1.VoidSigner; } });
|
||||||
Object.defineProperty(exports, "WrappedSigner", { enumerable: true, get: function () { return abstract_signer_js_1.WrappedSigner; } });
|
|
||||||
var community_js_1 = require("./community.js");
|
var community_js_1 = require("./community.js");
|
||||||
Object.defineProperty(exports, "showThrottleMessage", { enumerable: true, get: function () { return community_js_1.showThrottleMessage; } });
|
Object.defineProperty(exports, "showThrottleMessage", { enumerable: true, get: function () { return community_js_1.showThrottleMessage; } });
|
||||||
var default_provider_js_1 = require("./default-provider.js");
|
var default_provider_js_1 = require("./default-provider.js");
|
||||||
@ -21,11 +20,12 @@ var ens_resolver_js_1 = require("./ens-resolver.js");
|
|||||||
Object.defineProperty(exports, "EnsResolver", { enumerable: true, get: function () { return ens_resolver_js_1.EnsResolver; } });
|
Object.defineProperty(exports, "EnsResolver", { enumerable: true, get: function () { return ens_resolver_js_1.EnsResolver; } });
|
||||||
var network_js_1 = require("./network.js");
|
var network_js_1 = require("./network.js");
|
||||||
Object.defineProperty(exports, "Network", { enumerable: true, get: function () { return network_js_1.Network; } });
|
Object.defineProperty(exports, "Network", { enumerable: true, get: function () { return network_js_1.Network; } });
|
||||||
|
var signer_noncemanager_js_1 = require("./signer-noncemanager.js");
|
||||||
|
Object.defineProperty(exports, "NonceManager", { enumerable: true, get: function () { return signer_noncemanager_js_1.NonceManager; } });
|
||||||
var plugins_network_js_1 = require("./plugins-network.js");
|
var plugins_network_js_1 = require("./plugins-network.js");
|
||||||
Object.defineProperty(exports, "NetworkPlugin", { enumerable: true, get: function () { return plugins_network_js_1.NetworkPlugin; } });
|
Object.defineProperty(exports, "NetworkPlugin", { enumerable: true, get: function () { return plugins_network_js_1.NetworkPlugin; } });
|
||||||
Object.defineProperty(exports, "GasCostPlugin", { enumerable: true, get: function () { return plugins_network_js_1.GasCostPlugin; } });
|
Object.defineProperty(exports, "GasCostPlugin", { enumerable: true, get: function () { return plugins_network_js_1.GasCostPlugin; } });
|
||||||
Object.defineProperty(exports, "EnsPlugin", { enumerable: true, get: function () { return plugins_network_js_1.EnsPlugin; } });
|
Object.defineProperty(exports, "EnsPlugin", { enumerable: true, get: function () { return plugins_network_js_1.EnsPlugin; } });
|
||||||
//MaxPriorityFeePlugin,
|
|
||||||
Object.defineProperty(exports, "FeeDataNetworkPlugin", { enumerable: true, get: function () { return plugins_network_js_1.FeeDataNetworkPlugin; } });
|
Object.defineProperty(exports, "FeeDataNetworkPlugin", { enumerable: true, get: function () { return plugins_network_js_1.FeeDataNetworkPlugin; } });
|
||||||
var provider_js_1 = require("./provider.js");
|
var provider_js_1 = require("./provider.js");
|
||||||
Object.defineProperty(exports, "Block", { enumerable: true, get: function () { return provider_js_1.Block; } });
|
Object.defineProperty(exports, "Block", { enumerable: true, get: function () { return provider_js_1.Block; } });
|
||||||
@ -48,14 +48,14 @@ var provider_ankr_js_1 = require("./provider-ankr.js");
|
|||||||
Object.defineProperty(exports, "AnkrProvider", { enumerable: true, get: function () { return provider_ankr_js_1.AnkrProvider; } });
|
Object.defineProperty(exports, "AnkrProvider", { enumerable: true, get: function () { return provider_ankr_js_1.AnkrProvider; } });
|
||||||
var provider_cloudflare_js_1 = require("./provider-cloudflare.js");
|
var provider_cloudflare_js_1 = require("./provider-cloudflare.js");
|
||||||
Object.defineProperty(exports, "CloudflareProvider", { enumerable: true, get: function () { return provider_cloudflare_js_1.CloudflareProvider; } });
|
Object.defineProperty(exports, "CloudflareProvider", { enumerable: true, get: function () { return provider_cloudflare_js_1.CloudflareProvider; } });
|
||||||
var provider_etherscan_base_js_1 = require("./provider-etherscan-base.js");
|
|
||||||
Object.defineProperty(exports, "BaseEtherscanProvider", { enumerable: true, get: function () { return provider_etherscan_base_js_1.BaseEtherscanProvider; } });
|
|
||||||
Object.defineProperty(exports, "EtherscanPlugin", { enumerable: true, get: function () { return provider_etherscan_base_js_1.EtherscanPlugin; } });
|
|
||||||
var provider_etherscan_js_1 = require("./provider-etherscan.js");
|
var provider_etherscan_js_1 = require("./provider-etherscan.js");
|
||||||
Object.defineProperty(exports, "EtherscanProvider", { enumerable: true, get: function () { return provider_etherscan_js_1.EtherscanProvider; } });
|
Object.defineProperty(exports, "EtherscanProvider", { enumerable: true, get: function () { return provider_etherscan_js_1.EtherscanProvider; } });
|
||||||
|
Object.defineProperty(exports, "EtherscanPlugin", { enumerable: true, get: function () { return provider_etherscan_js_1.EtherscanPlugin; } });
|
||||||
var provider_infura_js_1 = require("./provider-infura.js");
|
var provider_infura_js_1 = require("./provider-infura.js");
|
||||||
Object.defineProperty(exports, "InfuraProvider", { enumerable: true, get: function () { return provider_infura_js_1.InfuraProvider; } });
|
Object.defineProperty(exports, "InfuraProvider", { enumerable: true, get: function () { return provider_infura_js_1.InfuraProvider; } });
|
||||||
Object.defineProperty(exports, "InfuraWebSocketProvider", { enumerable: true, get: function () { return provider_infura_js_1.InfuraWebSocketProvider; } });
|
Object.defineProperty(exports, "InfuraWebSocketProvider", { enumerable: true, get: function () { return provider_infura_js_1.InfuraWebSocketProvider; } });
|
||||||
|
var provider_pocket_js_1 = require("./provider-pocket.js");
|
||||||
|
Object.defineProperty(exports, "PocketProvider", { enumerable: true, get: function () { return provider_pocket_js_1.PocketProvider; } });
|
||||||
var provider_quicknode_js_1 = require("./provider-quicknode.js");
|
var provider_quicknode_js_1 = require("./provider-quicknode.js");
|
||||||
Object.defineProperty(exports, "QuickNodeProvider", { enumerable: true, get: function () { return provider_quicknode_js_1.QuickNodeProvider; } });
|
Object.defineProperty(exports, "QuickNodeProvider", { enumerable: true, get: function () { return provider_quicknode_js_1.QuickNodeProvider; } });
|
||||||
const provider_ipcsocket_js_1 = require("./provider-ipcsocket.js"); /*-browser*/
|
const provider_ipcsocket_js_1 = require("./provider-ipcsocket.js"); /*-browser*/
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/providers/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAIH,+DAEgC;AAD5B,wHAAA,gBAAgB,OAAA;AAAE,2HAAA,mBAAmB,OAAA;AAGzC,2DAI8B;AAH1B,oHAAA,cAAc,OAAA;AACd,gHAAA,UAAU,OAAA;AACV,mHAAA,aAAa,OAAA;AAGjB,+CAEwB;AADpB,mHAAA,mBAAmB,OAAA;AAGvB,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA;AAE3B,qDAAgD;AAAvC,8GAAA,WAAW,OAAA;AAEpB,2CAAuC;AAA9B,qGAAA,OAAO,OAAA;AAEhB,2DAO8B;AAN1B,mHAAA,aAAa,OAAA;AACb,mHAAA,aAAa,OAAA;AACb,+GAAA,SAAS,OAAA;AACT,uBAAuB;AACvB,0HAAA,oBAAoB,OAAA;AAIxB,6CASuB;AARnB,oGAAA,KAAK,OAAA;AACL,sGAAA,OAAO,OAAA;AACP,kGAAA,GAAG,OAAA;AACH,iHAAA,kBAAkB,OAAA;AAClB,kHAAA,mBAAmB,OAAA;AAEnB,0GAAA,WAAW,OAAA;AAIf,+DAA0D;AAAjD,wHAAA,gBAAgB,OAAA;AACzB,6DAA0F;AAAjF,yHAAA,kBAAkB,OAAA;AAAE,sHAAA,eAAe,OAAA;AAAE,oHAAA,aAAa,OAAA;AAE3D,6DAAwD;AAA/C,sHAAA,eAAe,OAAA;AAExB,6DAAwD;AAA/C,sHAAA,eAAe,OAAA;AACxB,uDAAkD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AAClB,kHAAA,mBAAmB,OAAA;AAEnB,0GAAA,WAAW,OAAA;AAIf,+DAA0D;AAAjD,wHAAA,gBAAgB,OAAA;AACzB,6DAA0F;AAAjF,yHAAA,kBAAkB,OAAA;AAAE,sHAAA,eAAe,OAAA;AAAE,oHAAA,aAAa,OAAA;AAE3D,6DAAwD;AAA/C,sHAAA,eAAe,OAAA;AAExB,6DAAwD;AAA/C,sHAAA,eAAe,OAAA;AACxB,uDAAkD;AAAzC,gHAAA,YAAY,OAAA;AACrB,mEAA8D;AAArD,4HAAA,kBAAkB,OAAA;AAC3B,iEAA6E;AAApE,0HAAA,iBAAiB,OAAA;AAAE,wHAAA,eAAe,OAAA;AAC3C,2DAA+E;AAAtE,oHAAA,cAAc,OAAA;AAAE,6HAAA,uBAAuB,OAAA;AAChD,2DAAsD;AAA7C,oHAAA,cAAc,OAAA;AACvB,iEAA4D;AAAnD,0HAAA,iBAAiB,OAAA;AAE1B,mEAA4D,CAAC,YAAY;AAChE,kGADA,yCAAiB,OACA;AAC1B,2DAAsD;AAA7C,oHAAA,cAAc,OAAA;AACvB,iEAA4D;AAAnD,0HAAA,iBAAiB,OAAA;AAE1B,2DAG8B;AAF1B,sHAAA,gBAAgB,OAAA;AAAE,2HAAA,qBAAqB,OAAA;AAAE,6HAAA,uBAAuB,OAAA;AAChE,2HAAA,qBAAqB,OAAA"}
|
@ -102,7 +102,7 @@ class Network {
|
|||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
computeIntrinsicGas(tx) {
|
computeIntrinsicGas(tx) {
|
||||||
const costs = this.getPlugin("org.ethers.gas-cost") || (new plugins_network_js_1.GasCostPlugin());
|
const costs = this.getPlugin("org.ethers.plugins.network.GasCost") || (new plugins_network_js_1.GasCostPlugin());
|
||||||
let gas = costs.txBase;
|
let gas = costs.txBase;
|
||||||
if (tx.to == null) {
|
if (tx.to == null) {
|
||||||
gas += costs.txCreate;
|
gas += costs.txCreate;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.PossiblyPrunedTransactionPlugin = exports.CheckQualifiedPlugin = exports.PluginIdFallbackProvider = void 0;
|
exports.PossiblyPrunedTransactionPlugin = exports.CheckQualifiedPlugin = exports.PluginIdFallbackProvider = void 0;
|
||||||
const index_js_1 = require("../utils/index.js");
|
const index_js_1 = require("../utils/index.js");
|
||||||
exports.PluginIdFallbackProvider = "org.ethers.plugins.QualifiedPlugin";
|
exports.PluginIdFallbackProvider = "org.ethers.plugins.provider.QualifiedPlugin";
|
||||||
class CheckQualifiedPlugin {
|
class CheckQualifiedPlugin {
|
||||||
constructor() {
|
constructor() {
|
||||||
(0, index_js_1.defineProperties)(this, { name: exports.PluginIdFallbackProvider });
|
(0, index_js_1.defineProperties)(this, { name: exports.PluginIdFallbackProvider });
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"plugin-fallback.js","sourceRoot":"","sources":["../../src.ts/providers/plugin-fallback.ts"],"names":[],"mappings":";;;AAEA,gDAAqD;AAKxC,QAAA,wBAAwB,GAAG,oCAAoC,CAAC;AAE7E,MAAa,oBAAoB;IAG7B;QACI,IAAA,2BAAgB,EAAuB,IAAI,EAAE,EAAE,IAAI,EAAE,gCAAwB,EAAE,CAAC,CAAC;IACrF,CAAC;IAED,OAAO,CAAC,QAA0B;QAC9B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,gEAAgE;IAChE,2BAA2B;IAC3B,WAAW,CAAC,MAA4B,EAAE,MAAW;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAhBD,oDAgBC;AAED,MAAa,+BAAgC,SAAQ,oBAAoB;IACrE,WAAW,CAAC,MAA4B,EAAE,MAAW;QACjD,IAAI,MAAM,CAAC,MAAM,KAAK,gBAAgB,IAAI,MAAM,CAAC,MAAM,KAAK,uBAAuB,EAAE;YACjF,IAAI,MAAM,IAAI,IAAI,EAAE;gBAAE,OAAO,KAAK,CAAC;aAAE;SACxC;QACD,OAAO,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;CACJ;AAPD,0EAOC"}
|
{"version":3,"file":"plugin-fallback.js","sourceRoot":"","sources":["../../src.ts/providers/plugin-fallback.ts"],"names":[],"mappings":";;;AAEA,gDAAqD;AAKxC,QAAA,wBAAwB,GAAG,6CAA6C,CAAC;AAEtF,MAAa,oBAAoB;IAG7B;QACI,IAAA,2BAAgB,EAAuB,IAAI,EAAE,EAAE,IAAI,EAAE,gCAAwB,EAAE,CAAC,CAAC;IACrF,CAAC;IAED,OAAO,CAAC,QAA0B;QAC9B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,gEAAgE;IAChE,2BAA2B;IAC3B,WAAW,CAAC,MAA4B,EAAE,MAAW;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAhBD,oDAgBC;AAED,MAAa,+BAAgC,SAAQ,oBAAoB;IACrE,WAAW,CAAC,MAA4B,EAAE,MAAW;QACjD,IAAI,MAAM,CAAC,MAAM,KAAK,gBAAgB,IAAI,MAAM,CAAC,MAAM,KAAK,uBAAuB,EAAE;YACjF,IAAI,MAAM,IAAI,IAAI,EAAE;gBAAE,OAAO,KAAK,CAAC;aAAE;SACxC;QACD,OAAO,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;CACJ;AAPD,0EAOC"}
|
@ -26,7 +26,7 @@ class GasCostPlugin extends NetworkPlugin {
|
|||||||
if (effectiveBlock == null) {
|
if (effectiveBlock == null) {
|
||||||
effectiveBlock = 0;
|
effectiveBlock = 0;
|
||||||
}
|
}
|
||||||
super(`org.ethers.network-plugins.gas-cost#${(effectiveBlock || 0)}`);
|
super(`org.ethers.network.plugins.GasCost#${(effectiveBlock || 0)}`);
|
||||||
const props = { effectiveBlock };
|
const props = { effectiveBlock };
|
||||||
function set(name, nullish) {
|
function set(name, nullish) {
|
||||||
let value = (costs || {})[name];
|
let value = (costs || {})[name];
|
||||||
@ -57,7 +57,7 @@ class EnsPlugin extends NetworkPlugin {
|
|||||||
// The network ID that the ENS contract lives on
|
// The network ID that the ENS contract lives on
|
||||||
targetNetwork;
|
targetNetwork;
|
||||||
constructor(address, targetNetwork) {
|
constructor(address, targetNetwork) {
|
||||||
super("org.ethers.network-plugins.ens");
|
super("org.ethers.plugins.network.Ens");
|
||||||
(0, properties_js_1.defineProperties)(this, {
|
(0, properties_js_1.defineProperties)(this, {
|
||||||
address: (address || EnsAddress),
|
address: (address || EnsAddress),
|
||||||
targetNetwork: ((targetNetwork == null) ? 1 : targetNetwork)
|
targetNetwork: ((targetNetwork == null) ? 1 : targetNetwork)
|
||||||
@ -68,31 +68,13 @@ class EnsPlugin extends NetworkPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.EnsPlugin = EnsPlugin;
|
exports.EnsPlugin = EnsPlugin;
|
||||||
/*
|
|
||||||
export class MaxPriorityFeePlugin extends NetworkPlugin {
|
|
||||||
readonly priorityFee!: bigint;
|
|
||||||
|
|
||||||
constructor(priorityFee: BigNumberish) {
|
|
||||||
super("org.ethers.plugins.max-priority-fee");
|
|
||||||
defineProperties<MaxPriorityFeePlugin>(this, {
|
|
||||||
priorityFee: logger.getBigInt(priorityFee)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async getPriorityFee(provider: Provider): Promise<bigint> {
|
|
||||||
return this.priorityFee;
|
|
||||||
}
|
|
||||||
|
|
||||||
clone(): MaxPriorityFeePlugin {
|
|
||||||
return new MaxPriorityFeePlugin(this.priorityFee);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
class FeeDataNetworkPlugin extends NetworkPlugin {
|
class FeeDataNetworkPlugin extends NetworkPlugin {
|
||||||
#feeDataFunc;
|
#feeDataFunc;
|
||||||
get feeDataFunc() { return this.#feeDataFunc; }
|
get feeDataFunc() {
|
||||||
|
return this.#feeDataFunc;
|
||||||
|
}
|
||||||
constructor(feeDataFunc) {
|
constructor(feeDataFunc) {
|
||||||
super("org.ethers.network-plugins.fee-data");
|
super("org.ethers.plugins.network.FeeData");
|
||||||
this.#feeDataFunc = feeDataFunc;
|
this.#feeDataFunc = feeDataFunc;
|
||||||
}
|
}
|
||||||
async getFeeData(provider) {
|
async getFeeData(provider) {
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"plugins-network.js","sourceRoot":"","sources":["../../src.ts/providers/plugins-network.ts"],"names":[],"mappings":";;;AAAA,0DAA0D;AAE1D,gDAAmD;AAQnD,MAAM,UAAU,GAAG,4CAA4C,CAAC;AAEhE,MAAa,aAAa;IACb,IAAI,CAAU;IAEvB,YAAY,IAAY;QACpB,IAAA,gCAAgB,EAAgB,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,KAAK;QACD,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CAKJ;AAdD,sCAcC;AAcD,MAAa,aAAc,SAAQ,aAAa;IACnC,cAAc,CAAU;IAExB,MAAM,CAAU;IAChB,QAAQ,CAAU;IAClB,UAAU,CAAU;IACpB,aAAa,CAAU;IACvB,sBAAsB,CAAU;IAChC,mBAAmB,CAAU;IAEtC,YAAY,cAAuB,EAAE,KAAyB;QAC1D,IAAI,cAAc,IAAI,IAAI,EAAE;YAAE,cAAc,GAAG,CAAC,CAAC;SAAE;QACnD,KAAK,CAAC,uCAAwC,CAAC,cAAc,IAAI,CAAC,CAAE,EAAE,CAAC,CAAC;QAExE,MAAM,KAAK,GAA2B,EAAE,cAAc,EAAE,CAAC;QACzD,SAAS,GAAG,CAAC,IAA6B,EAAE,OAAe;YACvD,IAAI,KAAK,GAAG,CAAC,KAAK,IAAI,EAAG,CAAC,CAAC,IAAI,CAAC,CAAC;YACjC,IAAI,KAAK,IAAI,IAAI,EAAE;gBAAE,KAA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AI,UAAU,CAAC;YAChC,aAAa,EAAE,CAAC,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC,aAAa,CAAC;SAC9D,CAAC,CAAC;IACP,CAAC;IAED,KAAK;QACD,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC3D,CAAC;CACJ;AAnBD,8BAmBC;AAED,MAAa,oBAAqB,SAAQ,aAAa;IAC1C,YAAY,CAA2C;IAEhE,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,YAAY,WAAqD;QAC7D,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAAkB;QAC/B,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK;QACD,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACvD,CAAC;CACJ;AAnBD,oDAmBC;AAED;;;;;;;;;;;;;;;;;;;;;;;EAuBE"}
|
@ -1,471 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.BaseEtherscanProvider = exports.EtherscanPlugin = void 0;
|
|
||||||
const index_js_1 = require("../abi/index.js");
|
|
||||||
const index_js_2 = require("../transaction/index.js");
|
|
||||||
const index_js_3 = require("../utils/index.js");
|
|
||||||
const abstract_provider_js_1 = require("./abstract-provider.js");
|
|
||||||
const network_js_1 = require("./network.js");
|
|
||||||
const plugins_network_js_1 = require("./plugins-network.js");
|
|
||||||
const community_js_1 = require("./community.js");
|
|
||||||
const THROTTLE = 2000;
|
|
||||||
const EtherscanPluginId = "org.ethers.plugins.Etherscan";
|
|
||||||
/**
|
|
||||||
* A Network can include an **EtherscanPlugin** to provide
|
|
||||||
* a custom base URL.
|
|
||||||
*
|
|
||||||
* @_docloc: api/providers/thirdparty:Etherscan
|
|
||||||
*/
|
|
||||||
class EtherscanPlugin extends plugins_network_js_1.NetworkPlugin {
|
|
||||||
/**
|
|
||||||
* The Etherscan API base URL.
|
|
||||||
*/
|
|
||||||
baseUrl;
|
|
||||||
/**
|
|
||||||
* Creates a new **EtherscanProvider** which will use
|
|
||||||
* %%baseUrl%%.
|
|
||||||
*/
|
|
||||||
constructor(baseUrl) {
|
|
||||||
super(EtherscanPluginId);
|
|
||||||
(0, index_js_3.defineProperties)(this, { baseUrl });
|
|
||||||
}
|
|
||||||
clone() {
|
|
||||||
return new EtherscanPlugin(this.baseUrl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.EtherscanPlugin = EtherscanPlugin;
|
|
||||||
let nextId = 1;
|
|
||||||
/**
|
|
||||||
* The **EtherscanBaseProvider** is the super-class of
|
|
||||||
* [[EtherscanProvider]], which should generally be used instead.
|
|
||||||
*
|
|
||||||
* Since the **EtherscanProvider** includes additional code for
|
|
||||||
* [[Contract]] access, in //rare cases// that contracts are not
|
|
||||||
* used, this class can reduce code size.
|
|
||||||
*
|
|
||||||
* @_docloc: api/providers/thirdparty:Etherscan
|
|
||||||
*/
|
|
||||||
class BaseEtherscanProvider extends abstract_provider_js_1.AbstractProvider {
|
|
||||||
/**
|
|
||||||
* The connected network.
|
|
||||||
*/
|
|
||||||
network;
|
|
||||||
/**
|
|
||||||
* The API key or null if using the community provided bandwidth.
|
|
||||||
*/
|
|
||||||
apiKey;
|
|
||||||
#plugin;
|
|
||||||
/**
|
|
||||||
* Creates a new **EtherscanBaseProvider**.
|
|
||||||
*/
|
|
||||||
constructor(_network, _apiKey) {
|
|
||||||
const apiKey = (_apiKey != null) ? _apiKey : null;
|
|
||||||
super();
|
|
||||||
const network = network_js_1.Network.from(_network);
|
|
||||||
this.#plugin = network.getPlugin(EtherscanPluginId);
|
|
||||||
(0, index_js_3.defineProperties)(this, { apiKey, network });
|
|
||||||
// Test that the network is supported by Etherscan
|
|
||||||
this.getBaseUrl();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Returns the base URL.
|
|
||||||
*
|
|
||||||
* If an [[EtherscanPlugin]] is configured on the
|
|
||||||
* [[EtherscanBaseProvider_network]], returns the plugin's
|
|
||||||
* baseUrl.
|
|
||||||
*/
|
|
||||||
getBaseUrl() {
|
|
||||||
if (this.#plugin) {
|
|
||||||
return this.#plugin.baseUrl;
|
|
||||||
}
|
|
||||||
switch (this.network.name) {
|
|
||||||
case "mainnet":
|
|
||||||
return "https:/\/api.etherscan.io";
|
|
||||||
case "goerli":
|
|
||||||
return "https:/\/api-goerli.etherscan.io";
|
|
||||||
case "sepolia":
|
|
||||||
return "https:/\/api-sepolia.etherscan.io";
|
|
||||||
case "arbitrum":
|
|
||||||
return "https:/\/api.arbiscan.io";
|
|
||||||
case "arbitrum-goerli":
|
|
||||||
return "https:/\/api-goerli.arbiscan.io";
|
|
||||||
case "matic":
|
|
||||||
return "https:/\/api.polygonscan.com";
|
|
||||||
case "maticmum":
|
|
||||||
return "https:/\/api-testnet.polygonscan.com";
|
|
||||||
case "optimism":
|
|
||||||
return "https:/\/api-optimistic.etherscan.io";
|
|
||||||
case "optimism-goerli":
|
|
||||||
return "https:/\/api-goerli-optimistic.etherscan.io";
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
(0, index_js_3.assertArgument)(false, "unsupported network", "network", this.network);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Returns the URL for the %%module%% and %%params%%.
|
|
||||||
*/
|
|
||||||
getUrl(module, params) {
|
|
||||||
const query = Object.keys(params).reduce((accum, key) => {
|
|
||||||
const value = params[key];
|
|
||||||
if (value != null) {
|
|
||||||
accum += `&${key}=${value}`;
|
|
||||||
}
|
|
||||||
return accum;
|
|
||||||
}, "");
|
|
||||||
const apiKey = ((this.apiKey) ? `&apikey=${this.apiKey}` : "");
|
|
||||||
return `${this.getBaseUrl()}/api?module=${module}${query}${apiKey}`;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Returns the URL for using POST requests.
|
|
||||||
*/
|
|
||||||
getPostUrl() {
|
|
||||||
return `${this.getBaseUrl()}/api`;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Returns the parameters for using POST requests.
|
|
||||||
*/
|
|
||||||
getPostData(module, params) {
|
|
||||||
params.module = module;
|
|
||||||
params.apikey = this.apiKey;
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
async detectNetwork() {
|
|
||||||
return this.network;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Resolves to the result of calling %%module%% with %%params%%.
|
|
||||||
*
|
|
||||||
* If %%post%%, the request is made as a POST request.
|
|
||||||
*/
|
|
||||||
async fetch(module, params, post) {
|
|
||||||
const id = nextId++;
|
|
||||||
const url = (post ? this.getPostUrl() : this.getUrl(module, params));
|
|
||||||
const payload = (post ? this.getPostData(module, params) : null);
|
|
||||||
this.emit("debug", { action: "sendRequest", id, url, payload: payload });
|
|
||||||
const request = new index_js_3.FetchRequest(url);
|
|
||||||
request.setThrottleParams({ slotInterval: 1000 });
|
|
||||||
request.retryFunc = (req, resp, attempt) => {
|
|
||||||
if (this.isCommunityResource()) {
|
|
||||||
(0, community_js_1.showThrottleMessage)("Etherscan");
|
|
||||||
}
|
|
||||||
return Promise.resolve(true);
|
|
||||||
};
|
|
||||||
request.processFunc = async (request, response) => {
|
|
||||||
const result = response.hasBody() ? JSON.parse((0, index_js_3.toUtf8String)(response.body)) : {};
|
|
||||||
const throttle = ((typeof (result.result) === "string") ? result.result : "").toLowerCase().indexOf("rate limit") >= 0;
|
|
||||||
if (module === "proxy") {
|
|
||||||
// This JSON response indicates we are being throttled
|
|
||||||
if (result && result.status == 0 && result.message == "NOTOK" && throttle) {
|
|
||||||
this.emit("debug", { action: "receiveError", id, reason: "proxy-NOTOK", error: result });
|
|
||||||
response.throwThrottleError(result.result, THROTTLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (throttle) {
|
|
||||||
this.emit("debug", { action: "receiveError", id, reason: "null result", error: result.result });
|
|
||||||
response.throwThrottleError(result.result, THROTTLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return response;
|
|
||||||
};
|
|
||||||
if (payload) {
|
|
||||||
request.setHeader("content-type", "application/x-www-form-urlencoded; charset=UTF-8");
|
|
||||||
request.body = Object.keys(payload).map((k) => `${k}=${payload[k]}`).join("&");
|
|
||||||
}
|
|
||||||
const response = await request.send();
|
|
||||||
try {
|
|
||||||
response.assertOk();
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
this.emit("debug", { action: "receiveError", id, error, reason: "assertOk" });
|
|
||||||
(0, index_js_3.assert)(false, "response error", "SERVER_ERROR", { request, response });
|
|
||||||
}
|
|
||||||
if (!response.hasBody()) {
|
|
||||||
this.emit("debug", { action: "receiveError", id, error: "missing body", reason: "null body" });
|
|
||||||
(0, index_js_3.assert)(false, "missing response", "SERVER_ERROR", { request, response });
|
|
||||||
}
|
|
||||||
const result = JSON.parse((0, index_js_3.toUtf8String)(response.body));
|
|
||||||
if (module === "proxy") {
|
|
||||||
if (result.jsonrpc != "2.0") {
|
|
||||||
this.emit("debug", { action: "receiveError", id, result, reason: "invalid JSON-RPC" });
|
|
||||||
(0, index_js_3.assert)(false, "invalid JSON-RPC response (missing jsonrpc='2.0')", "SERVER_ERROR", { request, response, info: { result } });
|
|
||||||
}
|
|
||||||
if (result.error) {
|
|
||||||
this.emit("debug", { action: "receiveError", id, result, reason: "JSON-RPC error" });
|
|
||||||
(0, index_js_3.assert)(false, "error response", "SERVER_ERROR", { request, response, info: { result } });
|
|
||||||
}
|
|
||||||
this.emit("debug", { action: "receiveRequest", id, result });
|
|
||||||
return result.result;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// getLogs, getHistory have weird success responses
|
|
||||||
if (result.status == 0 && (result.message === "No records found" || result.message === "No transactions found")) {
|
|
||||||
this.emit("debug", { action: "receiveRequest", id, result });
|
|
||||||
return result.result;
|
|
||||||
}
|
|
||||||
if (result.status != 1 || (typeof (result.message) === "string" && !result.message.match(/^OK/))) {
|
|
||||||
this.emit("debug", { action: "receiveError", id, result });
|
|
||||||
(0, index_js_3.assert)(false, "error response", "SERVER_ERROR", { request, response, info: { result } });
|
|
||||||
}
|
|
||||||
this.emit("debug", { action: "receiveRequest", id, result });
|
|
||||||
return result.result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Returns %%transaction%% normalized for the Etherscan API.
|
|
||||||
*/
|
|
||||||
_getTransactionPostData(transaction) {
|
|
||||||
const result = {};
|
|
||||||
for (let key in transaction) {
|
|
||||||
if (transaction[key] == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
let value = transaction[key];
|
|
||||||
if (key === "type" && value === 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// Quantity-types require no leading zero, unless 0
|
|
||||||
if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) {
|
|
||||||
value = (0, index_js_3.toQuantity)(value);
|
|
||||||
}
|
|
||||||
else if (key === "accessList") {
|
|
||||||
value = "[" + (0, index_js_2.accessListify)(value).map((set) => {
|
|
||||||
return `{address:"${set.address}",storageKeys:["${set.storageKeys.join('","')}"]}`;
|
|
||||||
}).join(",") + "]";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
value = (0, index_js_3.hexlify)(value);
|
|
||||||
}
|
|
||||||
result[key] = value;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Throws the normalized Etherscan error.
|
|
||||||
*/
|
|
||||||
_checkError(req, error, transaction) {
|
|
||||||
// Pull any message out if, possible
|
|
||||||
let message = "";
|
|
||||||
if ((0, index_js_3.isError)(error, "SERVER_ERROR")) {
|
|
||||||
// Check for an error emitted by a proxy call
|
|
||||||
try {
|
|
||||||
message = error.info.result.error.message;
|
|
||||||
}
|
|
||||||
catch (e) { }
|
|
||||||
if (!message) {
|
|
||||||
try {
|
|
||||||
message = error.info.message;
|
|
||||||
}
|
|
||||||
catch (e) { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (req.method === "estimateGas") {
|
|
||||||
if (!message.match(/revert/i) && message.match(/insufficient funds/i)) {
|
|
||||||
(0, index_js_3.assert)(false, "insufficient funds", "INSUFFICIENT_FUNDS", {
|
|
||||||
transaction: req.transaction
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (req.method === "call" || req.method === "estimateGas") {
|
|
||||||
if (message.match(/execution reverted/i)) {
|
|
||||||
let data = "";
|
|
||||||
try {
|
|
||||||
data = error.info.result.error.data;
|
|
||||||
}
|
|
||||||
catch (error) { }
|
|
||||||
const e = index_js_1.AbiCoder.getBuiltinCallException(req.method, req.transaction, data);
|
|
||||||
e.info = { request: req, error };
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (message) {
|
|
||||||
if (req.method === "broadcastTransaction") {
|
|
||||||
const transaction = index_js_2.Transaction.from(req.signedTransaction);
|
|
||||||
if (message.match(/replacement/i) && message.match(/underpriced/i)) {
|
|
||||||
(0, index_js_3.assert)(false, "replacement fee too low", "REPLACEMENT_UNDERPRICED", {
|
|
||||||
transaction
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (message.match(/insufficient funds/)) {
|
|
||||||
(0, index_js_3.assert)(false, "insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", {
|
|
||||||
transaction
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) {
|
|
||||||
(0, index_js_3.assert)(false, "nonce has already been used", "NONCE_EXPIRED", {
|
|
||||||
transaction
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Something we could not process
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
async _detectNetwork() {
|
|
||||||
return this.network;
|
|
||||||
}
|
|
||||||
async _perform(req) {
|
|
||||||
switch (req.method) {
|
|
||||||
case "chainId":
|
|
||||||
return this.network.chainId;
|
|
||||||
case "getBlockNumber":
|
|
||||||
return this.fetch("proxy", { action: "eth_blockNumber" });
|
|
||||||
case "getGasPrice":
|
|
||||||
return this.fetch("proxy", { action: "eth_gasPrice" });
|
|
||||||
case "getBalance":
|
|
||||||
// Returns base-10 result
|
|
||||||
return this.fetch("account", {
|
|
||||||
action: "balance",
|
|
||||||
address: req.address,
|
|
||||||
tag: req.blockTag
|
|
||||||
});
|
|
||||||
case "getTransactionCount":
|
|
||||||
return this.fetch("proxy", {
|
|
||||||
action: "eth_getTransactionCount",
|
|
||||||
address: req.address,
|
|
||||||
tag: req.blockTag
|
|
||||||
});
|
|
||||||
case "getCode":
|
|
||||||
return this.fetch("proxy", {
|
|
||||||
action: "eth_getCode",
|
|
||||||
address: req.address,
|
|
||||||
tag: req.blockTag
|
|
||||||
});
|
|
||||||
case "getStorage":
|
|
||||||
return this.fetch("proxy", {
|
|
||||||
action: "eth_getStorageAt",
|
|
||||||
address: req.address,
|
|
||||||
position: req.position,
|
|
||||||
tag: req.blockTag
|
|
||||||
});
|
|
||||||
case "broadcastTransaction":
|
|
||||||
return this.fetch("proxy", {
|
|
||||||
action: "eth_sendRawTransaction",
|
|
||||||
hex: req.signedTransaction
|
|
||||||
}, true).catch((error) => {
|
|
||||||
return this._checkError(req, error, req.signedTransaction);
|
|
||||||
});
|
|
||||||
case "getBlock":
|
|
||||||
if ("blockTag" in req) {
|
|
||||||
return this.fetch("proxy", {
|
|
||||||
action: "eth_getBlockByNumber",
|
|
||||||
tag: req.blockTag,
|
|
||||||
boolean: (req.includeTransactions ? "true" : "false")
|
|
||||||
});
|
|
||||||
}
|
|
||||||
(0, index_js_3.assert)(false, "getBlock by blockHash not supported by Etherscan", "UNSUPPORTED_OPERATION", {
|
|
||||||
operation: "getBlock(blockHash)"
|
|
||||||
});
|
|
||||||
case "getTransaction":
|
|
||||||
return this.fetch("proxy", {
|
|
||||||
action: "eth_getTransactionByHash",
|
|
||||||
txhash: req.hash
|
|
||||||
});
|
|
||||||
case "getTransactionReceipt":
|
|
||||||
return this.fetch("proxy", {
|
|
||||||
action: "eth_getTransactionReceipt",
|
|
||||||
txhash: req.hash
|
|
||||||
});
|
|
||||||
case "call": {
|
|
||||||
if (req.blockTag !== "latest") {
|
|
||||||
throw new Error("EtherscanProvider does not support blockTag for call");
|
|
||||||
}
|
|
||||||
const postData = this._getTransactionPostData(req.transaction);
|
|
||||||
postData.module = "proxy";
|
|
||||||
postData.action = "eth_call";
|
|
||||||
try {
|
|
||||||
return await this.fetch("proxy", postData, true);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
return this._checkError(req, error, req.transaction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "estimateGas": {
|
|
||||||
const postData = this._getTransactionPostData(req.transaction);
|
|
||||||
postData.module = "proxy";
|
|
||||||
postData.action = "eth_estimateGas";
|
|
||||||
try {
|
|
||||||
return await this.fetch("proxy", postData, true);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
return this._checkError(req, error, req.transaction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
case "getLogs": {
|
|
||||||
// Needs to complain if more than one address is passed in
|
|
||||||
const args: Record<string, any> = { action: "getLogs" }
|
|
||||||
|
|
||||||
if (params.filter.fromBlock) {
|
|
||||||
args.fromBlock = checkLogTag(params.filter.fromBlock);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params.filter.toBlock) {
|
|
||||||
args.toBlock = checkLogTag(params.filter.toBlock);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params.filter.address) {
|
|
||||||
args.address = params.filter.address;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @TODO: We can handle slightly more complicated logs using the logs API
|
|
||||||
if (params.filter.topics && params.filter.topics.length > 0) {
|
|
||||||
if (params.filter.topics.length > 1) {
|
|
||||||
logger.throwError("unsupported topic count", Logger.Errors.UNSUPPORTED_OPERATION, { topics: params.filter.topics });
|
|
||||||
}
|
|
||||||
if (params.filter.topics.length === 1) {
|
|
||||||
const topic0 = params.filter.topics[0];
|
|
||||||
if (typeof(topic0) !== "string" || topic0.length !== 66) {
|
|
||||||
logger.throwError("unsupported topic format", Logger.Errors.UNSUPPORTED_OPERATION, { topic0: topic0 });
|
|
||||||
}
|
|
||||||
args.topic0 = topic0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const logs: Array<any> = await this.fetch("logs", args);
|
|
||||||
|
|
||||||
// Cache txHash => blockHash
|
|
||||||
let blocks: { [tag: string]: string } = {};
|
|
||||||
|
|
||||||
// Add any missing blockHash to the logs
|
|
||||||
for (let i = 0; i < logs.length; i++) {
|
|
||||||
const log = logs[i];
|
|
||||||
if (log.blockHash != null) { continue; }
|
|
||||||
if (blocks[log.blockNumber] == null) {
|
|
||||||
const block = await this.getBlock(log.blockNumber);
|
|
||||||
if (block) {
|
|
||||||
blocks[log.blockNumber] = block.hash;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.blockHash = blocks[log.blockNumber];
|
|
||||||
}
|
|
||||||
|
|
||||||
return logs;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return super._perform(req);
|
|
||||||
}
|
|
||||||
async getNetwork() {
|
|
||||||
return this.network;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Resolves to the current price of ether.
|
|
||||||
*
|
|
||||||
* This returns ``0`` on any network other than ``mainnet``.
|
|
||||||
*/
|
|
||||||
async getEtherPrice() {
|
|
||||||
if (this.network.name !== "mainnet") {
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
return parseFloat((await this.fetch("stats", { action: "ethprice" })).ethusd);
|
|
||||||
}
|
|
||||||
isCommunityResource() {
|
|
||||||
return (this.apiKey == null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.BaseEtherscanProvider = BaseEtherscanProvider;
|
|
||||||
//# sourceMappingURL=provider-etherscan-base.js.map
|
|
File diff suppressed because one or more lines are too long
@ -1,40 +1,472 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
/**
|
|
||||||
* [[link-etherscan]] provides a third-party service for connecting to
|
|
||||||
* various blockchains over a combination of JSON-RPC and custom API
|
|
||||||
* endpoints.
|
|
||||||
*
|
|
||||||
* **Supported Networks**
|
|
||||||
*
|
|
||||||
* - Ethereum Mainnet (``mainnet``)
|
|
||||||
* - Goerli Testnet (``goerli``)
|
|
||||||
* - Sepolia Testnet (``sepolia``)
|
|
||||||
* - Arbitrum (``arbitrum``)
|
|
||||||
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
|
|
||||||
* - Optimism (``optimism``)
|
|
||||||
* - Optimism Goerli Testnet (``optimism-goerli``)
|
|
||||||
* - Polygon (``matic``)
|
|
||||||
* - Polygon Mumbai Testnet (``maticmum``)
|
|
||||||
*
|
|
||||||
* @_subsection api/providers/thirdparty:Etherscan [providers-etherscan]
|
|
||||||
*/
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.EtherscanProvider = void 0;
|
exports.EtherscanProvider = exports.EtherscanPlugin = void 0;
|
||||||
const provider_etherscan_base_js_1 = require("./provider-etherscan-base.js");
|
const index_js_1 = require("../abi/index.js");
|
||||||
const index_js_1 = require("../contract/index.js");
|
const index_js_2 = require("../contract/index.js");
|
||||||
|
const index_js_3 = require("../transaction/index.js");
|
||||||
|
const index_js_4 = require("../utils/index.js");
|
||||||
|
const abstract_provider_js_1 = require("./abstract-provider.js");
|
||||||
|
const network_js_1 = require("./network.js");
|
||||||
|
const plugins_network_js_1 = require("./plugins-network.js");
|
||||||
|
const community_js_1 = require("./community.js");
|
||||||
|
const THROTTLE = 2000;
|
||||||
function isPromise(value) {
|
function isPromise(value) {
|
||||||
return (value && typeof (value.then) === "function");
|
return (value && typeof (value.then) === "function");
|
||||||
}
|
}
|
||||||
|
const EtherscanPluginId = "org.ethers.plugins.provider.Etherscan";
|
||||||
/**
|
/**
|
||||||
* The **EtherscanProvider** connects to the [[link-etherscan]]
|
* A Network can include an **EtherscanPlugin** to provide
|
||||||
* JSON-RPC end-points.
|
* a custom base URL.
|
||||||
*
|
*
|
||||||
* By default, requests are highly-throttled, which is
|
* @_docloc: api/providers/thirdparty:Etherscan
|
||||||
* appropriate for quick prototypes and simple scripts. To
|
|
||||||
* gain access to an increased rate-limit, it is highly
|
|
||||||
* recommended to [sign up here](link-etherscan-signup).
|
|
||||||
*/
|
*/
|
||||||
class EtherscanProvider extends provider_etherscan_base_js_1.BaseEtherscanProvider {
|
class EtherscanPlugin extends plugins_network_js_1.NetworkPlugin {
|
||||||
|
/**
|
||||||
|
* The Etherscan API base URL.
|
||||||
|
*/
|
||||||
|
baseUrl;
|
||||||
|
/**
|
||||||
|
* Creates a new **EtherscanProvider** which will use
|
||||||
|
* %%baseUrl%%.
|
||||||
|
*/
|
||||||
|
constructor(baseUrl) {
|
||||||
|
super(EtherscanPluginId);
|
||||||
|
(0, index_js_4.defineProperties)(this, { baseUrl });
|
||||||
|
}
|
||||||
|
clone() {
|
||||||
|
return new EtherscanPlugin(this.baseUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.EtherscanPlugin = EtherscanPlugin;
|
||||||
|
let nextId = 1;
|
||||||
|
/**
|
||||||
|
* The **EtherscanBaseProvider** is the super-class of
|
||||||
|
* [[EtherscanProvider]], which should generally be used instead.
|
||||||
|
*
|
||||||
|
* Since the **EtherscanProvider** includes additional code for
|
||||||
|
* [[Contract]] access, in //rare cases// that contracts are not
|
||||||
|
* used, this class can reduce code size.
|
||||||
|
*
|
||||||
|
* @_docloc: api/providers/thirdparty:Etherscan
|
||||||
|
*/
|
||||||
|
class EtherscanProvider extends abstract_provider_js_1.AbstractProvider {
|
||||||
|
/**
|
||||||
|
* The connected network.
|
||||||
|
*/
|
||||||
|
network;
|
||||||
|
/**
|
||||||
|
* The API key or null if using the community provided bandwidth.
|
||||||
|
*/
|
||||||
|
apiKey;
|
||||||
|
#plugin;
|
||||||
|
/**
|
||||||
|
* Creates a new **EtherscanBaseProvider**.
|
||||||
|
*/
|
||||||
|
constructor(_network, _apiKey) {
|
||||||
|
const apiKey = (_apiKey != null) ? _apiKey : null;
|
||||||
|
super();
|
||||||
|
const network = network_js_1.Network.from(_network);
|
||||||
|
this.#plugin = network.getPlugin(EtherscanPluginId);
|
||||||
|
(0, index_js_4.defineProperties)(this, { apiKey, network });
|
||||||
|
// Test that the network is supported by Etherscan
|
||||||
|
this.getBaseUrl();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the base URL.
|
||||||
|
*
|
||||||
|
* If an [[EtherscanPlugin]] is configured on the
|
||||||
|
* [[EtherscanBaseProvider_network]], returns the plugin's
|
||||||
|
* baseUrl.
|
||||||
|
*/
|
||||||
|
getBaseUrl() {
|
||||||
|
if (this.#plugin) {
|
||||||
|
return this.#plugin.baseUrl;
|
||||||
|
}
|
||||||
|
switch (this.network.name) {
|
||||||
|
case "mainnet":
|
||||||
|
return "https:/\/api.etherscan.io";
|
||||||
|
case "goerli":
|
||||||
|
return "https:/\/api-goerli.etherscan.io";
|
||||||
|
case "sepolia":
|
||||||
|
return "https:/\/api-sepolia.etherscan.io";
|
||||||
|
case "arbitrum":
|
||||||
|
return "https:/\/api.arbiscan.io";
|
||||||
|
case "arbitrum-goerli":
|
||||||
|
return "https:/\/api-goerli.arbiscan.io";
|
||||||
|
case "matic":
|
||||||
|
return "https:/\/api.polygonscan.com";
|
||||||
|
case "maticmum":
|
||||||
|
return "https:/\/api-testnet.polygonscan.com";
|
||||||
|
case "optimism":
|
||||||
|
return "https:/\/api-optimistic.etherscan.io";
|
||||||
|
case "optimism-goerli":
|
||||||
|
return "https:/\/api-goerli-optimistic.etherscan.io";
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
(0, index_js_4.assertArgument)(false, "unsupported network", "network", this.network);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the URL for the %%module%% and %%params%%.
|
||||||
|
*/
|
||||||
|
getUrl(module, params) {
|
||||||
|
const query = Object.keys(params).reduce((accum, key) => {
|
||||||
|
const value = params[key];
|
||||||
|
if (value != null) {
|
||||||
|
accum += `&${key}=${value}`;
|
||||||
|
}
|
||||||
|
return accum;
|
||||||
|
}, "");
|
||||||
|
const apiKey = ((this.apiKey) ? `&apikey=${this.apiKey}` : "");
|
||||||
|
return `${this.getBaseUrl()}/api?module=${module}${query}${apiKey}`;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the URL for using POST requests.
|
||||||
|
*/
|
||||||
|
getPostUrl() {
|
||||||
|
return `${this.getBaseUrl()}/api`;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the parameters for using POST requests.
|
||||||
|
*/
|
||||||
|
getPostData(module, params) {
|
||||||
|
params.module = module;
|
||||||
|
params.apikey = this.apiKey;
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
async detectNetwork() {
|
||||||
|
return this.network;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Resolves to the result of calling %%module%% with %%params%%.
|
||||||
|
*
|
||||||
|
* If %%post%%, the request is made as a POST request.
|
||||||
|
*/
|
||||||
|
async fetch(module, params, post) {
|
||||||
|
const id = nextId++;
|
||||||
|
const url = (post ? this.getPostUrl() : this.getUrl(module, params));
|
||||||
|
const payload = (post ? this.getPostData(module, params) : null);
|
||||||
|
this.emit("debug", { action: "sendRequest", id, url, payload: payload });
|
||||||
|
const request = new index_js_4.FetchRequest(url);
|
||||||
|
request.setThrottleParams({ slotInterval: 1000 });
|
||||||
|
request.retryFunc = (req, resp, attempt) => {
|
||||||
|
if (this.isCommunityResource()) {
|
||||||
|
(0, community_js_1.showThrottleMessage)("Etherscan");
|
||||||
|
}
|
||||||
|
return Promise.resolve(true);
|
||||||
|
};
|
||||||
|
request.processFunc = async (request, response) => {
|
||||||
|
const result = response.hasBody() ? JSON.parse((0, index_js_4.toUtf8String)(response.body)) : {};
|
||||||
|
const throttle = ((typeof (result.result) === "string") ? result.result : "").toLowerCase().indexOf("rate limit") >= 0;
|
||||||
|
if (module === "proxy") {
|
||||||
|
// This JSON response indicates we are being throttled
|
||||||
|
if (result && result.status == 0 && result.message == "NOTOK" && throttle) {
|
||||||
|
this.emit("debug", { action: "receiveError", id, reason: "proxy-NOTOK", error: result });
|
||||||
|
response.throwThrottleError(result.result, THROTTLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (throttle) {
|
||||||
|
this.emit("debug", { action: "receiveError", id, reason: "null result", error: result.result });
|
||||||
|
response.throwThrottleError(result.result, THROTTLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
};
|
||||||
|
if (payload) {
|
||||||
|
request.setHeader("content-type", "application/x-www-form-urlencoded; charset=UTF-8");
|
||||||
|
request.body = Object.keys(payload).map((k) => `${k}=${payload[k]}`).join("&");
|
||||||
|
}
|
||||||
|
const response = await request.send();
|
||||||
|
try {
|
||||||
|
response.assertOk();
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
this.emit("debug", { action: "receiveError", id, error, reason: "assertOk" });
|
||||||
|
(0, index_js_4.assert)(false, "response error", "SERVER_ERROR", { request, response });
|
||||||
|
}
|
||||||
|
if (!response.hasBody()) {
|
||||||
|
this.emit("debug", { action: "receiveError", id, error: "missing body", reason: "null body" });
|
||||||
|
(0, index_js_4.assert)(false, "missing response", "SERVER_ERROR", { request, response });
|
||||||
|
}
|
||||||
|
const result = JSON.parse((0, index_js_4.toUtf8String)(response.body));
|
||||||
|
if (module === "proxy") {
|
||||||
|
if (result.jsonrpc != "2.0") {
|
||||||
|
this.emit("debug", { action: "receiveError", id, result, reason: "invalid JSON-RPC" });
|
||||||
|
(0, index_js_4.assert)(false, "invalid JSON-RPC response (missing jsonrpc='2.0')", "SERVER_ERROR", { request, response, info: { result } });
|
||||||
|
}
|
||||||
|
if (result.error) {
|
||||||
|
this.emit("debug", { action: "receiveError", id, result, reason: "JSON-RPC error" });
|
||||||
|
(0, index_js_4.assert)(false, "error response", "SERVER_ERROR", { request, response, info: { result } });
|
||||||
|
}
|
||||||
|
this.emit("debug", { action: "receiveRequest", id, result });
|
||||||
|
return result.result;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// getLogs, getHistory have weird success responses
|
||||||
|
if (result.status == 0 && (result.message === "No records found" || result.message === "No transactions found")) {
|
||||||
|
this.emit("debug", { action: "receiveRequest", id, result });
|
||||||
|
return result.result;
|
||||||
|
}
|
||||||
|
if (result.status != 1 || (typeof (result.message) === "string" && !result.message.match(/^OK/))) {
|
||||||
|
this.emit("debug", { action: "receiveError", id, result });
|
||||||
|
(0, index_js_4.assert)(false, "error response", "SERVER_ERROR", { request, response, info: { result } });
|
||||||
|
}
|
||||||
|
this.emit("debug", { action: "receiveRequest", id, result });
|
||||||
|
return result.result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns %%transaction%% normalized for the Etherscan API.
|
||||||
|
*/
|
||||||
|
_getTransactionPostData(transaction) {
|
||||||
|
const result = {};
|
||||||
|
for (let key in transaction) {
|
||||||
|
if (transaction[key] == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let value = transaction[key];
|
||||||
|
if (key === "type" && value === 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Quantity-types require no leading zero, unless 0
|
||||||
|
if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) {
|
||||||
|
value = (0, index_js_4.toQuantity)(value);
|
||||||
|
}
|
||||||
|
else if (key === "accessList") {
|
||||||
|
value = "[" + (0, index_js_3.accessListify)(value).map((set) => {
|
||||||
|
return `{address:"${set.address}",storageKeys:["${set.storageKeys.join('","')}"]}`;
|
||||||
|
}).join(",") + "]";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
value = (0, index_js_4.hexlify)(value);
|
||||||
|
}
|
||||||
|
result[key] = value;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Throws the normalized Etherscan error.
|
||||||
|
*/
|
||||||
|
_checkError(req, error, transaction) {
|
||||||
|
// Pull any message out if, possible
|
||||||
|
let message = "";
|
||||||
|
if ((0, index_js_4.isError)(error, "SERVER_ERROR")) {
|
||||||
|
// Check for an error emitted by a proxy call
|
||||||
|
try {
|
||||||
|
message = error.info.result.error.message;
|
||||||
|
}
|
||||||
|
catch (e) { }
|
||||||
|
if (!message) {
|
||||||
|
try {
|
||||||
|
message = error.info.message;
|
||||||
|
}
|
||||||
|
catch (e) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (req.method === "estimateGas") {
|
||||||
|
if (!message.match(/revert/i) && message.match(/insufficient funds/i)) {
|
||||||
|
(0, index_js_4.assert)(false, "insufficient funds", "INSUFFICIENT_FUNDS", {
|
||||||
|
transaction: req.transaction
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (req.method === "call" || req.method === "estimateGas") {
|
||||||
|
if (message.match(/execution reverted/i)) {
|
||||||
|
let data = "";
|
||||||
|
try {
|
||||||
|
data = error.info.result.error.data;
|
||||||
|
}
|
||||||
|
catch (error) { }
|
||||||
|
const e = index_js_1.AbiCoder.getBuiltinCallException(req.method, req.transaction, data);
|
||||||
|
e.info = { request: req, error };
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (message) {
|
||||||
|
if (req.method === "broadcastTransaction") {
|
||||||
|
const transaction = index_js_3.Transaction.from(req.signedTransaction);
|
||||||
|
if (message.match(/replacement/i) && message.match(/underpriced/i)) {
|
||||||
|
(0, index_js_4.assert)(false, "replacement fee too low", "REPLACEMENT_UNDERPRICED", {
|
||||||
|
transaction
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (message.match(/insufficient funds/)) {
|
||||||
|
(0, index_js_4.assert)(false, "insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", {
|
||||||
|
transaction
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) {
|
||||||
|
(0, index_js_4.assert)(false, "nonce has already been used", "NONCE_EXPIRED", {
|
||||||
|
transaction
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Something we could not process
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
async _detectNetwork() {
|
||||||
|
return this.network;
|
||||||
|
}
|
||||||
|
async _perform(req) {
|
||||||
|
switch (req.method) {
|
||||||
|
case "chainId":
|
||||||
|
return this.network.chainId;
|
||||||
|
case "getBlockNumber":
|
||||||
|
return this.fetch("proxy", { action: "eth_blockNumber" });
|
||||||
|
case "getGasPrice":
|
||||||
|
return this.fetch("proxy", { action: "eth_gasPrice" });
|
||||||
|
case "getBalance":
|
||||||
|
// Returns base-10 result
|
||||||
|
return this.fetch("account", {
|
||||||
|
action: "balance",
|
||||||
|
address: req.address,
|
||||||
|
tag: req.blockTag
|
||||||
|
});
|
||||||
|
case "getTransactionCount":
|
||||||
|
return this.fetch("proxy", {
|
||||||
|
action: "eth_getTransactionCount",
|
||||||
|
address: req.address,
|
||||||
|
tag: req.blockTag
|
||||||
|
});
|
||||||
|
case "getCode":
|
||||||
|
return this.fetch("proxy", {
|
||||||
|
action: "eth_getCode",
|
||||||
|
address: req.address,
|
||||||
|
tag: req.blockTag
|
||||||
|
});
|
||||||
|
case "getStorage":
|
||||||
|
return this.fetch("proxy", {
|
||||||
|
action: "eth_getStorageAt",
|
||||||
|
address: req.address,
|
||||||
|
position: req.position,
|
||||||
|
tag: req.blockTag
|
||||||
|
});
|
||||||
|
case "broadcastTransaction":
|
||||||
|
return this.fetch("proxy", {
|
||||||
|
action: "eth_sendRawTransaction",
|
||||||
|
hex: req.signedTransaction
|
||||||
|
}, true).catch((error) => {
|
||||||
|
return this._checkError(req, error, req.signedTransaction);
|
||||||
|
});
|
||||||
|
case "getBlock":
|
||||||
|
if ("blockTag" in req) {
|
||||||
|
return this.fetch("proxy", {
|
||||||
|
action: "eth_getBlockByNumber",
|
||||||
|
tag: req.blockTag,
|
||||||
|
boolean: (req.includeTransactions ? "true" : "false")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
(0, index_js_4.assert)(false, "getBlock by blockHash not supported by Etherscan", "UNSUPPORTED_OPERATION", {
|
||||||
|
operation: "getBlock(blockHash)"
|
||||||
|
});
|
||||||
|
case "getTransaction":
|
||||||
|
return this.fetch("proxy", {
|
||||||
|
action: "eth_getTransactionByHash",
|
||||||
|
txhash: req.hash
|
||||||
|
});
|
||||||
|
case "getTransactionReceipt":
|
||||||
|
return this.fetch("proxy", {
|
||||||
|
action: "eth_getTransactionReceipt",
|
||||||
|
txhash: req.hash
|
||||||
|
});
|
||||||
|
case "call": {
|
||||||
|
if (req.blockTag !== "latest") {
|
||||||
|
throw new Error("EtherscanProvider does not support blockTag for call");
|
||||||
|
}
|
||||||
|
const postData = this._getTransactionPostData(req.transaction);
|
||||||
|
postData.module = "proxy";
|
||||||
|
postData.action = "eth_call";
|
||||||
|
try {
|
||||||
|
return await this.fetch("proxy", postData, true);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
return this._checkError(req, error, req.transaction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case "estimateGas": {
|
||||||
|
const postData = this._getTransactionPostData(req.transaction);
|
||||||
|
postData.module = "proxy";
|
||||||
|
postData.action = "eth_estimateGas";
|
||||||
|
try {
|
||||||
|
return await this.fetch("proxy", postData, true);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
return this._checkError(req, error, req.transaction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
case "getLogs": {
|
||||||
|
// Needs to complain if more than one address is passed in
|
||||||
|
const args: Record<string, any> = { action: "getLogs" }
|
||||||
|
|
||||||
|
if (params.filter.fromBlock) {
|
||||||
|
args.fromBlock = checkLogTag(params.filter.fromBlock);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.filter.toBlock) {
|
||||||
|
args.toBlock = checkLogTag(params.filter.toBlock);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.filter.address) {
|
||||||
|
args.address = params.filter.address;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @TODO: We can handle slightly more complicated logs using the logs API
|
||||||
|
if (params.filter.topics && params.filter.topics.length > 0) {
|
||||||
|
if (params.filter.topics.length > 1) {
|
||||||
|
logger.throwError("unsupported topic count", Logger.Errors.UNSUPPORTED_OPERATION, { topics: params.filter.topics });
|
||||||
|
}
|
||||||
|
if (params.filter.topics.length === 1) {
|
||||||
|
const topic0 = params.filter.topics[0];
|
||||||
|
if (typeof(topic0) !== "string" || topic0.length !== 66) {
|
||||||
|
logger.throwError("unsupported topic format", Logger.Errors.UNSUPPORTED_OPERATION, { topic0: topic0 });
|
||||||
|
}
|
||||||
|
args.topic0 = topic0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const logs: Array<any> = await this.fetch("logs", args);
|
||||||
|
|
||||||
|
// Cache txHash => blockHash
|
||||||
|
let blocks: { [tag: string]: string } = {};
|
||||||
|
|
||||||
|
// Add any missing blockHash to the logs
|
||||||
|
for (let i = 0; i < logs.length; i++) {
|
||||||
|
const log = logs[i];
|
||||||
|
if (log.blockHash != null) { continue; }
|
||||||
|
if (blocks[log.blockNumber] == null) {
|
||||||
|
const block = await this.getBlock(log.blockNumber);
|
||||||
|
if (block) {
|
||||||
|
blocks[log.blockNumber] = block.hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.blockHash = blocks[log.blockNumber];
|
||||||
|
}
|
||||||
|
|
||||||
|
return logs;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return super._perform(req);
|
||||||
|
}
|
||||||
|
async getNetwork() {
|
||||||
|
return this.network;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Resolves to the current price of ether.
|
||||||
|
*
|
||||||
|
* This returns ``0`` on any network other than ``mainnet``.
|
||||||
|
*/
|
||||||
|
async getEtherPrice() {
|
||||||
|
if (this.network.name !== "mainnet") {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
return parseFloat((await this.fetch("stats", { action: "ethprice" })).ethusd);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Resolves to a [Contract]] for %%address%%, using the
|
* Resolves to a [Contract]] for %%address%%, using the
|
||||||
* Etherscan API to retreive the Contract ABI.
|
* Etherscan API to retreive the Contract ABI.
|
||||||
@ -45,14 +477,19 @@ class EtherscanProvider extends provider_etherscan_base_js_1.BaseEtherscanProvid
|
|||||||
address = await address;
|
address = await address;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const resp = await this.fetch("contract", { action: "getabi", address });
|
const resp = await this.fetch("contract", {
|
||||||
|
action: "getabi", address
|
||||||
|
});
|
||||||
const abi = JSON.parse(resp);
|
const abi = JSON.parse(resp);
|
||||||
return new index_js_1.Contract(address, abi, this);
|
return new index_js_2.Contract(address, abi, this);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isCommunityResource() {
|
||||||
|
return (this.apiKey == null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports.EtherscanProvider = EtherscanProvider;
|
exports.EtherscanProvider = EtherscanProvider;
|
||||||
//# sourceMappingURL=provider-etherscan.js.map
|
//# sourceMappingURL=provider-etherscan.js.map
|
File diff suppressed because one or more lines are too long
@ -1,101 +1,109 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
/*
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
import { defineProperties } from "../utils/properties.js";
|
exports.PocketProvider = void 0;
|
||||||
import { FetchRequest } from "../web/index.js";
|
/**
|
||||||
|
* [[link-pocket]] provides a third-party service for connecting to
|
||||||
import { showThrottleMessage } from "./community.js";
|
* various blockchains over JSON-RPC.
|
||||||
import { logger } from "../utils/logger.js";
|
*
|
||||||
import { Network } from "./network.js";
|
* **Supported Networks**
|
||||||
import { JsonRpcProvider } from "./provider-jsonrpc.js";
|
*
|
||||||
|
* - Ethereum Mainnet (``mainnet``)
|
||||||
import type { ConnectionInfo, ThrottleRetryFunc } from "../web/index.js";
|
* - Goerli Testnet (``goerli``)
|
||||||
|
* - Polygon (``matic``)
|
||||||
import type { CommunityResourcable } from "./community.js";
|
* - Arbitrum (``arbitrum``)
|
||||||
import type { Networkish } from "./network.js";
|
*
|
||||||
|
* @_subsection: api/providers/thirdparty:Pocket [providers-pocket]
|
||||||
|
*/
|
||||||
|
const index_js_1 = require("../utils/index.js");
|
||||||
// These are load-balancer-based application IDs
|
const community_js_1 = require("./community.js");
|
||||||
const defaultAppIds: Record<string, string> = {
|
const network_js_1 = require("./network.js");
|
||||||
homestead: "6004bcd10040261633ade990",
|
const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js");
|
||||||
ropsten: "6004bd4d0040261633ade991",
|
const defaultApplicationId = "62e1ad51b37b8e00394bda3b";
|
||||||
rinkeby: "6004bda20040261633ade994",
|
function getHost(name) {
|
||||||
goerli: "6004bd860040261633ade992",
|
|
||||||
};
|
|
||||||
|
|
||||||
function getHost(name: string): string {
|
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "homestead":
|
case "mainnet":
|
||||||
return "eth-mainnet.gateway.pokt.network";
|
return "eth-mainnet.gateway.pokt.network";
|
||||||
case "ropsten":
|
|
||||||
return "eth-ropsten.gateway.pokt.network";
|
|
||||||
case "rinkeby":
|
|
||||||
return "eth-rinkeby.gateway.pokt.network";
|
|
||||||
case "goerli":
|
case "goerli":
|
||||||
return "eth-goerli.gateway.pokt.network";
|
return "eth-goerli.gateway.pokt.network";
|
||||||
|
case "matic":
|
||||||
|
return "poly-mainnet.gateway.pokt.network";
|
||||||
|
case "maticmum":
|
||||||
|
return "polygon-mumbai-rpc.gateway.pokt.network";
|
||||||
}
|
}
|
||||||
|
(0, index_js_1.assertArgument)(false, "unsupported network", "network", name);
|
||||||
return logger.throwArgumentError("unsupported network", "network", name);
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
function normalizeApiKey(network: Network, _appId?: null | string, applicationSecretKey?: null | string, loadBalancer?: boolean): { applicationId: string, applicationSecretKey: null | string, loadBalancer: boolean, community: boolean } {
|
* The **PocketProvider** connects to the [[link-pocket]]
|
||||||
loadBalancer = !!loadBalancer;
|
* JSON-RPC end-points.
|
||||||
|
*
|
||||||
let community = false;
|
* By default, a highly-throttled API key is used, which is
|
||||||
let applicationId = _appId;
|
* appropriate for quick prototypes and simple scripts. To
|
||||||
|
* gain access to an increased rate-limit, it is highly
|
||||||
|
* recommended to [sign up here](link-pocket-signup).
|
||||||
|
*/
|
||||||
|
class PocketProvider extends provider_jsonrpc_js_1.JsonRpcProvider {
|
||||||
|
/**
|
||||||
|
* The Application ID for the Pocket connection.
|
||||||
|
*/
|
||||||
|
applicationId;
|
||||||
|
/**
|
||||||
|
* The Application Secret for making authenticated requests
|
||||||
|
* to the Pocket connection.
|
||||||
|
*/
|
||||||
|
applicationSecret;
|
||||||
|
/**
|
||||||
|
* Create a new **PocketProvider**.
|
||||||
|
*
|
||||||
|
* By default connecting to ``mainnet`` with a highly throttled
|
||||||
|
* API key.
|
||||||
|
*/
|
||||||
|
constructor(_network, applicationId, applicationSecret) {
|
||||||
|
if (_network == null) {
|
||||||
|
_network = "mainnet";
|
||||||
|
}
|
||||||
|
const network = network_js_1.Network.from(_network);
|
||||||
if (applicationId == null) {
|
if (applicationId == null) {
|
||||||
applicationId = defaultAppIds[network.name];
|
applicationId = defaultApplicationId;
|
||||||
|
}
|
||||||
|
if (applicationSecret == null) {
|
||||||
|
applicationSecret = null;
|
||||||
|
}
|
||||||
|
const options = { staticNetwork: network };
|
||||||
|
const request = PocketProvider.getRequest(network, applicationId, applicationSecret);
|
||||||
|
super(request, network, options);
|
||||||
|
(0, index_js_1.defineProperties)(this, { applicationId, applicationSecret });
|
||||||
|
}
|
||||||
|
_getProvider(chainId) {
|
||||||
|
try {
|
||||||
|
return new PocketProvider(chainId, this.applicationId, this.applicationSecret);
|
||||||
|
}
|
||||||
|
catch (error) { }
|
||||||
|
return super._getProvider(chainId);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns a prepared request for connecting to %%network%% with
|
||||||
|
* %%applicationId%%.
|
||||||
|
*/
|
||||||
|
static getRequest(network, applicationId, applicationSecret) {
|
||||||
if (applicationId == null) {
|
if (applicationId == null) {
|
||||||
logger.throwArgumentError("network does not support default applicationId", "applicationId", _appId);
|
applicationId = defaultApplicationId;
|
||||||
}
|
}
|
||||||
loadBalancer = true;
|
const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/v1/lb/${applicationId}`);
|
||||||
community = true;
|
|
||||||
} else if (applicationId === defaultAppIds[network.name]) {
|
|
||||||
loadBalancer = true;
|
|
||||||
community = true;
|
|
||||||
}
|
|
||||||
if (applicationSecretKey == null) { applicationSecretKey = null; }
|
|
||||||
|
|
||||||
return { applicationId, applicationSecretKey, community, loadBalancer };
|
|
||||||
}
|
|
||||||
|
|
||||||
export class PocketProvider extends JsonRpcProvider implements CommunityResourcable {
|
|
||||||
readonly applicationId!: string;
|
|
||||||
readonly applicationSecretKey!: null | string;
|
|
||||||
readonly loadBalancer!: boolean;
|
|
||||||
|
|
||||||
constructor(_network: Networkish = "homestead", _appId?: null | string, _secretKey?: null | string, _loadBalancer?: boolean) {
|
|
||||||
const network = Network.from(_network);
|
|
||||||
const { applicationId, applicationSecretKey, loadBalancer } = normalizeApiKey(network, _appId, _secretKey, _loadBalancer);
|
|
||||||
|
|
||||||
const connection = PocketProvider.getConnection(network, applicationId, applicationSecretKey, loadBalancer);
|
|
||||||
super(connection, network, { staticNetwork: network });
|
|
||||||
|
|
||||||
defineProperties<PocketProvider>(this, { applicationId, applicationSecretKey, loadBalancer });
|
|
||||||
}
|
|
||||||
|
|
||||||
static getConnection(network: Network, _appId?: null | string, _secretKey?: null | string, _loadBalancer?: boolean): ConnectionInfo {
|
|
||||||
const { applicationId, applicationSecretKey, community, loadBalancer } = normalizeApiKey(network, _appId, _secretKey, _loadBalancer);
|
|
||||||
|
|
||||||
let url = `https:/\/${ getHost(network.name) }/v1/`;
|
|
||||||
if (loadBalancer) { url += "lb/"; }
|
|
||||||
url += applicationId;
|
|
||||||
|
|
||||||
const request = new FetchRequest(url);
|
|
||||||
request.allowGzip = true;
|
request.allowGzip = true;
|
||||||
if (applicationSecretKey) { request.setCredentials("", applicationSecretKey); }
|
if (applicationSecret) {
|
||||||
|
request.setCredentials("", applicationSecret);
|
||||||
const throttleRetry: ThrottleRetryFunc = async (request, response, attempt) => {
|
}
|
||||||
if (community) { showThrottleMessage("PocketProvider"); }
|
if (applicationId === defaultApplicationId) {
|
||||||
|
request.retryFunc = async (request, response, attempt) => {
|
||||||
|
(0, community_js_1.showThrottleMessage)("PocketProvider");
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
return { request, throttleRetry };
|
|
||||||
}
|
}
|
||||||
|
return request;
|
||||||
isCommunityResource(): boolean {
|
}
|
||||||
return (this.applicationId === defaultAppIds[this.network.name]);
|
isCommunityResource() {
|
||||||
|
return (this.applicationId === defaultApplicationId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
exports.PocketProvider = PocketProvider;
|
||||||
//# sourceMappingURL=provider-pocket.js.map
|
//# sourceMappingURL=provider-pocket.js.map
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"provider-pocket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-pocket.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
exports.NonceManager = void 0;
|
||||||
|
const index_js_1 = require("../utils/index.js");
|
||||||
|
const abstract_signer_js_1 = require("./abstract-signer.js");
|
||||||
|
class NonceManager extends abstract_signer_js_1.AbstractSigner {
|
||||||
|
signer;
|
||||||
|
#noncePromise;
|
||||||
|
#delta;
|
||||||
|
constructor(signer) {
|
||||||
|
super(signer.provider);
|
||||||
|
(0, index_js_1.defineProperties)(this, { signer });
|
||||||
|
this.#noncePromise = null;
|
||||||
|
this.#delta = 0;
|
||||||
|
}
|
||||||
|
async getAddress() {
|
||||||
|
return this.signer.getAddress();
|
||||||
|
}
|
||||||
|
connect(provider) {
|
||||||
|
return new NonceManager(this.signer.connect(provider));
|
||||||
|
}
|
||||||
|
async getNonce(blockTag) {
|
||||||
|
if (blockTag === "pending") {
|
||||||
|
if (this.#noncePromise == null) {
|
||||||
|
this.#noncePromise = super.getNonce("pending");
|
||||||
|
}
|
||||||
|
return (await this.#noncePromise) + this.#delta;
|
||||||
|
}
|
||||||
|
return super.getNonce(blockTag);
|
||||||
|
}
|
||||||
|
increment() {
|
||||||
|
this.#delta++;
|
||||||
|
}
|
||||||
|
reset() {
|
||||||
|
this.#delta = 0;
|
||||||
|
this.#noncePromise = null;
|
||||||
|
}
|
||||||
|
async sendTransaction(tx) {
|
||||||
|
const noncePromise = this.getNonce("pending");
|
||||||
|
this.increment();
|
||||||
|
tx = await this.signer.populateTransaction(tx);
|
||||||
|
tx.nonce = await noncePromise;
|
||||||
|
// @TODO: Maybe handle interesting/recoverable errors?
|
||||||
|
// Like don't increment if the tx was certainly not sent
|
||||||
|
return await this.signer.sendTransaction(tx);
|
||||||
|
}
|
||||||
|
signTransaction(tx) {
|
||||||
|
return this.signer.signTransaction(tx);
|
||||||
|
}
|
||||||
|
signMessage(message) {
|
||||||
|
return this.signer.signMessage(message);
|
||||||
|
}
|
||||||
|
signTypedData(domain, types, value) {
|
||||||
|
return this.signer.signTypedData(domain, types, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.NonceManager = NonceManager;
|
||||||
|
//# sourceMappingURL=signer-noncemanager.js.map
|
1
lib.commonjs/providers/signer-noncemanager.js.map
Normal file
1
lib.commonjs/providers/signer-noncemanager.js.map
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"signer-noncemanager.js","sourceRoot":"","sources":["../../src.ts/providers/signer-noncemanager.ts"],"names":[],"mappings":";;;AAAA,gDAAqD;AACrD,6DAAsD;AAUtD,MAAa,YAAa,SAAQ,mCAAc;IAC5C,MAAM,CAAU;IAEhB,aAAa,CAAyB;IACtC,MAAM,CAAS;IAEf,YAAY,MAAc;QACtB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvB,IAAA,2BAAgB,EAAe,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QAEjD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,UAAU;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;IACpC,CAAC;IAED,OAAO,CAAC,QAAyB;QAC7B,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,QAAmB;QAC9B,IAAI,QAAQ,KAAK,SAAS,EAAE;YACxB,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,EAAE;gBAC5B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;aAClD;YACD,OAAO,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;SACnD;QAED,OAAO,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAED,SAAS;QACL,IAAI,CAAC,MAAM,EAAE,CAAC;IAClB,CAAC;IAED,KAAK;QACD,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,EAAsB;QACxC,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,CAAC,SAAS,EAAE,CAAC;QAEjB,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;QAC/C,EAAE,CAAC,KAAK,GAAG,MAAM,YAAY,CAAC;QAE9B,sDAAsD;QACtD,wDAAwD;QACxD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,eAAe,CAAC,EAAsB;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,WAAW,CAAC,OAA4B;QACpC,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,aAAa,CAAC,MAAuB,EAAE,KAA4C,EAAE,KAA0B;QAC3G,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;CACJ;AAjED,oCAiEC"}
|
@ -49,6 +49,10 @@ class PollingBlockSubscriber {
|
|||||||
this.#blockNumber = blockNumber;
|
this.#blockNumber = blockNumber;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// We have been stopped
|
||||||
|
if (this.#poller == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// @TODO: Put a cap on the maximum number of events per loop?
|
// @TODO: Put a cap on the maximum number of events per loop?
|
||||||
if (blockNumber !== this.#blockNumber) {
|
if (blockNumber !== this.#blockNumber) {
|
||||||
for (let b = this.#blockNumber + 1; b <= blockNumber; b++) {
|
for (let b = this.#blockNumber + 1; b <= blockNumber; b++) {
|
||||||
@ -62,8 +66,8 @@ class PollingBlockSubscriber {
|
|||||||
if (this.#poller) {
|
if (this.#poller) {
|
||||||
throw new Error("subscriber already running");
|
throw new Error("subscriber already running");
|
||||||
}
|
}
|
||||||
this.#poll();
|
|
||||||
this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval);
|
this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval);
|
||||||
|
this.#poll();
|
||||||
}
|
}
|
||||||
stop() {
|
stop() {
|
||||||
if (!this.#poller) {
|
if (!this.#poller) {
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,4 +1,5 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
/*
|
/*
|
||||||
import { defineProperties } from "@ethersproject/properties";
|
import { defineProperties } from "@ethersproject/properties";
|
||||||
export type EventCommon = "block" | "debug" | "blockObject";
|
export type EventCommon = "block" | "debug" | "blockObject";
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"subscriber.js","sourceRoot":"","sources":["../../src.ts/providers/subscriber.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsDE"}
|
{"version":3,"file":"subscriber.js","sourceRoot":"","sources":["../../src.ts/providers/subscriber.ts"],"names":[],"mappings":";;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsDE"}
|
@ -1,4 +1,4 @@
|
|||||||
"use strict";
|
export {};
|
||||||
/*
|
/*
|
||||||
import semver from "semver";
|
import semver from "semver";
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import { AlchemyProvider, AnkrProvider,
|
import { AlchemyProvider, AnkrProvider,
|
||||||
// CloudflareProvider,
|
// CloudflareProvider,
|
||||||
EtherscanProvider, InfuraProvider,
|
EtherscanProvider, InfuraProvider, PocketProvider, QuickNodeProvider, FallbackProvider, isError, } from "../index.js";
|
||||||
// PocketProvider,
|
|
||||||
QuickNodeProvider, FallbackProvider, isError, } from "../index.js";
|
|
||||||
;
|
;
|
||||||
const ethNetworks = ["default", "mainnet", "goerli"];
|
const ethNetworks = ["default", "mainnet", "goerli"];
|
||||||
//const maticNetworks = [ "matic", "maticmum" ];
|
//const maticNetworks = [ "matic", "maticmum" ];
|
||||||
@ -51,21 +49,13 @@ const ProviderCreators = [
|
|||||||
return InfuraProvider.getWebSocketProvider(network, "49a0efa3aaee4fd99797bfa94d8ce2f1");
|
return InfuraProvider.getWebSocketProvider(network, "49a0efa3aaee4fd99797bfa94d8ce2f1");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
{
|
{
|
||||||
name: "PocketProvider",
|
name: "PocketProvider",
|
||||||
networks: ethNetworks,
|
networks: ethNetworks,
|
||||||
create: function(network: string) {
|
create: function (network) {
|
||||||
const apiKeys: Record<string, string> = {
|
return new PocketProvider(network);
|
||||||
mainnet: "6004bcd10040261633ade990",
|
|
||||||
ropsten: "6004bd4d0040261633ade991",
|
|
||||||
rinkeby: "6004bda20040261633ade994",
|
|
||||||
goerli: "6004bd860040261633ade992",
|
|
||||||
};
|
|
||||||
return new PocketProvider(network, apiKeys[network]);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
name: "QuickNodeProvider",
|
name: "QuickNodeProvider",
|
||||||
networks: ethNetworks,
|
networks: ethNetworks,
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"create-provider.js","sourceRoot":"","sources":["../../src.ts/_tests/create-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,eAAe,EACf,YAAY;AAChB,yBAAyB;AACrB,iBAAiB,EACjB,cAAc;AAClB,qBAAqB;AACjB,i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O,CAAC,KAAK,EAAE,kBAAkB,CAAC,EAAE;YAAE,MAAM,KAAK,CAAC;SAAE;KAC5D;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,QAAgB,EAAE,OAAe;IAC3D,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IACrC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,OAAe;IACnC,MAAM,QAAQ,GAAG,WAAW,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACxD,IAAI,QAAQ,IAAI,IAAI,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,wBAAyB,OAAQ,EAAE,CAAC,CAAC;KAAE;IAC/E,OAAO,QAAQ,CAAC;AACpB,CAAC"}
|
@ -1,5 +1,6 @@
|
|||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
import { connect } from "./create-provider.js";
|
import { connect, setupProviders } from "./create-provider.js";
|
||||||
|
setupProviders();
|
||||||
describe("Resolve ENS avatar", function () {
|
describe("Resolve ENS avatar", function () {
|
||||||
[
|
[
|
||||||
{ title: "data", name: "data-avatar.tests.ethers.eth", value: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAMAAACeL25MAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyVpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDYuMC1jMDAyIDc5LjE2NDQ4OCwgMjAyMC8wNy8xMC0yMjowNjo1MyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3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URQAA/wAAAHtivz4AAAAOSURBVHjaYmDABAABBgAAFAABaEkyYwAAAABJRU5ErkJggg==" },
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"test-providers-avatar.js","sourceRoot":"","sources":["../../src.ts/_tests/test-providers-avatar.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,QAAQ,CAAC,oBAAoB,EAAE;IAC3B;QACI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B,EAAE,KAAK,EAAE,owCAAowC,EAAE;QACp0C,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B,EAAE,KAAK,EAAE,8EAA8E,EAAE;QAC9I,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,6BAA6B,EAAE,KAAK,EAAE,qCAAqC,EAAE;KACtG,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACf,EAAE,CAAC,uBAAwB,IAAI,CAAC,KAAM,EAAE,EAAE,KAAK;YAC3C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;YACnC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACP;;;;;;;;;;;;;MAaE;AACF,CAAC,CAAC,CAAC"}
|
{"version":3,"file":"test-providers-avatar.js","sourceRoot":"","sources":["../../src.ts/_tests/test-providers-avatar.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE/D,cAAc,EAAE,CAAC;AAEjB,QAAQ,CAAC,oBAAoB,EAAE;IAC3B;QACI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B,EAAE,KAAK,EAAE,owCAAowC,EAAE;QACp0C,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B,EAAE,KAAK,EAAE,8EAA8E,EAAE;QAC9I,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,6BAA6B,EAAE,KAAK,EAAE,qCAAqC,EAAE;KACtG,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACf,EAAE,CAAC,uBAAwB,IAAI,CAAC,KAAM,EAAE,EAAE,KAAK;YAC3C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;YACnC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACP;;;;;;;;;;;;;MAaE;AACF,CAAC,CAAC,CAAC"}
|
@ -1,6 +1,7 @@
|
|||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
import { concat, dataLength, keccak256, toBeArray, isCallException, isError } from "../index.js";
|
import { concat, dataLength, keccak256, toBeArray, isCallException, isError } from "../index.js";
|
||||||
import { connect } from "./create-provider.js";
|
import { connect, setupProviders } from "./create-provider.js";
|
||||||
|
setupProviders();
|
||||||
describe("Test CCIP execution", function () {
|
describe("Test CCIP execution", function () {
|
||||||
// This matches the verify method in the Solidity contract against the
|
// This matches the verify method in the Solidity contract against the
|
||||||
// processed data from the endpoint
|
// processed data from the endpoint
|
||||||
|
@ -1 +1 @@
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AAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,KAAK;QAC9C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAEpB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEnC,sCAAsC;QACtC,MAAM,EAAE,GAAG;YACP,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI;YACjC,IAAI,EAAE,4MAA4M;SACrN,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAA"}
|
@ -1,5 +1,6 @@
|
|||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
import { connect } from "./create-provider.js";
|
import { connect, setupProviders } from "./create-provider.js";
|
||||||
|
setupProviders();
|
||||||
describe("Test EIP-2544 ENS wildcards", function () {
|
describe("Test EIP-2544 ENS wildcards", function () {
|
||||||
const provider = connect("goerli");
|
const provider = connect("goerli");
|
||||||
it("Resolves recursively", async function () {
|
it("Resolves recursively", async function () {
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"test-providers-wildcard.js","sourceRoot":"","sources":["../../src.ts/_tests/test-providers-wildcard.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,QAAQ,CAAC,6BAA6B,EAAE;IACpC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEnC,EAAE,CAAC,sBAAsB,EAAE,KAAK;QAC5B,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;QAClE,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC;QAE9C,MAA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CAAC,CAAC;QAEvH,MAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,UAAU,EAAE,EAAE,4CAA4C,EAAE,cAAc,CAAC,CAAC;IAC5G,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
@ -1,2 +1,2 @@
|
|||||||
export const version = "6.0.0-beta-exports.15";
|
export const version = "6.0.0-beta-exports.16";
|
||||||
//# sourceMappingURL=_version.js.map
|
//# sourceMappingURL=_version.js.map
|
@ -897,6 +897,11 @@ export class EventFragment extends NamedFragment {
|
|||||||
}
|
}
|
||||||
return result.join(" ");
|
return result.join(" ");
|
||||||
}
|
}
|
||||||
|
static getTopicHash(name, params) {
|
||||||
|
params = (params || []).map((p) => ParamType.from(p));
|
||||||
|
const fragment = new EventFragment(_guard, name, params, false);
|
||||||
|
return fragment.topicHash;
|
||||||
|
}
|
||||||
static from(obj) {
|
static from(obj) {
|
||||||
if (EventFragment.isFragment(obj)) {
|
if (EventFragment.isFragment(obj)) {
|
||||||
return obj;
|
return obj;
|
||||||
@ -1120,6 +1125,11 @@ export class FunctionFragment extends NamedFragment {
|
|||||||
}
|
}
|
||||||
return result.join(" ");
|
return result.join(" ");
|
||||||
}
|
}
|
||||||
|
static getSelector(name, params) {
|
||||||
|
params = (params || []).map((p) => ParamType.from(p));
|
||||||
|
const fragment = new FunctionFragment(_guard, name, "view", params, [], null);
|
||||||
|
return fragment.selector;
|
||||||
|
}
|
||||||
static from(obj) {
|
static from(obj) {
|
||||||
if (FunctionFragment.isFragment(obj)) {
|
if (FunctionFragment.isFragment(obj)) {
|
||||||
return obj;
|
return obj;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -7,9 +7,7 @@ export { ZeroAddress, WeiPerEther, MaxUint256, MinInt256, MaxInt256, N, ZeroHash
|
|||||||
export { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, EventLog, } from "./contract/index.js";
|
export { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, EventLog, } from "./contract/index.js";
|
||||||
export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, lock, Signature, SigningKey } from "./crypto/index.js";
|
export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, lock, Signature, SigningKey } from "./crypto/index.js";
|
||||||
export { id, ensNormalize, isValidName, namehash, dnsEncode, hashMessage, verifyMessage, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, TypedDataEncoder } from "./hash/index.js";
|
export { id, ensNormalize, isValidName, namehash, dnsEncode, hashMessage, verifyMessage, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, TypedDataEncoder } from "./hash/index.js";
|
||||||
export { getDefaultProvider, Block, FeeData, Log, TransactionReceipt, TransactionResponse, AbstractSigner, VoidSigner, AbstractProvider, FallbackProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, BrowserProvider, AlchemyProvider, AnkrProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, QuickNodeProvider,
|
export { getDefaultProvider, Block, FeeData, Log, TransactionReceipt, TransactionResponse, AbstractSigner, NonceManager, VoidSigner, AbstractProvider, FallbackProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, BrowserProvider, AlchemyProvider, AnkrProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, PocketProvider, QuickNodeProvider, IpcSocketProvider, SocketProvider, WebSocketProvider, EnsResolver, Network } from "./providers/index.js";
|
||||||
//PocketProvider } from "./provider-pocket.js";
|
|
||||||
IpcSocketProvider, SocketProvider, WebSocketProvider, EnsResolver, Network } from "./providers/index.js";
|
|
||||||
export { accessListify, computeAddress, recoverAddress, Transaction } from "./transaction/index.js";
|
export { accessListify, computeAddress, recoverAddress, Transaction } from "./transaction/index.js";
|
||||||
export { decodeBase58, encodeBase58, decodeBase64, encodeBase64, concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify, isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue, defineProperties, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, makeError, isCallException, isError, FetchRequest, FetchResponse, FetchCancelSignal, FixedNumber, getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity, fromTwos, toTwos, mask, formatEther, parseEther, formatUnits, parseUnits, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, decodeRlp, encodeRlp } from "./utils/index.js";
|
export { decodeBase58, encodeBase58, decodeBase64, encodeBase64, concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify, isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue, defineProperties, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, makeError, isCallException, isError, FetchRequest, FetchResponse, FetchCancelSignal, FixedNumber, getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity, fromTwos, toTwos, mask, formatEther, parseEther, formatUnits, parseUnits, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, decodeRlp, encodeRlp } from "./utils/index.js";
|
||||||
export { Mnemonic, BaseWallet, HDNodeWallet, HDNodeVoidWallet, Wallet, defaultPath, getAccountPath, isCrowdsaleJson, isKeystoreJson, decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./wallet/index.js";
|
export { Mnemonic, BaseWallet, HDNodeWallet, HDNodeVoidWallet, Wallet, defaultPath, getAccountPath, isCrowdsaleJson, isKeystoreJson, decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./wallet/index.js";
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"ethers.js","sourceRoot":"","sources":["../src.ts/ethers.ts"],"names":[],"mappings":"AAEA,6BAA6B;AAC7B,EAAE;AAEF,OAAO,EAAE,OAAO,EAAE,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B,GAC/C,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACH,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAC9C,MAAM,sBAAsB,CAAC"}
|
@ -10,7 +10,10 @@
|
|||||||
// need time to resolve the address. Upon resolving the address, we need to
|
// need time to resolve the address. Upon resolving the address, we need to
|
||||||
// migrate the listener to the static event. We also need to maintain a map
|
// migrate the listener to the static event. We also need to maintain a map
|
||||||
// of Signer/ENS name to address so we can sync respond to listenerCount.
|
// of Signer/ENS name to address so we can sync respond to listenerCount.
|
||||||
import { resolveAddress } from "../address/index.js";
|
import { getAddress, resolveAddress } from "../address/index.js";
|
||||||
|
import { ZeroHash } from "../constants/index.js";
|
||||||
|
import { Contract } from "../contract/index.js";
|
||||||
|
import { namehash } from "../hash/index.js";
|
||||||
import { Transaction } from "../transaction/index.js";
|
import { Transaction } from "../transaction/index.js";
|
||||||
import { concat, dataLength, dataSlice, hexlify, isHexString, getBigInt, getBytes, getNumber, isCallException, makeError, assert, assertArgument, FetchRequest, toBeArray, toQuantity, defineProperties, EventPayload, resolveProperties, toUtf8String } from "../utils/index.js";
|
import { concat, dataLength, dataSlice, hexlify, isHexString, getBigInt, getBytes, getNumber, isCallException, makeError, assert, assertArgument, FetchRequest, toBeArray, toQuantity, defineProperties, EventPayload, resolveProperties, toUtf8String } from "../utils/index.js";
|
||||||
import { EnsResolver } from "./ens-resolver.js";
|
import { EnsResolver } from "./ens-resolver.js";
|
||||||
@ -167,7 +170,7 @@ export class AbstractProvider {
|
|||||||
this.#subs = new Map();
|
this.#subs = new Map();
|
||||||
this.#plugins = new Map();
|
this.#plugins = new Map();
|
||||||
this.#pausedState = null;
|
this.#pausedState = null;
|
||||||
this.#nextTimer = 0;
|
this.#nextTimer = 1;
|
||||||
this.#timers = new Map();
|
this.#timers = new Map();
|
||||||
this.#disableCcipRead = false;
|
this.#disableCcipRead = false;
|
||||||
}
|
}
|
||||||
@ -479,7 +482,7 @@ export class AbstractProvider {
|
|||||||
// We may want to compute this more accurately in the future,
|
// We may want to compute this more accurately in the future,
|
||||||
// using the formula "check if the base fee is correct".
|
// using the formula "check if the base fee is correct".
|
||||||
// See: https://eips.ethereum.org/EIPS/eip-1559
|
// See: https://eips.ethereum.org/EIPS/eip-1559
|
||||||
maxPriorityFeePerGas = BigInt("1500000000");
|
maxPriorityFeePerGas = BigInt("1000000000");
|
||||||
// Allow a network to override their maximum priority fee per gas
|
// Allow a network to override their maximum priority fee per gas
|
||||||
//const priorityFeePlugin = (await this.getNetwork()).getPlugin<MaxPriorityFeePlugin>("org.ethers.plugins.max-priority-fee");
|
//const priorityFeePlugin = (await this.getNetwork()).getPlugin<MaxPriorityFeePlugin>("org.ethers.plugins.max-priority-fee");
|
||||||
//if (priorityFeePlugin) {
|
//if (priorityFeePlugin) {
|
||||||
@ -704,28 +707,38 @@ export class AbstractProvider {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
async resolveName(name) {
|
async resolveName(name) {
|
||||||
if (isHexString(name, 20)) {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
//if (typeof(name) === "string") {
|
|
||||||
const resolver = await this.getResolver(name);
|
const resolver = await this.getResolver(name);
|
||||||
if (resolver) {
|
if (resolver) {
|
||||||
return await resolver.getAddress();
|
return await resolver.getAddress();
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
} else {
|
|
||||||
const address = await name.getAddress();
|
|
||||||
if (address == null) {
|
|
||||||
return logger.throwArgumentError("Addressable returned no address", "name", name);
|
|
||||||
}
|
|
||||||
return address;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
async lookupAddress(address) {
|
async lookupAddress(address) {
|
||||||
throw new Error();
|
address = getAddress(address);
|
||||||
//return "TODO";
|
const node = namehash(address.substring(2).toLowerCase() + ".addr.reverse");
|
||||||
|
try {
|
||||||
|
const ensAddr = await EnsResolver.getEnsAddress(this);
|
||||||
|
const ensContract = new Contract(ensAddr, [
|
||||||
|
"function resolver(bytes32) view returns (address)"
|
||||||
|
], this);
|
||||||
|
const resolver = await ensContract.resolver(node);
|
||||||
|
if (resolver == null || resolver === ZeroHash) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const resolverContract = new Contract(resolver, [
|
||||||
|
"function name(bytes32) view returns (string)"
|
||||||
|
], this);
|
||||||
|
const name = await resolverContract.name(node);
|
||||||
|
const check = await this.resolveName(name);
|
||||||
|
if (check !== address) {
|
||||||
|
console.log("FAIL", address, check);
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.log("TEMP", error);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
async waitForTransaction(hash, _confirms, timeout) {
|
async waitForTransaction(hash, _confirms, timeout) {
|
||||||
const confirms = (_confirms != null) ? _confirms : 1;
|
const confirms = (_confirms != null) ? _confirms : 1;
|
||||||
@ -768,8 +781,9 @@ export class AbstractProvider {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
async waitForBlock(blockTag) {
|
async waitForBlock(blockTag) {
|
||||||
throw new Error();
|
assert(false, "not implemented yet", "NOT_IMPLEMENTED", {
|
||||||
//return new Block(<any><unknown>{ }, this);
|
operation: "waitForBlock"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
_clearTimeout(timerId) {
|
_clearTimeout(timerId) {
|
||||||
const timer = this.#timers.get(timerId);
|
const timer = this.#timers.get(timerId);
|
||||||
@ -888,7 +902,9 @@ export class AbstractProvider {
|
|||||||
}
|
}
|
||||||
async emit(event, ...args) {
|
async emit(event, ...args) {
|
||||||
const sub = await this.#hasSub(event, args);
|
const sub = await this.#hasSub(event, args);
|
||||||
if (!sub) {
|
// If there is not subscription or if a recent emit removed
|
||||||
|
// the last of them (which also deleted the sub) do nothing
|
||||||
|
if (!sub || sub.listeners.length === 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -7,47 +7,47 @@ import { resolveAddress } from "../address/index.js";
|
|||||||
import { Transaction } from "../transaction/index.js";
|
import { Transaction } from "../transaction/index.js";
|
||||||
import { defineProperties, getBigInt, resolveProperties, assert, assertArgument } from "../utils/index.js";
|
import { defineProperties, getBigInt, resolveProperties, assert, assertArgument } from "../utils/index.js";
|
||||||
import { copyRequest } from "./provider.js";
|
import { copyRequest } from "./provider.js";
|
||||||
export class AbstractSigner {
|
function checkProvider(signer, operation) {
|
||||||
provider;
|
if (signer.provider) {
|
||||||
constructor(provider) {
|
return signer.provider;
|
||||||
defineProperties(this, { provider: (provider || null) });
|
|
||||||
}
|
|
||||||
#checkProvider(operation) {
|
|
||||||
if (this.provider) {
|
|
||||||
return this.provider;
|
|
||||||
}
|
}
|
||||||
assert(false, "missing provider", "UNSUPPORTED_OPERATION", { operation });
|
assert(false, "missing provider", "UNSUPPORTED_OPERATION", { operation });
|
||||||
}
|
}
|
||||||
async getNonce(blockTag) {
|
async function populate(signer, tx) {
|
||||||
return this.#checkProvider("getTransactionCount").getTransactionCount(await this.getAddress(), blockTag);
|
|
||||||
}
|
|
||||||
async #populate(tx) {
|
|
||||||
let pop = copyRequest(tx);
|
let pop = copyRequest(tx);
|
||||||
if (pop.to != null) {
|
if (pop.to != null) {
|
||||||
pop.to = resolveAddress(pop.to, this);
|
pop.to = resolveAddress(pop.to, signer);
|
||||||
}
|
}
|
||||||
if (pop.from != null) {
|
if (pop.from != null) {
|
||||||
const from = pop.from;
|
const from = pop.from;
|
||||||
pop.from = Promise.all([
|
pop.from = Promise.all([
|
||||||
this.getAddress(),
|
signer.getAddress(),
|
||||||
resolveAddress(from, this)
|
resolveAddress(from, signer)
|
||||||
]).then(([address, from]) => {
|
]).then(([address, from]) => {
|
||||||
assertArgument(address.toLowerCase() === from.toLowerCase(), "transaction from mismatch", "tx.from", from);
|
assertArgument(address.toLowerCase() === from.toLowerCase(), "transaction from mismatch", "tx.from", from);
|
||||||
return address;
|
return address;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pop.from = this.getAddress();
|
pop.from = signer.getAddress();
|
||||||
}
|
}
|
||||||
return await resolveProperties(pop);
|
return await resolveProperties(pop);
|
||||||
}
|
}
|
||||||
|
export class AbstractSigner {
|
||||||
|
provider;
|
||||||
|
constructor(provider) {
|
||||||
|
defineProperties(this, { provider: (provider || null) });
|
||||||
|
}
|
||||||
|
async getNonce(blockTag) {
|
||||||
|
return checkProvider(this, "getTransactionCount").getTransactionCount(await this.getAddress(), blockTag);
|
||||||
|
}
|
||||||
async populateCall(tx) {
|
async populateCall(tx) {
|
||||||
const pop = await this.#populate(tx);
|
const pop = await populate(this, tx);
|
||||||
return pop;
|
return pop;
|
||||||
}
|
}
|
||||||
async populateTransaction(tx) {
|
async populateTransaction(tx) {
|
||||||
const provider = this.#checkProvider("populateTransaction");
|
const provider = checkProvider(this, "populateTransaction");
|
||||||
const pop = await this.#populate(tx);
|
const pop = await populate(this, tx);
|
||||||
if (pop.nonce == null) {
|
if (pop.nonce == null) {
|
||||||
pop.nonce = await this.getNonce("pending");
|
pop.nonce = await this.getNonce("pending");
|
||||||
}
|
}
|
||||||
@ -151,17 +151,17 @@ export class AbstractSigner {
|
|||||||
return await resolveProperties(pop);
|
return await resolveProperties(pop);
|
||||||
}
|
}
|
||||||
async estimateGas(tx) {
|
async estimateGas(tx) {
|
||||||
return this.#checkProvider("estimateGas").estimateGas(await this.populateCall(tx));
|
return checkProvider(this, "estimateGas").estimateGas(await this.populateCall(tx));
|
||||||
}
|
}
|
||||||
async call(tx) {
|
async call(tx) {
|
||||||
return this.#checkProvider("call").call(await this.populateCall(tx));
|
return checkProvider(this, "call").call(await this.populateCall(tx));
|
||||||
}
|
}
|
||||||
async resolveName(name) {
|
async resolveName(name) {
|
||||||
const provider = this.#checkProvider("resolveName");
|
const provider = checkProvider(this, "resolveName");
|
||||||
return await provider.resolveName(name);
|
return await provider.resolveName(name);
|
||||||
}
|
}
|
||||||
async sendTransaction(tx) {
|
async sendTransaction(tx) {
|
||||||
const provider = this.#checkProvider("sendTransaction");
|
const provider = checkProvider(this, "sendTransaction");
|
||||||
const pop = await this.populateTransaction(tx);
|
const pop = await this.populateTransaction(tx);
|
||||||
delete pop.from;
|
delete pop.from;
|
||||||
const txObj = Transaction.from(pop);
|
const txObj = Transaction.from(pop);
|
||||||
@ -191,47 +191,4 @@ export class VoidSigner extends AbstractSigner {
|
|||||||
this.#throwUnsupported("typed-data", "signTypedData");
|
this.#throwUnsupported("typed-data", "signTypedData");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export class WrappedSigner extends AbstractSigner {
|
|
||||||
#signer;
|
|
||||||
constructor(signer) {
|
|
||||||
super(signer.provider);
|
|
||||||
this.#signer = signer;
|
|
||||||
}
|
|
||||||
async getAddress() {
|
|
||||||
return await this.#signer.getAddress();
|
|
||||||
}
|
|
||||||
connect(provider) {
|
|
||||||
return new WrappedSigner(this.#signer.connect(provider));
|
|
||||||
}
|
|
||||||
async getNonce(blockTag) {
|
|
||||||
return await this.#signer.getNonce(blockTag);
|
|
||||||
}
|
|
||||||
async populateCall(tx) {
|
|
||||||
return await this.#signer.populateCall(tx);
|
|
||||||
}
|
|
||||||
async populateTransaction(tx) {
|
|
||||||
return await this.#signer.populateTransaction(tx);
|
|
||||||
}
|
|
||||||
async estimateGas(tx) {
|
|
||||||
return await this.#signer.estimateGas(tx);
|
|
||||||
}
|
|
||||||
async call(tx) {
|
|
||||||
return await this.#signer.call(tx);
|
|
||||||
}
|
|
||||||
async resolveName(name) {
|
|
||||||
return this.#signer.resolveName(name);
|
|
||||||
}
|
|
||||||
async signTransaction(tx) {
|
|
||||||
return await this.#signer.signTransaction(tx);
|
|
||||||
}
|
|
||||||
async sendTransaction(tx) {
|
|
||||||
return await this.#signer.sendTransaction(tx);
|
|
||||||
}
|
|
||||||
async signMessage(message) {
|
|
||||||
return await this.#signer.signMessage(message);
|
|
||||||
}
|
|
||||||
async signTypedData(domain, types, value) {
|
|
||||||
return await this.#signer.signTypedData(domain, types, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=abstract-signer.js.map
|
//# sourceMappingURL=abstract-signer.js.map
|
File diff suppressed because one or more lines are too long
@ -3,71 +3,10 @@
|
|||||||
*
|
*
|
||||||
* @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver]
|
* @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver]
|
||||||
*/
|
*/
|
||||||
import { getAddress } from "../address/index.js";
|
import { ZeroAddress } from "../constants/index.js";
|
||||||
import { ZeroAddress, ZeroHash } from "../constants/index.js";
|
import { Contract } from "../contract/index.js";
|
||||||
import { dnsEncode, namehash } from "../hash/index.js";
|
import { dnsEncode, namehash } from "../hash/index.js";
|
||||||
import { concat, dataSlice, getBytes, hexlify, zeroPadValue, defineProperties, encodeBase58, getBigInt, toBeArray, toNumber, toUtf8Bytes, toUtf8String, assert, assertArgument, FetchRequest } from "../utils/index.js";
|
import { hexlify, toBeHex, defineProperties, encodeBase58, assert, assertArgument, isError, FetchRequest } from "../utils/index.js";
|
||||||
const BN_1 = BigInt(1);
|
|
||||||
const Empty = new Uint8Array([]);
|
|
||||||
function parseBytes(result, start) {
|
|
||||||
if (result === "0x") {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const offset = toNumber(dataSlice(result, start, start + 32));
|
|
||||||
const length = toNumber(dataSlice(result, offset, offset + 32));
|
|
||||||
return dataSlice(result, offset + 32, offset + 32 + length);
|
|
||||||
}
|
|
||||||
function parseString(result, start) {
|
|
||||||
try {
|
|
||||||
const bytes = parseBytes(result, start);
|
|
||||||
if (bytes != null) {
|
|
||||||
return toUtf8String(bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (error) { }
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
function numPad(value) {
|
|
||||||
const result = toBeArray(value);
|
|
||||||
if (result.length > 32) {
|
|
||||||
throw new Error("internal; should not happen");
|
|
||||||
}
|
|
||||||
const padded = new Uint8Array(32);
|
|
||||||
padded.set(result, 32 - result.length);
|
|
||||||
return padded;
|
|
||||||
}
|
|
||||||
function bytesPad(value) {
|
|
||||||
if ((value.length % 32) === 0) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
const result = new Uint8Array(Math.ceil(value.length / 32) * 32);
|
|
||||||
result.set(value);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
// ABI Encodes a series of (bytes, bytes, ...)
|
|
||||||
function encodeBytes(datas) {
|
|
||||||
const result = [];
|
|
||||||
let byteCount = 0;
|
|
||||||
// Add place-holders for pointers as we add items
|
|
||||||
for (let i = 0; i < datas.length; i++) {
|
|
||||||
result.push(Empty);
|
|
||||||
byteCount += 32;
|
|
||||||
}
|
|
||||||
for (let i = 0; i < datas.length; i++) {
|
|
||||||
const data = getBytes(datas[i]);
|
|
||||||
// Update the bytes offset
|
|
||||||
result[i] = numPad(byteCount);
|
|
||||||
// The length and padded value of data
|
|
||||||
result.push(numPad(data.length));
|
|
||||||
result.push(bytesPad(data));
|
|
||||||
byteCount += 32 + Math.ceil(data.length / 32) * 32;
|
|
||||||
}
|
|
||||||
return concat(result);
|
|
||||||
}
|
|
||||||
function callAddress(value) {
|
|
||||||
assertArgument(value.length === 66 && dataSlice(value, 0, 12) === "0x000000000000000000000000", "invalid call address", "value", value);
|
|
||||||
return getAddress("0x" + value.substring(26));
|
|
||||||
}
|
|
||||||
// @TODO: This should use the fetch-data:ipfs gateway
|
// @TODO: This should use the fetch-data:ipfs gateway
|
||||||
// Trim off the ipfs:// prefix and return the default gateway URL
|
// Trim off the ipfs:// prefix and return the default gateway URL
|
||||||
function getIpfsLink(link) {
|
function getIpfsLink(link) {
|
||||||
@ -105,7 +44,7 @@ export class MulticoinProviderPlugin {
|
|||||||
throw new Error("unsupported coin");
|
throw new Error("unsupported coin");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const BasicMulticoinPluginId = "org.ethers.plugins.BasicMulticoinProviderPlugin";
|
const BasicMulticoinPluginId = "org.ethers.plugins.provider.BasicMulticoin";
|
||||||
/**
|
/**
|
||||||
* A basic multicoin provider plugin.
|
* A basic multicoin provider plugin.
|
||||||
*/
|
*/
|
||||||
@ -140,68 +79,71 @@ export class EnsResolver {
|
|||||||
name;
|
name;
|
||||||
// For EIP-2544 names, the ancestor that provided the resolver
|
// For EIP-2544 names, the ancestor that provided the resolver
|
||||||
#supports2544;
|
#supports2544;
|
||||||
|
#resolver;
|
||||||
constructor(provider, address, name) {
|
constructor(provider, address, name) {
|
||||||
defineProperties(this, { provider, address, name });
|
defineProperties(this, { provider, address, name });
|
||||||
this.#supports2544 = null;
|
this.#supports2544 = null;
|
||||||
|
this.#resolver = new Contract(address, [
|
||||||
|
"function supportsInterface(bytes4) view returns (bool)",
|
||||||
|
"function resolve(bytes, bytes) view returns (bytes)",
|
||||||
|
"function addr(bytes32) view returns (address)",
|
||||||
|
"function addr(bytes32, uint) view returns (address)",
|
||||||
|
"function text(bytes32, string) view returns (string)",
|
||||||
|
"function contenthash() view returns (bytes)",
|
||||||
|
], provider);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Resolves to true if the resolver supports wildcard resolution.
|
* Resolves to true if the resolver supports wildcard resolution.
|
||||||
*/
|
*/
|
||||||
async supportsWildcard() {
|
async supportsWildcard() {
|
||||||
if (!this.#supports2544) {
|
if (this.#supports2544 == null) {
|
||||||
// supportsInterface(bytes4 = selector("resolve(bytes,bytes)"))
|
this.#supports2544 = (async () => {
|
||||||
this.#supports2544 = this.provider.call({
|
try {
|
||||||
to: this.address,
|
return await this.#resolver.supportsInterface("0x9061b923");
|
||||||
data: "0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"
|
}
|
||||||
}).then((result) => {
|
catch (error) {
|
||||||
return (getBigInt(result) === BN_1);
|
// Wildcard resolvers must understand supportsInterface
|
||||||
}).catch((error) => {
|
// and return true.
|
||||||
if (error.code === "CALL_EXCEPTION") {
|
if (isError(error, "CALL_EXCEPTION")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Rethrow the error: link is down, etc. Let future attempts retry.
|
// Let future attempts try again...
|
||||||
this.#supports2544 = null;
|
this.#supports2544 = null;
|
||||||
throw error;
|
throw error;
|
||||||
});
|
}
|
||||||
|
})();
|
||||||
}
|
}
|
||||||
return await this.#supports2544;
|
return await this.#supports2544;
|
||||||
}
|
}
|
||||||
/**
|
async #fetch(funcName, params) {
|
||||||
* Fetch the %%selector%% with %%parameters%% using call, resolving
|
params = (params || []).slice();
|
||||||
* recursively if the resolver supports it.
|
const iface = this.#resolver.interface;
|
||||||
*/
|
// The first parameters is always the nodehash
|
||||||
async _fetch(selector, parameters) {
|
params.unshift(namehash(this.name));
|
||||||
if (parameters == null) {
|
let fragment = null;
|
||||||
parameters = "0x";
|
|
||||||
}
|
|
||||||
// e.g. keccak256("addr(bytes32,uint256)")
|
|
||||||
const addrData = concat([selector, namehash(this.name), parameters]);
|
|
||||||
const tx = {
|
|
||||||
to: this.address,
|
|
||||||
from: ZeroAddress,
|
|
||||||
enableCcipRead: true,
|
|
||||||
data: addrData
|
|
||||||
};
|
|
||||||
// Wildcard support; use EIP-2544 to resolve the request
|
|
||||||
let wrapped = false;
|
|
||||||
if (await this.supportsWildcard()) {
|
if (await this.supportsWildcard()) {
|
||||||
wrapped = true;
|
fragment = iface.getFunction(funcName);
|
||||||
// selector("resolve(bytes,bytes)")
|
assert(fragment, "missing fragment", "UNKNOWN_ERROR", {
|
||||||
tx.data = concat(["0x9061b923", encodeBytes([dnsEncode(this.name), addrData])]);
|
info: { funcName }
|
||||||
}
|
|
||||||
try {
|
|
||||||
let data = await this.provider.call(tx);
|
|
||||||
assert((getBytes(data).length % 32) !== 4, "execution reverted during JSON-RPC call (could not parse reason; invalid data length)", "CALL_EXCEPTION", {
|
|
||||||
action: "call", data, reason: null, transaction: tx,
|
|
||||||
invocation: null, revert: null
|
|
||||||
});
|
});
|
||||||
if (wrapped) {
|
params = [
|
||||||
return parseBytes(data, 0);
|
dnsEncode(this.name),
|
||||||
|
iface.encodeFunctionData(fragment, params)
|
||||||
|
];
|
||||||
|
funcName = "resolve(bytes,bytes)";
|
||||||
}
|
}
|
||||||
return data;
|
params.push({
|
||||||
|
ccipReadEnable: true
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
const result = await this.#resolver[funcName](...params);
|
||||||
|
if (fragment) {
|
||||||
|
return iface.decodeFunctionResult(fragment, result)[0];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
if (error.code !== "CALL_EXCEPTION") {
|
if (!isError(error, "CALL_EXCEPTION")) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,16 +159,15 @@ export class EnsResolver {
|
|||||||
}
|
}
|
||||||
if (coinType === 60) {
|
if (coinType === 60) {
|
||||||
try {
|
try {
|
||||||
// keccak256("addr(bytes32)")
|
const result = await this.#fetch("addr(bytes32)");
|
||||||
const result = await this._fetch("0x3b3b57de");
|
|
||||||
// No address
|
// No address
|
||||||
if (result == null || result === "0x" || result === ZeroHash) {
|
if (result == null || result === ZeroAddress) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return callAddress(result);
|
return result;
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
if (error.code === "CALL_EXCEPTION") {
|
if (isError(error, "CALL_EXCEPTION")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
@ -246,7 +187,7 @@ export class EnsResolver {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// keccak256("addr(bytes32,uint256")
|
// keccak256("addr(bytes32,uint256")
|
||||||
const data = parseBytes((await this._fetch("0xf1cb7e06", numPad(coinType))) || "0x", 0);
|
const data = await this.#fetch("addr(bytes32,uint)", [coinType]);
|
||||||
// No address
|
// No address
|
||||||
if (data == null || data === "0x") {
|
if (data == null || data === "0x") {
|
||||||
return null;
|
return null;
|
||||||
@ -266,29 +207,24 @@ export class EnsResolver {
|
|||||||
* if unconfigured.
|
* if unconfigured.
|
||||||
*/
|
*/
|
||||||
async getText(key) {
|
async getText(key) {
|
||||||
// The key encoded as parameter to fetchBytes
|
const data = await this.#fetch("text(bytes32,string)", [key]);
|
||||||
let keyBytes = toUtf8Bytes(key);
|
if (data == null || data === "0x") {
|
||||||
// The nodehash consumes the first slot, so the string pointer targets
|
|
||||||
// offset 64, with the length at offset 64 and data starting at offset 96
|
|
||||||
const calldata = getBytes(concat([numPad(64), numPad(keyBytes.length), keyBytes]));
|
|
||||||
const hexBytes = parseBytes((await this._fetch("0x59d1d43c", bytesPad(calldata))) || "0x", 0);
|
|
||||||
if (hexBytes == null || hexBytes === "0x") {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return toUtf8String(hexBytes);
|
return data;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Rsolves to the content-hash or ``null`` if unconfigured.
|
* Rsolves to the content-hash or ``null`` if unconfigured.
|
||||||
*/
|
*/
|
||||||
async getContentHash() {
|
async getContentHash() {
|
||||||
// keccak256("contenthash()")
|
// keccak256("contenthash()")
|
||||||
const hexBytes = parseBytes((await this._fetch("0xbc1c58d1")) || "0x", 0);
|
const data = await this.#fetch("contenthash()");
|
||||||
// No contenthash
|
// No contenthash
|
||||||
if (hexBytes == null || hexBytes === "0x") {
|
if (data == null || data === "0x") {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// IPFS (CID: 1, Type: 70=DAG-PB, 72=libp2p-key)
|
// IPFS (CID: 1, Type: 70=DAG-PB, 72=libp2p-key)
|
||||||
const ipfs = hexBytes.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);
|
const ipfs = data.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);
|
||||||
if (ipfs) {
|
if (ipfs) {
|
||||||
const scheme = (ipfs[1] === "e3010170") ? "ipfs" : "ipns";
|
const scheme = (ipfs[1] === "e3010170") ? "ipfs" : "ipns";
|
||||||
const length = parseInt(ipfs[4], 16);
|
const length = parseInt(ipfs[4], 16);
|
||||||
@ -297,13 +233,13 @@ export class EnsResolver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32)
|
// Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32)
|
||||||
const swarm = hexBytes.match(/^0xe40101fa011b20([0-9a-f]*)$/);
|
const swarm = data.match(/^0xe40101fa011b20([0-9a-f]*)$/);
|
||||||
if (swarm && swarm[1].length === 64) {
|
if (swarm && swarm[1].length === 64) {
|
||||||
return `bzz:/\/${swarm[1]}`;
|
return `bzz:/\/${swarm[1]}`;
|
||||||
}
|
}
|
||||||
assert(false, `invalid or unsupported content hash data`, "UNSUPPORTED_OPERATION", {
|
assert(false, `invalid or unsupported content hash data`, "UNSUPPORTED_OPERATION", {
|
||||||
operation: "getContentHash()",
|
operation: "getContentHash()",
|
||||||
info: { data: hexBytes }
|
info: { data }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -315,7 +251,8 @@ export class EnsResolver {
|
|||||||
* method may be useful.
|
* method may be useful.
|
||||||
*/
|
*/
|
||||||
async getAvatar() {
|
async getAvatar() {
|
||||||
return (await this._getAvatar()).url;
|
const avatar = await this._getAvatar();
|
||||||
|
return avatar.url;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* When resolving an avatar, there are many steps involved, such
|
* When resolving an avatar, there are many steps involved, such
|
||||||
@ -333,7 +270,7 @@ export class EnsResolver {
|
|||||||
const avatar = await this.getText("avatar");
|
const avatar = await this.getText("avatar");
|
||||||
if (avatar == null) {
|
if (avatar == null) {
|
||||||
linkage.push({ type: "!avatar", value: "" });
|
linkage.push({ type: "!avatar", value: "" });
|
||||||
throw new Error("!avatar");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
linkage.push({ type: "avatar", value: avatar });
|
linkage.push({ type: "avatar", value: avatar });
|
||||||
for (let i = 0; i < matchers.length; i++) {
|
for (let i = 0; i < matchers.length; i++) {
|
||||||
@ -356,58 +293,55 @@ export class EnsResolver {
|
|||||||
case "erc721":
|
case "erc721":
|
||||||
case "erc1155": {
|
case "erc1155": {
|
||||||
// Depending on the ERC type, use tokenURI(uint256) or url(uint256)
|
// Depending on the ERC type, use tokenURI(uint256) or url(uint256)
|
||||||
const selector = (scheme === "erc721") ? "0xc87b56dd" : "0x0e89341c";
|
const selector = (scheme === "erc721") ? "tokenURI(uint256)" : "uri(uint256)";
|
||||||
linkage.push({ type: scheme, value: avatar });
|
linkage.push({ type: scheme, value: avatar });
|
||||||
// The owner of this name
|
// The owner of this name
|
||||||
const owner = await this.getAddress();
|
const owner = await this.getAddress();
|
||||||
if (owner == null) {
|
if (owner == null) {
|
||||||
linkage.push({ type: "!owner", value: "" });
|
linkage.push({ type: "!owner", value: "" });
|
||||||
throw new Error("!owner");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
const comps = (match[2] || "").split("/");
|
const comps = (match[2] || "").split("/");
|
||||||
if (comps.length !== 2) {
|
if (comps.length !== 2) {
|
||||||
linkage.push({ type: `!${scheme}caip`, value: (match[2] || "") });
|
linkage.push({ type: `!${scheme}caip`, value: (match[2] || "") });
|
||||||
throw new Error("!caip");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
const addr = getAddress(comps[0]);
|
const tokenId = comps[1];
|
||||||
const tokenId = numPad(comps[1]);
|
const contract = new Contract(comps[0], [
|
||||||
|
// ERC-721
|
||||||
|
"function tokenURI(uint) view returns (string)",
|
||||||
|
"function ownerOf(uint) view returns (address)",
|
||||||
|
// ERC-1155
|
||||||
|
"function uri(uint) view returns (string)",
|
||||||
|
"function balanceOf(address, uint256) view returns (uint)"
|
||||||
|
], this.provider);
|
||||||
// Check that this account owns the token
|
// Check that this account owns the token
|
||||||
if (scheme === "erc721") {
|
if (scheme === "erc721") {
|
||||||
// ownerOf(uint256 tokenId)
|
const tokenOwner = await contract.ownerOf(tokenId);
|
||||||
const tokenOwner = callAddress(await this.provider.call({
|
|
||||||
to: addr, data: concat(["0x6352211e", tokenId])
|
|
||||||
}));
|
|
||||||
if (owner !== tokenOwner) {
|
if (owner !== tokenOwner) {
|
||||||
linkage.push({ type: "!owner", value: tokenOwner });
|
linkage.push({ type: "!owner", value: tokenOwner });
|
||||||
throw new Error("!owner");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
linkage.push({ type: "owner", value: tokenOwner });
|
linkage.push({ type: "owner", value: tokenOwner });
|
||||||
}
|
}
|
||||||
else if (scheme === "erc1155") {
|
else if (scheme === "erc1155") {
|
||||||
// balanceOf(address owner, uint256 tokenId)
|
const balance = await contract.balanceOf(owner, tokenId);
|
||||||
const balance = getBigInt(await this.provider.call({
|
|
||||||
to: addr, data: concat(["0x00fdd58e", zeroPadValue(owner, 32), tokenId])
|
|
||||||
}));
|
|
||||||
if (!balance) {
|
if (!balance) {
|
||||||
linkage.push({ type: "!balance", value: "0" });
|
linkage.push({ type: "!balance", value: "0" });
|
||||||
throw new Error("!balance");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
linkage.push({ type: "balance", value: balance.toString() });
|
linkage.push({ type: "balance", value: balance.toString() });
|
||||||
}
|
}
|
||||||
// Call the token contract for the metadata URL
|
// Call the token contract for the metadata URL
|
||||||
const tx = {
|
let metadataUrl = await contract[selector](tokenId);
|
||||||
to: comps[0],
|
if (metadataUrl == null || metadataUrl === "0x") {
|
||||||
data: concat([selector, tokenId])
|
|
||||||
};
|
|
||||||
let metadataUrl = parseString(await this.provider.call(tx), 0);
|
|
||||||
if (metadataUrl == null) {
|
|
||||||
linkage.push({ type: "!metadata-url", value: "" });
|
linkage.push({ type: "!metadata-url", value: "" });
|
||||||
throw new Error("!metadata-url");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
linkage.push({ type: "metadata-url-base", value: metadataUrl });
|
linkage.push({ type: "metadata-url-base", value: metadataUrl });
|
||||||
// ERC-1155 allows a generic {id} in the URL
|
// ERC-1155 allows a generic {id} in the URL
|
||||||
if (scheme === "erc1155") {
|
if (scheme === "erc1155") {
|
||||||
metadataUrl = metadataUrl.replace("{id}", hexlify(tokenId).substring(2));
|
metadataUrl = metadataUrl.replace("{id}", toBeHex(tokenId, 32).substring(2));
|
||||||
linkage.push({ type: "metadata-url-expanded", value: metadataUrl });
|
linkage.push({ type: "metadata-url-expanded", value: metadataUrl });
|
||||||
}
|
}
|
||||||
// Transform IPFS metadata links
|
// Transform IPFS metadata links
|
||||||
@ -431,20 +365,20 @@ export class EnsResolver {
|
|||||||
if (bytes) {
|
if (bytes) {
|
||||||
linkage.push({ type: "!metadata", value: hexlify(bytes) });
|
linkage.push({ type: "!metadata", value: hexlify(bytes) });
|
||||||
}
|
}
|
||||||
throw error;
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
throw error;
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
if (!metadata) {
|
if (!metadata) {
|
||||||
linkage.push({ type: "!metadata", value: "" });
|
linkage.push({ type: "!metadata", value: "" });
|
||||||
throw new Error("!metadata");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
linkage.push({ type: "metadata", value: JSON.stringify(metadata) });
|
linkage.push({ type: "metadata", value: JSON.stringify(metadata) });
|
||||||
// Pull the image URL out
|
// Pull the image URL out
|
||||||
let imageUrl = metadata.image;
|
let imageUrl = metadata.image;
|
||||||
if (typeof (imageUrl) !== "string") {
|
if (typeof (imageUrl) !== "string") {
|
||||||
linkage.push({ type: "!imageUrl", value: "" });
|
linkage.push({ type: "!imageUrl", value: "" });
|
||||||
throw new Error("!imageUrl");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
if (imageUrl.match(/^(https:\/\/|data:)/i)) {
|
if (imageUrl.match(/^(https:\/\/|data:)/i)) {
|
||||||
// Allow
|
// Allow
|
||||||
@ -454,7 +388,7 @@ export class EnsResolver {
|
|||||||
const ipfs = imageUrl.match(matcherIpfs);
|
const ipfs = imageUrl.match(matcherIpfs);
|
||||||
if (ipfs == null) {
|
if (ipfs == null) {
|
||||||
linkage.push({ type: "!imageUrl-ipfs", value: imageUrl });
|
linkage.push({ type: "!imageUrl-ipfs", value: imageUrl });
|
||||||
throw new Error("!imageUrl-ipfs");
|
return { url: null, linkage };
|
||||||
}
|
}
|
||||||
linkage.push({ type: "imageUrl-ipfs", value: imageUrl });
|
linkage.push({ type: "imageUrl-ipfs", value: imageUrl });
|
||||||
imageUrl = getIpfsLink(imageUrl);
|
imageUrl = getIpfsLink(imageUrl);
|
||||||
@ -465,27 +399,28 @@ export class EnsResolver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) { }
|
||||||
console.log("EE", error);
|
|
||||||
}
|
|
||||||
return { linkage, url: null };
|
return { linkage, url: null };
|
||||||
}
|
}
|
||||||
static async #getResolver(provider, name) {
|
static async getEnsAddress(provider) {
|
||||||
const network = await provider.getNetwork();
|
const network = await provider.getNetwork();
|
||||||
const ensPlugin = network.getPlugin("org.ethers.network-plugins.ens");
|
const ensPlugin = network.getPlugin("org.ethers.plugins.network.Ens");
|
||||||
// No ENS...
|
// No ENS...
|
||||||
assert(ensPlugin, "network does not support ENS", "UNSUPPORTED_OPERATION", {
|
assert(ensPlugin, "network does not support ENS", "UNSUPPORTED_OPERATION", {
|
||||||
operation: "getResolver", info: { network: network.name }
|
operation: "getEnsAddress", info: { network }
|
||||||
});
|
});
|
||||||
|
return ensPlugin.address;
|
||||||
|
}
|
||||||
|
static async #getResolver(provider, name) {
|
||||||
|
const ensAddr = await EnsResolver.getEnsAddress(provider);
|
||||||
try {
|
try {
|
||||||
// keccak256("resolver(bytes32)")
|
const contract = new Contract(ensAddr, [
|
||||||
const addrData = await provider.call({
|
"function resolver(bytes32) view returns (address)"
|
||||||
to: ensPlugin.address,
|
], provider);
|
||||||
data: concat(["0x0178b8bf", namehash(name)]),
|
const addr = await contract.resolver(namehash(name), {
|
||||||
enableCcipRead: true
|
enableCcipRead: true
|
||||||
});
|
});
|
||||||
const addr = callAddress(addrData);
|
if (addr === ZeroAddress) {
|
||||||
if (addr === dataSlice(ZeroHash, 0, 20)) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return addr;
|
return addr;
|
||||||
@ -499,7 +434,7 @@ export class EnsResolver {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Resolve to the ENS resolver for %%name%% using %%provider%% or
|
* Resolve to the ENS resolver for %%name%% using %%provider%% or
|
||||||
* ``null`` if uncinfigured.
|
* ``null`` if unconfigured.
|
||||||
*/
|
*/
|
||||||
static async fromName(provider, name) {
|
static async fromName(provider, name) {
|
||||||
let currentName = name;
|
let currentName = name;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -4,16 +4,13 @@
|
|||||||
* @_section: api/providers:Providers [providers]
|
* @_section: api/providers:Providers [providers]
|
||||||
*/
|
*/
|
||||||
export { AbstractProvider, UnmanagedSubscriber } from "./abstract-provider.js";
|
export { AbstractProvider, UnmanagedSubscriber } from "./abstract-provider.js";
|
||||||
export { AbstractSigner, VoidSigner, WrappedSigner } from "./abstract-signer.js";
|
export { AbstractSigner, VoidSigner, } from "./abstract-signer.js";
|
||||||
export { showThrottleMessage } from "./community.js";
|
export { showThrottleMessage } from "./community.js";
|
||||||
export { getDefaultProvider } from "./default-provider.js";
|
export { getDefaultProvider } from "./default-provider.js";
|
||||||
export { EnsResolver } from "./ens-resolver.js";
|
export { EnsResolver } from "./ens-resolver.js";
|
||||||
export { Network } from "./network.js";
|
export { Network } from "./network.js";
|
||||||
export { NetworkPlugin, GasCostPlugin, EnsPlugin,
|
export { NonceManager } from "./signer-noncemanager.js";
|
||||||
//MaxPriorityFeePlugin,
|
export { NetworkPlugin, GasCostPlugin, EnsPlugin, FeeDataNetworkPlugin, } from "./plugins-network.js";
|
||||||
FeeDataNetworkPlugin,
|
|
||||||
//CustomBlockNetworkPlugin
|
|
||||||
} from "./plugins-network.js";
|
|
||||||
export { Block, FeeData, Log, TransactionReceipt, TransactionResponse, copyRequest,
|
export { Block, FeeData, Log, TransactionReceipt, TransactionResponse, copyRequest,
|
||||||
//resolveTransactionRequest,
|
//resolveTransactionRequest,
|
||||||
} from "./provider.js";
|
} from "./provider.js";
|
||||||
@ -23,9 +20,9 @@ export { BrowserProvider } from "./provider-browser.js";
|
|||||||
export { AlchemyProvider } from "./provider-alchemy.js";
|
export { AlchemyProvider } from "./provider-alchemy.js";
|
||||||
export { AnkrProvider } from "./provider-ankr.js";
|
export { AnkrProvider } from "./provider-ankr.js";
|
||||||
export { CloudflareProvider } from "./provider-cloudflare.js";
|
export { CloudflareProvider } from "./provider-cloudflare.js";
|
||||||
export { BaseEtherscanProvider, EtherscanPlugin } from "./provider-etherscan-base.js";
|
export { EtherscanProvider, EtherscanPlugin } from "./provider-etherscan.js";
|
||||||
export { EtherscanProvider } from "./provider-etherscan.js";
|
|
||||||
export { InfuraProvider, InfuraWebSocketProvider } from "./provider-infura.js";
|
export { InfuraProvider, InfuraWebSocketProvider } from "./provider-infura.js";
|
||||||
|
export { PocketProvider } from "./provider-pocket.js";
|
||||||
export { QuickNodeProvider } from "./provider-quicknode.js";
|
export { QuickNodeProvider } from "./provider-quicknode.js";
|
||||||
import { IpcSocketProvider } from "./provider-ipcsocket.js"; /*-browser*/
|
import { IpcSocketProvider } from "./provider-ipcsocket.js"; /*-browser*/
|
||||||
export { IpcSocketProvider };
|
export { IpcSocketProvider };
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/providers/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EACH,gBAAgB,EAAE,mBAAmB,EACxC,MAAM,wBAAwB,C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,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC,CAAC,YAAY;AACzE,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EACH,gBAAgB,EAAE,qBAAqB,EAAE,uBAAuB,EAChE,qBAAqB,EACxB,MAAM,sBAAsB,CAAC"}
|
@ -99,7 +99,7 @@ export class Network {
|
|||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
computeIntrinsicGas(tx) {
|
computeIntrinsicGas(tx) {
|
||||||
const costs = this.getPlugin("org.ethers.gas-cost") || (new GasCostPlugin());
|
const costs = this.getPlugin("org.ethers.plugins.network.GasCost") || (new GasCostPlugin());
|
||||||
let gas = costs.txBase;
|
let gas = costs.txBase;
|
||||||
if (tx.to == null) {
|
if (tx.to == null) {
|
||||||
gas += costs.txCreate;
|
gas += costs.txCreate;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
|||||||
import { defineProperties } from "../utils/index.js";
|
import { defineProperties } from "../utils/index.js";
|
||||||
export const PluginIdFallbackProvider = "org.ethers.plugins.QualifiedPlugin";
|
export const PluginIdFallbackProvider = "org.ethers.plugins.provider.QualifiedPlugin";
|
||||||
export class CheckQualifiedPlugin {
|
export class CheckQualifiedPlugin {
|
||||||
constructor() {
|
constructor() {
|
||||||
defineProperties(this, { name: PluginIdFallbackProvider });
|
defineProperties(this, { name: PluginIdFallbackProvider });
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"plugin-fallback.js","sourceRoot":"","sources":["../../src.ts/providers/plugin-fallback.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAKrD,MAAM,CAAC,MAAM,wBAAwB,GAAG,oCAAoC,CAAC;AAE7E,MAAM,OAAO,oBAAoB;IAG7B;QACI,gBAAgB,CAAuB,IAAI,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC,CAAC;IACrF,CAAC;IAED,OAAO,CAAC,QAA0B;QAC9B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,gEAAgE;IAChE,2BAA2B;IAC3B,WAAW,CAAC,MAA4B,EAAE,MAAW;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,MAAM,OAAO,+BAAgC,SAAQ,oBAAoB;IACrE,WAAW,CAAC,MAA4B,EAAE,MAAW;QACjD,IAAI,MAAM,CAAC,MAAM,KAAK,gBAAgB,IAAI,MAAM,CAAC,MAAM,KAAK,uBAAuB,EAAE;YACjF,IAAI,MAAM,IAAI,IAAI,EAAE;gBAAE,OAAO,KAAK,CAAC;aAAE;SACxC;QACD,OAAO,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;CACJ"}
|
{"version":3,"file":"plugin-fallback.js","sourceRoot":"","sources":["../../src.ts/providers/plugin-fallback.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAKrD,MAAM,CAAC,MAAM,wBAAwB,GAAG,6CAA6C,CAAC;AAEtF,MAAM,OAAO,oBAAoB;IAG7B;QACI,gBAAgB,CAAuB,IAAI,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC,CAAC;IACrF,CAAC;IAED,OAAO,CAAC,QAA0B;QAC9B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,gEAAgE;IAChE,2BAA2B;IAC3B,WAAW,CAAC,MAA4B,EAAE,MAAW;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,MAAM,OAAO,+BAAgC,SAAQ,oBAAoB;IACrE,WAAW,CAAC,MAA4B,EAAE,MAAW;QACjD,IAAI,MAAM,CAAC,MAAM,KAAK,gBAAgB,IAAI,MAAM,CAAC,MAAM,KAAK,uBAAuB,EAAE;YACjF,IAAI,MAAM,IAAI,IAAI,EAAE;gBAAE,OAAO,KAAK,CAAC;aAAE;SACxC;QACD,OAAO,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;CACJ"}
|
@ -22,7 +22,7 @@ export class GasCostPlugin extends NetworkPlugin {
|
|||||||
if (effectiveBlock == null) {
|
if (effectiveBlock == null) {
|
||||||
effectiveBlock = 0;
|
effectiveBlock = 0;
|
||||||
}
|
}
|
||||||
super(`org.ethers.network-plugins.gas-cost#${(effectiveBlock || 0)}`);
|
super(`org.ethers.network.plugins.GasCost#${(effectiveBlock || 0)}`);
|
||||||
const props = { effectiveBlock };
|
const props = { effectiveBlock };
|
||||||
function set(name, nullish) {
|
function set(name, nullish) {
|
||||||
let value = (costs || {})[name];
|
let value = (costs || {})[name];
|
||||||
@ -52,7 +52,7 @@ export class EnsPlugin extends NetworkPlugin {
|
|||||||
// The network ID that the ENS contract lives on
|
// The network ID that the ENS contract lives on
|
||||||
targetNetwork;
|
targetNetwork;
|
||||||
constructor(address, targetNetwork) {
|
constructor(address, targetNetwork) {
|
||||||
super("org.ethers.network-plugins.ens");
|
super("org.ethers.plugins.network.Ens");
|
||||||
defineProperties(this, {
|
defineProperties(this, {
|
||||||
address: (address || EnsAddress),
|
address: (address || EnsAddress),
|
||||||
targetNetwork: ((targetNetwork == null) ? 1 : targetNetwork)
|
targetNetwork: ((targetNetwork == null) ? 1 : targetNetwork)
|
||||||
@ -62,31 +62,13 @@ export class EnsPlugin extends NetworkPlugin {
|
|||||||
return new EnsPlugin(this.address, this.targetNetwork);
|
return new EnsPlugin(this.address, this.targetNetwork);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
export class MaxPriorityFeePlugin extends NetworkPlugin {
|
|
||||||
readonly priorityFee!: bigint;
|
|
||||||
|
|
||||||
constructor(priorityFee: BigNumberish) {
|
|
||||||
super("org.ethers.plugins.max-priority-fee");
|
|
||||||
defineProperties<MaxPriorityFeePlugin>(this, {
|
|
||||||
priorityFee: logger.getBigInt(priorityFee)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async getPriorityFee(provider: Provider): Promise<bigint> {
|
|
||||||
return this.priorityFee;
|
|
||||||
}
|
|
||||||
|
|
||||||
clone(): MaxPriorityFeePlugin {
|
|
||||||
return new MaxPriorityFeePlugin(this.priorityFee);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
export class FeeDataNetworkPlugin extends NetworkPlugin {
|
export class FeeDataNetworkPlugin extends NetworkPlugin {
|
||||||
#feeDataFunc;
|
#feeDataFunc;
|
||||||
get feeDataFunc() { return this.#feeDataFunc; }
|
get feeDataFunc() {
|
||||||
|
return this.#feeDataFunc;
|
||||||
|
}
|
||||||
constructor(feeDataFunc) {
|
constructor(feeDataFunc) {
|
||||||
super("org.ethers.network-plugins.fee-data");
|
super("org.ethers.plugins.network.FeeData");
|
||||||
this.#feeDataFunc = feeDataFunc;
|
this.#feeDataFunc = feeDataFunc;
|
||||||
}
|
}
|
||||||
async getFeeData(provider) {
|
async getFeeData(provider) {
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"plugins-network.js","sourceRoot":"","sources":["../../src.ts/providers/plugins-network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAQnD,MAAM,UAAU,GAAG,4CAA4C,CAAC;AAEhE,MAAM,OAAO,aAAa;IACb,IAAI,CAAU;IAEvB,YAAY,IAAY;QACpB,gBA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AU,CAAC,QAAkB;QAC/B,OAAO,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK;QACD,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACvD,CAAC;CACJ;AAED;;;;;;;;;;;;;;;;;;;;;;;EAuBE"}
|
@ -1,466 +0,0 @@
|
|||||||
import { AbiCoder } from "../abi/index.js";
|
|
||||||
import { accessListify, Transaction } from "../transaction/index.js";
|
|
||||||
import { defineProperties, hexlify, toQuantity, FetchRequest, assert, assertArgument, isError, toUtf8String } from "../utils/index.js";
|
|
||||||
import { AbstractProvider } from "./abstract-provider.js";
|
|
||||||
import { Network } from "./network.js";
|
|
||||||
import { NetworkPlugin } from "./plugins-network.js";
|
|
||||||
import { showThrottleMessage } from "./community.js";
|
|
||||||
const THROTTLE = 2000;
|
|
||||||
const EtherscanPluginId = "org.ethers.plugins.Etherscan";
|
|
||||||
/**
|
|
||||||
* A Network can include an **EtherscanPlugin** to provide
|
|
||||||
* a custom base URL.
|
|
||||||
*
|
|
||||||
* @_docloc: api/providers/thirdparty:Etherscan
|
|
||||||
*/
|
|
||||||
export class EtherscanPlugin extends NetworkPlugin {
|
|
||||||
/**
|
|
||||||
* The Etherscan API base URL.
|
|
||||||
*/
|
|
||||||
baseUrl;
|
|
||||||
/**
|
|
||||||
* Creates a new **EtherscanProvider** which will use
|
|
||||||
* %%baseUrl%%.
|
|
||||||
*/
|
|
||||||
constructor(baseUrl) {
|
|
||||||
super(EtherscanPluginId);
|
|
||||||
defineProperties(this, { baseUrl });
|
|
||||||
}
|
|
||||||
clone() {
|
|
||||||
return new EtherscanPlugin(this.baseUrl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let nextId = 1;
|
|
||||||
/**
|
|
||||||
* The **EtherscanBaseProvider** is the super-class of
|
|
||||||
* [[EtherscanProvider]], which should generally be used instead.
|
|
||||||
*
|
|
||||||
* Since the **EtherscanProvider** includes additional code for
|
|
||||||
* [[Contract]] access, in //rare cases// that contracts are not
|
|
||||||
* used, this class can reduce code size.
|
|
||||||
*
|
|
||||||
* @_docloc: api/providers/thirdparty:Etherscan
|
|
||||||
*/
|
|
||||||
export class BaseEtherscanProvider extends AbstractProvider {
|
|
||||||
/**
|
|
||||||
* The connected network.
|
|
||||||
*/
|
|
||||||
network;
|
|
||||||
/**
|
|
||||||
* The API key or null if using the community provided bandwidth.
|
|
||||||
*/
|
|
||||||
apiKey;
|
|
||||||
#plugin;
|
|
||||||
/**
|
|
||||||
* Creates a new **EtherscanBaseProvider**.
|
|
||||||
*/
|
|
||||||
constructor(_network, _apiKey) {
|
|
||||||
const apiKey = (_apiKey != null) ? _apiKey : null;
|
|
||||||
super();
|
|
||||||
const network = Network.from(_network);
|
|
||||||
this.#plugin = network.getPlugin(EtherscanPluginId);
|
|
||||||
defineProperties(this, { apiKey, network });
|
|
||||||
// Test that the network is supported by Etherscan
|
|
||||||
this.getBaseUrl();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Returns the base URL.
|
|
||||||
*
|
|
||||||
* If an [[EtherscanPlugin]] is configured on the
|
|
||||||
* [[EtherscanBaseProvider_network]], returns the plugin's
|
|
||||||
* baseUrl.
|
|
||||||
*/
|
|
||||||
getBaseUrl() {
|
|
||||||
if (this.#plugin) {
|
|
||||||
return this.#plugin.baseUrl;
|
|
||||||
}
|
|
||||||
switch (this.network.name) {
|
|
||||||
case "mainnet":
|
|
||||||
return "https:/\/api.etherscan.io";
|
|
||||||
case "goerli":
|
|
||||||
return "https:/\/api-goerli.etherscan.io";
|
|
||||||
case "sepolia":
|
|
||||||
return "https:/\/api-sepolia.etherscan.io";
|
|
||||||
case "arbitrum":
|
|
||||||
return "https:/\/api.arbiscan.io";
|
|
||||||
case "arbitrum-goerli":
|
|
||||||
return "https:/\/api-goerli.arbiscan.io";
|
|
||||||
case "matic":
|
|
||||||
return "https:/\/api.polygonscan.com";
|
|
||||||
case "maticmum":
|
|
||||||
return "https:/\/api-testnet.polygonscan.com";
|
|
||||||
case "optimism":
|
|
||||||
return "https:/\/api-optimistic.etherscan.io";
|
|
||||||
case "optimism-goerli":
|
|
||||||
return "https:/\/api-goerli-optimistic.etherscan.io";
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
assertArgument(false, "unsupported network", "network", this.network);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Returns the URL for the %%module%% and %%params%%.
|
|
||||||
*/
|
|
||||||
getUrl(module, params) {
|
|
||||||
const query = Object.keys(params).reduce((accum, key) => {
|
|
||||||
const value = params[key];
|
|
||||||
if (value != null) {
|
|
||||||
accum += `&${key}=${value}`;
|
|
||||||
}
|
|
||||||
return accum;
|
|
||||||
}, "");
|
|
||||||
const apiKey = ((this.apiKey) ? `&apikey=${this.apiKey}` : "");
|
|
||||||
return `${this.getBaseUrl()}/api?module=${module}${query}${apiKey}`;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Returns the URL for using POST requests.
|
|
||||||
*/
|
|
||||||
getPostUrl() {
|
|
||||||
return `${this.getBaseUrl()}/api`;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Returns the parameters for using POST requests.
|
|
||||||
*/
|
|
||||||
getPostData(module, params) {
|
|
||||||
params.module = module;
|
|
||||||
params.apikey = this.apiKey;
|
|
||||||
return params;
|
|
||||||
}
|
|
||||||
async detectNetwork() {
|
|
||||||
return this.network;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Resolves to the result of calling %%module%% with %%params%%.
|
|
||||||
*
|
|
||||||
* If %%post%%, the request is made as a POST request.
|
|
||||||
*/
|
|
||||||
async fetch(module, params, post) {
|
|
||||||
const id = nextId++;
|
|
||||||
const url = (post ? this.getPostUrl() : this.getUrl(module, params));
|
|
||||||
const payload = (post ? this.getPostData(module, params) : null);
|
|
||||||
this.emit("debug", { action: "sendRequest", id, url, payload: payload });
|
|
||||||
const request = new FetchRequest(url);
|
|
||||||
request.setThrottleParams({ slotInterval: 1000 });
|
|
||||||
request.retryFunc = (req, resp, attempt) => {
|
|
||||||
if (this.isCommunityResource()) {
|
|
||||||
showThrottleMessage("Etherscan");
|
|
||||||
}
|
|
||||||
return Promise.resolve(true);
|
|
||||||
};
|
|
||||||
request.processFunc = async (request, response) => {
|
|
||||||
const result = response.hasBody() ? JSON.parse(toUtf8String(response.body)) : {};
|
|
||||||
const throttle = ((typeof (result.result) === "string") ? result.result : "").toLowerCase().indexOf("rate limit") >= 0;
|
|
||||||
if (module === "proxy") {
|
|
||||||
// This JSON response indicates we are being throttled
|
|
||||||
if (result && result.status == 0 && result.message == "NOTOK" && throttle) {
|
|
||||||
this.emit("debug", { action: "receiveError", id, reason: "proxy-NOTOK", error: result });
|
|
||||||
response.throwThrottleError(result.result, THROTTLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (throttle) {
|
|
||||||
this.emit("debug", { action: "receiveError", id, reason: "null result", error: result.result });
|
|
||||||
response.throwThrottleError(result.result, THROTTLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return response;
|
|
||||||
};
|
|
||||||
if (payload) {
|
|
||||||
request.setHeader("content-type", "application/x-www-form-urlencoded; charset=UTF-8");
|
|
||||||
request.body = Object.keys(payload).map((k) => `${k}=${payload[k]}`).join("&");
|
|
||||||
}
|
|
||||||
const response = await request.send();
|
|
||||||
try {
|
|
||||||
response.assertOk();
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
this.emit("debug", { action: "receiveError", id, error, reason: "assertOk" });
|
|
||||||
assert(false, "response error", "SERVER_ERROR", { request, response });
|
|
||||||
}
|
|
||||||
if (!response.hasBody()) {
|
|
||||||
this.emit("debug", { action: "receiveError", id, error: "missing body", reason: "null body" });
|
|
||||||
assert(false, "missing response", "SERVER_ERROR", { request, response });
|
|
||||||
}
|
|
||||||
const result = JSON.parse(toUtf8String(response.body));
|
|
||||||
if (module === "proxy") {
|
|
||||||
if (result.jsonrpc != "2.0") {
|
|
||||||
this.emit("debug", { action: "receiveError", id, result, reason: "invalid JSON-RPC" });
|
|
||||||
assert(false, "invalid JSON-RPC response (missing jsonrpc='2.0')", "SERVER_ERROR", { request, response, info: { result } });
|
|
||||||
}
|
|
||||||
if (result.error) {
|
|
||||||
this.emit("debug", { action: "receiveError", id, result, reason: "JSON-RPC error" });
|
|
||||||
assert(false, "error response", "SERVER_ERROR", { request, response, info: { result } });
|
|
||||||
}
|
|
||||||
this.emit("debug", { action: "receiveRequest", id, result });
|
|
||||||
return result.result;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// getLogs, getHistory have weird success responses
|
|
||||||
if (result.status == 0 && (result.message === "No records found" || result.message === "No transactions found")) {
|
|
||||||
this.emit("debug", { action: "receiveRequest", id, result });
|
|
||||||
return result.result;
|
|
||||||
}
|
|
||||||
if (result.status != 1 || (typeof (result.message) === "string" && !result.message.match(/^OK/))) {
|
|
||||||
this.emit("debug", { action: "receiveError", id, result });
|
|
||||||
assert(false, "error response", "SERVER_ERROR", { request, response, info: { result } });
|
|
||||||
}
|
|
||||||
this.emit("debug", { action: "receiveRequest", id, result });
|
|
||||||
return result.result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Returns %%transaction%% normalized for the Etherscan API.
|
|
||||||
*/
|
|
||||||
_getTransactionPostData(transaction) {
|
|
||||||
const result = {};
|
|
||||||
for (let key in transaction) {
|
|
||||||
if (transaction[key] == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
let value = transaction[key];
|
|
||||||
if (key === "type" && value === 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// Quantity-types require no leading zero, unless 0
|
|
||||||
if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) {
|
|
||||||
value = toQuantity(value);
|
|
||||||
}
|
|
||||||
else if (key === "accessList") {
|
|
||||||
value = "[" + accessListify(value).map((set) => {
|
|
||||||
return `{address:"${set.address}",storageKeys:["${set.storageKeys.join('","')}"]}`;
|
|
||||||
}).join(",") + "]";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
value = hexlify(value);
|
|
||||||
}
|
|
||||||
result[key] = value;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Throws the normalized Etherscan error.
|
|
||||||
*/
|
|
||||||
_checkError(req, error, transaction) {
|
|
||||||
// Pull any message out if, possible
|
|
||||||
let message = "";
|
|
||||||
if (isError(error, "SERVER_ERROR")) {
|
|
||||||
// Check for an error emitted by a proxy call
|
|
||||||
try {
|
|
||||||
message = error.info.result.error.message;
|
|
||||||
}
|
|
||||||
catch (e) { }
|
|
||||||
if (!message) {
|
|
||||||
try {
|
|
||||||
message = error.info.message;
|
|
||||||
}
|
|
||||||
catch (e) { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (req.method === "estimateGas") {
|
|
||||||
if (!message.match(/revert/i) && message.match(/insufficient funds/i)) {
|
|
||||||
assert(false, "insufficient funds", "INSUFFICIENT_FUNDS", {
|
|
||||||
transaction: req.transaction
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (req.method === "call" || req.method === "estimateGas") {
|
|
||||||
if (message.match(/execution reverted/i)) {
|
|
||||||
let data = "";
|
|
||||||
try {
|
|
||||||
data = error.info.result.error.data;
|
|
||||||
}
|
|
||||||
catch (error) { }
|
|
||||||
const e = AbiCoder.getBuiltinCallException(req.method, req.transaction, data);
|
|
||||||
e.info = { request: req, error };
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (message) {
|
|
||||||
if (req.method === "broadcastTransaction") {
|
|
||||||
const transaction = Transaction.from(req.signedTransaction);
|
|
||||||
if (message.match(/replacement/i) && message.match(/underpriced/i)) {
|
|
||||||
assert(false, "replacement fee too low", "REPLACEMENT_UNDERPRICED", {
|
|
||||||
transaction
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (message.match(/insufficient funds/)) {
|
|
||||||
assert(false, "insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", {
|
|
||||||
transaction
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) {
|
|
||||||
assert(false, "nonce has already been used", "NONCE_EXPIRED", {
|
|
||||||
transaction
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Something we could not process
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
async _detectNetwork() {
|
|
||||||
return this.network;
|
|
||||||
}
|
|
||||||
async _perform(req) {
|
|
||||||
switch (req.method) {
|
|
||||||
case "chainId":
|
|
||||||
return this.network.chainId;
|
|
||||||
case "getBlockNumber":
|
|
||||||
return this.fetch("proxy", { action: "eth_blockNumber" });
|
|
||||||
case "getGasPrice":
|
|
||||||
return this.fetch("proxy", { action: "eth_gasPrice" });
|
|
||||||
case "getBalance":
|
|
||||||
// Returns base-10 result
|
|
||||||
return this.fetch("account", {
|
|
||||||
action: "balance",
|
|
||||||
address: req.address,
|
|
||||||
tag: req.blockTag
|
|
||||||
});
|
|
||||||
case "getTransactionCount":
|
|
||||||
return this.fetch("proxy", {
|
|
||||||
action: "eth_getTransactionCount",
|
|
||||||
address: req.address,
|
|
||||||
tag: req.blockTag
|
|
||||||
});
|
|
||||||
case "getCode":
|
|
||||||
return this.fetch("proxy", {
|
|
||||||
action: "eth_getCode",
|
|
||||||
address: req.address,
|
|
||||||
tag: req.blockTag
|
|
||||||
});
|
|
||||||
case "getStorage":
|
|
||||||
return this.fetch("proxy", {
|
|
||||||
action: "eth_getStorageAt",
|
|
||||||
address: req.address,
|
|
||||||
position: req.position,
|
|
||||||
tag: req.blockTag
|
|
||||||
});
|
|
||||||
case "broadcastTransaction":
|
|
||||||
return this.fetch("proxy", {
|
|
||||||
action: "eth_sendRawTransaction",
|
|
||||||
hex: req.signedTransaction
|
|
||||||
}, true).catch((error) => {
|
|
||||||
return this._checkError(req, error, req.signedTransaction);
|
|
||||||
});
|
|
||||||
case "getBlock":
|
|
||||||
if ("blockTag" in req) {
|
|
||||||
return this.fetch("proxy", {
|
|
||||||
action: "eth_getBlockByNumber",
|
|
||||||
tag: req.blockTag,
|
|
||||||
boolean: (req.includeTransactions ? "true" : "false")
|
|
||||||
});
|
|
||||||
}
|
|
||||||
assert(false, "getBlock by blockHash not supported by Etherscan", "UNSUPPORTED_OPERATION", {
|
|
||||||
operation: "getBlock(blockHash)"
|
|
||||||
});
|
|
||||||
case "getTransaction":
|
|
||||||
return this.fetch("proxy", {
|
|
||||||
action: "eth_getTransactionByHash",
|
|
||||||
txhash: req.hash
|
|
||||||
});
|
|
||||||
case "getTransactionReceipt":
|
|
||||||
return this.fetch("proxy", {
|
|
||||||
action: "eth_getTransactionReceipt",
|
|
||||||
txhash: req.hash
|
|
||||||
});
|
|
||||||
case "call": {
|
|
||||||
if (req.blockTag !== "latest") {
|
|
||||||
throw new Error("EtherscanProvider does not support blockTag for call");
|
|
||||||
}
|
|
||||||
const postData = this._getTransactionPostData(req.transaction);
|
|
||||||
postData.module = "proxy";
|
|
||||||
postData.action = "eth_call";
|
|
||||||
try {
|
|
||||||
return await this.fetch("proxy", postData, true);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
return this._checkError(req, error, req.transaction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "estimateGas": {
|
|
||||||
const postData = this._getTransactionPostData(req.transaction);
|
|
||||||
postData.module = "proxy";
|
|
||||||
postData.action = "eth_estimateGas";
|
|
||||||
try {
|
|
||||||
return await this.fetch("proxy", postData, true);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
return this._checkError(req, error, req.transaction);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
case "getLogs": {
|
|
||||||
// Needs to complain if more than one address is passed in
|
|
||||||
const args: Record<string, any> = { action: "getLogs" }
|
|
||||||
|
|
||||||
if (params.filter.fromBlock) {
|
|
||||||
args.fromBlock = checkLogTag(params.filter.fromBlock);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params.filter.toBlock) {
|
|
||||||
args.toBlock = checkLogTag(params.filter.toBlock);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params.filter.address) {
|
|
||||||
args.address = params.filter.address;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @TODO: We can handle slightly more complicated logs using the logs API
|
|
||||||
if (params.filter.topics && params.filter.topics.length > 0) {
|
|
||||||
if (params.filter.topics.length > 1) {
|
|
||||||
logger.throwError("unsupported topic count", Logger.Errors.UNSUPPORTED_OPERATION, { topics: params.filter.topics });
|
|
||||||
}
|
|
||||||
if (params.filter.topics.length === 1) {
|
|
||||||
const topic0 = params.filter.topics[0];
|
|
||||||
if (typeof(topic0) !== "string" || topic0.length !== 66) {
|
|
||||||
logger.throwError("unsupported topic format", Logger.Errors.UNSUPPORTED_OPERATION, { topic0: topic0 });
|
|
||||||
}
|
|
||||||
args.topic0 = topic0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const logs: Array<any> = await this.fetch("logs", args);
|
|
||||||
|
|
||||||
// Cache txHash => blockHash
|
|
||||||
let blocks: { [tag: string]: string } = {};
|
|
||||||
|
|
||||||
// Add any missing blockHash to the logs
|
|
||||||
for (let i = 0; i < logs.length; i++) {
|
|
||||||
const log = logs[i];
|
|
||||||
if (log.blockHash != null) { continue; }
|
|
||||||
if (blocks[log.blockNumber] == null) {
|
|
||||||
const block = await this.getBlock(log.blockNumber);
|
|
||||||
if (block) {
|
|
||||||
blocks[log.blockNumber] = block.hash;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.blockHash = blocks[log.blockNumber];
|
|
||||||
}
|
|
||||||
|
|
||||||
return logs;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return super._perform(req);
|
|
||||||
}
|
|
||||||
async getNetwork() {
|
|
||||||
return this.network;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Resolves to the current price of ether.
|
|
||||||
*
|
|
||||||
* This returns ``0`` on any network other than ``mainnet``.
|
|
||||||
*/
|
|
||||||
async getEtherPrice() {
|
|
||||||
if (this.network.name !== "mainnet") {
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
return parseFloat((await this.fetch("stats", { action: "ethprice" })).ethusd);
|
|
||||||
}
|
|
||||||
isCommunityResource() {
|
|
||||||
return (this.apiKey == null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=provider-etherscan-base.js.map
|
|
File diff suppressed because one or more lines are too long
@ -1,37 +1,468 @@
|
|||||||
/**
|
import { AbiCoder } from "../abi/index.js";
|
||||||
* [[link-etherscan]] provides a third-party service for connecting to
|
|
||||||
* various blockchains over a combination of JSON-RPC and custom API
|
|
||||||
* endpoints.
|
|
||||||
*
|
|
||||||
* **Supported Networks**
|
|
||||||
*
|
|
||||||
* - Ethereum Mainnet (``mainnet``)
|
|
||||||
* - Goerli Testnet (``goerli``)
|
|
||||||
* - Sepolia Testnet (``sepolia``)
|
|
||||||
* - Arbitrum (``arbitrum``)
|
|
||||||
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
|
|
||||||
* - Optimism (``optimism``)
|
|
||||||
* - Optimism Goerli Testnet (``optimism-goerli``)
|
|
||||||
* - Polygon (``matic``)
|
|
||||||
* - Polygon Mumbai Testnet (``maticmum``)
|
|
||||||
*
|
|
||||||
* @_subsection api/providers/thirdparty:Etherscan [providers-etherscan]
|
|
||||||
*/
|
|
||||||
import { BaseEtherscanProvider } from "./provider-etherscan-base.js";
|
|
||||||
import { Contract } from "../contract/index.js";
|
import { Contract } from "../contract/index.js";
|
||||||
|
import { accessListify, Transaction } from "../transaction/index.js";
|
||||||
|
import { defineProperties, hexlify, toQuantity, FetchRequest, assert, assertArgument, isError, toUtf8String } from "../utils/index.js";
|
||||||
|
import { AbstractProvider } from "./abstract-provider.js";
|
||||||
|
import { Network } from "./network.js";
|
||||||
|
import { NetworkPlugin } from "./plugins-network.js";
|
||||||
|
import { showThrottleMessage } from "./community.js";
|
||||||
|
const THROTTLE = 2000;
|
||||||
function isPromise(value) {
|
function isPromise(value) {
|
||||||
return (value && typeof (value.then) === "function");
|
return (value && typeof (value.then) === "function");
|
||||||
}
|
}
|
||||||
|
const EtherscanPluginId = "org.ethers.plugins.provider.Etherscan";
|
||||||
/**
|
/**
|
||||||
* The **EtherscanProvider** connects to the [[link-etherscan]]
|
* A Network can include an **EtherscanPlugin** to provide
|
||||||
* JSON-RPC end-points.
|
* a custom base URL.
|
||||||
*
|
*
|
||||||
* By default, requests are highly-throttled, which is
|
* @_docloc: api/providers/thirdparty:Etherscan
|
||||||
* appropriate for quick prototypes and simple scripts. To
|
|
||||||
* gain access to an increased rate-limit, it is highly
|
|
||||||
* recommended to [sign up here](link-etherscan-signup).
|
|
||||||
*/
|
*/
|
||||||
export class EtherscanProvider extends BaseEtherscanProvider {
|
export class EtherscanPlugin extends NetworkPlugin {
|
||||||
|
/**
|
||||||
|
* The Etherscan API base URL.
|
||||||
|
*/
|
||||||
|
baseUrl;
|
||||||
|
/**
|
||||||
|
* Creates a new **EtherscanProvider** which will use
|
||||||
|
* %%baseUrl%%.
|
||||||
|
*/
|
||||||
|
constructor(baseUrl) {
|
||||||
|
super(EtherscanPluginId);
|
||||||
|
defineProperties(this, { baseUrl });
|
||||||
|
}
|
||||||
|
clone() {
|
||||||
|
return new EtherscanPlugin(this.baseUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let nextId = 1;
|
||||||
|
/**
|
||||||
|
* The **EtherscanBaseProvider** is the super-class of
|
||||||
|
* [[EtherscanProvider]], which should generally be used instead.
|
||||||
|
*
|
||||||
|
* Since the **EtherscanProvider** includes additional code for
|
||||||
|
* [[Contract]] access, in //rare cases// that contracts are not
|
||||||
|
* used, this class can reduce code size.
|
||||||
|
*
|
||||||
|
* @_docloc: api/providers/thirdparty:Etherscan
|
||||||
|
*/
|
||||||
|
export class EtherscanProvider extends AbstractProvider {
|
||||||
|
/**
|
||||||
|
* The connected network.
|
||||||
|
*/
|
||||||
|
network;
|
||||||
|
/**
|
||||||
|
* The API key or null if using the community provided bandwidth.
|
||||||
|
*/
|
||||||
|
apiKey;
|
||||||
|
#plugin;
|
||||||
|
/**
|
||||||
|
* Creates a new **EtherscanBaseProvider**.
|
||||||
|
*/
|
||||||
|
constructor(_network, _apiKey) {
|
||||||
|
const apiKey = (_apiKey != null) ? _apiKey : null;
|
||||||
|
super();
|
||||||
|
const network = Network.from(_network);
|
||||||
|
this.#plugin = network.getPlugin(EtherscanPluginId);
|
||||||
|
defineProperties(this, { apiKey, network });
|
||||||
|
// Test that the network is supported by Etherscan
|
||||||
|
this.getBaseUrl();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the base URL.
|
||||||
|
*
|
||||||
|
* If an [[EtherscanPlugin]] is configured on the
|
||||||
|
* [[EtherscanBaseProvider_network]], returns the plugin's
|
||||||
|
* baseUrl.
|
||||||
|
*/
|
||||||
|
getBaseUrl() {
|
||||||
|
if (this.#plugin) {
|
||||||
|
return this.#plugin.baseUrl;
|
||||||
|
}
|
||||||
|
switch (this.network.name) {
|
||||||
|
case "mainnet":
|
||||||
|
return "https:/\/api.etherscan.io";
|
||||||
|
case "goerli":
|
||||||
|
return "https:/\/api-goerli.etherscan.io";
|
||||||
|
case "sepolia":
|
||||||
|
return "https:/\/api-sepolia.etherscan.io";
|
||||||
|
case "arbitrum":
|
||||||
|
return "https:/\/api.arbiscan.io";
|
||||||
|
case "arbitrum-goerli":
|
||||||
|
return "https:/\/api-goerli.arbiscan.io";
|
||||||
|
case "matic":
|
||||||
|
return "https:/\/api.polygonscan.com";
|
||||||
|
case "maticmum":
|
||||||
|
return "https:/\/api-testnet.polygonscan.com";
|
||||||
|
case "optimism":
|
||||||
|
return "https:/\/api-optimistic.etherscan.io";
|
||||||
|
case "optimism-goerli":
|
||||||
|
return "https:/\/api-goerli-optimistic.etherscan.io";
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
assertArgument(false, "unsupported network", "network", this.network);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the URL for the %%module%% and %%params%%.
|
||||||
|
*/
|
||||||
|
getUrl(module, params) {
|
||||||
|
const query = Object.keys(params).reduce((accum, key) => {
|
||||||
|
const value = params[key];
|
||||||
|
if (value != null) {
|
||||||
|
accum += `&${key}=${value}`;
|
||||||
|
}
|
||||||
|
return accum;
|
||||||
|
}, "");
|
||||||
|
const apiKey = ((this.apiKey) ? `&apikey=${this.apiKey}` : "");
|
||||||
|
return `${this.getBaseUrl()}/api?module=${module}${query}${apiKey}`;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the URL for using POST requests.
|
||||||
|
*/
|
||||||
|
getPostUrl() {
|
||||||
|
return `${this.getBaseUrl()}/api`;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns the parameters for using POST requests.
|
||||||
|
*/
|
||||||
|
getPostData(module, params) {
|
||||||
|
params.module = module;
|
||||||
|
params.apikey = this.apiKey;
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
async detectNetwork() {
|
||||||
|
return this.network;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Resolves to the result of calling %%module%% with %%params%%.
|
||||||
|
*
|
||||||
|
* If %%post%%, the request is made as a POST request.
|
||||||
|
*/
|
||||||
|
async fetch(module, params, post) {
|
||||||
|
const id = nextId++;
|
||||||
|
const url = (post ? this.getPostUrl() : this.getUrl(module, params));
|
||||||
|
const payload = (post ? this.getPostData(module, params) : null);
|
||||||
|
this.emit("debug", { action: "sendRequest", id, url, payload: payload });
|
||||||
|
const request = new FetchRequest(url);
|
||||||
|
request.setThrottleParams({ slotInterval: 1000 });
|
||||||
|
request.retryFunc = (req, resp, attempt) => {
|
||||||
|
if (this.isCommunityResource()) {
|
||||||
|
showThrottleMessage("Etherscan");
|
||||||
|
}
|
||||||
|
return Promise.resolve(true);
|
||||||
|
};
|
||||||
|
request.processFunc = async (request, response) => {
|
||||||
|
const result = response.hasBody() ? JSON.parse(toUtf8String(response.body)) : {};
|
||||||
|
const throttle = ((typeof (result.result) === "string") ? result.result : "").toLowerCase().indexOf("rate limit") >= 0;
|
||||||
|
if (module === "proxy") {
|
||||||
|
// This JSON response indicates we are being throttled
|
||||||
|
if (result && result.status == 0 && result.message == "NOTOK" && throttle) {
|
||||||
|
this.emit("debug", { action: "receiveError", id, reason: "proxy-NOTOK", error: result });
|
||||||
|
response.throwThrottleError(result.result, THROTTLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (throttle) {
|
||||||
|
this.emit("debug", { action: "receiveError", id, reason: "null result", error: result.result });
|
||||||
|
response.throwThrottleError(result.result, THROTTLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
};
|
||||||
|
if (payload) {
|
||||||
|
request.setHeader("content-type", "application/x-www-form-urlencoded; charset=UTF-8");
|
||||||
|
request.body = Object.keys(payload).map((k) => `${k}=${payload[k]}`).join("&");
|
||||||
|
}
|
||||||
|
const response = await request.send();
|
||||||
|
try {
|
||||||
|
response.assertOk();
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
this.emit("debug", { action: "receiveError", id, error, reason: "assertOk" });
|
||||||
|
assert(false, "response error", "SERVER_ERROR", { request, response });
|
||||||
|
}
|
||||||
|
if (!response.hasBody()) {
|
||||||
|
this.emit("debug", { action: "receiveError", id, error: "missing body", reason: "null body" });
|
||||||
|
assert(false, "missing response", "SERVER_ERROR", { request, response });
|
||||||
|
}
|
||||||
|
const result = JSON.parse(toUtf8String(response.body));
|
||||||
|
if (module === "proxy") {
|
||||||
|
if (result.jsonrpc != "2.0") {
|
||||||
|
this.emit("debug", { action: "receiveError", id, result, reason: "invalid JSON-RPC" });
|
||||||
|
assert(false, "invalid JSON-RPC response (missing jsonrpc='2.0')", "SERVER_ERROR", { request, response, info: { result } });
|
||||||
|
}
|
||||||
|
if (result.error) {
|
||||||
|
this.emit("debug", { action: "receiveError", id, result, reason: "JSON-RPC error" });
|
||||||
|
assert(false, "error response", "SERVER_ERROR", { request, response, info: { result } });
|
||||||
|
}
|
||||||
|
this.emit("debug", { action: "receiveRequest", id, result });
|
||||||
|
return result.result;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// getLogs, getHistory have weird success responses
|
||||||
|
if (result.status == 0 && (result.message === "No records found" || result.message === "No transactions found")) {
|
||||||
|
this.emit("debug", { action: "receiveRequest", id, result });
|
||||||
|
return result.result;
|
||||||
|
}
|
||||||
|
if (result.status != 1 || (typeof (result.message) === "string" && !result.message.match(/^OK/))) {
|
||||||
|
this.emit("debug", { action: "receiveError", id, result });
|
||||||
|
assert(false, "error response", "SERVER_ERROR", { request, response, info: { result } });
|
||||||
|
}
|
||||||
|
this.emit("debug", { action: "receiveRequest", id, result });
|
||||||
|
return result.result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns %%transaction%% normalized for the Etherscan API.
|
||||||
|
*/
|
||||||
|
_getTransactionPostData(transaction) {
|
||||||
|
const result = {};
|
||||||
|
for (let key in transaction) {
|
||||||
|
if (transaction[key] == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let value = transaction[key];
|
||||||
|
if (key === "type" && value === 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Quantity-types require no leading zero, unless 0
|
||||||
|
if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) {
|
||||||
|
value = toQuantity(value);
|
||||||
|
}
|
||||||
|
else if (key === "accessList") {
|
||||||
|
value = "[" + accessListify(value).map((set) => {
|
||||||
|
return `{address:"${set.address}",storageKeys:["${set.storageKeys.join('","')}"]}`;
|
||||||
|
}).join(",") + "]";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
value = hexlify(value);
|
||||||
|
}
|
||||||
|
result[key] = value;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Throws the normalized Etherscan error.
|
||||||
|
*/
|
||||||
|
_checkError(req, error, transaction) {
|
||||||
|
// Pull any message out if, possible
|
||||||
|
let message = "";
|
||||||
|
if (isError(error, "SERVER_ERROR")) {
|
||||||
|
// Check for an error emitted by a proxy call
|
||||||
|
try {
|
||||||
|
message = error.info.result.error.message;
|
||||||
|
}
|
||||||
|
catch (e) { }
|
||||||
|
if (!message) {
|
||||||
|
try {
|
||||||
|
message = error.info.message;
|
||||||
|
}
|
||||||
|
catch (e) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (req.method === "estimateGas") {
|
||||||
|
if (!message.match(/revert/i) && message.match(/insufficient funds/i)) {
|
||||||
|
assert(false, "insufficient funds", "INSUFFICIENT_FUNDS", {
|
||||||
|
transaction: req.transaction
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (req.method === "call" || req.method === "estimateGas") {
|
||||||
|
if (message.match(/execution reverted/i)) {
|
||||||
|
let data = "";
|
||||||
|
try {
|
||||||
|
data = error.info.result.error.data;
|
||||||
|
}
|
||||||
|
catch (error) { }
|
||||||
|
const e = AbiCoder.getBuiltinCallException(req.method, req.transaction, data);
|
||||||
|
e.info = { request: req, error };
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (message) {
|
||||||
|
if (req.method === "broadcastTransaction") {
|
||||||
|
const transaction = Transaction.from(req.signedTransaction);
|
||||||
|
if (message.match(/replacement/i) && message.match(/underpriced/i)) {
|
||||||
|
assert(false, "replacement fee too low", "REPLACEMENT_UNDERPRICED", {
|
||||||
|
transaction
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (message.match(/insufficient funds/)) {
|
||||||
|
assert(false, "insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", {
|
||||||
|
transaction
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) {
|
||||||
|
assert(false, "nonce has already been used", "NONCE_EXPIRED", {
|
||||||
|
transaction
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Something we could not process
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
async _detectNetwork() {
|
||||||
|
return this.network;
|
||||||
|
}
|
||||||
|
async _perform(req) {
|
||||||
|
switch (req.method) {
|
||||||
|
case "chainId":
|
||||||
|
return this.network.chainId;
|
||||||
|
case "getBlockNumber":
|
||||||
|
return this.fetch("proxy", { action: "eth_blockNumber" });
|
||||||
|
case "getGasPrice":
|
||||||
|
return this.fetch("proxy", { action: "eth_gasPrice" });
|
||||||
|
case "getBalance":
|
||||||
|
// Returns base-10 result
|
||||||
|
return this.fetch("account", {
|
||||||
|
action: "balance",
|
||||||
|
address: req.address,
|
||||||
|
tag: req.blockTag
|
||||||
|
});
|
||||||
|
case "getTransactionCount":
|
||||||
|
return this.fetch("proxy", {
|
||||||
|
action: "eth_getTransactionCount",
|
||||||
|
address: req.address,
|
||||||
|
tag: req.blockTag
|
||||||
|
});
|
||||||
|
case "getCode":
|
||||||
|
return this.fetch("proxy", {
|
||||||
|
action: "eth_getCode",
|
||||||
|
address: req.address,
|
||||||
|
tag: req.blockTag
|
||||||
|
});
|
||||||
|
case "getStorage":
|
||||||
|
return this.fetch("proxy", {
|
||||||
|
action: "eth_getStorageAt",
|
||||||
|
address: req.address,
|
||||||
|
position: req.position,
|
||||||
|
tag: req.blockTag
|
||||||
|
});
|
||||||
|
case "broadcastTransaction":
|
||||||
|
return this.fetch("proxy", {
|
||||||
|
action: "eth_sendRawTransaction",
|
||||||
|
hex: req.signedTransaction
|
||||||
|
}, true).catch((error) => {
|
||||||
|
return this._checkError(req, error, req.signedTransaction);
|
||||||
|
});
|
||||||
|
case "getBlock":
|
||||||
|
if ("blockTag" in req) {
|
||||||
|
return this.fetch("proxy", {
|
||||||
|
action: "eth_getBlockByNumber",
|
||||||
|
tag: req.blockTag,
|
||||||
|
boolean: (req.includeTransactions ? "true" : "false")
|
||||||
|
});
|
||||||
|
}
|
||||||
|
assert(false, "getBlock by blockHash not supported by Etherscan", "UNSUPPORTED_OPERATION", {
|
||||||
|
operation: "getBlock(blockHash)"
|
||||||
|
});
|
||||||
|
case "getTransaction":
|
||||||
|
return this.fetch("proxy", {
|
||||||
|
action: "eth_getTransactionByHash",
|
||||||
|
txhash: req.hash
|
||||||
|
});
|
||||||
|
case "getTransactionReceipt":
|
||||||
|
return this.fetch("proxy", {
|
||||||
|
action: "eth_getTransactionReceipt",
|
||||||
|
txhash: req.hash
|
||||||
|
});
|
||||||
|
case "call": {
|
||||||
|
if (req.blockTag !== "latest") {
|
||||||
|
throw new Error("EtherscanProvider does not support blockTag for call");
|
||||||
|
}
|
||||||
|
const postData = this._getTransactionPostData(req.transaction);
|
||||||
|
postData.module = "proxy";
|
||||||
|
postData.action = "eth_call";
|
||||||
|
try {
|
||||||
|
return await this.fetch("proxy", postData, true);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
return this._checkError(req, error, req.transaction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case "estimateGas": {
|
||||||
|
const postData = this._getTransactionPostData(req.transaction);
|
||||||
|
postData.module = "proxy";
|
||||||
|
postData.action = "eth_estimateGas";
|
||||||
|
try {
|
||||||
|
return await this.fetch("proxy", postData, true);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
return this._checkError(req, error, req.transaction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
case "getLogs": {
|
||||||
|
// Needs to complain if more than one address is passed in
|
||||||
|
const args: Record<string, any> = { action: "getLogs" }
|
||||||
|
|
||||||
|
if (params.filter.fromBlock) {
|
||||||
|
args.fromBlock = checkLogTag(params.filter.fromBlock);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.filter.toBlock) {
|
||||||
|
args.toBlock = checkLogTag(params.filter.toBlock);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.filter.address) {
|
||||||
|
args.address = params.filter.address;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @TODO: We can handle slightly more complicated logs using the logs API
|
||||||
|
if (params.filter.topics && params.filter.topics.length > 0) {
|
||||||
|
if (params.filter.topics.length > 1) {
|
||||||
|
logger.throwError("unsupported topic count", Logger.Errors.UNSUPPORTED_OPERATION, { topics: params.filter.topics });
|
||||||
|
}
|
||||||
|
if (params.filter.topics.length === 1) {
|
||||||
|
const topic0 = params.filter.topics[0];
|
||||||
|
if (typeof(topic0) !== "string" || topic0.length !== 66) {
|
||||||
|
logger.throwError("unsupported topic format", Logger.Errors.UNSUPPORTED_OPERATION, { topic0: topic0 });
|
||||||
|
}
|
||||||
|
args.topic0 = topic0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const logs: Array<any> = await this.fetch("logs", args);
|
||||||
|
|
||||||
|
// Cache txHash => blockHash
|
||||||
|
let blocks: { [tag: string]: string } = {};
|
||||||
|
|
||||||
|
// Add any missing blockHash to the logs
|
||||||
|
for (let i = 0; i < logs.length; i++) {
|
||||||
|
const log = logs[i];
|
||||||
|
if (log.blockHash != null) { continue; }
|
||||||
|
if (blocks[log.blockNumber] == null) {
|
||||||
|
const block = await this.getBlock(log.blockNumber);
|
||||||
|
if (block) {
|
||||||
|
blocks[log.blockNumber] = block.hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.blockHash = blocks[log.blockNumber];
|
||||||
|
}
|
||||||
|
|
||||||
|
return logs;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return super._perform(req);
|
||||||
|
}
|
||||||
|
async getNetwork() {
|
||||||
|
return this.network;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Resolves to the current price of ether.
|
||||||
|
*
|
||||||
|
* This returns ``0`` on any network other than ``mainnet``.
|
||||||
|
*/
|
||||||
|
async getEtherPrice() {
|
||||||
|
if (this.network.name !== "mainnet") {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
return parseFloat((await this.fetch("stats", { action: "ethprice" })).ethusd);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Resolves to a [Contract]] for %%address%%, using the
|
* Resolves to a [Contract]] for %%address%%, using the
|
||||||
* Etherscan API to retreive the Contract ABI.
|
* Etherscan API to retreive the Contract ABI.
|
||||||
@ -42,7 +473,9 @@ export class EtherscanProvider extends BaseEtherscanProvider {
|
|||||||
address = await address;
|
address = await address;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const resp = await this.fetch("contract", { action: "getabi", address });
|
const resp = await this.fetch("contract", {
|
||||||
|
action: "getabi", address
|
||||||
|
});
|
||||||
const abi = JSON.parse(resp);
|
const abi = JSON.parse(resp);
|
||||||
return new Contract(address, abi, this);
|
return new Contract(address, abi, this);
|
||||||
}
|
}
|
||||||
@ -50,5 +483,8 @@ export class EtherscanProvider extends BaseEtherscanProvider {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isCommunityResource() {
|
||||||
|
return (this.apiKey == null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=provider-etherscan.js.map
|
//# sourceMappingURL=provider-etherscan.js.map
|
File diff suppressed because one or more lines are too long
@ -1,101 +1,105 @@
|
|||||||
"use strict";
|
/**
|
||||||
/*
|
* [[link-pocket]] provides a third-party service for connecting to
|
||||||
import { defineProperties } from "../utils/properties.js";
|
* various blockchains over JSON-RPC.
|
||||||
import { FetchRequest } from "../web/index.js";
|
*
|
||||||
|
* **Supported Networks**
|
||||||
|
*
|
||||||
|
* - Ethereum Mainnet (``mainnet``)
|
||||||
|
* - Goerli Testnet (``goerli``)
|
||||||
|
* - Polygon (``matic``)
|
||||||
|
* - Arbitrum (``arbitrum``)
|
||||||
|
*
|
||||||
|
* @_subsection: api/providers/thirdparty:Pocket [providers-pocket]
|
||||||
|
*/
|
||||||
|
import { defineProperties, FetchRequest, assertArgument } from "../utils/index.js";
|
||||||
import { showThrottleMessage } from "./community.js";
|
import { showThrottleMessage } from "./community.js";
|
||||||
import { logger } from "../utils/logger.js";
|
|
||||||
import { Network } from "./network.js";
|
import { Network } from "./network.js";
|
||||||
import { JsonRpcProvider } from "./provider-jsonrpc.js";
|
import { JsonRpcProvider } from "./provider-jsonrpc.js";
|
||||||
|
const defaultApplicationId = "62e1ad51b37b8e00394bda3b";
|
||||||
import type { ConnectionInfo, ThrottleRetryFunc } from "../web/index.js";
|
function getHost(name) {
|
||||||
|
|
||||||
import type { CommunityResourcable } from "./community.js";
|
|
||||||
import type { Networkish } from "./network.js";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// These are load-balancer-based application IDs
|
|
||||||
const defaultAppIds: Record<string, string> = {
|
|
||||||
homestead: "6004bcd10040261633ade990",
|
|
||||||
ropsten: "6004bd4d0040261633ade991",
|
|
||||||
rinkeby: "6004bda20040261633ade994",
|
|
||||||
goerli: "6004bd860040261633ade992",
|
|
||||||
};
|
|
||||||
|
|
||||||
function getHost(name: string): string {
|
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "homestead":
|
case "mainnet":
|
||||||
return "eth-mainnet.gateway.pokt.network";
|
return "eth-mainnet.gateway.pokt.network";
|
||||||
case "ropsten":
|
|
||||||
return "eth-ropsten.gateway.pokt.network";
|
|
||||||
case "rinkeby":
|
|
||||||
return "eth-rinkeby.gateway.pokt.network";
|
|
||||||
case "goerli":
|
case "goerli":
|
||||||
return "eth-goerli.gateway.pokt.network";
|
return "eth-goerli.gateway.pokt.network";
|
||||||
|
case "matic":
|
||||||
|
return "poly-mainnet.gateway.pokt.network";
|
||||||
|
case "maticmum":
|
||||||
|
return "polygon-mumbai-rpc.gateway.pokt.network";
|
||||||
}
|
}
|
||||||
|
assertArgument(false, "unsupported network", "network", name);
|
||||||
return logger.throwArgumentError("unsupported network", "network", name);
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
function normalizeApiKey(network: Network, _appId?: null | string, applicationSecretKey?: null | string, loadBalancer?: boolean): { applicationId: string, applicationSecretKey: null | string, loadBalancer: boolean, community: boolean } {
|
* The **PocketProvider** connects to the [[link-pocket]]
|
||||||
loadBalancer = !!loadBalancer;
|
* JSON-RPC end-points.
|
||||||
|
*
|
||||||
let community = false;
|
* By default, a highly-throttled API key is used, which is
|
||||||
let applicationId = _appId;
|
* appropriate for quick prototypes and simple scripts. To
|
||||||
if (applicationId == null) {
|
* gain access to an increased rate-limit, it is highly
|
||||||
applicationId = defaultAppIds[network.name];
|
* recommended to [sign up here](link-pocket-signup).
|
||||||
if (applicationId == null) {
|
*/
|
||||||
logger.throwArgumentError("network does not support default applicationId", "applicationId", _appId);
|
export class PocketProvider extends JsonRpcProvider {
|
||||||
|
/**
|
||||||
|
* The Application ID for the Pocket connection.
|
||||||
|
*/
|
||||||
|
applicationId;
|
||||||
|
/**
|
||||||
|
* The Application Secret for making authenticated requests
|
||||||
|
* to the Pocket connection.
|
||||||
|
*/
|
||||||
|
applicationSecret;
|
||||||
|
/**
|
||||||
|
* Create a new **PocketProvider**.
|
||||||
|
*
|
||||||
|
* By default connecting to ``mainnet`` with a highly throttled
|
||||||
|
* API key.
|
||||||
|
*/
|
||||||
|
constructor(_network, applicationId, applicationSecret) {
|
||||||
|
if (_network == null) {
|
||||||
|
_network = "mainnet";
|
||||||
}
|
}
|
||||||
loadBalancer = true;
|
|
||||||
community = true;
|
|
||||||
} else if (applicationId === defaultAppIds[network.name]) {
|
|
||||||
loadBalancer = true;
|
|
||||||
community = true;
|
|
||||||
}
|
|
||||||
if (applicationSecretKey == null) { applicationSecretKey = null; }
|
|
||||||
|
|
||||||
return { applicationId, applicationSecretKey, community, loadBalancer };
|
|
||||||
}
|
|
||||||
|
|
||||||
export class PocketProvider extends JsonRpcProvider implements CommunityResourcable {
|
|
||||||
readonly applicationId!: string;
|
|
||||||
readonly applicationSecretKey!: null | string;
|
|
||||||
readonly loadBalancer!: boolean;
|
|
||||||
|
|
||||||
constructor(_network: Networkish = "homestead", _appId?: null | string, _secretKey?: null | string, _loadBalancer?: boolean) {
|
|
||||||
const network = Network.from(_network);
|
const network = Network.from(_network);
|
||||||
const { applicationId, applicationSecretKey, loadBalancer } = normalizeApiKey(network, _appId, _secretKey, _loadBalancer);
|
if (applicationId == null) {
|
||||||
|
applicationId = defaultApplicationId;
|
||||||
const connection = PocketProvider.getConnection(network, applicationId, applicationSecretKey, loadBalancer);
|
|
||||||
super(connection, network, { staticNetwork: network });
|
|
||||||
|
|
||||||
defineProperties<PocketProvider>(this, { applicationId, applicationSecretKey, loadBalancer });
|
|
||||||
}
|
}
|
||||||
|
if (applicationSecret == null) {
|
||||||
static getConnection(network: Network, _appId?: null | string, _secretKey?: null | string, _loadBalancer?: boolean): ConnectionInfo {
|
applicationSecret = null;
|
||||||
const { applicationId, applicationSecretKey, community, loadBalancer } = normalizeApiKey(network, _appId, _secretKey, _loadBalancer);
|
}
|
||||||
|
const options = { staticNetwork: network };
|
||||||
let url = `https:/\/${ getHost(network.name) }/v1/`;
|
const request = PocketProvider.getRequest(network, applicationId, applicationSecret);
|
||||||
if (loadBalancer) { url += "lb/"; }
|
super(request, network, options);
|
||||||
url += applicationId;
|
defineProperties(this, { applicationId, applicationSecret });
|
||||||
|
}
|
||||||
const request = new FetchRequest(url);
|
_getProvider(chainId) {
|
||||||
|
try {
|
||||||
|
return new PocketProvider(chainId, this.applicationId, this.applicationSecret);
|
||||||
|
}
|
||||||
|
catch (error) { }
|
||||||
|
return super._getProvider(chainId);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Returns a prepared request for connecting to %%network%% with
|
||||||
|
* %%applicationId%%.
|
||||||
|
*/
|
||||||
|
static getRequest(network, applicationId, applicationSecret) {
|
||||||
|
if (applicationId == null) {
|
||||||
|
applicationId = defaultApplicationId;
|
||||||
|
}
|
||||||
|
const request = new FetchRequest(`https:/\/${getHost(network.name)}/v1/lb/${applicationId}`);
|
||||||
request.allowGzip = true;
|
request.allowGzip = true;
|
||||||
if (applicationSecretKey) { request.setCredentials("", applicationSecretKey); }
|
if (applicationSecret) {
|
||||||
|
request.setCredentials("", applicationSecret);
|
||||||
const throttleRetry: ThrottleRetryFunc = async (request, response, attempt) => {
|
}
|
||||||
if (community) { showThrottleMessage("PocketProvider"); }
|
if (applicationId === defaultApplicationId) {
|
||||||
|
request.retryFunc = async (request, response, attempt) => {
|
||||||
|
showThrottleMessage("PocketProvider");
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
return { request, throttleRetry };
|
|
||||||
}
|
}
|
||||||
|
return request;
|
||||||
isCommunityResource(): boolean {
|
}
|
||||||
return (this.applicationId === defaultAppIds[this.network.name]);
|
isCommunityResource() {
|
||||||
|
return (this.applicationId === defaultApplicationId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
//# sourceMappingURL=provider-pocket.js.map
|
//# sourceMappingURL=provider-pocket.js.map
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"provider-pocket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-pocket.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkGE"}
|
{"version":3,"file":"provider-pocket.js","sourceRoot":"","sources":["../../src.ts/providers/provider-pocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACH,gBAAgB,EAAE,YAAY,EAAE,cAAc,EACjD,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAKxD,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAExD,SAAS,OAAO,CAAC,IAAY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AAO,KAAK,EAAE,GAAG;QACnB,OAAO,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAgB,EAAE,aAA6B,EAAE,iBAAiC;QAChG,IAAI,aAAa,IAAI,IAAI,EAAE;YAAE,aAAa,GAAG,oBAAoB,CAAC;SAAE;QAEpE,MAAM,OAAO,GAAG,IAAI,YAAY,CAAC,YAAa,OAAO,CAAC,OAAO,CAAC,IAAI,CAAE,UAAW,aAAc,EAAE,CAAC,CAAC;QACjG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;QAEzB,IAAI,iBAAiB,EAAE;YACnB,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC;SACjD;QAED,IAAI,aAAa,KAAK,oBAAoB,EAAE;YACxC,OAAO,CAAC,SAAS,GAAG,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACrD,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;gBACtC,OAAO,IAAI,CAAC;YAChB,CAAC,CAAC;SACL;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,mBAAmB;QACf,OAAO,CAAC,IAAI,CAAC,aAAa,KAAK,oBAAoB,CAAC,CAAC;IACzD,CAAC;CACJ"}
|
54
lib.esm/providers/signer-noncemanager.js
Normal file
54
lib.esm/providers/signer-noncemanager.js
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
import { defineProperties } from "../utils/index.js";
|
||||||
|
import { AbstractSigner } from "./abstract-signer.js";
|
||||||
|
export class NonceManager extends AbstractSigner {
|
||||||
|
signer;
|
||||||
|
#noncePromise;
|
||||||
|
#delta;
|
||||||
|
constructor(signer) {
|
||||||
|
super(signer.provider);
|
||||||
|
defineProperties(this, { signer });
|
||||||
|
this.#noncePromise = null;
|
||||||
|
this.#delta = 0;
|
||||||
|
}
|
||||||
|
async getAddress() {
|
||||||
|
return this.signer.getAddress();
|
||||||
|
}
|
||||||
|
connect(provider) {
|
||||||
|
return new NonceManager(this.signer.connect(provider));
|
||||||
|
}
|
||||||
|
async getNonce(blockTag) {
|
||||||
|
if (blockTag === "pending") {
|
||||||
|
if (this.#noncePromise == null) {
|
||||||
|
this.#noncePromise = super.getNonce("pending");
|
||||||
|
}
|
||||||
|
return (await this.#noncePromise) + this.#delta;
|
||||||
|
}
|
||||||
|
return super.getNonce(blockTag);
|
||||||
|
}
|
||||||
|
increment() {
|
||||||
|
this.#delta++;
|
||||||
|
}
|
||||||
|
reset() {
|
||||||
|
this.#delta = 0;
|
||||||
|
this.#noncePromise = null;
|
||||||
|
}
|
||||||
|
async sendTransaction(tx) {
|
||||||
|
const noncePromise = this.getNonce("pending");
|
||||||
|
this.increment();
|
||||||
|
tx = await this.signer.populateTransaction(tx);
|
||||||
|
tx.nonce = await noncePromise;
|
||||||
|
// @TODO: Maybe handle interesting/recoverable errors?
|
||||||
|
// Like don't increment if the tx was certainly not sent
|
||||||
|
return await this.signer.sendTransaction(tx);
|
||||||
|
}
|
||||||
|
signTransaction(tx) {
|
||||||
|
return this.signer.signTransaction(tx);
|
||||||
|
}
|
||||||
|
signMessage(message) {
|
||||||
|
return this.signer.signMessage(message);
|
||||||
|
}
|
||||||
|
signTypedData(domain, types, value) {
|
||||||
|
return this.signer.signTypedData(domain, types, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=signer-noncemanager.js.map
|
1
lib.esm/providers/signer-noncemanager.js.map
Normal file
1
lib.esm/providers/signer-noncemanager.js.map
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"signer-noncemanager.js","sourceRoot":"","sources":["../../src.ts/providers/signer-noncemanager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAUtD,MAAM,OAAO,YAAa,SAAQ,cAAc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EAAE,CAAC,CAAC;QAC/C,EAAE,CAAC,KAAK,GAAG,MAAM,YAAY,CAAC;QAE9B,sDAAsD;QACtD,wDAAwD;QACxD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,eAAe,CAAC,EAAsB;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,WAAW,CAAC,OAA4B;QACpC,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,aAAa,CAAC,MAAuB,EAAE,KAA4C,EAAE,KAA0B;QAC3G,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;CACJ"}
|
@ -45,6 +45,10 @@ export class PollingBlockSubscriber {
|
|||||||
this.#blockNumber = blockNumber;
|
this.#blockNumber = blockNumber;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// We have been stopped
|
||||||
|
if (this.#poller == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// @TODO: Put a cap on the maximum number of events per loop?
|
// @TODO: Put a cap on the maximum number of events per loop?
|
||||||
if (blockNumber !== this.#blockNumber) {
|
if (blockNumber !== this.#blockNumber) {
|
||||||
for (let b = this.#blockNumber + 1; b <= blockNumber; b++) {
|
for (let b = this.#blockNumber + 1; b <= blockNumber; b++) {
|
||||||
@ -58,8 +62,8 @@ export class PollingBlockSubscriber {
|
|||||||
if (this.#poller) {
|
if (this.#poller) {
|
||||||
throw new Error("subscriber already running");
|
throw new Error("subscriber already running");
|
||||||
}
|
}
|
||||||
this.#poll();
|
|
||||||
this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval);
|
this.#poller = this.#provider._setTimeout(this.#poll.bind(this), this.#interval);
|
||||||
|
this.#poll();
|
||||||
}
|
}
|
||||||
stop() {
|
stop() {
|
||||||
if (!this.#poller) {
|
if (!this.#poller) {
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
|||||||
"use strict";
|
export {};
|
||||||
/*
|
/*
|
||||||
import { defineProperties } from "@ethersproject/properties";
|
import { defineProperties } from "@ethersproject/properties";
|
||||||
export type EventCommon = "block" | "debug" | "blockObject";
|
export type EventCommon = "block" | "debug" | "blockObject";
|
||||||
|
31
package-lock.json
generated
31
package-lock.json
generated
@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "ethers",
|
"name": "ethers",
|
||||||
"version": "6.0.0-beta-exports.14",
|
"version": "6.0.0-beta-exports.16",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ethers",
|
"name": "ethers",
|
||||||
"version": "6.0.0-beta-exports.14",
|
"version": "6.0.0-beta-exports.16",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@adraffy/ens-normalize": "git@github.com:ricmoo/ens-normalize.js.git",
|
"@adraffy/ens-normalize": "1.8.9",
|
||||||
"@noble/hashes": "1.1.2",
|
"@noble/hashes": "1.1.2",
|
||||||
"@noble/secp256k1": "1.6.3",
|
"@noble/secp256k1": "1.6.3",
|
||||||
"aes-js": "4.0.0-beta.3",
|
"aes-js": "4.0.0-beta.3",
|
||||||
@ -24,7 +24,7 @@
|
|||||||
"mocha": "10.0.0",
|
"mocha": "10.0.0",
|
||||||
"rollup": "2.78.1",
|
"rollup": "2.78.1",
|
||||||
"semver": "7.3.7",
|
"semver": "7.3.7",
|
||||||
"typescript": "4.7.4",
|
"typescript": "4.9.5",
|
||||||
"uglify-js": "3.17.0"
|
"uglify-js": "3.17.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@ -32,9 +32,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@adraffy/ens-normalize": {
|
"node_modules/@adraffy/ens-normalize": {
|
||||||
"version": "1.8.8",
|
"version": "1.8.9",
|
||||||
"resolved": "git+ssh://git@github.com/ricmoo/ens-normalize.js.git#b8658d11c63396b605372e0d5d6d88665d5e97eb",
|
"resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.8.9.tgz",
|
||||||
"license": "MIT"
|
"integrity": "sha512-93OmGCV0vO8+JQ3FHG+gZk/MPHzzMPDRiCiFcCQNTCnHaaxsacO3ScTPGlu2wX2dOtgfalbchPcw1cOYYjHCYQ=="
|
||||||
},
|
},
|
||||||
"node_modules/@bcoe/v8-coverage": {
|
"node_modules/@bcoe/v8-coverage": {
|
||||||
"version": "0.2.3",
|
"version": "0.2.3",
|
||||||
@ -1391,9 +1391,9 @@
|
|||||||
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="
|
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "4.7.4",
|
"version": "4.9.5",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
||||||
"integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
|
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
@ -1565,8 +1565,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@adraffy/ens-normalize": {
|
"@adraffy/ens-normalize": {
|
||||||
"version": "git+ssh://git@github.com/ricmoo/ens-normalize.js.git#b8658d11c63396b605372e0d5d6d88665d5e97eb",
|
"version": "1.8.9",
|
||||||
"from": "@adraffy/ens-normalize@git@github.com:ricmoo/ens-normalize.js.git"
|
"resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.8.9.tgz",
|
||||||
|
"integrity": "sha512-93OmGCV0vO8+JQ3FHG+gZk/MPHzzMPDRiCiFcCQNTCnHaaxsacO3ScTPGlu2wX2dOtgfalbchPcw1cOYYjHCYQ=="
|
||||||
},
|
},
|
||||||
"@bcoe/v8-coverage": {
|
"@bcoe/v8-coverage": {
|
||||||
"version": "0.2.3",
|
"version": "0.2.3",
|
||||||
@ -2560,9 +2561,9 @@
|
|||||||
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="
|
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "4.7.4",
|
"version": "4.9.5",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
||||||
"integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
|
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"uglify-js": {
|
"uglify-js": {
|
||||||
|
10
package.json
10
package.json
@ -9,10 +9,10 @@
|
|||||||
"./lib.esm/wordlists/wordlists.js": "./lib.esm/wordlists/wordlists-browser.js"
|
"./lib.esm/wordlists/wordlists.js": "./lib.esm/wordlists/wordlists-browser.js"
|
||||||
},
|
},
|
||||||
"comment": {
|
"comment": {
|
||||||
"@adraffy/ens-normalize": "1.8.8"
|
"@adraffy/ens-normalize": "git@github.com:ricmoo/ens-normalize.js.git"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@adraffy/ens-normalize": "git@github.com:ricmoo/ens-normalize.js.git",
|
"@adraffy/ens-normalize": "1.8.9",
|
||||||
"@noble/hashes": "1.1.2",
|
"@noble/hashes": "1.1.2",
|
||||||
"@noble/secp256k1": "1.6.3",
|
"@noble/secp256k1": "1.6.3",
|
||||||
"aes-js": "4.0.0-beta.3",
|
"aes-js": "4.0.0-beta.3",
|
||||||
@ -28,7 +28,7 @@
|
|||||||
"mocha": "10.0.0",
|
"mocha": "10.0.0",
|
||||||
"rollup": "2.78.1",
|
"rollup": "2.78.1",
|
||||||
"semver": "7.3.7",
|
"semver": "7.3.7",
|
||||||
"typescript": "4.7.4",
|
"typescript": "4.9.5",
|
||||||
"uglify-js": "3.17.0"
|
"uglify-js": "3.17.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@ -96,7 +96,7 @@
|
|||||||
"types": "./types/wordlistsindex.d.ts"
|
"types": "./types/wordlistsindex.d.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gitHead": "c3f8e8ac0753cecbca64e602c73139b38fd7f58a",
|
"gitHead": "7c37182d03e407175eefab4509dfde43f247c699",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"ethereum",
|
"ethereum",
|
||||||
"ethers",
|
"ethers",
|
||||||
@ -136,5 +136,5 @@
|
|||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "./types/index.d.ts",
|
"types": "./types/index.d.ts",
|
||||||
"version": "6.0.0-beta-exports.15"
|
"version": "6.0.0-beta-exports.16"
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
export const version: string = "6.0.0-beta-exports.15";
|
export const version: string = "6.0.0-beta-exports.16";
|
||||||
|
10
types/abi/fragments.d.ts
vendored
10
types/abi/fragments.d.ts
vendored
@ -72,17 +72,17 @@ export interface JsonFragment {
|
|||||||
/**
|
/**
|
||||||
* The format to serialize the output as.
|
* The format to serialize the output as.
|
||||||
*/
|
*/
|
||||||
export declare type FormatType = "sighash" | "minimal" | "full" | "json";
|
export type FormatType = "sighash" | "minimal" | "full" | "json";
|
||||||
/**
|
/**
|
||||||
* When [walking](ParamType-walk) a [[ParamType]], this is called
|
* When [walking](ParamType-walk) a [[ParamType]], this is called
|
||||||
* on each component.
|
* on each component.
|
||||||
*/
|
*/
|
||||||
export declare type ParamTypeWalkFunc = (type: string, value: any) => any;
|
export type ParamTypeWalkFunc = (type: string, value: any) => any;
|
||||||
/**
|
/**
|
||||||
* When [walking asynchronously](ParamType-walkAsync) a [[ParamType]],
|
* When [walking asynchronously](ParamType-walkAsync) a [[ParamType]],
|
||||||
* this is called on each component.
|
* this is called on each component.
|
||||||
*/
|
*/
|
||||||
export declare type ParamTypeWalkAsyncFunc = (type: string, value: any) => any | Promise<any>;
|
export type ParamTypeWalkAsyncFunc = (type: string, value: any) => any | Promise<any>;
|
||||||
/**
|
/**
|
||||||
* Each input and output of a [[Fragment]] is an Array of **PAramType**.
|
* Each input and output of a [[Fragment]] is an Array of **PAramType**.
|
||||||
*/
|
*/
|
||||||
@ -198,7 +198,7 @@ export declare class ParamType {
|
|||||||
/**
|
/**
|
||||||
* The type of a [[Fragment]].
|
* The type of a [[Fragment]].
|
||||||
*/
|
*/
|
||||||
export declare type FragmentType = "constructor" | "error" | "event" | "fallback" | "function" | "struct";
|
export type FragmentType = "constructor" | "error" | "event" | "fallback" | "function" | "struct";
|
||||||
/**
|
/**
|
||||||
* An abstract class to represent An individual fragment from a parse ABI.
|
* An abstract class to represent An individual fragment from a parse ABI.
|
||||||
*/
|
*/
|
||||||
@ -289,6 +289,7 @@ export declare class EventFragment extends NamedFragment {
|
|||||||
*/
|
*/
|
||||||
get topicHash(): string;
|
get topicHash(): string;
|
||||||
format(format?: FormatType): string;
|
format(format?: FormatType): string;
|
||||||
|
static getTopicHash(name: string, params?: Array<any>): string;
|
||||||
static from(obj: any): EventFragment;
|
static from(obj: any): EventFragment;
|
||||||
static isFragment(value: any): value is EventFragment;
|
static isFragment(value: any): value is EventFragment;
|
||||||
}
|
}
|
||||||
@ -353,6 +354,7 @@ export declare class FunctionFragment extends NamedFragment {
|
|||||||
*/
|
*/
|
||||||
get selector(): string;
|
get selector(): string;
|
||||||
format(format?: FormatType): string;
|
format(format?: FormatType): string;
|
||||||
|
static getSelector(name: string, params?: Array<any>): string;
|
||||||
static from(obj: any): FunctionFragment;
|
static from(obj: any): FunctionFragment;
|
||||||
static isFragment(value: any): value is FunctionFragment;
|
static isFragment(value: any): value is FunctionFragment;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
2
types/abi/interface.d.ts
vendored
2
types/abi/interface.d.ts
vendored
@ -44,7 +44,7 @@ export declare class Indexed {
|
|||||||
/**
|
/**
|
||||||
* @TODO
|
* @TODO
|
||||||
*/
|
*/
|
||||||
export declare type InterfaceAbi = string | ReadonlyArray<Fragment | JsonFragment | string>;
|
export type InterfaceAbi = string | ReadonlyArray<Fragment | JsonFragment | string>;
|
||||||
/**
|
/**
|
||||||
* An Interface abstracts many of the low-level details for
|
* An Interface abstracts many of the low-level details for
|
||||||
* encoding and decoding the data on the blockchain.
|
* encoding and decoding the data on the blockchain.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endored
@ -29,7 +29,7 @@ export interface Addressable {
|
|||||||
/**
|
/**
|
||||||
* Anything that can be used to return or resolve an address.
|
* Anything that can be used to return or resolve an address.
|
||||||
*/
|
*/
|
||||||
export declare type AddressLike = string | Promise<string> | Addressable;
|
export type AddressLike = string | Promise<string> | Addressable;
|
||||||
/**
|
/**
|
||||||
* An interface for any object which can resolve an ENS name.
|
* An interface for any object which can resolve an ENS name.
|
||||||
*/
|
*/
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/address/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IACxB;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,oBAAY,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;;OAMG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;CACrD;AAED,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/address/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IACxB;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;;OAMG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;CACrD;AAED,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
8
types/contract/types.d.ts
vendored
8
types/contract/types.d.ts
vendored
@ -1,7 +1,7 @@
|
|||||||
import type { EventFragment, FunctionFragment, Result, Typed } from "../abi/index.js";
|
import type { EventFragment, FunctionFragment, Result, Typed } from "../abi/index.js";
|
||||||
import type { TransactionRequest, PreparedTransactionRequest, TopicFilter } from "../providers/index.js";
|
import type { TransactionRequest, PreparedTransactionRequest, TopicFilter } from "../providers/index.js";
|
||||||
import type { ContractTransactionResponse } from "./wrappers.js";
|
import type { ContractTransactionResponse } from "./wrappers.js";
|
||||||
export declare type ContractEventName = string | ContractEvent | TopicFilter | DeferredTopicFilter;
|
export type ContractEventName = string | ContractEvent | TopicFilter | DeferredTopicFilter;
|
||||||
export interface ContractInterface {
|
export interface ContractInterface {
|
||||||
[name: string]: BaseContractMethod;
|
[name: string]: BaseContractMethod;
|
||||||
}
|
}
|
||||||
@ -18,8 +18,8 @@ export interface ContractDeployTransaction extends Omit<ContractTransaction, "to
|
|||||||
}
|
}
|
||||||
export interface Overrides extends Omit<TransactionRequest, "to" | "data"> {
|
export interface Overrides extends Omit<TransactionRequest, "to" | "data"> {
|
||||||
}
|
}
|
||||||
export declare type PostfixOverrides<A extends Array<any>> = A | [...A, Overrides];
|
export type PostfixOverrides<A extends Array<any>> = A | [...A, Overrides];
|
||||||
export declare type ContractMethodArgs<A extends Array<any>> = PostfixOverrides<{
|
export type ContractMethodArgs<A extends Array<any>> = PostfixOverrides<{
|
||||||
[I in keyof A]-?: A[I] | Typed;
|
[I in keyof A]-?: A[I] | Typed;
|
||||||
}>;
|
}>;
|
||||||
export interface BaseContractMethod<A extends Array<any> = Array<any>, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> {
|
export interface BaseContractMethod<A extends Array<any> = Array<any>, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> {
|
||||||
@ -37,7 +37,7 @@ export interface ContractMethod<A extends Array<any> = Array<any>, R = any, D ex
|
|||||||
}
|
}
|
||||||
export interface ConstantContractMethod<A extends Array<any>, R = any> extends ContractMethod<A, R, R> {
|
export interface ConstantContractMethod<A extends Array<any>, R = any> extends ContractMethod<A, R, R> {
|
||||||
}
|
}
|
||||||
export declare type ContractEventArgs<A extends Array<any>> = {
|
export type ContractEventArgs<A extends Array<any>> = {
|
||||||
[I in keyof A]?: A[I] | Typed | null;
|
[I in keyof A]?: A[I] | Typed | null;
|
||||||
};
|
};
|
||||||
export interface ContractEvent<A extends Array<any> = Array<any>> {
|
export interface ContractEvent<A extends Array<any> = Array<any>> {
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src.ts/contract/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EACjD,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACR,kBAAkB,EAAE,0BAA0B,EAAE,WAAW,EAC9D,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAIjE,oBAAY,iBAAiB,GAAG,MAAM,GAAG,aAAa,GAAG,WAAW,GAAG,mBAAmB,CAAC;AAE3F,MAAM,WAAW,iBAAiB;IAC9B,CAAE,IAAI,EAAE,MAAM,GAAI,kBAAkB,CAAC;CACxC;AAED,MAAM,WAAW,mBAAmB;IAChC,cAAc,I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kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;CAAI;AAEzC,MAAM,WAAW,sBAAsB,CACnC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,EACpB,CAAC,GAAG,GAAG,CACT,SAAQ,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;CAAI;AAIrC,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,IAAI;KAAI,CAAC,IAAI,MAAM,CAAC,CAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI;CAAE,CAAC;AAEjG,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;IAC5D,CAAC,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,mBAAmB,CAAC;IAErD,IAAI,EAAE,MAAM,CAAC;IAEb,QAAQ,EAAE,aAAa,CAAC;IACxB,WAAW,CAAC,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC;CAC7D"}
|
2
types/crypto/scrypt.d.ts
vendored
2
types/crypto/scrypt.d.ts
vendored
@ -5,7 +5,7 @@ import type { BytesLike } from "../utils/index.js";
|
|||||||
*
|
*
|
||||||
* The %%percent%% is a value between ``0`` and ``1``.
|
* The %%percent%% is a value between ``0`` and ``1``.
|
||||||
*/
|
*/
|
||||||
export declare type ProgressCallback = (percent: number) => void;
|
export type ProgressCallback = (percent: number) => void;
|
||||||
/**
|
/**
|
||||||
* The [[link-wiki-scrypt]] uses a memory and cpu hard method of
|
* The [[link-wiki-scrypt]] uses a memory and cpu hard method of
|
||||||
* derivation to increase the resource cost to brute-force a password
|
* derivation to increase the resource cost to brute-force a password
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"scrypt.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/scrypt.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AJqB,MAAM;;;;;AAa5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIvH;yBAJe,UAAU"}
|
2
types/crypto/signature.d.ts
vendored
2
types/crypto/signature.d.ts
vendored
@ -1,5 +1,5 @@
|
|||||||
import type { BigNumberish, BytesLike } from "../utils/index.js";
|
import type { BigNumberish, BytesLike } from "../utils/index.js";
|
||||||
export declare type SignatureLike = Signature | string | {
|
export type SignatureLike = Signature | string | {
|
||||||
r: string;
|
r: string;
|
||||||
s: string;
|
s: string;
|
||||||
v: BigNumberish;
|
v: BigNumberish;
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/signature.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,YAAY,EAAE,SAAS,EAC1B,MAAM,mBAAmB,CAAC;AAe3B,oBAAY,aAAa,GAAG,SAAS,GAAG,MAAM,GAAG;IAC7C,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,YAAY,CAAC;IAChB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG;IACA,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACd,GAAG;IACA,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;IACf,CAAC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AED;;;OAGG;IACH,IAAI,QAAQ,IAAI,IAAI,GAAG,MAAM,CAA2B;IAExD;;;OAGG;IACH,IAAI,aAAa,IAAI,IAAI,GAAG,MAAM,CAIjC;IAED;;;;OAIG;IACH,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,CAEnB;IAED;;;OAGG;IACH,IAAI,WAAW,IAAI,MAAM,CAKxB;IAED;;OAEG;IACH,IAAI,iBAAiB,IAAI,MAAM,CAE9B;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE;IAYxD;;OAEG;IACH,KAAK,IAAI,SAAS;IAMlB;;OAEG;IACH,MAAM,IAAI,GAAG;IASb;;;;;;;;;OASG;IACH,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM;IAY1C;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,MAAM;IAI7D;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,YAAY,GAAG,EAAE,GAAG,EAAE;IAY/C;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,aAAa,GAAG,SAAS;CAuF9C"}
|
2
types/ethers.d.ts
vendored
2
types/ethers.d.ts
vendored
@ -5,7 +5,7 @@ export { ZeroAddress, WeiPerEther, MaxUint256, MinInt256, MaxInt256, N, ZeroHash
|
|||||||
export { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, EventLog, } from "./contract/index.js";
|
export { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, EventLog, } from "./contract/index.js";
|
||||||
export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, lock, Signature, SigningKey } from "./crypto/index.js";
|
export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, lock, Signature, SigningKey } from "./crypto/index.js";
|
||||||
export { id, ensNormalize, isValidName, namehash, dnsEncode, hashMessage, verifyMessage, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, TypedDataEncoder } from "./hash/index.js";
|
export { id, ensNormalize, isValidName, namehash, dnsEncode, hashMessage, verifyMessage, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, TypedDataEncoder } from "./hash/index.js";
|
||||||
export { getDefaultProvider, Block, FeeData, Log, TransactionReceipt, TransactionResponse, AbstractSigner, VoidSigner, AbstractProvider, FallbackProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, BrowserProvider, AlchemyProvider, AnkrProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, QuickNodeProvider, IpcSocketProvider, SocketProvider, WebSocketProvider, EnsResolver, Network } from "./providers/index.js";
|
export { getDefaultProvider, Block, FeeData, Log, TransactionReceipt, TransactionResponse, AbstractSigner, NonceManager, VoidSigner, AbstractProvider, FallbackProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, BrowserProvider, AlchemyProvider, AnkrProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, PocketProvider, QuickNodeProvider, IpcSocketProvider, SocketProvider, WebSocketProvider, EnsResolver, Network } from "./providers/index.js";
|
||||||
export { accessListify, computeAddress, recoverAddress, Transaction } from "./transaction/index.js";
|
export { accessListify, computeAddress, recoverAddress, Transaction } from "./transaction/index.js";
|
||||||
export { decodeBase58, encodeBase58, decodeBase64, encodeBase64, concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify, isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue, defineProperties, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, makeError, isCallException, isError, FetchRequest, FetchResponse, FetchCancelSignal, FixedNumber, getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity, fromTwos, toTwos, mask, formatEther, parseEther, formatUnits, parseUnits, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, decodeRlp, encodeRlp } from "./utils/index.js";
|
export { decodeBase58, encodeBase58, decodeBase64, encodeBase64, concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify, isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue, defineProperties, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, makeError, isCallException, isError, FetchRequest, FetchResponse, FetchCancelSignal, FixedNumber, getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity, fromTwos, toTwos, mask, formatEther, parseEther, formatUnits, parseUnits, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, decodeRlp, encodeRlp } from "./utils/index.js";
|
||||||
export { Mnemonic, BaseWallet, HDNodeWallet, HDNodeVoidWallet, Wallet, defaultPath, getAccountPath, isCrowdsaleJson, isKeystoreJson, decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./wallet/index.js";
|
export { Mnemonic, BaseWallet, HDNodeWallet, HDNodeVoidWallet, Wallet, defaultPath, getAccountPath, isCrowdsaleJson, isKeystoreJson, decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./wallet/index.js";
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user