Skip to content

Commit

Permalink
Fixed commonjs imports missing types (ethers-io#3703).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo authored and Woodpile37 committed Jan 14, 2024
1 parent d5c210d commit c3a4468
Show file tree
Hide file tree
Showing 169 changed files with 7,721 additions and 0 deletions.
84 changes: 84 additions & 0 deletions lib.commonjs/_tests/blockchain-data.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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 changes: 7 additions & 0 deletions lib.commonjs/_tests/create-provider.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
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 change: 1 addition & 0 deletions lib.commonjs/_tests/test-abi.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-address.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-contract.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-crypto-algoswap.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-crypto.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-hash-typeddata.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-hash.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-providers-avatar.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-providers-ccip.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-providers-data.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-providers-errors.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-providers-extra.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-providers-send.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-providers-wildcard.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-rlp.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-transaction.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-utils-maths.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-utils-misc.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-utils-units.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
12 changes: 12 additions & 0 deletions lib.commonjs/_tests/test-utils-utf8.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export type TestCaseBadString = {
name: string;
bytes: Uint8Array;
ignore: string;
replace: string;
error: string;
};
export type TestCaseCodePoints = {
name: string;
text: string;
codepoints: Array<number>;
};
6 changes: 6 additions & 0 deletions lib.commonjs/_tests/test-wallet-hd.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare global {
class TextDecoder {
decode(data: Uint8Array): string;
}
}
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-wallet-json.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-wallet-mnemonic.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-wallet.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib.commonjs/_tests/test-wordlists.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
216 changes: 216 additions & 0 deletions lib.commonjs/_tests/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
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 changes: 8 additions & 0 deletions lib.commonjs/_tests/utils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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>;
1 change: 1 addition & 0 deletions lib.commonjs/_version.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export declare const version: string;
Loading

0 comments on commit c3a4468

Please sign in to comment.