admin: updated dist files
This commit is contained in:
parent
ee847541be
commit
faef9f81ec
@ -32,13 +32,13 @@ describe("Tests ABI Coder", function () {
|
||||
const tests = (0, utils_js_1.loadTests)("abi");
|
||||
for (const test of tests) {
|
||||
it(`tests ABI encoding: (${test.name})`, function () {
|
||||
const encoded = index_js_1.defaultAbiCoder.encode([test.type], [test.value]);
|
||||
const encoded = index_js_1.AbiCoder.defaultAbiCoder().encode([test.type], [test.value]);
|
||||
assert_1.default.equal(encoded, test.encoded, "encoded");
|
||||
});
|
||||
}
|
||||
for (const test of tests) {
|
||||
it(`tests ABI decoding: (${test.name})`, function () {
|
||||
const decoded = index_js_1.defaultAbiCoder.decode([test.type], test.encoded)[0];
|
||||
const decoded = index_js_1.AbiCoder.defaultAbiCoder().decode([test.type], test.encoded)[0];
|
||||
equal(decoded, test.verbose);
|
||||
});
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -25,7 +25,7 @@ describe("computes checksum address", function () {
|
||||
{ name: "too long", value: "0x8ba1f109551bd432803012645ac136ddd64dba7200" },
|
||||
];
|
||||
invalidAddresses.forEach(({ name, value }) => {
|
||||
it(`fails on invalid address: ${name}`, function () {
|
||||
it(`correctly fails on invalid address: ${name}`, function () {
|
||||
assert_1.default.throws(function () {
|
||||
(0, index_js_1.getAddress)(value);
|
||||
}, function (error) {
|
||||
@ -36,7 +36,7 @@ describe("computes checksum address", function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
it("fails on invalid checksum", function () {
|
||||
it("correctly fails on invalid checksum", function () {
|
||||
const value = "0x8ba1f109551bD432803012645Ac136ddd64DBa72";
|
||||
assert_1.default.throws(function () {
|
||||
(0, index_js_1.getAddress)(value);
|
||||
@ -47,7 +47,7 @@ describe("computes checksum address", function () {
|
||||
error.value === value);
|
||||
});
|
||||
});
|
||||
it("fails on invalid IBAN checksum", function () {
|
||||
it("correctly fails on invalid IBAN checksum", function () {
|
||||
const value = "XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37";
|
||||
assert_1.default.throws(function () {
|
||||
(0, index_js_1.getAddress)(value);
|
||||
@ -91,7 +91,7 @@ describe("computes create2 address", function () {
|
||||
const sender = "0x8ba1f109551bD432803012645Ac136ddd64DBA72";
|
||||
const salt = "0x1c8aff950685c2ed4bc3174f3472287b56d9517b9c948127319a09a7a36deac8";
|
||||
const initCodeHash = "0x8452c9b9140222b08593a26daa782707297be9f7b3e8281d7b4974769f19afd0";
|
||||
it("fails on invalid salt", function () {
|
||||
it("correctly fails on invalid salt", function () {
|
||||
const badSalt = "0x1c8aff950685c2ed4bc3174f3472287b56d9517b9c948127319a09a7a36dea";
|
||||
assert_1.default.throws(function () {
|
||||
(0, index_js_1.getCreate2Address)(sender, badSalt, initCodeHash);
|
||||
@ -101,7 +101,7 @@ describe("computes create2 address", function () {
|
||||
error.value === badSalt);
|
||||
});
|
||||
});
|
||||
it("fails on invalid initCodeHash", function () {
|
||||
it("correctly fails on invalid initCodeHash", function () {
|
||||
const badInitCodeHash = "0x8452c9b9140222b08593a26daa782707297be9f7b3e8281d7b4974769f19af";
|
||||
assert_1.default.throws(function () {
|
||||
(0, index_js_1.getCreate2Address)(sender, salt, badInitCodeHash);
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"test-address.js","sourceRoot":"","sources":["../../src.ts/_tests/test-address.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,yCAAuC;AAQvC,0CAGqB;AAGrB,QAAQ,CAAC,2BAA2B,EAAE;IAClC,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAkB,UAAU,CAAC,CAAC;IACrD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,kCAAmC,IAAI,CAAC,IAAK,EAAE,EAAE;YAChD,gBAAM,CAAC,KAAK,CAAC,IAAA,qBAAU,EAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YACrD,gBAAM,CAAC,KAAK,CAAC,IAAA,qBAAU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K,CAAC,KAAK,KAAK,eAAe,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
@ -155,7 +155,7 @@ describe("Test Solidity Hash functions", function () {
|
||||
{ types: ["blorb"], values: [false] },
|
||||
];
|
||||
for (const { types, values } of badTypes) {
|
||||
it("fails on invalid type", function () {
|
||||
it("correctly fails on invalid type", function () {
|
||||
assert_1.default.throws(function () {
|
||||
const result = (0, index_js_1.solidityPacked)(types, values);
|
||||
console.log(result);
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"test-hash.js","sourceRoot":"","sources":["../../src.ts/_tests/test-hash.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAIqB;AAErB,yCAAsC;AAItC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0GE;AAEF,QAAQ,CAAC,oCAAoC,EAAE;IAC3C,MAAM,KAAK,GAAG;QACV;YACI,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,aAAa;YACtB,IAAI,EAAE,oEAAoE;SAC7E;QACD;YACI,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,IAAI,UAAU,CAAC,CAAE,IAAI,EAAE,IAAI,CAAE,CAAC;YACvC,IAAI,EAAE,oEAAoE;SAC7E;QACD;YACI,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,QAAQ;YACjB,IAAI,EAAE,oEAAoE;SAC7E;KACJ,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,sBAAuB,IAAI,CAAC,IAAK,EAAE,EAAE;YACpC,gBAAM,CAAC,KAAK,CAAC,IAAA,sBAAW,EAAC,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACvD,CAAC,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C,CAAC,CAAC;KACN;AACL,CAAC,CAAC,CAAC"}
|
@ -20,7 +20,7 @@ describe("Test RLP Coder", function () {
|
||||
});
|
||||
});
|
||||
describe("Test bad RLP Data", function () {
|
||||
it("fails encoding data with invalid values", function () {
|
||||
it("correctly fails encoding data with invalid values", function () {
|
||||
assert_1.default.throws(() => {
|
||||
(0, index_js_1.encodeRlp)(["0x1234", 1234]);
|
||||
}, (error) => {
|
||||
@ -29,7 +29,7 @@ describe("Test bad RLP Data", function () {
|
||||
error.value === 1234);
|
||||
});
|
||||
});
|
||||
it("fails decoding data with trailing junk", function () {
|
||||
it("correctlyfails decoding data with trailing junk", function () {
|
||||
assert_1.default.throws(() => {
|
||||
// Zeros_1
|
||||
(0, index_js_1.decodeRlp)("0x0042");
|
||||
@ -40,7 +40,7 @@ describe("Test bad RLP Data", function () {
|
||||
error.value === "0x0042");
|
||||
});
|
||||
});
|
||||
it("fails decoding short data", function () {
|
||||
it("correctlyfails decoding short data", function () {
|
||||
assert_1.default.throws(() => {
|
||||
(0, index_js_1.decodeRlp)("0x");
|
||||
}, (error) => {
|
||||
@ -51,7 +51,7 @@ describe("Test bad RLP Data", function () {
|
||||
error.length === 0);
|
||||
});
|
||||
});
|
||||
it("fails decoding short data in child", function () {
|
||||
it("correctlyfails decoding short data in child", function () {
|
||||
assert_1.default.throws(() => {
|
||||
(0, index_js_1.decodeRlp)("0xc8880102030405060708");
|
||||
}, (error) => {
|
||||
@ -62,7 +62,7 @@ describe("Test bad RLP Data", function () {
|
||||
error.length === 8);
|
||||
});
|
||||
});
|
||||
it("fails decoding short segment data", function () {
|
||||
it("correctlyfails decoding short segment data", function () {
|
||||
assert_1.default.throws(() => {
|
||||
// [["0x4243"], ["0x3145"]] = 0xc8 c3 82 4243 c3 82 3145
|
||||
// XXXX
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"test-rlp.js","sourceRoot":"","sources":["../../src.ts/_tests/test-rlp.ts"],"names":[],"mappings":";;;;;AAAA,oD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C,MAAM,KAAK,CAAC;gBAClB,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAA;QAC3B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH;;;;;;;;;;;;;EAaE"}
|
@ -204,17 +204,24 @@ describe("Tests Signed Transaction Parsing", function () {
|
||||
const tests = (0, utils_js_1.loadTests)("transactions");
|
||||
for (const test of tests) {
|
||||
it(`parses signed legacy transaction: ${test.name}`, function () {
|
||||
const tx = index_js_1.Transaction.from(test.signedLegacy);
|
||||
let tx = index_js_1.Transaction.from(test.signedLegacy);
|
||||
const expected = addDefaults(test.transaction);
|
||||
expected.maxFeePerGas = null;
|
||||
expected.maxPriorityFeePerGas = null;
|
||||
expected.accessList = null;
|
||||
expected.chainId = BN_0;
|
||||
assertTxEqual(tx, expected);
|
||||
assert_1.default.ok(!!tx.signature, "signature:!null");
|
||||
assert_1.default.equal(tx.signature.r, test.signatureLegacy.r, "signature.r");
|
||||
assert_1.default.equal(tx.signature.s, test.signatureLegacy.s, "signature.s");
|
||||
assert_1.default.equal(BigInt(tx.signature.v), BigInt(test.signatureLegacy.v), "signature.v");
|
||||
for (let i = 0; i < 2; i++) {
|
||||
assertTxEqual(tx, expected);
|
||||
assert_1.default.equal(tx.typeName, "legacy", "typeName");
|
||||
assert_1.default.equal(tx.isLegacy(), true, "isLegacy");
|
||||
assert_1.default.equal(tx.isBerlin(), false, "isBerlin");
|
||||
assert_1.default.equal(tx.isLondon(), false, "isLondon");
|
||||
assert_1.default.ok(!!tx.signature, "signature:!null");
|
||||
assert_1.default.equal(tx.signature.r, test.signatureLegacy.r, "signature.r");
|
||||
assert_1.default.equal(tx.signature.s, test.signatureLegacy.s, "signature.s");
|
||||
assert_1.default.equal(BigInt(tx.signature.v), BigInt(test.signatureLegacy.v), "signature.v");
|
||||
tx = tx.clone();
|
||||
}
|
||||
});
|
||||
}
|
||||
for (const test of tests) {
|
||||
@ -222,41 +229,111 @@ describe("Tests Signed Transaction Parsing", function () {
|
||||
continue;
|
||||
}
|
||||
it(`parses signed EIP-155 transaction: ${test.name}`, function () {
|
||||
const tx = index_js_1.Transaction.from(test.signedEip155);
|
||||
let tx = index_js_1.Transaction.from(test.signedEip155);
|
||||
const expected = addDefaults(test.transaction);
|
||||
expected.maxFeePerGas = null;
|
||||
expected.maxPriorityFeePerGas = null;
|
||||
expected.accessList = null;
|
||||
assertTxEqual(tx, expected);
|
||||
assert_1.default.ok(!!tx.signature, "signature:!null");
|
||||
assert_1.default.equal(tx.signature.r, test.signatureEip155.r, "signature.r");
|
||||
assert_1.default.equal(tx.signature.s, test.signatureEip155.s, "signature.s");
|
||||
assert_1.default.equal(tx.signature.networkV, BigInt(test.signatureEip155.v), "signature.v");
|
||||
for (let i = 0; i < 2; i++) {
|
||||
assertTxEqual(tx, expected);
|
||||
assert_1.default.equal(tx.typeName, "legacy", "typeName");
|
||||
assert_1.default.equal(tx.isLegacy(), true, "isLegacy");
|
||||
assert_1.default.equal(tx.isBerlin(), false, "isBerlin");
|
||||
assert_1.default.equal(tx.isLondon(), false, "isLondon");
|
||||
assert_1.default.ok(!!tx.signature, "signature:!null");
|
||||
assert_1.default.equal(tx.signature.r, test.signatureEip155.r, "signature.r");
|
||||
assert_1.default.equal(tx.signature.s, test.signatureEip155.s, "signature.s");
|
||||
assert_1.default.equal(tx.signature.networkV, BigInt(test.signatureEip155.v), "signature.v");
|
||||
tx = tx.clone();
|
||||
}
|
||||
});
|
||||
}
|
||||
for (const test of tests) {
|
||||
it(`parses signed Berlin transaction: ${test.name}`, function () {
|
||||
const tx = index_js_1.Transaction.from(test.signedBerlin);
|
||||
let tx = index_js_1.Transaction.from(test.signedBerlin);
|
||||
const expected = addDefaults(test.transaction);
|
||||
expected.maxFeePerGas = null;
|
||||
expected.maxPriorityFeePerGas = null;
|
||||
assertTxEqual(tx, expected);
|
||||
assert_1.default.ok(!!tx.signature, "signature:!null");
|
||||
assert_1.default.equal(tx.signature.r, test.signatureBerlin.r, "signature.r");
|
||||
assert_1.default.equal(tx.signature.s, test.signatureBerlin.s, "signature.s");
|
||||
assert_1.default.equal(tx.signature.yParity, parseInt(test.signatureBerlin.v), "signature.v");
|
||||
for (let i = 0; i < 2; i++) {
|
||||
assertTxEqual(tx, expected);
|
||||
assert_1.default.equal(tx.typeName, "eip-2930", "typeName");
|
||||
assert_1.default.equal(tx.isLegacy(), false, "isLegacy");
|
||||
assert_1.default.equal(tx.isBerlin(), true, "isBerlin");
|
||||
assert_1.default.equal(tx.isLondon(), false, "isLondon");
|
||||
assert_1.default.ok(!!tx.signature, "signature:!null");
|
||||
assert_1.default.equal(tx.signature.r, test.signatureBerlin.r, "signature.r");
|
||||
assert_1.default.equal(tx.signature.s, test.signatureBerlin.s, "signature.s");
|
||||
assert_1.default.equal(tx.signature.yParity, parseInt(test.signatureBerlin.v), "signature.v");
|
||||
tx = tx.clone();
|
||||
}
|
||||
});
|
||||
}
|
||||
for (const test of tests) {
|
||||
it(`parses signed London transaction: ${test.name}`, function () {
|
||||
const tx = index_js_1.Transaction.from(test.signedLondon);
|
||||
let tx = index_js_1.Transaction.from(test.signedLondon);
|
||||
const expected = addDefaults(test.transaction);
|
||||
expected.gasPrice = null;
|
||||
assertTxEqual(tx, expected);
|
||||
assert_1.default.ok(!!tx.signature, "signature:!null");
|
||||
assert_1.default.equal(tx.signature.r, test.signatureLondon.r, "signature.r");
|
||||
assert_1.default.equal(tx.signature.s, test.signatureLondon.s, "signature.s");
|
||||
assert_1.default.equal(tx.signature.yParity, parseInt(test.signatureLondon.v), "signature.v");
|
||||
for (let i = 0; i < 2; i++) {
|
||||
assertTxEqual(tx, expected);
|
||||
assert_1.default.equal(tx.typeName, "eip-1559", "typeName");
|
||||
assert_1.default.equal(tx.isLegacy(), false, "isLegacy");
|
||||
assert_1.default.equal(tx.isBerlin(), false, "isBerlin");
|
||||
assert_1.default.equal(tx.isLondon(), true, "isLondon");
|
||||
assert_1.default.ok(!!tx.signature, "signature:!null");
|
||||
assert_1.default.equal(tx.signature.r, test.signatureLondon.r, "signature.r");
|
||||
assert_1.default.equal(tx.signature.s, test.signatureLondon.s, "signature.s");
|
||||
assert_1.default.equal(tx.signature.yParity, parseInt(test.signatureLondon.v), "signature.v");
|
||||
// Test cloning
|
||||
tx = tx.clone();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
describe("Tests Transaction Parameters", function () {
|
||||
const badData = [
|
||||
{
|
||||
name: "accessList=0x09",
|
||||
data: "0x02c9010203040580070809",
|
||||
message: "invalid access list",
|
||||
argument: "accessList"
|
||||
},
|
||||
{
|
||||
name: "accessList=[0x09]",
|
||||
data: "0x02ca0102030405800708c109",
|
||||
message: "invalid address-slot set",
|
||||
argument: "accessList"
|
||||
},
|
||||
{
|
||||
name: "accessList=[0x09,0x10]",
|
||||
data: "0x02cb0102030405800708c20910",
|
||||
message: "invalid address-slot set",
|
||||
argument: "accessList"
|
||||
},
|
||||
{
|
||||
name: "accessList=[0x09,[HASH]] (bad address)",
|
||||
data: "0x02ed0102030405800708e4e309e1a024412927c99a717115f5308c0ebd11136659b3cb6291abb4a8f87e9856a12538",
|
||||
message: "invalid address",
|
||||
argument: "accessList"
|
||||
},
|
||||
{
|
||||
name: "accessList=[ADDR,[0x09]] (bad slot)",
|
||||
data: "0x02e10102030405800708d8d794939d33ff01840e9eeeb67525ec2f7035af41a4b1c109",
|
||||
message: "invalid slot",
|
||||
argument: "accessList"
|
||||
}
|
||||
];
|
||||
for (const { name, data, argument, message } of badData) {
|
||||
it(`correctly fails on bad accessList: ${name}`, function () {
|
||||
assert_1.default.throws(() => {
|
||||
// The access list is a single value: 0x09 instead of
|
||||
// structured data
|
||||
const result = index_js_1.Transaction.from(data);
|
||||
console.log(result);
|
||||
}, (error) => {
|
||||
return ((0, index_js_1.isError)(error, "INVALID_ARGUMENT") &&
|
||||
error.argument === argument &&
|
||||
(message == null || error.message.startsWith(message)));
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
File diff suppressed because one or more lines are too long
173
lib.commonjs/_tests/test-utils-maths.js
Normal file
173
lib.commonjs/_tests/test-utils-maths.js
Normal file
@ -0,0 +1,173 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const index_js_1 = require("../index.js");
|
||||
describe("Tests Quantity Functions", function () {
|
||||
const quantities = [
|
||||
{
|
||||
name: "zero number",
|
||||
value: 0,
|
||||
expected: "0x0"
|
||||
},
|
||||
{
|
||||
name: "zero single hex",
|
||||
value: "0x0",
|
||||
expected: "0x0"
|
||||
},
|
||||
{
|
||||
name: "zero double hex",
|
||||
value: "0x00",
|
||||
expected: "0x0"
|
||||
},
|
||||
{
|
||||
name: "zero array(0)",
|
||||
value: new Uint8Array([]),
|
||||
expected: "0x0"
|
||||
},
|
||||
{
|
||||
name: "zero array(1)",
|
||||
value: new Uint8Array([0]),
|
||||
expected: "0x0"
|
||||
},
|
||||
{
|
||||
name: "single hex digit",
|
||||
value: 0x5,
|
||||
expected: "0x5"
|
||||
},
|
||||
{
|
||||
name: "double hex digit",
|
||||
value: 0x42,
|
||||
expected: "0x42"
|
||||
},
|
||||
{
|
||||
name: "big array, odd output",
|
||||
value: new Uint8Array([0x0f, 254, 253, 252]),
|
||||
expected: "0xffefdfc"
|
||||
},
|
||||
{
|
||||
name: "big array, even output",
|
||||
value: new Uint8Array([255, 254, 253, 252]),
|
||||
expected: "0xfffefdfc"
|
||||
},
|
||||
];
|
||||
for (const { name, value, expected } of quantities) {
|
||||
it(`computes quantity: ${name}`, function () {
|
||||
assert_1.default.equal((0, index_js_1.toQuantity)(value), expected);
|
||||
});
|
||||
}
|
||||
});
|
||||
describe("Tests Bad Math Values", function () {
|
||||
const badBigInts = [
|
||||
{
|
||||
name: "empty string",
|
||||
value: "",
|
||||
error: "invalid BigNumberish string"
|
||||
},
|
||||
{
|
||||
name: "non-numeric string",
|
||||
value: "foobar",
|
||||
error: "invalid BigNumberish string"
|
||||
},
|
||||
{
|
||||
name: "double negative sign",
|
||||
value: "--42",
|
||||
error: "invalid BigNumberish string"
|
||||
},
|
||||
{
|
||||
name: "non-numeric thing",
|
||||
value: true,
|
||||
error: "invalid BigNumberish value"
|
||||
},
|
||||
];
|
||||
for (const { name, value, error } of badBigInts) {
|
||||
it(`correctly fails on bad bigint: ${name}`, function () {
|
||||
assert_1.default.throws(() => {
|
||||
const result = (0, index_js_1.getBigInt)(value);
|
||||
console.log(result);
|
||||
}, (e) => {
|
||||
return ((0, index_js_1.isError)(e, "INVALID_ARGUMENT") &&
|
||||
e.message.startsWith(error));
|
||||
});
|
||||
});
|
||||
}
|
||||
const badNumbers = [
|
||||
{
|
||||
name: "empty string",
|
||||
value: "",
|
||||
error: "invalid numeric string"
|
||||
},
|
||||
{
|
||||
name: "non-numeric string",
|
||||
value: "foobar",
|
||||
error: "invalid numeric string"
|
||||
},
|
||||
{
|
||||
name: "double negative sign",
|
||||
value: "--42",
|
||||
error: "invalid numeric string"
|
||||
},
|
||||
{
|
||||
name: "non-numeric thing",
|
||||
value: true,
|
||||
error: "invalid numeric value"
|
||||
},
|
||||
{
|
||||
name: "too big",
|
||||
value: Number.MAX_SAFE_INTEGER + 10,
|
||||
error: "overflow"
|
||||
},
|
||||
{
|
||||
name: "too small",
|
||||
value: -Number.MAX_SAFE_INTEGER - 10,
|
||||
error: "overflow"
|
||||
},
|
||||
];
|
||||
for (const { name, value, error } of badNumbers) {
|
||||
it(`correctly fails on bad numeric: ${name}`, function () {
|
||||
assert_1.default.throws(() => {
|
||||
const result = (0, index_js_1.getNumber)(value);
|
||||
console.log(result);
|
||||
}, (e) => {
|
||||
return ((0, index_js_1.isError)(e, "INVALID_ARGUMENT") &&
|
||||
e.message.startsWith(error));
|
||||
});
|
||||
});
|
||||
}
|
||||
const badHex = [
|
||||
{
|
||||
name: "negative value",
|
||||
value: -4,
|
||||
error: "cannot toHex negative value"
|
||||
},
|
||||
{
|
||||
name: "width too short",
|
||||
value: 0x123456,
|
||||
width: 2,
|
||||
error: "value exceeds width"
|
||||
},
|
||||
];
|
||||
for (const { name, value, error, width } of badHex) {
|
||||
it(`correctly fails on bad toHex values: ${name}`, function () {
|
||||
assert_1.default.throws(() => {
|
||||
const result = (0, index_js_1.toHex)(value, width);
|
||||
console.log(result);
|
||||
}, (e) => {
|
||||
return ((0, index_js_1.isError)(e, "INVALID_ARGUMENT") &&
|
||||
e.message.startsWith(error));
|
||||
});
|
||||
});
|
||||
}
|
||||
it(`correctly fails on nad toArray values: negative value`, function () {
|
||||
assert_1.default.throws(() => {
|
||||
const result = (0, index_js_1.toArray)(-4);
|
||||
console.log(result);
|
||||
}, (e) => {
|
||||
return ((0, index_js_1.isError)(e, "INVALID_ARGUMENT") &&
|
||||
e.message.startsWith("cannot toArray negative value"));
|
||||
});
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=test-utils-maths.js.map
|
1
lib.commonjs/_tests/test-utils-maths.js.map
Normal file
1
lib.commonjs/_tests/test-utils-maths.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"test-utils-maths.js","sourceRoot":"","sources":["../../src.ts/_tests/test-utils-maths.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAGqB;AAErB,QAAQ,CAAC,0BAA0B,EAAE;IACjC,MAAM,UAAU,GAA0D;QACtE;YACI,IAAI,EAAE,aAAa;YACnB,KAAK,EAAE,CAAC;YACR,QAAQ,EAAE,KAAK;SAClB;QACD;YACI,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,KAAK;YACZ,QAAQ,EAAE,KAAK;SAClB;QACD;YACI,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,MAAM;YACb,QAAQ,EAAE,KAAK;SAClB;QACD;YACI,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,IAAI,UAAU,C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AAC;QACP,CAAC,CAAC,CAAC;KACN;IAED,EAAE,CAAC,uDAAuD,EAAE;QACxD,gBAAM,CAAC,MAAM,CAAC,GAAG,EAAE;YACf,MAAM,MAAM,GAAG,IAAA,kBAAO,EAAC,CAAC,CAAC,CAAC,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC,EAAE,CAAC,CAAM,EAAE,EAAE;YACV,OAAO,CAAC,IAAA,kBAAO,EAAC,CAAC,EAAE,kBAAkB,CAAC;gBAClC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,+BAA+B,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
@ -28,4 +28,40 @@ describe("Base64 Coding", function () {
|
||||
});
|
||||
}
|
||||
});
|
||||
describe("Test Minor Features", function () {
|
||||
it("checks types in defineProperties", function () {
|
||||
const any = {};
|
||||
const values = {
|
||||
vAny: any,
|
||||
vBigint: BigInt(60),
|
||||
vBoolean: true,
|
||||
vNumber: 42,
|
||||
vString: "some string",
|
||||
};
|
||||
const item = {};
|
||||
(0, index_js_1.defineProperties)(item, values, {
|
||||
vAny: "any",
|
||||
vBigint: "bigint",
|
||||
vBoolean: "boolean",
|
||||
vNumber: "number",
|
||||
vString: "string"
|
||||
});
|
||||
assert_1.default.equal(item.vAny, any, "vAny");
|
||||
assert_1.default.equal(item.vBoolean, true, "vBoolenay");
|
||||
assert_1.default.equal(item.vNumber, 42, "nNumber");
|
||||
assert_1.default.equal(item.vString, "some string", "any");
|
||||
});
|
||||
it("correctly throws if defineProperty type mismatch", function () {
|
||||
assert_1.default.throws(() => {
|
||||
const item = {};
|
||||
const values = { vBoolean: 42 };
|
||||
(0, index_js_1.defineProperties)(item, values, { vBoolean: "boolean" });
|
||||
console.log(values);
|
||||
}, (error) => {
|
||||
return ((0, index_js_1.isError)(error, "INVALID_ARGUMENT") &&
|
||||
error.argument === "value.vBoolean" &&
|
||||
error.value === 42);
|
||||
});
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=test-utils-misc.js.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"test-utils-misc.js","sourceRoot":"","sources":["../../src.ts/_tests/test-utils-misc.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAGqB;AAGrB,QAAQ,CAAC,eAAe,EAAE;IACtB,MAAM,KAAK,GAAG;QACV;YACI,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE,IAAA,sBAAW,EAAC,6BAA6B,CAAC;YACrD,OAAO,EAAE,sCAAsC;SAClD;KACJ,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,mBAAoB,IAAI,CAAC,IAAK,EAAE,EAAE;YACjC,gBAAM,CAAC,KAAK,CAAC,IAAA,uBAAY,EAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;KACN;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,mBAAoB,IAAI,CAAC,IAAK,EAAE,EAAE;YACjC,MAAM,OAAO,GAAG,IAAA,uBAAY,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3C,gBAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;YACnE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACrC,gBAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;aAC/C;QACL,CAAC,CAAC,CAAC;KACN;AACL,CAAC,CAAC,CAAA"}
|
||||
{"version":3,"file":"test-utils-misc.js","sourceRoot":"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,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
@ -50,14 +50,14 @@ describe("Tests unit conversion", function () {
|
||||
}
|
||||
});
|
||||
describe("Tests bad unit conversion", function () {
|
||||
it("fails to convert non-string value", function () {
|
||||
it("correctly fails to convert non-string value", function () {
|
||||
assert_1.default.throws(() => {
|
||||
(0, index_js_1.parseUnits)(3, "ether");
|
||||
}, (error) => {
|
||||
return error.message.startsWith("value must be a string");
|
||||
});
|
||||
});
|
||||
it("fails to convert unknown unit", function () {
|
||||
it("correctly fails to convert unknown unit", function () {
|
||||
assert_1.default.throws(() => {
|
||||
(0, index_js_1.parseUnits)("3", "foobar");
|
||||
}, (error) => {
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"test-utils-units.js","sourceRoot":"","sources":["../../src.ts/_tests/test-utils-units.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,yCAAuC;AAEvC,0CAA+E;AAK/E,QAAQ,CAAC,uBAAuB,EAAE;IAC9B,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAe,OAAO,CAAC,CAAC;IAE/C,MAAM,KAAK,GAAG;QACV,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,EAAE;QACvD,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,EAAE;QACpD,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,EAAE;QACpD,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,EAAE;QACpD,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,EAAE;QACvD,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,EAAE;KAC5D,CAAC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AAC,CAAC,CAAC;AAEH,QAAQ,CAAC,2BAA2B,EAAE;IAClC,EAAE,CAAC,6CAA6C,EAAE;QAC9C,gBAAM,CAAC,MAAM,CAAC,GAAG,EAAE;YACf,IAAA,qBAAU,EAAM,CAAC,EAAE,OAAO,CAAC,CAAC;QAChC,CAAC,EAAE,CAAC,KAAU,EAAE,EAAE;YACd,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE;QAC1C,gBAAM,CAAC,MAAM,CAAC,GAAG,EAAE;YACf,IAAA,qBAAU,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC9B,CAAC,EAAE,CAAC,KAAU,EAAE,EAAE;YACd,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
@ -89,7 +89,7 @@ describe("Tests UTF-8 bad strings", function () {
|
||||
});
|
||||
});
|
||||
}
|
||||
it("fails to get UTF-8 bytes from incomplete surrogate", function () {
|
||||
it("correctly fails to get UTF-8 bytes from incomplete surrogate", function () {
|
||||
assert_1.default.throws(() => {
|
||||
const text = String.fromCharCode(0xd800);
|
||||
;
|
||||
@ -99,7 +99,7 @@ describe("Tests UTF-8 bad strings", function () {
|
||||
return (error.message.startsWith("invalid surrogate pair"));
|
||||
});
|
||||
});
|
||||
it("fails to get UTF-8 bytes from invalid surrogate pair", function () {
|
||||
it("correctly fails to get UTF-8 bytes from invalid surrogate pair", function () {
|
||||
assert_1.default.throws(() => {
|
||||
const text = String.fromCharCode(0xd800, 0xdbff);
|
||||
;
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"test-utils-utf8.js","sourceRoot":"","sources":["../../src.ts/_tests/test-utils-utf8.ts"],"names":[],"mappings":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CAAC,OAAO,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,yBAAyB,EAAE;IAEhC,MAAM,KAAK,GAA8B;QACrC;YACI,IAAI,EAAE,iBAAiB;YACvB,IAAI,EAAE,WAAW;YACjB,UAAU,EAAE,CAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAE;SAC3C;KACJ,CAAC;IAEF,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,KAAK,EAAE;QAC5C,EAAE,CAAC,kCAAmC,IAAK,EAAE,EAAE;YAC3C,MAAM,MAAM,GAAG,IAAA,2BAAgB,EAAC,IAAI,CAAC,CAAC;YACtC,gBAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;YACpE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,gBAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,cAAe,CAAE,GAAG,CAAC,CAAC;aAChE;QACL,CAAC,CAAC,CAAC;KACN;AAEL,CAAC,CAAC,CAAC"}
|
@ -60,5 +60,110 @@ describe("Tests JSON Wallet Formats", function () {
|
||||
assert_1.default.equal(wallet.address, test.address, "address");
|
||||
});
|
||||
});
|
||||
it("tests encrypting wallet with mnemonic", function () {
|
||||
this.timeout(20000);
|
||||
const wallet = index_js_1.HDNodeWallet.createRandom();
|
||||
assert_1.default.ok(wallet.mnemonic, "mnemonic");
|
||||
const phrase = wallet.mnemonic.phrase;
|
||||
const json = wallet.encryptSync("foobar");
|
||||
const wallet2 = index_js_1.Wallet.fromEncryptedJsonSync(json, "foobar");
|
||||
assert_1.default.ok(wallet2 instanceof index_js_1.HDNodeWallet && wallet2.mnemonic);
|
||||
assert_1.default.equal(wallet2.mnemonic.phrase, phrase, "phrase");
|
||||
assert_1.default.equal(wallet2.address, wallet.address, "address");
|
||||
});
|
||||
});
|
||||
describe("Tests Extra JSON Wallet Functions", function () {
|
||||
const badCrowdsales = [
|
||||
{
|
||||
name: "undefined",
|
||||
value: undefined
|
||||
},
|
||||
{
|
||||
name: "junk string",
|
||||
value: "junk!"
|
||||
},
|
||||
{
|
||||
name: "non-string",
|
||||
value: 42
|
||||
},
|
||||
{
|
||||
name: "JSON without encseed",
|
||||
value: JSON.stringify({ foo: "bar" })
|
||||
},
|
||||
];
|
||||
for (const { name, value } of badCrowdsales) {
|
||||
it(`tests the invalid isCrowdsale wallet: ${name}`, function () {
|
||||
assert_1.default.equal((0, index_js_1.isCrowdsaleJson)(value), false);
|
||||
});
|
||||
}
|
||||
const badKeystoreOptions = [
|
||||
{
|
||||
name: "invalid salt type",
|
||||
options: { salt: 42 },
|
||||
error: "invalid BytesLike value"
|
||||
},
|
||||
{
|
||||
name: "invalid uuid type",
|
||||
options: { uuid: 42 },
|
||||
error: "invalid BytesLike value"
|
||||
},
|
||||
{
|
||||
name: "invalid uuid length",
|
||||
options: { uuid: "0x1234" },
|
||||
error: "invalid options.uuid"
|
||||
},
|
||||
{
|
||||
name: "invalid iv type",
|
||||
options: { iv: 42 },
|
||||
error: "invalid BytesLike value"
|
||||
},
|
||||
{
|
||||
name: "invalid iv length",
|
||||
options: { iv: "0x1234" },
|
||||
error: "invalid options.iv"
|
||||
},
|
||||
{
|
||||
name: "invalid scrypt N (non-one-hot-encoded)",
|
||||
options: { scrypt: { N: 1023 } },
|
||||
error: "invalid scrypt N parameter"
|
||||
},
|
||||
{
|
||||
name: "invalid scrypt N (non-integer)",
|
||||
options: { scrypt: { N: 1.5 } },
|
||||
error: "invalid scrypt N parameter"
|
||||
},
|
||||
{
|
||||
name: "invalid scrypt r",
|
||||
options: { scrypt: { r: 1.5 } },
|
||||
error: "invalid scrypt r parameter"
|
||||
},
|
||||
{
|
||||
name: "invalid scrypt p",
|
||||
options: { scrypt: { p: 1.5 } },
|
||||
error: "invalid scrypt p parameter"
|
||||
},
|
||||
];
|
||||
const wallet = index_js_1.Wallet.createRandom();
|
||||
const account = { address: wallet.address, privateKey: wallet.privateKey };
|
||||
const password = "foobar";
|
||||
for (const { name, options, error } of badKeystoreOptions) {
|
||||
it(`tests bad keystore options: ${name}`, function () {
|
||||
assert_1.default.throws(() => {
|
||||
const result = (0, index_js_1.encryptKeystoreJsonSync)(account, password, options);
|
||||
console.log(result);
|
||||
}, (e) => {
|
||||
return ((0, index_js_1.isError)(e, "INVALID_ARGUMENT") &&
|
||||
e.message.startsWith(error));
|
||||
});
|
||||
});
|
||||
}
|
||||
// Mainly to round out weird edge cases in coverage
|
||||
it("tests encryption with options (sync)", function () {
|
||||
assert_1.default.ok((0, index_js_1.encryptKeystoreJsonSync)(account, password));
|
||||
});
|
||||
// Mainly to round out weird edge cases in coverage
|
||||
it("tests encryption with options (async)", async function () {
|
||||
assert_1.default.ok(await (0, index_js_1.encryptKeystoreJson)(account, password));
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=test-wallet-json.js.map
|
File diff suppressed because one or more lines are too long
@ -68,7 +68,7 @@ describe("Tests Bad Mnemonics Fail", function () {
|
||||
];
|
||||
for (const _phrase of badLengths) {
|
||||
const phrase = _phrase.join(" ");
|
||||
it(`fails on invalid mnemonic length: ${_phrase.length}`, function () {
|
||||
it(`correctly fails on invalid mnemonic length: ${_phrase.length}`, function () {
|
||||
assert_1.default.ok(!index_js_2.Mnemonic.isValidMnemonic(phrase));
|
||||
assert_1.default.throws(function () {
|
||||
index_js_2.Mnemonic.fromPhrase(phrase);
|
||||
@ -80,7 +80,7 @@ describe("Tests Bad Mnemonics Fail", function () {
|
||||
});
|
||||
});
|
||||
}
|
||||
it("fails on invalid mnemonic word", function () {
|
||||
it("correctly fails on invalid mnemonic word", function () {
|
||||
const phrase = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon wagmi";
|
||||
assert_1.default.ok(!index_js_2.Mnemonic.isValidMnemonic(phrase));
|
||||
assert_1.default.throws(function () {
|
||||
@ -92,7 +92,7 @@ describe("Tests Bad Mnemonics Fail", function () {
|
||||
error.value === "[ REDACTED ]");
|
||||
});
|
||||
});
|
||||
it("fails on invalid mnemonic checksum", function () {
|
||||
it("correctly fails on invalid mnemonic checksum", function () {
|
||||
const phrase = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon";
|
||||
assert_1.default.ok(!index_js_2.Mnemonic.isValidMnemonic(phrase));
|
||||
assert_1.default.throws(function () {
|
||||
@ -111,7 +111,7 @@ describe("Tests Bad Mnemonics Fail", function () {
|
||||
];
|
||||
for (const _entropy of badEntropyLengths) {
|
||||
const entropy = "0x" + _entropy.join("");
|
||||
it(`fails on invalid entropy length: ${_entropy.length}`, function () {
|
||||
it(`correctly fails on invalid entropy length: ${_entropy.length}`, function () {
|
||||
assert_1.default.throws(function () {
|
||||
index_js_2.Mnemonic.fromEntropy(entropy);
|
||||
}, function (error) {
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"test-wallet-mnemonic.js","sourceRoot":"","sources":["../../src.ts/_tests/test-wallet-mnemonic.ts"],"names":[],"mappings":";;;;;AACA,oDAA4B;AAE5B,iDAA4C;AAC5C,8CAA+C;AAE/C,4DAAsD;AAEtD,0CAAuC;AAEvC,yCAAuC;AAGvC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAClC,SAAS,OAAO,CAAC,GAAW;IACxB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAClD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,MAAM,CAAC,IAAY,EAAE,MAAc;I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AC,MAAM,CAAC;gBACV,mBAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAClC,CAAC,EAAE,UAAS,KAAU;gBAClB,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,kBAAkB;oBACrC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC;oBAC5C,KAAK,CAAC,QAAQ,KAAK,SAAS;oBAC5B,KAAK,CAAC,KAAK,KAAK,cAAc,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;KACN;AACL,CAAC,CAAC,CAAA"}
|
@ -76,17 +76,24 @@ describe("Test Typed-Data Signing (EIP-712)", function () {
|
||||
});
|
||||
describe("Test Wallet Encryption", function () {
|
||||
const password = "foobar";
|
||||
it("encrypts a wallet: sync", function () {
|
||||
const wallet = index_js_1.Wallet.createRandom();
|
||||
const json = wallet.encryptSync(password);
|
||||
const decrypted = index_js_1.Wallet.fromEncryptedJsonSync(json, password);
|
||||
assert_1.default.equal(decrypted.address, wallet.address, "address");
|
||||
});
|
||||
it("encrypts a wallet: async", async function () {
|
||||
const wallet = index_js_1.Wallet.createRandom();
|
||||
const json = await wallet.encrypt(password);
|
||||
const decrypted = await index_js_1.Wallet.fromEncryptedJson(json, password);
|
||||
assert_1.default.equal(decrypted.address, wallet.address, "address");
|
||||
});
|
||||
// Loop:
|
||||
// 1 : random wallet (uses HDNodeWallet under the hood)
|
||||
// 2 : Wallet using private key (uses Wallet explicitly)
|
||||
for (let i = 0; i < 2; i++) {
|
||||
let wallet = index_js_1.Wallet.createRandom();
|
||||
it("encrypts a random wallet: sync", function () {
|
||||
this.timeout(30000);
|
||||
const json = wallet.encryptSync(password);
|
||||
const decrypted = index_js_1.Wallet.fromEncryptedJsonSync(json, password);
|
||||
assert_1.default.equal(decrypted.address, wallet.address, "address");
|
||||
});
|
||||
it("encrypts a random wallet: async", async function () {
|
||||
this.timeout(30000);
|
||||
const json = await wallet.encrypt(password);
|
||||
const decrypted = await index_js_1.Wallet.fromEncryptedJson(json, password);
|
||||
assert_1.default.equal(decrypted.address, wallet.address, "address");
|
||||
});
|
||||
wallet = new index_js_1.Wallet((0, index_js_1.hexlify)((0, index_js_1.randomBytes)(32)));
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=test-wallet.js.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"test-wallet.js","sourceRoot":"","sources":["../../src.ts/_tests/test-wallet.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,yCAAuC;AAOvC,0CAAqC;AAGrC,QAAQ,CAAC,yBAAyB,EAAE;IAChC,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAkB,UAAU,CAAC,CAAC;IAErD,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,EAAE;QAC5C,EAAE,CAAC,mBAAoB,IAAK,EAAE,EAAE;YAC5B,MAAM,MAAM,GAAG,IAAI,iBAAM,CAAC,UAAU,CAAC,CAAC;YACtC,gBAAM,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;YAC5C,gBAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,0BAA0B,EAAE;IACjC,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAsB,cAAc,CAAC,CAAC;IAC7D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,uCAAwC,IAAI,CAAC,IAAK,EAAE,EAAE,KAAK;YAC1D,MAAM,MAAM,GAAG,IAAI,iBAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAG,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI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AI,iBAAM,CAAC,IAAA,kBAAO,EAAC,IAAA,sBAAW,EAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KACjD;AACL,CAAC,CAAC,CAAC"}
|
@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const index_js_1 = require("../index.js");
|
||||
const wordlists_js_1 = require("../wordlists/wordlists.js");
|
||||
const utils_js_1 = require("./utils.js");
|
||||
describe('Check Wordlists', function () {
|
||||
const tests = (0, utils_js_1.loadTests)("wordlists");
|
||||
tests.forEach((test) => {
|
||||
let wordlist = index_js_1.wordlists[test.locale];
|
||||
let wordlist = wordlists_js_1.wordlists[test.locale];
|
||||
if (wordlist == null) {
|
||||
return;
|
||||
}
|
||||
@ -26,7 +26,7 @@ describe('Check Wordlists', function () {
|
||||
});
|
||||
});
|
||||
tests.forEach((test) => {
|
||||
let wordlist = index_js_1.wordlists[test.locale];
|
||||
let wordlist = wordlists_js_1.wordlists[test.locale];
|
||||
if (wordlist == null) {
|
||||
return;
|
||||
}
|
||||
@ -43,7 +43,7 @@ describe('Check Wordlists', function () {
|
||||
});
|
||||
});
|
||||
tests.forEach((test) => {
|
||||
let wordlist = index_js_1.wordlists[test.locale];
|
||||
let wordlist = wordlists_js_1.wordlists[test.locale];
|
||||
if (wordlist == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"test-wordlists.js","sourceRoot":"","sources":["../../src.ts/_tests/test-wordlists.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAAwC;AAExC,yCAAuC;AAKvC,QAAQ,CAAC,iBAAiB,EAAE;IACxB,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAmB,WAAW,CAAC,CAAC;IAEvD,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACnB,IAAI,QAAQ,GAAG,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O,EAAE,EAAE;YAChD,gBAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YAElD,gBAAM,CAAC,MAAM,CAAC,GAAG,EAAE;gBACf,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YACzB,CAAC,EAAE,CAAC,KAAU,EAAE,EAAE;gBACd,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,kBAAkB;oBACrC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC;oBAC1C,KAAK,CAAC,QAAQ,KAAK,OAAO;oBAC1B,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;YAEH,gBAAM,CAAC,MAAM,CAAC,GAAG,EAAE;gBACf,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC3B,CAAC,EAAE,CAAC,KAAU,EAAE,EAAE;gBACd,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,kBAAkB;oBACrC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC;oBAC1C,KAAK,CAAC,QAAQ,KAAK,OAAO;oBAC1B,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IAEP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
@ -1 +1 @@
|
||||
{"version":3,"file":"_version.js","sourceRoot":"","sources":["../src.ts/_version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,sBAAsB,CAAC"}
|
||||
{"version":3,"file":"_version.js","sourceRoot":"","sources":["../src.ts/_version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAW,sBAAsB,CAAC"}
|
@ -1,7 +1,19 @@
|
||||
"use strict";
|
||||
// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI
|
||||
/**
|
||||
* When sending values to or receiving values from a [[Contract]], the
|
||||
* data is generally encoded using the [ABI standard](solc-abi-standard).
|
||||
*
|
||||
* The AbiCoder provides a utility to encode values to ABI data and
|
||||
* decode values from ABI data.
|
||||
*
|
||||
* Most of the time, developers should favour the [[Contract]] class,
|
||||
* which further abstracts a lot of the finer details of ABI data.
|
||||
*
|
||||
* @_section api/abi/abi-coder:ABI Encoding
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.defaultAbiCoder = exports.getBuiltinCallException = exports.AbiCoder = void 0;
|
||||
exports.AbiCoder = void 0;
|
||||
// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI
|
||||
const index_js_1 = require("../utils/index.js");
|
||||
const abstract_coder_js_1 = require("./coders/abstract-coder.js");
|
||||
const address_js_1 = require("./coders/address.js");
|
||||
@ -16,8 +28,84 @@ const tuple_js_1 = require("./coders/tuple.js");
|
||||
const fragments_js_1 = require("./fragments.js");
|
||||
const index_js_2 = require("../address/index.js");
|
||||
const index_js_3 = require("../utils/index.js");
|
||||
// https://docs.soliditylang.org/en/v0.8.17/control-structures.html
|
||||
const PanicReasons = new Map();
|
||||
PanicReasons.set(0x00, "GENERIC_PANIC");
|
||||
PanicReasons.set(0x01, "ASSERT_FALSE");
|
||||
PanicReasons.set(0x11, "OVERFLOW");
|
||||
PanicReasons.set(0x12, "DIVIDE_BY_ZERO");
|
||||
PanicReasons.set(0x21, "ENUM_RANGE_ERROR");
|
||||
PanicReasons.set(0x22, "BAD_STORAGE_DATA");
|
||||
PanicReasons.set(0x31, "STACK_UNDERFLOW");
|
||||
PanicReasons.set(0x32, "ARRAY_RANGE_ERROR");
|
||||
PanicReasons.set(0x41, "OUT_OF_MEMORY");
|
||||
PanicReasons.set(0x51, "UNINITIALIZED_FUNCTION_CALL");
|
||||
const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);
|
||||
const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);
|
||||
let defaultCoder = null;
|
||||
function getBuiltinCallException(action, tx, data, abiCoder) {
|
||||
let message = "missing revert data";
|
||||
let reason = null;
|
||||
const invocation = null;
|
||||
let revert = null;
|
||||
if (data) {
|
||||
message = "execution reverted";
|
||||
const bytes = (0, index_js_3.getBytes)(data);
|
||||
data = (0, index_js_3.hexlify)(data);
|
||||
if (bytes.length % 32 !== 4) {
|
||||
message += " (could not decode reason; invalid data length)";
|
||||
}
|
||||
else if ((0, index_js_3.hexlify)(bytes.slice(0, 4)) === "0x08c379a0") {
|
||||
// Error(string)
|
||||
try {
|
||||
reason = abiCoder.decode(["string"], bytes.slice(4))[0];
|
||||
revert = {
|
||||
signature: "Error(string)",
|
||||
name: "Error",
|
||||
args: [reason]
|
||||
};
|
||||
message += `: ${JSON.stringify(reason)}`;
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
message += " (could not decode reason; invalid data)";
|
||||
}
|
||||
}
|
||||
else if ((0, index_js_3.hexlify)(bytes.slice(0, 4)) === "0x4e487b71") {
|
||||
// Panic(uint256)
|
||||
try {
|
||||
const code = Number(abiCoder.decode(["uint256"], bytes.slice(4))[0]);
|
||||
revert = {
|
||||
signature: "Panic(uint256)",
|
||||
name: "Panic",
|
||||
args: [code]
|
||||
};
|
||||
reason = `Panic due to ${PanicReasons.get(code) || "UNKNOWN"}(${code})`;
|
||||
message += `: ${reason}`;
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
message += " (could not decode panic reason)";
|
||||
}
|
||||
}
|
||||
else {
|
||||
message += " (unknown custom error)";
|
||||
}
|
||||
}
|
||||
const transaction = {
|
||||
to: (tx.to ? (0, index_js_2.getAddress)(tx.to) : null),
|
||||
data: (tx.data || "0x")
|
||||
};
|
||||
if (tx.from) {
|
||||
transaction.from = (0, index_js_2.getAddress)(tx.from);
|
||||
}
|
||||
return (0, index_js_3.makeError)(message, "CALL_EXCEPTION", {
|
||||
action, data, reason, transaction, invocation, revert
|
||||
});
|
||||
}
|
||||
/**
|
||||
* About AbiCoder
|
||||
*/
|
||||
class AbiCoder {
|
||||
#getCoder(param) {
|
||||
if (param.isArray()) {
|
||||
@ -54,11 +142,22 @@ class AbiCoder {
|
||||
}
|
||||
(0, index_js_1.assertArgument)(false, "invalid type", "type", param.type);
|
||||
}
|
||||
/**
|
||||
* Get the default values for the given %%types%%.
|
||||
*
|
||||
* For example, a ``uint`` is by default ``0`` and ``bool``
|
||||
* is by default ``false``.
|
||||
*/
|
||||
getDefaultValue(types) {
|
||||
const coders = types.map((type) => this.#getCoder(fragments_js_1.ParamType.from(type)));
|
||||
const coder = new tuple_js_1.TupleCoder(coders, "_");
|
||||
return coder.defaultValue();
|
||||
}
|
||||
/**
|
||||
* Encode the %%values%% as the %%types%% into ABI data.
|
||||
*
|
||||
* @returns DataHexstring
|
||||
*/
|
||||
encode(types, values) {
|
||||
(0, index_js_1.assertArgumentCount)(values.length, types.length, "types/values length mismatch");
|
||||
const coders = types.map((type) => this.#getCoder(fragments_js_1.ParamType.from(type)));
|
||||
@ -67,85 +166,37 @@ class AbiCoder {
|
||||
coder.encode(writer, values);
|
||||
return writer.data;
|
||||
}
|
||||
/**
|
||||
* Decode the ABI %%data%% as the %%types%% into values.
|
||||
*
|
||||
* If %%loose%% decoding is enabled, then strict padding is
|
||||
* not enforced. Some older versions of Solidity incorrectly
|
||||
* padded event data emitted from ``external`` functions.
|
||||
*/
|
||||
decode(types, data, loose) {
|
||||
const coders = types.map((type) => this.#getCoder(fragments_js_1.ParamType.from(type)));
|
||||
const coder = new tuple_js_1.TupleCoder(coders, "_");
|
||||
return coder.decode(new abstract_coder_js_1.Reader(data, loose));
|
||||
}
|
||||
/**
|
||||
* Returns the shared singleton instance of a default [[AbiCoder]].
|
||||
*
|
||||
* On the first call, the instance is created internally.
|
||||
*/
|
||||
static defaultAbiCoder() {
|
||||
if (defaultCoder == null) {
|
||||
defaultCoder = new AbiCoder();
|
||||
}
|
||||
return defaultCoder;
|
||||
}
|
||||
/**
|
||||
* Returns an ethers-compatible [[CALL_EXCEPTION]] Error for the given
|
||||
* result %%data%% for the [[CallExceptionAction]] %%action%% against
|
||||
* the Transaction %%tx%%.
|
||||
*/
|
||||
static getBuiltinCallException(action, tx, data) {
|
||||
return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder());
|
||||
}
|
||||
}
|
||||
exports.AbiCoder = AbiCoder;
|
||||
// https://docs.soliditylang.org/en/v0.8.17/control-structures.html
|
||||
const PanicReasons = new Map();
|
||||
PanicReasons.set(0x00, "GENERIC_PANIC");
|
||||
PanicReasons.set(0x01, "ASSERT_FALSE");
|
||||
PanicReasons.set(0x11, "OVERFLOW");
|
||||
PanicReasons.set(0x12, "DIVIDE_BY_ZERO");
|
||||
PanicReasons.set(0x21, "ENUM_RANGE_ERROR");
|
||||
PanicReasons.set(0x22, "BAD_STORAGE_DATA");
|
||||
PanicReasons.set(0x31, "STACK_UNDERFLOW");
|
||||
PanicReasons.set(0x32, "ARRAY_RANGE_ERROR");
|
||||
PanicReasons.set(0x41, "OUT_OF_MEMORY");
|
||||
PanicReasons.set(0x51, "UNINITIALIZED_FUNCTION_CALL");
|
||||
function getBuiltinCallException(action, tx, data) {
|
||||
let message = "missing revert data";
|
||||
let reason = null;
|
||||
const invocation = null;
|
||||
let revert = null;
|
||||
if (data) {
|
||||
message = "execution reverted";
|
||||
const bytes = (0, index_js_3.getBytes)(data);
|
||||
data = (0, index_js_3.hexlify)(data);
|
||||
if (bytes.length % 32 !== 4) {
|
||||
message += " (could not decode reason; invalid data length)";
|
||||
}
|
||||
else if ((0, index_js_3.hexlify)(bytes.slice(0, 4)) === "0x08c379a0") {
|
||||
// Error(string)
|
||||
try {
|
||||
reason = exports.defaultAbiCoder.decode(["string"], bytes.slice(4))[0];
|
||||
revert = {
|
||||
signature: "Error(string)",
|
||||
name: "Error",
|
||||
args: [reason]
|
||||
};
|
||||
message += `: ${JSON.stringify(reason)}`;
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
message += " (could not decode reason; invalid data)";
|
||||
}
|
||||
}
|
||||
else if ((0, index_js_3.hexlify)(bytes.slice(0, 4)) === "0x4e487b71") {
|
||||
// Panic(uint256)
|
||||
try {
|
||||
const code = Number(exports.defaultAbiCoder.decode(["uint256"], bytes.slice(4))[0]);
|
||||
revert = {
|
||||
signature: "Panic(uint256)",
|
||||
name: "Panic",
|
||||
args: [code]
|
||||
};
|
||||
reason = `Panic due to ${PanicReasons.get(code) || "UNKNOWN"}(${code})`;
|
||||
message += `: ${reason}`;
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
message += " (could not decode panic reason)";
|
||||
}
|
||||
}
|
||||
else {
|
||||
message += " (unknown custom error)";
|
||||
}
|
||||
}
|
||||
const transaction = {
|
||||
to: (tx.to ? (0, index_js_2.getAddress)(tx.to) : null),
|
||||
data: (tx.data || "0x")
|
||||
};
|
||||
if (tx.from) {
|
||||
transaction.from = (0, index_js_2.getAddress)(tx.from);
|
||||
}
|
||||
return (0, index_js_3.makeError)(message, "CALL_EXCEPTION", {
|
||||
action, data, reason, transaction, invocation, revert
|
||||
});
|
||||
}
|
||||
exports.getBuiltinCallException = getBuiltinCallException;
|
||||
exports.defaultAbiCoder = new AbiCoder();
|
||||
//# sourceMappingURL=abi-coder.js.map
|
File diff suppressed because one or more lines are too long
@ -1,7 +1,15 @@
|
||||
"use strict";
|
||||
/**
|
||||
* About bytes32 strings...
|
||||
*
|
||||
* @_docloc: api/utils:Bytes32 Strings
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.decodeBytes32String = exports.encodeBytes32String = void 0;
|
||||
const index_js_1 = require("../utils/index.js");
|
||||
/**
|
||||
* Encodes %%text%% as a Bytes32 string.
|
||||
*/
|
||||
function encodeBytes32String(text) {
|
||||
// Get the bytes
|
||||
const bytes = (0, index_js_1.toUtf8Bytes)(text);
|
||||
@ -13,6 +21,9 @@ function encodeBytes32String(text) {
|
||||
return (0, index_js_1.zeroPadBytes)(bytes, 32);
|
||||
}
|
||||
exports.encodeBytes32String = encodeBytes32String;
|
||||
/**
|
||||
* Encodes the Bytes32-encoded %%bytes%% into a string.
|
||||
*/
|
||||
function decodeBytes32String(_bytes) {
|
||||
const data = (0, index_js_1.getBytes)(_bytes, "bytes");
|
||||
// Must be 32 bytes with a null-termination
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"bytes32.js","sourceRoot":"","sources":["../../src.ts/abi/bytes32.ts"],"names":[],"mappings":";;;AACA,gDAE2B;AAK3B,SAAgB,mBAAmB,CAAC,IAAY;IAE5C,gBAAgB;IAChB,MAAM,KAAK,GAAG,IAAA,sBAAW,EAAC,IAAI,CAAC,CAAC;IAEhC,0CAA0C;IAC1C,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAAE;IAExF,wCAAwC;IACxC,OAAO,IAAA,uBAAY,EAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC;AAVD,kDAUC;AAED,SAAgB,mBAAmB,CAAC,MAAiB;IACjD,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvC,2CAA2C;IAC3C,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KAAE;IACnF,IAAI,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;KAAE;IAEvF,4BAA4B;IAC5B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,CAAC;KAAE;IAE5C,6BAA6B;IAC7B,OAAO,IAAA,uBAAY,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/C,CAAC;AAbD,kDAaC"}
|
||||
{"version":3,"file":"bytes32.js","sourceRoot":"","sources":["../../src.ts/abi/bytes32.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gDAE2B;AAI3B;;GAEG;AACH,SAAgB,mBAAmB,CAAC,IAAY;IAE5C,gBAAgB;IAChB,MAAM,KAAK,GAAG,IAAA,sBAAW,EAAC,IAAI,CAAC,CAAC;IAEhC,0CAA0C;IAC1C,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAAE;IAExF,wCAAwC;IACxC,OAAO,IAAA,uBAAY,EAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC;AAVD,kDAUC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,MAAiB;IACjD,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvC,2CAA2C;IAC3C,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KAAE;IACnF,IAAI,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;KAAE;IAEvF,4BAA4B;IAC5B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,CAAC;KAAE;IAE5C,6BAA6B;IAC7B,OAAO,IAAA,uBAAY,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/C,CAAC;AAbD,kDAaC"}
|
@ -8,8 +8,18 @@ const Padding = new Uint8Array(exports.WordSize);
|
||||
// - `then` is used to detect if an object is a Promise for await
|
||||
const passProperties = ["then"];
|
||||
const _guard = {};
|
||||
/**
|
||||
* A [[Result]] is a sub-class of Array, which allows accessing any
|
||||
* of its values either positionally by its index or, if keys are
|
||||
* provided by its name.
|
||||
*
|
||||
* @_docloc: api/abi
|
||||
*/
|
||||
class Result extends Array {
|
||||
#indices;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard, items, keys) {
|
||||
(0, index_js_1.assertPrivate)(guard, _guard, "Result");
|
||||
super(...items);
|
||||
@ -68,6 +78,9 @@ class Result extends Array {
|
||||
return this;
|
||||
}
|
||||
*/
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
slice(start, end) {
|
||||
if (start == null) {
|
||||
start = 0;
|
||||
@ -93,6 +106,14 @@ class Result extends Array {
|
||||
wrapped.error = error;
|
||||
throw wrapped;
|
||||
}
|
||||
/**
|
||||
* Returns the value for %%name%%.
|
||||
*
|
||||
* Since it is possible to have a key whose name conflicts with
|
||||
* a method on a [[Result]] or its superclass Array, or any
|
||||
* JavaScript keyword, this ensures all named values are still
|
||||
* accessible by name.
|
||||
*/
|
||||
getValue(name) {
|
||||
const index = this.#indices.get(name);
|
||||
if (index != null && index.length === 1) {
|
||||
@ -104,11 +125,28 @@ class Result extends Array {
|
||||
}
|
||||
throw new Error(`no named parameter: ${JSON.stringify(name)}`);
|
||||
}
|
||||
/**
|
||||
* Creates a new [[Result]] for %%items%% with each entry
|
||||
* also accessible by its corresponding name in %%keys%%.
|
||||
*/
|
||||
static fromItems(items, keys) {
|
||||
return new Result(_guard, items, keys);
|
||||
}
|
||||
}
|
||||
exports.Result = Result;
|
||||
/**
|
||||
* Returns all errors found in a [[Result]].
|
||||
*
|
||||
* Since certain errors encountered when creating a [[Result]] do
|
||||
* not impact the ability to continue parsing data, they are
|
||||
* deferred until they are actually accessed. Hence a faulty string
|
||||
* in an Event that is never used does not impact the program flow.
|
||||
*
|
||||
* However, sometimes it may be useful to access, identify or
|
||||
* validate correctness of a [[Result]].
|
||||
*
|
||||
* @_docloc api/abi
|
||||
*/
|
||||
function checkResultErrors(result) {
|
||||
// Find the first error (if any)
|
||||
const errors = [];
|
||||
@ -139,6 +177,9 @@ function getValue(value) {
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
class Coder {
|
||||
// The coder name:
|
||||
// - address, uint256, tuple, array, etc.
|
||||
@ -163,6 +204,9 @@ class Coder {
|
||||
}
|
||||
}
|
||||
exports.Coder = Coder;
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
class Writer {
|
||||
// An array of WordSize lengthed objects to concatenation
|
||||
#data;
|
||||
@ -208,6 +252,9 @@ class Writer {
|
||||
}
|
||||
}
|
||||
exports.Writer = Writer;
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
class Reader {
|
||||
// Allows incomplete unpadded data to be read; otherwise an error
|
||||
// is raised if attempting to overrun the buffer. This is required
|
||||
|
File diff suppressed because one or more lines are too long
@ -5,6 +5,9 @@ const index_js_1 = require("../../address/index.js");
|
||||
const maths_js_1 = require("../../utils/maths.js");
|
||||
const typed_js_1 = require("../typed.js");
|
||||
const abstract_coder_js_1 = require("./abstract-coder.js");
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
class AddressCoder extends abstract_coder_js_1.Coder {
|
||||
constructor(localName) {
|
||||
super("address", "address", localName, false);
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/address.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AACpD,mDAA6C;AAE7C,0CAAoC;AACpC,2DAA4C;AAK5C,MAAa,YAAa,SAAQ,yBAAK;IAEnC,YAAY,SAAiB;QACzB,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,YAAY;QACR,OAAO,4CAA4C,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,MAAc,EAA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O,IAAA,qBAAU,EAAC,IAAA,gBAAK,EAAC,MAAM,CAAC,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACrD,CAAC;CACJ;AAvBD,oCAuBC"}
|
@ -2,7 +2,11 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AnonymousCoder = void 0;
|
||||
const abstract_coder_js_1 = require("./abstract-coder.js");
|
||||
// Clones the functionality of an existing Coder, but without a localName
|
||||
/**
|
||||
* Clones the functionality of an existing Coder, but without a localName
|
||||
*
|
||||
* @_ignore
|
||||
*/
|
||||
class AnonymousCoder extends abstract_coder_js_1.Coder {
|
||||
coder;
|
||||
constructor(coder) {
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"anonymous.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/anonymous.ts"],"names":[],"mappings":";;;AAAA,2DAA4C;AAI5C,yEAAyE;AACzE,MAAa,cAAe,SAAQ,yBAAK;IAC7B,KAAK,CAAQ;IAErB,YAAY,KAAY;QACpB,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACJ;AAnBD,wCAmBC"}
|
||||
{"version":3,"file":"anonymous.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/anonymous.ts"],"names":[],"mappings":";;;AAAA,2DAA4C;AAI5C;;;;GAIG;AACH,MAAa,cAAe,SAAQ,yBAAK;IAC7B,KAAK,CAAQ;IAErB,YAAY,KAAY;QACpB,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACJ;AAnBD,wCAmBC"}
|
@ -5,6 +5,9 @@ const index_js_1 = require("../../utils/index.js");
|
||||
const typed_js_1 = require("../typed.js");
|
||||
const abstract_coder_js_1 = require("./abstract-coder.js");
|
||||
const anonymous_js_1 = require("./anonymous.js");
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
function pack(writer, coders, values) {
|
||||
let arrayValues = [];
|
||||
if (Array.isArray(values)) {
|
||||
@ -51,6 +54,9 @@ function pack(writer, coders, values) {
|
||||
return length;
|
||||
}
|
||||
exports.pack = pack;
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
function unpack(reader, coders) {
|
||||
let values = [];
|
||||
let keys = [];
|
||||
@ -99,6 +105,9 @@ function unpack(reader, coders) {
|
||||
return abstract_coder_js_1.Result.fromItems(values, keys);
|
||||
}
|
||||
exports.unpack = unpack;
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
class ArrayCoder extends abstract_coder_js_1.Coder {
|
||||
coder;
|
||||
length;
|
||||
|
File diff suppressed because one or more lines are too long
@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BooleanCoder = void 0;
|
||||
const typed_js_1 = require("../typed.js");
|
||||
const abstract_coder_js_1 = require("./abstract-coder.js");
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
class BooleanCoder extends abstract_coder_js_1.Coder {
|
||||
constructor(localName) {
|
||||
super("bool", "bool", localName, false);
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/boolean.ts"],"names":[],"mappings":";;;AAAA,0CAAoC;AACpC,2DAA4C;AAK5C,MAAa,YAAa,SAAQ,yBAAK;IAEnC,YAAY,SAAiB;QACzB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,YAAY;QACR,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAuB;QAC1C,MAAM,KAAK,GAAG,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IAChC,CAAC;CACJ;AAlBD,oCAkBC"}
|
||||
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/boolean.ts"],"names":[],"mappings":";;;AAAA,0CAAoC;AACpC,2DAA4C;AAI5C;;GAEG;AACH,MAAa,YAAa,SAAQ,yBAAK;IAEnC,YAAY,SAAiB;QACzB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,YAAY;QACR,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAuB;QAC1C,MAAM,KAAK,GAAG,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IAChC,CAAC;CACJ;AAlBD,oCAkBC"}
|
@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.BytesCoder = exports.DynamicBytesCoder = void 0;
|
||||
const index_js_1 = require("../../utils/index.js");
|
||||
const abstract_coder_js_1 = require("./abstract-coder.js");
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
class DynamicBytesCoder extends abstract_coder_js_1.Coder {
|
||||
constructor(type, localName) {
|
||||
super(type, type, localName, true);
|
||||
@ -21,6 +24,9 @@ class DynamicBytesCoder extends abstract_coder_js_1.Coder {
|
||||
}
|
||||
}
|
||||
exports.DynamicBytesCoder = DynamicBytesCoder;
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
class BytesCoder extends DynamicBytesCoder {
|
||||
constructor(localName) {
|
||||
super("bytes", localName);
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/bytes.ts"],"names":[],"mappings":";;;AAAA,mDAA6D;AAE7D,2DAA4C;AAK5C,MAAa,iBAAkB,SAAQ,yBAAK;IACxC,YAAY,IAAY,EAAE,SAAiB;QACxC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC7B,KAAK,GAAG,IAAA,uBAAY,EAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,MAAM,GAAG,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,CAAC;IACtD,CAAC;CACJ;AAnBD,8CAmBC;AAED;;GAEG;AACH,MAAa,UAAW,SAAQ,iBAAiB;IAC7C,YAAY,SAAiB;QACzB,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAA,kBAAO,EAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACzC,CAAC;CACJ;AARD,gCAQC"}
|
@ -4,6 +4,9 @@ exports.FixedBytesCoder = void 0;
|
||||
const index_js_1 = require("../../utils/index.js");
|
||||
const typed_js_1 = require("../typed.js");
|
||||
const abstract_coder_js_1 = require("./abstract-coder.js");
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
class FixedBytesCoder extends abstract_coder_js_1.Coder {
|
||||
size;
|
||||
constructor(size, localName) {
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"fixed-bytes.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/fixed-bytes.ts"],"names":[],"mappings":";;;AACA,mDAA+E;AAE/E,0CAAoC;AACpC,2DAA4C;AAO5C,MAAa,eAAgB,SAAQ,yBAAK;IAC7B,IAAI,CAAU;IAEvB,YAAY,IAAY,EAAE,SAAiB;QACvC,IAAI,IAAI,GAAG,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAClC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACpC,IAAA,2BAAgB,EAAkB,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,YAAY;QACR,OAAO,CAAC,oEAAoE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IAClH,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAyB;QAC5C,IAAI,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AAC;QAC9D,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,EAAE;YAAE,IAAI,CAAC,WAAW,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;SAAE;QACrF,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAA,kBAAO,EAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;CACJ;AAtBD,0CAsBC"}
|
@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NullCoder = void 0;
|
||||
const abstract_coder_js_1 = require("./abstract-coder.js");
|
||||
const Empty = new Uint8Array([]);
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
class NullCoder extends abstract_coder_js_1.Coder {
|
||||
constructor(localName) {
|
||||
super("null", "", localName, false);
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"null.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/null.ts"],"names":[],"mappings":";;;AAAA,2DAA4C;AAG5C,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAG,CAAC,CAAC;AAElC,MAAa,SAAU,SAAQ,yBAAK;IAEhC,YAAY,SAAiB;QACzB,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC7B,IAAI,KAAK,IAAI,IAAI,EAAE;YAAE,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;SAAE;QAC3D,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAnBD,8BAmBC"}
|
||||
{"version":3,"file":"null.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/null.ts"],"names":[],"mappings":";;;AAAA,2DAA4C;AAG5C,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAG,CAAC,CAAC;AAElC;;GAEG;AACH,MAAa,SAAU,SAAQ,yBAAK;IAEhC,YAAY,SAAiB;QACzB,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC7B,IAAI,KAAK,IAAI,IAAI,EAAE;YAAE,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;SAAE;QAC3D,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAnBD,8BAmBC"}
|
@ -7,6 +7,9 @@ const abstract_coder_js_1 = require("./abstract-coder.js");
|
||||
const BN_0 = BigInt(0);
|
||||
const BN_1 = BigInt(1);
|
||||
const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
class NumberCoder extends abstract_coder_js_1.Coder {
|
||||
size;
|
||||
signed;
|
||||
@ -27,14 +30,11 @@ class NumberCoder extends abstract_coder_js_1.Coder {
|
||||
if (value > bounds || value < -(bounds + BN_1)) {
|
||||
this._throwError("value out-of-bounds", _value);
|
||||
}
|
||||
value = (0, index_js_1.toTwos)(value, 8 * abstract_coder_js_1.WordSize);
|
||||
}
|
||||
else if (value < BN_0 || value > (0, index_js_1.mask)(maxUintValue, this.size * 8)) {
|
||||
this._throwError("value out-of-bounds", _value);
|
||||
}
|
||||
value = (0, index_js_1.mask)((0, index_js_1.toTwos)(value, this.size * 8), this.size * 8);
|
||||
if (this.signed) {
|
||||
value = (0, index_js_1.toTwos)((0, index_js_1.fromTwos)(value, this.size * 8), 8 * abstract_coder_js_1.WordSize);
|
||||
}
|
||||
return writer.writeValue(value);
|
||||
}
|
||||
decode(reader) {
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"number.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/number.ts"],"names":[],"mappings":";;;AAAA,mDAE8B;AAE9B,0CAAoC;AACpC,2DAAsD;AAOtD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,cAAc,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAEpG,MAAa,WAAY,SAAQ,yBAAK;IACzB,IAAI,CAAU;IACd,MAAM,CAAW;IAE1B,YAAY,IAAY,EAAE,MAAe,EAAE,SAAiB;QACxD,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAA,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;QACrD,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAEpC,IAAA,2BAAgB,EAAc,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACjG,CAAC;IAED,YAAY;QACR,OAAO,CAAC,CAAC;IACb,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAA4B;QAC/C,IAAI,KAAK,GAAG,IAAA,oBAAS,EAAC,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,C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ACtD,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,IAAI,MAAM,GAAG,IAAA,eAAI,EAAC,YAAY,EAAE,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACrD,IAAI,KAAK,GAAG,MAAM,IAAI,KAAK,GAAG,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE;gBAC5C,IAAI,CAAC,WAAW,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;aACnD;YACD,KAAK,GAAG,IAAA,iBAAM,EAAC,KAAK,EAAE,CAAC,GAAG,4BAAQ,CAAC,CAAC;SACvC;aAAM,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,IAAA,eAAI,EAAC,YAAY,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE;YAClE,IAAI,CAAC,WAAW,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;SACnD;QAED,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,IAAI,KAAK,GAAG,IAAA,eAAI,EAAC,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAEpD,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,KAAK,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;SAC1C;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA1CD,kCA0CC"}
|
@ -4,6 +4,9 @@ exports.StringCoder = void 0;
|
||||
const utf8_js_1 = require("../../utils/utf8.js");
|
||||
const typed_js_1 = require("../typed.js");
|
||||
const bytes_js_1 = require("./bytes.js");
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
class StringCoder extends bytes_js_1.DynamicBytesCoder {
|
||||
constructor(localName) {
|
||||
super("string", localName);
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/string.ts"],"names":[],"mappings":";;;AAAA,iDAAgE;AAEhE,0CAAoC;AACpC,yCAA+C;AAK/C,MAAa,WAAY,SAAQ,4BAAiB;IAE9C,YAAY,SAAiB;QACzB,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED,YAAY;QACR,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAsB;QACzC,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAA,qBAAW,EAAC,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAA,sBAAY,EAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9C,CAAC;CACJ;AAjBD,kCAiBC"}
|
||||
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/string.ts"],"names":[],"mappings":";;;AAAA,iDAAgE;AAEhE,0CAAoC;AACpC,yCAA+C;AAK/C;;GAEG;AACH,MAAa,WAAY,SAAQ,4BAAiB;IAE9C,YAAY,SAAiB;QACzB,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED,YAAY;QACR,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAsB;QACzC,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAA,qBAAW,EAAC,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAA,sBAAY,EAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9C,CAAC;CACJ;AAjBD,kCAiBC"}
|
@ -5,6 +5,9 @@ const properties_js_1 = require("../../utils/properties.js");
|
||||
const typed_js_1 = require("../typed.js");
|
||||
const abstract_coder_js_1 = require("./abstract-coder.js");
|
||||
const array_js_1 = require("./array.js");
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
class TupleCoder extends abstract_coder_js_1.Coder {
|
||||
coders;
|
||||
constructor(coders, localName) {
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"tuple.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/tuple.ts"],"names":[],"mappings":";;;AAAA,6DAA6D;AAE7D,0CAAoC;AACpC,2DAA4C;AAE5C,yCAA0C;AAI1C,MAAa,UAAW,SAAQ,yBAAK;IACxB,MAAM,CAAwB;IAEvC,YAAY,MAAoB,EAAE,SAAiB;QAC/C,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,KAAK,GAAkB,EAAE,CAAC;QAChC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACrB,IAAI,KAAK,CAAC,OAAO,EAAE;gBAAE,OAAO,GAAG,IAAI,CAAC;aAAE;YACtC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;QAEhD,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QACzC,IAAA,gCAAgB,EAAa,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,YAAY;QACR,MAAM,MAAM,GAAQ,EAAG,CAAC;QACxB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YAC1B,MAAM,C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"}
|
@ -1,4 +1,9 @@
|
||||
"use strict";
|
||||
/**
|
||||
* About frgaments...
|
||||
*
|
||||
* @_subsection api/abi/abi-coder:Fragments
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.StructFragment = exports.FunctionFragment = exports.ConstructorFragment = exports.EventFragment = exports.ErrorFragment = exports.NamedFragment = exports.Fragment = exports.ParamType = void 0;
|
||||
const index_js_1 = require("../utils/index.js");
|
||||
@ -347,6 +352,9 @@ class ParamType {
|
||||
// - child type
|
||||
arrayLength;
|
||||
arrayChildren;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard, name, type, baseType, indexed, components, arrayLength, arrayChildren) {
|
||||
(0, index_js_1.assertPrivate)(guard, _guard, "ParamType");
|
||||
Object.defineProperty(this, internal, { value: ParamTypeInternal });
|
||||
@ -377,7 +385,10 @@ class ParamType {
|
||||
// - sighash: "(uint256,address)"
|
||||
// - minimal: "tuple(uint256,address) indexed"
|
||||
// - full: "tuple(uint256 foo, address bar) indexed baz"
|
||||
format(format = "sighash") {
|
||||
format(format) {
|
||||
if (format == null) {
|
||||
format = "sighash";
|
||||
}
|
||||
if (format === "json") {
|
||||
let result = {
|
||||
type: ((this.baseType === "tuple") ? "tuple" : this.type),
|
||||
@ -602,6 +613,9 @@ exports.ParamType = ParamType;
|
||||
class Fragment {
|
||||
type;
|
||||
inputs;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard, type, inputs) {
|
||||
(0, index_js_1.assertPrivate)(guard, _guard, "Fragment");
|
||||
inputs = Object.freeze(inputs.slice());
|
||||
@ -657,6 +671,9 @@ class Fragment {
|
||||
exports.Fragment = Fragment;
|
||||
class NamedFragment extends Fragment {
|
||||
name;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard, type, name, inputs) {
|
||||
super(guard, type, inputs);
|
||||
(0, index_js_1.assertArgument)(typeof (name) === "string" && name.match(regexIdentifier), "invalid identifier", "name", name);
|
||||
@ -669,6 +686,9 @@ function joinParams(format, params) {
|
||||
return "(" + params.map((p) => p.format(format)).join((format === "full") ? ", " : ",") + ")";
|
||||
}
|
||||
class ErrorFragment extends NamedFragment {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard, name, inputs) {
|
||||
super(guard, "error", name, inputs);
|
||||
Object.defineProperty(this, internal, { value: ErrorFragmentInternal });
|
||||
@ -676,7 +696,10 @@ class ErrorFragment extends NamedFragment {
|
||||
get selector() {
|
||||
return (0, index_js_2.id)(this.format("sighash")).substring(0, 10);
|
||||
}
|
||||
format(format = "sighash") {
|
||||
format(format) {
|
||||
if (format == null) {
|
||||
format = "sighash";
|
||||
}
|
||||
if (format === "json") {
|
||||
return JSON.stringify({
|
||||
type: "error",
|
||||
@ -713,6 +736,9 @@ class ErrorFragment extends NamedFragment {
|
||||
exports.ErrorFragment = ErrorFragment;
|
||||
class EventFragment extends NamedFragment {
|
||||
anonymous;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard, name, inputs, anonymous) {
|
||||
super(guard, "event", name, inputs);
|
||||
Object.defineProperty(this, internal, { value: EventFragmentInternal });
|
||||
@ -721,7 +747,10 @@ class EventFragment extends NamedFragment {
|
||||
get topicHash() {
|
||||
return (0, index_js_2.id)(this.format("sighash"));
|
||||
}
|
||||
format(format = "sighash") {
|
||||
format(format) {
|
||||
if (format == null) {
|
||||
format = "sighash";
|
||||
}
|
||||
if (format === "json") {
|
||||
return JSON.stringify({
|
||||
type: "event",
|
||||
@ -764,13 +793,16 @@ exports.EventFragment = EventFragment;
|
||||
class ConstructorFragment extends Fragment {
|
||||
payable;
|
||||
gas;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard, type, inputs, payable, gas) {
|
||||
super(guard, type, inputs);
|
||||
Object.defineProperty(this, internal, { value: ConstructorFragmentInternal });
|
||||
(0, index_js_1.defineProperties)(this, { payable, gas });
|
||||
}
|
||||
format(format = "sighash") {
|
||||
(0, index_js_1.assert)(format !== "sighash", "cannot format a constructor for sighash", "UNSUPPORTED_OPERATION", { operation: "format(sighash)" });
|
||||
format(format) {
|
||||
(0, index_js_1.assert)(format != null && format !== "sighash", "cannot format a constructor for sighash", "UNSUPPORTED_OPERATION", { operation: "format(sighash)" });
|
||||
if (format === "json") {
|
||||
return JSON.stringify({
|
||||
type: "constructor",
|
||||
@ -815,6 +847,9 @@ class FunctionFragment extends NamedFragment {
|
||||
stateMutability;
|
||||
payable;
|
||||
gas;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard, name, stateMutability, inputs, outputs, gas) {
|
||||
super(guard, "function", name, inputs);
|
||||
Object.defineProperty(this, internal, { value: FunctionFragmentInternal });
|
||||
@ -826,7 +861,10 @@ class FunctionFragment extends NamedFragment {
|
||||
get selector() {
|
||||
return (0, index_js_2.id)(this.format("sighash")).substring(0, 10);
|
||||
}
|
||||
format(format = "sighash") {
|
||||
format(format) {
|
||||
if (format == null) {
|
||||
format = "sighash";
|
||||
}
|
||||
if (format === "json") {
|
||||
return JSON.stringify({
|
||||
type: "function",
|
||||
@ -886,6 +924,9 @@ class FunctionFragment extends NamedFragment {
|
||||
}
|
||||
exports.FunctionFragment = FunctionFragment;
|
||||
class StructFragment extends NamedFragment {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard, name, inputs) {
|
||||
super(guard, "struct", name, inputs);
|
||||
Object.defineProperty(this, internal, { value: StructFragmentInternal });
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,11 +1,14 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Explain about ABI here...
|
||||
*
|
||||
* @_section api/abi:Application Binary Interface [abi]
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Typed = exports.Result = exports.TransactionDescription = exports.LogDescription = exports.ErrorDescription = exports.Interface = exports.Indexed = exports.checkResultErrors = exports.StructFragment = exports.ParamType = exports.NamedFragment = exports.FunctionFragment = exports.Fragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.encodeBytes32String = exports.decodeBytes32String = exports.getBuiltinCallException = exports.defaultAbiCoder = exports.AbiCoder = void 0;
|
||||
exports.Typed = exports.Result = exports.TransactionDescription = exports.LogDescription = exports.ErrorDescription = exports.Interface = exports.Indexed = exports.checkResultErrors = exports.StructFragment = exports.ParamType = exports.NamedFragment = exports.FunctionFragment = exports.Fragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.encodeBytes32String = exports.decodeBytes32String = exports.AbiCoder = void 0;
|
||||
//////
|
||||
var abi_coder_js_1 = require("./abi-coder.js");
|
||||
Object.defineProperty(exports, "AbiCoder", { enumerable: true, get: function () { return abi_coder_js_1.AbiCoder; } });
|
||||
Object.defineProperty(exports, "defaultAbiCoder", { enumerable: true, get: function () { return abi_coder_js_1.defaultAbiCoder; } });
|
||||
Object.defineProperty(exports, "getBuiltinCallException", { enumerable: true, get: function () { return abi_coder_js_1.getBuiltinCallException; } });
|
||||
var bytes32_js_1 = require("./bytes32.js");
|
||||
Object.defineProperty(exports, "decodeBytes32String", { enumerable: true, get: function () { return bytes32_js_1.decodeBytes32String; } });
|
||||
Object.defineProperty(exports, "encodeBytes32String", { enumerable: true, get: function () { return bytes32_js_1.encodeBytes32String; } });
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":";;;AAGA,MAAM;AACN,+CAIwB;AAHpB,wGAAA,QAAQ,OAAA;AACR,+GAAA,eAAe,OAAA;AACf,uHAAA,uBAAuB,OAAA;AAG3B,2CAAwE;AAA/D,iHAAA,mBAAmB,OAAA;AAAE,iHAAA,mBAAmB,OAAA;AAEjD,+CAGwB;AAFpB,mHAAA,mBAAmB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,wGAAA,QAAQ,OAAA;AAC3D,gHAAA,gBAAgB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,yGAAA,SAAS,OAAA;AAAE,8GAAA,cAAc,OAAA;AAG9D,+CAMwB;AALpB,iHAAA,iBAAiB,OAAA;AACjB,uGAAA,OAAO,OAAA;AACP,yGAAA,SAAS,OAAA;AACT,gHAAA,gBAAgB,OAAA;AAAE,8GAAA,cAAc,OAAA;AAAE,sHAAA,sBAAsB,OAAA;AACxD,sGAAA,MAAM,OAAA;AAGV,uCAAmC;AAA1B,iGAAA,KAAK,OAAA"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,MAAM;AACN,+CAA0C;AAAjC,wGAAA,QAAQ,OAAA;AAEjB,2CAAwE;AAA/D,iHAAA,mBAAmB,OAAA;AAAE,iHAAA,mBAAmB,OAAA;AAEjD,+CAGwB;AAFpB,mHAAA,mBAAmB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,wGAAA,QAAQ,OAAA;AAC3D,gHAAA,gBAAgB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,yGAAA,SAAS,OAAA;AAAE,8GAAA,cAAc,OAAA;AAG9D,+CAMwB;AALpB,iHAAA,iBAAiB,OAAA;AACjB,uGAAA,OAAO,OAAA;AACP,yGAAA,SAAS,OAAA;AACT,gHAAA,gBAAgB,OAAA;AAAE,8GAAA,cAAc,OAAA;AAAE,sHAAA,sBAAsB,OAAA;AACxD,sGAAA,MAAM,OAAA;AAGV,uCAAmC;AAA1B,iGAAA,KAAK,OAAA"}
|
@ -1,4 +1,9 @@
|
||||
"use strict";
|
||||
/**
|
||||
* About Interface
|
||||
*
|
||||
* @_subsection api/abi:Interfaces [interfaces]
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Interface = exports.Indexed = exports.ErrorDescription = exports.TransactionDescription = exports.LogDescription = exports.Result = exports.checkResultErrors = void 0;
|
||||
const index_js_1 = require("../crypto/index.js");
|
||||
@ -99,6 +104,16 @@ const BuiltinErrors = {
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* An Interface abstracts many of the low-level details for
|
||||
* encoding and decoding the data on the blockchain.
|
||||
*
|
||||
* An ABI provides information on how to encode data to send to
|
||||
* a Contract, how to decode the results and events and how to
|
||||
* interpret revert errors.
|
||||
*
|
||||
* The ABI can be specified by [any supported format](InterfaceAbi).
|
||||
*/
|
||||
class Interface {
|
||||
/**
|
||||
* All the Contract ABI members (i.e. methods, events, errors, etc).
|
||||
@ -113,6 +128,9 @@ class Interface {
|
||||
#functions;
|
||||
// #structs: Map<string, StructFragment>;
|
||||
#abiCoder;
|
||||
/**
|
||||
* Create a new Interface for the %%fragments%%.
|
||||
*/
|
||||
constructor(fragments) {
|
||||
let abi = [];
|
||||
if (typeof (fragments) === "string") {
|
||||
@ -203,7 +221,7 @@ class Interface {
|
||||
* data.
|
||||
*/
|
||||
getAbiCoder() {
|
||||
return abi_coder_js_1.defaultAbiCoder;
|
||||
return abi_coder_js_1.AbiCoder.defaultAbiCoder();
|
||||
}
|
||||
// Find a function definition by any means necessary (unless it is ambiguous)
|
||||
#getFunction(key, values, forceUnique) {
|
||||
@ -572,7 +590,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string {
|
||||
}
|
||||
makeError(_data, tx) {
|
||||
const data = (0, index_js_3.getBytes)(_data, "data");
|
||||
const error = (0, abi_coder_js_1.getBuiltinCallException)("call", tx, data);
|
||||
const error = abi_coder_js_1.AbiCoder.getBuiltinCallException("call", tx, data);
|
||||
// Not a built-in error; try finding a custom error
|
||||
if (!error.message.match(/could not decode/)) {
|
||||
const selector = (0, index_js_3.hexlify)(data.slice(0, 4));
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,4 +1,9 @@
|
||||
"use strict";
|
||||
/**
|
||||
* About typed...
|
||||
*
|
||||
* @_subsection: api/abi:Typed Values
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Typed = void 0;
|
||||
const index_js_1 = require("../utils/index.js");
|
||||
@ -22,7 +27,10 @@ class Typed {
|
||||
value;
|
||||
#options;
|
||||
_typedSymbol;
|
||||
constructor(gaurd, type, value, options = null) {
|
||||
constructor(gaurd, type, value, options) {
|
||||
if (options == null) {
|
||||
options = null;
|
||||
}
|
||||
(0, index_js_1.assertPrivate)(_gaurd, gaurd, "Typed");
|
||||
(0, index_js_1.defineProperties)(this, { _typedSymbol, type, value });
|
||||
this.#options = options;
|
||||
@ -197,9 +205,19 @@ class Typed {
|
||||
static overrides(v) {
|
||||
return new Typed(_gaurd, "overrides", Object.assign({}, v));
|
||||
}
|
||||
/**
|
||||
* Returns true only if %%value%% is a [[Typed]] instance.
|
||||
*/
|
||||
static isTyped(value) {
|
||||
return (value && value._typedSymbol === _typedSymbol);
|
||||
}
|
||||
/**
|
||||
* If the value is a [[Typed]] instance, validates the underlying value
|
||||
* and returns it, otherwise returns value directly.
|
||||
*
|
||||
* This is useful for functions that with to accept either a [[Typed]]
|
||||
* object or values.
|
||||
*/
|
||||
static dereference(value, type) {
|
||||
if (Typed.isTyped(value)) {
|
||||
if (value.type !== type) {
|
||||
|
File diff suppressed because one or more lines are too long
@ -5,6 +5,17 @@ const index_js_1 = require("../crypto/index.js");
|
||||
const index_js_2 = require("../utils/index.js");
|
||||
const address_js_1 = require("./address.js");
|
||||
// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed
|
||||
/**
|
||||
* Returns the address that would result from a ``CREATE`` for %%tx%%.
|
||||
*
|
||||
* This can be used to compute the address a contract will be
|
||||
* deployed to by an EOA when sending a deployment transaction (i.e.
|
||||
* when the ``to`` address is ``null``).
|
||||
*
|
||||
* This can also be used to compute the address a contract will be
|
||||
* deployed to by a contract, by using the contract's address as the
|
||||
* ``to`` and the contract's nonce.
|
||||
*/
|
||||
function getCreateAddress(tx) {
|
||||
const from = (0, address_js_1.getAddress)(tx.from);
|
||||
const nonce = (0, index_js_2.getBigInt)(tx.nonce, "tx.nonce");
|
||||
@ -21,6 +32,13 @@ function getCreateAddress(tx) {
|
||||
return (0, address_js_1.getAddress)((0, index_js_2.dataSlice)((0, index_js_1.keccak256)((0, index_js_2.encodeRlp)([from, nonceHex])), 12));
|
||||
}
|
||||
exports.getCreateAddress = getCreateAddress;
|
||||
/**
|
||||
* Returns the address that would result from a ``CREATE2`` operation
|
||||
* with the given %%from%%, %%salt%% and %%initCodeHash%%.
|
||||
*
|
||||
* To compute the %%initCodeHash%% from a contract's init code, use
|
||||
* the [[keccak256]] function.
|
||||
*/
|
||||
function getCreate2Address(_from, _salt, _initCodeHash) {
|
||||
const from = (0, address_js_1.getAddress)(_from);
|
||||
const salt = (0, index_js_2.getBytes)(_salt, "salt");
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"contract-address.js","sourceRoot":"","sources":["../../src.ts/address/contract-address.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,gDAE2B;AAE3B,6CAA0C;AAK1C,sGAAsG;AACtG,SAAgB,gBAAgB,CAAC,EAAyC;IACtE,MAAM,IAAI,GAAG,IAAA,uBAAU,EAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAE9C,IAAI,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAClC,IAAI,QAAQ,KAAK,GAAG,EAAE;QAClB,QAAQ,GAAG,IAAI,CAAC;KACnB;SAAM,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QAC5B,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;KAC/B;SAAM;QACH,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAAC;KAC9B;IAED,OAAO,IAAA,uBAAU,EAAC,IAAA,oBAAS,EAAC,IAAA,oBAAS,EAAC,IAAA,oBAAS,EAAC,CAAE,IAAI,EA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||
* @_section: api/address:Addresses [addresses]
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveAddress = exports.isAddress = exports.isAddressable = exports.getCreate2Address = exports.getCreateAddress = exports.getIcapAddress = exports.getAddress = void 0;
|
||||
var address_js_1 = require("./address.js");
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/address/index.ts"],"names":[],"mappings":";;;AAUA,2CAA0D;AAAjD,wGAAA,UAAU,OAAA;AAAE,4GAAA,cAAc,OAAA;AAEnC,6DAA4E;AAAnE,uHAAA,gBAAgB,OAAA;AAAE,wHAAA,iBAAiB,OAAA;AAG5C,yCAAuE;AAA9D,0GAAA,aAAa,OAAA;AAAE,sGAAA,SAAS,OAAA;AAAE,2GAAA,cAAc,OAAA"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/address/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAYH,2CAA0D;AAAjD,wGAAA,UAAU,OAAA;AAAE,4GAAA,cAAc,OAAA;AAEnC,6DAA4E;AAAnE,uHAAA,gBAAgB,OAAA;AAAE,wHAAA,iBAAiB,OAAA;AAG5C,yCAAuE;AAA9D,0GAAA,aAAa,OAAA;AAAE,sGAAA,SAAS,OAAA;AAAE,2GAAA,cAAc,OAAA"}
|
@ -1 +1 @@
|
||||
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../src.ts/constants/addresses.ts"],"names":[],"mappings":";;;AACA;;GAEG;AACU,QAAA,WAAW,GAAG,4CAA4C,CAAC"}
|
||||
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../src.ts/constants/addresses.ts"],"names":[],"mappings":";;;AACA;;GAEG;AACU,QAAA,WAAW,GAAW,4CAA4C,CAAC"}
|
@ -1 +1 @@
|
||||
{"version":3,"file":"hashes.js","sourceRoot":"","sources":["../../src.ts/constants/hashes.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,QAAQ,GAAG,oEAAoE,CAAC"}
|
||||
{"version":3,"file":"hashes.js","sourceRoot":"","sources":["../../src.ts/constants/hashes.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,QAAQ,GAAW,oEAAoE,CAAC"}
|
@ -1,15 +1,16 @@
|
||||
"use strict";
|
||||
/**
|
||||
* Some common constants useful for Ethereum.
|
||||
*
|
||||
* @_section: api/constants: Constants [constants]
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.MessagePrefix = exports.EtherSymbol = exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.N = exports.Two = exports.One = exports.Zero = exports.NegativeOne = exports.ZeroHash = exports.ZeroAddress = void 0;
|
||||
exports.MessagePrefix = exports.EtherSymbol = exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.N = exports.ZeroHash = exports.ZeroAddress = void 0;
|
||||
var addresses_js_1 = require("./addresses.js");
|
||||
Object.defineProperty(exports, "ZeroAddress", { enumerable: true, get: function () { return addresses_js_1.ZeroAddress; } });
|
||||
var hashes_js_1 = require("./hashes.js");
|
||||
Object.defineProperty(exports, "ZeroHash", { enumerable: true, get: function () { return hashes_js_1.ZeroHash; } });
|
||||
var numbers_js_1 = require("./numbers.js");
|
||||
Object.defineProperty(exports, "NegativeOne", { enumerable: true, get: function () { return numbers_js_1.NegativeOne; } });
|
||||
Object.defineProperty(exports, "Zero", { enumerable: true, get: function () { return numbers_js_1.Zero; } });
|
||||
Object.defineProperty(exports, "One", { enumerable: true, get: function () { return numbers_js_1.One; } });
|
||||
Object.defineProperty(exports, "Two", { enumerable: true, get: function () { return numbers_js_1.Two; } });
|
||||
Object.defineProperty(exports, "N", { enumerable: true, get: function () { return numbers_js_1.N; } });
|
||||
Object.defineProperty(exports, "WeiPerEther", { enumerable: true, get: function () { return numbers_js_1.WeiPerEther; } });
|
||||
Object.defineProperty(exports, "MaxUint256", { enumerable: true, get: function () { return numbers_js_1.MaxUint256; } });
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/constants/index.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,2CAUsB;AATlB,yGAAA,WAAW,OAAA;AACX,kGAAA,IAAI,OAAA;AACJ,iGAAA,GAAG,OAAA;AACH,iGAAA,GAAG,OAAA;AACH,+FAAA,CAAC,OAAA;AACD,yGAAA,WAAW,OAAA;AACX,wGAAA,UAAU,OAAA;AACV,uGAAA,SAAS,OAAA;AACT,uGAAA,SAAS,OAAA;AAEb,2CAA0D;AAAjD,yGAAA,WAAW,OAAA;AAAE,2GAAA,aAAa,OAAA"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/constants/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,2CAMsB;AALlB,+FAAA,CAAC,OAAA;AACD,yGAAA,WAAW,OAAA;AACX,wGAAA,UAAU,OAAA;AACV,uGAAA,SAAS,OAAA;AACT,uGAAA,SAAS,OAAA;AAEb,2CAA0D;AAAjD,yGAAA,WAAW,OAAA;AAAE,2GAAA,aAAa,OAAA"}
|
@ -1,49 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.N = exports.Two = exports.One = exports.Zero = exports.NegativeOne = void 0;
|
||||
/**
|
||||
* A constant for the BigInt of -1.
|
||||
*/
|
||||
const NegativeOne = BigInt(-1);
|
||||
exports.NegativeOne = NegativeOne;
|
||||
/**
|
||||
* A constant for the BigInt of 0.
|
||||
*/
|
||||
const Zero = BigInt(0);
|
||||
exports.Zero = Zero;
|
||||
/**
|
||||
* A constant for the BigInt of 1.
|
||||
*/
|
||||
const One = BigInt(1);
|
||||
exports.One = One;
|
||||
/**
|
||||
* A constant for the BigInt of 2.
|
||||
*/
|
||||
const Two = BigInt(2);
|
||||
exports.Two = Two;
|
||||
exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.N = void 0;
|
||||
/**
|
||||
* A constant for the order N for the secp256k1 curve.
|
||||
*/
|
||||
const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
|
||||
exports.N = N;
|
||||
exports.N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
|
||||
/**
|
||||
* A constant for the number of wei in a single ether.
|
||||
*/
|
||||
const WeiPerEther = BigInt("1000000000000000000");
|
||||
exports.WeiPerEther = WeiPerEther;
|
||||
exports.WeiPerEther = BigInt("1000000000000000000");
|
||||
/**
|
||||
* A constant for the maximum value for a ``uint256``.
|
||||
*/
|
||||
const MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
exports.MaxUint256 = MaxUint256;
|
||||
exports.MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
/**
|
||||
* A constant for the minimum value for an ``int256``.
|
||||
*/
|
||||
const MinInt256 = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * NegativeOne;
|
||||
exports.MinInt256 = MinInt256;
|
||||
exports.MinInt256 = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * BigInt(-1);
|
||||
/**
|
||||
* A constant for the maximum value for an ``int256``.
|
||||
*/
|
||||
const MaxInt256 = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
exports.MaxInt256 = MaxInt256;
|
||||
exports.MaxInt256 = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
//# sourceMappingURL=numbers.js.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"numbers.js","sourceRoot":"","sources":["../../src.ts/constants/numbers.ts"],"names":[],"mappings":";;;AACA;;GAEG;AACH,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AA2C3B,kCAAW;AAzCf;;GAEG;AACH,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAuCnB,oBAAI;AArCR;;GAEG;AACH,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAmClB,kBAAG;AAjCP;;GAEG;AACH,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AA+BlB,kBAAG;AA7BP;;GAEG;AACH,MAAM,CAAC,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AA2BnF,cAAC;AAzBL;;GAEG;AACH,MAAM,WAAW,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAuB9C,kCAAW;AArBf;;GAEG;AACH,MAAM,UAAU,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAmB5F,gCAAU;AAjBd;;GAEG;AACH,MAAM,SAAS,GAAG,MAAM,CAAC,oEAAoE,CAAC,GAAG,WAAW,CAAC;AAezG,8BAAS;AAbb;;GAEG;AACH,MAAM,SAAS,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAW3F,8BAAS"}
|
||||
{"version":3,"file":"numbers.js","sourceRoot":"","sources":["../../src.ts/constants/numbers.ts"],"names":[],"mappings":";;;AACA;;GAEG;AACU,QAAA,CAAC,GAAW,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAEtG;;GAEG;AACU,QAAA,WAAW,GAAW,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAEjE;;GAEG;AACU,QAAA,UAAU,GAAW,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAE/G;;GAEG;AACU,QAAA,SAAS,GAAW,MAAM,CAAC,oEAAoE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3H;;GAEG;AACU,QAAA,SAAS,GAAW,MAAM,CAAC,oEAAoE,CAAC,CAAC"}
|
@ -1 +1 @@
|
||||
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src.ts/constants/strings.ts"],"names":[],"mappings":";AAAA,8CAA8C;;;AAE9C;;GAEG;AACU,QAAA,WAAW,GAAG,QAAQ,CAAC,CAAE,kBAAkB;AAG3C,QAAA,aAAa,GAAG,gCAAgC,CAAC"}
|
||||
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src.ts/constants/strings.ts"],"names":[],"mappings":";AAAA,8CAA8C;;;AAE9C;;GAEG;AACU,QAAA,WAAW,GAAW,QAAQ,CAAC,CAAE,kBAAkB;AAGnD,QAAA,aAAa,GAAW,gCAAgC,CAAC"}
|
@ -405,7 +405,10 @@ class BaseContract {
|
||||
runner;
|
||||
filters;
|
||||
[internal];
|
||||
constructor(target, abi, runner = null, _deployTx) {
|
||||
constructor(target, abi, runner, _deployTx) {
|
||||
if (runner == null) {
|
||||
runner = null;
|
||||
}
|
||||
const iface = index_js_1.Interface.from(abi);
|
||||
(0, index_js_4.defineProperties)(this, { target, runner, interface: iface });
|
||||
Object.defineProperty(this, internal, { value: {} });
|
||||
@ -546,7 +549,13 @@ class BaseContract {
|
||||
// Is this useful?
|
||||
throw new Error("@TODO");
|
||||
}
|
||||
async queryFilter(event, fromBlock = 0, toBlock = "latest") {
|
||||
async queryFilter(event, fromBlock, toBlock) {
|
||||
if (fromBlock == null) {
|
||||
fromBlock = 0;
|
||||
}
|
||||
if (toBlock == null) {
|
||||
toBlock = "latest";
|
||||
}
|
||||
const { addr, addrPromise } = getInternal(this);
|
||||
const address = (addr ? addr : (await addrPromise));
|
||||
const { fragment, topics } = await getSubInfo(this, event);
|
||||
@ -666,7 +675,10 @@ class BaseContract {
|
||||
return CustomContract;
|
||||
}
|
||||
;
|
||||
static from(target, abi, runner = null) {
|
||||
static from(target, abi, runner) {
|
||||
if (runner == null) {
|
||||
runner = null;
|
||||
}
|
||||
const contract = new this(target, abi, runner);
|
||||
return contract;
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.EventLog = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.ContractEventPayload = exports.ContractFactory = exports.Contract = exports.BaseContract = void 0;
|
||||
/**
|
||||
* About contracts...
|
||||
*
|
||||
* @_section: api/contract:Contracts [contracts]
|
||||
*/
|
||||
var contract_js_1 = require("./contract.js");
|
||||
Object.defineProperty(exports, "BaseContract", { enumerable: true, get: function () { return contract_js_1.BaseContract; } });
|
||||
Object.defineProperty(exports, "Contract", { enumerable: true, get: function () { return contract_js_1.Contract; } });
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/contract/index.ts"],"names":[],"mappings":";;;AACA,6CAEuB;AADnB,2GAAA,YAAY,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAG1B,2CAEsB;AADlB,6GAAA,eAAe,OAAA;AAGnB,6CAGuB;AAFnB,mHAAA,oBAAoB,OAAA;AAAE,yHAAA,0BAA0B,OAAA;AAAE,0HAAA,2BAA2B,OAAA;AAC7E,uGAAA,QAAQ,OAAA"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/contract/index.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,6CAEuB;AADnB,2GAAA,YAAY,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAG1B,2CAEsB;AADlB,6GAAA,eAAe,OAAA;AAGnB,6CAGuB;AAFnB,mHAAA,oBAAoB,OAAA;AAAE,yHAAA,0BAA0B,OAAA;AAAE,0HAAA,2BAA2B,OAAA;AAC7E,uGAAA,QAAQ,OAAA"}
|
@ -1,4 +1,9 @@
|
||||
"use strict";
|
||||
/**
|
||||
* About Crypto?
|
||||
*
|
||||
* @_section: api/crypto:Cryptographic Functions [crypto]
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.lock = exports.Signature = exports.SigningKey = exports.scryptSync = exports.scrypt = exports.pbkdf2 = exports.sha512 = exports.sha256 = exports.ripemd160 = exports.keccak256 = exports.randomBytes = exports.computeHmac = void 0;
|
||||
// We import all these so we can export lock()
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":";;;AAAA,8CAA8C;AAC9C,uCAAwC;AASpC,4FATK,qBAAW,OASL;AARf,2CAAwC;AAYpC,0FAZK,qBAAS,OAYL;AAXb,iDAA2C;AAYvC,0FAZK,wBAAS,OAYL;AAXb,2CAAqC;AAcjC,uFAdK,kBAAM,OAcL;AAbV,2CAA0C;AAOtC,4FAPK,uBAAW,OAOL;AANf,2CAAiD;AAa7C,uFAbK,kBAAM,OAaL;AAAE,2FAbK,sBAAU,OAaL;AAZtB,uCAA2C;AASvC,uFATK,gBAAM,OASL;AAAE,uFATK,gBAAM,OASL;AAMlB,mDAA8C;AAArC,4GAAA,UAAU,OAAA;AACnB,+CAA2C;AAAlC,yGAAA,SAAS,OAAA;AAElB,SAAS,IAAI;IACT,qBAAW,CAAC,IAAI,EAAE,CAAC;IACnB,qBAAS,CAAC,IAAI,EAAE,CAAC;IACjB,kBAAM,CAAC,IAAI,EAAE,CAAC;IACd,uBAAW,CAAC,IAAI,EAAE,CAAC;IACnB,wBAAS,CAAC,IAAI,EAAE,CAAC;IACjB,kBAAM,CAAC,IAAI,EAAE,CAAC;IACd,sBAAU,CAAC,IAAI,EAAE,CAAC;IAClB,gBAAM,CAAC,IAAI,EAAE,CAAC;IACd,gBAAM,CAAC,IAAI,EAAE,CAAC;IACd,uBAAW,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAEQ,oBAAI"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,8CAA8C;AAC9C,uCAAwC;AASpC,4FATK,qBAAW,OASL;AARf,2CAAwC;AAYpC,0FAZK,qBAAS,OAYL;AAXb,iDAA2C;AAYvC,0FAZK,wBAAS,OAYL;AAXb,2CAAqC;AAcjC,uFAdK,kBAAM,OAcL;AAbV,2CAA0C;AAOtC,4FAPK,uBAAW,OAOL;AANf,2CAAiD;AAa7C,uFAbK,kBAAM,OAaL;AAAE,2FAbK,sBAAU,OAaL;AAZtB,uCAA2C;AASvC,uFATK,gBAAM,OASL;AAAE,uFATK,gBAAM,OASL;AAMlB,mDAA8C;AAArC,4GAAA,UAAU,OAAA;AACnB,+CAA2C;AAAlC,yGAAA,SAAS,OAAA;AAElB,SAAS,IAAI;IACT,qBAAW,CAAC,IAAI,EAAE,CAAC;IACnB,qBAAS,CAAC,IAAI,EAAE,CAAC;IACjB,kBAAM,CAAC,IAAI,EAAE,CAAC;IACd,uBAAW,CAAC,IAAI,EAAE,CAAC;IACnB,wBAAS,CAAC,IAAI,EAAE,CAAC;IACjB,kBAAM,CAAC,IAAI,EAAE,CAAC;IACd,sBAAU,CAAC,IAAI,EAAE,CAAC;IAClB,gBAAM,CAAC,IAAI,EAAE,CAAC;IACd,gBAAM,CAAC,IAAI,EAAE,CAAC;IACd,uBAAW,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAEQ,oBAAI"}
|
@ -8,6 +8,11 @@ const _keccak256 = function (data) {
|
||||
return (0, sha3_1.keccak_256)(data);
|
||||
};
|
||||
let __keccak256 = _keccak256;
|
||||
/**
|
||||
* Compute the cryptographic KECCAK256 hash of %%data%%.
|
||||
*
|
||||
* @returns DataHexstring
|
||||
*/
|
||||
function keccak256(_data) {
|
||||
const data = (0, index_js_1.getBytes)(_data, "data");
|
||||
return (0, index_js_1.hexlify)(__keccak256(data));
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"keccak.js","sourceRoot":"","sources":["../../src.ts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WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AAHD,8BAGC;AACD,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC;AACzB,SAAS,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACpD,SAAS,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC/D,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAAE;IAC3D,WAAW,GAAG,IAAI,CAAC;AACvB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC"}
|
@ -8,6 +8,11 @@ const _ripemd160 = function (data) {
|
||||
return (0, ripemd160_1.ripemd160)(data);
|
||||
};
|
||||
let __ripemd160 = _ripemd160;
|
||||
/**
|
||||
* Compute the cryptographic RIPEMD-160 hash of %%data%%.
|
||||
*
|
||||
* @returns DataHexstring
|
||||
*/
|
||||
function ripemd160(_data) {
|
||||
const data = (0, index_js_1.getBytes)(_data, "data");
|
||||
return (0, index_js_1.hexlify)(__ripemd160(data));
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"ripemd160.js","sourceRoot":"","sources":["../../src.ts/crypto/ripemd160.ts"],"names":[],"mappings":";;;AAAA,uDAAuE;AAEvE,gDAAuD;AAKvD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,UAAU,GAAG,UAAS,IAAgB;IACxC,OAAO,IAAA,qBAAe,EAAC,IAAI,CAAC,CAAC;AACjC,CAAC,CAAA;AAED,IAAI,WAAW,GAAoC,UAAU,CAAC;AAE9D,SAAgB,SAAS,CAAC,KAAgB;IACtC,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AAHD,8BAGC;AACD,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC;AACzB,SAAS,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACpD,SAAS,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC/D,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAAE;IAC3D,WAAW,GAAG,IAAI,CAAC;AACvB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC"}
|
||||
{"version":3,"file":"ripemd160.js","sourceRoot":"","sources":["../../src.ts/crypto/ripemd160.ts"],"names":[],"mappings":";;;AAAA,uDAAuE;AAEvE,gDAAuD;AAKvD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,UAAU,GAAG,UAAS,IAAgB;IACxC,OAAO,IAAA,qBAAe,EAAC,IAAI,CAAC,CAAC;AACjC,CAAC,CAAA;AAED,IAAI,WAAW,GAAoC,UAAU,CAAC;AAE9D;;;;GAIG;AACH,SAAgB,SAAS,CAAC,KAAgB;IACtC,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AAHD,8BAGC;AACD,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC;AACzB,SAAS,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACpD,SAAS,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC/D,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAAE;IAC3D,WAAW,GAAG,IAAI,CAAC;AACvB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC"}
|
@ -12,6 +12,11 @@ const _sha512 = function (data) {
|
||||
let __sha256 = _sha256;
|
||||
let __sha512 = _sha512;
|
||||
let locked256 = false, locked512 = false;
|
||||
/**
|
||||
* Compute the cryptographic SHA2-256 hash of %%data%%.
|
||||
*
|
||||
* @returns DataHexstring
|
||||
*/
|
||||
function sha256(_data) {
|
||||
const data = (0, index_js_1.getBytes)(_data, "data");
|
||||
return (0, index_js_1.hexlify)(__sha256(data));
|
||||
@ -26,6 +31,11 @@ sha256.register = function (func) {
|
||||
__sha256 = func;
|
||||
};
|
||||
Object.freeze(sha256);
|
||||
/**
|
||||
* Compute the cryptographic SHA2-512 hash of %%data%%.
|
||||
*
|
||||
* @returns DataHexstring
|
||||
*/
|
||||
function sha512(_data) {
|
||||
const data = (0, index_js_1.getBytes)(_data, "data");
|
||||
return (0, index_js_1.hexlify)(__sha512(data));
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"sha2.js","sourceRoot":"","sources":["../../src.ts/crypto/sha2.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAEzC,gDAAsD;AAKtD,MAAM,OAAO,GAAG,UAAS,IAAgB;IACrC,OAAO,IAAA,sBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AACtD,CAAC,CAAA;AAED,MAAM,OAAO,GAAG,UAAS,IAAgB;IACrC,OAAO,IAAA,sBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AACtD,CAAC,CAAA;AAED,IAAI,QAAQ,GAAoC,OAAO,CAAC;AACxD,IAAI,QAAQ,GAAoC,OAAO,CAAC;AAExD,IAAI,SAAS,GAAG,KAAK,EAAE,SAAS,GAAG,KAAK,CAAC;AAGzC,SAAgB,MAAM,CAAC,KAAgB;IACnC,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CA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AAC,kBAAkB,CAAC,CAAC;KAAE;IACvD,QAAQ,GAAG,IAAI,CAAC;AACpB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"}
|
@ -11,26 +11,60 @@ const BN_27 = BigInt(27);
|
||||
const BN_28 = BigInt(28);
|
||||
const BN_35 = BigInt(35);
|
||||
const _guard = {};
|
||||
/**
|
||||
* A Signature @TODO
|
||||
*/
|
||||
class Signature {
|
||||
#props;
|
||||
get r() { return (0, index_js_2.getStore)(this.#props, "r"); }
|
||||
#r;
|
||||
#s;
|
||||
#v;
|
||||
#networkV;
|
||||
/**
|
||||
* The ``r`` value for a signautre.
|
||||
*
|
||||
* This represents the ``x`` coordinate of a "reference" or
|
||||
* challenge point, from which the ``y`` can be computed.
|
||||
*/
|
||||
get r() { return this.#r; }
|
||||
set r(value) {
|
||||
(0, index_js_2.assertArgument)((0, index_js_2.dataLength)(value) === 32, "invalid r", "value", value);
|
||||
(0, index_js_2.setStore)(this.#props, "r", (0, index_js_2.hexlify)(value));
|
||||
this.#r = (0, index_js_2.hexlify)(value);
|
||||
}
|
||||
get s() { return (0, index_js_2.getStore)(this.#props, "s"); }
|
||||
set s(value) {
|
||||
(0, index_js_2.assertArgument)((0, index_js_2.dataLength)(value) === 32, "invalid r", "value", value);
|
||||
(0, index_js_2.assertArgument)(((0, index_js_2.getBytes)(value)[0] & 0x80) === 0, "non-canonical s", "value", value);
|
||||
(0, index_js_2.setStore)(this.#props, "s", (0, index_js_2.hexlify)(value));
|
||||
/**
|
||||
* The ``s`` value for a signature.
|
||||
*/
|
||||
get s() { return this.#s; }
|
||||
set s(_value) {
|
||||
(0, index_js_2.assertArgument)((0, index_js_2.dataLength)(_value) === 32, "invalid r", "value", _value);
|
||||
const value = (0, index_js_2.hexlify)(_value);
|
||||
(0, index_js_2.assertArgument)(parseInt(value.substring(0, 3)) < 8, "non-canonical s", "value", value);
|
||||
this.#s = value;
|
||||
}
|
||||
get v() { return (0, index_js_2.getStore)(this.#props, "v"); }
|
||||
/**
|
||||
* The ``v`` value for a signature.
|
||||
*
|
||||
* Since a given ``x`` value for ``r`` has two possible values for
|
||||
* its correspondin ``y``, the ``v`` indicates which of the two ``y``
|
||||
* values to use.
|
||||
*
|
||||
* It is normalized to the values ``27`` or ``28`` for legacy
|
||||
* purposes.
|
||||
*/
|
||||
get v() { return this.#v; }
|
||||
set v(value) {
|
||||
const v = (0, index_js_2.getNumber)(value, "value");
|
||||
(0, index_js_2.assertArgument)(v === 27 || v === 28, "invalid v", "v", value);
|
||||
(0, index_js_2.setStore)(this.#props, "v", v);
|
||||
this.#v = v;
|
||||
}
|
||||
get networkV() { return (0, index_js_2.getStore)(this.#props, "networkV"); }
|
||||
/**
|
||||
* The EIP-155 ``v`` for legacy transactions. For non-legacy
|
||||
* transactions, this value is ``null``.
|
||||
*/
|
||||
get networkV() { return this.#networkV; }
|
||||
/**
|
||||
* The chain ID for EIP-155 legacy transactions. For non-legacy
|
||||
* transactions, this value is ``null``.
|
||||
*/
|
||||
get legacyChainId() {
|
||||
const v = this.networkV;
|
||||
if (v == null) {
|
||||
@ -38,9 +72,18 @@ class Signature {
|
||||
}
|
||||
return Signature.getChainId(v);
|
||||
}
|
||||
/**
|
||||
* The ``yParity`` for the signature.
|
||||
*
|
||||
* See ``v`` for more details on how this value is used.
|
||||
*/
|
||||
get yParity() {
|
||||
return (this.v === 27) ? 0 : 1;
|
||||
}
|
||||
/**
|
||||
* The [[link-eip-2098]] compact representation of the ``yParity``
|
||||
* and ``s`` compacted into a single ``bytes32``.
|
||||
*/
|
||||
get yParityAndS() {
|
||||
// The EIP-2098 compact representation
|
||||
const yParityAndS = (0, index_js_2.getBytes)(this.s);
|
||||
@ -49,33 +92,44 @@ class Signature {
|
||||
}
|
||||
return (0, index_js_2.hexlify)(yParityAndS);
|
||||
}
|
||||
/**
|
||||
* The [[link-eip-2098]] compact representation.
|
||||
*/
|
||||
get compactSerialized() {
|
||||
return (0, index_js_2.concat)([this.r, this.yParityAndS]);
|
||||
}
|
||||
/**
|
||||
* The serialized representation.
|
||||
*/
|
||||
get serialized() {
|
||||
return (0, index_js_2.concat)([this.r, this.s, (this.yParity ? "0x1c" : "0x1b")]);
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard, r, s, v) {
|
||||
(0, index_js_2.assertPrivate)(guard, _guard, "Signature");
|
||||
this.#props = { r, s, v, networkV: null };
|
||||
this.#r = r;
|
||||
this.#s = s;
|
||||
this.#v = v;
|
||||
this.#networkV = null;
|
||||
}
|
||||
[Symbol.for('nodejs.util.inspect.custom')]() {
|
||||
return `Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`;
|
||||
}
|
||||
/**
|
||||
* Returns a new identical [[Signature]].
|
||||
*/
|
||||
clone() {
|
||||
const clone = new Signature(_guard, this.r, this.s, this.v);
|
||||
if (this.networkV) {
|
||||
(0, index_js_2.setStore)(clone.#props, "networkV", this.networkV);
|
||||
clone.#networkV = this.networkV;
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
freeze() {
|
||||
Object.freeze(this.#props);
|
||||
return this;
|
||||
}
|
||||
isFrozen() {
|
||||
return Object.isFrozen(this.#props);
|
||||
}
|
||||
/**
|
||||
* Returns a representation that is compatible with ``JSON.stringify``.
|
||||
*/
|
||||
toJSON() {
|
||||
const networkV = this.networkV;
|
||||
return {
|
||||
@ -84,7 +138,9 @@ class Signature {
|
||||
r: this.r, s: this.s, v: this.v,
|
||||
};
|
||||
}
|
||||
// Get the chain ID from an EIP-155 v
|
||||
/**
|
||||
* Compute the chain ID from an EIP-155 ``v`` for legacy transactions.
|
||||
*/
|
||||
static getChainId(v) {
|
||||
const bv = (0, index_js_2.getBigInt)(v, "v");
|
||||
// The v is not an EIP-155 v, so it is the unspecified chain ID
|
||||
@ -95,11 +151,15 @@ class Signature {
|
||||
(0, index_js_2.assertArgument)(bv >= BN_35, "invalid EIP-155 v", "v", v);
|
||||
return (bv - BN_35) / BN_2;
|
||||
}
|
||||
// Get the EIP-155 v transformed for a given chainId
|
||||
/**
|
||||
* Compute the EIP-155 ``v`` for a chain ID for legacy transactions.
|
||||
*/
|
||||
static getChainIdV(chainId, v) {
|
||||
return ((0, index_js_2.getBigInt)(chainId) * BN_2) + BigInt(35 + v - 27);
|
||||
}
|
||||
// Convert an EIP-155 v into a normalized v
|
||||
/**
|
||||
* Compute the normalized EIP-155 ``v`` for legacy transactions.
|
||||
*/
|
||||
static getNormalizedV(v) {
|
||||
const bv = (0, index_js_2.getBigInt)(v);
|
||||
if (bv == BN_0) {
|
||||
@ -111,6 +171,14 @@ class Signature {
|
||||
// Otherwise, EIP-155 v means odd is 27 and even is 28
|
||||
return (bv & BN_1) ? 27 : 28;
|
||||
}
|
||||
/**
|
||||
* Creates a new [[Signature]].
|
||||
*
|
||||
* If no %%sig%% is provided, a new [[Signature]] is created
|
||||
* with default values.
|
||||
*
|
||||
* If %%sig%% is a string, it is parsed.
|
||||
*/
|
||||
static from(sig) {
|
||||
function assertError(check, message) {
|
||||
(0, index_js_2.assertArgument)(check, message, "signature", sig);
|
||||
@ -183,7 +251,7 @@ class Signature {
|
||||
})(sig.v, sig.yParityAndS, sig.yParity);
|
||||
const result = new Signature(_guard, r, s, v);
|
||||
if (networkV) {
|
||||
(0, index_js_2.setStore)(result.#props, "networkV", networkV);
|
||||
result.#networkV = networkV;
|
||||
}
|
||||
// If multiple of v, yParity, yParityAndS we given, check they match
|
||||
assertError(!("yParity" in sig && sig.yParity !== result.yParity), "yParity mismatch");
|
||||
|
File diff suppressed because one or more lines are too long
@ -36,12 +36,7 @@ secp256k1.utils.hmacSha256Sync = function (key, ...messages) {
|
||||
class SigningKey {
|
||||
#privateKey;
|
||||
constructor(privateKey) {
|
||||
/* @TODO
|
||||
logger.assertArgument(() => {
|
||||
if (dataLength(privateKey) !== 32) { throw new Error("bad length"); }
|
||||
return toBigInt(privateKey) < N;
|
||||
}, "invalid private key", "privateKey", "[REDACTED]");
|
||||
*/
|
||||
(0, index_js_1.assertArgument)((0, index_js_1.dataLength)(privateKey) === 32, "invalid private key", "privateKey", "[REDACTED]");
|
||||
this.#privateKey = (0, index_js_1.hexlify)(privateKey);
|
||||
}
|
||||
get privateKey() { return this.#privateKey; }
|
||||
@ -58,7 +53,7 @@ class SigningKey {
|
||||
r: (0, index_js_1.toHex)("0x" + sig.r.toString(16), 32),
|
||||
s: (0, index_js_1.toHex)("0x" + sig.s.toString(16), 32),
|
||||
v: (recid ? 0x1c : 0x1b)
|
||||
}).freeze();
|
||||
});
|
||||
}
|
||||
computeShardSecret(other) {
|
||||
const pubKey = SigningKey.computePublicKey(other);
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"signing-key.js","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4DAA8C;AAE9C,gDAG2B;AAE3B,uCAAwC;AACxC,iDAA2C;AAO3C,yFAAyF;AAEzF,4BAA4B;AAC5B,SAAS,CAAC,KAAK,CAAC,cAAc,GAAG,UAAS,GAAe,EAAE,GAAG,QAA2B;IACrF,OAAO,IAAA,mBAAQ,EAAC,IAAA,qBAAW,EAAC,QAAQ,EAAE,GAAG,EAAE,IAAA,iBAAM,EAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC,CAAA;AAED,MAAa,UAAU;IACnB,WAAW,CAAS;IAEpB,YAAY,UAAqB;QAC7B;;;;;UAKE;QACF,IAAI,CAAC,WAAW,GAAG,IAAA,kBAAO,EAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,UAAU,KAAa,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IACrD,IAAI,SAAS,KAAa,OAAO,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IACjF,IAAI,mBAAmB,KAAa,OAAO,UAAU,CAAC,gBAAgB,CAAC,IA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CAAC,SAAS,CAAC,CAAC;QACtC,MAAM,GAAG,GAAG,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,IAAA,uBAAY,EAAC,IAAA,iBAAM,EAAC,CAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QAEpG,MAAM,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,IAAA,uBAAY,EAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;QAClF,IAAI,MAAM,IAAI,IAAI,EAAE;YAAE,OAAO,IAAA,kBAAO,EAAC,MAAM,CAAC,CAAC;SAAE;QAE/C,IAAA,yBAAc,EAAC,KAAK,EAAE,8BAA8B,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAClF,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,EAAa,EAAE,EAAa,EAAE,UAAoB;QAChE,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACnF,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACnF,OAAO,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;IACpD,CAAC;CACJ;AArED,gCAqEC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCE"}
|
@ -2,17 +2,15 @@
|
||||
/////////////////////////////
|
||||
//
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.scrypt = exports.pbkdf2 = exports.sha512 = exports.sha256 = exports.ripemd160 = exports.keccak256 = exports.randomBytes = exports.computeHmac = exports.EventLog = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.ContractEventPayload = exports.ContractFactory = exports.Contract = exports.BaseContract = exports.MessagePrefix = exports.EtherSymbol = exports.ZeroHash = exports.N = exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.Two = exports.One = exports.Zero = exports.NegativeOne = exports.ZeroAddress = exports.getCreate2Address = exports.getCreateAddress = exports.getIcapAddress = exports.getAddress = exports.Typed = exports.TransactionDescription = exports.Result = exports.LogDescription = exports.Interface = exports.Indexed = exports.checkResultErrors = exports.ParamType = exports.FunctionFragment = exports.Fragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.defaultAbiCoder = exports.AbiCoder = exports.encodeBytes32String = exports.decodeBytes32String = exports.version = void 0;
|
||||
exports.stripZerosLeft = exports.isBytesLike = exports.isHexString = exports.hexlify = exports.getBytesCopy = exports.getBytes = exports.dataSlice = exports.dataLength = exports.concat = exports.encodeBase64 = exports.decodeBase64 = exports.encodeBase58 = exports.decodeBase58 = exports.Transaction = exports.recoverAddress = exports.computeAddress = exports.accessListify = exports.Network = exports.WebSocketProvider = exports.SocketProvider = exports.IpcSocketProvider = exports.InfuraProvider = exports.EtherscanProvider = exports.CloudflareProvider = exports.AnkrProvider = exports.AlchemyProvider = exports.BrowserProvider = exports.JsonRpcSigner = exports.JsonRpcProvider = exports.JsonRpcApiProvider = exports.FallbackProvider = exports.AbstractProvider = exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.FeeData = exports.Block = exports.TypedDataEncoder = exports.solidityPackedSha256 = exports.solidityPackedKeccak256 = exports.solidityPacked = exports.hashMessage = exports.dnsEncode = exports.namehash = exports.isValidName = exports.id = exports.SigningKey = exports.Signature = exports.lock = exports.scryptSync = void 0;
|
||||
exports.Mnemonic = exports.encryptKeystoreJson = exports.decryptKeystoreJson = exports.decryptKeystoreJsonSync = exports.isKeystoreJson = exports.decryptCrowdsaleJson = exports.isCrowdsaleJson = exports.HDNodeWalletManager = exports.HDNodeVoidWallet = exports.HDNodeWallet = exports.getAccountPath = exports.defaultPath = exports.encodeRlp = exports.decodeRlp = exports.Utf8ErrorFuncs = exports.toUtf8String = exports.toUtf8CodePoints = exports.toUtf8Bytes = exports.parseUnits = exports.formatUnits = exports.parseEther = exports.formatEther = exports.mask = exports.toTwos = exports.fromTwos = exports.toQuantity = exports.toNumber = exports.toHex = exports.toBigInt = exports.toArray = exports.getNumber = exports.getBigInt = exports.parseFixed = exports.formatFixed = exports.FixedNumber = exports.FixedFormat = exports.FetchCancelSignal = exports.FetchResponse = exports.FetchRequest = exports.getIpfsGatewayFunc = exports.isError = exports.isCallException = exports.makeError = exports.assertPrivate = exports.assertNormalize = exports.assertArgumentCount = exports.assertArgument = exports.assert = exports.zeroPadValue = exports.zeroPadBytes = void 0;
|
||||
exports.WordlistOwlA = exports.WordlistOwl = exports.wordlists = exports.LangEn = exports.langEn = exports.Wordlist = exports.Wallet = void 0;
|
||||
exports.id = exports.SigningKey = exports.Signature = 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.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.assertArgument = exports.assert = exports.defineProperties = exports.zeroPadValue = exports.zeroPadBytes = exports.stripZerosLeft = exports.isBytesLike = exports.isHexString = exports.hexlify = exports.getBytesCopy = exports.getBytes = exports.dataSlice = exports.dataLength = exports.concat = exports.encodeBase64 = exports.decodeBase64 = exports.encodeBase58 = exports.decodeBase58 = exports.Transaction = exports.recoverAddress = exports.computeAddress = exports.accessListify = exports.Network = exports.WebSocketProvider = exports.SocketProvider = exports.IpcSocketProvider = exports.InfuraProvider = exports.EtherscanProvider = exports.CloudflareProvider = exports.AnkrProvider = exports.AlchemyProvider = exports.BrowserProvider = exports.JsonRpcSigner = exports.JsonRpcProvider = exports.JsonRpcApiProvider = exports.FallbackProvider = exports.AbstractProvider = exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.FeeData = exports.Block = exports.TypedDataEncoder = exports.solidityPackedSha256 = exports.solidityPackedKeccak256 = exports.solidityPacked = exports.hashMessage = exports.dnsEncode = exports.namehash = exports.isValidName = void 0;
|
||||
exports.WordlistOwlA = exports.WordlistOwl = exports.LangEn = exports.Wordlist = exports.encryptKeystoreJsonSync = exports.encryptKeystoreJson = exports.decryptKeystoreJson = exports.decryptKeystoreJsonSync = exports.decryptCrowdsaleJson = exports.isKeystoreJson = exports.isCrowdsaleJson = exports.getAccountPath = exports.defaultPath = exports.Wallet = exports.HDNodeWalletManager = 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.toHex = exports.toBigInt = exports.toArray = exports.getNumber = exports.getBigInt = exports.FixedNumber = exports.FetchCancelSignal = exports.FetchResponse = exports.FetchRequest = exports.isError = exports.isCallException = exports.makeError = exports.assertPrivate = exports.assertNormalize = exports.assertArgumentCount = void 0;
|
||||
var _version_js_1 = require("./_version.js");
|
||||
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return _version_js_1.version; } });
|
||||
var index_js_1 = require("./abi/index.js");
|
||||
Object.defineProperty(exports, "decodeBytes32String", { enumerable: true, get: function () { return index_js_1.decodeBytes32String; } });
|
||||
Object.defineProperty(exports, "encodeBytes32String", { enumerable: true, get: function () { return index_js_1.encodeBytes32String; } });
|
||||
Object.defineProperty(exports, "AbiCoder", { enumerable: true, get: function () { return index_js_1.AbiCoder; } });
|
||||
Object.defineProperty(exports, "defaultAbiCoder", { enumerable: true, get: function () { return index_js_1.defaultAbiCoder; } });
|
||||
Object.defineProperty(exports, "ConstructorFragment", { enumerable: true, get: function () { return index_js_1.ConstructorFragment; } });
|
||||
Object.defineProperty(exports, "ErrorFragment", { enumerable: true, get: function () { return index_js_1.ErrorFragment; } });
|
||||
Object.defineProperty(exports, "EventFragment", { enumerable: true, get: function () { return index_js_1.EventFragment; } });
|
||||
@ -33,10 +31,6 @@ Object.defineProperty(exports, "getCreateAddress", { enumerable: true, get: func
|
||||
Object.defineProperty(exports, "getCreate2Address", { enumerable: true, get: function () { return index_js_2.getCreate2Address; } });
|
||||
var index_js_3 = require("./constants/index.js");
|
||||
Object.defineProperty(exports, "ZeroAddress", { enumerable: true, get: function () { return index_js_3.ZeroAddress; } });
|
||||
Object.defineProperty(exports, "NegativeOne", { enumerable: true, get: function () { return index_js_3.NegativeOne; } });
|
||||
Object.defineProperty(exports, "Zero", { enumerable: true, get: function () { return index_js_3.Zero; } });
|
||||
Object.defineProperty(exports, "One", { enumerable: true, get: function () { return index_js_3.One; } });
|
||||
Object.defineProperty(exports, "Two", { enumerable: true, get: function () { return index_js_3.Two; } });
|
||||
Object.defineProperty(exports, "WeiPerEther", { enumerable: true, get: function () { return index_js_3.WeiPerEther; } });
|
||||
Object.defineProperty(exports, "MaxUint256", { enumerable: true, get: function () { return index_js_3.MaxUint256; } });
|
||||
Object.defineProperty(exports, "MinInt256", { enumerable: true, get: function () { return index_js_3.MinInt256; } });
|
||||
@ -119,6 +113,7 @@ Object.defineProperty(exports, "isBytesLike", { enumerable: true, get: function
|
||||
Object.defineProperty(exports, "stripZerosLeft", { enumerable: true, get: function () { return index_js_9.stripZerosLeft; } });
|
||||
Object.defineProperty(exports, "zeroPadBytes", { enumerable: true, get: function () { return index_js_9.zeroPadBytes; } });
|
||||
Object.defineProperty(exports, "zeroPadValue", { enumerable: true, get: function () { return index_js_9.zeroPadValue; } });
|
||||
Object.defineProperty(exports, "defineProperties", { enumerable: true, get: function () { return index_js_9.defineProperties; } });
|
||||
Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return index_js_9.assert; } });
|
||||
Object.defineProperty(exports, "assertArgument", { enumerable: true, get: function () { return index_js_9.assertArgument; } });
|
||||
Object.defineProperty(exports, "assertArgumentCount", { enumerable: true, get: function () { return index_js_9.assertArgumentCount; } });
|
||||
@ -127,14 +122,10 @@ Object.defineProperty(exports, "assertPrivate", { enumerable: true, get: functio
|
||||
Object.defineProperty(exports, "makeError", { enumerable: true, get: function () { return index_js_9.makeError; } });
|
||||
Object.defineProperty(exports, "isCallException", { enumerable: true, get: function () { return index_js_9.isCallException; } });
|
||||
Object.defineProperty(exports, "isError", { enumerable: true, get: function () { return index_js_9.isError; } });
|
||||
Object.defineProperty(exports, "getIpfsGatewayFunc", { enumerable: true, get: function () { return index_js_9.getIpfsGatewayFunc; } });
|
||||
Object.defineProperty(exports, "FetchRequest", { enumerable: true, get: function () { return index_js_9.FetchRequest; } });
|
||||
Object.defineProperty(exports, "FetchResponse", { enumerable: true, get: function () { return index_js_9.FetchResponse; } });
|
||||
Object.defineProperty(exports, "FetchCancelSignal", { enumerable: true, get: function () { return index_js_9.FetchCancelSignal; } });
|
||||
Object.defineProperty(exports, "FixedFormat", { enumerable: true, get: function () { return index_js_9.FixedFormat; } });
|
||||
Object.defineProperty(exports, "FixedNumber", { enumerable: true, get: function () { return index_js_9.FixedNumber; } });
|
||||
Object.defineProperty(exports, "formatFixed", { enumerable: true, get: function () { return index_js_9.formatFixed; } });
|
||||
Object.defineProperty(exports, "parseFixed", { enumerable: true, get: function () { return index_js_9.parseFixed; } });
|
||||
Object.defineProperty(exports, "getBigInt", { enumerable: true, get: function () { return index_js_9.getBigInt; } });
|
||||
Object.defineProperty(exports, "getNumber", { enumerable: true, get: function () { return index_js_9.getNumber; } });
|
||||
Object.defineProperty(exports, "toArray", { enumerable: true, get: function () { return index_js_9.toArray; } });
|
||||
@ -156,24 +147,24 @@ Object.defineProperty(exports, "Utf8ErrorFuncs", { enumerable: true, get: functi
|
||||
Object.defineProperty(exports, "decodeRlp", { enumerable: true, get: function () { return index_js_9.decodeRlp; } });
|
||||
Object.defineProperty(exports, "encodeRlp", { enumerable: true, get: function () { return index_js_9.encodeRlp; } });
|
||||
var index_js_10 = require("./wallet/index.js");
|
||||
Object.defineProperty(exports, "defaultPath", { enumerable: true, get: function () { return index_js_10.defaultPath; } });
|
||||
Object.defineProperty(exports, "getAccountPath", { enumerable: true, get: function () { return index_js_10.getAccountPath; } });
|
||||
Object.defineProperty(exports, "Mnemonic", { enumerable: true, get: function () { return index_js_10.Mnemonic; } });
|
||||
Object.defineProperty(exports, "BaseWallet", { enumerable: true, get: function () { return index_js_10.BaseWallet; } });
|
||||
Object.defineProperty(exports, "HDNodeWallet", { enumerable: true, get: function () { return index_js_10.HDNodeWallet; } });
|
||||
Object.defineProperty(exports, "HDNodeVoidWallet", { enumerable: true, get: function () { return index_js_10.HDNodeVoidWallet; } });
|
||||
Object.defineProperty(exports, "HDNodeWalletManager", { enumerable: true, get: function () { return index_js_10.HDNodeWalletManager; } });
|
||||
Object.defineProperty(exports, "Wallet", { enumerable: true, get: function () { return index_js_10.Wallet; } });
|
||||
Object.defineProperty(exports, "defaultPath", { enumerable: true, get: function () { return index_js_10.defaultPath; } });
|
||||
Object.defineProperty(exports, "getAccountPath", { enumerable: true, get: function () { return index_js_10.getAccountPath; } });
|
||||
Object.defineProperty(exports, "isCrowdsaleJson", { enumerable: true, get: function () { return index_js_10.isCrowdsaleJson; } });
|
||||
Object.defineProperty(exports, "decryptCrowdsaleJson", { enumerable: true, get: function () { return index_js_10.decryptCrowdsaleJson; } });
|
||||
Object.defineProperty(exports, "isKeystoreJson", { enumerable: true, get: function () { return index_js_10.isKeystoreJson; } });
|
||||
Object.defineProperty(exports, "decryptCrowdsaleJson", { enumerable: true, get: function () { return index_js_10.decryptCrowdsaleJson; } });
|
||||
Object.defineProperty(exports, "decryptKeystoreJsonSync", { enumerable: true, get: function () { return index_js_10.decryptKeystoreJsonSync; } });
|
||||
Object.defineProperty(exports, "decryptKeystoreJson", { enumerable: true, get: function () { return index_js_10.decryptKeystoreJson; } });
|
||||
Object.defineProperty(exports, "encryptKeystoreJson", { enumerable: true, get: function () { return index_js_10.encryptKeystoreJson; } });
|
||||
Object.defineProperty(exports, "Mnemonic", { enumerable: true, get: function () { return index_js_10.Mnemonic; } });
|
||||
Object.defineProperty(exports, "Wallet", { enumerable: true, get: function () { return index_js_10.Wallet; } });
|
||||
Object.defineProperty(exports, "encryptKeystoreJsonSync", { enumerable: true, get: function () { return index_js_10.encryptKeystoreJsonSync; } });
|
||||
var index_js_11 = require("./wordlists/index.js");
|
||||
Object.defineProperty(exports, "Wordlist", { enumerable: true, get: function () { return index_js_11.Wordlist; } });
|
||||
Object.defineProperty(exports, "langEn", { enumerable: true, get: function () { return index_js_11.langEn; } });
|
||||
Object.defineProperty(exports, "LangEn", { enumerable: true, get: function () { return index_js_11.LangEn; } });
|
||||
Object.defineProperty(exports, "wordlists", { enumerable: true, get: function () { return index_js_11.wordlists; } });
|
||||
Object.defineProperty(exports, "WordlistOwl", { enumerable: true, get: function () { return index_js_11.WordlistOwl; } });
|
||||
Object.defineProperty(exports, "WordlistOwlA", { enumerable: true, get: function () { return index_js_11.WordlistOwlA; } });
|
||||
//# sourceMappingURL=ethers.js.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"ethers.js","sourceRoot":"","sources":["../src.ts/ethers.ts"],"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, "__esModule", { value: true });
|
||||
exports.TypedDataEncoder = exports.solidityPackedSha256 = exports.solidityPackedKeccak256 = exports.solidityPacked = exports.hashMessage = exports.dnsEncode = exports.namehash = exports.isValidName = exports.id = void 0;
|
||||
var id_js_1 = require("./id.js");
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/hash/index.ts"],"names":[],"mappings":";;;AACA,iCAA4B;AAAnB,2FAAA,EAAE,OAAA;AACX,6CAAiE;AAAxD,0GAAA,WAAW,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAAE,wGAAA,SAAS,OAAA;AACzC,2CAA2C;AAAlC,yGAAA,WAAW,OAAA;AACpB,6CAEuB;AADnB,6GAAA,cAAc,OAAA;AAAE,sHAAA,uBAAuB,OAAA;AAAE,mHAAA,oBAAoB,OAAA;AAEjE,iDAAmD;AAA1C,iHAAA,gBAAgB,OAAA"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/hash/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,iCAA4B;AAAnB,2FAAA,EAAE,OAAA;AACX,6CAAiE;AAAxD,0GAAA,WAAW,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAAE,wGAAA,SAAS,OAAA;AACzC,2CAA2C;AAAlC,yGAAA,WAAW,OAAA;AACpB,6CAEuB;AADnB,6GAAA,cAAc,OAAA;AAAE,sHAAA,uBAAuB,OAAA;AAAE,mHAAA,oBAAoB,OAAA;AAEjE,iDAAmD;AAA1C,iHAAA,gBAAgB,OAAA"}
|
@ -26,12 +26,15 @@ function _pack(type, value, isArray) {
|
||||
}
|
||||
let match = type.match(regexNumber);
|
||||
if (match) {
|
||||
let signed = (match[1] === "int");
|
||||
let size = parseInt(match[2] || "256");
|
||||
(0, index_js_2.assertArgument)((!match[2] || match[2] === String(size)) && (size % 8 === 0) && size !== 0 && size <= 256, "invalid number type", "type", type);
|
||||
if (isArray) {
|
||||
size = 256;
|
||||
}
|
||||
value = (0, index_js_2.toTwos)(value, size);
|
||||
if (signed) {
|
||||
value = (0, index_js_2.toTwos)(value, size);
|
||||
}
|
||||
return (0, index_js_2.getBytes)((0, index_js_2.zeroPadValue)((0, index_js_2.toArray)(value), size / 8));
|
||||
}
|
||||
match = type.match(regexBytes);
|
||||
@ -74,10 +77,9 @@ exports.solidityPacked = solidityPacked;
|
||||
* @param {Array<string>} types - The Solidity types to interpret each value as [default: bar]
|
||||
* @param {Array<any>} values - The values to pack
|
||||
*
|
||||
* @returns: {HexString} the hexstring of the hash
|
||||
* @example:
|
||||
* solidityPackedKeccak256([ "address", "uint" ], [ "0x1234", 45 ]);
|
||||
* //_result:
|
||||
* / /_result:
|
||||
*
|
||||
* @see https://docs.soliditylang.org/en/v0.8.14/abi-spec.html#non-standard-packed-mode
|
||||
*/
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"solidity.js","sourceRoot":"","sources":["../../src.ts/hash/solidity.ts"],"names":[],"mappings":";;;AAAA,iDAE4B;AAC5B,gDAG2B;AAG3B,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;AACjD,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACpD,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,sBAAsB,CAAC,CAAC;AAGtD,SAAS,KAAK,CAAC,IAAY,EAAE,KAAU,EAAE,OAAiB;IACtD,QAAO,IAAI,EAAE;QACT,KAAK,SAAS;YACV,IAAI,OAAO,EAAE;gBAAE,OAAO,IAAA,mBAAQ,EAAC,IAAA,uBAAY,EAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;aAAE;YAC1D,OAAO,IAAA,mBAAQ,EAAC,KAAK,CAAC,CAAC;QAC3B,KAAK,QAAQ;YACT,OAAO,IAAA,sBAAW,EAAC,KAAK,CAAC,CAAC;QAC9B,KAAK,OAAO;YACR,OAAO,IAAA,mBAAQ,EAAC,KAAK,CA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,OAAO,CAAC,UAAS,KAAK;YACxB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;QACH,OAAO,IAAA,mBAAQ,EAAC,IAAA,iBAAM,EAAC,MAAM,CAAC,CAAC,CAAC;KACnC;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;AACvD,CAAC;AAED,oBAAoB;AAEpB,SAAgB,cAAc,CAAC,KAA4B,EAAE,MAA0B;IACnF,IAAA,yBAAc,EAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,oDAAoD,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAEvH,MAAM,KAAK,GAAsB,EAAE,CAAC;IACpC,KAAK,CAAC,OAAO,CAAC,UAAS,IAAI,EAAE,KAAK;QAC9B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IACH,OAAO,IAAA,kBAAO,EAAC,IAAA,iBAAM,EAAC,KAAK,CAAC,CAAC,CAAC;AAClC,CAAC;AARD,wCAQC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,uBAAuB,CAAC,KAA4B,EAAE,MAA0B;IAC5F,OAAO,IAAA,oBAAU,EAAC,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AACrD,CAAC;AAFD,0DAEC;AAED,SAAgB,oBAAoB,CAAC,KAA4B,EAAE,MAA0B;IACzF,OAAO,IAAA,iBAAO,EAAC,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAClD,CAAC;AAFD,oDAEC"}
|
@ -27,6 +27,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ethers = void 0;
|
||||
/**
|
||||
* The Application Programming Interface (API) is the collection of
|
||||
* functions, classes and types offered by the Ethers library.
|
||||
*
|
||||
* @_section: api:API Specification
|
||||
*/
|
||||
const ethers = __importStar(require("./ethers.js"));
|
||||
exports.ethers = ethers;
|
||||
__exportStar(require("./ethers.js"), exports);
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAAsC;AAE7B,wBAAM;AAEf,8CAA4B"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,oDAAsC;AAE7B,wBAAM;AAEf,8CAA4B"}
|
@ -1,4 +1,11 @@
|
||||
"use strict";
|
||||
/**
|
||||
* About Subclassing the Provider...
|
||||
*
|
||||
* @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider]
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AbstractProvider = exports.UnmanagedSubscriber = void 0;
|
||||
// @TODO
|
||||
// Event coalescence
|
||||
// When we register an event with an async value (e.g. address is a Signer
|
||||
@ -6,8 +13,6 @@
|
||||
// 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
|
||||
// of Signer/ENS name to address so we can sync respond to listenerCount.
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AbstractProvider = exports.UnmanagedSubscriber = void 0;
|
||||
const index_js_1 = require("../address/index.js");
|
||||
const index_js_2 = require("../transaction/index.js");
|
||||
const index_js_3 = require("../utils/index.js");
|
||||
@ -184,8 +189,8 @@ class AbstractProvider {
|
||||
getPlugin(name) {
|
||||
return (this.#plugins.get(name)) || null;
|
||||
}
|
||||
set disableCcipRead(value) { this.#disableCcipRead = !!value; }
|
||||
get disableCcipRead() { return this.#disableCcipRead; }
|
||||
set disableCcipRead(value) { this.#disableCcipRead = !!value; }
|
||||
// Shares multiple identical requests made during the same 250ms
|
||||
async #perform(req) {
|
||||
// Create a tag
|
||||
@ -251,9 +256,6 @@ class AbstractProvider {
|
||||
_wrapBlock(value, network) {
|
||||
return new provider_js_1.Block((0, format_js_1.formatBlock)(value), this);
|
||||
}
|
||||
_wrapBlockWithTransactions(value, network) {
|
||||
return new provider_js_1.Block((0, format_js_1.formatBlock)(value), this);
|
||||
}
|
||||
_wrapLog(value, network) {
|
||||
return new provider_js_1.Log((0, format_js_1.formatLog)(value), this);
|
||||
}
|
||||
@ -628,26 +630,16 @@ class AbstractProvider {
|
||||
});
|
||||
}
|
||||
// Queries
|
||||
async getBlock(block) {
|
||||
async getBlock(block, prefetchTxs) {
|
||||
const { network, params } = await (0, index_js_3.resolveProperties)({
|
||||
network: this.getNetwork(),
|
||||
params: this.#getBlock(block, false)
|
||||
params: this.#getBlock(block, !!prefetchTxs)
|
||||
});
|
||||
if (params == null) {
|
||||
return null;
|
||||
}
|
||||
return this._wrapBlock((0, format_js_1.formatBlock)(params), network);
|
||||
}
|
||||
async getBlockWithTransactions(block) {
|
||||
const { network, params } = await (0, index_js_3.resolveProperties)({
|
||||
network: this.getNetwork(),
|
||||
params: this.#getBlock(block, true)
|
||||
});
|
||||
if (params == null) {
|
||||
return null;
|
||||
}
|
||||
return this._wrapBlockWithTransactions((0, format_js_1.formatBlockWithTransactions)(params), network);
|
||||
}
|
||||
async getTransaction(hash) {
|
||||
const { network, params } = await (0, index_js_3.resolveProperties)({
|
||||
network: this.getNetwork(),
|
||||
@ -793,7 +785,10 @@ class AbstractProvider {
|
||||
}
|
||||
this.#timers.delete(timerId);
|
||||
}
|
||||
_setTimeout(_func, timeout = 0) {
|
||||
_setTimeout(_func, timeout) {
|
||||
if (timeout == null) {
|
||||
timeout = 0;
|
||||
}
|
||||
const timerId = this.#nextTimer++;
|
||||
const func = () => {
|
||||
this.#timers.delete(timerId);
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.WrappedSigner = exports.VoidSigner = exports.AbstractSigner = void 0;
|
||||
/**
|
||||
* About Abstract Signer and subclassing
|
||||
*
|
||||
* @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer]
|
||||
*/
|
||||
const index_js_1 = require("../transaction/index.js");
|
||||
const index_js_2 = require("../utils/index.js");
|
||||
class AbstractSigner {
|
||||
|
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user