admin: updated dist files

This commit is contained in:
Richard Moore 2023-05-06 15:16:41 +09:00
parent 1bc8b55d50
commit 13593809bd
56 changed files with 608 additions and 130 deletions

14
dist/ethers.js vendored

@ -6046,7 +6046,6 @@ class SigningKey {
*/
computeSharedSecret(other) {
const pubKey = SigningKey.computePublicKey(other);
console.log(pubKey);
return hexlify(getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey)));
}
/**
@ -9020,6 +9019,10 @@ function hashMessage(message) {
message
]));
}
/**
* Return the address of the private key that produced
* the signature %%sig%% during signing for %%message%%.
*/
function verifyMessage(message, sig) {
const digest = hashMessage(message);
return recoverAddress(digest, sig);
@ -12390,6 +12393,13 @@ class TransactionReceipt {
this.#logs = Object.freeze(tx.logs.map((log) => {
return new Log(log, provider);
}));
let gasPrice = BN_0$2;
if (tx.effectiveGasPrice != null) {
gasPrice = tx.effectiveGasPrice;
}
else if (tx.gasPrice != null) {
gasPrice = tx.gasPrice;
}
defineProperties(this, {
provider,
to: tx.to,
@ -12402,7 +12412,7 @@ class TransactionReceipt {
logsBloom: tx.logsBloom,
gasUsed: tx.gasUsed,
cumulativeGasUsed: tx.cumulativeGasUsed,
gasPrice: (tx.effectiveGasPrice || tx.gasPrice),
gasPrice,
type: tx.type,
//byzantium: tx.byzantium,
status: tx.status,

2
dist/ethers.js.map vendored

File diff suppressed because one or more lines are too long

2
dist/ethers.min.js vendored

File diff suppressed because one or more lines are too long

14
dist/ethers.umd.js vendored

@ -6052,7 +6052,6 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
*/
computeSharedSecret(other) {
const pubKey = SigningKey.computePublicKey(other);
console.log(pubKey);
return hexlify(getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey)));
}
/**
@ -9026,6 +9025,10 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
message
]));
}
/**
* Return the address of the private key that produced
* the signature %%sig%% during signing for %%message%%.
*/
function verifyMessage(message, sig) {
const digest = hashMessage(message);
return recoverAddress(digest, sig);
@ -12396,6 +12399,13 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
this.#logs = Object.freeze(tx.logs.map((log) => {
return new Log(log, provider);
}));
let gasPrice = BN_0$2;
if (tx.effectiveGasPrice != null) {
gasPrice = tx.effectiveGasPrice;
}
else if (tx.gasPrice != null) {
gasPrice = tx.gasPrice;
}
defineProperties(this, {
provider,
to: tx.to,
@ -12408,7 +12418,7 @@ const __$G = (typeof globalThis !== 'undefined' ? globalThis: typeof window !==
logsBloom: tx.logsBloom,
gasUsed: tx.gasUsed,
cumulativeGasUsed: tx.cumulativeGasUsed,
gasPrice: (tx.effectiveGasPrice || tx.gasPrice),
gasPrice,
type: tx.type,
//byzantium: tx.byzantium,
status: tx.status,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

21
lib.commonjs/_tests/index.d.ts vendored Normal file

@ -0,0 +1,21 @@
import "./test-abi.js";
import "./test-address.js";
import "./test-contract.js";
import "./test-crypto.js";
import "./test-hash.js";
import "./test-hash-typeddata.js";
import "./test-providers-avatar.js";
import "./test-providers-ccip.js";
import "./test-providers-wildcard.js";
import "./test-rlp.js";
import "./test-transaction.js";
import "./test-utils-maths.js";
import "./test-utils-misc.js";
import "./test-utils-units.js";
import "./test-utils-utf8.js";
import "./test-wallet.js";
import "./test-wallet-hd.js";
import "./test-wallet-json.js";
import "./test-wallet-mnemonic.js";
import "./test-wordlists.js";
//# sourceMappingURL=index.d.ts.map

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/_tests/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,mBAAmB,CAAA;AAC1B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,gBAAgB,CAAC;AACxB,OAAO,0BAA0B,CAAC;AAClC,OAAO,4BAA4B,CAAC;AACpC,OAAO,0BAA0B,CAAC;AAClC,OAAO,8BAA8B,CAAC;AACtC,OAAO,eAAe,CAAA;AACtB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,2BAA2B,CAAC;AACnC,OAAO,qBAAqB,CAAC"}

@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("./test-abi.js");
require("./test-address.js");
require("./test-contract.js");
require("./test-crypto.js");
require("./test-hash.js");
require("./test-hash-typeddata.js");
require("./test-providers-avatar.js");
require("./test-providers-ccip.js");
require("./test-providers-wildcard.js");
require("./test-rlp.js");
require("./test-transaction.js");
require("./test-utils-maths.js");
require("./test-utils-misc.js");
require("./test-utils-units.js");
require("./test-utils-utf8.js");
require("./test-wallet.js");
require("./test-wallet-hd.js");
require("./test-wallet-json.js");
require("./test-wallet-mnemonic.js");
require("./test-wordlists.js");
////import "./test-contract-integ.js";
////import "./test-providers-data.js";
//import "./test-providers-errors.js";
////import "./test-providers-extra.js";
////import "./test-providers-send.js";
/*
test-crypto-algoswap.ts
*/
//# sourceMappingURL=index.js.map

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/_tests/index.ts"],"names":[],"mappings":";;AAAA,yBAAuB;AACvB,6BAA0B;AAC1B,8BAA4B;AAC5B,4BAA0B;AAC1B,0BAAwB;AACxB,oCAAkC;AAClC,sCAAoC;AACpC,oCAAkC;AAClC,wCAAsC;AACtC,yBAAsB;AACtB,iCAA+B;AAC/B,iCAA+B;AAC/B,gCAA8B;AAC9B,iCAA+B;AAC/B,gCAA8B;AAC9B,4BAA0B;AAC1B,+BAA6B;AAC7B,iCAA+B;AAC/B,qCAAmC;AACnC,+BAA6B;AAE7B,sCAAsC;AAEtC,sCAAsC;AACtC,sCAAsC;AACtC,uCAAuC;AACvC,sCAAsC;AAEtC;;EAEE"}

@ -4,26 +4,27 @@ const tslib_1 = require("tslib");
const assert_1 = tslib_1.__importDefault(require("assert"));
const utils_js_1 = require("./utils.js");
const index_js_1 = require("../index.js");
const index_js_2 = require("../index.js");
describe("test hashing", function () {
const tests = (0, utils_js_1.loadTests)("hashes");
tests.forEach((test) => {
it(`computes sha2-256: ${test.name}`, function () {
assert_1.default.equal((0, index_js_1.sha256)(test.data), test.sha256);
assert_1.default.equal((0, index_js_2.sha256)(test.data), test.sha256);
});
});
tests.forEach((test) => {
it(`computes sha2-512: ${test.name}`, function () {
assert_1.default.equal((0, index_js_1.sha512)(test.data), test.sha512);
assert_1.default.equal((0, index_js_2.sha512)(test.data), test.sha512);
});
});
tests.forEach((test) => {
it(`computes ripemd160: ${test.name}`, function () {
assert_1.default.equal((0, index_js_1.ripemd160)(test.data), test.ripemd160);
assert_1.default.equal((0, index_js_2.ripemd160)(test.data), test.ripemd160);
});
});
tests.forEach((test) => {
it(`computes keccak256: ${test.name}`, function () {
assert_1.default.equal((0, index_js_1.keccak256)(test.data), test.keccak256);
assert_1.default.equal((0, index_js_2.keccak256)(test.data), test.keccak256);
});
});
});
@ -31,31 +32,31 @@ describe("test password-based key derivation", function () {
const tests = (0, utils_js_1.loadTests)("pbkdf");
tests.forEach((test) => {
it(`computes pbkdf2: ${test.name}`, function () {
const password = Buffer.from(test.password.substring(2), "hex");
const salt = Buffer.from(test.salt.substring(2), "hex");
const password = (0, index_js_1.getBytes)(test.password);
const salt = (0, index_js_1.getBytes)(test.salt);
const { iterations, algorithm, key } = test.pbkdf2;
const result = (0, index_js_1.pbkdf2)(password, salt, iterations, test.dkLen, algorithm);
const result = (0, index_js_2.pbkdf2)(password, salt, iterations, test.dkLen, algorithm);
assert_1.default.equal(result, key);
});
});
tests.forEach((test) => {
it(`computes scrypt (sync): ${test.name}`, function () {
this.timeout(1000);
const password = Buffer.from(test.password.substring(2), "hex");
const salt = Buffer.from(test.salt.substring(2), "hex");
const password = (0, index_js_1.getBytes)(test.password);
const salt = (0, index_js_1.getBytes)(test.salt);
const { N, r, p, key } = test.scrypt;
const result = (0, index_js_1.scryptSync)(password, salt, N, r, p, test.dkLen);
const result = (0, index_js_2.scryptSync)(password, salt, N, r, p, test.dkLen);
assert_1.default.equal(result, key);
});
});
tests.forEach((test) => {
it(`computes scrypt (async): ${test.name}`, async function () {
this.timeout(1000);
const password = Buffer.from(test.password.substring(2), "hex");
const salt = Buffer.from(test.salt.substring(2), "hex");
const password = (0, index_js_1.getBytes)(test.password);
const salt = (0, index_js_1.getBytes)(test.salt);
const { N, r, p, key } = test.scrypt;
let progressCount = 0, progressOk = true, lastProgress = -1;
const result = await (0, index_js_1.scrypt)(password, salt, N, r, p, test.dkLen, (progress) => {
const result = await (0, index_js_2.scrypt)(password, salt, N, r, p, test.dkLen, (progress) => {
if (progress < lastProgress) {
progressOk = false;
}
@ -73,7 +74,7 @@ describe("test hmac", function () {
tests.forEach((test) => {
it(`computes hmac: ${test.name}`, async function () {
const { algorithm, key, data } = test;
assert_1.default.equal((0, index_js_1.computeHmac)(algorithm, key, data), test.hmac);
assert_1.default.equal((0, index_js_2.computeHmac)(algorithm, key, data), test.hmac);
});
});
});
@ -466,8 +467,8 @@ describe("tests ECDH shared secret", function () {
];
for (const { name, keyA, keyB, shared } of tests) {
it(`tests shared secrets match: ${name}`, function () {
const signA = new index_js_1.SigningKey(keyA);
const signB = new index_js_1.SigningKey(keyB);
const signA = new index_js_2.SigningKey(keyA);
const signB = new index_js_2.SigningKey(keyB);
assert_1.default.equal(shared, signA.computeSharedSecret(signB.publicKey), "privA + pubB");
assert_1.default.equal(shared, signB.computeSharedSecret(signA.publicKey), "pubA + privB");
assert_1.default.equal(shared, signA.computeSharedSecret(signB.privateKey), "privA + privB");

File diff suppressed because one or more lines are too long

@ -13,7 +13,7 @@ describe("Test RLP Coder", function () {
});
tests.forEach(({ name, encoded, decoded }) => {
it(`decodes RLP: ${name}`, function () {
assert_1.default.deepStrictEqual((0, index_js_1.decodeRlp)(encoded), decoded);
assert_1.default.deepEqual((0, index_js_1.decodeRlp)(encoded), decoded);
});
});
});
@ -44,7 +44,7 @@ describe("Test bad RLP Data", function () {
}, (error) => {
return (error.code === "BUFFER_OVERRUN" &&
error.message.match(/^data too short/) &&
Buffer.from(error.buffer).toString("hex") === "" &&
(0, index_js_1.hexlify)(error.buffer) === "0x" &&
error.offset === 1 &&
error.length === 0);
});
@ -55,7 +55,7 @@ describe("Test bad RLP Data", function () {
}, (error) => {
return (error.code === "BUFFER_OVERRUN" &&
error.message.match(/^child data too short/) &&
Buffer.from(error.buffer).toString("hex") === "c8880102030405060708" &&
(0, index_js_1.hexlify)(error.buffer) === "0xc8880102030405060708" &&
error.offset === 0 &&
error.length === 8);
});
@ -68,7 +68,7 @@ describe("Test bad RLP Data", function () {
}, (error) => {
return (error.code === "BUFFER_OVERRUN" &&
error.message.match(/^data short segment too short/) &&
Buffer.from(error.buffer).toString("hex") === "c8c382c3823145" &&
(0, index_js_1.hexlify)(error.buffer) === "0xc8c382c3823145" &&
error.offset === 9 &&
error.length === 7);
});

@ -1 +1 @@
{"version":3,"file":"test-rlp.js","sourceRoot":"","sources":["../../src.ts/_tests/test-rlp.ts"],"names":[],"mappings":";;;AAAA,4DAA4B;AAE5B,yCAAuC;AAEvC,0CAAmD;AAInD,QAAQ,CAAC,gBAAgB,EAAE;IAEvB,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAc,KAAK,CAAC,CAAC;IAE5C,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QACzC,EAAE,CAAC,gBAAiB,IAAK,EAAE,EAAE;YACzB,gBAAM,CAAC,KAAK,CAAC,IAAA,oBAAS,EAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;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AC,KAAU,EAAE,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,gBAAgB;gBACnC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC;gBAC5C,IAAA,kBAAO,EAAC,KAAK,CAAC,MAAM,CAAC,KAAK,wBAAwB;gBAClD,KAAK,CAAC,MAAM,KAAK,CAAC;gBAClB,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAA;QAC3B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAE,4CAA4C,EAAE;QAC9C,gBAAM,CAAC,MAAM,CAAC,GAAG,EAAE;YACf,wDAAwD;YACxD,6CAA6C;YAC7C,IAAA,oBAAS,EAAC,kBAAkB,CAAC,CAAC;QAClC,CAAC,EAAE,CAAC,KAAU,EAAE,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,gBAAgB;gBACnC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC;gBACpD,IAAA,kBAAO,EAAC,KAAK,CAAC,MAAM,CAAC,KAAK,kBAAkB;gBAC5C,KAAK,CAAC,MAAM,KAAK,CAAC;gBAClB,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAA;QAC3B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH;;;;;;;;;;;;;EAaE"}

@ -2,19 +2,11 @@
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const assert_1 = tslib_1.__importDefault(require("assert"));
const wordlists_js_1 = require("../wordlists/wordlists.js");
const utils_js_1 = require("./utils.js");
const index_js_1 = require("../index.js");
/*
declare global {
class TextDecoder {
decode(data: Uint8Array): string;
}
}
*/
const decoder = new TextDecoder();
function fromHex(hex) {
const data = Buffer.from(hex.substring(2), "hex");
const data = (0, index_js_1.getBytes)(hex);
return decoder.decode(data);
}
describe("Test HDWallets", function () {
@ -41,7 +33,7 @@ describe("Test HDWallets", function () {
// are safe as ascii7 values for viewing, printing, etc.
const phrase = fromHex(test.phrase);
const password = fromHex(test.password);
const wordlist = wordlists_js_1.wordlists[test.locale];
const wordlist = index_js_1.wordlists[test.locale];
if (wordlist == null) {
it(`tests ${test.name}`, function () {
this.skip();

File diff suppressed because one or more lines are too long

@ -11,7 +11,7 @@ describe("Tests JSON Wallet Formats", function () {
return;
}
it(`tests decrypting Crowdsale JSON: ${test.name}`, async function () {
const password = Buffer.from(test.password.substring(2), "hex");
const password = (0, index_js_1.getBytes)(test.password);
const account = (0, index_js_1.decryptCrowdsaleJson)(test.content, password);
assert_1.default.equal(account.address, test.address, "address");
});
@ -22,7 +22,7 @@ describe("Tests JSON Wallet Formats", function () {
}
it(`tests decrypting Keystore JSON (sync): ${test.name}`, function () {
this.timeout(20000);
const password = Buffer.from(test.password.substring(2), "hex");
const password = (0, index_js_1.getBytes)(test.password);
const account = (0, index_js_1.decryptKeystoreJsonSync)(test.content, password);
//console.log(account);
assert_1.default.equal(account.address, test.address, "address");
@ -34,7 +34,7 @@ describe("Tests JSON Wallet Formats", function () {
}
it(`tests decrypting Keystore JSON (async): ${test.name}`, async function () {
this.timeout(20000);
const password = Buffer.from(test.password.substring(2), "hex");
const password = (0, index_js_1.getBytes)(test.password);
const account = await (0, index_js_1.decryptKeystoreJson)(test.content, password);
//console.log(account);
assert_1.default.equal(account.address, test.address, "address");
@ -43,7 +43,7 @@ describe("Tests JSON Wallet Formats", function () {
tests.forEach((test) => {
it(`tests decrypting JSON (sync): ${test.name}`, function () {
this.timeout(20000);
const password = Buffer.from(test.password.substring(2), "hex");
const password = (0, index_js_1.getBytes)(test.password);
const wallet = index_js_1.Wallet.fromEncryptedJsonSync(test.content, password);
//console.log(wallet);
assert_1.default.equal(wallet.address, test.address, "address");
@ -52,7 +52,7 @@ describe("Tests JSON Wallet Formats", function () {
tests.forEach((test) => {
it(`tests decrypting JSON (async): ${test.name}`, async function () {
this.timeout(20000);
const password = Buffer.from(test.password.substring(2), "hex");
const password = (0, index_js_1.getBytes)(test.password);
const wallet = await index_js_1.Wallet.fromEncryptedJson(test.content, password);
//console.log(wallet);
assert_1.default.equal(wallet.address, test.address, "address");

File diff suppressed because one or more lines are too long

@ -2,14 +2,11 @@
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const assert_1 = tslib_1.__importDefault(require("assert"));
const index_js_1 = require("../crypto/index.js");
const utf8_js_1 = require("../utils/utf8.js");
const wordlists_js_1 = require("../wordlists/wordlists.js");
const index_js_2 = require("../index.js");
const index_js_1 = require("../index.js");
const utils_js_1 = require("./utils.js");
const decoder = new TextDecoder();
function fromHex(hex) {
const data = Buffer.from(hex.substring(2), "hex");
const data = (0, index_js_1.getBytes)(hex);
return decoder.decode(data);
}
function repeat(text, length) {
@ -22,17 +19,17 @@ function repeat(text, length) {
describe("Tests Mnemonics", function () {
const tests = (0, utils_js_1.loadTests)("mnemonics");
function runTest(phrase, mnemonic, test) {
assert_1.default.ok(index_js_2.Mnemonic.isValidMnemonic(phrase, mnemonic.wordlist), "isValidMnemonic");
assert_1.default.ok(index_js_1.Mnemonic.isValidMnemonic(phrase, mnemonic.wordlist), "isValidMnemonic");
if (test.locale === "en") {
assert_1.default.ok(index_js_2.Mnemonic.isValidMnemonic(phrase), "isValidMnemonic (default)");
assert_1.default.ok(index_js_1.Mnemonic.isValidMnemonic(phrase), "isValidMnemonic (default)");
}
assert_1.default.equal(mnemonic.wordlist.locale, test.locale, "locale");
assert_1.default.equal(mnemonic.entropy, test.entropy, "entropy");
assert_1.default.equal(mnemonic.computeSeed(), test.seed, "seed");
assert_1.default.equal((0, index_js_1.sha256)((0, utf8_js_1.toUtf8Bytes)(phrase)), test.phraseHash, "phraseHash");
assert_1.default.equal((0, index_js_1.sha256)((0, index_js_1.toUtf8Bytes)(phrase)), test.phraseHash, "phraseHash");
}
for (const test of tests) {
const wordlist = wordlists_js_1.wordlists[test.locale];
const wordlist = index_js_1.wordlists[test.locale];
it(`computes mnemonic from phrase: ${test.name}`, function () {
if (wordlist == null) {
this.skip();
@ -40,12 +37,12 @@ describe("Tests Mnemonics", function () {
}
const phrase = fromHex(test.phrase);
const password = fromHex(test.password);
const mnemonic = index_js_2.Mnemonic.fromPhrase(phrase, password, wordlist);
const mnemonic = index_js_1.Mnemonic.fromPhrase(phrase, password, wordlist);
runTest(phrase, mnemonic, test);
});
}
for (const test of tests) {
const wordlist = wordlists_js_1.wordlists[test.locale];
const wordlist = index_js_1.wordlists[test.locale];
it(`computes mnemonic from entropy: ${test.name}`, function () {
if (wordlist == null) {
this.skip();
@ -53,7 +50,7 @@ describe("Tests Mnemonics", function () {
}
const phrase = fromHex(test.phrase);
const password = fromHex(test.password);
const mnemonic = index_js_2.Mnemonic.fromEntropy(test.entropy, password, wordlist);
const mnemonic = index_js_1.Mnemonic.fromEntropy(test.entropy, password, wordlist);
runTest(phrase, mnemonic, test);
});
}
@ -67,9 +64,9 @@ describe("Tests Bad Mnemonics Fail", function () {
for (const _phrase of badLengths) {
const phrase = _phrase.join(" ");
it(`correctly fails on invalid mnemonic length: ${_phrase.length}`, function () {
assert_1.default.ok(!index_js_2.Mnemonic.isValidMnemonic(phrase));
assert_1.default.ok(!index_js_1.Mnemonic.isValidMnemonic(phrase));
assert_1.default.throws(function () {
index_js_2.Mnemonic.fromPhrase(phrase);
index_js_1.Mnemonic.fromPhrase(phrase);
}, function (error) {
return (error.code === "INVALID_ARGUMENT" &&
error.message.match(/^invalid mnemonic length/) &&
@ -80,9 +77,9 @@ describe("Tests Bad Mnemonics Fail", function () {
}
it("correctly fails on invalid mnemonic word", function () {
const phrase = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon wagmi";
assert_1.default.ok(!index_js_2.Mnemonic.isValidMnemonic(phrase));
assert_1.default.ok(!index_js_1.Mnemonic.isValidMnemonic(phrase));
assert_1.default.throws(function () {
index_js_2.Mnemonic.fromPhrase(phrase);
index_js_1.Mnemonic.fromPhrase(phrase);
}, function (error) {
return (error.code === "INVALID_ARGUMENT" &&
error.message.match(/^invalid mnemonic word at index 11/) &&
@ -92,9 +89,9 @@ describe("Tests Bad Mnemonics Fail", function () {
});
it("correctly fails on invalid mnemonic checksum", function () {
const phrase = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon";
assert_1.default.ok(!index_js_2.Mnemonic.isValidMnemonic(phrase));
assert_1.default.ok(!index_js_1.Mnemonic.isValidMnemonic(phrase));
assert_1.default.throws(function () {
index_js_2.Mnemonic.fromPhrase(phrase);
index_js_1.Mnemonic.fromPhrase(phrase);
}, function (error) {
return (error.code === "INVALID_ARGUMENT" &&
error.message.match(/^invalid mnemonic checksum/) &&
@ -111,7 +108,7 @@ describe("Tests Bad Mnemonics Fail", function () {
const entropy = "0x" + _entropy.join("");
it(`correctly fails on invalid entropy length: ${_entropy.length}`, function () {
assert_1.default.throws(function () {
index_js_2.Mnemonic.fromEntropy(entropy);
index_js_1.Mnemonic.fromEntropy(entropy);
}, function (error) {
return (error.code === "INVALID_ARGUMENT" &&
error.message.match(/^invalid entropy size/) &&

@ -1 +1 @@
{"version":3,"file":"test-wallet-mnemonic.js","sourceRoot":"","sources":["../../src.ts/_tests/test-wallet-mnemonic.ts"],"names":[],"mappings":";;;AACA,4DAA4B;AAE5B,iDAA4C;AAC5C,8CAA+C;AAE/C,4DAAsD;AAEtD,0CAAuC;AAEvC,yCAAuC;AAGvC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAClC,SAAS,OAAO,CAAC,GAAW;IACxB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAClD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,MAAM,CAAC,IAAY,EAAE,MAAc;IACxC,MAAM,MAAM,GAAG,EAAG,CAAC;IACnB,OAAO,MAAM,CAAC,MAA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CAAC,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC;oBAC5C,KAAK,CAAC,QAAQ,KAAK,SAAS;oBAC5B,KAAK,CAAC,KAAK,KAAK,cAAc,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;KACN;AACL,CAAC,CAAC,CAAA"}

@ -2,12 +2,12 @@
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const assert_1 = tslib_1.__importDefault(require("assert"));
const wordlists_js_1 = require("../wordlists/wordlists.js");
const index_js_1 = require("../index.js");
const utils_js_1 = require("./utils.js");
describe('Check Wordlists', function () {
const tests = (0, utils_js_1.loadTests)("wordlists");
tests.forEach((test) => {
let wordlist = wordlists_js_1.wordlists[test.locale];
let wordlist = index_js_1.wordlists[test.locale];
if (wordlist == null) {
return;
}
@ -24,7 +24,7 @@ describe('Check Wordlists', function () {
});
});
tests.forEach((test) => {
let wordlist = wordlists_js_1.wordlists[test.locale];
let wordlist = index_js_1.wordlists[test.locale];
if (wordlist == null) {
return;
}
@ -36,12 +36,12 @@ describe('Check Wordlists', function () {
const phrase = wordlist.join(words);
const words2 = wordlist.split(phrase);
const phrase2 = wordlist.join(words2);
assert_1.default.deepStrictEqual(words2, words, "split words");
assert_1.default.deepStrictEqual(phrase2, phrase, "re-joined words");
assert_1.default.deepEqual(words2, words, "split words");
assert_1.default.deepEqual(phrase2, phrase, "re-joined words");
});
});
tests.forEach((test) => {
let wordlist = wordlists_js_1.wordlists[test.locale];
let wordlist = index_js_1.wordlists[test.locale];
if (wordlist == null) {
return;
}

@ -1 +1 @@
{"version":3,"file":"test-wordlists.js","sourceRoot":"","sources":["../../src.ts/_tests/test-wordlists.ts"],"names":[],"mappings":";;;AAAA,4DAA4B;AAE5B,4DAAsD;AAEtD,yCAAuC;AAMvC,QAAQ,CAAC,iBAAiB,EAAE;IACxB,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAmB,WAAW,CAAC,CAAC;IAEvD,KA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IAEjF;;;;;;OAMG;IACH,IAAI,mBAAmB,IAAI,MAAM,CAAgE;IAEjG;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS;IAgBlC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAK7C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;IAqBrE;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM;IAY5E;;;;;;;;;OASG;IACH,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;CAK/E"}

@ -88,7 +88,6 @@ class SigningKey {
*/
computeSharedSecret(other) {
const pubKey = SigningKey.computePublicKey(other);
console.log(pubKey);
return (0, index_js_1.hexlify)(secp256k1.getSharedSecret((0, index_js_1.getBytesCopy)(this.#privateKey), (0, index_js_1.getBytes)(pubKey)));
}
/**

@ -1 +1 @@
{"version":3,"file":"signing-key.js","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;AAEH,oEAA8C;AAE9C,gDAG2B;AAE3B,uCAAwC;AACxC,iDAA2C;AAO3C,yFAAyF;AAEzF,4BAA4B;AAC5B,SAAS,CAAC,KAAK,CAAC,cAAc,GAAG,UAAS,GAAe,EAAE,GAAG,QAA2B;IACrF,OAAO,IAAA,mBAAQ,EAAC,IAAA,qBAAW,EAAC,QAAQ,EAAE,GAAG,EAAE,IAAA,iBAAM,EAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC,CAAA;AAED;;;GAGG;AACH,MAAa,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CAAC,CAAC;QAClF,IAAA,yBAAc,EAAC,MAAM,IAAI,IAAI,EAAE,8BAA8B,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QAEvF,OAAO,IAAA,kBAAO,EAAC,MAAM,CAAC,CAAC;IAC3B,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;AA1KD,gCA0KC"}

File diff suppressed because one or more lines are too long

@ -453,6 +453,13 @@ class TransactionReceipt {
this.#logs = Object.freeze(tx.logs.map((log) => {
return new Log(log, provider);
}));
let gasPrice = BN_0;
if (tx.effectiveGasPrice != null) {
gasPrice = tx.effectiveGasPrice;
}
else if (tx.gasPrice != null) {
gasPrice = tx.gasPrice;
}
(0, index_js_1.defineProperties)(this, {
provider,
to: tx.to,
@ -465,7 +472,7 @@ class TransactionReceipt {
logsBloom: tx.logsBloom,
gasUsed: tx.gasUsed,
cumulativeGasUsed: tx.cumulativeGasUsed,
gasPrice: (tx.effectiveGasPrice || tx.gasPrice),
gasPrice,
type: tx.type,
//byzantium: tx.byzantium,
status: tx.status,

File diff suppressed because one or more lines are too long

32
lib.esm/_admin/test-browser.d.ts vendored Normal file

@ -0,0 +1,32 @@
/**
*
*
* Paths
* /index.js => dist/ethers.js
* /tests/utils.js => in-memory hijack
* /static/* => output/*
* - index.html
* - assert.js
* /tests/* => lib.esm/_tests/*
*/
/// <reference types="node" />
import { WebSocket } from "ws";
import { Server } from "http";
export declare function getMime(filename: string): string;
export declare class CDPSession {
#private;
readonly websocket: WebSocket;
constructor(url: string);
get target(): string;
get ready(): Promise<void>;
get done(): Promise<number>;
send(method: string, params: any): Promise<any>;
_send(method: string, params: any): Promise<any>;
navigate(url: string): Promise<void>;
}
export type Options = {
port?: number;
redirects?: Record<string, string>;
};
export declare function start(_root: string, options: Options): Promise<Server>;
//# sourceMappingURL=test-browser.d.ts.map

@ -0,0 +1 @@
{"version":3,"file":"test-browser.d.ts","sourceRoot":"","sources":["../../src.ts/_admin/test-browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;AAQH,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAE/B,OAAO,EAAgB,MAAM,EAAE,MAAM,MAAM,CAAC;AAuB5C,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAShD;AAOD,qBAAa,UAAU;;IACnB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;gBAclB,GAAG,EAAE,MAAM;IA4EvB,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAKzB;IAED,IAAI,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAE1B;IAEK,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAO/C,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAahD,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7C;AAED,MAAM,MAAM,OAAO,GAAG;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC,CAAC;AAgCF,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAyGtE"}

@ -0,0 +1,326 @@
/**
*
*
* Paths
* /index.js => dist/ethers.js
* /tests/utils.js => in-memory hijack
* /static/* => output/*
* - index.html
* - assert.js
* /tests/* => lib.esm/_tests/*
*/
// See: https://vanilla.aslushnikov.com/?Console
import fs from "fs";
import child_process from "child_process";
import zlib from "zlib";
import { WebSocket } from "ws";
import { createServer } from "http";
import { join, resolve } from "path";
const mimes = {
css: "text/css",
doctree: "application/x-doctree",
eot: "application/vnd.ms-fontobject",
gif: "image/gif",
html: "text/html",
ico: "image/x-icon",
js: "application/javascript",
jpg: "image/jpeg",
jpeg: "image/jpeg",
json: "application/json",
map: "application/json",
md: "text/markdown",
png: "image/png",
svg: "image/svg+xml",
ttf: "application/x-font-ttf",
txt: "text/plain",
woff: "application/font-woff"
};
export function getMime(filename) {
const mime = mimes[(filename.split('.').pop() || "").toLowerCase()];
if (mime == null) {
console.log(`WARN: NO MIME for ${filename}`);
return "application/octet-stream";
}
return mime;
}
export class CDPSession {
websocket;
#id;
#resp;
#readyOpen;
#readyPage;
#target;
#session;
#done;
#exit;
constructor(url) {
this.websocket = new WebSocket(url);
this.#id = 1;
this.#resp = new Map();
this.#exit = (status) => { };
this.#done = new Promise((resolve) => {
this.#exit = resolve;
});
this.#target = "";
this.#session = "";
const readyOpen = new Promise((resolve, reject) => {
this.websocket.onopen = async () => { resolve(); };
});
const readyPage = (async () => {
await readyOpen;
const target = await this._send("Target.getTargets", {});
if (target.targetInfos.length) {
this.#target = target.targetInfos[0].targetId;
}
else {
const target = await this._send("Target.createTarget", { url: "" });
this.#target = target.targetId;
}
const attached = await this._send("Target.attachToTarget", {
targetId: this.#target,
flatten: true
});
this.#session = attached.sessionId;
})();
this.#readyOpen = readyOpen;
this.#readyPage = readyPage;
this.websocket.onmessage = (_msg) => {
const msg = JSON.parse(_msg.data);
if (msg.id != null) {
const responder = this.#resp.get(msg.id);
this.#resp.delete(msg.id);
if (responder == null) {
console.log("WARN: unknown request ${ msg.id }");
return;
}
if (msg.error) {
responder.reject(new Error(msg.error));
}
else {
responder.resolve(msg.result);
}
}
else {
if (msg.method === "Console.messageAdded") {
const text = msg.params.message.text;
if (text.startsWith("#status")) {
this.#exit(parseInt(text.split("=").pop()));
}
console.log(text);
//console.log(msg.params.message.text, `${ msg.params.message.url }:${ msg.params.message.line }`);
}
else if (msg.method === "Target.attachedToTarget") {
}
else {
console.log(`WARN: Unhandled event - ${JSON.stringify(msg)}`);
}
}
};
this.websocket.onerror = (error) => {
console.log(`WARN: WebSocket error - ${JSON.stringify(error)}`);
};
}
get target() {
return this.#target;
}
get ready() {
return (async () => {
await this.#readyOpen;
await this.#readyPage;
})();
}
get done() {
return this.#done;
}
async send(method, params) {
await this.#readyOpen;
await this.#readyPage;
return this._send(method, params);
}
async _send(method, params) {
const id = this.#id++;
const payload = { id, method, params };
if (this.#session) {
payload.sessionId = this.#session;
}
this.websocket.send(JSON.stringify(payload));
return new Promise((resolve, reject) => {
this.#resp.set(id, { resolve, reject });
});
}
async navigate(url) {
await this.send("Page.navigate", { url });
}
}
const TestData = (function () {
function load(tag) {
const filename = resolve("testcases", tag + ".json.gz");
const data = zlib.gunzipSync(fs.readFileSync(filename));
return [String(data.length), zlib.deflateRawSync(data).toString("base64")].join(",");
}
let data = [];
data.push(`import { ethers } from "/index.js";`);
data.push(`import { inflate } from "/static/tiny-inflate.js";`);
data.push(`const fs = new Map();`);
for (const filename of fs.readdirSync("testcases")) {
if (!filename.endsWith(".json.gz")) {
continue;
}
const tag = filename.split(".")[0];
data.push(`fs.set(${JSON.stringify(tag)}, ${JSON.stringify(load(tag))});`);
}
data.push(`export function loadTests(tag) {`);
data.push(` const data = fs.get(tag);`);
data.push(` if (data == null) { throw new Error("missing tag: " + tag); }`);
data.push(` const comps = data.split(",");`);
data.push(` const result = new Uint8Array(parseInt(comps[0]));`);
data.push(` inflate(ethers.decodeBase64(comps[1]), result);`);
data.push(` return JSON.parse(ethers.toUtf8String(result))`);
data.push(`}`);
return data.join("\n");
})();
export function start(_root, options) {
if (options == null) {
options = {};
}
if (options.port == null) {
options.port = 8000;
}
const server = createServer((req, resp) => {
const url = (req.url || "").split("?")[0];
let transform = false;
let filename;
if (url === "/") {
filename = "./misc/test-browser/index.html";
}
else if (url === "/ethers.js" || url === "/index.js") {
filename = "./dist/ethers.js";
}
else if (url === "/ethers.js.map") {
filename = "./dist/ethers.js.map";
}
else if (url.startsWith("/static/")) {
filename = "./misc/test-browser/" + url.substring(8);
}
else if (url === "/tests/utils.js") {
//console.log({ status: 200, content: `<<in-memory ${ TestData.length } bytes>>` });
resp.writeHead(200, {
"Content-Length": TestData.length,
"Content-Type": getMime("testdata.js")
});
resp.end(TestData);
return;
}
else if (url.startsWith("/tests/")) {
transform = true;
filename = join("./lib.esm/_tests", url.substring(7));
}
else {
//console.log("FALLBACK");
filename = url.substring(1);
}
// Make sure we aren't crawling out of our sandbox
if (url[0] !== "/" || filename.substring(0, filename.length) !== filename) {
//console.log({ status: 403, reason: "escaping" });
resp.writeHead(403);
resp.end();
return;
}
try {
const stat = fs.statSync(filename);
if (stat.isDirectory()) {
// Redirect bare directory to its path (i.e. "/foo" => "/foo/")
if (url[url.length - 1] !== "/") {
//console.log({ status: 301, location: (url + "/") });
resp.writeHead(301, { Location: url + "/" });
resp.end();
return;
}
filename += "/index.html";
}
let content = fs.readFileSync(filename);
if (transform) {
content = Buffer.from(content.toString().replace(/import ([^;]*) from "([^"]*)";/g, (all, names, filename) => {
switch (filename) {
case "assert":
//case "path":
//case "fs":
//case "zlib":
return `import ${names} from "/static/${filename}.js"`;
}
return all;
}));
}
//console.log({ status: 200, filename });
resp.writeHead(200, {
"Content-Length": content.length,
"Content-Type": getMime(filename)
});
resp.end(content);
return;
}
catch (error) {
if (error.code === "ENOENT") {
//console.log({ status: 404, filename });
console.log(`WARN: Not found - ${filename}`);
resp.writeHead(404, {});
resp.end();
return;
}
//console.log({ status: 500, error: error.toString() });
console.log(`WARN: Server error - ${error.toString()}`);
resp.writeHead(500, {});
resp.end();
return;
}
});
return new Promise((resolve, reject) => {
server.listen(options.port, () => {
console.log(`Server running on: http://localhost:${options.port}`);
resolve(server);
});
});
}
(async function () {
await start(resolve("."), { port: 8000 });
const cmds = [
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
"/usr/bin/chromium"
].filter((f) => { try {
fs.accessSync(f);
return true;
}
catch (error) {
return false;
} });
if (cmds.length === 0) {
throw new Error("no installed browser found");
}
const cmd = cmds[0];
const args = ["--headless", "--disable-gpu", "--remote-debugging-port=8022"];
const browser = child_process.spawn(cmd, args);
let url = await new Promise((resolve, reject) => {
browser.stdout.on("data", (data) => {
console.log("OUT", data.toString());
});
browser.stderr.on("data", (data) => {
const text = data.toString();
for (const line of text.split("\n")) {
const match = line.match(/^DevTools listening on (.*)$/);
if (match) {
resolve(match[1]);
return;
}
}
});
});
console.log("URL:", url);
const session = new CDPSession(url);
await session.ready;
await session.send("Console.enable", {});
await session.navigate("http:/\/localhost:8000");
const status = await session.done;
console.log("STATUS:", status);
process.exit(status);
})();
//# sourceMappingURL=test-browser.js.map

File diff suppressed because one or more lines are too long

21
lib.esm/_tests/index.d.ts vendored Normal file

@ -0,0 +1,21 @@
import "./test-abi.js";
import "./test-address.js";
import "./test-contract.js";
import "./test-crypto.js";
import "./test-hash.js";
import "./test-hash-typeddata.js";
import "./test-providers-avatar.js";
import "./test-providers-ccip.js";
import "./test-providers-wildcard.js";
import "./test-rlp.js";
import "./test-transaction.js";
import "./test-utils-maths.js";
import "./test-utils-misc.js";
import "./test-utils-units.js";
import "./test-utils-utf8.js";
import "./test-wallet.js";
import "./test-wallet-hd.js";
import "./test-wallet-json.js";
import "./test-wallet-mnemonic.js";
import "./test-wordlists.js";
//# sourceMappingURL=index.d.ts.map

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/_tests/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,mBAAmB,CAAA;AAC1B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,gBAAgB,CAAC;AACxB,OAAO,0BAA0B,CAAC;AAClC,OAAO,4BAA4B,CAAC;AACpC,OAAO,0BAA0B,CAAC;AAClC,OAAO,8BAA8B,CAAC;AACtC,OAAO,eAAe,CAAA;AACtB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,2BAA2B,CAAC;AACnC,OAAO,qBAAqB,CAAC"}

29
lib.esm/_tests/index.js Normal file

@ -0,0 +1,29 @@
import "./test-abi.js";
import "./test-address.js";
import "./test-contract.js";
import "./test-crypto.js";
import "./test-hash.js";
import "./test-hash-typeddata.js";
import "./test-providers-avatar.js";
import "./test-providers-ccip.js";
import "./test-providers-wildcard.js";
import "./test-rlp.js";
import "./test-transaction.js";
import "./test-utils-maths.js";
import "./test-utils-misc.js";
import "./test-utils-units.js";
import "./test-utils-utf8.js";
import "./test-wallet.js";
import "./test-wallet-hd.js";
import "./test-wallet-json.js";
import "./test-wallet-mnemonic.js";
import "./test-wordlists.js";
////import "./test-contract-integ.js";
////import "./test-providers-data.js";
//import "./test-providers-errors.js";
////import "./test-providers-extra.js";
////import "./test-providers-send.js";
/*
test-crypto-algoswap.ts
*/
//# sourceMappingURL=index.js.map

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/_tests/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,mBAAmB,CAAA;AAC1B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,gBAAgB,CAAC;AACxB,OAAO,0BAA0B,CAAC;AAClC,OAAO,4BAA4B,CAAC;AACpC,OAAO,0BAA0B,CAAC;AAClC,OAAO,8BAA8B,CAAC;AACtC,OAAO,eAAe,CAAA;AACtB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,2BAA2B,CAAC;AACnC,OAAO,qBAAqB,CAAC;AAE7B,sCAAsC;AAEtC,sCAAsC;AACtC,sCAAsC;AACtC,uCAAuC;AACvC,sCAAsC;AAEtC;;EAEE"}

@ -1,5 +1,6 @@
import assert from "assert";
import { loadTests } from "./utils.js";
import { getBytes } from "../index.js";
import { computeHmac, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, SigningKey } from "../index.js";
describe("test hashing", function () {
const tests = loadTests("hashes");
@ -28,8 +29,8 @@ describe("test password-based key derivation", function () {
const tests = loadTests("pbkdf");
tests.forEach((test) => {
it(`computes pbkdf2: ${test.name}`, function () {
const password = Buffer.from(test.password.substring(2), "hex");
const salt = Buffer.from(test.salt.substring(2), "hex");
const password = getBytes(test.password);
const salt = getBytes(test.salt);
const { iterations, algorithm, key } = test.pbkdf2;
const result = pbkdf2(password, salt, iterations, test.dkLen, algorithm);
assert.equal(result, key);
@ -38,8 +39,8 @@ describe("test password-based key derivation", function () {
tests.forEach((test) => {
it(`computes scrypt (sync): ${test.name}`, function () {
this.timeout(1000);
const password = Buffer.from(test.password.substring(2), "hex");
const salt = Buffer.from(test.salt.substring(2), "hex");
const password = getBytes(test.password);
const salt = getBytes(test.salt);
const { N, r, p, key } = test.scrypt;
const result = scryptSync(password, salt, N, r, p, test.dkLen);
assert.equal(result, key);
@ -48,8 +49,8 @@ describe("test password-based key derivation", function () {
tests.forEach((test) => {
it(`computes scrypt (async): ${test.name}`, async function () {
this.timeout(1000);
const password = Buffer.from(test.password.substring(2), "hex");
const salt = Buffer.from(test.salt.substring(2), "hex");
const password = getBytes(test.password);
const salt = getBytes(test.salt);
const { N, r, p, key } = test.scrypt;
let progressCount = 0, progressOk = true, lastProgress = -1;
const result = await scrypt(password, salt, N, r, p, test.dkLen, (progress) => {

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
import assert from "assert";
import { loadTests } from "./utils.js";
import { decodeRlp, encodeRlp } from "../index.js";
import { decodeRlp, encodeRlp, hexlify } from "../index.js";
describe("Test RLP Coder", function () {
const tests = loadTests("rlp");
tests.forEach(({ name, encoded, decoded }) => {
@ -10,7 +10,7 @@ describe("Test RLP Coder", function () {
});
tests.forEach(({ name, encoded, decoded }) => {
it(`decodes RLP: ${name}`, function () {
assert.deepStrictEqual(decodeRlp(encoded), decoded);
assert.deepEqual(decodeRlp(encoded), decoded);
});
});
});
@ -41,7 +41,7 @@ describe("Test bad RLP Data", function () {
}, (error) => {
return (error.code === "BUFFER_OVERRUN" &&
error.message.match(/^data too short/) &&
Buffer.from(error.buffer).toString("hex") === "" &&
hexlify(error.buffer) === "0x" &&
error.offset === 1 &&
error.length === 0);
});
@ -52,7 +52,7 @@ describe("Test bad RLP Data", function () {
}, (error) => {
return (error.code === "BUFFER_OVERRUN" &&
error.message.match(/^child data too short/) &&
Buffer.from(error.buffer).toString("hex") === "c8880102030405060708" &&
hexlify(error.buffer) === "0xc8880102030405060708" &&
error.offset === 0 &&
error.length === 8);
});
@ -65,7 +65,7 @@ describe("Test bad RLP Data", function () {
}, (error) => {
return (error.code === "BUFFER_OVERRUN" &&
error.message.match(/^data short segment too short/) &&
Buffer.from(error.buffer).toString("hex") === "c8c382c3823145" &&
hexlify(error.buffer) === "0xc8c382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C;gBACpD,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,kBAAkB;gBAC5C,KAAK,CAAC,MAAM,KAAK,CAAC;gBAClB,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAA;QAC3B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH;;;;;;;;;;;;;EAaE"}

@ -1,17 +1,9 @@
import assert from "assert";
import { wordlists } from "../wordlists/wordlists.js";
import { loadTests } from "./utils.js";
import { HDNodeWallet, HDNodeVoidWallet, Mnemonic } from "../index.js";
/*
declare global {
class TextDecoder {
decode(data: Uint8Array): string;
}
}
*/
import { getBytes, wordlists, HDNodeWallet, HDNodeVoidWallet, Mnemonic } from "../index.js";
const decoder = new TextDecoder();
function fromHex(hex) {
const data = Buffer.from(hex.substring(2), "hex");
const data = getBytes(hex);
return decoder.decode(data);
}
describe("Test HDWallets", function () {

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
import assert from "assert";
import { loadTests } from "./utils.js";
import { isError, decryptCrowdsaleJson, decryptKeystoreJson, decryptKeystoreJsonSync, encryptKeystoreJson, encryptKeystoreJsonSync, isCrowdsaleJson, HDNodeWallet, Wallet } from "../index.js";
import { isError, getBytes, decryptCrowdsaleJson, decryptKeystoreJson, decryptKeystoreJsonSync, encryptKeystoreJson, encryptKeystoreJsonSync, isCrowdsaleJson, HDNodeWallet, Wallet } from "../index.js";
describe("Tests JSON Wallet Formats", function () {
const tests = loadTests("wallets");
tests.forEach((test) => {
@ -8,7 +8,7 @@ describe("Tests JSON Wallet Formats", function () {
return;
}
it(`tests decrypting Crowdsale JSON: ${test.name}`, async function () {
const password = Buffer.from(test.password.substring(2), "hex");
const password = getBytes(test.password);
const account = decryptCrowdsaleJson(test.content, password);
assert.equal(account.address, test.address, "address");
});
@ -19,7 +19,7 @@ describe("Tests JSON Wallet Formats", function () {
}
it(`tests decrypting Keystore JSON (sync): ${test.name}`, function () {
this.timeout(20000);
const password = Buffer.from(test.password.substring(2), "hex");
const password = getBytes(test.password);
const account = decryptKeystoreJsonSync(test.content, password);
//console.log(account);
assert.equal(account.address, test.address, "address");
@ -31,7 +31,7 @@ describe("Tests JSON Wallet Formats", function () {
}
it(`tests decrypting Keystore JSON (async): ${test.name}`, async function () {
this.timeout(20000);
const password = Buffer.from(test.password.substring(2), "hex");
const password = getBytes(test.password);
const account = await decryptKeystoreJson(test.content, password);
//console.log(account);
assert.equal(account.address, test.address, "address");
@ -40,7 +40,7 @@ describe("Tests JSON Wallet Formats", function () {
tests.forEach((test) => {
it(`tests decrypting JSON (sync): ${test.name}`, function () {
this.timeout(20000);
const password = Buffer.from(test.password.substring(2), "hex");
const password = getBytes(test.password);
const wallet = Wallet.fromEncryptedJsonSync(test.content, password);
//console.log(wallet);
assert.equal(wallet.address, test.address, "address");
@ -49,7 +49,7 @@ describe("Tests JSON Wallet Formats", function () {
tests.forEach((test) => {
it(`tests decrypting JSON (async): ${test.name}`, async function () {
this.timeout(20000);
const password = Buffer.from(test.password.substring(2), "hex");
const password = getBytes(test.password);
const wallet = await Wallet.fromEncryptedJson(test.content, password);
//console.log(wallet);
assert.equal(wallet.address, test.address, "address");

File diff suppressed because one or more lines are too long

@ -1,12 +1,9 @@
import assert from "assert";
import { sha256 } from "../crypto/index.js";
import { toUtf8Bytes } from "../utils/utf8.js";
import { wordlists } from "../wordlists/wordlists.js";
import { Mnemonic } from "../index.js";
import { getBytes, sha256, toUtf8Bytes, Mnemonic, wordlists, } from "../index.js";
import { loadTests } from "./utils.js";
const decoder = new TextDecoder();
function fromHex(hex) {
const data = Buffer.from(hex.substring(2), "hex");
const data = getBytes(hex);
return decoder.decode(data);
}
function repeat(text, length) {

@ -1 +1 @@
{"version":3,"file":"test-wallet-mnemonic.js","sourceRoot":"","sources":["../../src.ts/_tests/test-wallet-mnemonic.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,MAAM,EA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K,KAAK,cAAc,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAGH,MAAM,iBAAiB,GAAG;QACtB,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QAChB,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QAChB,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,EAAG,qBAAqB;KAC3C,CAAC;IAEF,KAAK,MAAM,QAAQ,IAAI,iBAAiB,EAAE;QACtC,MAAM,OAAO,GAAG,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzC,EAAE,CAAC,8CAA+C,QAAQ,CAAC,MAAO,EAAE,EAAE;YAClE,MAAM,CAAC,MAAM,CAAC;gBACV,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAClC,CAAC,EAAE,UAAS,KAAU;gBAClB,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,kBAAkB;oBACrC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC;oBAC5C,KAAK,CAAC,QAAQ,KAAK,SAAS;oBAC5B,KAAK,CAAC,KAAK,KAAK,cAAc,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;KACN;AACL,CAAC,CAAC,CAAA"}

@ -1,5 +1,5 @@
import assert from 'assert';
import { wordlists } from "../wordlists/wordlists.js";
import assert from "assert";
import { wordlists } from "../index.js";
import { loadTests } from "./utils.js";
describe('Check Wordlists', function () {
const tests = loadTests("wordlists");
@ -33,8 +33,8 @@ describe('Check Wordlists', function () {
const phrase = wordlist.join(words);
const words2 = wordlist.split(phrase);
const phrase2 = wordlist.join(words2);
assert.deepStrictEqual(words2, words, "split words");
assert.deepStrictEqual(phrase2, phrase, "re-joined words");
assert.deepEqual(words2, words, "split words");
assert.deepEqual(phrase2, phrase, "re-joined words");
});
});
tests.forEach((test) => {

@ -1 +1 @@
{"version":3,"file":"test-wordlists.js","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9B,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IAEP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}

@ -1,6 +1,6 @@
import fs from "fs";
import path from "path";
import zlib from 'zlib';
import zlib from "zlib";
// Find the package root (based on the nyc output/ folder)
const root = (function () {
let root = process.cwd();

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

@ -84,7 +84,6 @@ export class SigningKey {
*/
computeSharedSecret(other) {
const pubKey = SigningKey.computePublicKey(other);
console.log(pubKey);
return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey)));
}
/**

@ -1 +1 @@
{"version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B,EAAE,SAAwB;QAC/D,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAErF,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,MAAM,GAAG,GAAG,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,CAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QAEpG,MAAM,MAAM,GAAG,SAAS,CAAC,gBAAgB,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;QAClF,cAAc,CAAC,MAAM,IAAI,IAAI,EAAE,8BAA8B,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QAEvF,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3B,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"}

File diff suppressed because one or more lines are too long

@ -446,6 +446,13 @@ export class TransactionReceipt {
this.#logs = Object.freeze(tx.logs.map((log) => {
return new Log(log, provider);
}));
let gasPrice = BN_0;
if (tx.effectiveGasPrice != null) {
gasPrice = tx.effectiveGasPrice;
}
else if (tx.gasPrice != null) {
gasPrice = tx.gasPrice;
}
defineProperties(this, {
provider,
to: tx.to,
@ -458,7 +465,7 @@ export class TransactionReceipt {
logsBloom: tx.logsBloom,
gasUsed: tx.gasUsed,
cumulativeGasUsed: tx.cumulativeGasUsed,
gasPrice: (tx.effectiveGasPrice || tx.gasPrice),
gasPrice,
type: tx.type,
//byzantium: tx.byzantium,
status: tx.status,

File diff suppressed because one or more lines are too long

@ -93,7 +93,7 @@
"url": "https://www.buymeacoffee.com/ricmoo"
}
],
"gitHead": "2b0fe611335432aee334d777a64d8c7827881618",
"gitHead": "1bc8b55d502a95c4ae58352bdcfce9e5f9ea72d3",
"homepage": "https://ethers.org",
"keywords": [
"ethereum",