admin: updated dist files
This commit is contained in:
parent
b39e955eb6
commit
5715d611e7
48
dist/ethers.js
vendored
48
dist/ethers.js
vendored
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* The current version of Ethers.
|
||||
*/
|
||||
const version = "6.0.4";
|
||||
const version = "6.0.5";
|
||||
|
||||
/**
|
||||
* Property helper functions.
|
||||
@ -389,7 +389,7 @@ function dataSlice(data, start, end) {
|
||||
*/
|
||||
function stripZerosLeft(data) {
|
||||
let bytes = hexlify(data).substring(2);
|
||||
while (bytes.substring(0, 2) == "00") {
|
||||
while (bytes.startsWith("00")) {
|
||||
bytes = bytes.substring(2);
|
||||
}
|
||||
return "0x" + bytes;
|
||||
@ -638,7 +638,7 @@ function toBeArray(_value) {
|
||||
*/
|
||||
function toQuantity(value) {
|
||||
let result = hexlify(isBytesLike(value) ? value : toBeArray(value)).substring(2);
|
||||
while (result.substring(0, 1) === "0") {
|
||||
while (result.startsWith("0")) {
|
||||
result = result.substring(1);
|
||||
}
|
||||
if (result === "") {
|
||||
@ -2658,12 +2658,14 @@ class Result extends Array {
|
||||
* errors.
|
||||
*/
|
||||
toArray() {
|
||||
const result = [];
|
||||
this.forEach((item, index) => {
|
||||
if (item instanceof Error) {
|
||||
throwError(`index ${index}`, item);
|
||||
}
|
||||
result.push(item);
|
||||
});
|
||||
return Array.of(this);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Returns the Result as an Object with each name-value pair.
|
||||
@ -2690,9 +2692,24 @@ class Result extends Array {
|
||||
if (start == null) {
|
||||
start = 0;
|
||||
}
|
||||
if (start < 0) {
|
||||
start += this.length;
|
||||
if (start < 0) {
|
||||
start = 0;
|
||||
}
|
||||
}
|
||||
if (end == null) {
|
||||
end = this.length;
|
||||
}
|
||||
if (end < 0) {
|
||||
end += this.length;
|
||||
if (end < 0) {
|
||||
end = 0;
|
||||
}
|
||||
}
|
||||
if (end > this.length) {
|
||||
end = this.length;
|
||||
}
|
||||
const result = [], names = [];
|
||||
for (let i = start; i < end; i++) {
|
||||
result.push(this[i]);
|
||||
@ -6551,7 +6568,7 @@ function getAddress(address) {
|
||||
assertArgument(typeof (address) === "string", "invalid address", "address", address);
|
||||
if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
|
||||
// Missing the 0x prefix
|
||||
if (address.substring(0, 2) !== "0x") {
|
||||
if (!address.startsWith("0x")) {
|
||||
address = "0x" + address;
|
||||
}
|
||||
const result = getChecksumAddress(address);
|
||||
@ -6852,7 +6869,7 @@ class Typed {
|
||||
return !!(this.type.match(/^u?int[0-9]+$/));
|
||||
}
|
||||
isData() {
|
||||
return (this.type.substring(0, 5) === "bytes");
|
||||
return this.type.startsWith("bytes");
|
||||
}
|
||||
isString() {
|
||||
return (this.type === "string");
|
||||
@ -7079,7 +7096,7 @@ function pack(writer, coders, values) {
|
||||
arrayValues = coders.map((coder) => {
|
||||
const name = coder.localName;
|
||||
assert$1(name, "cannot encode object for signature with missing names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values });
|
||||
assert$1(unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values });
|
||||
assert$1(!unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values });
|
||||
unique[name] = true;
|
||||
return values[name];
|
||||
});
|
||||
@ -10448,7 +10465,7 @@ class ParamType {
|
||||
});
|
||||
return new ParamType(_guard$2, name || "", type, "array", indexed, null, arrayLength, arrayChildren);
|
||||
}
|
||||
if (type === "tuple" || type.substring(0, 5) === "tuple(" || type[0] === "(") {
|
||||
if (type === "tuple" || type.startsWith("tuple(" /* fix: ) */) || type.startsWith("(" /* fix: ) */)) {
|
||||
const comps = (obj.components != null) ? obj.components.map((c) => ParamType.from(c)) : null;
|
||||
const tuple = new ParamType(_guard$2, name || "", type, "tuple", indexed, comps, null, null);
|
||||
// @TODO: use lexer to validate and normalize type
|
||||
@ -12255,7 +12272,7 @@ function copyRequest(req) {
|
||||
if (req.data) {
|
||||
result.data = hexlify(req.data);
|
||||
}
|
||||
const bigIntKeys = "chainId,gasLimit,gasPrice,maxFeePerGas, maxPriorityFeePerGas,value".split(/,/);
|
||||
const bigIntKeys = "chainId,gasLimit,gasPrice,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);
|
||||
for (const key of bigIntKeys) {
|
||||
if (!(key in req) || req[key] == null) {
|
||||
continue;
|
||||
@ -13847,7 +13864,7 @@ class ContractFactory {
|
||||
if (typeof (bytecode) === "object") {
|
||||
bytecode = bytecode.object;
|
||||
}
|
||||
if (bytecode.substring(0, 2) !== "0x") {
|
||||
if (!bytecode.startsWith("0x")) {
|
||||
bytecode = "0x" + bytecode;
|
||||
}
|
||||
bytecode = hexlify(getBytes(bytecode));
|
||||
@ -19465,7 +19482,7 @@ function getDefaultProvider(network, options) {
|
||||
*/
|
||||
if (options.quicknode !== "-") {
|
||||
try {
|
||||
let token = options.qquicknode;
|
||||
let token = options.quicknode;
|
||||
providers.push(new QuickNodeProvider(network, token));
|
||||
}
|
||||
catch (error) {
|
||||
@ -20705,8 +20722,8 @@ function pkcs7Strip(data) {
|
||||
* @_ignore
|
||||
*/
|
||||
function looseArrayify(hexString) {
|
||||
if (typeof (hexString) === 'string' && hexString.substring(0, 2) !== '0x') {
|
||||
hexString = '0x' + hexString;
|
||||
if (typeof (hexString) === "string" && !hexString.startsWith("0x")) {
|
||||
hexString = "0x" + hexString;
|
||||
}
|
||||
return getBytesCopy(hexString);
|
||||
}
|
||||
@ -20887,7 +20904,7 @@ function getAccount(data, _key) {
|
||||
const address = computeAddress(privateKey);
|
||||
if (data.address) {
|
||||
let check = data.address.toLowerCase();
|
||||
if (check.substring(0, 2) !== "0x") {
|
||||
if (!check.startsWith("0x")) {
|
||||
check = "0x" + check;
|
||||
}
|
||||
assertArgument(getAddress(check) === address, "keystore address/privateKey mismatch", "address", data.address);
|
||||
@ -21680,6 +21697,9 @@ class Wallet extends BaseWallet {
|
||||
* to %%provider%%.
|
||||
*/
|
||||
constructor(key, provider) {
|
||||
if (typeof (key) === "string" && !key.startsWith("0x")) {
|
||||
key = "0x" + key;
|
||||
}
|
||||
let signingKey = (typeof (key) === "string") ? new SigningKey(key) : key;
|
||||
super(signingKey, provider);
|
||||
}
|
||||
|
2
dist/ethers.js.map
vendored
2
dist/ethers.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/ethers.min.js
vendored
2
dist/ethers.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/wordlists-extra.js
vendored
2
dist/wordlists-extra.js
vendored
@ -149,7 +149,7 @@ const u64 = {
|
||||
/**
|
||||
* The current version of Ethers.
|
||||
*/
|
||||
const version = "6.0.4";
|
||||
const version = "6.0.5";
|
||||
|
||||
/**
|
||||
* Property helper functions.
|
||||
|
2
dist/wordlists-extra.js.map
vendored
2
dist/wordlists-extra.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/wordlists-extra.min.js
vendored
2
dist/wordlists-extra.min.js
vendored
File diff suppressed because one or more lines are too long
84
lib.commonjs/_tests/blockchain-data.d.ts
vendored
84
lib.commonjs/_tests/blockchain-data.d.ts
vendored
@ -1,84 +0,0 @@
|
||||
export type TestBlockchainNetwork = "mainnet" | "goerli";
|
||||
export interface TestBlockchainAddress {
|
||||
test: string;
|
||||
address: string;
|
||||
code?: string;
|
||||
nonce?: number;
|
||||
name?: string;
|
||||
balance?: bigint;
|
||||
storage?: Record<string, string>;
|
||||
}
|
||||
export interface TestBlockchainBlock {
|
||||
test: string;
|
||||
hash: string;
|
||||
parentHash: string;
|
||||
number: number;
|
||||
timestamp: number;
|
||||
nonce: string;
|
||||
difficulty: bigint;
|
||||
gasLimit: bigint;
|
||||
gasUsed: bigint;
|
||||
miner: string;
|
||||
extraData: string;
|
||||
transactions: Array<string>;
|
||||
baseFeePerGas?: bigint;
|
||||
}
|
||||
export interface TestBlockchainTransaction {
|
||||
test: string;
|
||||
hash: string;
|
||||
blockHash: string;
|
||||
blockNumber: number;
|
||||
type: number;
|
||||
from: string;
|
||||
gasPrice: bigint;
|
||||
gasLimit: bigint;
|
||||
to: string;
|
||||
value: bigint;
|
||||
nonce: number;
|
||||
data: string;
|
||||
signature: {
|
||||
r: string;
|
||||
s: string;
|
||||
yParity: 0 | 1;
|
||||
v: number;
|
||||
networkV: null | bigint;
|
||||
};
|
||||
creates: null | string;
|
||||
chainId: bigint;
|
||||
accessList?: Array<Record<string, Array<string>>>;
|
||||
maxPriorityFeePerGas?: bigint;
|
||||
maxFeePerGas?: bigint;
|
||||
}
|
||||
export interface TestBlockchainReceipt {
|
||||
test: string;
|
||||
blockHash: string;
|
||||
blockNumber: number;
|
||||
type: number;
|
||||
contractAddress: null | string;
|
||||
cumulativeGasUsed: bigint;
|
||||
from: string;
|
||||
gasUsed: bigint;
|
||||
gasPrice: bigint;
|
||||
logs: Array<{
|
||||
address: string;
|
||||
blockHash: string;
|
||||
blockNumber: number;
|
||||
data: string;
|
||||
index: number;
|
||||
topics: Array<string>;
|
||||
transactionHash: string;
|
||||
transactionIndex: number;
|
||||
}>;
|
||||
logsBloom: string;
|
||||
root: null | string;
|
||||
status: null | number;
|
||||
to: string;
|
||||
hash: string;
|
||||
index: number;
|
||||
}
|
||||
export declare const testAddress: Record<TestBlockchainNetwork, Array<TestBlockchainAddress>>;
|
||||
export declare const testBlock: Record<TestBlockchainNetwork, Array<TestBlockchainBlock>>;
|
||||
export declare const testTransaction: Record<TestBlockchainNetwork, Array<TestBlockchainTransaction>>;
|
||||
export declare const testReceipt: Record<TestBlockchainNetwork, Array<TestBlockchainReceipt>>;
|
||||
export declare const networkNames: Array<TestBlockchainNetwork>;
|
||||
export declare function networkFeatureAtBlock(feature: string, block: number): boolean;
|
7
lib.commonjs/_tests/create-provider.d.ts
vendored
7
lib.commonjs/_tests/create-provider.d.ts
vendored
@ -1,7 +0,0 @@
|
||||
import type { AbstractProvider } from "../index.js";
|
||||
export declare function setupProviders(): void;
|
||||
export declare const providerNames: readonly string[];
|
||||
export declare function getProviderNetworks(provider: string): Array<string>;
|
||||
export declare function getProvider(provider: string, network: string): null | AbstractProvider;
|
||||
export declare function checkProvider(provider: string, network: string): boolean;
|
||||
export declare function connect(network: string): AbstractProvider;
|
1
lib.commonjs/_tests/test-abi.d.ts
vendored
1
lib.commonjs/_tests/test-abi.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
1
lib.commonjs/_tests/test-address.d.ts
vendored
1
lib.commonjs/_tests/test-address.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
1
lib.commonjs/_tests/test-contract.d.ts
vendored
1
lib.commonjs/_tests/test-contract.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
@ -1 +0,0 @@
|
||||
export {};
|
1
lib.commonjs/_tests/test-crypto.d.ts
vendored
1
lib.commonjs/_tests/test-crypto.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
1
lib.commonjs/_tests/test-hash-typeddata.d.ts
vendored
1
lib.commonjs/_tests/test-hash-typeddata.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
1
lib.commonjs/_tests/test-hash.d.ts
vendored
1
lib.commonjs/_tests/test-hash.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
@ -1 +0,0 @@
|
||||
export {};
|
1
lib.commonjs/_tests/test-providers-ccip.d.ts
vendored
1
lib.commonjs/_tests/test-providers-ccip.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
1
lib.commonjs/_tests/test-providers-data.d.ts
vendored
1
lib.commonjs/_tests/test-providers-data.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
@ -1 +0,0 @@
|
||||
export {};
|
@ -1 +0,0 @@
|
||||
export {};
|
1
lib.commonjs/_tests/test-providers-send.d.ts
vendored
1
lib.commonjs/_tests/test-providers-send.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
@ -1 +0,0 @@
|
||||
export {};
|
1
lib.commonjs/_tests/test-rlp.d.ts
vendored
1
lib.commonjs/_tests/test-rlp.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
1
lib.commonjs/_tests/test-transaction.d.ts
vendored
1
lib.commonjs/_tests/test-transaction.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
1
lib.commonjs/_tests/test-utils-maths.d.ts
vendored
1
lib.commonjs/_tests/test-utils-maths.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
1
lib.commonjs/_tests/test-utils-misc.d.ts
vendored
1
lib.commonjs/_tests/test-utils-misc.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
1
lib.commonjs/_tests/test-utils-units.d.ts
vendored
1
lib.commonjs/_tests/test-utils-units.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
12
lib.commonjs/_tests/test-utils-utf8.d.ts
vendored
12
lib.commonjs/_tests/test-utils-utf8.d.ts
vendored
@ -1,12 +0,0 @@
|
||||
export type TestCaseBadString = {
|
||||
name: string;
|
||||
bytes: Uint8Array;
|
||||
ignore: string;
|
||||
replace: string;
|
||||
error: string;
|
||||
};
|
||||
export type TestCaseCodePoints = {
|
||||
name: string;
|
||||
text: string;
|
||||
codepoints: Array<number>;
|
||||
};
|
6
lib.commonjs/_tests/test-wallet-hd.d.ts
vendored
6
lib.commonjs/_tests/test-wallet-hd.d.ts
vendored
@ -1,6 +0,0 @@
|
||||
declare global {
|
||||
class TextDecoder {
|
||||
decode(data: Uint8Array): string;
|
||||
}
|
||||
}
|
||||
export {};
|
1
lib.commonjs/_tests/test-wallet-json.d.ts
vendored
1
lib.commonjs/_tests/test-wallet-json.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
@ -1 +0,0 @@
|
||||
export {};
|
1
lib.commonjs/_tests/test-wallet.d.ts
vendored
1
lib.commonjs/_tests/test-wallet.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
1
lib.commonjs/_tests/test-wordlists.d.ts
vendored
1
lib.commonjs/_tests/test-wordlists.d.ts
vendored
@ -1 +0,0 @@
|
||||
export {};
|
216
lib.commonjs/_tests/types.d.ts
vendored
216
lib.commonjs/_tests/types.d.ts
vendored
@ -1,216 +0,0 @@
|
||||
export type TestCaseAbiVerbose = {
|
||||
type: "address" | "hexstring" | "number" | "string";
|
||||
value: string;
|
||||
} | {
|
||||
type: "boolean";
|
||||
value: boolean;
|
||||
} | {
|
||||
type: "array";
|
||||
value: Array<TestCaseAbiVerbose>;
|
||||
} | {
|
||||
type: "object";
|
||||
value: Array<TestCaseAbiVerbose>;
|
||||
};
|
||||
export interface TestCaseAbi {
|
||||
name: string;
|
||||
type: string;
|
||||
value: any;
|
||||
verbose: TestCaseAbiVerbose;
|
||||
bytecode: string;
|
||||
encoded: string;
|
||||
}
|
||||
export interface TestCaseAccount {
|
||||
name: string;
|
||||
privateKey: string;
|
||||
address: string;
|
||||
icap: string;
|
||||
}
|
||||
export type TestCaseCreate = {
|
||||
sender: string;
|
||||
creates: Array<{
|
||||
name: string;
|
||||
nonce: number;
|
||||
address: string;
|
||||
}>;
|
||||
};
|
||||
export type TestCaseCreate2 = {
|
||||
sender: string;
|
||||
creates: Array<{
|
||||
name: string;
|
||||
salt: string;
|
||||
initCode: string;
|
||||
initCodeHash: string;
|
||||
address: string;
|
||||
}>;
|
||||
};
|
||||
export interface TestCaseHash {
|
||||
name: string;
|
||||
data: string;
|
||||
sha256: string;
|
||||
sha512: string;
|
||||
ripemd160: string;
|
||||
keccak256: string;
|
||||
}
|
||||
export interface TestCasePbkdf {
|
||||
name: string;
|
||||
password: string;
|
||||
salt: string;
|
||||
dkLen: number;
|
||||
pbkdf2: {
|
||||
iterations: number;
|
||||
algorithm: "sha256" | "sha512";
|
||||
key: string;
|
||||
};
|
||||
scrypt: {
|
||||
N: number;
|
||||
r: number;
|
||||
p: number;
|
||||
key: string;
|
||||
};
|
||||
}
|
||||
export interface TestCaseHmac {
|
||||
name: string;
|
||||
data: string;
|
||||
key: string;
|
||||
algorithm: "sha256" | "sha512";
|
||||
hmac: string;
|
||||
}
|
||||
export interface TestCaseHash {
|
||||
name: string;
|
||||
data: string;
|
||||
sha256: string;
|
||||
sha512: string;
|
||||
ripemd160: string;
|
||||
keccak256: string;
|
||||
}
|
||||
export interface TestCaseNamehash {
|
||||
name: string;
|
||||
ensName: string;
|
||||
error?: string;
|
||||
namehash?: string;
|
||||
}
|
||||
export interface TestCaseTypedDataDomain {
|
||||
name?: string;
|
||||
version?: string;
|
||||
chainId?: number;
|
||||
verifyingContract?: string;
|
||||
salt?: string;
|
||||
}
|
||||
export interface TestCaseTypedDataType {
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
export interface TestCaseTypedData {
|
||||
name: string;
|
||||
domain: TestCaseTypedDataDomain;
|
||||
primaryType: string;
|
||||
types: Record<string, Array<TestCaseTypedDataType>>;
|
||||
data: any;
|
||||
encoded: string;
|
||||
digest: string;
|
||||
privateKey?: string;
|
||||
signature?: string;
|
||||
}
|
||||
export interface TestCaseSolidityHash {
|
||||
name: string;
|
||||
types: Array<string>;
|
||||
keccak256: string;
|
||||
ripemd160: string;
|
||||
sha256: string;
|
||||
values: Array<any>;
|
||||
}
|
||||
export interface TestCaseUnit {
|
||||
name: string;
|
||||
wei: string;
|
||||
ethers: string;
|
||||
ether_format: string;
|
||||
kwei?: string;
|
||||
mwei?: string;
|
||||
gwei?: string;
|
||||
szabo?: string;
|
||||
finney?: string;
|
||||
finney_format?: string;
|
||||
szabo_format?: string;
|
||||
gwei_format?: string;
|
||||
mwei_format?: string;
|
||||
kwei_format?: string;
|
||||
}
|
||||
export type NestedHexString = string | Array<string | NestedHexString>;
|
||||
export interface TestCaseRlp {
|
||||
name: string;
|
||||
encoded: string;
|
||||
decoded: NestedHexString;
|
||||
}
|
||||
export interface TestCaseTransactionTx {
|
||||
to?: string;
|
||||
nonce?: number;
|
||||
gasLimit?: string;
|
||||
gasPrice?: string;
|
||||
maxFeePerGas?: string;
|
||||
maxPriorityFeePerGas?: string;
|
||||
data?: string;
|
||||
value?: string;
|
||||
accessList?: Array<{
|
||||
address: string;
|
||||
storageKeys: Array<string>;
|
||||
}>;
|
||||
chainId?: string;
|
||||
}
|
||||
export interface TestCaseTransactionSig {
|
||||
r: string;
|
||||
s: string;
|
||||
v: string;
|
||||
}
|
||||
export interface TestCaseTransaction {
|
||||
name: string;
|
||||
transaction: TestCaseTransactionTx;
|
||||
privateKey: string;
|
||||
unsignedLegacy: string;
|
||||
signedLegacy: string;
|
||||
unsignedEip155: string;
|
||||
signedEip155: string;
|
||||
unsignedBerlin: string;
|
||||
signedBerlin: string;
|
||||
unsignedLondon: string;
|
||||
signedLondon: string;
|
||||
signatureLegacy: TestCaseTransactionSig;
|
||||
signatureEip155: TestCaseTransactionSig;
|
||||
signatureBerlin: TestCaseTransactionSig;
|
||||
signatureLondon: TestCaseTransactionSig;
|
||||
}
|
||||
export interface TestCaseMnemonicNode {
|
||||
path: string;
|
||||
chainCode: string;
|
||||
depth: number;
|
||||
index: number;
|
||||
parentFingerprint: string;
|
||||
fingerprint: string;
|
||||
publicKey: string;
|
||||
privateKey: string;
|
||||
xpriv: string;
|
||||
xpub: string;
|
||||
}
|
||||
export interface TestCaseMnemonic {
|
||||
name: string;
|
||||
phrase: string;
|
||||
phraseHash: string;
|
||||
password: string;
|
||||
locale: string;
|
||||
entropy: string;
|
||||
seed: string;
|
||||
nodes: Array<TestCaseMnemonicNode>;
|
||||
}
|
||||
export interface TestCaseWallet {
|
||||
name: string;
|
||||
filename: string;
|
||||
type: string;
|
||||
address: string;
|
||||
password: string;
|
||||
content: string;
|
||||
}
|
||||
export interface TestCaseWordlist {
|
||||
name: string;
|
||||
filename: string;
|
||||
locale: string;
|
||||
content: string;
|
||||
}
|
8
lib.commonjs/_tests/utils.d.ts
vendored
8
lib.commonjs/_tests/utils.d.ts
vendored
@ -1,8 +0,0 @@
|
||||
export declare function loadTests<T>(tag: string): Array<T>;
|
||||
export declare function log(context: any, text: string): void;
|
||||
export declare function stall(duration: number): Promise<void>;
|
||||
export interface MochaRunnable {
|
||||
timeout: (value: number) => void;
|
||||
skip: () => void;
|
||||
}
|
||||
export declare function retryIt(name: string, func: (this: MochaRunnable) => Promise<void>): Promise<void>;
|
4
lib.commonjs/_version.d.ts
vendored
4
lib.commonjs/_version.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
/**
|
||||
* The current version of Ethers.
|
||||
*/
|
||||
export declare const version: string;
|
@ -5,5 +5,5 @@ exports.version = void 0;
|
||||
/**
|
||||
* The current version of Ethers.
|
||||
*/
|
||||
exports.version = "6.0.4";
|
||||
exports.version = "6.0.5";
|
||||
//# sourceMappingURL=_version.js.map
|
58
lib.commonjs/abi/abi-coder.d.ts
vendored
58
lib.commonjs/abi/abi-coder.d.ts
vendored
@ -1,58 +0,0 @@
|
||||
/**
|
||||
* When sending values to or receiving values from a [[Contract]], the
|
||||
* data is generally encoded using the [ABI standard](solc-abi-standard).
|
||||
*
|
||||
* The AbiCoder provides a utility to encode values to ABI data and
|
||||
* decode values from ABI data.
|
||||
*
|
||||
* Most of the time, developers should favour the [[Contract]] class,
|
||||
* which further abstracts a lot of the finer details of ABI data.
|
||||
*
|
||||
* @_section api/abi/abi-coder:ABI Encoding
|
||||
*/
|
||||
import { Result } from "./coders/abstract-coder.js";
|
||||
import { ParamType } from "./fragments.js";
|
||||
import type { BytesLike, CallExceptionAction, CallExceptionError } from "../utils/index.js";
|
||||
/**
|
||||
* About AbiCoder
|
||||
*/
|
||||
export declare class AbiCoder {
|
||||
#private;
|
||||
/**
|
||||
* Get the default values for the given %%types%%.
|
||||
*
|
||||
* For example, a ``uint`` is by default ``0`` and ``bool``
|
||||
* is by default ``false``.
|
||||
*/
|
||||
getDefaultValue(types: ReadonlyArray<string | ParamType>): Result;
|
||||
/**
|
||||
* Encode the %%values%% as the %%types%% into ABI data.
|
||||
*
|
||||
* @returns DataHexstring
|
||||
*/
|
||||
encode(types: ReadonlyArray<string | ParamType>, values: ReadonlyArray<any>): string;
|
||||
/**
|
||||
* Decode the ABI %%data%% as the %%types%% into values.
|
||||
*
|
||||
* If %%loose%% decoding is enabled, then strict padding is
|
||||
* not enforced. Some older versions of Solidity incorrectly
|
||||
* padded event data emitted from ``external`` functions.
|
||||
*/
|
||||
decode(types: ReadonlyArray<string | ParamType>, data: BytesLike, loose?: boolean): Result;
|
||||
/**
|
||||
* Returns the shared singleton instance of a default [[AbiCoder]].
|
||||
*
|
||||
* On the first call, the instance is created internally.
|
||||
*/
|
||||
static defaultAbiCoder(): AbiCoder;
|
||||
/**
|
||||
* Returns an ethers-compatible [[CallExceptionError]] Error for the given
|
||||
* result %%data%% for the [[CallExceptionAction]] %%action%% against
|
||||
* the Transaction %%tx%%.
|
||||
*/
|
||||
static getBuiltinCallException(action: CallExceptionAction, tx: {
|
||||
to?: null | string;
|
||||
from?: null | string;
|
||||
data?: string;
|
||||
}, data: null | BytesLike): CallExceptionError;
|
||||
}
|
14
lib.commonjs/abi/bytes32.d.ts
vendored
14
lib.commonjs/abi/bytes32.d.ts
vendored
@ -1,14 +0,0 @@
|
||||
/**
|
||||
* About bytes32 strings...
|
||||
*
|
||||
* @_docloc: api/utils:Bytes32 Strings
|
||||
*/
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
/**
|
||||
* Encodes %%text%% as a Bytes32 string.
|
||||
*/
|
||||
export declare function encodeBytes32String(text: string): string;
|
||||
/**
|
||||
* Encodes the Bytes32-encoded %%bytes%% into a string.
|
||||
*/
|
||||
export declare function decodeBytes32String(_bytes: BytesLike): string;
|
116
lib.commonjs/abi/coders/abstract-coder.d.ts
vendored
116
lib.commonjs/abi/coders/abstract-coder.d.ts
vendored
@ -1,116 +0,0 @@
|
||||
import type { BigNumberish, BytesLike } from "../../utils/index.js";
|
||||
/**
|
||||
* @_ignore:
|
||||
*/
|
||||
export declare const WordSize: number;
|
||||
/**
|
||||
* A [[Result]] is a sub-class of Array, which allows accessing any
|
||||
* of its values either positionally by its index or, if keys are
|
||||
* provided by its name.
|
||||
*
|
||||
* @_docloc: api/abi
|
||||
*/
|
||||
export declare class Result extends Array<any> {
|
||||
#private;
|
||||
[K: string | number]: any;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(...args: Array<any>);
|
||||
/**
|
||||
* Returns the Result as a normal Array.
|
||||
*
|
||||
* This will throw if there are any outstanding deferred
|
||||
* errors.
|
||||
*/
|
||||
toArray(): Array<any>;
|
||||
/**
|
||||
* Returns the Result as an Object with each name-value pair.
|
||||
*
|
||||
* This will throw if any value is unnamed, or if there are
|
||||
* any outstanding deferred errors.
|
||||
*/
|
||||
toObject(): Record<string, any>;
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
slice(start?: number | undefined, end?: number | undefined): Result;
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result;
|
||||
/**
|
||||
* Returns the value for %%name%%.
|
||||
*
|
||||
* Since it is possible to have a key whose name conflicts with
|
||||
* a method on a [[Result]] or its superclass Array, or any
|
||||
* JavaScript keyword, this ensures all named values are still
|
||||
* accessible by name.
|
||||
*/
|
||||
getValue(name: string): any;
|
||||
/**
|
||||
* Creates a new [[Result]] for %%items%% with each entry
|
||||
* also accessible by its corresponding name in %%keys%%.
|
||||
*/
|
||||
static fromItems(items: Array<any>, keys?: Array<null | string>): Result;
|
||||
}
|
||||
/**
|
||||
* Returns all errors found in a [[Result]].
|
||||
*
|
||||
* Since certain errors encountered when creating a [[Result]] do
|
||||
* not impact the ability to continue parsing data, they are
|
||||
* deferred until they are actually accessed. Hence a faulty string
|
||||
* in an Event that is never used does not impact the program flow.
|
||||
*
|
||||
* However, sometimes it may be useful to access, identify or
|
||||
* validate correctness of a [[Result]].
|
||||
*
|
||||
* @_docloc api/abi
|
||||
*/
|
||||
export declare function checkResultErrors(result: Result): Array<{
|
||||
path: Array<string | number>;
|
||||
error: Error;
|
||||
}>;
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare abstract class Coder {
|
||||
readonly name: string;
|
||||
readonly type: string;
|
||||
readonly localName: string;
|
||||
readonly dynamic: boolean;
|
||||
constructor(name: string, type: string, localName: string, dynamic: boolean);
|
||||
_throwError(message: string, value: any): never;
|
||||
abstract encode(writer: Writer, value: any): number;
|
||||
abstract decode(reader: Reader): any;
|
||||
abstract defaultValue(): any;
|
||||
}
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class Writer {
|
||||
#private;
|
||||
constructor();
|
||||
get data(): string;
|
||||
get length(): number;
|
||||
appendWriter(writer: Writer): number;
|
||||
writeBytes(value: BytesLike): number;
|
||||
writeValue(value: BigNumberish): number;
|
||||
writeUpdatableValue(): (value: BigNumberish) => void;
|
||||
}
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class Reader {
|
||||
#private;
|
||||
readonly allowLoose: boolean;
|
||||
constructor(data: BytesLike, allowLoose?: boolean);
|
||||
get data(): string;
|
||||
get dataLength(): number;
|
||||
get consumed(): number;
|
||||
get bytes(): Uint8Array;
|
||||
subReader(offset: number): Reader;
|
||||
readBytes(length: number, loose?: boolean): Uint8Array;
|
||||
readValue(): bigint;
|
||||
readIndex(): number;
|
||||
}
|
@ -112,12 +112,14 @@ class Result extends Array {
|
||||
* errors.
|
||||
*/
|
||||
toArray() {
|
||||
const result = [];
|
||||
this.forEach((item, index) => {
|
||||
if (item instanceof Error) {
|
||||
throwError(`index ${index}`, item);
|
||||
}
|
||||
result.push(item);
|
||||
});
|
||||
return Array.of(this);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Returns the Result as an Object with each name-value pair.
|
||||
@ -144,9 +146,24 @@ class Result extends Array {
|
||||
if (start == null) {
|
||||
start = 0;
|
||||
}
|
||||
if (start < 0) {
|
||||
start += this.length;
|
||||
if (start < 0) {
|
||||
start = 0;
|
||||
}
|
||||
}
|
||||
if (end == null) {
|
||||
end = this.length;
|
||||
}
|
||||
if (end < 0) {
|
||||
end += this.length;
|
||||
if (end < 0) {
|
||||
end = 0;
|
||||
}
|
||||
}
|
||||
if (end > this.length) {
|
||||
end = this.length;
|
||||
}
|
||||
const result = [], names = [];
|
||||
for (let i = start; i < end; i++) {
|
||||
result.push(this[i]);
|
||||
|
File diff suppressed because one or more lines are too long
12
lib.commonjs/abi/coders/address.d.ts
vendored
12
lib.commonjs/abi/coders/address.d.ts
vendored
@ -1,12 +0,0 @@
|
||||
import { Typed } from "../typed.js";
|
||||
import { Coder } from "./abstract-coder.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class AddressCoder extends Coder {
|
||||
constructor(localName: string);
|
||||
defaultValue(): string;
|
||||
encode(writer: Writer, _value: string | Typed): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
14
lib.commonjs/abi/coders/anonymous.d.ts
vendored
14
lib.commonjs/abi/coders/anonymous.d.ts
vendored
@ -1,14 +0,0 @@
|
||||
import { Coder } from "./abstract-coder.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* Clones the functionality of an existing Coder, but without a localName
|
||||
*
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class AnonymousCoder extends Coder {
|
||||
private coder;
|
||||
constructor(coder: Coder);
|
||||
defaultValue(): any;
|
||||
encode(writer: Writer, value: any): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
24
lib.commonjs/abi/coders/array.d.ts
vendored
24
lib.commonjs/abi/coders/array.d.ts
vendored
@ -1,24 +0,0 @@
|
||||
import { Typed } from "../typed.js";
|
||||
import { Coder, Result, Writer } from "./abstract-coder.js";
|
||||
import type { Reader } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare function pack(writer: Writer, coders: ReadonlyArray<Coder>, values: Array<any> | {
|
||||
[name: string]: any;
|
||||
}): number;
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare function unpack(reader: Reader, coders: ReadonlyArray<Coder>): Result;
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class ArrayCoder extends Coder {
|
||||
readonly coder: Coder;
|
||||
readonly length: number;
|
||||
constructor(coder: Coder, length: number, localName: string);
|
||||
defaultValue(): Array<any>;
|
||||
encode(writer: Writer, _value: Array<any> | Typed): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
@ -18,7 +18,7 @@ function pack(writer, coders, values) {
|
||||
arrayValues = coders.map((coder) => {
|
||||
const name = coder.localName;
|
||||
(0, index_js_1.assert)(name, "cannot encode object for signature with missing names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values });
|
||||
(0, index_js_1.assert)(unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values });
|
||||
(0, index_js_1.assert)(!unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values });
|
||||
unique[name] = true;
|
||||
return values[name];
|
||||
});
|
||||
|
File diff suppressed because one or more lines are too long
12
lib.commonjs/abi/coders/boolean.d.ts
vendored
12
lib.commonjs/abi/coders/boolean.d.ts
vendored
@ -1,12 +0,0 @@
|
||||
import { Typed } from "../typed.js";
|
||||
import { Coder } from "./abstract-coder.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class BooleanCoder extends Coder {
|
||||
constructor(localName: string);
|
||||
defaultValue(): boolean;
|
||||
encode(writer: Writer, _value: boolean | Typed): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
18
lib.commonjs/abi/coders/bytes.d.ts
vendored
18
lib.commonjs/abi/coders/bytes.d.ts
vendored
@ -1,18 +0,0 @@
|
||||
import { Coder } from "./abstract-coder.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class DynamicBytesCoder extends Coder {
|
||||
constructor(type: string, localName: string);
|
||||
defaultValue(): string;
|
||||
encode(writer: Writer, value: any): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class BytesCoder extends DynamicBytesCoder {
|
||||
constructor(localName: string);
|
||||
decode(reader: Reader): any;
|
||||
}
|
14
lib.commonjs/abi/coders/fixed-bytes.d.ts
vendored
14
lib.commonjs/abi/coders/fixed-bytes.d.ts
vendored
@ -1,14 +0,0 @@
|
||||
import { Typed } from "../typed.js";
|
||||
import { Coder } from "./abstract-coder.js";
|
||||
import type { BytesLike } from "../../utils/index.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class FixedBytesCoder extends Coder {
|
||||
readonly size: number;
|
||||
constructor(size: number, localName: string);
|
||||
defaultValue(): string;
|
||||
encode(writer: Writer, _value: BytesLike | Typed): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
11
lib.commonjs/abi/coders/null.d.ts
vendored
11
lib.commonjs/abi/coders/null.d.ts
vendored
@ -1,11 +0,0 @@
|
||||
import { Coder } from "./abstract-coder.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class NullCoder extends Coder {
|
||||
constructor(localName: string);
|
||||
defaultValue(): null;
|
||||
encode(writer: Writer, value: any): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
15
lib.commonjs/abi/coders/number.d.ts
vendored
15
lib.commonjs/abi/coders/number.d.ts
vendored
@ -1,15 +0,0 @@
|
||||
import { Typed } from "../typed.js";
|
||||
import { Coder } from "./abstract-coder.js";
|
||||
import type { BigNumberish } from "../../utils/index.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class NumberCoder extends Coder {
|
||||
readonly size: number;
|
||||
readonly signed: boolean;
|
||||
constructor(size: number, signed: boolean, localName: string);
|
||||
defaultValue(): number;
|
||||
encode(writer: Writer, _value: BigNumberish | Typed): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
12
lib.commonjs/abi/coders/string.d.ts
vendored
12
lib.commonjs/abi/coders/string.d.ts
vendored
@ -1,12 +0,0 @@
|
||||
import { Typed } from "../typed.js";
|
||||
import { DynamicBytesCoder } from "./bytes.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class StringCoder extends DynamicBytesCoder {
|
||||
constructor(localName: string);
|
||||
defaultValue(): string;
|
||||
encode(writer: Writer, _value: string | Typed): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
15
lib.commonjs/abi/coders/tuple.d.ts
vendored
15
lib.commonjs/abi/coders/tuple.d.ts
vendored
@ -1,15 +0,0 @@
|
||||
import { Typed } from "../typed.js";
|
||||
import { Coder } from "./abstract-coder.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class TupleCoder extends Coder {
|
||||
readonly coders: ReadonlyArray<Coder>;
|
||||
constructor(coders: Array<Coder>, localName: string);
|
||||
defaultValue(): any;
|
||||
encode(writer: Writer, _value: Array<any> | {
|
||||
[name: string]: any;
|
||||
} | Typed): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
371
lib.commonjs/abi/fragments.d.ts
vendored
371
lib.commonjs/abi/fragments.d.ts
vendored
@ -1,371 +0,0 @@
|
||||
/**
|
||||
* About frgaments...
|
||||
*
|
||||
* @_subsection api/abi/abi-coder:Fragments [about-fragments]
|
||||
*/
|
||||
/**
|
||||
* A type description in a JSON API.
|
||||
*/
|
||||
export interface JsonFragmentType {
|
||||
/**
|
||||
* The parameter name.
|
||||
*/
|
||||
readonly name?: string;
|
||||
/**
|
||||
* If the parameter is indexed.
|
||||
*/
|
||||
readonly indexed?: boolean;
|
||||
/**
|
||||
* The type of the parameter.
|
||||
*/
|
||||
readonly type?: string;
|
||||
/**
|
||||
* The internal Solidity type.
|
||||
*/
|
||||
readonly internalType?: string;
|
||||
/**
|
||||
* The components for a tuple.
|
||||
*/
|
||||
readonly components?: ReadonlyArray<JsonFragmentType>;
|
||||
}
|
||||
/**
|
||||
* A fragment for a method, event or error in a JSON API.
|
||||
*/
|
||||
export interface JsonFragment {
|
||||
/**
|
||||
* The name of the error, event, function, etc.
|
||||
*/
|
||||
readonly name?: string;
|
||||
/**
|
||||
* The type of the fragment (e.g. ``event``, ``"function"``, etc.)
|
||||
*/
|
||||
readonly type?: string;
|
||||
/**
|
||||
* If the event is anonymous.
|
||||
*/
|
||||
readonly anonymous?: boolean;
|
||||
/**
|
||||
* If the function is payable.
|
||||
*/
|
||||
readonly payable?: boolean;
|
||||
/**
|
||||
* If the function is constant.
|
||||
*/
|
||||
readonly constant?: boolean;
|
||||
/**
|
||||
* The mutability state of the function.
|
||||
*/
|
||||
readonly stateMutability?: string;
|
||||
/**
|
||||
* The input parameters.
|
||||
*/
|
||||
readonly inputs?: ReadonlyArray<JsonFragmentType>;
|
||||
/**
|
||||
* The output parameters.
|
||||
*/
|
||||
readonly outputs?: ReadonlyArray<JsonFragmentType>;
|
||||
/**
|
||||
* The gas limit to use when sending a transaction for this function.
|
||||
*/
|
||||
readonly gas?: string;
|
||||
}
|
||||
/**
|
||||
* The format to serialize the output as.
|
||||
*/
|
||||
export type FormatType = "sighash" | "minimal" | "full" | "json";
|
||||
/**
|
||||
* When [walking](ParamType-walk) a [[ParamType]], this is called
|
||||
* on each component.
|
||||
*/
|
||||
export type ParamTypeWalkFunc = (type: string, value: any) => any;
|
||||
/**
|
||||
* When [walking asynchronously](ParamType-walkAsync) a [[ParamType]],
|
||||
* this is called on each component.
|
||||
*/
|
||||
export type ParamTypeWalkAsyncFunc = (type: string, value: any) => any | Promise<any>;
|
||||
/**
|
||||
* Each input and output of a [[Fragment]] is an Array of **PAramType**.
|
||||
*/
|
||||
export declare class ParamType {
|
||||
#private;
|
||||
/**
|
||||
* The local name of the parameter (or ``""`` if unbound)
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``,
|
||||
* ``"uint256[3][]"``)
|
||||
*/
|
||||
readonly type: string;
|
||||
/**
|
||||
* The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``)
|
||||
*/
|
||||
readonly baseType: string;
|
||||
/**
|
||||
* True if the parameters is indexed.
|
||||
*
|
||||
* For non-indexable types this is ``null``.
|
||||
*/
|
||||
readonly indexed: null | boolean;
|
||||
/**
|
||||
* The components for the tuple.
|
||||
*
|
||||
* For non-tuple types this is ``null``.
|
||||
*/
|
||||
readonly components: null | ReadonlyArray<ParamType>;
|
||||
/**
|
||||
* The array length, or ``-1`` for dynamic-lengthed arrays.
|
||||
*
|
||||
* For non-array types this is ``null``.
|
||||
*/
|
||||
readonly arrayLength: null | number;
|
||||
/**
|
||||
* The type of each child in the array.
|
||||
*
|
||||
* For non-array types this is ``null``.
|
||||
*/
|
||||
readonly arrayChildren: null | ParamType;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard: any, name: string, type: string, baseType: string, indexed: null | boolean, components: null | ReadonlyArray<ParamType>, arrayLength: null | number, arrayChildren: null | ParamType);
|
||||
/**
|
||||
* Return a string representation of this type.
|
||||
*
|
||||
* For example,
|
||||
*
|
||||
* ``sighash" => "(uint256,address)"``
|
||||
*
|
||||
* ``"minimal" => "tuple(uint256,address) indexed"``
|
||||
*
|
||||
* ``"full" => "tuple(uint256 foo, address bar) indexed baz"``
|
||||
*/
|
||||
format(format?: FormatType): string;
|
||||
/**
|
||||
* Returns true if %%this%% is an Array type.
|
||||
*
|
||||
* This provides a type gaurd ensuring that [[arrayChildren]]
|
||||
* and [[arrayLength]] are non-null.
|
||||
*/
|
||||
isArray(): this is (ParamType & {
|
||||
arrayChildren: ParamType;
|
||||
arrayLength: number;
|
||||
});
|
||||
/**
|
||||
* Returns true if %%this%% is a Tuple type.
|
||||
*
|
||||
* This provides a type gaurd ensuring that [[components]]
|
||||
* is non-null.
|
||||
*/
|
||||
isTuple(): this is (ParamType & {
|
||||
components: ReadonlyArray<ParamType>;
|
||||
});
|
||||
/**
|
||||
* Returns true if %%this%% is an Indexable type.
|
||||
*
|
||||
* This provides a type gaurd ensuring that [[indexed]]
|
||||
* is non-null.
|
||||
*/
|
||||
isIndexable(): this is (ParamType & {
|
||||
indexed: boolean;
|
||||
});
|
||||
/**
|
||||
* Walks the **ParamType** with %%value%%, calling %%process%%
|
||||
* on each type, destructing the %%value%% recursively.
|
||||
*/
|
||||
walk(value: any, process: ParamTypeWalkFunc): any;
|
||||
/**
|
||||
* Walks the **ParamType** with %%value%%, asynchronously calling
|
||||
* %%process%% on each type, destructing the %%value%% recursively.
|
||||
*
|
||||
* This can be used to resolve ENS naes by walking and resolving each
|
||||
* ``"address"`` type.
|
||||
*/
|
||||
walkAsync(value: any, process: ParamTypeWalkAsyncFunc): Promise<any>;
|
||||
/**
|
||||
* Creates a new **ParamType** for %%obj%%.
|
||||
*
|
||||
* If %%allowIndexed%% then the ``indexed`` keyword is permitted,
|
||||
* otherwise the ``indexed`` keyword will throw an error.
|
||||
*/
|
||||
static from(obj: any, allowIndexed?: boolean): ParamType;
|
||||
/**
|
||||
* Returns true if %%value%% is a **ParamType**.
|
||||
*/
|
||||
static isParamType(value: any): value is ParamType;
|
||||
}
|
||||
/**
|
||||
* The type of a [[Fragment]].
|
||||
*/
|
||||
export type FragmentType = "constructor" | "error" | "event" | "fallback" | "function" | "struct";
|
||||
/**
|
||||
* An abstract class to represent An individual fragment from a parse ABI.
|
||||
*/
|
||||
export declare abstract class Fragment {
|
||||
/**
|
||||
* The type of the fragment.
|
||||
*/
|
||||
readonly type: FragmentType;
|
||||
/**
|
||||
* The inputs for the fragment.
|
||||
*/
|
||||
readonly inputs: ReadonlyArray<ParamType>;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard: any, type: FragmentType, inputs: ReadonlyArray<ParamType>);
|
||||
/**
|
||||
* Returns a string representation of this fragment.
|
||||
*/
|
||||
abstract format(format?: FormatType): string;
|
||||
/**
|
||||
* Creates a new **Fragment** for %%obj%%, wich can be any supported
|
||||
* ABI frgament type.
|
||||
*/
|
||||
static from(obj: any): Fragment;
|
||||
/**
|
||||
* Returns true if %%value%% is a [[ConstructorFragment]].
|
||||
*/
|
||||
static isConstructor(value: any): value is ConstructorFragment;
|
||||
/**
|
||||
* Returns true if %%value%% is an [[ErrorFragment]].
|
||||
*/
|
||||
static isError(value: any): value is ErrorFragment;
|
||||
/**
|
||||
* Returns true if %%value%% is an [[EventFragment]].
|
||||
*/
|
||||
static isEvent(value: any): value is EventFragment;
|
||||
/**
|
||||
* Returns true if %%value%% is a [[FunctionFragment]].
|
||||
*/
|
||||
static isFunction(value: any): value is FunctionFragment;
|
||||
/**
|
||||
* Returns true if %%value%% is a [[StructFragment]].
|
||||
*/
|
||||
static isStruct(value: any): value is StructFragment;
|
||||
}
|
||||
/**
|
||||
* An abstract class to represent An individual fragment
|
||||
* which has a name from a parse ABI.
|
||||
*/
|
||||
export declare abstract class NamedFragment extends Fragment {
|
||||
/**
|
||||
* The name of the fragment.
|
||||
*/
|
||||
readonly name: string;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard: any, type: FragmentType, name: string, inputs: ReadonlyArray<ParamType>);
|
||||
}
|
||||
/**
|
||||
* A Fragment which represents a //Custom Error//.
|
||||
*/
|
||||
export declare class ErrorFragment extends NamedFragment {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard: any, name: string, inputs: ReadonlyArray<ParamType>);
|
||||
/**
|
||||
* The Custom Error selector.
|
||||
*/
|
||||
get selector(): string;
|
||||
format(format?: FormatType): string;
|
||||
static from(obj: any): ErrorFragment;
|
||||
static isFragment(value: any): value is ErrorFragment;
|
||||
}
|
||||
/**
|
||||
* A Fragment which represents an Event.
|
||||
*/
|
||||
export declare class EventFragment extends NamedFragment {
|
||||
readonly anonymous: boolean;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard: any, name: string, inputs: ReadonlyArray<ParamType>, anonymous: boolean);
|
||||
/**
|
||||
* The Event topic hash.
|
||||
*/
|
||||
get topicHash(): string;
|
||||
format(format?: FormatType): string;
|
||||
static getTopicHash(name: string, params?: Array<any>): string;
|
||||
static from(obj: any): EventFragment;
|
||||
static isFragment(value: any): value is EventFragment;
|
||||
}
|
||||
/**
|
||||
* A Fragment which represents a constructor.
|
||||
*/
|
||||
export declare class ConstructorFragment extends Fragment {
|
||||
readonly payable: boolean;
|
||||
readonly gas: null | bigint;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard: any, type: FragmentType, inputs: ReadonlyArray<ParamType>, payable: boolean, gas: null | bigint);
|
||||
format(format?: FormatType): string;
|
||||
static from(obj: any): ConstructorFragment;
|
||||
static isFragment(value: any): value is ConstructorFragment;
|
||||
}
|
||||
/**
|
||||
* A Fragment which represents a method.
|
||||
*/
|
||||
export declare class FallbackFragment extends Fragment {
|
||||
/**
|
||||
* If the function can be sent value during invocation.
|
||||
*/
|
||||
readonly payable: boolean;
|
||||
constructor(guard: any, inputs: ReadonlyArray<ParamType>, payable: boolean);
|
||||
format(format?: FormatType): string;
|
||||
static from(obj: any): FallbackFragment;
|
||||
static isFragment(value: any): value is FallbackFragment;
|
||||
}
|
||||
/**
|
||||
* A Fragment which represents a method.
|
||||
*/
|
||||
export declare class FunctionFragment extends NamedFragment {
|
||||
/**
|
||||
* If the function is constant (e.g. ``pure`` or ``view`` functions).
|
||||
*/
|
||||
readonly constant: boolean;
|
||||
/**
|
||||
* The returned types for the result of calling this function.
|
||||
*/
|
||||
readonly outputs: ReadonlyArray<ParamType>;
|
||||
/**
|
||||
* The state mutability (e.g. ``payable``, ``nonpayable``, ``view``
|
||||
* or ``pure``)
|
||||
*/
|
||||
readonly stateMutability: "payable" | "nonpayable" | "view" | "pure";
|
||||
/**
|
||||
* If the function can be sent value during invocation.
|
||||
*/
|
||||
readonly payable: boolean;
|
||||
/**
|
||||
* The amount of gas to send when calling this function
|
||||
*/
|
||||
readonly gas: null | bigint;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard: any, name: string, stateMutability: "payable" | "nonpayable" | "view" | "pure", inputs: ReadonlyArray<ParamType>, outputs: ReadonlyArray<ParamType>, gas: null | bigint);
|
||||
/**
|
||||
* The Function selector.
|
||||
*/
|
||||
get selector(): string;
|
||||
format(format?: FormatType): string;
|
||||
static getSelector(name: string, params?: Array<any>): string;
|
||||
static from(obj: any): FunctionFragment;
|
||||
static isFragment(value: any): value is FunctionFragment;
|
||||
}
|
||||
/**
|
||||
* A Fragment which represents a structure.
|
||||
*/
|
||||
export declare class StructFragment extends NamedFragment {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard: any, name: string, inputs: ReadonlyArray<ParamType>);
|
||||
format(): string;
|
||||
static from(obj: any): StructFragment;
|
||||
static isFragment(value: any): value is FunctionFragment;
|
||||
}
|
@ -671,7 +671,7 @@ class ParamType {
|
||||
});
|
||||
return new ParamType(_guard, name || "", type, "array", indexed, null, arrayLength, arrayChildren);
|
||||
}
|
||||
if (type === "tuple" || type.substring(0, 5) === "tuple(" || type[0] === "(") {
|
||||
if (type === "tuple" || type.startsWith("tuple(" /* fix: ) */) || type.startsWith("(" /* fix: ) */)) {
|
||||
const comps = (obj.components != null) ? obj.components.map((c) => ParamType.from(c)) : null;
|
||||
const tuple = new ParamType(_guard, name || "", type, "tuple", indexed, comps, null, null);
|
||||
// @TODO: use lexer to validate and normalize type
|
||||
|
File diff suppressed because one or more lines are too long
13
lib.commonjs/abi/index.d.ts
vendored
13
lib.commonjs/abi/index.d.ts
vendored
@ -1,13 +0,0 @@
|
||||
/**
|
||||
* Explain about ABI here...
|
||||
*
|
||||
* @_section api/abi:Application Binary Interface [about-abi]
|
||||
* @_navTitle: ABI
|
||||
*/
|
||||
export { AbiCoder } from "./abi-coder.js";
|
||||
export { decodeBytes32String, encodeBytes32String } from "./bytes32.js";
|
||||
export { ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, Fragment, FunctionFragment, NamedFragment, ParamType, StructFragment, } from "./fragments.js";
|
||||
export { checkResultErrors, Indexed, Interface, ErrorDescription, LogDescription, TransactionDescription, Result } from "./interface.js";
|
||||
export { Typed } from "./typed.js";
|
||||
export type { JsonFragment, JsonFragmentType, FormatType, FragmentType, ParamTypeWalkAsyncFunc, ParamTypeWalkFunc } from "./fragments.js";
|
||||
export type { InterfaceAbi, } from "./interface.js";
|
253
lib.commonjs/abi/interface.d.ts
vendored
253
lib.commonjs/abi/interface.d.ts
vendored
@ -1,253 +0,0 @@
|
||||
/**
|
||||
* About Interface
|
||||
*
|
||||
* @_subsection api/abi:Interfaces [interfaces]
|
||||
*/
|
||||
import { AbiCoder } from "./abi-coder.js";
|
||||
import { checkResultErrors, Result } from "./coders/abstract-coder.js";
|
||||
import { ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, Fragment, FunctionFragment, ParamType } from "./fragments.js";
|
||||
import { Typed } from "./typed.js";
|
||||
import type { BigNumberish, BytesLike, CallExceptionError, CallExceptionTransaction } from "../utils/index.js";
|
||||
import type { JsonFragment } from "./fragments.js";
|
||||
export { checkResultErrors, Result };
|
||||
export declare class LogDescription {
|
||||
readonly fragment: EventFragment;
|
||||
readonly name: string;
|
||||
readonly signature: string;
|
||||
readonly topic: string;
|
||||
readonly args: Result;
|
||||
constructor(fragment: EventFragment, topic: string, args: Result);
|
||||
}
|
||||
export declare class TransactionDescription {
|
||||
readonly fragment: FunctionFragment;
|
||||
readonly name: string;
|
||||
readonly args: Result;
|
||||
readonly signature: string;
|
||||
readonly selector: string;
|
||||
readonly value: bigint;
|
||||
constructor(fragment: FunctionFragment, selector: string, args: Result, value: bigint);
|
||||
}
|
||||
export declare class ErrorDescription {
|
||||
readonly fragment: ErrorFragment;
|
||||
readonly name: string;
|
||||
readonly args: Result;
|
||||
readonly signature: string;
|
||||
readonly selector: string;
|
||||
constructor(fragment: ErrorFragment, selector: string, args: Result);
|
||||
}
|
||||
export declare class Indexed {
|
||||
readonly hash: null | string;
|
||||
readonly _isIndexed: boolean;
|
||||
static isIndexed(value: any): value is Indexed;
|
||||
constructor(hash: null | string);
|
||||
}
|
||||
/**
|
||||
* @TODO
|
||||
*/
|
||||
export type InterfaceAbi = string | ReadonlyArray<Fragment | JsonFragment | string>;
|
||||
/**
|
||||
* An Interface abstracts many of the low-level details for
|
||||
* encoding and decoding the data on the blockchain.
|
||||
*
|
||||
* An ABI provides information on how to encode data to send to
|
||||
* a Contract, how to decode the results and events and how to
|
||||
* interpret revert errors.
|
||||
*
|
||||
* The ABI can be specified by [any supported format](InterfaceAbi).
|
||||
*/
|
||||
export declare class Interface {
|
||||
#private;
|
||||
/**
|
||||
* All the Contract ABI members (i.e. methods, events, errors, etc).
|
||||
*/
|
||||
readonly fragments: ReadonlyArray<Fragment>;
|
||||
/**
|
||||
* The Contract constructor.
|
||||
*/
|
||||
readonly deploy: ConstructorFragment;
|
||||
/**
|
||||
* The Fallback method, if any.
|
||||
*/
|
||||
readonly fallback: null | FallbackFragment;
|
||||
/**
|
||||
* If receiving ether is supported.
|
||||
*/
|
||||
readonly receive: boolean;
|
||||
/**
|
||||
* Create a new Interface for the %%fragments%%.
|
||||
*/
|
||||
constructor(fragments: InterfaceAbi);
|
||||
/**
|
||||
* Returns the entire Human-Readable ABI, as an array of
|
||||
* signatures, optionally as %%minimal%% strings, which
|
||||
* removes parameter names and unneceesary spaces.
|
||||
*/
|
||||
format(minimal?: boolean): Array<string>;
|
||||
/**
|
||||
* Return the JSON-encoded ABI. This is the format Solidiy
|
||||
* returns.
|
||||
*/
|
||||
formatJson(): string;
|
||||
/**
|
||||
* The ABI coder that will be used to encode and decode binary
|
||||
* data.
|
||||
*/
|
||||
getAbiCoder(): AbiCoder;
|
||||
/**
|
||||
* Get the function name for %%key%%, which may be a function selector,
|
||||
* function name or function signature that belongs to the ABI.
|
||||
*/
|
||||
getFunctionName(key: string): string;
|
||||
/**
|
||||
* Get the [[FunctionFragment]] for %%key%%, which may be a function
|
||||
* selector, function name or function signature that belongs to the ABI.
|
||||
*
|
||||
* If %%values%% is provided, it will use the Typed API to handle
|
||||
* ambiguous cases where multiple functions match by name.
|
||||
*
|
||||
* If the %%key%% and %%values%% do not refine to a single function in
|
||||
* the ABI, this will throw.
|
||||
*/
|
||||
getFunction(key: string, values?: Array<any | Typed>): null | FunctionFragment;
|
||||
/**
|
||||
* Iterate over all functions, calling %%callback%%, sorted by their name.
|
||||
*/
|
||||
forEachFunction(callback: (func: FunctionFragment, index: number) => void): void;
|
||||
/**
|
||||
* Get the event name for %%key%%, which may be a topic hash,
|
||||
* event name or event signature that belongs to the ABI.
|
||||
*/
|
||||
getEventName(key: string): string;
|
||||
/**
|
||||
* Get the [[EventFragment]] for %%key%%, which may be a topic hash,
|
||||
* event name or event signature that belongs to the ABI.
|
||||
*
|
||||
* If %%values%% is provided, it will use the Typed API to handle
|
||||
* ambiguous cases where multiple events match by name.
|
||||
*
|
||||
* If the %%key%% and %%values%% do not refine to a single event in
|
||||
* the ABI, this will throw.
|
||||
*/
|
||||
getEvent(key: string, values?: Array<any | Typed>): null | EventFragment;
|
||||
/**
|
||||
* Iterate over all events, calling %%callback%%, sorted by their name.
|
||||
*/
|
||||
forEachEvent(callback: (func: EventFragment, index: number) => void): void;
|
||||
/**
|
||||
* Get the [[ErrorFragment]] for %%key%%, which may be an error
|
||||
* selector, error name or error signature that belongs to the ABI.
|
||||
*
|
||||
* If %%values%% is provided, it will use the Typed API to handle
|
||||
* ambiguous cases where multiple errors match by name.
|
||||
*
|
||||
* If the %%key%% and %%values%% do not refine to a single error in
|
||||
* the ABI, this will throw.
|
||||
*/
|
||||
getError(key: string, values?: Array<any | Typed>): null | ErrorFragment;
|
||||
/**
|
||||
* Iterate over all errors, calling %%callback%%, sorted by their name.
|
||||
*/
|
||||
forEachError(callback: (func: ErrorFragment, index: number) => void): void;
|
||||
_decodeParams(params: ReadonlyArray<ParamType>, data: BytesLike): Result;
|
||||
_encodeParams(params: ReadonlyArray<ParamType>, values: ReadonlyArray<any>): string;
|
||||
/**
|
||||
* Encodes a ``tx.data`` object for deploying the Contract with
|
||||
* the %%values%% as the constructor arguments.
|
||||
*/
|
||||
encodeDeploy(values?: ReadonlyArray<any>): string;
|
||||
/**
|
||||
* Decodes the result %%data%% (e.g. from an ``eth_call``) for the
|
||||
* specified error (see [[getError]] for valid values for
|
||||
* %%key%%).
|
||||
*
|
||||
* Most developers should prefer the [[parseCallResult]] method instead,
|
||||
* which will automatically detect a ``CALL_EXCEPTION`` and throw the
|
||||
* corresponding error.
|
||||
*/
|
||||
decodeErrorResult(fragment: ErrorFragment | string, data: BytesLike): Result;
|
||||
/**
|
||||
* Encodes the transaction revert data for a call result that
|
||||
* reverted from the the Contract with the sepcified %%error%%
|
||||
* (see [[getError]] for valid values for %%fragment%%) with the %%values%%.
|
||||
*
|
||||
* This is generally not used by most developers, unless trying to mock
|
||||
* a result from a Contract.
|
||||
*/
|
||||
encodeErrorResult(fragment: ErrorFragment | string, values?: ReadonlyArray<any>): string;
|
||||
/**
|
||||
* Decodes the %%data%% from a transaction ``tx.data`` for
|
||||
* the function specified (see [[getFunction]] for valid values
|
||||
* for %%fragment%%).
|
||||
*
|
||||
* Most developers should prefer the [[parseTransaction]] method
|
||||
* instead, which will automatically detect the fragment.
|
||||
*/
|
||||
decodeFunctionData(fragment: FunctionFragment | string, data: BytesLike): Result;
|
||||
/**
|
||||
* Encodes the ``tx.data`` for a transaction that calls the function
|
||||
* specified (see [[getFunction]] for valid values for %%fragment%%) with
|
||||
* the %%values%%.
|
||||
*/
|
||||
encodeFunctionData(fragment: FunctionFragment | string, values?: ReadonlyArray<any>): string;
|
||||
/**
|
||||
* Decodes the result %%data%% (e.g. from an ``eth_call``) for the
|
||||
* specified function (see [[getFunction]] for valid values for
|
||||
* %%key%%).
|
||||
*
|
||||
* Most developers should prefer the [[parseCallResult]] method instead,
|
||||
* which will automatically detect a ``CALL_EXCEPTION`` and throw the
|
||||
* corresponding error.
|
||||
*/
|
||||
decodeFunctionResult(fragment: FunctionFragment | string, data: BytesLike): Result;
|
||||
makeError(_data: BytesLike, tx: CallExceptionTransaction): CallExceptionError;
|
||||
/**
|
||||
* Encodes the result data (e.g. from an ``eth_call``) for the
|
||||
* specified function (see [[getFunction]] for valid values
|
||||
* for %%fragment%%) with %%values%%.
|
||||
*
|
||||
* This is generally not used by most developers, unless trying to mock
|
||||
* a result from a Contract.
|
||||
*/
|
||||
encodeFunctionResult(fragment: FunctionFragment | string, values?: ReadonlyArray<any>): string;
|
||||
encodeFilterTopics(fragment: EventFragment | string, values: ReadonlyArray<any>): Array<null | string | Array<string>>;
|
||||
encodeEventLog(fragment: EventFragment | string, values: ReadonlyArray<any>): {
|
||||
data: string;
|
||||
topics: Array<string>;
|
||||
};
|
||||
decodeEventLog(fragment: EventFragment | string, data: BytesLike, topics?: ReadonlyArray<string>): Result;
|
||||
/**
|
||||
* Parses a transaction, finding the matching function and extracts
|
||||
* the parameter values along with other useful function details.
|
||||
*
|
||||
* If the matching function cannot be found, return null.
|
||||
*/
|
||||
parseTransaction(tx: {
|
||||
data: string;
|
||||
value?: BigNumberish;
|
||||
}): null | TransactionDescription;
|
||||
parseCallResult(data: BytesLike): Result;
|
||||
/**
|
||||
* Parses a receipt log, finding the matching event and extracts
|
||||
* the parameter values along with other useful event details.
|
||||
*
|
||||
* If the matching event cannot be found, returns null.
|
||||
*/
|
||||
parseLog(log: {
|
||||
topics: Array<string>;
|
||||
data: string;
|
||||
}): null | LogDescription;
|
||||
/**
|
||||
* Parses a revert data, finding the matching error and extracts
|
||||
* the parameter values along with other useful error details.
|
||||
*
|
||||
* If the matching event cannot be found, returns null.
|
||||
*/
|
||||
parseError(data: BytesLike): null | ErrorDescription;
|
||||
/**
|
||||
* Creates a new [[Interface]] from the ABI %%value%%.
|
||||
*
|
||||
* The %%value%% may be provided as an existing [[Interface]] object,
|
||||
* a JSON-encoded ABI or any Human-Readable ABI format.
|
||||
*/
|
||||
static from(value: InterfaceAbi | Interface): Interface;
|
||||
}
|
162
lib.commonjs/abi/typed.d.ts
vendored
162
lib.commonjs/abi/typed.d.ts
vendored
@ -1,162 +0,0 @@
|
||||
/**
|
||||
* About typed...
|
||||
*
|
||||
* @_subsection: api/abi:Typed Values
|
||||
*/
|
||||
import type { Addressable } from "../address/index.js";
|
||||
import type { BigNumberish, BytesLike } from "../utils/index.js";
|
||||
import type { Result } from "./coders/abstract-coder.js";
|
||||
export interface TypedNumber extends Typed {
|
||||
value: number;
|
||||
defaultValue(): number;
|
||||
minValue(): number;
|
||||
maxValue(): number;
|
||||
}
|
||||
export interface TypedBigInt extends Typed {
|
||||
value: bigint;
|
||||
defaultValue(): bigint;
|
||||
minValue(): bigint;
|
||||
maxValue(): bigint;
|
||||
}
|
||||
export interface TypedData extends Typed {
|
||||
value: string;
|
||||
defaultValue(): string;
|
||||
}
|
||||
export interface TypedString extends Typed {
|
||||
value: string;
|
||||
defaultValue(): string;
|
||||
}
|
||||
export declare class Typed {
|
||||
#private;
|
||||
readonly type: string;
|
||||
readonly value: any;
|
||||
readonly _typedSymbol: Symbol;
|
||||
constructor(gaurd: any, type: string, value: any, options?: any);
|
||||
format(): string;
|
||||
defaultValue(): string | number | bigint | Result;
|
||||
minValue(): string | number | bigint;
|
||||
maxValue(): string | number | bigint;
|
||||
isBigInt(): this is TypedBigInt;
|
||||
isData(): this is TypedData;
|
||||
isString(): this is TypedString;
|
||||
get tupleName(): null | string;
|
||||
get arrayLength(): null | number;
|
||||
static from(type: string, value: any): Typed;
|
||||
static uint8(v: BigNumberish): Typed;
|
||||
static uint16(v: BigNumberish): Typed;
|
||||
static uint24(v: BigNumberish): Typed;
|
||||
static uint32(v: BigNumberish): Typed;
|
||||
static uint40(v: BigNumberish): Typed;
|
||||
static uint48(v: BigNumberish): Typed;
|
||||
static uint56(v: BigNumberish): Typed;
|
||||
static uint64(v: BigNumberish): Typed;
|
||||
static uint72(v: BigNumberish): Typed;
|
||||
static uint80(v: BigNumberish): Typed;
|
||||
static uint88(v: BigNumberish): Typed;
|
||||
static uint96(v: BigNumberish): Typed;
|
||||
static uint104(v: BigNumberish): Typed;
|
||||
static uint112(v: BigNumberish): Typed;
|
||||
static uint120(v: BigNumberish): Typed;
|
||||
static uint128(v: BigNumberish): Typed;
|
||||
static uint136(v: BigNumberish): Typed;
|
||||
static uint144(v: BigNumberish): Typed;
|
||||
static uint152(v: BigNumberish): Typed;
|
||||
static uint160(v: BigNumberish): Typed;
|
||||
static uint168(v: BigNumberish): Typed;
|
||||
static uint176(v: BigNumberish): Typed;
|
||||
static uint184(v: BigNumberish): Typed;
|
||||
static uint192(v: BigNumberish): Typed;
|
||||
static uint200(v: BigNumberish): Typed;
|
||||
static uint208(v: BigNumberish): Typed;
|
||||
static uint216(v: BigNumberish): Typed;
|
||||
static uint224(v: BigNumberish): Typed;
|
||||
static uint232(v: BigNumberish): Typed;
|
||||
static uint240(v: BigNumberish): Typed;
|
||||
static uint248(v: BigNumberish): Typed;
|
||||
static uint256(v: BigNumberish): Typed;
|
||||
static uint(v: BigNumberish): Typed;
|
||||
static int8(v: BigNumberish): Typed;
|
||||
static int16(v: BigNumberish): Typed;
|
||||
static int24(v: BigNumberish): Typed;
|
||||
static int32(v: BigNumberish): Typed;
|
||||
static int40(v: BigNumberish): Typed;
|
||||
static int48(v: BigNumberish): Typed;
|
||||
static int56(v: BigNumberish): Typed;
|
||||
static int64(v: BigNumberish): Typed;
|
||||
static int72(v: BigNumberish): Typed;
|
||||
static int80(v: BigNumberish): Typed;
|
||||
static int88(v: BigNumberish): Typed;
|
||||
static int96(v: BigNumberish): Typed;
|
||||
static int104(v: BigNumberish): Typed;
|
||||
static int112(v: BigNumberish): Typed;
|
||||
static int120(v: BigNumberish): Typed;
|
||||
static int128(v: BigNumberish): Typed;
|
||||
static int136(v: BigNumberish): Typed;
|
||||
static int144(v: BigNumberish): Typed;
|
||||
static int152(v: BigNumberish): Typed;
|
||||
static int160(v: BigNumberish): Typed;
|
||||
static int168(v: BigNumberish): Typed;
|
||||
static int176(v: BigNumberish): Typed;
|
||||
static int184(v: BigNumberish): Typed;
|
||||
static int192(v: BigNumberish): Typed;
|
||||
static int200(v: BigNumberish): Typed;
|
||||
static int208(v: BigNumberish): Typed;
|
||||
static int216(v: BigNumberish): Typed;
|
||||
static int224(v: BigNumberish): Typed;
|
||||
static int232(v: BigNumberish): Typed;
|
||||
static int240(v: BigNumberish): Typed;
|
||||
static int248(v: BigNumberish): Typed;
|
||||
static int256(v: BigNumberish): Typed;
|
||||
static int(v: BigNumberish): Typed;
|
||||
static bytes1(v: BytesLike): Typed;
|
||||
static bytes2(v: BytesLike): Typed;
|
||||
static bytes3(v: BytesLike): Typed;
|
||||
static bytes4(v: BytesLike): Typed;
|
||||
static bytes5(v: BytesLike): Typed;
|
||||
static bytes6(v: BytesLike): Typed;
|
||||
static bytes7(v: BytesLike): Typed;
|
||||
static bytes8(v: BytesLike): Typed;
|
||||
static bytes9(v: BytesLike): Typed;
|
||||
static bytes10(v: BytesLike): Typed;
|
||||
static bytes11(v: BytesLike): Typed;
|
||||
static bytes12(v: BytesLike): Typed;
|
||||
static bytes13(v: BytesLike): Typed;
|
||||
static bytes14(v: BytesLike): Typed;
|
||||
static bytes15(v: BytesLike): Typed;
|
||||
static bytes16(v: BytesLike): Typed;
|
||||
static bytes17(v: BytesLike): Typed;
|
||||
static bytes18(v: BytesLike): Typed;
|
||||
static bytes19(v: BytesLike): Typed;
|
||||
static bytes20(v: BytesLike): Typed;
|
||||
static bytes21(v: BytesLike): Typed;
|
||||
static bytes22(v: BytesLike): Typed;
|
||||
static bytes23(v: BytesLike): Typed;
|
||||
static bytes24(v: BytesLike): Typed;
|
||||
static bytes25(v: BytesLike): Typed;
|
||||
static bytes26(v: BytesLike): Typed;
|
||||
static bytes27(v: BytesLike): Typed;
|
||||
static bytes28(v: BytesLike): Typed;
|
||||
static bytes29(v: BytesLike): Typed;
|
||||
static bytes30(v: BytesLike): Typed;
|
||||
static bytes31(v: BytesLike): Typed;
|
||||
static bytes32(v: BytesLike): Typed;
|
||||
static address(v: string | Addressable): Typed;
|
||||
static bool(v: any): Typed;
|
||||
static bytes(v: BytesLike): Typed;
|
||||
static string(v: string): Typed;
|
||||
static array(v: Array<any | Typed>, dynamic?: null | boolean): Typed;
|
||||
static tuple(v: Array<any | Typed> | Record<string, any | Typed>, name?: string): Typed;
|
||||
static overrides(v: Record<string, any>): Typed;
|
||||
/**
|
||||
* Returns true only if %%value%% is a [[Typed]] instance.
|
||||
*/
|
||||
static isTyped(value: any): value is Typed;
|
||||
/**
|
||||
* If the value is a [[Typed]] instance, validates the underlying value
|
||||
* and returns it, otherwise returns value directly.
|
||||
*
|
||||
* This is useful for functions that with to accept either a [[Typed]]
|
||||
* object or values.
|
||||
*/
|
||||
static dereference<T>(value: Typed | T, type: string): T;
|
||||
}
|
@ -62,7 +62,7 @@ class Typed {
|
||||
return !!(this.type.match(/^u?int[0-9]+$/));
|
||||
}
|
||||
isData() {
|
||||
return (this.type.substring(0, 5) === "bytes");
|
||||
return this.type.startsWith("bytes");
|
||||
}
|
||||
isString() {
|
||||
return (this.type === "string");
|
||||
|
File diff suppressed because one or more lines are too long
55
lib.commonjs/address/address.d.ts
vendored
55
lib.commonjs/address/address.d.ts
vendored
@ -1,55 +0,0 @@
|
||||
/**
|
||||
* Returns a normalized and checksumed address for %%address%%.
|
||||
* This accepts non-checksum addresses, checksum addresses and
|
||||
* [[getIcapAddress]] formats.
|
||||
*
|
||||
* The checksum in Ethereum uses the capitalization (upper-case
|
||||
* vs lower-case) of the characters within an address to encode
|
||||
* its checksum, which offers, on average, a checksum of 15-bits.
|
||||
*
|
||||
* If %%address%% contains both upper-case and lower-case, it is
|
||||
* assumed to already be a checksum address and its checksum is
|
||||
* validated, and if the address fails its expected checksum an
|
||||
* error is thrown.
|
||||
*
|
||||
* If you wish the checksum of %%address%% to be ignore, it should
|
||||
* be converted to lower-case (i.e. ``.toLowercase()``) before
|
||||
* being passed in. This should be a very rare situation though,
|
||||
* 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 declare function getAddress(address: string): string;
|
||||
/**
|
||||
* The [ICAP Address format](link-icap) format is an early checksum
|
||||
* format which attempts to be compatible with the banking
|
||||
* 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 declare function getIcapAddress(address: string): string;
|
@ -110,7 +110,7 @@ function getAddress(address) {
|
||||
(0, index_js_2.assertArgument)(typeof (address) === "string", "invalid address", "address", address);
|
||||
if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
|
||||
// Missing the 0x prefix
|
||||
if (address.substring(0, 2) !== "0x") {
|
||||
if (!address.startsWith("0x")) {
|
||||
address = "0x" + address;
|
||||
}
|
||||
const result = getChecksumAddress(address);
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src.ts/address/address.ts"],"names":[],"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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"}
|
80
lib.commonjs/address/checks.d.ts
vendored
80
lib.commonjs/address/checks.d.ts
vendored
@ -1,80 +0,0 @@
|
||||
import type { Addressable, AddressLike, NameResolver } from "./index.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 declare function isAddressable(value: any): value is Addressable;
|
||||
/**
|
||||
* 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 declare function isAddress(value: any): value is string;
|
||||
/**
|
||||
* Resolves to an address for the %%target%%, which may be any
|
||||
* supported address type, an [[Addressable]] or a Promise which
|
||||
* resolves to an address.
|
||||
*
|
||||
* 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 declare function resolveAddress(target: AddressLike, resolver?: null | NameResolver): string | Promise<string>;
|
47
lib.commonjs/address/contract-address.d.ts
vendored
47
lib.commonjs/address/contract-address.d.ts
vendored
@ -1,47 +0,0 @@
|
||||
import type { BigNumberish, BytesLike } from "../utils/index.js";
|
||||
/**
|
||||
* Returns the address that would result from a ``CREATE`` for %%tx%%.
|
||||
*
|
||||
* This can be used to compute the address a contract will be
|
||||
* deployed to by an EOA when sending a deployment transaction (i.e.
|
||||
* when the ``to`` address is ``null``).
|
||||
*
|
||||
* This can also be used to compute the address a contract will be
|
||||
* deployed to by a contract, by using the contract's address as the
|
||||
* ``to`` and the contract's nonce.
|
||||
*
|
||||
* @example
|
||||
* from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72";
|
||||
* nonce = 5;
|
||||
*
|
||||
* getCreateAddress({ from, nonce });
|
||||
* //_result:
|
||||
*/
|
||||
export declare function getCreateAddress(tx: {
|
||||
from: string;
|
||||
nonce: BigNumberish;
|
||||
}): string;
|
||||
/**
|
||||
* Returns the address that would result from a ``CREATE2`` operation
|
||||
* with the given %%from%%, %%salt%% and %%initCodeHash%%.
|
||||
*
|
||||
* To compute the %%initCodeHash%% from a contract's init code, use
|
||||
* the [[keccak256]] function.
|
||||
*
|
||||
* 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 declare function getCreate2Address(_from: string, _salt: BytesLike, _initCodeHash: BytesLike): string;
|
48
lib.commonjs/address/index.d.ts
vendored
48
lib.commonjs/address/index.d.ts
vendored
@ -1,48 +0,0 @@
|
||||
/**
|
||||
* Addresses are a fundamental part of interacting with Ethereum. They
|
||||
* represent the gloabal identity of Externally Owned Accounts (accounts
|
||||
* backed by a private key) and contracts.
|
||||
*
|
||||
* The Ethereum Naming Service (ENS) provides an interconnected ecosystem
|
||||
* of contracts, standards and libraries which enable looking up an
|
||||
* address for an ENS name.
|
||||
*
|
||||
* These functions help convert between various formats, validate
|
||||
* addresses and safely resolve ENS names.
|
||||
*
|
||||
* @_section: api/address:Addresses [about-addresses]
|
||||
*/
|
||||
/**
|
||||
* An interface for objects which have an address, and can
|
||||
* resolve it asyncronously.
|
||||
*
|
||||
* This allows objects such as [[Signer]] or [[Contract]] to
|
||||
* be used most places an address can be, for example getting
|
||||
* the [balance](Provider-getBalance).
|
||||
*/
|
||||
export interface Addressable {
|
||||
/**
|
||||
* Get the object address.
|
||||
*/
|
||||
getAddress(): Promise<string>;
|
||||
}
|
||||
/**
|
||||
* Anything that can be used to return or resolve an address.
|
||||
*/
|
||||
export type AddressLike = string | Promise<string> | Addressable;
|
||||
/**
|
||||
* An interface for any object which can resolve an ENS name.
|
||||
*/
|
||||
export interface NameResolver {
|
||||
/**
|
||||
* Resolve to the address for the ENS %%name%%.
|
||||
*
|
||||
* Resolves to ``null`` if the name is unconfigued. Use
|
||||
* [[resolveAddress]] (passing this object as %%resolver%%) to
|
||||
* throw for names that are unconfigured.
|
||||
*/
|
||||
resolveName(name: string): Promise<null | string>;
|
||||
}
|
||||
export { getAddress, getIcapAddress } from "./address.js";
|
||||
export { getCreateAddress, getCreate2Address } from "./contract-address.js";
|
||||
export { isAddressable, isAddress, resolveAddress } from "./checks.js";
|
6
lib.commonjs/constants/addresses.d.ts
vendored
6
lib.commonjs/constants/addresses.d.ts
vendored
@ -1,6 +0,0 @@
|
||||
/**
|
||||
* A constant for the zero address.
|
||||
*
|
||||
* (**i.e.** ``"0x0000000000000000000000000000000000000000"``)
|
||||
*/
|
||||
export declare const ZeroAddress: string;
|
6
lib.commonjs/constants/hashes.d.ts
vendored
6
lib.commonjs/constants/hashes.d.ts
vendored
@ -1,6 +0,0 @@
|
||||
/**
|
||||
* A constant for the zero hash.
|
||||
*
|
||||
* (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``)
|
||||
*/
|
||||
export declare const ZeroHash: string;
|
9
lib.commonjs/constants/index.d.ts
vendored
9
lib.commonjs/constants/index.d.ts
vendored
@ -1,9 +0,0 @@
|
||||
/**
|
||||
* Some common constants useful for Ethereum.
|
||||
*
|
||||
* @_section: api/constants: Constants [about-constants]
|
||||
*/
|
||||
export { ZeroAddress } from "./addresses.js";
|
||||
export { ZeroHash } from "./hashes.js";
|
||||
export { N, WeiPerEther, MaxUint256, MinInt256, MaxInt256 } from "./numbers.js";
|
||||
export { EtherSymbol, MessagePrefix } from "./strings.js";
|
30
lib.commonjs/constants/numbers.d.ts
vendored
30
lib.commonjs/constants/numbers.d.ts
vendored
@ -1,30 +0,0 @@
|
||||
/**
|
||||
* A constant for the order N for the secp256k1 curve.
|
||||
*
|
||||
* (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``)
|
||||
*/
|
||||
export declare const N: bigint;
|
||||
/**
|
||||
* A constant for the number of wei in a single ether.
|
||||
*
|
||||
* (**i.e.** ``1000000000000000000n``)
|
||||
*/
|
||||
export declare const WeiPerEther: bigint;
|
||||
/**
|
||||
* A constant for the maximum value for a ``uint256``.
|
||||
*
|
||||
* (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)
|
||||
*/
|
||||
export declare const MaxUint256: bigint;
|
||||
/**
|
||||
* A constant for the minimum value for an ``int256``.
|
||||
*
|
||||
* (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``)
|
||||
*/
|
||||
export declare const MinInt256: bigint;
|
||||
/**
|
||||
* A constant for the maximum value for an ``int256``.
|
||||
*
|
||||
* (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``)
|
||||
*/
|
||||
export declare const MaxInt256: bigint;
|
12
lib.commonjs/constants/strings.d.ts
vendored
12
lib.commonjs/constants/strings.d.ts
vendored
@ -1,12 +0,0 @@
|
||||
/**
|
||||
* A constant for the ether symbol (normalized using NFKC).
|
||||
*
|
||||
* (**i.e.** ``"\\u039e"``)
|
||||
*/
|
||||
export declare const EtherSymbol: string;
|
||||
/**
|
||||
* A constant for the [[link-eip-191]] personal message prefix.
|
||||
*
|
||||
* (**i.e.** ``"\\x19Ethereum Signed Message:\\n"``)
|
||||
*/
|
||||
export declare const MessagePrefix: string;
|
58
lib.commonjs/contract/contract.d.ts
vendored
58
lib.commonjs/contract/contract.d.ts
vendored
@ -1,58 +0,0 @@
|
||||
import { Interface } from "../abi/index.js";
|
||||
import { Log, TransactionResponse } from "../providers/provider.js";
|
||||
import { ContractTransactionResponse, EventLog } from "./wrappers.js";
|
||||
import type { EventFragment, FunctionFragment, InterfaceAbi, ParamType } from "../abi/index.js";
|
||||
import type { Addressable } from "../address/index.js";
|
||||
import type { EventEmitterable, Listener } from "../utils/index.js";
|
||||
import type { BlockTag, ContractRunner, TransactionRequest } from "../providers/index.js";
|
||||
import type { ContractEventName, ContractInterface, ContractMethod, ContractEvent, ContractTransaction } from "./types.js";
|
||||
/**
|
||||
* @_ignore:
|
||||
*/
|
||||
export declare function copyOverrides<O extends string = "data" | "to">(arg: any, allowed?: Array<string>): Promise<Omit<ContractTransaction, O>>;
|
||||
/**
|
||||
* @_ignore:
|
||||
*/
|
||||
export declare function resolveArgs(_runner: null | ContractRunner, inputs: ReadonlyArray<ParamType>, args: Array<any>): Promise<Array<any>>;
|
||||
declare class WrappedFallback {
|
||||
readonly _contract: BaseContract;
|
||||
constructor(contract: BaseContract);
|
||||
populateTransaction(overrides?: Omit<TransactionRequest, "to">): Promise<ContractTransaction>;
|
||||
staticCall(overrides?: Omit<TransactionRequest, "to">): Promise<string>;
|
||||
send(overrides?: Omit<TransactionRequest, "to">): Promise<ContractTransactionResponse>;
|
||||
estimateGas(overrides?: Omit<TransactionRequest, "to">): Promise<bigint>;
|
||||
}
|
||||
declare const internal: unique symbol;
|
||||
export declare class BaseContract implements Addressable, EventEmitterable<ContractEventName> {
|
||||
readonly target: string | Addressable;
|
||||
readonly interface: Interface;
|
||||
readonly runner: null | ContractRunner;
|
||||
readonly filters: Record<string, ContractEvent>;
|
||||
readonly [internal]: any;
|
||||
readonly fallback: null | WrappedFallback;
|
||||
constructor(target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner, _deployTx?: null | TransactionResponse);
|
||||
connect(runner: null | ContractRunner): BaseContract;
|
||||
getAddress(): Promise<string>;
|
||||
getDeployedCode(): Promise<null | string>;
|
||||
waitForDeployment(): Promise<this>;
|
||||
deploymentTransaction(): null | ContractTransactionResponse;
|
||||
getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
|
||||
getEvent(key: string | EventFragment): ContractEvent;
|
||||
queryTransaction(hash: string): Promise<Array<EventLog>>;
|
||||
queryFilter(event: ContractEventName, fromBlock?: BlockTag, toBlock?: BlockTag): Promise<Array<EventLog | Log>>;
|
||||
on(event: ContractEventName, listener: Listener): Promise<this>;
|
||||
once(event: ContractEventName, listener: Listener): Promise<this>;
|
||||
emit(event: ContractEventName, ...args: Array<any>): Promise<boolean>;
|
||||
listenerCount(event?: ContractEventName): Promise<number>;
|
||||
listeners(event?: ContractEventName): Promise<Array<Listener>>;
|
||||
off(event: ContractEventName, listener?: Listener): Promise<this>;
|
||||
removeAllListeners(event?: ContractEventName): Promise<this>;
|
||||
addListener(event: ContractEventName, listener: Listener): Promise<this>;
|
||||
removeListener(event: ContractEventName, listener: Listener): Promise<this>;
|
||||
static buildClass<T = ContractInterface>(abi: InterfaceAbi): new (target: string, runner?: null | ContractRunner) => BaseContract & Omit<T, keyof BaseContract>;
|
||||
static from<T = ContractInterface>(target: string, abi: InterfaceAbi, runner?: null | ContractRunner): BaseContract & Omit<T, keyof BaseContract>;
|
||||
}
|
||||
declare const Contract_base: new (target: string, abi: InterfaceAbi, runner?: ContractRunner | null | undefined) => BaseContract & Omit<ContractInterface, keyof BaseContract>;
|
||||
export declare class Contract extends Contract_base {
|
||||
}
|
||||
export {};
|
21
lib.commonjs/contract/factory.d.ts
vendored
21
lib.commonjs/contract/factory.d.ts
vendored
@ -1,21 +0,0 @@
|
||||
import { Interface } from "../abi/index.js";
|
||||
import { BaseContract } from "./contract.js";
|
||||
import type { InterfaceAbi } from "../abi/index.js";
|
||||
import type { ContractRunner } from "../providers/index.js";
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
import type { ContractInterface, ContractMethodArgs, ContractDeployTransaction } from "./types.js";
|
||||
import type { ContractTransactionResponse } from "./wrappers.js";
|
||||
export declare class ContractFactory<A extends Array<any> = Array<any>, I = BaseContract> {
|
||||
readonly interface: Interface;
|
||||
readonly bytecode: string;
|
||||
readonly runner: null | ContractRunner;
|
||||
constructor(abi: Interface | InterfaceAbi, bytecode: BytesLike | {
|
||||
object: string;
|
||||
}, runner?: null | ContractRunner);
|
||||
getDeployTransaction(...args: ContractMethodArgs<A>): Promise<ContractDeployTransaction>;
|
||||
deploy(...args: ContractMethodArgs<A>): Promise<BaseContract & {
|
||||
deploymentTransaction(): ContractTransactionResponse;
|
||||
} & Omit<I, keyof BaseContract>>;
|
||||
connect(runner: null | ContractRunner): ContractFactory<A, I>;
|
||||
static fromSolidity<A extends Array<any> = Array<any>, I = ContractInterface>(output: any, runner?: ContractRunner): ContractFactory<A, I>;
|
||||
}
|
@ -21,7 +21,7 @@ class ContractFactory {
|
||||
if (typeof (bytecode) === "object") {
|
||||
bytecode = bytecode.object;
|
||||
}
|
||||
if (bytecode.substring(0, 2) !== "0x") {
|
||||
if (!bytecode.startsWith("0x")) {
|
||||
bytecode = "0x" + bytecode;
|
||||
}
|
||||
bytecode = (0, index_js_3.hexlify)((0, index_js_3.getBytes)(bytecode));
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src.ts/contract/factory.ts"],"names":[],"mappings":";;;AACA,8CAA4C;AAC5C,kDAAuD;AACvD,gDAG2B;AAE3B,+CAAyE;AAYzE,mCAAmC;AACnC,sCAAsC;AACtC,MAAa,eAAe;IACf,SAAS,CAAa;IACtB,QAAQ,CAAU;IAClB,MAAM,CAAyB;IAExC,YAAY,GAA6B,EAAE,QAAwC,EAAE,MAA8B;QAC/G,MAAM,KAAK,GAAG,oBAAS,CAAC,IAAI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|
||||
* @_section: api/contract:Contracts [about-contracts]
|
||||
*/
|
||||
export { BaseContract, Contract } from "./contract.js";
|
||||
export { ContractFactory } from "./factory.js";
|
||||
export { ContractEventPayload, ContractUnknownEventPayload, ContractTransactionReceipt, ContractTransactionResponse, EventLog, } from "./wrappers.js";
|
||||
export type { BaseContractMethod, ConstantContractMethod, PostfixOverrides, ContractEvent, ContractEventArgs, ContractEventName, ContractDeployTransaction, ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction, DeferredTopicFilter, Overrides } from "./types.js";
|
48
lib.commonjs/contract/types.d.ts
vendored
48
lib.commonjs/contract/types.d.ts
vendored
@ -1,48 +0,0 @@
|
||||
import type { EventFragment, FunctionFragment, Result, Typed } from "../abi/index.js";
|
||||
import type { TransactionRequest, PreparedTransactionRequest, TopicFilter } from "../providers/index.js";
|
||||
import type { ContractTransactionResponse } from "./wrappers.js";
|
||||
export type ContractEventName = string | ContractEvent | TopicFilter | DeferredTopicFilter;
|
||||
export interface ContractInterface {
|
||||
[name: string]: BaseContractMethod;
|
||||
}
|
||||
export interface DeferredTopicFilter {
|
||||
getTopicFilter(): Promise<TopicFilter>;
|
||||
fragment: EventFragment;
|
||||
}
|
||||
export interface ContractTransaction extends PreparedTransactionRequest {
|
||||
to: string;
|
||||
data: string;
|
||||
from?: string;
|
||||
}
|
||||
export interface ContractDeployTransaction extends Omit<ContractTransaction, "to"> {
|
||||
}
|
||||
export interface Overrides extends Omit<TransactionRequest, "to" | "data"> {
|
||||
}
|
||||
export type PostfixOverrides<A extends Array<any>> = A | [...A, Overrides];
|
||||
export type ContractMethodArgs<A extends Array<any>> = PostfixOverrides<{
|
||||
[I in keyof A]-?: A[I] | Typed;
|
||||
}>;
|
||||
export interface BaseContractMethod<A extends Array<any> = Array<any>, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> {
|
||||
(...args: ContractMethodArgs<A>): Promise<D>;
|
||||
name: string;
|
||||
fragment: FunctionFragment;
|
||||
getFragment(...args: ContractMethodArgs<A>): FunctionFragment;
|
||||
populateTransaction(...args: ContractMethodArgs<A>): Promise<ContractTransaction>;
|
||||
staticCall(...args: ContractMethodArgs<A>): Promise<R>;
|
||||
send(...args: ContractMethodArgs<A>): Promise<ContractTransactionResponse>;
|
||||
estimateGas(...args: ContractMethodArgs<A>): Promise<bigint>;
|
||||
staticCallResult(...args: ContractMethodArgs<A>): Promise<Result>;
|
||||
}
|
||||
export interface ContractMethod<A extends Array<any> = Array<any>, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> extends BaseContractMethod<A, R, D> {
|
||||
}
|
||||
export interface ConstantContractMethod<A extends Array<any>, R = any> extends ContractMethod<A, R, R> {
|
||||
}
|
||||
export type ContractEventArgs<A extends Array<any>> = {
|
||||
[I in keyof A]?: A[I] | Typed | null;
|
||||
};
|
||||
export interface ContractEvent<A extends Array<any> = Array<any>> {
|
||||
(...args: ContractEventArgs<A>): DeferredTopicFilter;
|
||||
name: string;
|
||||
fragment: EventFragment;
|
||||
getFragment(...args: ContractEventArgs<A>): EventFragment;
|
||||
}
|
40
lib.commonjs/contract/wrappers.d.ts
vendored
40
lib.commonjs/contract/wrappers.d.ts
vendored
@ -1,40 +0,0 @@
|
||||
import { Block, Log, TransactionReceipt, TransactionResponse } from "../providers/provider.js";
|
||||
import { EventPayload } from "../utils/index.js";
|
||||
import type { EventFragment, Interface, Result } from "../abi/index.js";
|
||||
import type { Listener } from "../utils/index.js";
|
||||
import type { Provider } from "../providers/index.js";
|
||||
import type { BaseContract } from "./contract.js";
|
||||
import type { ContractEventName } from "./types.js";
|
||||
export declare class EventLog extends Log {
|
||||
readonly interface: Interface;
|
||||
readonly fragment: EventFragment;
|
||||
readonly args: Result;
|
||||
constructor(log: Log, iface: Interface, fragment: EventFragment);
|
||||
get eventName(): string;
|
||||
get eventSignature(): string;
|
||||
}
|
||||
export declare class ContractTransactionReceipt extends TransactionReceipt {
|
||||
#private;
|
||||
constructor(iface: Interface, provider: Provider, tx: TransactionReceipt);
|
||||
get logs(): Array<EventLog | Log>;
|
||||
}
|
||||
export declare class ContractTransactionResponse extends TransactionResponse {
|
||||
#private;
|
||||
constructor(iface: Interface, provider: Provider, tx: TransactionResponse);
|
||||
wait(confirms?: number): Promise<null | ContractTransactionReceipt>;
|
||||
}
|
||||
export declare class ContractUnknownEventPayload extends EventPayload<ContractEventName> {
|
||||
readonly log: Log;
|
||||
constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, log: Log);
|
||||
getBlock(): Promise<Block>;
|
||||
getTransaction(): Promise<TransactionResponse>;
|
||||
getTransactionReceipt(): Promise<TransactionReceipt>;
|
||||
}
|
||||
export declare class ContractEventPayload extends ContractUnknownEventPayload {
|
||||
readonly fragment: EventFragment;
|
||||
readonly log: EventLog;
|
||||
readonly args: Result;
|
||||
constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, fragment: EventFragment, _log: Log);
|
||||
get eventName(): string;
|
||||
get eventSignature(): string;
|
||||
}
|
14
lib.commonjs/crypto/crypto-browser.d.ts
vendored
14
lib.commonjs/crypto/crypto-browser.d.ts
vendored
@ -1,14 +0,0 @@
|
||||
declare global {
|
||||
interface Window {
|
||||
}
|
||||
const window: Window;
|
||||
const self: Window;
|
||||
}
|
||||
export interface CryptoHasher {
|
||||
update(data: Uint8Array): CryptoHasher;
|
||||
digest(): Uint8Array;
|
||||
}
|
||||
export declare function createHash(algo: string): CryptoHasher;
|
||||
export declare function createHmac(_algo: string, key: Uint8Array): CryptoHasher;
|
||||
export declare function pbkdf2Sync(password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, _algo: "sha256" | "sha512"): Uint8Array;
|
||||
export declare function randomBytes(length: number): Uint8Array;
|
1
lib.commonjs/crypto/crypto.d.ts
vendored
1
lib.commonjs/crypto/crypto.d.ts
vendored
@ -1 +0,0 @@
|
||||
export { createHash, createHmac, pbkdf2Sync, randomBytes } from "crypto";
|
24
lib.commonjs/crypto/hmac.d.ts
vendored
24
lib.commonjs/crypto/hmac.d.ts
vendored
@ -1,24 +0,0 @@
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
/**
|
||||
* 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:
|
||||
*
|
||||
*/
|
||||
export declare function computeHmac(algorithm: "sha256" | "sha512", _key: BytesLike, _data: BytesLike): string;
|
||||
export declare namespace computeHmac {
|
||||
var _: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike;
|
||||
var lock: () => void;
|
||||
var register: (func: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike) => void;
|
||||
}
|
20
lib.commonjs/crypto/index.d.ts
vendored
20
lib.commonjs/crypto/index.d.ts
vendored
@ -1,20 +0,0 @@
|
||||
/**
|
||||
* A fundamental building block of Ethereum is the underlying
|
||||
* cryptographic primitives.
|
||||
*
|
||||
* @_section: api/crypto:Cryptographic Functions [about-crypto]
|
||||
*/
|
||||
import { computeHmac } from "./hmac.js";
|
||||
import { keccak256 } from "./keccak.js";
|
||||
import { ripemd160 } from "./ripemd160.js";
|
||||
import { pbkdf2 } from "./pbkdf2.js";
|
||||
import { randomBytes } from "./random.js";
|
||||
import { scrypt, scryptSync } from "./scrypt.js";
|
||||
import { sha256, sha512 } from "./sha2.js";
|
||||
export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync };
|
||||
export { SigningKey } from "./signing-key.js";
|
||||
export { Signature } from "./signature.js";
|
||||
declare function lock(): void;
|
||||
export { lock };
|
||||
export type { ProgressCallback } from "./scrypt.js";
|
||||
export type { SignatureLike } from "./signature.js";
|
34
lib.commonjs/crypto/keccak.d.ts
vendored
34
lib.commonjs/crypto/keccak.d.ts
vendored
@ -1,34 +0,0 @@
|
||||
/**
|
||||
* Cryptographic hashing functions
|
||||
*
|
||||
* @_subsection: api/crypto:Hash Functions [about-crypto-hashing]
|
||||
*/
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
/**
|
||||
* 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:
|
||||
*
|
||||
* // Strings are assumed to be DataHexString, otherwise it will
|
||||
* // throw. To hash UTF-8 data, see the note above.
|
||||
* keccak256("Hello World")
|
||||
* //_error:
|
||||
*/
|
||||
export declare function keccak256(_data: BytesLike): string;
|
||||
export declare namespace keccak256 {
|
||||
var _: (data: Uint8Array) => Uint8Array;
|
||||
var lock: () => void;
|
||||
var register: (func: (data: Uint8Array) => BytesLike) => void;
|
||||
}
|
34
lib.commonjs/crypto/pbkdf2.d.ts
vendored
34
lib.commonjs/crypto/pbkdf2.d.ts
vendored
@ -1,34 +0,0 @@
|
||||
/**
|
||||
* A **Password-Based Key-Derivation Function** is designed to create
|
||||
* a sequence of bytes suitible as a **key** from a human-rememberable
|
||||
* password.
|
||||
*
|
||||
* @_subsection: api/crypto:Passwords [about-pbkdf]
|
||||
*/
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
/**
|
||||
* Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using
|
||||
* the %%salt%% and using %%iterations%% of %%algo%%.
|
||||
*
|
||||
* 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:
|
||||
*/
|
||||
export declare function pbkdf2(_password: BytesLike, _salt: BytesLike, iterations: number, keylen: number, algo: "sha256" | "sha512"): string;
|
||||
export declare namespace pbkdf2 {
|
||||
var _: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike;
|
||||
var lock: () => void;
|
||||
var register: (func: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike) => void;
|
||||
}
|
13
lib.commonjs/crypto/random.d.ts
vendored
13
lib.commonjs/crypto/random.d.ts
vendored
@ -1,13 +0,0 @@
|
||||
/**
|
||||
* Return %%length%% bytes of cryptographically secure random data.
|
||||
*
|
||||
* @example:
|
||||
* randomBytes(8)
|
||||
* //_result:
|
||||
*/
|
||||
export declare function randomBytes(length: number): Uint8Array;
|
||||
export declare namespace randomBytes {
|
||||
var _: (length: number) => Uint8Array;
|
||||
var lock: () => void;
|
||||
var register: (func: (length: number) => Uint8Array) => void;
|
||||
}
|
24
lib.commonjs/crypto/ripemd160.d.ts
vendored
24
lib.commonjs/crypto/ripemd160.d.ts
vendored
@ -1,24 +0,0 @@
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
/**
|
||||
* Compute the cryptographic RIPEMD-160 hash of %%data%%.
|
||||
*
|
||||
* @_docloc: api/crypto:Hash Functions
|
||||
* @returns DataHexstring
|
||||
*
|
||||
* @example:
|
||||
* ripemd160("0x")
|
||||
* //_result:
|
||||
*
|
||||
* ripemd160("0x1337")
|
||||
* //_result:
|
||||
*
|
||||
* ripemd160(new Uint8Array([ 0x13, 0x37 ]))
|
||||
* //_result:
|
||||
*
|
||||
*/
|
||||
export declare function ripemd160(_data: BytesLike): string;
|
||||
export declare namespace ripemd160 {
|
||||
var _: (data: Uint8Array) => Uint8Array;
|
||||
var lock: () => void;
|
||||
var register: (func: (data: Uint8Array) => BytesLike) => void;
|
||||
}
|
81
lib.commonjs/crypto/scrypt.d.ts
vendored
81
lib.commonjs/crypto/scrypt.d.ts
vendored
@ -1,81 +0,0 @@
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
/**
|
||||
* A callback during long-running operations to update any
|
||||
* UI or provide programatic access to the progress.
|
||||
*
|
||||
* The %%percent%% is a value between ``0`` and ``1``.
|
||||
*
|
||||
* @_docloc: api/crypto:Passwords
|
||||
*/
|
||||
export type ProgressCallback = (percent: number) => void;
|
||||
/**
|
||||
* The [[link-wiki-scrypt]] uses a memory and cpu hard method of
|
||||
* derivation to increase the resource cost to brute-force a password
|
||||
* for a given key.
|
||||
*
|
||||
* This means this algorithm is intentionally slow, and can be tuned to
|
||||
* become slower. As computation and memory speed improve over time,
|
||||
* increasing the difficulty maintains the cost of an attacker.
|
||||
*
|
||||
* For example, if a target time of 5 seconds is used, a legitimate user
|
||||
* which knows their password requires only 5 seconds to unlock their
|
||||
* account. A 6 character password has 68 billion possibilities, which
|
||||
* would require an attacker to invest over 10,000 years of CPU time. This
|
||||
* is of course a crude example (as password generally aren't random),
|
||||
* but demonstrates to value of imposing large costs to decryption.
|
||||
*
|
||||
* For this reason, if building a UI which involved decrypting or
|
||||
* encrypting datsa using scrypt, it is recommended to use a
|
||||
* [[ProgressCallback]] (as event short periods can seem lik an eternity
|
||||
* if the UI freezes). Including the phrase //"decrypting"// in the UI
|
||||
* 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:
|
||||
*/
|
||||
export declare function scrypt(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback): Promise<string>;
|
||||
export declare namespace scrypt {
|
||||
var _: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, onProgress?: ProgressCallback | undefined) => Promise<Uint8Array>;
|
||||
var lock: () => void;
|
||||
var register: (func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback | undefined) => Promise<BytesLike>) => void;
|
||||
}
|
||||
/**
|
||||
* Provides a synchronous variant of [[scrypt]].
|
||||
*
|
||||
* This will completely lock up and freeze the UI in a browser and will
|
||||
* prevent any event loop from progressing. For this reason, it is
|
||||
* 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:
|
||||
*/
|
||||
export declare function scryptSync(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number): string;
|
||||
export declare namespace scryptSync {
|
||||
var _: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => Uint8Array;
|
||||
var lock: () => void;
|
||||
var register: (func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => BytesLike) => void;
|
||||
}
|
46
lib.commonjs/crypto/sha2.d.ts
vendored
46
lib.commonjs/crypto/sha2.d.ts
vendored
@ -1,46 +0,0 @@
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
/**
|
||||
* Compute the cryptographic SHA2-256 hash of %%data%%.
|
||||
*
|
||||
* @_docloc: api/crypto:Hash Functions
|
||||
* @returns DataHexstring
|
||||
*
|
||||
* @example:
|
||||
* sha256("0x")
|
||||
* //_result:
|
||||
*
|
||||
* sha256("0x1337")
|
||||
* //_result:
|
||||
*
|
||||
* sha256(new Uint8Array([ 0x13, 0x37 ]))
|
||||
* //_result:
|
||||
*
|
||||
*/
|
||||
export declare function sha256(_data: BytesLike): string;
|
||||
export declare namespace sha256 {
|
||||
var _: (data: Uint8Array) => Uint8Array;
|
||||
var lock: () => void;
|
||||
var register: (func: (data: Uint8Array) => BytesLike) => void;
|
||||
}
|
||||
/**
|
||||
* Compute the cryptographic SHA2-512 hash of %%data%%.
|
||||
*
|
||||
* @_docloc: api/crypto:Hash Functions
|
||||
* @returns DataHexstring
|
||||
*
|
||||
* @example:
|
||||
* sha512("0x")
|
||||
* //_result:
|
||||
*
|
||||
* sha512("0x1337")
|
||||
* //_result:
|
||||
*
|
||||
* sha512(new Uint8Array([ 0x13, 0x37 ]))
|
||||
* //_result:
|
||||
*/
|
||||
export declare function sha512(_data: BytesLike): string;
|
||||
export declare namespace sha512 {
|
||||
var _: (data: Uint8Array) => Uint8Array;
|
||||
var lock: () => void;
|
||||
var register: (func: (data: Uint8Array) => BytesLike) => void;
|
||||
}
|
157
lib.commonjs/crypto/signature.d.ts
vendored
157
lib.commonjs/crypto/signature.d.ts
vendored
@ -1,157 +0,0 @@
|
||||
import type { BigNumberish, BytesLike } from "../utils/index.js";
|
||||
/**
|
||||
* A SignatureLike
|
||||
*
|
||||
* @_docloc: api/crypto:Signing
|
||||
*/
|
||||
export type SignatureLike = Signature | string | {
|
||||
r: string;
|
||||
s: string;
|
||||
v: BigNumberish;
|
||||
yParity?: 0 | 1;
|
||||
yParityAndS?: string;
|
||||
} | {
|
||||
r: string;
|
||||
yParityAndS: string;
|
||||
yParity?: 0 | 1;
|
||||
s?: string;
|
||||
v?: number;
|
||||
} | {
|
||||
r: string;
|
||||
s: string;
|
||||
yParity: 0 | 1;
|
||||
v?: BigNumberish;
|
||||
yParityAndS?: string;
|
||||
};
|
||||
/**
|
||||
* A Signature @TODO
|
||||
*
|
||||
*
|
||||
* @_docloc: api/crypto:Signing
|
||||
*/
|
||||
export declare class Signature {
|
||||
#private;
|
||||
/**
|
||||
* The ``r`` value for a signautre.
|
||||
*
|
||||
* This represents the ``x`` coordinate of a "reference" or
|
||||
* challenge point, from which the ``y`` can be computed.
|
||||
*/
|
||||
get r(): string;
|
||||
set r(value: BytesLike);
|
||||
/**
|
||||
* The ``s`` value for a signature.
|
||||
*/
|
||||
get s(): string;
|
||||
set s(_value: BytesLike);
|
||||
/**
|
||||
* The ``v`` value for a signature.
|
||||
*
|
||||
* Since a given ``x`` value for ``r`` has two possible values for
|
||||
* its correspondin ``y``, the ``v`` indicates which of the two ``y``
|
||||
* values to use.
|
||||
*
|
||||
* It is normalized to the values ``27`` or ``28`` for legacy
|
||||
* purposes.
|
||||
*/
|
||||
get v(): 27 | 28;
|
||||
set v(value: BigNumberish);
|
||||
/**
|
||||
* The EIP-155 ``v`` for legacy transactions. For non-legacy
|
||||
* transactions, this value is ``null``.
|
||||
*/
|
||||
get networkV(): null | bigint;
|
||||
/**
|
||||
* The chain ID for EIP-155 legacy transactions. For non-legacy
|
||||
* transactions, this value is ``null``.
|
||||
*/
|
||||
get legacyChainId(): null | bigint;
|
||||
/**
|
||||
* The ``yParity`` for the signature.
|
||||
*
|
||||
* See ``v`` for more details on how this value is used.
|
||||
*/
|
||||
get yParity(): 0 | 1;
|
||||
/**
|
||||
* The [[link-eip-2098]] compact representation of the ``yParity``
|
||||
* and ``s`` compacted into a single ``bytes32``.
|
||||
*/
|
||||
get yParityAndS(): string;
|
||||
/**
|
||||
* The [[link-eip-2098]] compact representation.
|
||||
*/
|
||||
get compactSerialized(): string;
|
||||
/**
|
||||
* The serialized representation.
|
||||
*/
|
||||
get serialized(): string;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard: any, r: string, s: string, v: 27 | 28);
|
||||
/**
|
||||
* Returns a new identical [[Signature]].
|
||||
*/
|
||||
clone(): Signature;
|
||||
/**
|
||||
* Returns a representation that is compatible with ``JSON.stringify``.
|
||||
*/
|
||||
toJSON(): any;
|
||||
/**
|
||||
* Compute the chain ID from the ``v`` in a legacy EIP-155 transactions.
|
||||
*
|
||||
* @example:
|
||||
* Signature.getChainId(45)
|
||||
* //_result:
|
||||
*
|
||||
* Signature.getChainId(46)
|
||||
* //_result:
|
||||
*/
|
||||
static getChainId(v: BigNumberish): bigint;
|
||||
/**
|
||||
* 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: BigNumberish, v: 27 | 28): bigint;
|
||||
/**
|
||||
* 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: BigNumberish): 27 | 28;
|
||||
/**
|
||||
* Creates a new [[Signature]].
|
||||
*
|
||||
* If no %%sig%% is provided, a new [[Signature]] is created
|
||||
* with default values.
|
||||
*
|
||||
* If %%sig%% is a string, it is parsed.
|
||||
*/
|
||||
static from(sig?: SignatureLike): Signature;
|
||||
}
|
121
lib.commonjs/crypto/signing-key.d.ts
vendored
121
lib.commonjs/crypto/signing-key.d.ts
vendored
@ -1,121 +0,0 @@
|
||||
/**
|
||||
* Add details about signing here.
|
||||
*
|
||||
* @_subsection: api/crypto:Signing [about-signing]
|
||||
*/
|
||||
import { Signature } from "./signature.js";
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
import type { SignatureLike } from "./index.js";
|
||||
/**
|
||||
* A **SigningKey** provides high-level access to the elliptic curve
|
||||
* cryptography (ECC) operations and key management.
|
||||
*/
|
||||
export declare class SigningKey {
|
||||
#private;
|
||||
/**
|
||||
* Creates a new **SigningKey** for %%privateKey%%.
|
||||
*/
|
||||
constructor(privateKey: BytesLike);
|
||||
/**
|
||||
* The private key.
|
||||
*/
|
||||
get privateKey(): string;
|
||||
/**
|
||||
* The uncompressed public key.
|
||||
*
|
||||
* This will always begin with the prefix ``0x04`` and be 132
|
||||
* characters long (the ``0x`` prefix and 130 hexadecimal nibbles).
|
||||
*/
|
||||
get publicKey(): string;
|
||||
/**
|
||||
* The compressed public key.
|
||||
*
|
||||
* This will always begin with either the prefix ``0x02`` or ``0x03``
|
||||
* and be 68 characters long (the ``0x`` prefix and 33 hexadecimal
|
||||
* nibbles)
|
||||
*/
|
||||
get compressedPublicKey(): string;
|
||||
/**
|
||||
* Return the signature of the signed %%digest%%.
|
||||
*/
|
||||
sign(digest: BytesLike): Signature;
|
||||
/**
|
||||
* Returns the [[link-wiki-ecdh]] shared secret between this
|
||||
* private key and the %%other%% key.
|
||||
*
|
||||
* The %%other%% key may be any type of key, a raw public key,
|
||||
* a compressed/uncompressed pubic key or aprivate key.
|
||||
*
|
||||
* 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:
|
||||
*/
|
||||
computeSharedSecret(other: BytesLike): string;
|
||||
/**
|
||||
* 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: BytesLike, compressed?: boolean): string;
|
||||
/**
|
||||
* 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: BytesLike, signature: SignatureLike): string;
|
||||
/**
|
||||
* Returns the point resulting from adding the ellipic curve points
|
||||
* %%p0%% and %%p1%%.
|
||||
*
|
||||
* This is not a common function most developers should require, but
|
||||
* can be useful for certain privacy-specific techniques.
|
||||
*
|
||||
* For example, it is used by [[HDNodeWallet]] to compute child
|
||||
* addresses from parent public keys and chain codes.
|
||||
*/
|
||||
static addPoints(p0: BytesLike, p1: BytesLike, compressed?: boolean): string;
|
||||
}
|
21
lib.commonjs/ethers.d.ts
vendored
21
lib.commonjs/ethers.d.ts
vendored
@ -1,21 +0,0 @@
|
||||
export { version } from "./_version.js";
|
||||
export { decodeBytes32String, encodeBytes32String, AbiCoder, ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType, checkResultErrors, Indexed, Interface, LogDescription, Result, TransactionDescription, Typed, } from "./abi/index.js";
|
||||
export { getAddress, getIcapAddress, getCreateAddress, getCreate2Address, isAddressable, isAddress, resolveAddress } from "./address/index.js";
|
||||
export { ZeroAddress, WeiPerEther, MaxUint256, MinInt256, MaxInt256, N, ZeroHash, EtherSymbol, MessagePrefix } from "./constants/index.js";
|
||||
export { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, EventLog, } from "./contract/index.js";
|
||||
export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, lock, Signature, SigningKey } from "./crypto/index.js";
|
||||
export { id, ensNormalize, isValidName, namehash, dnsEncode, hashMessage, verifyMessage, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, TypedDataEncoder } from "./hash/index.js";
|
||||
export { getDefaultProvider, Block, FeeData, Log, TransactionReceipt, TransactionResponse, AbstractSigner, NonceManager, VoidSigner, AbstractProvider, FallbackProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, BrowserProvider, AlchemyProvider, AnkrProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, PocketProvider, QuickNodeProvider, IpcSocketProvider, SocketProvider, WebSocketProvider, EnsResolver, Network } from "./providers/index.js";
|
||||
export { accessListify, computeAddress, recoverAddress, Transaction } from "./transaction/index.js";
|
||||
export { decodeBase58, encodeBase58, decodeBase64, encodeBase64, concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify, isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue, defineProperties, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, makeError, isCallException, isError, FetchRequest, FetchResponse, FetchCancelSignal, FixedNumber, getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity, fromTwos, toTwos, mask, formatEther, parseEther, formatUnits, parseUnits, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, decodeRlp, encodeRlp } from "./utils/index.js";
|
||||
export { Mnemonic, BaseWallet, HDNodeWallet, HDNodeVoidWallet, Wallet, defaultPath, getAccountPath, isCrowdsaleJson, isKeystoreJson, decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./wallet/index.js";
|
||||
export { Wordlist, LangEn, WordlistOwl, WordlistOwlA } from "./wordlists/index.js";
|
||||
export type { JsonFragment, JsonFragmentType, InterfaceAbi, ParamTypeWalkFunc, ParamTypeWalkAsyncFunc } from "./abi/index.js";
|
||||
export type { Addressable } from "./address/index.js";
|
||||
export type { ConstantContractMethod, ContractEvent, ContractEventArgs, ContractEventName, ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction, DeferredTopicFilter, Overrides } from "./contract/index.js";
|
||||
export type { ProgressCallback, SignatureLike } from "./crypto/index.js";
|
||||
export type { TypedDataDomain, TypedDataField } from "./hash/index.js";
|
||||
export type { Provider, Signer } from "./providers/index.js";
|
||||
export type { AccessList, AccessListish, AccessListEntry, TransactionLike } from "./transaction/index.js";
|
||||
export type { BytesLike, BigNumberish, Numeric, ErrorCode, FixedFormat, Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason, RlpStructuredData, GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc, EthersError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CodedEthersError, } from "./utils/index.js";
|
||||
export type { KeystoreAccount, EncryptOptions } from "./wallet/index.js";
|
12
lib.commonjs/hash/id.d.ts
vendored
12
lib.commonjs/hash/id.d.ts
vendored
@ -1,12 +0,0 @@
|
||||
/**
|
||||
* 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:
|
||||
*/
|
||||
export declare function id(value: string): string;
|
11
lib.commonjs/hash/index.d.ts
vendored
11
lib.commonjs/hash/index.d.ts
vendored
@ -1,11 +0,0 @@
|
||||
/**
|
||||
* About hashing here...
|
||||
*
|
||||
* @_section: api/hashing:Hashing Utilities [about-hashing]
|
||||
*/
|
||||
export { id } from "./id.js";
|
||||
export { ensNormalize, isValidName, namehash, dnsEncode } from "./namehash.js";
|
||||
export { hashMessage, verifyMessage } from "./message.js";
|
||||
export { solidityPacked, solidityPackedKeccak256, solidityPackedSha256 } from "./solidity.js";
|
||||
export { TypedDataEncoder } from "./typed-data.js";
|
||||
export type { TypedDataDomain, TypedDataField } from "./typed-data.js";
|
31
lib.commonjs/hash/message.d.ts
vendored
31
lib.commonjs/hash/message.d.ts
vendored
@ -1,31 +0,0 @@
|
||||
import type { SignatureLike } from "../crypto/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:
|
||||
*
|
||||
*/
|
||||
export declare function hashMessage(message: Uint8Array | string): string;
|
||||
export declare function verifyMessage(message: Uint8Array | string, sig: SignatureLike): string;
|
19
lib.commonjs/hash/namehash.d.ts
vendored
19
lib.commonjs/hash/namehash.d.ts
vendored
@ -1,19 +0,0 @@
|
||||
/**
|
||||
* Returns the ENS %%name%% normalized.
|
||||
*/
|
||||
export declare function ensNormalize(name: string): string;
|
||||
/**
|
||||
* Returns ``true`` if %%name%% is a valid ENS name.
|
||||
*/
|
||||
export declare function isValidName(name: string): name is string;
|
||||
/**
|
||||
* Returns the [[link-namehash]] for %%name%%.
|
||||
*/
|
||||
export declare function namehash(name: string): string;
|
||||
/**
|
||||
* Returns the DNS encoded %%name%%.
|
||||
*
|
||||
* This is used for various parts of ENS name resolution, such
|
||||
* as the wildcard resolution.
|
||||
*/
|
||||
export declare function dnsEncode(name: string): string;
|
30
lib.commonjs/hash/solidity.d.ts
vendored
30
lib.commonjs/hash/solidity.d.ts
vendored
@ -1,30 +0,0 @@
|
||||
/**
|
||||
* Computes the [[link-solc-packed]] representation of %%values%%
|
||||
* respectively to their %%types%%.
|
||||
*
|
||||
* @example:
|
||||
* addr = "0x8ba1f109551bd432803012645ac136ddd64dba72"
|
||||
* solidityPacked([ "address", "uint" ], [ addr, 45 ]);
|
||||
* //_result:
|
||||
*/
|
||||
export declare function solidityPacked(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
|
||||
/**
|
||||
* Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%%
|
||||
* respectively to their %%types%%.
|
||||
*
|
||||
* @example:
|
||||
* addr = "0x8ba1f109551bd432803012645ac136ddd64dba72"
|
||||
* solidityPackedKeccak256([ "address", "uint" ], [ addr, 45 ]);
|
||||
* //_result:
|
||||
*/
|
||||
export declare function solidityPackedKeccak256(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
|
||||
/**
|
||||
* Computes the [[link-solc-packed]] [[sha256]] hash of %%values%%
|
||||
* respectively to their %%types%%.
|
||||
*
|
||||
* @example:
|
||||
* addr = "0x8ba1f109551bd432803012645ac136ddd64dba72"
|
||||
* solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]);
|
||||
* //_result:
|
||||
*/
|
||||
export declare function solidityPackedSha256(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
|
37
lib.commonjs/hash/typed-data.d.ts
vendored
37
lib.commonjs/hash/typed-data.d.ts
vendored
@ -1,37 +0,0 @@
|
||||
import type { BigNumberish, BytesLike } from "../utils/index.js";
|
||||
export interface TypedDataDomain {
|
||||
name?: string;
|
||||
version?: string;
|
||||
chainId?: BigNumberish;
|
||||
verifyingContract?: string;
|
||||
salt?: BytesLike;
|
||||
}
|
||||
export interface TypedDataField {
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
export declare class TypedDataEncoder {
|
||||
#private;
|
||||
readonly primaryType: string;
|
||||
get types(): Record<string, Array<TypedDataField>>;
|
||||
constructor(types: Record<string, Array<TypedDataField>>);
|
||||
getEncoder(type: string): (value: any) => string;
|
||||
encodeType(name: string): string;
|
||||
encodeData(type: string, value: any): string;
|
||||
hashStruct(name: string, value: Record<string, any>): string;
|
||||
encode(value: Record<string, any>): string;
|
||||
hash(value: Record<string, any>): string;
|
||||
_visit(type: string, value: any, callback: (type: string, data: any) => any): any;
|
||||
visit(value: Record<string, any>, callback: (type: string, data: any) => any): any;
|
||||
static from(types: Record<string, Array<TypedDataField>>): TypedDataEncoder;
|
||||
static getPrimaryType(types: Record<string, Array<TypedDataField>>): string;
|
||||
static hashStruct(name: string, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): string;
|
||||
static hashDomain(domain: TypedDataDomain): string;
|
||||
static encode(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): string;
|
||||
static hash(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): string;
|
||||
static resolveNames(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>, resolveName: (name: string) => Promise<string>): Promise<{
|
||||
domain: TypedDataDomain;
|
||||
value: any;
|
||||
}>;
|
||||
static getPayload(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): any;
|
||||
}
|
10
lib.commonjs/index.d.ts
vendored
10
lib.commonjs/index.d.ts
vendored
@ -1,10 +0,0 @@
|
||||
/**
|
||||
* The Application Programming Interface (API) is the collection of
|
||||
* functions, classes and types offered by the Ethers library.
|
||||
*
|
||||
* @_section: api:Application Programming Interface [about-api]
|
||||
* @_navTitle: API
|
||||
*/
|
||||
import * as ethers from "./ethers.js";
|
||||
export { ethers };
|
||||
export * from "./ethers.js";
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user