admin: updated dist files
This commit is contained in:
parent
8af9e5953f
commit
3d3273a8c5
@ -6,6 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const index_js_1 = require("../index.js");
|
||||
const create_provider_js_1 = require("./create-provider.js");
|
||||
function stall(duration) {
|
||||
return new Promise((resolve) => { setTimeout(resolve, duration); });
|
||||
}
|
||||
describe("Sends Transactions", function () {
|
||||
const cleanup = [];
|
||||
after(function () {
|
||||
@ -29,11 +32,26 @@ describe("Sends Transactions", function () {
|
||||
this.timeout(60000);
|
||||
const w = wallet.connect(provider);
|
||||
const dustAddr = index_js_1.Wallet.createRandom().address;
|
||||
const tx = await w.sendTransaction({
|
||||
to: dustAddr,
|
||||
value: 42,
|
||||
type: 2
|
||||
});
|
||||
// Retry if another CI instance used our value
|
||||
let tx = null;
|
||||
for (let i = 0; i < 10; i++) {
|
||||
try {
|
||||
tx = await w.sendTransaction({
|
||||
to: dustAddr,
|
||||
value: 42,
|
||||
type: 2
|
||||
});
|
||||
break;
|
||||
}
|
||||
catch (error) {
|
||||
if ((0, index_js_1.isError)(error, "REPLACEMENT_UNDERPRICED")) {
|
||||
await stall(1000);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
assert_1.default.ok(!!tx, "too many retries");
|
||||
//const receipt =
|
||||
await provider.waitForTransaction(tx.hash); //tx.wait();
|
||||
//console.log(receipt);
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"test-providers-send.js","sourceRoot":"","sources":["../../src.ts/_tests/test-providers-send.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAAqC;AAErC,6DAAkE;AAGlE,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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AAI,EAAE,GAA+B,IAAI,CAAC;YAC1C,KAAK,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,CAAC,CAAC,CAAC,YAAY;YACxD,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"}
|
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "6.0.0-beta-exports.5";
|
||||
exports.version = "6.0.0-beta-exports.6";
|
||||
//# sourceMappingURL=_version.js.map
|
@ -715,7 +715,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string {
|
||||
if (!eventFragment.anonymous) {
|
||||
topics.push(eventFragment.topicHash);
|
||||
}
|
||||
(0, index_js_3.assertArgument)(values.length !== eventFragment.inputs.length, "event arguments/values mismatch", "values", values);
|
||||
(0, index_js_3.assertArgument)(values.length === eventFragment.inputs.length, "event arguments/values mismatch", "values", values);
|
||||
eventFragment.inputs.forEach((param, index) => {
|
||||
const value = values[index];
|
||||
if (param.indexed) {
|
||||
|
@ -54,9 +54,7 @@ function ser_I(index, chainCode, publicKey, privateKey) {
|
||||
}
|
||||
function derivePath(node, path) {
|
||||
const components = path.split("/");
|
||||
if (components.length === 0 || (components[0] === "m" && node.depth !== 0)) {
|
||||
throw new Error("invalid path - " + path);
|
||||
}
|
||||
(0, index_js_4.assertArgument)(components.length > 0 && (components[0] === "m" || node.depth > 0), "invalid path", "path", path);
|
||||
if (components[0] === "m") {
|
||||
components.shift();
|
||||
}
|
||||
@ -65,20 +63,16 @@ function derivePath(node, path) {
|
||||
const component = components[i];
|
||||
if (component.match(/^[0-9]+'$/)) {
|
||||
const index = parseInt(component.substring(0, component.length - 1));
|
||||
if (index >= HardenedBit) {
|
||||
throw new Error("invalid path index - " + component);
|
||||
}
|
||||
(0, index_js_4.assertArgument)(index < HardenedBit, "invalid path index", `path[${i}]`, component);
|
||||
result = result.deriveChild(HardenedBit + index);
|
||||
}
|
||||
else if (component.match(/^[0-9]+$/)) {
|
||||
const index = parseInt(component);
|
||||
if (index >= HardenedBit) {
|
||||
throw new Error("invalid path index - " + component);
|
||||
}
|
||||
(0, index_js_4.assertArgument)(index < HardenedBit, "invalid path index", `path[${i}]`, component);
|
||||
result = result.deriveChild(index);
|
||||
}
|
||||
else {
|
||||
throw new Error("invalid path component - " + component);
|
||||
(0, index_js_4.assertArgument)(false, "invalid path component", `path[${i}]`, component);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -112,9 +106,7 @@ class HDNodeWallet extends base_wallet_js_1.BaseWallet {
|
||||
// we should always use mainnet, and use BIP-44 to derive the network
|
||||
// - Mainnet: public=0x0488B21E, private=0x0488ADE4
|
||||
// - Testnet: public=0x043587CF, private=0x04358394
|
||||
if (this.depth >= 256) {
|
||||
throw new Error("Depth too large!");
|
||||
}
|
||||
(0, index_js_4.assert)(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" });
|
||||
return encodeBase58Check((0, index_js_4.concat)([
|
||||
"0x0488ADE4", zpad(this.depth, 1), this.parentFingerprint,
|
||||
zpad(this.index, 4), this.chainCode,
|
||||
@ -127,9 +119,7 @@ class HDNodeWallet extends base_wallet_js_1.BaseWallet {
|
||||
}
|
||||
deriveChild(_index) {
|
||||
const index = (0, index_js_4.getNumber)(_index, "index");
|
||||
if (index > 0xffffffff) {
|
||||
throw new Error("invalid index - " + String(index));
|
||||
}
|
||||
(0, index_js_4.assertArgument)(index <= 0xffffffff, "invalid index", "index", index);
|
||||
// Base path
|
||||
let path = this.path;
|
||||
if (path) {
|
||||
@ -146,10 +136,9 @@ class HDNodeWallet extends base_wallet_js_1.BaseWallet {
|
||||
return derivePath(this, path);
|
||||
}
|
||||
static #fromSeed(_seed, mnemonic) {
|
||||
(0, index_js_4.assertArgument)((0, index_js_4.isBytesLike)(_seed), "invalid seed", "seed", "[REDACTED]");
|
||||
const seed = (0, index_js_4.getBytes)(_seed, "seed");
|
||||
if (seed.length < 16 || seed.length > 64) {
|
||||
throw new Error("invalid seed");
|
||||
}
|
||||
(0, index_js_4.assertArgument)(seed.length >= 16 && seed.length <= 64, "invalid seed", "seed", "[REDACTED]");
|
||||
const I = (0, index_js_4.getBytes)((0, index_js_1.computeHmac)("sha512", MasterSecret, seed));
|
||||
const signingKey = new index_js_1.SigningKey((0, index_js_4.hexlify)(I.slice(0, 32)));
|
||||
return new HDNodeWallet(_guard, signingKey, "0x00000000", (0, index_js_4.hexlify)(I.slice(32)), "m", 0, 0, mnemonic, null);
|
||||
@ -230,9 +219,7 @@ class HDNodeVoidWallet extends index_js_2.VoidSigner {
|
||||
// we should always use mainnet, and use BIP-44 to derive the network
|
||||
// - Mainnet: public=0x0488B21E, private=0x0488ADE4
|
||||
// - Testnet: public=0x043587CF, private=0x04358394
|
||||
if (this.depth >= 256) {
|
||||
throw new Error("Depth too large!");
|
||||
}
|
||||
(0, index_js_4.assert)(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" });
|
||||
return encodeBase58Check((0, index_js_4.concat)([
|
||||
"0x0488B21E",
|
||||
zpad(this.depth, 1),
|
||||
@ -245,9 +232,7 @@ class HDNodeVoidWallet extends index_js_2.VoidSigner {
|
||||
hasPath() { return (this.path != null); }
|
||||
deriveChild(_index) {
|
||||
const index = (0, index_js_4.getNumber)(_index, "index");
|
||||
if (index > 0xffffffff) {
|
||||
throw new Error("invalid index - " + String(index));
|
||||
}
|
||||
(0, index_js_4.assertArgument)(index <= 0xffffffff, "invalid index", "index", index);
|
||||
// Base path
|
||||
let path = this.path;
|
||||
if (path) {
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,9 @@
|
||||
import assert from "assert";
|
||||
import { Wallet } from "../index.js";
|
||||
import { isError, Wallet } from "../index.js";
|
||||
import { getProvider, providerNames } from "./create-provider.js";
|
||||
function stall(duration) {
|
||||
return new Promise((resolve) => { setTimeout(resolve, duration); });
|
||||
}
|
||||
describe("Sends Transactions", function () {
|
||||
const cleanup = [];
|
||||
after(function () {
|
||||
@ -24,11 +27,26 @@ describe("Sends Transactions", function () {
|
||||
this.timeout(60000);
|
||||
const w = wallet.connect(provider);
|
||||
const dustAddr = Wallet.createRandom().address;
|
||||
const tx = await w.sendTransaction({
|
||||
to: dustAddr,
|
||||
value: 42,
|
||||
type: 2
|
||||
});
|
||||
// Retry if another CI instance used our value
|
||||
let tx = null;
|
||||
for (let i = 0; i < 10; i++) {
|
||||
try {
|
||||
tx = await w.sendTransaction({
|
||||
to: dustAddr,
|
||||
value: 42,
|
||||
type: 2
|
||||
});
|
||||
break;
|
||||
}
|
||||
catch (error) {
|
||||
if (isError(error, "REPLACEMENT_UNDERPRICED")) {
|
||||
await stall(1000);
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
assert.ok(!!tx, "too many retries");
|
||||
//const receipt =
|
||||
await provider.waitForTransaction(tx.hash); //tx.wait();
|
||||
//console.log(receipt);
|
||||
|
@ -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,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGlE,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,GAAG,WAAW,CAAC,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,CAAC,CAAC,CAAC,CAAC,CAAC;SAAE;QAEpF,EAAE,CAAC,kBAAmB,YAAa,EAAE,EAAE,KAAK;YACxC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAEpB,MAAM,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAEnC,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,EA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,IAAI,CAAC,CAAC,CAAC,YAAY;YACxD,uBAAuB;YAEvB,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YACpD,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,2BAA2B,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;KACN;AAGL,CAAC,CAAC,CAAC"}
|
@ -1,2 +1,2 @@
|
||||
export const version = "6.0.0-beta-exports.5";
|
||||
export const version = "6.0.0-beta-exports.6";
|
||||
//# sourceMappingURL=_version.js.map
|
@ -707,7 +707,7 @@ getSelector(fragment: ErrorFragment | FunctionFragment): string {
|
||||
if (!eventFragment.anonymous) {
|
||||
topics.push(eventFragment.topicHash);
|
||||
}
|
||||
assertArgument(values.length !== eventFragment.inputs.length, "event arguments/values mismatch", "values", values);
|
||||
assertArgument(values.length === eventFragment.inputs.length, "event arguments/values mismatch", "values", values);
|
||||
eventFragment.inputs.forEach((param, index) => {
|
||||
const value = values[index];
|
||||
if (param.indexed) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { computeHmac, randomBytes, ripemd160, SigningKey, sha256 } from "../crypto/index.js";
|
||||
import { VoidSigner } from "../providers/index.js";
|
||||
import { computeAddress } from "../transaction/index.js";
|
||||
import { concat, dataSlice, decodeBase58, defineProperties, encodeBase58, getBytes, hexlify, getNumber, toBigInt, toHex, assertPrivate, assert, assertArgument } from "../utils/index.js";
|
||||
import { concat, dataSlice, decodeBase58, defineProperties, encodeBase58, getBytes, hexlify, isBytesLike, getNumber, toBigInt, toHex, assertPrivate, assert, assertArgument } from "../utils/index.js";
|
||||
import { langEn } from "../wordlists/lang-en.js";
|
||||
import { Mnemonic } from "./mnemonic.js";
|
||||
import { BaseWallet } from "./base-wallet.js";
|
||||
@ -51,9 +51,7 @@ function ser_I(index, chainCode, publicKey, privateKey) {
|
||||
}
|
||||
function derivePath(node, path) {
|
||||
const components = path.split("/");
|
||||
if (components.length === 0 || (components[0] === "m" && node.depth !== 0)) {
|
||||
throw new Error("invalid path - " + path);
|
||||
}
|
||||
assertArgument(components.length > 0 && (components[0] === "m" || node.depth > 0), "invalid path", "path", path);
|
||||
if (components[0] === "m") {
|
||||
components.shift();
|
||||
}
|
||||
@ -62,20 +60,16 @@ function derivePath(node, path) {
|
||||
const component = components[i];
|
||||
if (component.match(/^[0-9]+'$/)) {
|
||||
const index = parseInt(component.substring(0, component.length - 1));
|
||||
if (index >= HardenedBit) {
|
||||
throw new Error("invalid path index - " + component);
|
||||
}
|
||||
assertArgument(index < HardenedBit, "invalid path index", `path[${i}]`, component);
|
||||
result = result.deriveChild(HardenedBit + index);
|
||||
}
|
||||
else if (component.match(/^[0-9]+$/)) {
|
||||
const index = parseInt(component);
|
||||
if (index >= HardenedBit) {
|
||||
throw new Error("invalid path index - " + component);
|
||||
}
|
||||
assertArgument(index < HardenedBit, "invalid path index", `path[${i}]`, component);
|
||||
result = result.deriveChild(index);
|
||||
}
|
||||
else {
|
||||
throw new Error("invalid path component - " + component);
|
||||
assertArgument(false, "invalid path component", `path[${i}]`, component);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -109,9 +103,7 @@ export class HDNodeWallet extends BaseWallet {
|
||||
// we should always use mainnet, and use BIP-44 to derive the network
|
||||
// - Mainnet: public=0x0488B21E, private=0x0488ADE4
|
||||
// - Testnet: public=0x043587CF, private=0x04358394
|
||||
if (this.depth >= 256) {
|
||||
throw new Error("Depth too large!");
|
||||
}
|
||||
assert(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" });
|
||||
return encodeBase58Check(concat([
|
||||
"0x0488ADE4", zpad(this.depth, 1), this.parentFingerprint,
|
||||
zpad(this.index, 4), this.chainCode,
|
||||
@ -124,9 +116,7 @@ export class HDNodeWallet extends BaseWallet {
|
||||
}
|
||||
deriveChild(_index) {
|
||||
const index = getNumber(_index, "index");
|
||||
if (index > 0xffffffff) {
|
||||
throw new Error("invalid index - " + String(index));
|
||||
}
|
||||
assertArgument(index <= 0xffffffff, "invalid index", "index", index);
|
||||
// Base path
|
||||
let path = this.path;
|
||||
if (path) {
|
||||
@ -143,10 +133,9 @@ export class HDNodeWallet extends BaseWallet {
|
||||
return derivePath(this, path);
|
||||
}
|
||||
static #fromSeed(_seed, mnemonic) {
|
||||
assertArgument(isBytesLike(_seed), "invalid seed", "seed", "[REDACTED]");
|
||||
const seed = getBytes(_seed, "seed");
|
||||
if (seed.length < 16 || seed.length > 64) {
|
||||
throw new Error("invalid seed");
|
||||
}
|
||||
assertArgument(seed.length >= 16 && seed.length <= 64, "invalid seed", "seed", "[REDACTED]");
|
||||
const I = getBytes(computeHmac("sha512", MasterSecret, seed));
|
||||
const signingKey = new SigningKey(hexlify(I.slice(0, 32)));
|
||||
return new HDNodeWallet(_guard, signingKey, "0x00000000", hexlify(I.slice(32)), "m", 0, 0, mnemonic, null);
|
||||
@ -226,9 +215,7 @@ export class HDNodeVoidWallet extends VoidSigner {
|
||||
// we should always use mainnet, and use BIP-44 to derive the network
|
||||
// - Mainnet: public=0x0488B21E, private=0x0488ADE4
|
||||
// - Testnet: public=0x043587CF, private=0x04358394
|
||||
if (this.depth >= 256) {
|
||||
throw new Error("Depth too large!");
|
||||
}
|
||||
assert(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" });
|
||||
return encodeBase58Check(concat([
|
||||
"0x0488B21E",
|
||||
zpad(this.depth, 1),
|
||||
@ -241,9 +228,7 @@ export class HDNodeVoidWallet extends VoidSigner {
|
||||
hasPath() { return (this.path != null); }
|
||||
deriveChild(_index) {
|
||||
const index = getNumber(_index, "index");
|
||||
if (index > 0xffffffff) {
|
||||
throw new Error("invalid index - " + String(index));
|
||||
}
|
||||
assertArgument(index <= 0xffffffff, "invalid index", "index", index);
|
||||
// Base path
|
||||
let path = this.path;
|
||||
if (path) {
|
||||
|
File diff suppressed because one or more lines are too long
@ -104,7 +104,7 @@
|
||||
"types": "./types/wordlistsindex.d.ts"
|
||||
}
|
||||
},
|
||||
"gitHead": "60d7709069cbeedb5da73c3fb4864683beed2156",
|
||||
"gitHead": "6aa853abc32d4824a91f8584e8eaa1d4a178dbb7",
|
||||
"keywords": [
|
||||
"ethereum",
|
||||
"ethers",
|
||||
@ -144,5 +144,5 @@
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"types": "./types/index.d.ts",
|
||||
"version": "6.0.0-beta-exports.5"
|
||||
"version": "6.0.0-beta-exports.6"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "6.0.0-beta-exports.5";
|
||||
export const version = "6.0.0-beta-exports.6";
|
||||
|
2
types/_version.d.ts
vendored
2
types/_version.d.ts
vendored
@ -1,2 +1,2 @@
|
||||
export declare const version = "6.0.0-beta-exports.5";
|
||||
export declare const version = "6.0.0-beta-exports.6";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"hdwallet.d.ts","sourceRoot":"","sources":["../../src.ts/wallet/hdwallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,UAAU,EAAU,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAUnD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD,eAAO,MAAM,WAAW,qBAAqB,CAAC;AAqF9C,qBAAa,YAAa,SAAQ,UAAU;;IACxC,QAAQ,CAAC,SAAS,EAAG,MAAM,CAAC;IAE5B,QAAQ,CAAC,WAAW,EAAG,MAAM,CAAC;IAC9B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