admin: updated dist files

This commit is contained in:
Richard Moore 2022-12-09 18:24:58 -05:00
parent 724881f34d
commit 7aaeb090f3
207 changed files with 1666 additions and 403 deletions

View File

@ -11,8 +11,8 @@ describe("Test CCIP execution", function () {
// processed data from the endpoint
const verify = function (sender, data, result) {
const check = (0, index_js_1.concat)([
(0, index_js_1.toArray)((0, index_js_1.dataLength)(sender)), sender,
(0, index_js_1.toArray)((0, index_js_1.dataLength)(data)), data
(0, index_js_1.toBeArray)((0, index_js_1.dataLength)(sender)), sender,
(0, index_js_1.toBeArray)((0, index_js_1.dataLength)(data)), data
]);
assert_1.default.equal(result, (0, index_js_1.keccak256)(check), "response is equal");
};

View File

@ -1 +1 @@
{"version":3,"file":"test-providers-ccip.js","sourceRoot":"","sources":["../../src.ts/_tests/test-providers-ccip.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAKqB;AAErB,6DAA+C;AAE/C,QAAQ,CAAC,qBAAqB,EAAE;IAE5B,sEAAsE;IACtE,mCAAmC;IACnC,MAAM,MAAM,GAAG,UAAS,MAAc,EAAE,IAAY,EAAE,MAAc;QAChE,MAAM,KAAK,GAAG,IAAA,iBAAM,EAAC;YACjB,IAAA,kBAAO,EAAC,IAAA,qBAAU,EAAC,MAAM,CAAC,CAAC,EAAE,MAAM;YACnC,IAAA,kBAAO,EAAC,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC,EAAE,IAAI;SAClC,CAAC,CAAC;QACH,gBAAM,CAAC,KAAK,CAAC,MAAM,EAAE,IAAA,oBAAS,EAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC,CAAC;IAChE,CAAC,CAAA;IAED,MAAM,OAAO,GAAG,4CAA4C,CAAC;IAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC;IAE1B,EAAE,CAAC,uCAAuC,EAAE,KAAK;QAC7C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAEpB,MAAM,QAAQ,GAAG,IAAA,4BAAO,EAAC,QAA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AAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAEpB,MAAM,QAAQ,GAAG,IAAA,4BAAO,EAAC,QAAQ,CAAC,CAAC;QAEnC,6CAA6C;QAC7C,MAAM,EAAE,GAAG;YACP,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI;YACjC,IAAI,EAAE,4MAA4M;SACrN,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,KAAK;QAC9C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAEpB,MAAM,QAAQ,GAAG,IAAA,4BAAO,EAAC,QAAQ,CAAC,CAAC;QAEnC,sCAAsC;QACtC,MAAM,EAAE,GAAG;YACP,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI;YACjC,IAAI,EAAE,4MAA4M;SACrN,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAA"}

View File

@ -43,7 +43,7 @@ describe("Tests Provider Errors", function () {
this.timeout(10000);
const data = (0, index_js_1.concat)([
(0, index_js_1.dataSlice)((0, index_js_1.id)("testPanic(uint256)"), 0, 4),
(0, index_js_1.zeroPadValue)((0, index_js_1.toArray)(code), 32)
(0, index_js_1.zeroPadValue)((0, index_js_1.toBeArray)(code), 32)
]);
const tx = { to: testAddr, data };
try {

File diff suppressed because one or more lines are too long

View File

@ -29,7 +29,7 @@ describe("Sends Transactions", function () {
cleanup.push(() => { provider.destroy(); });
}
it(`tests sending: ${providerName}`, async function () {
this.timeout(60000);
this.timeout(180000);
const w = wallet.connect(provider);
const dustAddr = index_js_1.Wallet.createRandom().address;
// Retry if another CI instance used our value
@ -53,7 +53,7 @@ describe("Sends Transactions", function () {
}
assert_1.default.ok(!!tx, "too many retries");
//const receipt =
await provider.waitForTransaction(tx.hash); //tx.wait();
await provider.waitForTransaction(tx.hash, null, 60000); //tx.wait();
//console.log(receipt);
const balance = await provider.getBalance(dustAddr);
assert_1.default.equal(balance, BigInt(42), "target balance after send");

View File

@ -1 +1 @@
{"version":3,"file":"test-providers-send.js","sourceRoot":"","sources":["../../src.ts/_tests/test-providers-send.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAA8C;AAE9C,6DAAkE;AAIlE,SAAS,KAAK,CAAC,QAAgB;IAC3B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxE,CAAC;AAGD,QAAQ,CAAC,oBAAoB,EAAE;IAE3B,MAAM,OAAO,GAAsB,EAAG,CAAC;IACvC,KAAK,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE;YAAE,IAAI,EAAE,CAAC;SAAE;IAC3C,CAAC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAI,iBAAM,CAAS,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAEnE,MAAM,WAAW,GAAG,QAAQ,CAAC;IAC7B,KAAK,MAAM,YAAY,IAAI,kCAAa,EAAE;QACtC,MAAM,QAAQ,GAAG,IAAA,gCAAW,EAAC,YAAY,EAAE,WAAW,CAAC,CAAC;QACxD,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,SAAS;SAAE;QAEnC,oEAAoE;QACpE,4BAA4B;QAC5B,IAAU,QAAS,CAAC,OAAO,EAAE;YAAE,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,GAAS,QAAS,CAAC,OAAO,EAAE,CA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AAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;gBACzB,IAAI;oBACA,EAAE,GAAG,MAAM,CAAC,CAAC,eAAe,CAAC;wBACzB,EAAE,EAAE,QAAQ;wBACZ,KAAK,EAAE,EAAE;wBACT,IAAI,EAAE,CAAC;qBACV,CAAC,CAAC;oBACH,MAAM;iBACT;gBAAC,OAAO,KAAK,EAAE;oBACZ,IAAI,IAAA,kBAAO,EAAC,KAAK,EAAE,yBAAyB,CAAC,EAAE;wBAC3C,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;wBAClB,SAAS;qBACZ;oBACD,MAAM,KAAK,CAAC;iBACf;aACJ;YACD,gBAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,kBAAkB,CAAC,CAAC;YAEpC,kBAAkB;YAClB,MAAM,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,YAAY;YACrE,uBAAuB;YAEvB,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YACpD,gBAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,2BAA2B,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;KACN;AAGL,CAAC,CAAC,CAAC"}

View File

@ -140,7 +140,7 @@ describe("Tests Bad Math Values", function () {
{
name: "negative value",
value: -4,
error: "cannot toHex negative value"
error: "cannot toBeHex negative value"
},
{
name: "width too short",
@ -150,9 +150,9 @@ describe("Tests Bad Math Values", function () {
},
];
for (const { name, value, error, width } of badHex) {
it(`correctly fails on bad toHex values: ${name}`, function () {
it(`correctly fails on bad toBeHex values: ${name}`, function () {
assert_1.default.throws(() => {
const result = (0, index_js_1.toHex)(value, width);
const result = (0, index_js_1.toBeHex)(value, width);
console.log(result);
}, (e) => {
return ((0, index_js_1.isError)(e, "INVALID_ARGUMENT") &&
@ -160,13 +160,13 @@ describe("Tests Bad Math Values", function () {
});
});
}
it(`correctly fails on nad toArray values: negative value`, function () {
it(`correctly fails on nad toBeArray values: negative value`, function () {
assert_1.default.throws(() => {
const result = (0, index_js_1.toArray)(-4);
const result = (0, index_js_1.toBeArray)(-4);
console.log(result);
}, (e) => {
return ((0, index_js_1.isError)(e, "INVALID_ARGUMENT") &&
e.message.startsWith("cannot toArray negative value"));
e.message.startsWith("cannot toBeArray negative value"));
});
});
});

View File

@ -1 +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,CAAC,EAAG,CAAC;YAC1B,QAAQ,EAAE,KAAK;SAClB;QACD;YACI,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,IAAI,UAAU,CAAC,CAAE,CAAC,CAAE,CAAC;YAC5B,QAAQ,EAAE,KAAK;SAClB;QACD;YACI,IAAI,EAAE,kBAAkB;YACxB,KAAK,EAAE,GAAG;YACV,QAAQ,EAAE,KAAK;SAClB;QACD;YACI,IAAI,EAAE,kBAAkB;YACxB,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,MAAM;SACnB;QACD;YACI,IAAI,EAAE,uBAAuB;YAC7B,KAAK,EAAE,IAAI,UAAU,CAAC,CAA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AE,CAAC;YACR,KAAK,EAAE,qBAAqB;SAC/B;KACJ,CAAC;IAEF,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,MAAM,EAAE;QAChD,EAAE,CAAC,0CAA2C,IAAK,EAAE,EAAE;YACnD,gBAAM,CAAC,MAAM,CAAC,GAAG,EAAE;gBACf,MAAM,MAAM,GAAG,IAAA,kBAAO,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;gBACrC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACxB,CAAC,EAAE,CAAC,CAAM,EAAE,EAAE;gBACV,OAAO,CAAC,IAAA,kBAAO,EAAC,CAAC,EAAE,kBAAkB,CAAC;oBAClC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;KACN;IAED,EAAE,CAAC,yDAAyD,EAAE;QAC1D,gBAAM,CAAC,MAAM,CAAC,GAAG,EAAE;YACf,MAAM,MAAM,GAAG,IAAA,oBAAS,EAAC,CAAC,CAAC,CAAC,CAAC;YAC7B,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,iCAAiC,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}

View File

@ -170,7 +170,7 @@ function checkResultErrors(result) {
}
exports.checkResultErrors = checkResultErrors;
function getValue(value) {
let bytes = (0, index_js_1.toArray)(value);
let bytes = (0, index_js_1.toBeArray)(value);
(0, index_js_1.assert)(bytes.length <= exports.WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: bytes, length: exports.WordSize, offset: bytes.length });
if (bytes.length !== exports.WordSize) {
bytes = (0, index_js_1.getBytesCopy)((0, index_js_1.concat)([Padding.slice(bytes.length % exports.WordSize), bytes]));

File diff suppressed because one or more lines are too long

View File

@ -26,7 +26,7 @@ class AddressCoder extends abstract_coder_js_1.Coder {
return writer.writeValue(value);
}
decode(reader) {
return (0, index_js_1.getAddress)((0, maths_js_1.toHex)(reader.readValue(), 20));
return (0, index_js_1.getAddress)((0, maths_js_1.toBeHex)(reader.readValue(), 20));
}
}
exports.AddressCoder = AddressCoder;

View File

@ -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;;GAEG;AACH,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,EAAE,MAAsB;QACzC,IAAI,KAAK,GAAG,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAChD,IAAI;YACA,KAAK,GAAG,IAAA,qBAAU,EAAC,KAAK,CAAC,CAAC;SAC7B;QAAC,OAAO,KAAU,EAAE;YACjB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SAClD;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAA,qBAAU,EAAC,IAAA,gBAAK,EAAC,MAAM,CAAC,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACrD,CAAC;CACJ;AAvBD,oCAuBC"}
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/address.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AACpD,mDAA+C;AAE/C,0CAAoC;AACpC,2DAA4C;AAK5C;;GAEG;AACH,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,EAAE,MAAsB;QACzC,IAAI,KAAK,GAAG,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAChD,IAAI;YACA,KAAK,GAAG,IAAA,qBAAU,EAAC,KAAK,CAAC,CAAC;SAC7B;QAAC,OAAO,KAAU,EAAE;YACjB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SAClD;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAA,qBAAU,EAAC,IAAA,kBAAO,EAAC,MAAM,CAAC,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;CACJ;AAvBD,oCAuBC"}

View File

@ -689,7 +689,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string {
value = (value ? "0x01" : "0x00");
}
if (param.type.match(/^u?int/)) {
value = (0, index_js_3.toHex)(value);
value = (0, index_js_3.toBeHex)(value);
}
// Check addresses are valid
if (param.type === "address") {

File diff suppressed because one or more lines are too long

View File

@ -91,6 +91,20 @@ function fromBase36(value) {
* that you wish to bypass the safegaurds in place to protect
* against an address that has been incorrectly copied from another
* source.
*
* @example:
* // Adds the checksum (via upper-casing specific letters)
* getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72")
* //_result:
*
* // Converts ICAP address and adds checksum
* getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36");
* //_result:
*
* // Throws an error if an address contains mixed case,
* // but the checksum fails
* getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72")
* //_error:
*/
function getAddress(address) {
(0, index_js_2.assertArgument)(typeof (address) === "string", "invalid address", "address", address);
@ -123,6 +137,17 @@ exports.getAddress = getAddress;
* industry [IBAN format](link-wiki-iban] for bank accounts.
*
* It is no longer common or a recommended format.
*
* @example:
* getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72");
* //_result:
*
* getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36");
* //_result:
*
* // Throws an error if the ICAP checksum is wrong
* getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37");
* //_error:
*/
function getIcapAddress(address) {
//let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase();

View File

@ -1 +1 @@
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src.ts/address/address.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,gDAA6D;AAG7D,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAEzB,SAAS,kBAAkB,CAAC,OAAe;IAC3C,sCAAsC;IACtC,2EAA2E;IAC3E,OAAO;IAEH,OAAO,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAEhC,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAE7C,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;QACzB,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CA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;KACjB;IAED,4CAA4C;IAC5C,IAAI,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,EAAE;QACjD,4CAA4C;QAC5C,IAAA,yBAAc,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAE3G,IAAI,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC3D,OAAO,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE;YAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;SAAE;QACrD,OAAQ,kBAAkB,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;KAC7C;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AACjE,CAAC;AA7BD,gCA6BC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,cAAc,CAAC,OAAe;IAC1C,2EAA2E;IAC3E,IAAI,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACpE,OAAO,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE;QAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;KAAE;IACrD,OAAO,IAAI,GAAG,YAAY,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;AACzD,CAAC;AALD,wCAKC"}

View File

@ -6,6 +6,16 @@ const address_js_1 = require("./address.js");
/**
* Returns true if %%value%% is an object which implements the
* [[Addressable]] interface.
*
* @example:
* // Wallets and AbstractSigner sub-classes
* isAddressable(Wallet.createRandom())
* //_result:
*
* // Contracts
* contract = new Contract("dai.tokens.ethers.eth", [ ], provider)
* isAddressable(contract)
* //_result:
*/
function isAddressable(value) {
return (value && typeof (value.getAddress) === "function");
@ -13,6 +23,28 @@ function isAddressable(value) {
exports.isAddressable = isAddressable;
/**
* Returns true if %%value%% is a valid address.
*
* @example:
* // Valid address
* isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72")
* //_result:
*
* // Valid ICAP address
* isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36")
* //_result:
*
* // Invalid checksum
* isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72")
* //_result:
*
* // Invalid ICAP checksum
* isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72")
* //_result:
*
* // Not an address (an ENS name requires a provided and an
* // asynchronous API to access)
* isAddress("ricmoo.eth")
* //_result:
*/
function isAddress(value) {
try {
@ -38,6 +70,35 @@ async function checkAddress(target, promise) {
*
* If an ENS name is provided, but that name has not been correctly
* configured a [[UnconfiguredNameError]] is thrown.
*
* @example:
* addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F"
*
* // Addresses are return synchronously
* resolveAddress(addr, provider)
* //_result:
*
* // Address promises are resolved asynchronously
* resolveAddress(Promise.resolve(addr))
* //_result:
*
* // ENS names are resolved asynchronously
* resolveAddress("dai.tokens.ethers.eth", provider)
* //_result:
*
* // Addressable objects are resolved asynchronously
* contract = new Contract(addr, [ ])
* resolveAddress(contract, provider)
* //_result:
*
* // Unconfigured ENS names reject
* resolveAddress("nothing-here.ricmoo.eth", provider)
* //_error:
*
* // ENS names require a NameResolver object passed in
* // (notice the provider was omitted)
* resolveAddress("nothing-here.ricmoo.eth")
* //_error:
*/
function resolveAddress(target, resolver) {
if (typeof (target) === "string") {

View File

@ -1 +1 @@
{"version":3,"file":"checks.js","sourceRoot":"","sources":["../../src.ts/address/checks.ts"],"names":[],"mappings":";;;AAAA,gDAA2D;AAE3D,6CAA0C;AAK1C;;;GAGG;AACH,SAAgB,aAAa,CAAC,KAAU;IACpC,OAAO,CAAC,KAAK,IAAI,OAA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AAM,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,SAAgB,cAAc,CAAC,MAAmB,EAAE,QAA8B;IAE9E,IAAI,OAAM,CAAC,MAAM,CAAC,KAAK,QAAQ,EAAE;QAC7B,IAAI,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE;YAAE,OAAO,IAAA,uBAAU,EAAC,MAAM,CAAC,CAAC;SAAE;QAErE,IAAA,iBAAM,EAAC,QAAQ,IAAI,IAAI,EAAE,oCAAoC,EACzD,uBAAuB,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;QAE3D,OAAO,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;KAE7D;SAAM,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;QAC9B,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;KAEpD;SAAM,IAAI,OAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE;QAC3C,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACvC;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,+BAA+B,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC7E,CAAC;AAlBD,wCAkBC"}

View File

@ -15,6 +15,13 @@ const address_js_1 = require("./address.js");
* 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.
*
* @example
* from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72";
* nonce = 5;
*
* getCreateAddress({ from, nonce });
* //_result:
*/
function getCreateAddress(tx) {
const from = (0, address_js_1.getAddress)(tx.from);
@ -38,6 +45,22 @@ exports.getCreateAddress = getCreateAddress;
*
* To compute the %%initCodeHash%% from a contract's init code, use
* the [[keccak256]] function.
*
* For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]].
*
* @example
* // The address of the contract
* from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"
*
* // The salt
* salt = id("HelloWorld")
*
* // The hash of the initCode
* initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3";
* initCodeHash = keccak256(initCode)
*
* getCreate2Address(from, salt, initCodeHash)
* //_result:
*/
function getCreate2Address(_from, _salt, _initCodeHash) {
const from = (0, address_js_1.getAddress)(_from);

View File

@ -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;AAEtG;;;;;;;;;;GAUG;AACH,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,EAAE,QAAQ,CAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/E,CAAC;AAdD,4CAcC;AAED;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAAC,KAAa,EAAE,KAAgB,EAAE,aAAwB;IACvF,MAAM,IA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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,EAAE,QAAQ,CAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/E,CAAC;AAdD,4CAcC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,iBAAiB,CAAC,KAAa,EAAE,KAAgB,EAAE,aAAwB;IACvF,MAAM,IAAI,GAAG,IAAA,uBAAU,EAAC,KAAK,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,IAAA,mBAAQ,EAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IAE7D,IAAA,yBAAc,EAAC,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE,uBAAuB,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAE3E,IAAA,yBAAc,EAAC,YAAY,CAAC,MAAM,KAAK,EAAE,EAAE,+BAA+B,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;IAE3G,OAAO,IAAA,uBAAU,EAAC,IAAA,oBAAS,EAAC,IAAA,oBAAS,EAAC,IAAA,iBAAM,EAAC,CAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,CAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AAC7F,CAAC;AAVD,8CAUC"}

View File

@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.ZeroAddress = void 0;
/**
* A constant for the zero address.
*
* (**i.e.** ``"0x0000000000000000000000000000000000000000"``)
*/
exports.ZeroAddress = "0x0000000000000000000000000000000000000000";
//# sourceMappingURL=addresses.js.map

View File

@ -1 +1 @@
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../src.ts/constants/addresses.ts"],"names":[],"mappings":";;;AACA;;GAEG;AACU,QAAA,WAAW,GAAW,4CAA4C,CAAC"}
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../src.ts/constants/addresses.ts"],"names":[],"mappings":";;;AACA;;;;GAIG;AACU,QAAA,WAAW,GAAW,4CAA4C,CAAC"}

View File

@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.ZeroHash = void 0;
/**
* A constant for the zero hash.
*
* (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``)
*/
exports.ZeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000";
//# sourceMappingURL=hashes.js.map

View File

@ -1 +1 @@
{"version":3,"file":"hashes.js","sourceRoot":"","sources":["../../src.ts/constants/hashes.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,QAAQ,GAAW,oEAAoE,CAAC"}
{"version":3,"file":"hashes.js","sourceRoot":"","sources":["../../src.ts/constants/hashes.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,QAAQ,GAAW,oEAAoE,CAAC"}

View File

@ -3,22 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.N = void 0;
/**
* A constant for the order N for the secp256k1 curve.
*
* (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``)
*/
exports.N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
/**
* A constant for the number of wei in a single ether.
*
* (**i.e.** ``1000000000000000000n``)
*/
exports.WeiPerEther = BigInt("1000000000000000000");
/**
* A constant for the maximum value for a ``uint256``.
*
* (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)
*/
exports.MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
/**
* A constant for the minimum value for an ``int256``.
*
* (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``)
*/
exports.MinInt256 = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * BigInt(-1);
/**
* A constant for the maximum value for an ``int256``.
*
* (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)
*/
exports.MaxInt256 = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
//# sourceMappingURL=numbers.js.map

View File

@ -1 +1 @@
{"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"}
{"version":3,"file":"numbers.js","sourceRoot":"","sources":["../../src.ts/constants/numbers.ts"],"names":[],"mappings":";;;AACA;;;;GAIG;AACU,QAAA,CAAC,GAAW,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAEtG;;;;GAIG;AACU,QAAA,WAAW,GAAW,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAEjE;;;;GAIG;AACU,QAAA,UAAU,GAAW,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAE/G;;;;GAIG;AACU,QAAA,SAAS,GAAW,MAAM,CAAC,oEAAoE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3H;;;;GAIG;AACU,QAAA,SAAS,GAAW,MAAM,CAAC,oEAAoE,CAAC,CAAC"}

View File

@ -4,7 +4,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.MessagePrefix = exports.EtherSymbol = void 0;
/**
* A constant for the ether symbol (normalized using NFKC).
*
* (**i.e.** ``"\\u039e"``)
*/
exports.EtherSymbol = "\u039e"; // "\uD835\uDF63";
/**
* A constant for the [[link-eip-191]] personal message prefix.
*
* (**i.e.** ``"\\x19Ethereum Signed Message:\\n"``)
*/
exports.MessagePrefix = "\x19Ethereum Signed Message:\n";
//# sourceMappingURL=strings.js.map

View File

@ -1 +1 @@
{"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"}
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../src.ts/constants/strings.ts"],"names":[],"mappings":";AAAA,8CAA8C;;;AAE9C;;;;GAIG;AACU,QAAA,WAAW,GAAW,QAAQ,CAAC,CAAE,kBAAkB;AAGhE;;;;GAIG;AACU,QAAA,aAAa,GAAW,gCAAgC,CAAC"}

View File

@ -19,6 +19,19 @@ let __computeHmac = _computeHmac;
/**
* Return the HMAC for %%data%% using the %%key%% key with the underlying
* %%algo%% used for compression.
*
* @example:
* key = id("some-secret")
*
* // Compute the HMAC
* computeHmac("sha256", key, "0x1337")
* //_result:
*
* // To compute the HMAC of UTF-8 data, the data must be
* // converted to UTF-8 bytes
* computeHmac("sha256", key, toUtf8Bytes("Hello World"))
* //_result:
*
*/
function computeHmac(algorithm, _key, _data) {
const key = (0, index_js_1.getBytes)(_key, "key");

View File

@ -1 +1 @@
{"version":3,"file":"hmac.js","sourceRoot":"","sources":["../../src.ts/crypto/hmac.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,2CAAyC;AACzC,gDAAsD;AAKtD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,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5D,CAAC,CAAA;AAED,IAAI,aAAa,GAAG,YAAY,CAAC;AAEjC;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,WAAW,CAAC,SAA8B,EAAE,IAAe,EAAE,KAAgB;IACzF,MAAM,GAAG,GAAG,IAAA,mBAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,aAAa,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AACxD,CAAC;AAJD,kCAIC;AACD,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC;AAC7B,WAAW,CAAC,IAAI,GAAI,cAAa,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACjD,WAAW,CAAC,QAAQ,GAAG,UAAS,IAAsF;IAClH,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAAE;IACzD,aAAa,GAAG,IAAI,CAAC;AACzB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"}

View File

@ -16,7 +16,20 @@ let __keccak256 = _keccak256;
/**
* Compute the cryptographic KECCAK256 hash of %%data%%.
*
* The %%data%% **must** be a data representation, to compute the
* hash of UTF-8 data use the [[id]] function.
*
* @returns DataHexstring
* @example:
* keccak256("0x")
* //_result:
*
* keccak256("0x1337")
* //_result:
*
* keccak256(new Uint8Array([ 0x13, 0x37 ]))
* //_result:
*
*/
function keccak256(_data) {
const data = (0, index_js_1.getBytes)(_data, "data");

View File

@ -1 +1 @@
{"version":3,"file":"keccak.js","sourceRoot":"","sources":["../../src.ts/crypto/keccak.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,6CAAgD;AAEhD,gDAAsD;AAKtD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,UAAU,GAA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AC,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"}

View File

@ -21,6 +21,19 @@ let __pbkdf2 = _pbkdf2;
*
* This PBKDF is outdated and should not be used in new projects, but is
* required to decrypt older files.
*
* @example:
* // The password must be converted to bytes, and it is generally
* // best practices to ensure the string has been normalized. Many
* // formats explicitly indicate the normalization form to use.
* password = "hello"
* passwordBytes = toUtf8Bytes(password, "NFKC")
*
* salt = id("some-salt")
*
* // Compute the PBKDF2
* pbkdf2(passwordBytes, salt, 1024, 16, "sha256")
* //_result:
*/
function pbkdf2(_password, _salt, iterations, keylen, algo) {
const password = (0, index_js_1.getBytes)(_password, "password");

View File

@ -1 +1 @@
{"version":3,"file":"pbkdf2.js","sourceRoot":"","sources":["../../src.ts/crypto/pbkdf2.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,2CAAyC;AAEzC,gDAAsD;AAKtD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,OAAO,GAAG,UAAS,QAAoB,EAAE,IAAgB,EAAE,UAAkB,EAAE,MAAc,EAAE,IAAyB;IAC1H,OAAO,IAAA,sBAAU,EAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC,CAAA;AAED,IAAI,QAAQ,GAAG,OAAO,CAAC;AAEvB;;;;;;GAMG;AACH,SAAgB,MAAM,CAAC,SAAoB,EAAE,KAAgB,EAAE,UAAkB,EAAE,MAAc,EAAE,IAAyB;IACxH,MAAM,QAAQ,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AAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACvE,CAAC;AAJD,wBAIC;AACD,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC;AACnB,MAAM,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACjD,MAAM,CAAC,QAAQ,GAAG,UAAS,IAA0H;IACjJ,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;KAAE;IACpD,QAAQ,GAAG,IAAI,CAAC;AACpB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"}

View File

@ -17,6 +17,10 @@ const _randomBytes = function (length) {
let __randomBytes = _randomBytes;
/**
* Return %%length%% bytes of cryptographically secure random data.
*
* @example:
* randomBytes(8)
* //_result:
*/
function randomBytes(length) {
return __randomBytes(length);

View File

@ -1 +1 @@
{"version":3,"file":"random.js","sourceRoot":"","sources":["../../src.ts/crypto/random.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,2CAA2D;AAE3D,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,YAAY,GAAG,UAAS,MAAc;IACxC,OAAO,IAAI,UAAU,CAAC,IAAA,uBAAa,EAAC,MAAM,CAAC,CAAC,CAAC;AACjD,CAAC,CAAA;AAED,IAAI,aAAa,GAAG,YAAY,CAAC;AAEjC;;GAEG;AACH,SAAgB,WAAW,CAAC,MAAc;IACtC,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAFD,kCAEC;AAED,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC;AAC7B,WAAW,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACtD,WAAW,CAAC,QAAQ,GAAG,UAAS,IAAoC;IAChE,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAAE;IACzD,aAAa,GAAG,IAAI,CAAC;AACzB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"}
{"version":3,"file":"random.js","sourceRoot":"","sources":["../../src.ts/crypto/random.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,2CAA2D;AAE3D,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,YAAY,GAAG,UAAS,MAAc;IACxC,OAAO,IAAI,UAAU,CAAC,IAAA,uBAAa,EAAC,MAAM,CAAC,CAAC,CAAC;AACjD,CAAC,CAAA;AAED,IAAI,aAAa,GAAG,YAAY,CAAC;AAEjC;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,MAAc;IACtC,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAFD,kCAEC;AAED,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC;AAC7B,WAAW,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACtD,WAAW,CAAC,QAAQ,GAAG,UAAS,IAAoC;IAChE,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAAE;IACzD,aAAa,GAAG,IAAI,CAAC;AACzB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"}

View File

@ -13,6 +13,17 @@ let __ripemd160 = _ripemd160;
*
* @_docloc: api/crypto:Hash Functions
* @returns DataHexstring
*
* @example:
* ripemd160("0x")
* //_result:
*
* ripemd160("0x1337")
* //_result:
*
* ripemd160(new Uint8Array([ 0x13, 0x37 ]))
* //_result:
*
*/
function ripemd160(_data) {
const data = (0, index_js_1.getBytes)(_data, "data");

View File

@ -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;;;;;GAKG;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"}
{"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;;;;;;;;;;;;;;;;GAgBG;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"}

View File

@ -35,6 +35,19 @@ let __scryptSync = _scryptSync;
* can also help, assuring the user their waiting is for a good reason.
*
* @_docloc: api/crypto:Passwords
*
* @example:
* // The password must be converted to bytes, and it is generally
* // best practices to ensure the string has been normalized. Many
* // formats explicitly indicate the normalization form to use.
* password = "hello"
* passwordBytes = toUtf8Bytes(password, "NFKC")
*
* salt = id("some-salt")
*
* // Compute the scrypt
* scrypt(passwordBytes, salt, 1024, 8, 1, 16)
* //_result:
*/
async function scrypt(_passwd, _salt, N, r, p, dkLen, progress) {
const passwd = (0, index_js_1.getBytes)(_passwd, "passwd");
@ -59,6 +72,19 @@ Object.freeze(scrypt);
* preferred to use the [async variant](scrypt).
*
* @_docloc: api/crypto:Passwords
*
* @example:
* // The password must be converted to bytes, and it is generally
* // best practices to ensure the string has been normalized. Many
* // formats explicitly indicate the normalization form to use.
* password = "hello"
* passwordBytes = toUtf8Bytes(password, "NFKC")
*
* salt = id("some-salt")
*
* // Compute the scrypt
* scryptSync(passwordBytes, salt, 1024, 8, 1, 16)
* //_result:
*/
function scryptSync(_passwd, _salt, N, r, p, dkLen) {
const passwd = (0, index_js_1.getBytes)(_passwd, "passwd");

View File

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IAAI,CAAC,CAAC,CAAC,CAAA;AACtD,MAAM,CAAC,QAAQ,GAAG,UAAS,IAA+I;IACtK,IAAI,WAAW,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;KAAE;IACzD,aAAa,GAAG,IAAI,CAAC;AACzB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAEtB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,UAAU,CAAC,OAAkB,EAAE,KAAgB,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,KAAa;IAC3G,MAAM,MAAM,GAAG,IAAA,mBAAQ,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAC,EAAC,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AACzD,CAAC;AAJD,gCAIC;AACD,UAAU,CAAC,CAAC,GAAG,WAAW,CAAC;AAC3B,UAAU,CAAC,IAAI,GAAG,cAAmB,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACzD,UAAU,CAAC,QAAQ,GAAG,UAAS,IAAyG;IACpI,IAAI,UAAU,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;KAAE;IAC5D,YAAY,GAAG,IAAI,CAAC;AACxB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC"}

View File

@ -17,6 +17,17 @@ let locked256 = false, locked512 = false;
*
* @_docloc: api/crypto:Hash Functions
* @returns DataHexstring
*
* @example:
* sha256("0x")
* //_result:
*
* sha256("0x1337")
* //_result:
*
* sha256(new Uint8Array([ 0x13, 0x37 ]))
* //_result:
*
*/
function sha256(_data) {
const data = (0, index_js_1.getBytes)(_data, "data");
@ -37,6 +48,16 @@ Object.freeze(sha256);
*
* @_docloc: api/crypto:Hash Functions
* @returns DataHexstring
*
* @example:
* sha512("0x")
* //_result:
*
* sha512("0x1337")
* //_result:
*
* sha512(new Uint8Array([ 0x13, 0x37 ]))
* //_result:
*/
function sha512(_data) {
const data = (0, index_js_1.getBytes)(_data, "data");

View File

@ -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;;;;;GAKG;AACH,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,CAAC;AACnC,CAAC;AAHD,wBAGC;AACD,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC;AACnB,MAAM,CAAC,IAAI,GAAG,cAAmB,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACpD,MAAM,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC5D,IAAI,SAAS,EAAE;QAAE,MAAM,IAAI,KAAK,CAA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ute the chain ID from the ``v`` in a legacy EIP-155 transactions.
*
* @example:
* Signature.getChainId(45)
* //_result:
*
* Signature.getChainId(46)
* //_result:
*/
static getChainId(v) {
const bv = (0, index_js_2.getBigInt)(v, "v");
@ -152,22 +159,52 @@ class Signature {
return (bv - BN_35) / BN_2;
}
/**
* Compute the EIP-155 ``v`` for a chain ID for legacy transactions.
* Compute the ``v`` for a chain ID for a legacy EIP-155 transactions.
*
* Legacy transactions which use [[link-eip-155]] hijack the ``v``
* property to include the chain ID.
*
* @example:
* Signature.getChainIdV(5, 27)
* //_result:
*
* Signature.getChainIdV(5, 28)
* //_result:
*
*/
static getChainIdV(chainId, v) {
return ((0, index_js_2.getBigInt)(chainId) * BN_2) + BigInt(35 + v - 27);
}
/**
* Compute the normalized EIP-155 ``v`` for legacy transactions.
* Compute the normalized legacy transaction ``v`` from a ``yParirty``,
* a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction.
*
* @example:
* // The values 0 and 1 imply v is actually yParity
* Signature.getNormalizedV(0)
* //_result:
*
* // Legacy non-EIP-1559 transaction (i.e. 27 or 28)
* Signature.getNormalizedV(27)
* //_result:
*
* // Legacy EIP-155 transaction (i.e. >= 35)
* Signature.getNormalizedV(46)
* //_result:
*
* // Invalid values throw
* Signature.getNormalizedV(5)
* //_error:
*/
static getNormalizedV(v) {
const bv = (0, index_js_2.getBigInt)(v);
if (bv == BN_0) {
if (bv === BN_0 || bv === BN_27) {
return 27;
}
if (bv == BN_1) {
if (bv === BN_1 || bv === BN_28) {
return 28;
}
(0, index_js_2.assertArgument)(bv >= BN_35, "invalid v", "v", v);
// Otherwise, EIP-155 v means odd is 27 and even is 28
return (bv & BN_1) ? 27 : 28;
}

File diff suppressed because one or more lines are too long

View File

@ -76,8 +76,8 @@ class SigningKey {
});
const sig = secp256k1.Signature.fromHex(sigDer);
return signature_js_1.Signature.from({
r: (0, index_js_1.toHex)("0x" + sig.r.toString(16), 32),
s: (0, index_js_1.toHex)("0x" + sig.s.toString(16), 32),
r: (0, index_js_1.toBeHex)("0x" + sig.r.toString(16), 32),
s: (0, index_js_1.toBeHex)("0x" + sig.s.toString(16), 32),
v: (recid ? 0x1c : 0x1b)
});
}
@ -90,16 +90,48 @@ class SigningKey {
*
* Best practice is usually to use a cryptographic hash on the
* returned value before using it as a symetric secret.
*
* @example:
* sign1 = new SigningKey(id("some-secret-1"))
* sign2 = new SigningKey(id("some-secret-2"))
*
* // Notice that privA.computeSharedSecret(pubB)...
* sign1.computeSharedSecret(sign2.publicKey)
* //_result:
*
* // ...is equal to privB.computeSharedSecret(pubA).
* sign2.computeSharedSecret(sign1.publicKey)
* //_result:
*/
computeShardSecret(other) {
computeSharedSecret(other) {
const pubKey = SigningKey.computePublicKey(other);
return (0, index_js_1.hexlify)(secp256k1.getSharedSecret((0, index_js_1.getBytesCopy)(this.#privateKey), pubKey));
console.log(pubKey);
return (0, index_js_1.hexlify)(secp256k1.getSharedSecret((0, index_js_1.getBytesCopy)(this.#privateKey), (0, index_js_1.getBytes)(pubKey)));
}
/**
* Compute the public key for %%key%%, optionally %%compressed%%.
*
* The %%key%% may be any type of key, a raw public key, a
* compressed/uncompressed public key or private key.
*
* @example:
* sign = new SigningKey(id("some-secret"));
*
* // Compute the uncompressed public key for a private key
* SigningKey.computePublicKey(sign.privateKey)
* //_result:
*
* // Compute the compressed public key for a private key
* SigningKey.computePublicKey(sign.privateKey, true)
* //_result:
*
* // Compute the uncompressed public key
* SigningKey.computePublicKey(sign.publicKey, false);
* //_result:
*
* // Compute the Compressed a public key
* SigningKey.computePublicKey(sign.publicKey, true);
* //_result:
*/
static computePublicKey(key, compressed) {
let bytes = (0, index_js_1.getBytes)(key, "key");
@ -119,6 +151,20 @@ class SigningKey {
/**
* Returns the public key for the private key which produced the
* %%signature%% for the given %%digest%%.
*
* @example:
* key = new SigningKey(id("some-secret"))
* digest = id("hello world")
* sig = key.sign(digest)
*
* // Notice the signer public key...
* key.publicKey
* //_result:
*
* // ...is equal to the recovered public key
* SigningKey.recoverPublicKey(digest, sig)
* //_result:
*
*/
static recoverPublicKey(digest, signature) {
(0, index_js_1.assertArgument)((0, index_js_1.dataLength)(digest) === 32, "invalid digest length", "digest", digest);
@ -147,37 +193,4 @@ class SigningKey {
}
}
exports.SigningKey = SigningKey;
/*
const key = new SigningKey("0x1234567890123456789012345678901234567890123456789012345678901234");
console.log(key);
console.log(key.sign("0x1234567890123456789012345678901234567890123456789012345678901234"));
{
const privKey = "0x1234567812345678123456781234567812345678123456781234567812345678";
const signingKey = new SigningKey(privKey);
console.log("0", signingKey, signingKey.publicKey, signingKey.publicKeyCompressed);
let pubKey = SigningKey.computePublicKey(privKey);
let pubKeyComp = SigningKey.computePublicKey(privKey, true);
let pubKeyRaw = "0x" + SigningKey.computePublicKey(privKey).substring(4);
console.log("A", pubKey, pubKeyComp);
let a = SigningKey.computePublicKey(pubKey);
let b = SigningKey.computePublicKey(pubKey, true);
console.log("B", a, b);
a = SigningKey.computePublicKey(pubKeyComp);
b = SigningKey.computePublicKey(pubKeyComp, true);
console.log("C", a, b);
a = SigningKey.computePublicKey(pubKeyRaw);
b = SigningKey.computePublicKey(pubKeyRaw, true);
console.log("D", a, b);
const digest = "0x1122334411223344112233441122334411223344112233441122334411223344";
const sig = signingKey.sign(digest);
console.log("SS", sig, sig.r, sig.s, sig.yParity);
console.log("R", SigningKey.recoverPublicKey(digest, sig));
}
*/
//# sourceMappingURL=signing-key.js.map

View File

@ -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,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AY,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;;;;;;;;;OASG;IACH,MAAM,CAAC,SAAS,CAAC,EAAa,EAAE,EAAa,EAAE,UAAoB;QAC/D,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;AAzKD,gCAyKC"}

View File

@ -2,10 +2,10 @@
/////////////////////////////
//
Object.defineProperty(exports, "__esModule", { value: true });
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.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.EnsResolver = exports.WebSocketProvider = exports.SocketProvider = exports.IpcSocketProvider = exports.QuickNodeProvider = exports.InfuraProvider = exports.EtherscanProvider = exports.CloudflareProvider = exports.AnkrProvider = exports.AlchemyProvider = exports.BrowserProvider = exports.JsonRpcSigner = exports.JsonRpcProvider = exports.JsonRpcApiProvider = exports.FallbackProvider = exports.AbstractProvider = exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.FeeData = exports.Block = exports.getDefaultProvider = exports.TypedDataEncoder = exports.solidityPackedSha256 = exports.solidityPackedKeccak256 = exports.solidityPacked = exports.hashMessage = exports.dnsEncode = exports.namehash = exports.isValidName = void 0;
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.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 = exports.assertArgument = exports.assert = exports.defineProperties = void 0;
exports.WordlistOwlA = void 0;
exports.lock = exports.scryptSync = exports.scrypt = exports.pbkdf2 = exports.sha512 = exports.sha256 = exports.ripemd160 = exports.keccak256 = exports.randomBytes = exports.computeHmac = exports.EventLog = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.ContractEventPayload = exports.ContractFactory = exports.Contract = exports.BaseContract = exports.MessagePrefix = exports.EtherSymbol = exports.ZeroHash = exports.N = exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.ZeroAddress = exports.resolveAddress = exports.isAddress = exports.isAddressable = exports.getCreate2Address = exports.getCreateAddress = exports.getIcapAddress = exports.getAddress = exports.Typed = exports.TransactionDescription = exports.Result = exports.LogDescription = exports.Interface = exports.Indexed = exports.checkResultErrors = exports.ParamType = exports.FunctionFragment = exports.Fragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.AbiCoder = exports.encodeBytes32String = exports.decodeBytes32String = exports.version = void 0;
exports.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.EnsResolver = exports.WebSocketProvider = exports.SocketProvider = exports.IpcSocketProvider = exports.QuickNodeProvider = exports.InfuraProvider = exports.EtherscanProvider = exports.CloudflareProvider = exports.AnkrProvider = exports.AlchemyProvider = exports.BrowserProvider = exports.JsonRpcSigner = exports.JsonRpcProvider = exports.JsonRpcApiProvider = exports.FallbackProvider = exports.AbstractProvider = exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.FeeData = exports.Block = exports.getDefaultProvider = exports.TypedDataEncoder = exports.solidityPackedSha256 = exports.solidityPackedKeccak256 = exports.solidityPacked = exports.hashMessage = exports.dnsEncode = exports.namehash = exports.isValidName = exports.id = exports.SigningKey = exports.Signature = void 0;
exports.encryptKeystoreJson = exports.decryptKeystoreJson = exports.decryptKeystoreJsonSync = exports.decryptCrowdsaleJson = exports.isKeystoreJson = exports.isCrowdsaleJson = exports.getAccountPath = exports.defaultPath = exports.Wallet = exports.HDNodeVoidWallet = exports.HDNodeWallet = exports.BaseWallet = exports.Mnemonic = exports.encodeRlp = exports.decodeRlp = exports.Utf8ErrorFuncs = exports.toUtf8String = exports.toUtf8CodePoints = exports.toUtf8Bytes = exports.parseUnits = exports.formatUnits = exports.parseEther = exports.formatEther = exports.mask = exports.toTwos = exports.fromTwos = exports.toQuantity = exports.toNumber = exports.toBeHex = exports.toBigInt = exports.toBeArray = exports.getUint = exports.getNumber = exports.getBigInt = exports.FixedNumber = exports.FetchCancelSignal = exports.FetchResponse = exports.FetchRequest = exports.isError = exports.isCallException = exports.makeError = exports.assertPrivate = exports.assertNormalize = exports.assertArgumentCount = exports.assertArgument = exports.assert = exports.defineProperties = exports.zeroPadValue = exports.zeroPadBytes = exports.stripZerosLeft = void 0;
exports.WordlistOwlA = exports.WordlistOwl = exports.LangEn = exports.Wordlist = exports.encryptKeystoreJsonSync = 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");
@ -30,6 +30,9 @@ Object.defineProperty(exports, "getAddress", { enumerable: true, get: function (
Object.defineProperty(exports, "getIcapAddress", { enumerable: true, get: function () { return index_js_2.getIcapAddress; } });
Object.defineProperty(exports, "getCreateAddress", { enumerable: true, get: function () { return index_js_2.getCreateAddress; } });
Object.defineProperty(exports, "getCreate2Address", { enumerable: true, get: function () { return index_js_2.getCreate2Address; } });
Object.defineProperty(exports, "isAddressable", { enumerable: true, get: function () { return index_js_2.isAddressable; } });
Object.defineProperty(exports, "isAddress", { enumerable: true, get: function () { return index_js_2.isAddress; } });
Object.defineProperty(exports, "resolveAddress", { enumerable: true, get: function () { return index_js_2.resolveAddress; } });
var index_js_3 = require("./constants/index.js");
Object.defineProperty(exports, "ZeroAddress", { enumerable: true, get: function () { return index_js_3.ZeroAddress; } });
Object.defineProperty(exports, "WeiPerEther", { enumerable: true, get: function () { return index_js_3.WeiPerEther; } });
@ -132,9 +135,10 @@ Object.defineProperty(exports, "FetchCancelSignal", { enumerable: true, get: fun
Object.defineProperty(exports, "FixedNumber", { enumerable: true, get: function () { return index_js_9.FixedNumber; } });
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; } });
Object.defineProperty(exports, "getUint", { enumerable: true, get: function () { return index_js_9.getUint; } });
Object.defineProperty(exports, "toBeArray", { enumerable: true, get: function () { return index_js_9.toBeArray; } });
Object.defineProperty(exports, "toBigInt", { enumerable: true, get: function () { return index_js_9.toBigInt; } });
Object.defineProperty(exports, "toHex", { enumerable: true, get: function () { return index_js_9.toHex; } });
Object.defineProperty(exports, "toBeHex", { enumerable: true, get: function () { return index_js_9.toBeHex; } });
Object.defineProperty(exports, "toNumber", { enumerable: true, get: function () { return index_js_9.toNumber; } });
Object.defineProperty(exports, "toQuantity", { enumerable: true, get: function () { return index_js_9.toQuantity; } });
Object.defineProperty(exports, "fromTwos", { enumerable: true, get: function () { return index_js_9.fromTwos; } });

View File

@ -1 +1 @@
{"version":3,"file":"ethers.js","sourceRoot":"","sources":["../src.ts/ethers.ts"],"names":[],"mappings":";AAEA,6BAA6B;AAC7B,EAAE;;;;;;AAEF,6CAAwC;AAA/B,sGAAA,OAAO,OAAA;AAEhB,2CAQwB;AAPpB,+GAAA,mBAAmB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A,OAAO,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,sGAAA,UAAU,OAAA;AACjF,oGAAA,QAAQ,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,gGAAA,IAAI,OAAA;AACtB,uGAAA,WAAW,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,sGAAA,UAAU,OAAA;AAChD,uGAAA,WAAW,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,wGAAA,YAAY,OAAA;AAC3C,0GAAA,cAAc,OAAA;AACd,qGAAA,SAAS,OAAA;AAAE,qGAAA,SAAS,OAAA;AAGxB,+CAY2B;AAXvB,qGAAA,QAAQ,OAAA;AACR,uGAAA,UAAU,OAAA;AAAE,yGAAA,YAAY,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAC1C,mGAAA,MAAM,OAAA;AAEN,wGAAA,WAAW,OAAA;AAEX,2GAAA,cAAc,OAAA;AACd,4GAAA,eAAe,OAAA;AAAE,2GAAA,cAAc,OAAA;AAE/B,iHAAA,oBAAoB,OAAA;AAAE,oHAAA,uBAAuB,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAClE,gHAAA,mBAAmB,OAAA;AAAE,oHAAA,uBAAuB,OAAA;AAGhD,kDAE8B;AAD1B,qGAAA,QAAQ,OAAA;AAAE,mGAAA,MAAM,OAAA;AAAE,wGAAA,WAAW,OAAA;AAAE,yGAAA,YAAY,OAAA"}

View File

@ -3,6 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.id = void 0;
const index_js_1 = require("../crypto/index.js");
const index_js_2 = require("../utils/index.js");
/**
* A simple hashing function which operates on UTF-8 strings to
* compute an 32-byte irentifier.
*
* This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes
* the [[keccak256]].
*
* @example:
* id("hello world")
* //_result:
*/
function id(value) {
return (0, index_js_1.keccak256)((0, index_js_2.toUtf8Bytes)(value));
}

View File

@ -1 +1 @@
{"version":3,"file":"id.js","sourceRoot":"","sources":["../../src.ts/hash/id.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,gDAAgD;AAEhD,SAAgB,EAAE,CAAC,KAAa;IAC5B,OAAO,IAAA,oBAAS,EAAC,IAAA,sBAAW,EAAC,KAAK,CAAC,CAAC,CAAC;AACzC,CAAC;AAFD,gBAEC"}
{"version":3,"file":"id.js","sourceRoot":"","sources":["../../src.ts/hash/id.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,gDAAgD;AAEhD;;;;;;;;;;GAUG;AACH,SAAgB,EAAE,CAAC,KAAa;IAC5B,OAAO,IAAA,oBAAS,EAAC,IAAA,sBAAW,EAAC,KAAK,CAAC,CAAC,CAAC;AACzC,CAAC;AAFD,gBAEC"}

View File

@ -4,6 +4,34 @@ exports.hashMessage = void 0;
const index_js_1 = require("../crypto/index.js");
const index_js_2 = require("../constants/index.js");
const index_js_3 = require("../utils/index.js");
/**
* Computes the [[link-eip-191]] personal-sign message digest to sign.
*
* This prefixes the message with [[MessagePrefix]] and the decimal length
* of %%message%% and computes the [[keccak256]] digest.
*
* If %%message%% is a string, it is converted to its UTF-8 bytes
* first. To compute the digest of a [[DataHexString]], it must be converted
* to [bytes](getBytes).
*
* @example:
* hashMessage("Hello World")
* //_result:
*
* // Hashes the SIX (6) string characters, i.e.
* // [ "0", "x", "4", "2", "4", "3" ]
* hashMessage("0x4243")
* //_result:
*
* // Hashes the TWO (2) bytes [ 0x42, 0x43 ]...
* hashMessage(getBytes("0x4243"))
* //_result:
*
* // ...which is equal to using data
* hashMessage(new Uint8Array([ 0x42, 0x43 ]))
* //_result:
*
*/
function hashMessage(message) {
if (typeof (message) === "string") {
message = (0, index_js_3.toUtf8Bytes)(message);

View File

@ -1 +1 @@
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src.ts/hash/message.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,oDAAsD;AACtD,gDAAwD;AAGxD,SAAgB,WAAW,CAAC,OAA4B;IACpD,IAAI,OAAM,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE;QAAE,OAAO,GAAG,IAAA,sBAAW,EAAC,OAAO,CAAC,CAAC;KAAE;IACrE,OAAO,IAAA,oBAAS,EAAC,IAAA,iBAAM,EAAC;QACpB,IAAA,sBAAW,EAAC,wBAAa,CAAC;QAC1B,IAAA,sBAAW,EAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,OAAO;KACV,CAAC,CAAC,CAAC;AACR,CAAC;AAPD,kCAOC"}
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src.ts/hash/message.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,oDAAsD;AACtD,gDAAwD;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,WAAW,CAAC,OAA4B;IACpD,IAAI,OAAM,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE;QAAE,OAAO,GAAG,IAAA,sBAAW,EAAC,OAAO,CAAC,CAAC;KAAE;IACrE,OAAO,IAAA,oBAAS,EAAC,IAAA,iBAAM,EAAC;QACpB,IAAA,sBAAW,EAAC,wBAAa,CAAC;QAC1B,IAAA,sBAAW,EAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,OAAO;KACV,CAAC,CAAC,CAAC;AACR,CAAC;AAPD,kCAOC"}

View File

@ -1,8 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.solidityPackedSha256 = exports.solidityPackedKeccak256 = exports.solidityPacked = void 0;
const index_js_1 = require("../crypto/index.js");
const index_js_2 = require("../utils/index.js");
const index_js_1 = require("../address/index.js");
const index_js_2 = require("../crypto/index.js");
const index_js_3 = require("../utils/index.js");
const regexBytes = new RegExp("^bytes([0-9]+)$");
const regexNumber = new RegExp("^(u?int)([0-9]*)$");
const regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$");
@ -10,40 +11,40 @@ function _pack(type, value, isArray) {
switch (type) {
case "address":
if (isArray) {
return (0, index_js_2.getBytes)((0, index_js_2.zeroPadValue)(value, 32));
return (0, index_js_3.getBytes)((0, index_js_3.zeroPadValue)(value, 32));
}
return (0, index_js_2.getBytes)(value);
return (0, index_js_3.getBytes)((0, index_js_1.getAddress)(value));
case "string":
return (0, index_js_2.toUtf8Bytes)(value);
return (0, index_js_3.toUtf8Bytes)(value);
case "bytes":
return (0, index_js_2.getBytes)(value);
return (0, index_js_3.getBytes)(value);
case "bool":
value = (!!value ? "0x01" : "0x00");
if (isArray) {
return (0, index_js_2.getBytes)((0, index_js_2.zeroPadValue)(value, 32));
return (0, index_js_3.getBytes)((0, index_js_3.zeroPadValue)(value, 32));
}
return (0, index_js_2.getBytes)(value);
return (0, index_js_3.getBytes)(value);
}
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);
(0, index_js_3.assertArgument)((!match[2] || match[2] === String(size)) && (size % 8 === 0) && size !== 0 && size <= 256, "invalid number type", "type", type);
if (isArray) {
size = 256;
}
if (signed) {
value = (0, index_js_2.toTwos)(value, size);
value = (0, index_js_3.toTwos)(value, size);
}
return (0, index_js_2.getBytes)((0, index_js_2.zeroPadValue)((0, index_js_2.toArray)(value), size / 8));
return (0, index_js_3.getBytes)((0, index_js_3.zeroPadValue)((0, index_js_3.toBeArray)(value), size / 8));
}
match = type.match(regexBytes);
if (match) {
const size = parseInt(match[1]);
(0, index_js_2.assertArgument)(String(size) === match[1] && size !== 0 && size <= 32, "invalid bytes type", "type", type);
(0, index_js_2.assertArgument)((0, index_js_2.dataLength)(value) === size, `invalid value for ${type}`, "value", value);
(0, index_js_3.assertArgument)(String(size) === match[1] && size !== 0 && size <= 32, "invalid bytes type", "type", type);
(0, index_js_3.assertArgument)((0, index_js_3.dataLength)(value) === size, `invalid value for ${type}`, "value", value);
if (isArray) {
return (0, index_js_2.getBytes)((0, index_js_2.zeroPadBytes)(value, 32));
return (0, index_js_3.getBytes)((0, index_js_3.zeroPadBytes)(value, 32));
}
return value;
}
@ -51,44 +52,58 @@ function _pack(type, value, isArray) {
if (match && Array.isArray(value)) {
const baseType = match[1];
const count = parseInt(match[2] || String(value.length));
(0, index_js_2.assertArgument)(count === value.length, `invalid array length for ${type}`, "value", value);
(0, index_js_3.assertArgument)(count === value.length, `invalid array length for ${type}`, "value", value);
const result = [];
value.forEach(function (value) {
result.push(_pack(baseType, value, true));
});
return (0, index_js_2.getBytes)((0, index_js_2.concat)(result));
return (0, index_js_3.getBytes)((0, index_js_3.concat)(result));
}
(0, index_js_2.assertArgument)(false, "invalid type", "type", type);
(0, index_js_3.assertArgument)(false, "invalid type", "type", type);
}
// @TODO: Array Enum
/**
* Computes the [[link-solc-packed]] representation of %%values%%
* respectively to their %%types%%.
*
* @example:
* addr = "0x8ba1f109551bd432803012645ac136ddd64dba72"
* solidityPacked([ "address", "uint" ], [ addr, 45 ]);
* //_result:
*/
function solidityPacked(types, values) {
(0, index_js_2.assertArgument)(types.length === values.length, "wrong number of values; expected ${ types.length }", "values", values);
(0, index_js_3.assertArgument)(types.length === values.length, "wrong number of values; expected ${ types.length }", "values", values);
const tight = [];
types.forEach(function (type, index) {
tight.push(_pack(type, values[index]));
});
return (0, index_js_2.hexlify)((0, index_js_2.concat)(tight));
return (0, index_js_3.hexlify)((0, index_js_3.concat)(tight));
}
exports.solidityPacked = solidityPacked;
/**
* Computes the non-standard packed (tightly packed) keccak256 hash of
* the values given the types.
*
* @param {Array<string>} types - The Solidity types to interpret each value as [default: bar]
* @param {Array<any>} values - The values to pack
* Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%%
* respectively to their %%types%%.
*
* @example:
* solidityPackedKeccak256([ "address", "uint" ], [ "0x1234", 45 ]);
* / /_result:
*
* @see https://docs.soliditylang.org/en/v0.8.14/abi-spec.html#non-standard-packed-mode
* addr = "0x8ba1f109551bd432803012645ac136ddd64dba72"
* solidityPackedKeccak256([ "address", "uint" ], [ addr, 45 ]);
* //_result:
*/
function solidityPackedKeccak256(types, values) {
return (0, index_js_1.keccak256)(solidityPacked(types, values));
return (0, index_js_2.keccak256)(solidityPacked(types, values));
}
exports.solidityPackedKeccak256 = solidityPackedKeccak256;
/**
* Computes the [[link-solc-packed]] [[sha256]] hash of %%values%%
* respectively to their %%types%%.
*
* @example:
* addr = "0x8ba1f109551bd432803012645ac136ddd64dba72"
* solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]);
* //_result:
*/
function solidityPackedSha256(types, values) {
return (0, index_js_1.sha256)(solidityPacked(types, values));
return (0, index_js_2.sha256)(solidityPacked(types, values));
}
exports.solidityPackedSha256 = solidityPackedSha256;
//# sourceMappingURL=solidity.js.map

View File

@ -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;QA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CAAC,KAA4B,EAAE,MAA0B;IACzF,OAAO,IAAA,iBAAO,EAAC,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAClD,CAAC;AAFD,oDAEC"}

View File

@ -22,8 +22,8 @@ function hexPadRight(value) {
}
return (0, index_js_3.hexlify)(bytes);
}
const hexTrue = (0, index_js_3.toHex)(BN_1, 32);
const hexFalse = (0, index_js_3.toHex)(BN_0, 32);
const hexTrue = (0, index_js_3.toBeHex)(BN_1, 32);
const hexFalse = (0, index_js_3.toBeHex)(BN_0, 32);
const domainFieldTypes = {
name: "string",
version: "string",
@ -72,7 +72,7 @@ function getBaseEncoder(type) {
return function (_value) {
const value = (0, index_js_3.getBigInt)(_value, "value");
(0, index_js_3.assertArgument)(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, "value", value);
return (0, index_js_3.toHex)((0, index_js_3.toTwos)(value, 256), 32);
return (0, index_js_3.toBeHex)((0, index_js_3.toTwos)(value, 256), 32);
};
}
}

File diff suppressed because one or more lines are too long

View File

@ -31,7 +31,7 @@ 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
* @_section: api:API Specification [about-api]
*/
const ethers = __importStar(require("./ethers.js"));
exports.ethers = ethers;

View File

@ -1072,7 +1072,7 @@ function _parseBytes(result, start) {
return null;
}
function numPad(value) {
const result = (0, index_js_3.toArray)(value);
const result = (0, index_js_3.toBeArray)(value);
if (result.length > 32) {
throw new Error("internal; should not happen");
}

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,9 @@
"use strict";
/**
* About ENS Resolver
*
* @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver]
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnsResolver = exports.BasicMulticoinProviderPlugin = exports.MulticoinProviderPlugin = void 0;
const index_js_1 = require("../address/index.js");
@ -26,7 +31,7 @@ function parseString(result, start) {
return null;
}
function numPad(value) {
const result = (0, index_js_4.toArray)(value);
const result = (0, index_js_4.toBeArray)(value);
if (result.length > 32) {
throw new Error("internal; should not happen");
}
@ -82,6 +87,9 @@ function getIpfsLink(link) {
}
;
;
/**
* A provider plugin super-class for processing multicoin address types.
*/
class MulticoinProviderPlugin {
name;
constructor(name) {
@ -102,6 +110,9 @@ class MulticoinProviderPlugin {
}
exports.MulticoinProviderPlugin = MulticoinProviderPlugin;
const BasicMulticoinPluginId = "org.ethers.plugins.BasicMulticoinProviderPlugin";
/**
* A basic multicoin provider plugin.
*/
class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin {
constructor() {
super(BasicMulticoinPluginId);
@ -115,9 +126,22 @@ const matchers = [
matcherIpfs,
new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i"),
];
/**
* A connected object to a resolved ENS name resolver, which can be
* used to query additional details.
*/
class EnsResolver {
/**
* The connected provider.
*/
provider;
/**
* The address of the resolver.
*/
address;
/**
* The name this resovler was resolved against.
*/
name;
// For EIP-2544 names, the ancestor that provided the resolver
#supports2544;
@ -125,6 +149,9 @@ class EnsResolver {
(0, index_js_4.defineProperties)(this, { provider, address, name });
this.#supports2544 = null;
}
/**
* Resolves to true if the resolver supports wildcard resolution.
*/
async supportsWildcard() {
if (!this.#supports2544) {
// supportsInterface(bytes4 = selector("resolve(bytes,bytes)"))
@ -144,6 +171,10 @@ class EnsResolver {
}
return await this.#supports2544;
}
/**
* Fetch the %%selector%% with %%parameters%% using call, resolving
* recursively if the resolver supports it.
*/
async _fetch(selector, parameters) {
if (parameters == null) {
parameters = "0x";
@ -181,6 +212,10 @@ class EnsResolver {
}
return null;
}
/**
* Resolves to the address for %%coinType%% or null if the
* provided %%coinType%% has not been configured.
*/
async getAddress(coinType) {
if (coinType == null) {
coinType = 60;
@ -231,6 +266,10 @@ class EnsResolver {
info: { coinType, data }
});
}
/**
* Resovles to the EIP-643 text record for %%key%%, or ``null``
* if unconfigured.
*/
async getText(key) {
// The key encoded as parameter to fetchBytes
let keyBytes = (0, index_js_4.toUtf8Bytes)(key);
@ -243,6 +282,9 @@ class EnsResolver {
}
return (0, index_js_4.toUtf8String)(hexBytes);
}
/**
* Rsolves to the content-hash or ``null`` if unconfigured.
*/
async getContentHash() {
// keccak256("contenthash()")
const hexBytes = parseBytes((await this._fetch("0xbc1c58d1")) || "0x", 0);
@ -269,9 +311,25 @@ class EnsResolver {
info: { data: hexBytes }
});
}
/**
* Resolves to the avatar url or ``null`` if the avatar is either
* unconfigured or incorrectly configured (e.g. references an NFT
* not owned by the address).
*
* If diagnosing issues with configurations, the [[_getAvatar]]
* method may be useful.
*/
async getAvatar() {
return (await this._getAvatar()).url;
}
/**
* When resolving an avatar, there are many steps involved, such
* fetching metadata and possibly validating ownership of an
* NFT.
*
* This method can be used to examine each step and the value it
* was working from.
*/
async _getAvatar() {
const linkage = [{ type: "name", value: this.name }];
try {
@ -444,6 +502,10 @@ class EnsResolver {
}
return null;
}
/**
* Resolve to the ENS resolver for %%name%% using %%provider%% or
* ``null`` if uncinfigured.
*/
static async fromName(provider, name) {
let currentName = name;
while (true) {

File diff suppressed because one or more lines are too long

View File

@ -42,7 +42,7 @@ function handleUint(_value, param) {
}
function formatNumber(_value, name) {
const value = (0, index_js_3.getBigInt)(_value, "value");
const result = (0, index_js_3.toArray)(value);
const result = (0, index_js_3.toBeArray)(value);
(0, index_js_3.assertArgument)(result.length <= 32, `value too large`, `tx.${name}`, value);
return result;
}
@ -119,7 +119,7 @@ function _serializeLegacy(tx, sig) {
if (!sig) {
// We have an EIP-155 transaction (chainId was specified and non-zero)
if (chainId !== BN_0) {
fields.push((0, index_js_3.toArray)(chainId));
fields.push((0, index_js_3.toBeArray)(chainId));
fields.push("0x");
fields.push("0x");
}
@ -133,9 +133,9 @@ function _serializeLegacy(tx, sig) {
else if (BigInt(sig.v) !== v) {
(0, index_js_3.assertArgument)(false, "tx.chainId/sig.v mismatch", "sig", sig);
}
fields.push((0, index_js_3.toArray)(v));
fields.push((0, index_js_3.toArray)(sig.r));
fields.push((0, index_js_3.toArray)(sig.s));
fields.push((0, index_js_3.toBeArray)(v));
fields.push((0, index_js_3.toBeArray)(sig.r));
fields.push((0, index_js_3.toBeArray)(sig.s));
return (0, index_js_3.encodeRlp)(fields);
}
function _parseEipSignature(tx, fields, serialize) {
@ -194,8 +194,8 @@ function _serializeEip1559(tx, sig) {
];
if (sig) {
fields.push(formatNumber(sig.yParity, "yParity"));
fields.push((0, index_js_3.toArray)(sig.r));
fields.push((0, index_js_3.toArray)(sig.s));
fields.push((0, index_js_3.toBeArray)(sig.r));
fields.push((0, index_js_3.toBeArray)(sig.s));
}
return (0, index_js_3.concat)(["0x02", (0, index_js_3.encodeRlp)(fields)]);
}
@ -234,27 +234,23 @@ function _serializeEip2930(tx, sig) {
];
if (sig) {
fields.push(formatNumber(sig.yParity, "recoveryParam"));
fields.push((0, index_js_3.toArray)(sig.r));
fields.push((0, index_js_3.toArray)(sig.s));
fields.push((0, index_js_3.toBeArray)(sig.r));
fields.push((0, index_js_3.toBeArray)(sig.s));
}
return (0, index_js_3.concat)(["0x01", (0, index_js_3.encodeRlp)(fields)]);
}
/**
* A transactions which has been signed.
*/
/*
export interface SignedTransaction extends Transaction {
type: number;
typeName: string;
from: string;
signature: Signature;
}
*/
/**
* A **Transaction** describes an operation to be executed on
* Ethereum by an Externally Owned Account (EOA). It includes
* who (the [[to]] address), what (the [[data]]) and how much (the
* [[value]] in ether) the operation should entail.
*
* @example:
* tx = new Transaction()
* //_result:
*
* tx.data = "0x1234";
* //_result:
*/
class Transaction {
#type;

File diff suppressed because one or more lines are too long

View File

@ -55,13 +55,14 @@ function stringify(value) {
*
* @See [ErrorCodes](api:ErrorCode)
* @example
* try {
* / / code....
* } catch (e) {
* try {
* // code....
* } catch (e) {
* if (isError(e, "CALL_EXCEPTION")) {
* // The Type Guard has validated this object
* console.log(e.data);
* }
* }
* }
*/
function isError(error, code) {
return (error && error.code === code);

File diff suppressed because one or more lines are too long

View File

@ -109,6 +109,12 @@ function checkSignal(signal) {
* and ``IPFS:``.
*
* Additional schemes can be added globally using [[registerGateway]].
*
* @example:
* req = new FetchRequest("https://www.ricmoo.com")
* resp = await req.send()
* resp.body.length
* //_result:
*/
class FetchRequest {
#allowInsecure;

File diff suppressed because one or more lines are too long

View File

@ -10,9 +10,6 @@ const data_js_1 = require("./data.js");
const errors_js_1 = require("./errors.js");
const maths_js_1 = require("./maths.js");
const properties_js_1 = require("./properties.js");
if (0) {
console.log(data_js_1.getBytes, maths_js_1.toBigInt, maths_js_1.toHex, maths_js_1.toTwos);
}
const BN_N1 = BigInt(-1);
const BN_0 = BigInt(0);
const BN_1 = BigInt(1);

File diff suppressed because one or more lines are too long

View File

@ -7,8 +7,8 @@
* @_section api/utils:Utilities [utils]
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Utf8ErrorFuncs = exports.toUtf8String = exports.toUtf8CodePoints = exports.toUtf8Bytes = exports.parseUnits = exports.formatUnits = exports.parseEther = exports.formatEther = exports.encodeRlp = exports.decodeRlp = exports.defineProperties = exports.resolveProperties = exports.toQuantity = exports.toArray = exports.toHex = exports.toNumber = exports.toBigInt = exports.getNumber = exports.getBigInt = exports.mask = exports.toTwos = exports.fromTwos = exports.FixedNumber = exports.FetchCancelSignal = exports.FetchResponse = exports.FetchRequest = exports.EventPayload = exports.makeError = exports.assertNormalize = exports.assertPrivate = exports.assertArgumentCount = exports.assertArgument = exports.assert = exports.isError = exports.isCallException = exports.zeroPadBytes = exports.zeroPadValue = exports.stripZerosLeft = exports.dataSlice = exports.dataLength = exports.concat = exports.hexlify = exports.isBytesLike = exports.isHexString = exports.getBytesCopy = exports.getBytes = exports.encodeBase64 = exports.decodeBase64 = exports.encodeBase58 = exports.decodeBase58 = void 0;
exports.uuidV4 = void 0;
exports.toUtf8String = exports.toUtf8CodePoints = exports.toUtf8Bytes = exports.parseUnits = exports.formatUnits = exports.parseEther = exports.formatEther = exports.encodeRlp = exports.decodeRlp = exports.defineProperties = exports.resolveProperties = exports.toQuantity = exports.toBeArray = exports.toBeHex = exports.toNumber = exports.toBigInt = exports.getUint = exports.getNumber = exports.getBigInt = exports.mask = exports.toTwos = exports.fromTwos = exports.FixedNumber = exports.FetchCancelSignal = exports.FetchResponse = exports.FetchRequest = exports.EventPayload = exports.makeError = exports.assertNormalize = exports.assertPrivate = exports.assertArgumentCount = exports.assertArgument = exports.assert = exports.isError = exports.isCallException = exports.zeroPadBytes = exports.zeroPadValue = exports.stripZerosLeft = exports.dataSlice = exports.dataLength = exports.concat = exports.hexlify = exports.isBytesLike = exports.isHexString = exports.getBytesCopy = exports.getBytes = exports.encodeBase64 = exports.decodeBase64 = exports.encodeBase58 = exports.decodeBase58 = void 0;
exports.uuidV4 = exports.Utf8ErrorFuncs = void 0;
var base58_js_1 = require("./base58.js");
Object.defineProperty(exports, "decodeBase58", { enumerable: true, get: function () { return base58_js_1.decodeBase58; } });
Object.defineProperty(exports, "encodeBase58", { enumerable: true, get: function () { return base58_js_1.encodeBase58; } });
@ -50,10 +50,11 @@ Object.defineProperty(exports, "toTwos", { enumerable: true, get: function () {
Object.defineProperty(exports, "mask", { enumerable: true, get: function () { return maths_js_1.mask; } });
Object.defineProperty(exports, "getBigInt", { enumerable: true, get: function () { return maths_js_1.getBigInt; } });
Object.defineProperty(exports, "getNumber", { enumerable: true, get: function () { return maths_js_1.getNumber; } });
Object.defineProperty(exports, "getUint", { enumerable: true, get: function () { return maths_js_1.getUint; } });
Object.defineProperty(exports, "toBigInt", { enumerable: true, get: function () { return maths_js_1.toBigInt; } });
Object.defineProperty(exports, "toNumber", { enumerable: true, get: function () { return maths_js_1.toNumber; } });
Object.defineProperty(exports, "toHex", { enumerable: true, get: function () { return maths_js_1.toHex; } });
Object.defineProperty(exports, "toArray", { enumerable: true, get: function () { return maths_js_1.toArray; } });
Object.defineProperty(exports, "toBeHex", { enumerable: true, get: function () { return maths_js_1.toBeHex; } });
Object.defineProperty(exports, "toBeArray", { enumerable: true, get: function () { return maths_js_1.toBeArray; } });
Object.defineProperty(exports, "toQuantity", { enumerable: true, get: function () { return maths_js_1.toQuantity; } });
var properties_js_1 = require("./properties.js");
Object.defineProperty(exports, "resolveProperties", { enumerable: true, get: function () { return properties_js_1.resolveProperties; } });

View File

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;AAEH,yCAAyD;AAAhD,yGAAA,YAAY,OAAA;AAAE,yGAAA,YAAY,OAAA;AAEnC,yCAAyD;AAAhD,yGAAA,YAAY,OAAA;AAAE,yGAAA,YAAY,OAAA;AAEnC,qCAGmB;AAFf,mGAAA,QAAQ,OAAA;AAAE,uGAAA,YAAY,OAAA;AAAE,sGAAA,WAAW,OAAA;AAAE,sGAAA,WAAW,OAAA;AAAE,kGAAA,OAAO,OAAA;AAAE,iGAAA,MAAM,OAAA;AAAE,qGAAA,UAAU,OAAA;AAAE,oGAAA,SAAS,OAAA;AACxF,yGAAA,cAAc,OAAA;AAAE,uGAAA,YAAY,OAAA;AAAE,uGAAA,YAAY,OAAA;AAG9C,yCAGoB;AAFhB,4GAAA,eAAe,OAAA;AAAE,oGAAA,OAAO,OAAA;AACxB,mGAAA,MAAM,OAAA;AAAE,2GAAA,cAAc,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAAE,0GAAA,aAAa,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,sGAAA,SAAS,OAAA;AAG1F,yCAA2C;AAAlC,yGAAA,YAAY,OAAA;AAErB,uCAEoB;AADhB,wGAAA,YAAY,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAGlD,mDAA8C;AAArC,6GAAA,WAAW,OAAA;AAEpB,uCAGoB;AAFhB,oGAAA,QAAQ,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,gGAAA,IAAI,OAAA;AACtB,qGAAA,SAAS,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,oGAAA,QA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AAAE,4GAAA,eAAe,OAAA;AAAE,sGAAA,SAAS,OAAA;AAG1F,yCAA2C;AAAlC,yGAAA,YAAY,OAAA;AAErB,uCAEoB;AADhB,wGAAA,YAAY,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAGlD,mDAA8C;AAArC,6GAAA,WAAW,OAAA;AAEpB,uCAGoB;AAFhB,oGAAA,QAAQ,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,gGAAA,IAAI,OAAA;AACtB,qGAAA,SAAS,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,sGAAA,UAAU,OAAA;AAGrF,iDAAqE;AAA5D,kHAAA,iBAAiB,OAAA;AAAE,iHAAA,gBAAgB,OAAA;AAE5C,iDAA4C;AAAnC,0GAAA,SAAS,OAAA;AAClB,iDAA4C;AAAnC,0GAAA,SAAS,OAAA;AAElB,uCAA8E;AAArE,uGAAA,WAAW,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,sGAAA,UAAU,OAAA;AAEzD,qCAMmB;AALf,sGAAA,WAAW,OAAA;AACX,2GAAA,gBAAgB,OAAA;AAChB,uGAAA,YAAY,OAAA;AAEZ,yGAAA,cAAc,OAAA;AAGlB,qCAAmC;AAA1B,iGAAA,MAAM,OAAA"}

View File

@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toQuantity = exports.toArray = exports.toHex = exports.toNumber = exports.getNumber = exports.toBigInt = exports.getBigInt = exports.mask = exports.toTwos = exports.fromTwos = void 0;
exports.toQuantity = exports.toBeArray = exports.toBeHex = exports.toNumber = exports.getNumber = exports.toBigInt = exports.getUint = exports.getBigInt = exports.mask = exports.toTwos = exports.fromTwos = void 0;
/**
* Some mathematic operations.
*
@ -10,6 +10,7 @@ const data_js_1 = require("./data.js");
const errors_js_1 = require("./errors.js");
const BN_0 = BigInt(0);
const BN_1 = BigInt(1);
//const BN_Max256 = (BN_1 << BigInt(256)) - BN_1;
// IEEE 754 support 53-bits of mantissa
const maxValue = 0x1fffffffffffff;
/**
@ -19,9 +20,8 @@ const maxValue = 0x1fffffffffffff;
* If the highest bit is ``1``, the result will be negative.
*/
function fromTwos(_value, _width) {
const value = getBigInt(_value, "value");
const value = getUint(_value, "value");
const width = BigInt(getNumber(_width, "width"));
(0, errors_js_1.assertArgument)(value >= BN_0, "invalid twos complement value", "value", value);
(0, errors_js_1.assert)((value >> width) === BN_0, "overflow", "NUMERIC_FAULT", {
operation: "fromTwos", fault: "overflow", value: _value
});
@ -63,7 +63,7 @@ exports.toTwos = toTwos;
* Mask %%value%% with a bitmask of %%bits%% ones.
*/
function mask(_value, _bits) {
const value = getBigInt(_value, "value");
const value = getUint(_value, "value");
const bits = BigInt(getNumber(_bits, "bits"));
return value & ((BN_1 << bits) - BN_1);
}
@ -96,6 +96,14 @@ function getBigInt(value, name) {
(0, errors_js_1.assertArgument)(false, "invalid BigNumberish value", name || "value", value);
}
exports.getBigInt = getBigInt;
function getUint(value, name) {
const result = getBigInt(value, name);
(0, errors_js_1.assert)(result >= BN_0, "overflow", "NUMERIC_FAULT", {
fault: "overflow", operation: "getUint", value
});
return result;
}
exports.getUint = getUint;
const Nibbles = "0123456789abcdef";
/*
* Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it
@ -152,9 +160,8 @@ exports.toNumber = toNumber;
* Converts %%value%% to a Big Endian hexstring, optionally padded to
* %%width%% bytes.
*/
function toHex(_value, _width) {
const value = getBigInt(_value, "value");
(0, errors_js_1.assertArgument)(value >= 0, "cannot toHex negative value", "value", _value);
function toBeHex(_value, _width) {
const value = getUint(_value, "value");
let result = value.toString(16);
if (_width == null) {
// Ensure the value is of even length
@ -172,13 +179,12 @@ function toHex(_value, _width) {
}
return "0x" + result;
}
exports.toHex = toHex;
exports.toBeHex = toBeHex;
/**
* Converts %%value%% to a Big Endian Uint8Array.
*/
function toArray(_value) {
const value = getBigInt(_value, "value");
(0, errors_js_1.assertArgument)(value >= 0, "cannot toArray negative value", "value", _value);
function toBeArray(_value) {
const value = getUint(_value, "value");
if (value === BN_0) {
return new Uint8Array([]);
}
@ -193,7 +199,7 @@ function toArray(_value) {
}
return result;
}
exports.toArray = toArray;
exports.toBeArray = toBeArray;
/**
* Returns a [[HexString]] for %%value%% safe to use as a //Quantity//.
*
@ -202,7 +208,7 @@ exports.toArray = toArray;
* numeric values.
*/
function toQuantity(value) {
let result = (0, data_js_1.hexlify)((0, data_js_1.isBytesLike)(value) ? value : toArray(value)).substring(2);
let result = (0, data_js_1.hexlify)((0, data_js_1.isBytesLike)(value) ? value : toBeArray(value)).substring(2);
while (result.substring(0, 1) === "0") {
result = result.substring(1);
}

File diff suppressed because one or more lines are too long

View File

@ -242,7 +242,7 @@ class HDNodeWallet extends base_wallet_js_1.BaseWallet {
}
}
const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, this.privateKey);
const ki = new index_js_1.SigningKey((0, index_js_4.toHex)(((0, index_js_4.toBigInt)(IL) + BigInt(this.privateKey)) % N, 32));
const ki = new index_js_1.SigningKey((0, index_js_4.toBeHex)(((0, index_js_4.toBigInt)(IL) + BigInt(this.privateKey)) % N, 32));
return new HDNodeWallet(_guard, ki, this.fingerprint, (0, index_js_4.hexlify)(IR), path, index, this.depth + 1, this.mnemonic, this.provider);
}
/**
@ -267,7 +267,7 @@ class HDNodeWallet extends base_wallet_js_1.BaseWallet {
* or full HD Node ([[HDNodeWallet) respectively.
*/
static fromExtendedKey(extendedKey) {
const bytes = (0, index_js_4.toArray)((0, index_js_4.decodeBase58)(extendedKey)); // @TODO: redact
const bytes = (0, index_js_4.toBeArray)((0, index_js_4.decodeBase58)(extendedKey)); // @TODO: redact
(0, index_js_4.assertArgument)(bytes.length === 82 || encodeBase58Check(bytes.slice(0, 78)) === extendedKey, "invalid extended key", "extendedKey", "[ REDACTED ]");
const depth = bytes[4];
const parentFingerprint = (0, index_js_4.hexlify)(bytes.slice(5, 9));

File diff suppressed because one or more lines are too long

View File

@ -1,13 +1,13 @@
import assert from "assert";
import { concat, dataLength, keccak256, toArray, isCallException, isError } from "../index.js";
import { concat, dataLength, keccak256, toBeArray, isCallException, isError } from "../index.js";
import { connect } from "./create-provider.js";
describe("Test CCIP execution", function () {
// This matches the verify method in the Solidity contract against the
// processed data from the endpoint
const verify = function (sender, data, result) {
const check = concat([
toArray(dataLength(sender)), sender,
toArray(dataLength(data)), data
toBeArray(dataLength(sender)), sender,
toBeArray(dataLength(data)), data
]);
assert.equal(result, keccak256(check), "response is equal");
};

View File

@ -1 +1 @@
{"version":3,"file":"test-providers-ccip.js","sourceRoot":"","sources":["../../src.ts/_tests/test-providers-ccip.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EACH,MAAM,EAAE,UAAU,EAClB,SAAS,EACT,OAAO,EACP,eAAe,EAAE,OAAO,EAC3B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,QAAQ,CAAC,qBAAqB,EAAE;IAE5B,sEAAsE;IACtE,mCAAmC;IACnC,MAAM,MAAM,GAAG,UAAS,MAAc,EAAE,IAAY,EAAE,MAAc;QAChE,MAAM,KAAK,GAAG,MAAM,CAAC;YACjB,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM;YACnC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI;SAClC,CAAC,CAAC;QACH,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC,CAAC;IAChE,CAAC,CAAA;IAED,MAAM,OAAO,GAAG,4CAA4C,CAAC;IAC7D,MAAM,QAAQ,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P,CAAC,CAAC,CAAC;IAGH,EAAE,CAAC,qDAAqD,EAAE,KAAK;QAC3D,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAEpB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEnC,6CAA6C;QAC7C,MAAM,EAAE,GAAG;YACP,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI;YACjC,IAAI,EAAE,4MAA4M;SACrN,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,KAAK;QAC9C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAEpB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEnC,sCAAsC;QACtC,MAAM,EAAE,GAAG;YACP,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI;YACjC,IAAI,EAAE,4MAA4M;SACrN,CAAA;QAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAA"}

View File

@ -1,5 +1,5 @@
import assert from "assert";
import { concat, dataSlice, id, toArray, zeroPadValue, isCallException } from "../index.js";
import { concat, dataSlice, id, toBeArray, zeroPadValue, isCallException } from "../index.js";
import { getProvider, providerNames } from "./create-provider.js";
describe("Tests Provider Errors", function () {
const panics = [
@ -38,7 +38,7 @@ describe("Tests Provider Errors", function () {
this.timeout(10000);
const data = concat([
dataSlice(id("testPanic(uint256)"), 0, 4),
zeroPadValue(toArray(code), 32)
zeroPadValue(toBeArray(code), 32)
]);
const tx = { to: testAddr, data };
try {

File diff suppressed because one or more lines are too long

View File

@ -24,7 +24,7 @@ describe("Sends Transactions", function () {
cleanup.push(() => { provider.destroy(); });
}
it(`tests sending: ${providerName}`, async function () {
this.timeout(60000);
this.timeout(180000);
const w = wallet.connect(provider);
const dustAddr = Wallet.createRandom().address;
// Retry if another CI instance used our value
@ -48,7 +48,7 @@ describe("Sends Transactions", function () {
}
assert.ok(!!tx, "too many retries");
//const receipt =
await provider.waitForTransaction(tx.hash); //tx.wait();
await provider.waitForTransaction(tx.hash, null, 60000); //tx.wait();
//console.log(receipt);
const balance = await provider.getBalance(dustAddr);
assert.equal(balance, BigInt(42), "target balance after send");

View File

@ -1 +1 @@
{"version":3,"file":"test-providers-send.js","sourceRoot":"","sources":["../../src.ts/_tests/test-providers-send.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAIlE,SAAS,KAAK,CAAC,QAAgB;IAC3B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxE,CAAC;AAGD,QAAQ,CAAC,oBAAoB,EAAE;IAE3B,MAAM,OAAO,GAAsB,EAAG,CAAC;IACvC,KAAK,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE;YAAE,IAAI,EAAE,CAAC;SAAE;IAC3C,CAAC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAI,MAAM,CAAS,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAEnE,MAAM,WAAW,GAAG,QAAQ,CAAC;IAC7B,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE;QACtC,MAAM,QAAQ,GAA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import { isError, getBigInt, getNumber, toArray, toHex, toQuantity, } from "../index.js";
import { isError, getBigInt, getNumber, toBeArray, toBeHex, toQuantity, } from "../index.js";
describe("Tests Quantity Functions", function () {
const quantities = [
{
@ -135,7 +135,7 @@ describe("Tests Bad Math Values", function () {
{
name: "negative value",
value: -4,
error: "cannot toHex negative value"
error: "cannot toBeHex negative value"
},
{
name: "width too short",
@ -145,9 +145,9 @@ describe("Tests Bad Math Values", function () {
},
];
for (const { name, value, error, width } of badHex) {
it(`correctly fails on bad toHex values: ${name}`, function () {
it(`correctly fails on bad toBeHex values: ${name}`, function () {
assert.throws(() => {
const result = toHex(value, width);
const result = toBeHex(value, width);
console.log(result);
}, (e) => {
return (isError(e, "INVALID_ARGUMENT") &&
@ -155,13 +155,13 @@ describe("Tests Bad Math Values", function () {
});
});
}
it(`correctly fails on nad toArray values: negative value`, function () {
it(`correctly fails on nad toBeArray values: negative value`, function () {
assert.throws(() => {
const result = toArray(-4);
const result = toBeArray(-4);
console.log(result);
}, (e) => {
return (isError(e, "INVALID_ARGUMENT") &&
e.message.startsWith("cannot toArray negative value"));
e.message.startsWith("cannot toBeArray negative value"));
});
});
});

View File

@ -1 +1 @@
{"version":3,"file":"test-utils-maths.js","sourceRoot":"","sources":["../../src.ts/_tests/test-utils-maths.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EACH,OAAO,EACP,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,GACnD,MAAM,aAAa,CAAC;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,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CAAC,MAAM,CAAC,CAAC;QACxB,CAAC,EAAE,CAAC,CAAM,EAAE,EAAE;YACV,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,kBAAkB,CAAC;gBAClC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,iCAAiC,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}

View File

@ -1,4 +1,4 @@
import { defineProperties, concat, getBytesCopy, getNumber, hexlify, toArray, toBigInt, toNumber, assert, assertPrivate, assertArgument } from "../../utils/index.js";
import { defineProperties, concat, getBytesCopy, getNumber, hexlify, toBeArray, toBigInt, toNumber, assert, assertPrivate, assertArgument } from "../../utils/index.js";
export const WordSize = 32;
const Padding = new Uint8Array(WordSize);
// Properties used to immediate pass through to the underlying object
@ -165,7 +165,7 @@ export function checkResultErrors(result) {
return errors;
}
function getValue(value) {
let bytes = toArray(value);
let bytes = toBeArray(value);
assert(bytes.length <= WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: bytes, length: WordSize, offset: bytes.length });
if (bytes.length !== WordSize) {
bytes = getBytesCopy(concat([Padding.slice(bytes.length % WordSize), bytes]));

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
import { getAddress } from "../../address/index.js";
import { toHex } from "../../utils/maths.js";
import { toBeHex } from "../../utils/maths.js";
import { Typed } from "../typed.js";
import { Coder } from "./abstract-coder.js";
/**
@ -23,7 +23,7 @@ export class AddressCoder extends Coder {
return writer.writeValue(value);
}
decode(reader) {
return getAddress(toHex(reader.readValue(), 20));
return getAddress(toBeHex(reader.readValue(), 20));
}
}
//# sourceMappingURL=address.js.map

View File

@ -1 +1 @@
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../../src.ts/abi/coders/address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,C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;QACR,OAAO,4CAA4C,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAsB;QACzC,IAAI,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAChD,IAAI;YACA,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;SAC7B;QAAC,OAAO,KAAU,EAAE;YACjB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SAClD;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;CACJ"}

View File

@ -5,7 +5,7 @@
*/
import { keccak256 } from "../crypto/index.js";
import { id } from "../hash/index.js";
import { concat, dataSlice, getBigInt, getBytes, getBytesCopy, hexlify, zeroPadValue, isHexString, defineProperties, assertArgument, toHex, assert } from "../utils/index.js";
import { concat, dataSlice, getBigInt, getBytes, getBytesCopy, hexlify, zeroPadValue, isHexString, defineProperties, assertArgument, toBeHex, assert } from "../utils/index.js";
import { AbiCoder } from "./abi-coder.js";
import { checkResultErrors, Result } from "./coders/abstract-coder.js";
import { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType } from "./fragments.js";
@ -681,7 +681,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string {
value = (value ? "0x01" : "0x00");
}
if (param.type.match(/^u?int/)) {
value = toHex(value);
value = toBeHex(value);
}
// Check addresses are valid
if (param.type === "address") {

File diff suppressed because one or more lines are too long

View File

@ -88,6 +88,20 @@ function fromBase36(value) {
* that you wish to bypass the safegaurds in place to protect
* against an address that has been incorrectly copied from another
* source.
*
* @example:
* // Adds the checksum (via upper-casing specific letters)
* getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72")
* //_result:
*
* // Converts ICAP address and adds checksum
* getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36");
* //_result:
*
* // Throws an error if an address contains mixed case,
* // but the checksum fails
* getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72")
* //_error:
*/
export function getAddress(address) {
assertArgument(typeof (address) === "string", "invalid address", "address", address);
@ -119,6 +133,17 @@ export function getAddress(address) {
* industry [IBAN format](link-wiki-iban] for bank accounts.
*
* It is no longer common or a recommended format.
*
* @example:
* getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72");
* //_result:
*
* getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36");
* //_result:
*
* // Throws an error if the ICAP checksum is wrong
* getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37");
* //_error:
*/
export function getIcapAddress(address) {
//let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase();

View File

@ -1 +1 @@
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src.ts/address/address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAG7D,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAEzB,SAAS,kBAAkB,CAAC,OAAe;IAC3C,sCAAsC;IACtC,2EAA2E;IAC3E,OAAO;IAEH,OAAO,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAEhC,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAE7C,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAA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BAA+B,CAAC,IAAI,MAAM,KAAK,OAAO,EAChF,sBAAsB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAEhD,OAAO,MAAM,CAAC;KACjB;IAED,4CAA4C;IAC5C,IAAI,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,EAAE;QACjD,4CAA4C;QAC5C,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAE3G,IAAI,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC3D,OAAO,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE;YAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;SAAE;QACrD,OAAQ,kBAAkB,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;KAC7C;IAED,cAAc,CAAC,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC1C,2EAA2E;IAC3E,IAAI,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACpE,OAAO,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE;QAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;KAAE;IACrD,OAAO,IAAI,GAAG,YAAY,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;AACzD,CAAC"}

View File

@ -3,12 +3,44 @@ import { getAddress } from "./address.js";
/**
* Returns true if %%value%% is an object which implements the
* [[Addressable]] interface.
*
* @example:
* // Wallets and AbstractSigner sub-classes
* isAddressable(Wallet.createRandom())
* //_result:
*
* // Contracts
* contract = new Contract("dai.tokens.ethers.eth", [ ], provider)
* isAddressable(contract)
* //_result:
*/
export function isAddressable(value) {
return (value && typeof (value.getAddress) === "function");
}
/**
* Returns true if %%value%% is a valid address.
*
* @example:
* // Valid address
* isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72")
* //_result:
*
* // Valid ICAP address
* isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36")
* //_result:
*
* // Invalid checksum
* isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72")
* //_result:
*
* // Invalid ICAP checksum
* isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72")
* //_result:
*
* // Not an address (an ENS name requires a provided and an
* // asynchronous API to access)
* isAddress("ricmoo.eth")
* //_result:
*/
export function isAddress(value) {
try {
@ -33,6 +65,35 @@ async function checkAddress(target, promise) {
*
* If an ENS name is provided, but that name has not been correctly
* configured a [[UnconfiguredNameError]] is thrown.
*
* @example:
* addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F"
*
* // Addresses are return synchronously
* resolveAddress(addr, provider)
* //_result:
*
* // Address promises are resolved asynchronously
* resolveAddress(Promise.resolve(addr))
* //_result:
*
* // ENS names are resolved asynchronously
* resolveAddress("dai.tokens.ethers.eth", provider)
* //_result:
*
* // Addressable objects are resolved asynchronously
* contract = new Contract(addr, [ ])
* resolveAddress(contract, provider)
* //_result:
*
* // Unconfigured ENS names reject
* resolveAddress("nothing-here.ricmoo.eth", provider)
* //_error:
*
* // ENS names require a NameResolver object passed in
* // (notice the provider was omitted)
* resolveAddress("nothing-here.ricmoo.eth")
* //_error:
*/
export function resolveAddress(target, resolver) {
if (typeof (target) === "string") {

View File

@ -1 +1 @@
{"version":3,"file":"checks.js","sourceRoot":"","sources":["../../src.ts/address/checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,U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AE,QAAQ,EAAE,MAAM,CAAC,CAAC;KAC5G;IACD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,UAAU,cAAc,CAAC,MAAmB,EAAE,QAA8B;IAE9E,IAAI,OAAM,CAAC,MAAM,CAAC,KAAK,QAAQ,EAAE;QAC7B,IAAI,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE;YAAE,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;SAAE;QAErE,MAAM,CAAC,QAAQ,IAAI,IAAI,EAAE,oCAAoC,EACzD,uBAAuB,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;QAE3D,OAAO,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;KAE7D;SAAM,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;QAC9B,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;KAEpD;SAAM,IAAI,OAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE;QAC3C,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACvC;IAED,cAAc,CAAC,KAAK,EAAE,+BAA+B,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC7E,CAAC"}

View File

@ -12,6 +12,13 @@ import { getAddress } from "./address.js";
* 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.
*
* @example
* from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72";
* nonce = 5;
*
* getCreateAddress({ from, nonce });
* //_result:
*/
export function getCreateAddress(tx) {
const from = getAddress(tx.from);
@ -34,6 +41,22 @@ export function getCreateAddress(tx) {
*
* To compute the %%initCodeHash%% from a contract's init code, use
* the [[keccak256]] function.
*
* For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]].
*
* @example
* // The address of the contract
* from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"
*
* // The salt
* salt = id("HelloWorld")
*
* // The hash of the initCode
* initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3";
* initCodeHash = keccak256(initCode)
*
* getCreate2Address(from, salt, initCodeHash)
* //_result:
*/
export function getCreate2Address(_from, _salt, _initCodeHash) {
const from = getAddress(_from);

View File

@ -1 +1 @@
{"version":3,"file":"contract-address.js","sourceRoot":"","sources":["../../src.ts/address/contract-address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACH,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EACpE,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,sGAAsG;AAEtG;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAyC;IACtE,MAAM,IAAI,GAAG,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,SAAS,CAAC,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,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,CAAE,IAAI,EAAE,QAAQ,CAAE,CAAC,CAAC,EAAE,EAAE,CAAC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AAC,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,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,CAAE,IAAI,EAAE,QAAQ,CAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/E,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,KAAgB,EAAE,aAAwB;IACvF,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IAE7D,cAAc,CAAC,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE,uBAAuB,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAE3E,cAAc,CAAC,YAAY,CAAC,MAAM,KAAK,EAAE,EAAE,+BAA+B,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;IAE3G,OAAO,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,CAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AAC7F,CAAC"}

View File

@ -1,5 +1,7 @@
/**
* A constant for the zero address.
*
* (**i.e.** ``"0x0000000000000000000000000000000000000000"``)
*/
export const ZeroAddress = "0x0000000000000000000000000000000000000000";
//# sourceMappingURL=addresses.js.map

View File

@ -1 +1 @@
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../src.ts/constants/addresses.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW,4CAA4C,CAAC"}
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../src.ts/constants/addresses.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW,4CAA4C,CAAC"}

View File

@ -1,5 +1,7 @@
/**
* A constant for the zero hash.
*
* (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``)
*/
export const ZeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000";
//# sourceMappingURL=hashes.js.map

View File

@ -1 +1 @@
{"version":3,"file":"hashes.js","sourceRoot":"","sources":["../../src.ts/constants/hashes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAW,oEAAoE,CAAC"}
{"version":3,"file":"hashes.js","sourceRoot":"","sources":["../../src.ts/constants/hashes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAW,oEAAoE,CAAC"}

View File

@ -1,21 +1,31 @@
/**
* A constant for the order N for the secp256k1 curve.
*
* (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``)
*/
export const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
/**
* A constant for the number of wei in a single ether.
*
* (**i.e.** ``1000000000000000000n``)
*/
export const WeiPerEther = BigInt("1000000000000000000");
/**
* A constant for the maximum value for a ``uint256``.
*
* (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)
*/
export const MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
/**
* A constant for the minimum value for an ``int256``.
*
* (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``)
*/
export const MinInt256 = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * BigInt(-1);
/**
* A constant for the maximum value for an ``int256``.
*
* (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)
*/
export const MaxInt256 = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
//# sourceMappingURL=numbers.js.map

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