admin: updated dist files
This commit is contained in:
parent
15ed2f5b32
commit
56ed4e7380
@ -28,3 +28,4 @@ testcases/**
|
|||||||
node_modules/**
|
node_modules/**
|
||||||
misc/**
|
misc/**
|
||||||
**/*.tgz
|
**/*.tgz
|
||||||
|
dist/*.gz
|
||||||
|
@ -3,6 +3,12 @@ Change Log
|
|||||||
|
|
||||||
This change log is maintained by `src.ts/_admin/update-changelog.ts` but may also be manually updated.
|
This change log is maintained by `src.ts/_admin/update-changelog.ts` but may also be manually updated.
|
||||||
|
|
||||||
|
ethers/v6.4.1 (2023-06-01 17:52)
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
- Fixed AbstractProvider lookupAddress bug ([#4086](https://github.com/ethers-io/ethers.js/issues/4086); [15ed2f5](https://github.com/ethers-io/ethers.js/commit/15ed2f5b32084527961332481c9442a313036a01)).
|
||||||
|
- Fix FixedNumber comparison bug ([#4112](https://github.com/ethers-io/ethers.js/issues/4112); [d8e9586](https://github.com/ethers-io/ethers.js/commit/d8e9586044e888e424b5ead0f6e01f88140dba8a)).
|
||||||
|
|
||||||
ethers/v6.4.0 (2023-05-18 17:28)
|
ethers/v6.4.0 (2023-05-18 17:28)
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
|
||||||
|
1669
dist/ethers.js
vendored
1669
dist/ethers.js
vendored
File diff suppressed because it is too large
Load Diff
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
1667
dist/ethers.umd.js
vendored
1667
dist/ethers.umd.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/ethers.umd.js.map
vendored
2
dist/ethers.umd.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/ethers.umd.min.js
vendored
2
dist/ethers.umd.min.js
vendored
File diff suppressed because one or more lines are too long
28
dist/wordlists-extra.js
vendored
28
dist/wordlists-extra.js
vendored
@ -151,7 +151,7 @@ const u64 = {
|
|||||||
/**
|
/**
|
||||||
* The current version of Ethers.
|
* The current version of Ethers.
|
||||||
*/
|
*/
|
||||||
const version = "6.4.0";
|
const version = "6.4.1";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property helper functions.
|
* Property helper functions.
|
||||||
@ -196,7 +196,11 @@ function defineProperties(target, values, types) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* About Errors.
|
* All errors in ethers include properties to ensure they are both
|
||||||
|
* human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``).
|
||||||
|
*
|
||||||
|
* The [[isError]] function can be used to check the error ``code`` and
|
||||||
|
* provide a type guard for the properties present on that error interface.
|
||||||
*
|
*
|
||||||
* @_section: api/utils/errors:Errors [about-errors]
|
* @_section: api/utils/errors:Errors [about-errors]
|
||||||
*/
|
*/
|
||||||
@ -968,7 +972,7 @@ class Wordlist {
|
|||||||
* based on ASCII-7 small.
|
* based on ASCII-7 small.
|
||||||
*
|
*
|
||||||
* If necessary, there are tools within the ``generation/`` folder
|
* If necessary, there are tools within the ``generation/`` folder
|
||||||
* to create these necessary data.
|
* to create the necessary data.
|
||||||
*/
|
*/
|
||||||
class WordlistOwl extends Wordlist {
|
class WordlistOwl extends Wordlist {
|
||||||
#data;
|
#data;
|
||||||
@ -983,7 +987,13 @@ class WordlistOwl extends Wordlist {
|
|||||||
this.#checksum = checksum;
|
this.#checksum = checksum;
|
||||||
this.#words = null;
|
this.#words = null;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The OWL-encoded data.
|
||||||
|
*/
|
||||||
get _data() { return this.#data; }
|
get _data() { return this.#data; }
|
||||||
|
/**
|
||||||
|
* Decode all the words for the wordlist.
|
||||||
|
*/
|
||||||
_decodeWords() {
|
_decodeWords() {
|
||||||
return decodeOwl(this.#data);
|
return decodeOwl(this.#data);
|
||||||
}
|
}
|
||||||
@ -1109,15 +1119,25 @@ function decodeOwlA(data, accents) {
|
|||||||
* based on latin-1 small.
|
* based on latin-1 small.
|
||||||
*
|
*
|
||||||
* If necessary, there are tools within the ``generation/`` folder
|
* If necessary, there are tools within the ``generation/`` folder
|
||||||
* to create these necessary data.
|
* to create the necessary data.
|
||||||
*/
|
*/
|
||||||
class WordlistOwlA extends WordlistOwl {
|
class WordlistOwlA extends WordlistOwl {
|
||||||
#accent;
|
#accent;
|
||||||
|
/**
|
||||||
|
* Creates a new Wordlist for %%locale%% using the OWLA %%data%%
|
||||||
|
* and %%accent%% data and validated against the %%checksum%%.
|
||||||
|
*/
|
||||||
constructor(locale, data, accent, checksum) {
|
constructor(locale, data, accent, checksum) {
|
||||||
super(locale, data, checksum);
|
super(locale, data, checksum);
|
||||||
this.#accent = accent;
|
this.#accent = accent;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The OWLA-encoded accent data.
|
||||||
|
*/
|
||||||
get _accent() { return this.#accent; }
|
get _accent() { return this.#accent; }
|
||||||
|
/**
|
||||||
|
* Decode all the words for the wordlist.
|
||||||
|
*/
|
||||||
_decodeWords() {
|
_decodeWords() {
|
||||||
return decodeOwlA(this._data, this._accent);
|
return decodeOwlA(this._data, this._accent);
|
||||||
}
|
}
|
||||||
|
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
@ -5,5 +5,5 @@ exports.version = void 0;
|
|||||||
/**
|
/**
|
||||||
* The current version of Ethers.
|
* The current version of Ethers.
|
||||||
*/
|
*/
|
||||||
exports.version = "6.4.0";
|
exports.version = "6.4.1";
|
||||||
//# sourceMappingURL=_version.js.map
|
//# sourceMappingURL=_version.js.map
|
3
lib.commonjs/abi/abi-coder.d.ts
vendored
3
lib.commonjs/abi/abi-coder.d.ts
vendored
@ -14,7 +14,8 @@ import { Result } from "./coders/abstract-coder.js";
|
|||||||
import { ParamType } from "./fragments.js";
|
import { ParamType } from "./fragments.js";
|
||||||
import type { BytesLike, CallExceptionAction, CallExceptionError } from "../utils/index.js";
|
import type { BytesLike, CallExceptionAction, CallExceptionError } from "../utils/index.js";
|
||||||
/**
|
/**
|
||||||
* About AbiCoder
|
* The **AbiCoder** is a low-level class responsible for encoding JavaScript
|
||||||
|
* values into binary data and decoding binary data into JavaScript values.
|
||||||
*/
|
*/
|
||||||
export declare class AbiCoder {
|
export declare class AbiCoder {
|
||||||
#private;
|
#private;
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"abi-coder.d.ts","sourceRoot":"","sources":["../../src.ts/abi/abi-coder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAAiB,MAAM,EAAU,MAAM,4BAA4B,CAAC;AAU3E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK3C,OAAO,KAAK,EACR,SAAS,EACT,mBAAmB,EAAE,kBAAkB,EAC1C,MAAM,mBAAmB,CAAC;AAuF3B;;IAEI;AACJ,qBAAa,QAAQ;;IA4CjB;;;;;OAKG;IACH,eAAe,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM;IAMjE;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,MAAM;IAWpF;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM;IAM1F;;;;OAIG;IACH,MAAM,CAAC,eAAe,IAAI,QAAQ;IAOlC;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,CAAC,MAAM,EAAE,mBAAmB,EAAE,EAAE,EAAE;QAAE,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,IAAI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, abiCoder) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* About AbiCoder
|
* The **AbiCoder** is a low-level class responsible for encoding JavaScript
|
||||||
|
* values into binary data and decoding binary data into JavaScript values.
|
||||||
*/
|
*/
|
||||||
class AbiCoder {
|
class AbiCoder {
|
||||||
#getCoder(param) {
|
#getCoder(param) {
|
||||||
|
File diff suppressed because one or more lines are too long
106
lib.commonjs/abi/fragments.d.ts
vendored
106
lib.commonjs/abi/fragments.d.ts
vendored
@ -1,10 +1,16 @@
|
|||||||
/**
|
/**
|
||||||
* About frgaments...
|
* A fragment is a single item from an ABI, which may represent any of:
|
||||||
|
*
|
||||||
|
* - [Functions](FunctionFragment)
|
||||||
|
* - [Events](EventFragment)
|
||||||
|
* - [Constructors](ConstructorFragment)
|
||||||
|
* - Custom [Errors](ErrorFragment)
|
||||||
|
* - [Fallback or Receive](FallbackFragment) functions
|
||||||
*
|
*
|
||||||
* @_subsection api/abi/abi-coder:Fragments [about-fragments]
|
* @_subsection api/abi/abi-coder:Fragments [about-fragments]
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* A type description in a JSON API.
|
* A Type description in a [JSON ABI format](link-solc-jsonabi).
|
||||||
*/
|
*/
|
||||||
export interface JsonFragmentType {
|
export interface JsonFragmentType {
|
||||||
/**
|
/**
|
||||||
@ -29,7 +35,7 @@ export interface JsonFragmentType {
|
|||||||
readonly components?: ReadonlyArray<JsonFragmentType>;
|
readonly components?: ReadonlyArray<JsonFragmentType>;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* A fragment for a method, event or error in a JSON API.
|
* A fragment for a method, event or error in a [JSON ABI format](link-solc-jsonabi).
|
||||||
*/
|
*/
|
||||||
export interface JsonFragment {
|
export interface JsonFragment {
|
||||||
/**
|
/**
|
||||||
@ -71,6 +77,19 @@ export interface JsonFragment {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* The format to serialize the output as.
|
* The format to serialize the output as.
|
||||||
|
*
|
||||||
|
* **``"sighash"``** - the bare formatting, used to compute the selector
|
||||||
|
* or topic hash; this format cannot be reversed (as it discards ``indexed``)
|
||||||
|
* so cannot by used to export an [[Interface]].
|
||||||
|
*
|
||||||
|
* **``"minimal"``** - Human-Readable ABI with minimal spacing and without
|
||||||
|
* names, so it is compact, but will result in Result objects that cannot
|
||||||
|
* be accessed by name.
|
||||||
|
*
|
||||||
|
* **``"full"``** - Full Human-Readable ABI, with readable spacing and names
|
||||||
|
* intact; this is generally the recommended format.
|
||||||
|
*
|
||||||
|
* **``"json"``** - The [JSON ABI format](link-solc-jsonabi).
|
||||||
*/
|
*/
|
||||||
export type FormatType = "sighash" | "minimal" | "full" | "json";
|
export type FormatType = "sighash" | "minimal" | "full" | "json";
|
||||||
/**
|
/**
|
||||||
@ -84,7 +103,7 @@ export type ParamTypeWalkFunc = (type: string, value: any) => any;
|
|||||||
*/
|
*/
|
||||||
export type ParamTypeWalkAsyncFunc = (type: string, value: any) => any | Promise<any>;
|
export type ParamTypeWalkAsyncFunc = (type: string, value: any) => any | Promise<any>;
|
||||||
/**
|
/**
|
||||||
* Each input and output of a [[Fragment]] is an Array of **PAramType**.
|
* Each input and output of a [[Fragment]] is an Array of **ParamType**.
|
||||||
*/
|
*/
|
||||||
export declare class ParamType {
|
export declare class ParamType {
|
||||||
#private;
|
#private;
|
||||||
@ -215,7 +234,7 @@ export declare abstract class Fragment {
|
|||||||
*/
|
*/
|
||||||
constructor(guard: any, type: FragmentType, inputs: ReadonlyArray<ParamType>);
|
constructor(guard: any, type: FragmentType, inputs: ReadonlyArray<ParamType>);
|
||||||
/**
|
/**
|
||||||
* Returns a string representation of this fragment.
|
* Returns a string representation of this fragment as %%format%%.
|
||||||
*/
|
*/
|
||||||
abstract format(format?: FormatType): string;
|
abstract format(format?: FormatType): string;
|
||||||
/**
|
/**
|
||||||
@ -270,14 +289,27 @@ export declare class ErrorFragment extends NamedFragment {
|
|||||||
* The Custom Error selector.
|
* The Custom Error selector.
|
||||||
*/
|
*/
|
||||||
get selector(): string;
|
get selector(): string;
|
||||||
|
/**
|
||||||
|
* Returns a string representation of this fragment as %%format%%.
|
||||||
|
*/
|
||||||
format(format?: FormatType): string;
|
format(format?: FormatType): string;
|
||||||
|
/**
|
||||||
|
* Returns a new **ErrorFragment** for %%obj%%.
|
||||||
|
*/
|
||||||
static from(obj: any): ErrorFragment;
|
static from(obj: any): ErrorFragment;
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard if %%value%% is an
|
||||||
|
* **ErrorFragment**.
|
||||||
|
*/
|
||||||
static isFragment(value: any): value is ErrorFragment;
|
static isFragment(value: any): value is ErrorFragment;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* A Fragment which represents an Event.
|
* A Fragment which represents an Event.
|
||||||
*/
|
*/
|
||||||
export declare class EventFragment extends NamedFragment {
|
export declare class EventFragment extends NamedFragment {
|
||||||
|
/**
|
||||||
|
* Whether this event is anonymous.
|
||||||
|
*/
|
||||||
readonly anonymous: boolean;
|
readonly anonymous: boolean;
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@ -287,23 +319,52 @@ export declare class EventFragment extends NamedFragment {
|
|||||||
* The Event topic hash.
|
* The Event topic hash.
|
||||||
*/
|
*/
|
||||||
get topicHash(): string;
|
get topicHash(): string;
|
||||||
|
/**
|
||||||
|
* Returns a string representation of this event as %%format%%.
|
||||||
|
*/
|
||||||
format(format?: FormatType): string;
|
format(format?: FormatType): string;
|
||||||
|
/**
|
||||||
|
* Return the topic hash for an event with %%name%% and %%params%%.
|
||||||
|
*/
|
||||||
static getTopicHash(name: string, params?: Array<any>): string;
|
static getTopicHash(name: string, params?: Array<any>): string;
|
||||||
|
/**
|
||||||
|
* Returns a new **EventFragment** for %%obj%%.
|
||||||
|
*/
|
||||||
static from(obj: any): EventFragment;
|
static from(obj: any): EventFragment;
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard if %%value%% is an
|
||||||
|
* **EventFragment**.
|
||||||
|
*/
|
||||||
static isFragment(value: any): value is EventFragment;
|
static isFragment(value: any): value is EventFragment;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* A Fragment which represents a constructor.
|
* A Fragment which represents a constructor.
|
||||||
*/
|
*/
|
||||||
export declare class ConstructorFragment extends Fragment {
|
export declare class ConstructorFragment extends Fragment {
|
||||||
|
/**
|
||||||
|
* Whether the constructor can receive an endowment.
|
||||||
|
*/
|
||||||
readonly payable: boolean;
|
readonly payable: boolean;
|
||||||
|
/**
|
||||||
|
* The recommended gas limit for deployment or ``null``.
|
||||||
|
*/
|
||||||
readonly gas: null | bigint;
|
readonly gas: null | bigint;
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
constructor(guard: any, type: FragmentType, inputs: ReadonlyArray<ParamType>, payable: boolean, gas: null | bigint);
|
constructor(guard: any, type: FragmentType, inputs: ReadonlyArray<ParamType>, payable: boolean, gas: null | bigint);
|
||||||
|
/**
|
||||||
|
* Returns a string representation of this constructor as %%format%%.
|
||||||
|
*/
|
||||||
format(format?: FormatType): string;
|
format(format?: FormatType): string;
|
||||||
|
/**
|
||||||
|
* Returns a new **ConstructorFragment** for %%obj%%.
|
||||||
|
*/
|
||||||
static from(obj: any): ConstructorFragment;
|
static from(obj: any): ConstructorFragment;
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard if %%value%% is a
|
||||||
|
* **ConstructorFragment**.
|
||||||
|
*/
|
||||||
static isFragment(value: any): value is ConstructorFragment;
|
static isFragment(value: any): value is ConstructorFragment;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -315,8 +376,18 @@ export declare class FallbackFragment extends Fragment {
|
|||||||
*/
|
*/
|
||||||
readonly payable: boolean;
|
readonly payable: boolean;
|
||||||
constructor(guard: any, inputs: ReadonlyArray<ParamType>, payable: boolean);
|
constructor(guard: any, inputs: ReadonlyArray<ParamType>, payable: boolean);
|
||||||
|
/**
|
||||||
|
* Returns a string representation of this fallback as %%format%%.
|
||||||
|
*/
|
||||||
format(format?: FormatType): string;
|
format(format?: FormatType): string;
|
||||||
|
/**
|
||||||
|
* Returns a new **FallbackFragment** for %%obj%%.
|
||||||
|
*/
|
||||||
static from(obj: any): FallbackFragment;
|
static from(obj: any): FallbackFragment;
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard if %%value%% is a
|
||||||
|
* **FallbackFragment**.
|
||||||
|
*/
|
||||||
static isFragment(value: any): value is FallbackFragment;
|
static isFragment(value: any): value is FallbackFragment;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -341,7 +412,7 @@ export declare class FunctionFragment extends NamedFragment {
|
|||||||
*/
|
*/
|
||||||
readonly payable: boolean;
|
readonly payable: boolean;
|
||||||
/**
|
/**
|
||||||
* The amount of gas to send when calling this function
|
* The recommended gas limit to send when calling this function.
|
||||||
*/
|
*/
|
||||||
readonly gas: null | bigint;
|
readonly gas: null | bigint;
|
||||||
/**
|
/**
|
||||||
@ -352,9 +423,22 @@ export declare class FunctionFragment extends NamedFragment {
|
|||||||
* The Function selector.
|
* The Function selector.
|
||||||
*/
|
*/
|
||||||
get selector(): string;
|
get selector(): string;
|
||||||
|
/**
|
||||||
|
* Returns a string representation of this function as %%format%%.
|
||||||
|
*/
|
||||||
format(format?: FormatType): string;
|
format(format?: FormatType): string;
|
||||||
|
/**
|
||||||
|
* Return the selector for a function with %%name%% and %%params%%.
|
||||||
|
*/
|
||||||
static getSelector(name: string, params?: Array<any>): string;
|
static getSelector(name: string, params?: Array<any>): string;
|
||||||
|
/**
|
||||||
|
* Returns a new **FunctionFragment** for %%obj%%.
|
||||||
|
*/
|
||||||
static from(obj: any): FunctionFragment;
|
static from(obj: any): FunctionFragment;
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard if %%value%% is a
|
||||||
|
* **FunctionFragment**.
|
||||||
|
*/
|
||||||
static isFragment(value: any): value is FunctionFragment;
|
static isFragment(value: any): value is FunctionFragment;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -365,8 +449,18 @@ export declare class StructFragment extends NamedFragment {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
constructor(guard: any, name: string, inputs: ReadonlyArray<ParamType>);
|
constructor(guard: any, name: string, inputs: ReadonlyArray<ParamType>);
|
||||||
|
/**
|
||||||
|
* Returns a string representation of this struct as %%format%%.
|
||||||
|
*/
|
||||||
format(): string;
|
format(): string;
|
||||||
|
/**
|
||||||
|
* Returns a new **StructFragment** for %%obj%%.
|
||||||
|
*/
|
||||||
static from(obj: any): StructFragment;
|
static from(obj: any): StructFragment;
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard if %%value%% is a
|
||||||
|
* **StructFragment**.
|
||||||
|
*/
|
||||||
static isFragment(value: any): value is FunctionFragment;
|
static isFragment(value: any): value is FunctionFragment;
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=fragments.d.ts.map
|
//# sourceMappingURL=fragments.d.ts.map
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,12 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
/**
|
/**
|
||||||
* About frgaments...
|
* A fragment is a single item from an ABI, which may represent any of:
|
||||||
|
*
|
||||||
|
* - [Functions](FunctionFragment)
|
||||||
|
* - [Events](EventFragment)
|
||||||
|
* - [Constructors](ConstructorFragment)
|
||||||
|
* - Custom [Errors](ErrorFragment)
|
||||||
|
* - [Fallback or Receive](FallbackFragment) functions
|
||||||
*
|
*
|
||||||
* @_subsection api/abi/abi-coder:Fragments [about-fragments]
|
* @_subsection api/abi/abi-coder:Fragments [about-fragments]
|
||||||
*/
|
*/
|
||||||
@ -338,7 +344,7 @@ const FallbackFragmentInternal = "_FallbackInternal";
|
|||||||
const FunctionFragmentInternal = "_FunctionInternal";
|
const FunctionFragmentInternal = "_FunctionInternal";
|
||||||
const StructFragmentInternal = "_StructInternal";
|
const StructFragmentInternal = "_StructInternal";
|
||||||
/**
|
/**
|
||||||
* Each input and output of a [[Fragment]] is an Array of **PAramType**.
|
* Each input and output of a [[Fragment]] is an Array of **ParamType**.
|
||||||
*/
|
*/
|
||||||
class ParamType {
|
class ParamType {
|
||||||
/**
|
/**
|
||||||
@ -462,15 +468,6 @@ class ParamType {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* Returns true if %%value%% is an Array type.
|
|
||||||
*
|
|
||||||
* This provides a type gaurd ensuring that the
|
|
||||||
* [[arrayChildren]] and [[arrayLength]] are non-null.
|
|
||||||
*/
|
|
||||||
//static isArray(value: any): value is { arrayChildren: ParamType, arrayLength: number } {
|
|
||||||
// return value && (value.baseType === "array")
|
|
||||||
//}
|
|
||||||
/**
|
/**
|
||||||
* Returns true if %%this%% is an Array type.
|
* Returns true if %%this%% is an Array type.
|
||||||
*
|
*
|
||||||
@ -825,6 +822,9 @@ class ErrorFragment extends NamedFragment {
|
|||||||
get selector() {
|
get selector() {
|
||||||
return (0, index_js_2.id)(this.format("sighash")).substring(0, 10);
|
return (0, index_js_2.id)(this.format("sighash")).substring(0, 10);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a string representation of this fragment as %%format%%.
|
||||||
|
*/
|
||||||
format(format) {
|
format(format) {
|
||||||
if (format == null) {
|
if (format == null) {
|
||||||
format = "sighash";
|
format = "sighash";
|
||||||
@ -843,6 +843,9 @@ class ErrorFragment extends NamedFragment {
|
|||||||
result.push(this.name + joinParams(format, this.inputs));
|
result.push(this.name + joinParams(format, this.inputs));
|
||||||
return result.join(" ");
|
return result.join(" ");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a new **ErrorFragment** for %%obj%%.
|
||||||
|
*/
|
||||||
static from(obj) {
|
static from(obj) {
|
||||||
if (ErrorFragment.isFragment(obj)) {
|
if (ErrorFragment.isFragment(obj)) {
|
||||||
return obj;
|
return obj;
|
||||||
@ -858,6 +861,10 @@ class ErrorFragment extends NamedFragment {
|
|||||||
}
|
}
|
||||||
return new ErrorFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);
|
return new ErrorFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard if %%value%% is an
|
||||||
|
* **ErrorFragment**.
|
||||||
|
*/
|
||||||
static isFragment(value) {
|
static isFragment(value) {
|
||||||
return (value && value[internal] === ErrorFragmentInternal);
|
return (value && value[internal] === ErrorFragmentInternal);
|
||||||
}
|
}
|
||||||
@ -867,6 +874,9 @@ exports.ErrorFragment = ErrorFragment;
|
|||||||
* A Fragment which represents an Event.
|
* A Fragment which represents an Event.
|
||||||
*/
|
*/
|
||||||
class EventFragment extends NamedFragment {
|
class EventFragment extends NamedFragment {
|
||||||
|
/**
|
||||||
|
* Whether this event is anonymous.
|
||||||
|
*/
|
||||||
anonymous;
|
anonymous;
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@ -882,6 +892,9 @@ class EventFragment extends NamedFragment {
|
|||||||
get topicHash() {
|
get topicHash() {
|
||||||
return (0, index_js_2.id)(this.format("sighash"));
|
return (0, index_js_2.id)(this.format("sighash"));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a string representation of this event as %%format%%.
|
||||||
|
*/
|
||||||
format(format) {
|
format(format) {
|
||||||
if (format == null) {
|
if (format == null) {
|
||||||
format = "sighash";
|
format = "sighash";
|
||||||
@ -904,11 +917,17 @@ class EventFragment extends NamedFragment {
|
|||||||
}
|
}
|
||||||
return result.join(" ");
|
return result.join(" ");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return the topic hash for an event with %%name%% and %%params%%.
|
||||||
|
*/
|
||||||
static getTopicHash(name, params) {
|
static getTopicHash(name, params) {
|
||||||
params = (params || []).map((p) => ParamType.from(p));
|
params = (params || []).map((p) => ParamType.from(p));
|
||||||
const fragment = new EventFragment(_guard, name, params, false);
|
const fragment = new EventFragment(_guard, name, params, false);
|
||||||
return fragment.topicHash;
|
return fragment.topicHash;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a new **EventFragment** for %%obj%%.
|
||||||
|
*/
|
||||||
static from(obj) {
|
static from(obj) {
|
||||||
if (EventFragment.isFragment(obj)) {
|
if (EventFragment.isFragment(obj)) {
|
||||||
return obj;
|
return obj;
|
||||||
@ -925,6 +944,10 @@ class EventFragment extends NamedFragment {
|
|||||||
}
|
}
|
||||||
return new EventFragment(_guard, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous);
|
return new EventFragment(_guard, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard if %%value%% is an
|
||||||
|
* **EventFragment**.
|
||||||
|
*/
|
||||||
static isFragment(value) {
|
static isFragment(value) {
|
||||||
return (value && value[internal] === EventFragmentInternal);
|
return (value && value[internal] === EventFragmentInternal);
|
||||||
}
|
}
|
||||||
@ -934,7 +957,13 @@ exports.EventFragment = EventFragment;
|
|||||||
* A Fragment which represents a constructor.
|
* A Fragment which represents a constructor.
|
||||||
*/
|
*/
|
||||||
class ConstructorFragment extends Fragment {
|
class ConstructorFragment extends Fragment {
|
||||||
|
/**
|
||||||
|
* Whether the constructor can receive an endowment.
|
||||||
|
*/
|
||||||
payable;
|
payable;
|
||||||
|
/**
|
||||||
|
* The recommended gas limit for deployment or ``null``.
|
||||||
|
*/
|
||||||
gas;
|
gas;
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@ -944,6 +973,9 @@ class ConstructorFragment extends Fragment {
|
|||||||
Object.defineProperty(this, internal, { value: ConstructorFragmentInternal });
|
Object.defineProperty(this, internal, { value: ConstructorFragmentInternal });
|
||||||
(0, index_js_1.defineProperties)(this, { payable, gas });
|
(0, index_js_1.defineProperties)(this, { payable, gas });
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a string representation of this constructor as %%format%%.
|
||||||
|
*/
|
||||||
format(format) {
|
format(format) {
|
||||||
(0, index_js_1.assert)(format != null && format !== "sighash", "cannot format a constructor for sighash", "UNSUPPORTED_OPERATION", { operation: "format(sighash)" });
|
(0, index_js_1.assert)(format != null && format !== "sighash", "cannot format a constructor for sighash", "UNSUPPORTED_OPERATION", { operation: "format(sighash)" });
|
||||||
if (format === "json") {
|
if (format === "json") {
|
||||||
@ -962,6 +994,9 @@ class ConstructorFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
return result.join(" ");
|
return result.join(" ");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a new **ConstructorFragment** for %%obj%%.
|
||||||
|
*/
|
||||||
static from(obj) {
|
static from(obj) {
|
||||||
if (ConstructorFragment.isFragment(obj)) {
|
if (ConstructorFragment.isFragment(obj)) {
|
||||||
return obj;
|
return obj;
|
||||||
@ -979,6 +1014,10 @@ class ConstructorFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
return new ConstructorFragment(_guard, "constructor", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, (obj.gas != null) ? obj.gas : null);
|
return new ConstructorFragment(_guard, "constructor", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, (obj.gas != null) ? obj.gas : null);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard if %%value%% is a
|
||||||
|
* **ConstructorFragment**.
|
||||||
|
*/
|
||||||
static isFragment(value) {
|
static isFragment(value) {
|
||||||
return (value && value[internal] === ConstructorFragmentInternal);
|
return (value && value[internal] === ConstructorFragmentInternal);
|
||||||
}
|
}
|
||||||
@ -997,6 +1036,9 @@ class FallbackFragment extends Fragment {
|
|||||||
Object.defineProperty(this, internal, { value: FallbackFragmentInternal });
|
Object.defineProperty(this, internal, { value: FallbackFragmentInternal });
|
||||||
(0, index_js_1.defineProperties)(this, { payable });
|
(0, index_js_1.defineProperties)(this, { payable });
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a string representation of this fallback as %%format%%.
|
||||||
|
*/
|
||||||
format(format) {
|
format(format) {
|
||||||
const type = ((this.inputs.length === 0) ? "receive" : "fallback");
|
const type = ((this.inputs.length === 0) ? "receive" : "fallback");
|
||||||
if (format === "json") {
|
if (format === "json") {
|
||||||
@ -1005,6 +1047,9 @@ class FallbackFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
return `${type}()${this.payable ? " payable" : ""}`;
|
return `${type}()${this.payable ? " payable" : ""}`;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a new **FallbackFragment** for %%obj%%.
|
||||||
|
*/
|
||||||
static from(obj) {
|
static from(obj) {
|
||||||
if (FallbackFragment.isFragment(obj)) {
|
if (FallbackFragment.isFragment(obj)) {
|
||||||
return obj;
|
return obj;
|
||||||
@ -1053,6 +1098,10 @@ class FallbackFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
(0, index_js_1.assertArgument)(false, "invalid fallback description", "obj", obj);
|
(0, index_js_1.assertArgument)(false, "invalid fallback description", "obj", obj);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard if %%value%% is a
|
||||||
|
* **FallbackFragment**.
|
||||||
|
*/
|
||||||
static isFragment(value) {
|
static isFragment(value) {
|
||||||
return (value && value[internal] === FallbackFragmentInternal);
|
return (value && value[internal] === FallbackFragmentInternal);
|
||||||
}
|
}
|
||||||
@ -1080,7 +1129,7 @@ class FunctionFragment extends NamedFragment {
|
|||||||
*/
|
*/
|
||||||
payable;
|
payable;
|
||||||
/**
|
/**
|
||||||
* The amount of gas to send when calling this function
|
* The recommended gas limit to send when calling this function.
|
||||||
*/
|
*/
|
||||||
gas;
|
gas;
|
||||||
/**
|
/**
|
||||||
@ -1100,6 +1149,9 @@ class FunctionFragment extends NamedFragment {
|
|||||||
get selector() {
|
get selector() {
|
||||||
return (0, index_js_2.id)(this.format("sighash")).substring(0, 10);
|
return (0, index_js_2.id)(this.format("sighash")).substring(0, 10);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a string representation of this function as %%format%%.
|
||||||
|
*/
|
||||||
format(format) {
|
format(format) {
|
||||||
if (format == null) {
|
if (format == null) {
|
||||||
format = "sighash";
|
format = "sighash";
|
||||||
@ -1135,11 +1187,17 @@ class FunctionFragment extends NamedFragment {
|
|||||||
}
|
}
|
||||||
return result.join(" ");
|
return result.join(" ");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return the selector for a function with %%name%% and %%params%%.
|
||||||
|
*/
|
||||||
static getSelector(name, params) {
|
static getSelector(name, params) {
|
||||||
params = (params || []).map((p) => ParamType.from(p));
|
params = (params || []).map((p) => ParamType.from(p));
|
||||||
const fragment = new FunctionFragment(_guard, name, "view", params, [], null);
|
const fragment = new FunctionFragment(_guard, name, "view", params, [], null);
|
||||||
return fragment.selector;
|
return fragment.selector;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a new **FunctionFragment** for %%obj%%.
|
||||||
|
*/
|
||||||
static from(obj) {
|
static from(obj) {
|
||||||
if (FunctionFragment.isFragment(obj)) {
|
if (FunctionFragment.isFragment(obj)) {
|
||||||
return obj;
|
return obj;
|
||||||
@ -1180,6 +1238,10 @@ class FunctionFragment extends NamedFragment {
|
|||||||
// payable: false but stateMutability is "nonpayable")
|
// payable: false but stateMutability is "nonpayable")
|
||||||
return new FunctionFragment(_guard, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], (obj.gas != null) ? obj.gas : null);
|
return new FunctionFragment(_guard, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], (obj.gas != null) ? obj.gas : null);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard if %%value%% is a
|
||||||
|
* **FunctionFragment**.
|
||||||
|
*/
|
||||||
static isFragment(value) {
|
static isFragment(value) {
|
||||||
return (value && value[internal] === FunctionFragmentInternal);
|
return (value && value[internal] === FunctionFragmentInternal);
|
||||||
}
|
}
|
||||||
@ -1196,9 +1258,15 @@ class StructFragment extends NamedFragment {
|
|||||||
super(guard, "struct", name, inputs);
|
super(guard, "struct", name, inputs);
|
||||||
Object.defineProperty(this, internal, { value: StructFragmentInternal });
|
Object.defineProperty(this, internal, { value: StructFragmentInternal });
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a string representation of this struct as %%format%%.
|
||||||
|
*/
|
||||||
format() {
|
format() {
|
||||||
throw new Error("@TODO");
|
throw new Error("@TODO");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a new **StructFragment** for %%obj%%.
|
||||||
|
*/
|
||||||
static from(obj) {
|
static from(obj) {
|
||||||
if (typeof (obj) === "string") {
|
if (typeof (obj) === "string") {
|
||||||
return StructFragment.from(lex(obj));
|
return StructFragment.from(lex(obj));
|
||||||
@ -1211,6 +1279,11 @@ class StructFragment extends NamedFragment {
|
|||||||
}
|
}
|
||||||
return new StructFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);
|
return new StructFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []);
|
||||||
}
|
}
|
||||||
|
// @TODO: fix this return type
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard if %%value%% is a
|
||||||
|
* **StructFragment**.
|
||||||
|
*/
|
||||||
static isFragment(value) {
|
static isFragment(value) {
|
||||||
return (value && value[internal] === StructFragmentInternal);
|
return (value && value[internal] === StructFragmentInternal);
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
6
lib.commonjs/abi/index.d.ts
vendored
6
lib.commonjs/abi/index.d.ts
vendored
@ -1,5 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* Explain about ABI here...
|
* The Application Binary Interface (ABI) describes how method input
|
||||||
|
* parameters should be encoded, their results decoded, and how to
|
||||||
|
* decode events and errors.
|
||||||
|
*
|
||||||
|
* See [About ABIs](docs-abi) for more details how they are used.
|
||||||
*
|
*
|
||||||
* @_section api/abi:Application Binary Interface [about-abi]
|
* @_section api/abi:Application Binary Interface [about-abi]
|
||||||
* @_navTitle: ABI
|
* @_navTitle: ABI
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EACH,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EACnE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,GACvE,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,gBAAgB,EAAE,cAAc,EAAE,sBAAsB,EACxD,MAAM,EACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,YAAY,EACR,YAAY,EAAE,gBAAgB,EAC9B,UAAU,EAAE,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EACtE,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACR,YAAY,GACf,MAAM,gBAAgB,CAAC"}
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EACH,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EACnE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,GACvE,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,gBAAgB,EAAE,cAAc,EAAE,sBAAsB,EACxD,MAAM,EACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,YAAY,EACR,YAAY,EAAE,gBAAgB,EAC9B,UAAU,EAAE,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EACtE,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACR,YAAY,GACf,MAAM,gBAAgB,CAAC"}
|
@ -1,6 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
/**
|
/**
|
||||||
* Explain about ABI here...
|
* The Application Binary Interface (ABI) describes how method input
|
||||||
|
* parameters should be encoded, their results decoded, and how to
|
||||||
|
* decode events and errors.
|
||||||
|
*
|
||||||
|
* See [About ABIs](docs-abi) for more details how they are used.
|
||||||
*
|
*
|
||||||
* @_section api/abi:Application Binary Interface [about-abi]
|
* @_section api/abi:Application Binary Interface [about-abi]
|
||||||
* @_navTitle: ABI
|
* @_navTitle: ABI
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAGH,MAAM;AACN,+CAA0C;AAAjC,wGAAA,QAAQ,OAAA;AAEjB,2CAAwE;AAA/D,iHAAA,mBAAmB,OAAA;AAAE,iHAAA,mBAAmB,OAAA;AAEjD,+CAGwB;AAFpB,mHAAA,mBAAmB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AACnE,wGAAA,QAAQ,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,yGAAA,SAAS,OAAA;AAAE,8GAAA,cAAc,OAAA;AAGxE,+CAMwB;AALpB,iHAAA,iBAAiB,OAAA;AACjB,uGAAA,OAAO,OAAA;AACP,yGAAA,SAAS,OAAA;AACT,gHAAA,gBAAgB,OAAA;AAAE,8GAAA,cAAc,OAAA;AAAE,sHAAA,sBAAsB,OAAA;AACxD,sGAAA,MAAM,OAAA;AAGV,uCAAmC;AAA1B,iGAAA,KAAK,OAAA"}
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/abi/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAGH,MAAM;AACN,+CAA0C;AAAjC,wGAAA,QAAQ,OAAA;AAEjB,2CAAwE;AAA/D,iHAAA,mBAAmB,OAAA;AAAE,iHAAA,mBAAmB,OAAA;AAEjD,+CAGwB;AAFpB,mHAAA,mBAAmB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AACnE,wGAAA,QAAQ,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,yGAAA,SAAS,OAAA;AAAE,8GAAA,cAAc,OAAA;AAGxE,+CAMwB;AALpB,iHAAA,iBAAiB,OAAA;AACjB,uGAAA,OAAO,OAAA;AACP,yGAAA,SAAS,OAAA;AACT,gHAAA,gBAAgB,OAAA;AAAE,8GAAA,cAAc,OAAA;AAAE,sHAAA,sBAAsB,OAAA;AACxD,sGAAA,MAAM,OAAA;AAGV,uCAAmC;AAA1B,iGAAA,KAAK,OAAA"}
|
116
lib.commonjs/abi/interface.d.ts
vendored
116
lib.commonjs/abi/interface.d.ts
vendored
@ -1,5 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* About Interface
|
* The Interface class is a low-level class that accepts an
|
||||||
|
* ABI and provides all the necessary functionality to encode
|
||||||
|
* and decode paramaters to and results from methods, events
|
||||||
|
* and errors.
|
||||||
|
*
|
||||||
|
* It also provides several convenience methods to automatically
|
||||||
|
* search and find matching transactions and events to parse them.
|
||||||
*
|
*
|
||||||
* @_subsection api/abi:Interfaces [interfaces]
|
* @_subsection api/abi:Interfaces [interfaces]
|
||||||
*/
|
*/
|
||||||
@ -10,39 +16,145 @@ import { Typed } from "./typed.js";
|
|||||||
import type { BigNumberish, BytesLike, CallExceptionError, CallExceptionTransaction } from "../utils/index.js";
|
import type { BigNumberish, BytesLike, CallExceptionError, CallExceptionTransaction } from "../utils/index.js";
|
||||||
import type { JsonFragment } from "./fragments.js";
|
import type { JsonFragment } from "./fragments.js";
|
||||||
export { checkResultErrors, Result };
|
export { checkResultErrors, Result };
|
||||||
|
/**
|
||||||
|
* When using the [[Interface-parseLog]] to automatically match a Log to its event
|
||||||
|
* for parsing, a **LogDescription** is returned.
|
||||||
|
*/
|
||||||
export declare class LogDescription {
|
export declare class LogDescription {
|
||||||
|
/**
|
||||||
|
* The matching fragment for the ``topic0``.
|
||||||
|
*/
|
||||||
readonly fragment: EventFragment;
|
readonly fragment: EventFragment;
|
||||||
|
/**
|
||||||
|
* The name of the Event.
|
||||||
|
*/
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
|
/**
|
||||||
|
* The full Event signature.
|
||||||
|
*/
|
||||||
readonly signature: string;
|
readonly signature: string;
|
||||||
|
/**
|
||||||
|
* The topic hash for the Event.
|
||||||
|
*/
|
||||||
readonly topic: string;
|
readonly topic: string;
|
||||||
|
/**
|
||||||
|
* The arguments passed into the Event with ``emit``.
|
||||||
|
*/
|
||||||
readonly args: Result;
|
readonly args: Result;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(fragment: EventFragment, topic: string, args: Result);
|
constructor(fragment: EventFragment, topic: string, args: Result);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* When using the [[Interface-parseTransaction]] to automatically match
|
||||||
|
* a transaction data to its function for parsing,
|
||||||
|
* a **TransactionDescription** is returned.
|
||||||
|
*/
|
||||||
export declare class TransactionDescription {
|
export declare class TransactionDescription {
|
||||||
|
/**
|
||||||
|
* The matching fragment from the transaction ``data``.
|
||||||
|
*/
|
||||||
readonly fragment: FunctionFragment;
|
readonly fragment: FunctionFragment;
|
||||||
|
/**
|
||||||
|
* The name of the Function from the transaction ``data``.
|
||||||
|
*/
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
|
/**
|
||||||
|
* The arguments passed to the Function from the transaction ``data``.
|
||||||
|
*/
|
||||||
readonly args: Result;
|
readonly args: Result;
|
||||||
|
/**
|
||||||
|
* The full Function signature from the transaction ``data``.
|
||||||
|
*/
|
||||||
readonly signature: string;
|
readonly signature: string;
|
||||||
|
/**
|
||||||
|
* The selector for the Function from the transaction ``data``.
|
||||||
|
*/
|
||||||
readonly selector: string;
|
readonly selector: string;
|
||||||
|
/**
|
||||||
|
* The ``value`` (in wei) from the transaction.
|
||||||
|
*/
|
||||||
readonly value: bigint;
|
readonly value: bigint;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(fragment: FunctionFragment, selector: string, args: Result, value: bigint);
|
constructor(fragment: FunctionFragment, selector: string, args: Result, value: bigint);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* When using the [[Interface-parseError]] to automatically match an
|
||||||
|
* error for a call result for parsing, an **ErrorDescription** is returned.
|
||||||
|
*/
|
||||||
export declare class ErrorDescription {
|
export declare class ErrorDescription {
|
||||||
|
/**
|
||||||
|
* The matching fragment.
|
||||||
|
*/
|
||||||
readonly fragment: ErrorFragment;
|
readonly fragment: ErrorFragment;
|
||||||
|
/**
|
||||||
|
* The name of the Error.
|
||||||
|
*/
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
|
/**
|
||||||
|
* The arguments passed to the Error with ``revert``.
|
||||||
|
*/
|
||||||
readonly args: Result;
|
readonly args: Result;
|
||||||
|
/**
|
||||||
|
* The full Error signature.
|
||||||
|
*/
|
||||||
readonly signature: string;
|
readonly signature: string;
|
||||||
|
/**
|
||||||
|
* The selector for the Error.
|
||||||
|
*/
|
||||||
readonly selector: string;
|
readonly selector: string;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(fragment: ErrorFragment, selector: string, args: Result);
|
constructor(fragment: ErrorFragment, selector: string, args: Result);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* An **Indexed** is used as a value when a value that does not
|
||||||
|
* fit within a topic (i.e. not a fixed-length, 32-byte type). It
|
||||||
|
* is the ``keccak256`` of the value, and used for types such as
|
||||||
|
* arrays, tuples, bytes and strings.
|
||||||
|
*/
|
||||||
export declare class Indexed {
|
export declare class Indexed {
|
||||||
|
/**
|
||||||
|
* The ``keccak256`` of the value logged.
|
||||||
|
*/
|
||||||
readonly hash: null | string;
|
readonly hash: null | string;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
readonly _isIndexed: boolean;
|
readonly _isIndexed: boolean;
|
||||||
|
/**
|
||||||
|
* Returns ``true`` if %%value%% is an **Indexed**.
|
||||||
|
*
|
||||||
|
* This provides a Type Guard for property access.
|
||||||
|
*/
|
||||||
static isIndexed(value: any): value is Indexed;
|
static isIndexed(value: any): value is Indexed;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(hash: null | string);
|
constructor(hash: null | string);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @TODO
|
* An **InterfaceAbi** may be any supported ABI format.
|
||||||
|
*
|
||||||
|
* A string is expected to be a JSON string, which will be parsed
|
||||||
|
* using ``JSON.parse``. This means that the value **must** be a valid
|
||||||
|
* JSON string, with no stray commas, etc.
|
||||||
|
*
|
||||||
|
* An array may contain any combination of:
|
||||||
|
* - Human-Readable fragments
|
||||||
|
* - Parsed JSON fragment
|
||||||
|
* - [[Fragment]] instances
|
||||||
|
*
|
||||||
|
* A **Human-Readable Fragment** is a string which resembles a Solidity
|
||||||
|
* signature and is introduced in [this blog entry](link-ricmoo-humanreadableabi).
|
||||||
|
* For example, ``function balanceOf(address) view returns (uint)``.
|
||||||
|
*
|
||||||
|
* A **Parsed JSON Fragment** is a JavaScript Object desribed in the
|
||||||
|
* [Solidity documentation](link-solc-jsonabi).
|
||||||
*/
|
*/
|
||||||
export type InterfaceAbi = string | ReadonlyArray<Fragment | JsonFragment | string>;
|
export type InterfaceAbi = string | ReadonlyArray<Fragment | JsonFragment | string>;
|
||||||
/**
|
/**
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,12 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
/**
|
/**
|
||||||
* About Interface
|
* The Interface class is a low-level class that accepts an
|
||||||
|
* ABI and provides all the necessary functionality to encode
|
||||||
|
* and decode paramaters to and results from methods, events
|
||||||
|
* and errors.
|
||||||
|
*
|
||||||
|
* It also provides several convenience methods to automatically
|
||||||
|
* search and find matching transactions and events to parse them.
|
||||||
*
|
*
|
||||||
* @_subsection api/abi:Interfaces [interfaces]
|
* @_subsection api/abi:Interfaces [interfaces]
|
||||||
*/
|
*/
|
||||||
@ -15,12 +21,34 @@ Object.defineProperty(exports, "checkResultErrors", { enumerable: true, get: fun
|
|||||||
Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return abstract_coder_js_1.Result; } });
|
Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return abstract_coder_js_1.Result; } });
|
||||||
const fragments_js_1 = require("./fragments.js");
|
const fragments_js_1 = require("./fragments.js");
|
||||||
const typed_js_1 = require("./typed.js");
|
const typed_js_1 = require("./typed.js");
|
||||||
|
/**
|
||||||
|
* When using the [[Interface-parseLog]] to automatically match a Log to its event
|
||||||
|
* for parsing, a **LogDescription** is returned.
|
||||||
|
*/
|
||||||
class LogDescription {
|
class LogDescription {
|
||||||
|
/**
|
||||||
|
* The matching fragment for the ``topic0``.
|
||||||
|
*/
|
||||||
fragment;
|
fragment;
|
||||||
|
/**
|
||||||
|
* The name of the Event.
|
||||||
|
*/
|
||||||
name;
|
name;
|
||||||
|
/**
|
||||||
|
* The full Event signature.
|
||||||
|
*/
|
||||||
signature;
|
signature;
|
||||||
|
/**
|
||||||
|
* The topic hash for the Event.
|
||||||
|
*/
|
||||||
topic;
|
topic;
|
||||||
|
/**
|
||||||
|
* The arguments passed into the Event with ``emit``.
|
||||||
|
*/
|
||||||
args;
|
args;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(fragment, topic, args) {
|
constructor(fragment, topic, args) {
|
||||||
const name = fragment.name, signature = fragment.format();
|
const name = fragment.name, signature = fragment.format();
|
||||||
(0, index_js_3.defineProperties)(this, {
|
(0, index_js_3.defineProperties)(this, {
|
||||||
@ -29,13 +57,39 @@ class LogDescription {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.LogDescription = LogDescription;
|
exports.LogDescription = LogDescription;
|
||||||
|
/**
|
||||||
|
* When using the [[Interface-parseTransaction]] to automatically match
|
||||||
|
* a transaction data to its function for parsing,
|
||||||
|
* a **TransactionDescription** is returned.
|
||||||
|
*/
|
||||||
class TransactionDescription {
|
class TransactionDescription {
|
||||||
|
/**
|
||||||
|
* The matching fragment from the transaction ``data``.
|
||||||
|
*/
|
||||||
fragment;
|
fragment;
|
||||||
|
/**
|
||||||
|
* The name of the Function from the transaction ``data``.
|
||||||
|
*/
|
||||||
name;
|
name;
|
||||||
|
/**
|
||||||
|
* The arguments passed to the Function from the transaction ``data``.
|
||||||
|
*/
|
||||||
args;
|
args;
|
||||||
|
/**
|
||||||
|
* The full Function signature from the transaction ``data``.
|
||||||
|
*/
|
||||||
signature;
|
signature;
|
||||||
|
/**
|
||||||
|
* The selector for the Function from the transaction ``data``.
|
||||||
|
*/
|
||||||
selector;
|
selector;
|
||||||
|
/**
|
||||||
|
* The ``value`` (in wei) from the transaction.
|
||||||
|
*/
|
||||||
value;
|
value;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(fragment, selector, args, value) {
|
constructor(fragment, selector, args, value) {
|
||||||
const name = fragment.name, signature = fragment.format();
|
const name = fragment.name, signature = fragment.format();
|
||||||
(0, index_js_3.defineProperties)(this, {
|
(0, index_js_3.defineProperties)(this, {
|
||||||
@ -44,12 +98,34 @@ class TransactionDescription {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.TransactionDescription = TransactionDescription;
|
exports.TransactionDescription = TransactionDescription;
|
||||||
|
/**
|
||||||
|
* When using the [[Interface-parseError]] to automatically match an
|
||||||
|
* error for a call result for parsing, an **ErrorDescription** is returned.
|
||||||
|
*/
|
||||||
class ErrorDescription {
|
class ErrorDescription {
|
||||||
|
/**
|
||||||
|
* The matching fragment.
|
||||||
|
*/
|
||||||
fragment;
|
fragment;
|
||||||
|
/**
|
||||||
|
* The name of the Error.
|
||||||
|
*/
|
||||||
name;
|
name;
|
||||||
|
/**
|
||||||
|
* The arguments passed to the Error with ``revert``.
|
||||||
|
*/
|
||||||
args;
|
args;
|
||||||
|
/**
|
||||||
|
* The full Error signature.
|
||||||
|
*/
|
||||||
signature;
|
signature;
|
||||||
|
/**
|
||||||
|
* The selector for the Error.
|
||||||
|
*/
|
||||||
selector;
|
selector;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(fragment, selector, args) {
|
constructor(fragment, selector, args) {
|
||||||
const name = fragment.name, signature = fragment.format();
|
const name = fragment.name, signature = fragment.format();
|
||||||
(0, index_js_3.defineProperties)(this, {
|
(0, index_js_3.defineProperties)(this, {
|
||||||
@ -58,12 +134,32 @@ class ErrorDescription {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.ErrorDescription = ErrorDescription;
|
exports.ErrorDescription = ErrorDescription;
|
||||||
|
/**
|
||||||
|
* An **Indexed** is used as a value when a value that does not
|
||||||
|
* fit within a topic (i.e. not a fixed-length, 32-byte type). It
|
||||||
|
* is the ``keccak256`` of the value, and used for types such as
|
||||||
|
* arrays, tuples, bytes and strings.
|
||||||
|
*/
|
||||||
class Indexed {
|
class Indexed {
|
||||||
|
/**
|
||||||
|
* The ``keccak256`` of the value logged.
|
||||||
|
*/
|
||||||
hash;
|
hash;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
_isIndexed;
|
_isIndexed;
|
||||||
|
/**
|
||||||
|
* Returns ``true`` if %%value%% is an **Indexed**.
|
||||||
|
*
|
||||||
|
* This provides a Type Guard for property access.
|
||||||
|
*/
|
||||||
static isIndexed(value) {
|
static isIndexed(value) {
|
||||||
return !!(value && value._isIndexed);
|
return !!(value && value._isIndexed);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(hash) {
|
constructor(hash) {
|
||||||
(0, index_js_3.defineProperties)(this, { hash, _isIndexed: true });
|
(0, index_js_3.defineProperties)(this, { hash, _isIndexed: true });
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
398
lib.commonjs/abi/typed.d.ts
vendored
398
lib.commonjs/abi/typed.d.ts
vendored
@ -15,146 +15,544 @@
|
|||||||
import type { Addressable } from "../address/index.js";
|
import type { Addressable } from "../address/index.js";
|
||||||
import type { BigNumberish, BytesLike } from "../utils/index.js";
|
import type { BigNumberish, BytesLike } from "../utils/index.js";
|
||||||
import type { Result } from "./coders/abstract-coder.js";
|
import type { Result } from "./coders/abstract-coder.js";
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
export interface TypedNumber extends Typed {
|
export interface TypedNumber extends Typed {
|
||||||
value: number;
|
value: number;
|
||||||
defaultValue(): number;
|
defaultValue(): number;
|
||||||
minValue(): number;
|
minValue(): number;
|
||||||
maxValue(): number;
|
maxValue(): number;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A **Typed** that represents a numeric value.
|
||||||
|
*/
|
||||||
export interface TypedBigInt extends Typed {
|
export interface TypedBigInt extends Typed {
|
||||||
|
/**
|
||||||
|
* The value.
|
||||||
|
*/
|
||||||
value: bigint;
|
value: bigint;
|
||||||
|
/**
|
||||||
|
* The default value for all numeric types is ``0``.
|
||||||
|
*/
|
||||||
defaultValue(): bigint;
|
defaultValue(): bigint;
|
||||||
|
/**
|
||||||
|
* The minimum value for this type, accounting for bit-width and signed-ness.
|
||||||
|
*/
|
||||||
minValue(): bigint;
|
minValue(): bigint;
|
||||||
|
/**
|
||||||
|
* The minimum value for this type, accounting for bit-width.
|
||||||
|
*/
|
||||||
maxValue(): bigint;
|
maxValue(): bigint;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A **Typed** that represents a binary sequence of data as bytes.
|
||||||
|
*/
|
||||||
export interface TypedData extends Typed {
|
export interface TypedData extends Typed {
|
||||||
|
/**
|
||||||
|
* The value.
|
||||||
|
*/
|
||||||
value: string;
|
value: string;
|
||||||
|
/**
|
||||||
|
* The default value for this type.
|
||||||
|
*/
|
||||||
defaultValue(): string;
|
defaultValue(): string;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A **Typed** that represents a UTF-8 sequence of bytes.
|
||||||
|
*/
|
||||||
export interface TypedString extends Typed {
|
export interface TypedString extends Typed {
|
||||||
|
/**
|
||||||
|
* The value.
|
||||||
|
*/
|
||||||
value: string;
|
value: string;
|
||||||
|
/**
|
||||||
|
* The default value for the string type is the empty string (i.e. ``""``).
|
||||||
|
*/
|
||||||
defaultValue(): string;
|
defaultValue(): string;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The **Typed** class to wrap values providing explicit type information.
|
||||||
|
*/
|
||||||
export declare class Typed {
|
export declare class Typed {
|
||||||
#private;
|
#private;
|
||||||
|
/**
|
||||||
|
* The type, as a Solidity-compatible type.
|
||||||
|
*/
|
||||||
readonly type: string;
|
readonly type: string;
|
||||||
|
/**
|
||||||
|
* The actual value.
|
||||||
|
*/
|
||||||
readonly value: any;
|
readonly value: any;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
readonly _typedSymbol: Symbol;
|
readonly _typedSymbol: Symbol;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(gaurd: any, type: string, value: any, options?: any);
|
constructor(gaurd: any, type: string, value: any, options?: any);
|
||||||
|
/**
|
||||||
|
* Format the type as a Human-Readable type.
|
||||||
|
*/
|
||||||
format(): string;
|
format(): string;
|
||||||
|
/**
|
||||||
|
* The default value returned by this type.
|
||||||
|
*/
|
||||||
defaultValue(): string | number | bigint | Result;
|
defaultValue(): string | number | bigint | Result;
|
||||||
|
/**
|
||||||
|
* The minimum value for numeric types.
|
||||||
|
*/
|
||||||
minValue(): string | number | bigint;
|
minValue(): string | number | bigint;
|
||||||
|
/**
|
||||||
|
* The maximum value for numeric types.
|
||||||
|
*/
|
||||||
maxValue(): string | number | bigint;
|
maxValue(): string | number | bigint;
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard is this is a [[TypedBigInt]].
|
||||||
|
*/
|
||||||
isBigInt(): this is TypedBigInt;
|
isBigInt(): this is TypedBigInt;
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard is this is a [[TypedData]].
|
||||||
|
*/
|
||||||
isData(): this is TypedData;
|
isData(): this is TypedData;
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard is this is a [[TypedString]].
|
||||||
|
*/
|
||||||
isString(): this is TypedString;
|
isString(): this is TypedString;
|
||||||
|
/**
|
||||||
|
* Returns the tuple name, if this is a tuple. Throws otherwise.
|
||||||
|
*/
|
||||||
get tupleName(): null | string;
|
get tupleName(): null | string;
|
||||||
|
/**
|
||||||
|
* Returns the length of the array type or ``-1`` if it is dynamic.
|
||||||
|
*
|
||||||
|
* Throws if the type is not an array.
|
||||||
|
*/
|
||||||
get arrayLength(): null | number;
|
get arrayLength(): null | number;
|
||||||
|
/**
|
||||||
|
* Returns a new **Typed** of %%type%% with the %%value%%.
|
||||||
|
*/
|
||||||
static from(type: string, value: any): Typed;
|
static from(type: string, value: any): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint8`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint8(v: BigNumberish): Typed;
|
static uint8(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint16`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint16(v: BigNumberish): Typed;
|
static uint16(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint24`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint24(v: BigNumberish): Typed;
|
static uint24(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint32`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint32(v: BigNumberish): Typed;
|
static uint32(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint40`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint40(v: BigNumberish): Typed;
|
static uint40(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint48`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint48(v: BigNumberish): Typed;
|
static uint48(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint56`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint56(v: BigNumberish): Typed;
|
static uint56(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint64`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint64(v: BigNumberish): Typed;
|
static uint64(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint72`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint72(v: BigNumberish): Typed;
|
static uint72(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint80`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint80(v: BigNumberish): Typed;
|
static uint80(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint88`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint88(v: BigNumberish): Typed;
|
static uint88(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint96`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint96(v: BigNumberish): Typed;
|
static uint96(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint104`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint104(v: BigNumberish): Typed;
|
static uint104(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint112`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint112(v: BigNumberish): Typed;
|
static uint112(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint120`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint120(v: BigNumberish): Typed;
|
static uint120(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint128`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint128(v: BigNumberish): Typed;
|
static uint128(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint136`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint136(v: BigNumberish): Typed;
|
static uint136(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint144`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint144(v: BigNumberish): Typed;
|
static uint144(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint152`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint152(v: BigNumberish): Typed;
|
static uint152(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint160`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint160(v: BigNumberish): Typed;
|
static uint160(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint168`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint168(v: BigNumberish): Typed;
|
static uint168(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint176`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint176(v: BigNumberish): Typed;
|
static uint176(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint184`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint184(v: BigNumberish): Typed;
|
static uint184(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint192`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint192(v: BigNumberish): Typed;
|
static uint192(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint200`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint200(v: BigNumberish): Typed;
|
static uint200(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint208`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint208(v: BigNumberish): Typed;
|
static uint208(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint216`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint216(v: BigNumberish): Typed;
|
static uint216(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint224`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint224(v: BigNumberish): Typed;
|
static uint224(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint232`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint232(v: BigNumberish): Typed;
|
static uint232(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint240`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint240(v: BigNumberish): Typed;
|
static uint240(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint248`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint248(v: BigNumberish): Typed;
|
static uint248(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint256`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint256(v: BigNumberish): Typed;
|
static uint256(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint256`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint(v: BigNumberish): Typed;
|
static uint(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int8`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int8(v: BigNumberish): Typed;
|
static int8(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int16`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int16(v: BigNumberish): Typed;
|
static int16(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int24`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int24(v: BigNumberish): Typed;
|
static int24(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int32`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int32(v: BigNumberish): Typed;
|
static int32(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int40`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int40(v: BigNumberish): Typed;
|
static int40(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int48`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int48(v: BigNumberish): Typed;
|
static int48(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int56`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int56(v: BigNumberish): Typed;
|
static int56(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int64`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int64(v: BigNumberish): Typed;
|
static int64(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int72`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int72(v: BigNumberish): Typed;
|
static int72(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int80`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int80(v: BigNumberish): Typed;
|
static int80(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int88`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int88(v: BigNumberish): Typed;
|
static int88(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int96`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int96(v: BigNumberish): Typed;
|
static int96(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int104`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int104(v: BigNumberish): Typed;
|
static int104(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int112`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int112(v: BigNumberish): Typed;
|
static int112(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int120`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int120(v: BigNumberish): Typed;
|
static int120(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int128`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int128(v: BigNumberish): Typed;
|
static int128(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int136`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int136(v: BigNumberish): Typed;
|
static int136(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int144`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int144(v: BigNumberish): Typed;
|
static int144(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int52`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int152(v: BigNumberish): Typed;
|
static int152(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int160`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int160(v: BigNumberish): Typed;
|
static int160(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int168`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int168(v: BigNumberish): Typed;
|
static int168(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int176`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int176(v: BigNumberish): Typed;
|
static int176(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int184`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int184(v: BigNumberish): Typed;
|
static int184(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int92`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int192(v: BigNumberish): Typed;
|
static int192(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int200`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int200(v: BigNumberish): Typed;
|
static int200(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int208`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int208(v: BigNumberish): Typed;
|
static int208(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int216`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int216(v: BigNumberish): Typed;
|
static int216(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int224`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int224(v: BigNumberish): Typed;
|
static int224(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int232`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int232(v: BigNumberish): Typed;
|
static int232(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int240`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int240(v: BigNumberish): Typed;
|
static int240(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int248`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int248(v: BigNumberish): Typed;
|
static int248(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int256`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int256(v: BigNumberish): Typed;
|
static int256(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``int256`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int(v: BigNumberish): Typed;
|
static int(v: BigNumberish): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes1`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes1(v: BytesLike): Typed;
|
static bytes1(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes2`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes2(v: BytesLike): Typed;
|
static bytes2(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes3`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes3(v: BytesLike): Typed;
|
static bytes3(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes4`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes4(v: BytesLike): Typed;
|
static bytes4(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes5`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes5(v: BytesLike): Typed;
|
static bytes5(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes6`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes6(v: BytesLike): Typed;
|
static bytes6(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes7`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes7(v: BytesLike): Typed;
|
static bytes7(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes8`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes8(v: BytesLike): Typed;
|
static bytes8(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes9`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes9(v: BytesLike): Typed;
|
static bytes9(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes10`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes10(v: BytesLike): Typed;
|
static bytes10(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes11`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes11(v: BytesLike): Typed;
|
static bytes11(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes12`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes12(v: BytesLike): Typed;
|
static bytes12(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes13`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes13(v: BytesLike): Typed;
|
static bytes13(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes14`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes14(v: BytesLike): Typed;
|
static bytes14(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes15`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes15(v: BytesLike): Typed;
|
static bytes15(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes16`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes16(v: BytesLike): Typed;
|
static bytes16(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes17`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes17(v: BytesLike): Typed;
|
static bytes17(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes18`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes18(v: BytesLike): Typed;
|
static bytes18(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes19`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes19(v: BytesLike): Typed;
|
static bytes19(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes20`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes20(v: BytesLike): Typed;
|
static bytes20(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes21`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes21(v: BytesLike): Typed;
|
static bytes21(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes22`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes22(v: BytesLike): Typed;
|
static bytes22(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes23`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes23(v: BytesLike): Typed;
|
static bytes23(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes24`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes24(v: BytesLike): Typed;
|
static bytes24(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes25`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes25(v: BytesLike): Typed;
|
static bytes25(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes26`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes26(v: BytesLike): Typed;
|
static bytes26(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes27`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes27(v: BytesLike): Typed;
|
static bytes27(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes28`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes28(v: BytesLike): Typed;
|
static bytes28(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes29`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes29(v: BytesLike): Typed;
|
static bytes29(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes30`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes30(v: BytesLike): Typed;
|
static bytes30(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes31`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes31(v: BytesLike): Typed;
|
static bytes31(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes32`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes32(v: BytesLike): Typed;
|
static bytes32(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``address`` type for %%v%%.
|
||||||
|
*/
|
||||||
static address(v: string | Addressable): Typed;
|
static address(v: string | Addressable): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bool`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bool(v: any): Typed;
|
static bool(v: any): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes(v: BytesLike): Typed;
|
static bytes(v: BytesLike): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``string`` type for %%v%%.
|
||||||
|
*/
|
||||||
static string(v: string): Typed;
|
static string(v: string): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``array`` type for %%v%%, allowing %%dynamic%% length.
|
||||||
|
*/
|
||||||
static array(v: Array<any | Typed>, dynamic?: null | boolean): Typed;
|
static array(v: Array<any | Typed>, dynamic?: null | boolean): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``tuple`` type for %%v%%, with the optional %%name%%.
|
||||||
|
*/
|
||||||
static tuple(v: Array<any | Typed> | Record<string, any | Typed>, name?: string): Typed;
|
static tuple(v: Array<any | Typed> | Record<string, any | Typed>, name?: string): Typed;
|
||||||
|
/**
|
||||||
|
* Return a new ``uint8`` type for %%v%%.
|
||||||
|
*/
|
||||||
static overrides(v: Record<string, any>): Typed;
|
static overrides(v: Record<string, any>): Typed;
|
||||||
/**
|
/**
|
||||||
* Returns true only if %%value%% is a [[Typed]] instance.
|
* Returns true only if %%value%% is a [[Typed]] instance.
|
||||||
|
File diff suppressed because one or more lines are too long
@ -31,11 +31,26 @@ function b(value, size) {
|
|||||||
return new Typed(_gaurd, `bytes${(size) ? size : ""}`, value, { size });
|
return new Typed(_gaurd, `bytes${(size) ? size : ""}`, value, { size });
|
||||||
}
|
}
|
||||||
const _typedSymbol = Symbol.for("_ethers_typed");
|
const _typedSymbol = Symbol.for("_ethers_typed");
|
||||||
|
/**
|
||||||
|
* The **Typed** class to wrap values providing explicit type information.
|
||||||
|
*/
|
||||||
class Typed {
|
class Typed {
|
||||||
|
/**
|
||||||
|
* The type, as a Solidity-compatible type.
|
||||||
|
*/
|
||||||
type;
|
type;
|
||||||
|
/**
|
||||||
|
* The actual value.
|
||||||
|
*/
|
||||||
value;
|
value;
|
||||||
#options;
|
#options;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
_typedSymbol;
|
_typedSymbol;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(gaurd, type, value, options) {
|
constructor(gaurd, type, value, options) {
|
||||||
if (options == null) {
|
if (options == null) {
|
||||||
options = null;
|
options = null;
|
||||||
@ -46,6 +61,9 @@ class Typed {
|
|||||||
// Check the value is valid
|
// Check the value is valid
|
||||||
this.format();
|
this.format();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Format the type as a Human-Readable type.
|
||||||
|
*/
|
||||||
format() {
|
format() {
|
||||||
if (this.type === "array") {
|
if (this.type === "array") {
|
||||||
throw new Error("");
|
throw new Error("");
|
||||||
@ -58,24 +76,45 @@ class Typed {
|
|||||||
}
|
}
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The default value returned by this type.
|
||||||
|
*/
|
||||||
defaultValue() {
|
defaultValue() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The minimum value for numeric types.
|
||||||
|
*/
|
||||||
minValue() {
|
minValue() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The maximum value for numeric types.
|
||||||
|
*/
|
||||||
maxValue() {
|
maxValue() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard is this is a [[TypedBigInt]].
|
||||||
|
*/
|
||||||
isBigInt() {
|
isBigInt() {
|
||||||
return !!(this.type.match(/^u?int[0-9]+$/));
|
return !!(this.type.match(/^u?int[0-9]+$/));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard is this is a [[TypedData]].
|
||||||
|
*/
|
||||||
isData() {
|
isData() {
|
||||||
return this.type.startsWith("bytes");
|
return this.type.startsWith("bytes");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns ``true`` and provides a type guard is this is a [[TypedString]].
|
||||||
|
*/
|
||||||
isString() {
|
isString() {
|
||||||
return (this.type === "string");
|
return (this.type === "string");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns the tuple name, if this is a tuple. Throws otherwise.
|
||||||
|
*/
|
||||||
get tupleName() {
|
get tupleName() {
|
||||||
if (this.type !== "tuple") {
|
if (this.type !== "tuple") {
|
||||||
throw TypeError("not a tuple");
|
throw TypeError("not a tuple");
|
||||||
@ -86,6 +125,11 @@ class Typed {
|
|||||||
// - `null` indicates the length is unforced, it could be dynamic
|
// - `null` indicates the length is unforced, it could be dynamic
|
||||||
// - `-1` indicates the length is dynamic
|
// - `-1` indicates the length is dynamic
|
||||||
// - any other value indicates it is a static array and is its length
|
// - any other value indicates it is a static array and is its length
|
||||||
|
/**
|
||||||
|
* Returns the length of the array type or ``-1`` if it is dynamic.
|
||||||
|
*
|
||||||
|
* Throws if the type is not an array.
|
||||||
|
*/
|
||||||
get arrayLength() {
|
get arrayLength() {
|
||||||
if (this.type !== "array") {
|
if (this.type !== "array") {
|
||||||
throw TypeError("not an array");
|
throw TypeError("not an array");
|
||||||
@ -98,119 +142,437 @@ class Typed {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a new **Typed** of %%type%% with the %%value%%.
|
||||||
|
*/
|
||||||
static from(type, value) {
|
static from(type, value) {
|
||||||
return new Typed(_gaurd, type, value);
|
return new Typed(_gaurd, type, value);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return a new ``uint8`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint8(v) { return n(v, 8); }
|
static uint8(v) { return n(v, 8); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint16`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint16(v) { return n(v, 16); }
|
static uint16(v) { return n(v, 16); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint24`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint24(v) { return n(v, 24); }
|
static uint24(v) { return n(v, 24); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint32`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint32(v) { return n(v, 32); }
|
static uint32(v) { return n(v, 32); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint40`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint40(v) { return n(v, 40); }
|
static uint40(v) { return n(v, 40); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint48`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint48(v) { return n(v, 48); }
|
static uint48(v) { return n(v, 48); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint56`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint56(v) { return n(v, 56); }
|
static uint56(v) { return n(v, 56); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint64`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint64(v) { return n(v, 64); }
|
static uint64(v) { return n(v, 64); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint72`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint72(v) { return n(v, 72); }
|
static uint72(v) { return n(v, 72); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint80`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint80(v) { return n(v, 80); }
|
static uint80(v) { return n(v, 80); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint88`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint88(v) { return n(v, 88); }
|
static uint88(v) { return n(v, 88); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint96`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint96(v) { return n(v, 96); }
|
static uint96(v) { return n(v, 96); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint104`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint104(v) { return n(v, 104); }
|
static uint104(v) { return n(v, 104); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint112`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint112(v) { return n(v, 112); }
|
static uint112(v) { return n(v, 112); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint120`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint120(v) { return n(v, 120); }
|
static uint120(v) { return n(v, 120); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint128`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint128(v) { return n(v, 128); }
|
static uint128(v) { return n(v, 128); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint136`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint136(v) { return n(v, 136); }
|
static uint136(v) { return n(v, 136); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint144`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint144(v) { return n(v, 144); }
|
static uint144(v) { return n(v, 144); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint152`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint152(v) { return n(v, 152); }
|
static uint152(v) { return n(v, 152); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint160`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint160(v) { return n(v, 160); }
|
static uint160(v) { return n(v, 160); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint168`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint168(v) { return n(v, 168); }
|
static uint168(v) { return n(v, 168); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint176`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint176(v) { return n(v, 176); }
|
static uint176(v) { return n(v, 176); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint184`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint184(v) { return n(v, 184); }
|
static uint184(v) { return n(v, 184); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint192`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint192(v) { return n(v, 192); }
|
static uint192(v) { return n(v, 192); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint200`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint200(v) { return n(v, 200); }
|
static uint200(v) { return n(v, 200); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint208`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint208(v) { return n(v, 208); }
|
static uint208(v) { return n(v, 208); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint216`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint216(v) { return n(v, 216); }
|
static uint216(v) { return n(v, 216); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint224`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint224(v) { return n(v, 224); }
|
static uint224(v) { return n(v, 224); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint232`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint232(v) { return n(v, 232); }
|
static uint232(v) { return n(v, 232); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint240`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint240(v) { return n(v, 240); }
|
static uint240(v) { return n(v, 240); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint248`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint248(v) { return n(v, 248); }
|
static uint248(v) { return n(v, 248); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint256`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint256(v) { return n(v, 256); }
|
static uint256(v) { return n(v, 256); }
|
||||||
|
/**
|
||||||
|
* Return a new ``uint256`` type for %%v%%.
|
||||||
|
*/
|
||||||
static uint(v) { return n(v, 256); }
|
static uint(v) { return n(v, 256); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int8`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int8(v) { return n(v, -8); }
|
static int8(v) { return n(v, -8); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int16`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int16(v) { return n(v, -16); }
|
static int16(v) { return n(v, -16); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int24`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int24(v) { return n(v, -24); }
|
static int24(v) { return n(v, -24); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int32`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int32(v) { return n(v, -32); }
|
static int32(v) { return n(v, -32); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int40`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int40(v) { return n(v, -40); }
|
static int40(v) { return n(v, -40); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int48`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int48(v) { return n(v, -48); }
|
static int48(v) { return n(v, -48); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int56`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int56(v) { return n(v, -56); }
|
static int56(v) { return n(v, -56); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int64`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int64(v) { return n(v, -64); }
|
static int64(v) { return n(v, -64); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int72`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int72(v) { return n(v, -72); }
|
static int72(v) { return n(v, -72); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int80`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int80(v) { return n(v, -80); }
|
static int80(v) { return n(v, -80); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int88`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int88(v) { return n(v, -88); }
|
static int88(v) { return n(v, -88); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int96`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int96(v) { return n(v, -96); }
|
static int96(v) { return n(v, -96); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int104`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int104(v) { return n(v, -104); }
|
static int104(v) { return n(v, -104); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int112`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int112(v) { return n(v, -112); }
|
static int112(v) { return n(v, -112); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int120`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int120(v) { return n(v, -120); }
|
static int120(v) { return n(v, -120); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int128`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int128(v) { return n(v, -128); }
|
static int128(v) { return n(v, -128); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int136`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int136(v) { return n(v, -136); }
|
static int136(v) { return n(v, -136); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int144`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int144(v) { return n(v, -144); }
|
static int144(v) { return n(v, -144); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int52`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int152(v) { return n(v, -152); }
|
static int152(v) { return n(v, -152); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int160`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int160(v) { return n(v, -160); }
|
static int160(v) { return n(v, -160); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int168`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int168(v) { return n(v, -168); }
|
static int168(v) { return n(v, -168); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int176`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int176(v) { return n(v, -176); }
|
static int176(v) { return n(v, -176); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int184`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int184(v) { return n(v, -184); }
|
static int184(v) { return n(v, -184); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int92`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int192(v) { return n(v, -192); }
|
static int192(v) { return n(v, -192); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int200`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int200(v) { return n(v, -200); }
|
static int200(v) { return n(v, -200); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int208`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int208(v) { return n(v, -208); }
|
static int208(v) { return n(v, -208); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int216`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int216(v) { return n(v, -216); }
|
static int216(v) { return n(v, -216); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int224`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int224(v) { return n(v, -224); }
|
static int224(v) { return n(v, -224); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int232`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int232(v) { return n(v, -232); }
|
static int232(v) { return n(v, -232); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int240`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int240(v) { return n(v, -240); }
|
static int240(v) { return n(v, -240); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int248`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int248(v) { return n(v, -248); }
|
static int248(v) { return n(v, -248); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int256`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int256(v) { return n(v, -256); }
|
static int256(v) { return n(v, -256); }
|
||||||
|
/**
|
||||||
|
* Return a new ``int256`` type for %%v%%.
|
||||||
|
*/
|
||||||
static int(v) { return n(v, -256); }
|
static int(v) { return n(v, -256); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes1`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes1(v) { return b(v, 1); }
|
static bytes1(v) { return b(v, 1); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes2`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes2(v) { return b(v, 2); }
|
static bytes2(v) { return b(v, 2); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes3`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes3(v) { return b(v, 3); }
|
static bytes3(v) { return b(v, 3); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes4`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes4(v) { return b(v, 4); }
|
static bytes4(v) { return b(v, 4); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes5`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes5(v) { return b(v, 5); }
|
static bytes5(v) { return b(v, 5); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes6`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes6(v) { return b(v, 6); }
|
static bytes6(v) { return b(v, 6); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes7`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes7(v) { return b(v, 7); }
|
static bytes7(v) { return b(v, 7); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes8`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes8(v) { return b(v, 8); }
|
static bytes8(v) { return b(v, 8); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes9`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes9(v) { return b(v, 9); }
|
static bytes9(v) { return b(v, 9); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes10`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes10(v) { return b(v, 10); }
|
static bytes10(v) { return b(v, 10); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes11`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes11(v) { return b(v, 11); }
|
static bytes11(v) { return b(v, 11); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes12`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes12(v) { return b(v, 12); }
|
static bytes12(v) { return b(v, 12); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes13`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes13(v) { return b(v, 13); }
|
static bytes13(v) { return b(v, 13); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes14`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes14(v) { return b(v, 14); }
|
static bytes14(v) { return b(v, 14); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes15`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes15(v) { return b(v, 15); }
|
static bytes15(v) { return b(v, 15); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes16`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes16(v) { return b(v, 16); }
|
static bytes16(v) { return b(v, 16); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes17`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes17(v) { return b(v, 17); }
|
static bytes17(v) { return b(v, 17); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes18`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes18(v) { return b(v, 18); }
|
static bytes18(v) { return b(v, 18); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes19`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes19(v) { return b(v, 19); }
|
static bytes19(v) { return b(v, 19); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes20`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes20(v) { return b(v, 20); }
|
static bytes20(v) { return b(v, 20); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes21`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes21(v) { return b(v, 21); }
|
static bytes21(v) { return b(v, 21); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes22`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes22(v) { return b(v, 22); }
|
static bytes22(v) { return b(v, 22); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes23`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes23(v) { return b(v, 23); }
|
static bytes23(v) { return b(v, 23); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes24`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes24(v) { return b(v, 24); }
|
static bytes24(v) { return b(v, 24); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes25`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes25(v) { return b(v, 25); }
|
static bytes25(v) { return b(v, 25); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes26`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes26(v) { return b(v, 26); }
|
static bytes26(v) { return b(v, 26); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes27`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes27(v) { return b(v, 27); }
|
static bytes27(v) { return b(v, 27); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes28`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes28(v) { return b(v, 28); }
|
static bytes28(v) { return b(v, 28); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes29`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes29(v) { return b(v, 29); }
|
static bytes29(v) { return b(v, 29); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes30`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes30(v) { return b(v, 30); }
|
static bytes30(v) { return b(v, 30); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes31`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes31(v) { return b(v, 31); }
|
static bytes31(v) { return b(v, 31); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes32`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes32(v) { return b(v, 32); }
|
static bytes32(v) { return b(v, 32); }
|
||||||
|
/**
|
||||||
|
* Return a new ``address`` type for %%v%%.
|
||||||
|
*/
|
||||||
static address(v) { return new Typed(_gaurd, "address", v); }
|
static address(v) { return new Typed(_gaurd, "address", v); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bool`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bool(v) { return new Typed(_gaurd, "bool", !!v); }
|
static bool(v) { return new Typed(_gaurd, "bool", !!v); }
|
||||||
|
/**
|
||||||
|
* Return a new ``bytes`` type for %%v%%.
|
||||||
|
*/
|
||||||
static bytes(v) { return new Typed(_gaurd, "bytes", v); }
|
static bytes(v) { return new Typed(_gaurd, "bytes", v); }
|
||||||
|
/**
|
||||||
|
* Return a new ``string`` type for %%v%%.
|
||||||
|
*/
|
||||||
static string(v) { return new Typed(_gaurd, "string", v); }
|
static string(v) { return new Typed(_gaurd, "string", v); }
|
||||||
|
/**
|
||||||
|
* Return a new ``array`` type for %%v%%, allowing %%dynamic%% length.
|
||||||
|
*/
|
||||||
static array(v, dynamic) {
|
static array(v, dynamic) {
|
||||||
throw new Error("not implemented yet");
|
throw new Error("not implemented yet");
|
||||||
return new Typed(_gaurd, "array", v, dynamic);
|
return new Typed(_gaurd, "array", v, dynamic);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return a new ``tuple`` type for %%v%%, with the optional %%name%%.
|
||||||
|
*/
|
||||||
static tuple(v, name) {
|
static tuple(v, name) {
|
||||||
throw new Error("not implemented yet");
|
throw new Error("not implemented yet");
|
||||||
return new Typed(_gaurd, "tuple", v, name);
|
return new Typed(_gaurd, "tuple", v, name);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return a new ``uint8`` type for %%v%%.
|
||||||
|
*/
|
||||||
static overrides(v) {
|
static overrides(v) {
|
||||||
return new Typed(_gaurd, "overrides", Object.assign({}, v));
|
return new Typed(_gaurd, "overrides", Object.assign({}, v));
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
112
lib.commonjs/contract/contract.d.ts
vendored
112
lib.commonjs/contract/contract.d.ts
vendored
@ -16,35 +16,147 @@ export declare function copyOverrides<O extends string = "data" | "to">(arg: any
|
|||||||
export declare function resolveArgs(_runner: null | ContractRunner, inputs: ReadonlyArray<ParamType>, args: Array<any>): Promise<Array<any>>;
|
export declare function resolveArgs(_runner: null | ContractRunner, inputs: ReadonlyArray<ParamType>, args: Array<any>): Promise<Array<any>>;
|
||||||
declare const internal: unique symbol;
|
declare const internal: unique symbol;
|
||||||
export declare class BaseContract implements Addressable, EventEmitterable<ContractEventName> {
|
export declare class BaseContract implements Addressable, EventEmitterable<ContractEventName> {
|
||||||
|
/**
|
||||||
|
* The target to connect to.
|
||||||
|
*
|
||||||
|
* This can be an address, ENS name or any [[Addressable]], such as
|
||||||
|
* another contract. To get the resovled address, use the ``getAddress``
|
||||||
|
* method.
|
||||||
|
*/
|
||||||
readonly target: string | Addressable;
|
readonly target: string | Addressable;
|
||||||
|
/**
|
||||||
|
* The contract Interface.
|
||||||
|
*/
|
||||||
readonly interface: Interface;
|
readonly interface: Interface;
|
||||||
|
/**
|
||||||
|
* The connected runner. This is generally a [[Provider]] or a
|
||||||
|
* [[Signer]], which dictates what operations are supported.
|
||||||
|
*
|
||||||
|
* For example, a **Contract** connected to a [[Provider]] may
|
||||||
|
* only execute read-only operations.
|
||||||
|
*/
|
||||||
readonly runner: null | ContractRunner;
|
readonly runner: null | ContractRunner;
|
||||||
|
/**
|
||||||
|
* All the Events available on this contract.
|
||||||
|
*/
|
||||||
readonly filters: Record<string, ContractEvent>;
|
readonly filters: Record<string, ContractEvent>;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
readonly [internal]: any;
|
readonly [internal]: any;
|
||||||
|
/**
|
||||||
|
* The fallback or receive function if any.
|
||||||
|
*/
|
||||||
readonly fallback: null | WrappedFallback;
|
readonly fallback: null | WrappedFallback;
|
||||||
|
/**
|
||||||
|
* Creates a new contract connected to %%target%% with the %%abi%% and
|
||||||
|
* optionally connected to a %%runner%% to perform operations on behalf
|
||||||
|
* of.
|
||||||
|
*/
|
||||||
constructor(target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner, _deployTx?: null | TransactionResponse);
|
constructor(target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner, _deployTx?: null | TransactionResponse);
|
||||||
|
/**
|
||||||
|
* Return a new Contract instance with the same target and ABI, but
|
||||||
|
* a different %%runner%%.
|
||||||
|
*/
|
||||||
connect(runner: null | ContractRunner): BaseContract;
|
connect(runner: null | ContractRunner): BaseContract;
|
||||||
|
/**
|
||||||
|
* Return the resolved address of this Contract.
|
||||||
|
*/
|
||||||
getAddress(): Promise<string>;
|
getAddress(): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Return the dedployed bytecode or null if no bytecode is found.
|
||||||
|
*/
|
||||||
getDeployedCode(): Promise<null | string>;
|
getDeployedCode(): Promise<null | string>;
|
||||||
|
/**
|
||||||
|
* Resolve to this Contract once the bytecode has been deployed, or
|
||||||
|
* resolve immediately if already deployed.
|
||||||
|
*/
|
||||||
waitForDeployment(): Promise<this>;
|
waitForDeployment(): Promise<this>;
|
||||||
|
/**
|
||||||
|
* Return the transaction used to deploy this contract.
|
||||||
|
*
|
||||||
|
* This is only available if this instance was returned from a
|
||||||
|
* [[ContractFactory]].
|
||||||
|
*/
|
||||||
deploymentTransaction(): null | ContractTransactionResponse;
|
deploymentTransaction(): null | ContractTransactionResponse;
|
||||||
|
/**
|
||||||
|
* Return the function for a given name. This is useful when a contract
|
||||||
|
* method name conflicts with a JavaScript name such as ``prototype`` or
|
||||||
|
* when using a Contract programatically.
|
||||||
|
*/
|
||||||
getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
|
getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
|
||||||
|
/**
|
||||||
|
* Return the event for a given name. This is useful when a contract
|
||||||
|
* event name conflicts with a JavaScript name such as ``prototype`` or
|
||||||
|
* when using a Contract programatically.
|
||||||
|
*/
|
||||||
getEvent(key: string | EventFragment): ContractEvent;
|
getEvent(key: string | EventFragment): ContractEvent;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
queryTransaction(hash: string): Promise<Array<EventLog>>;
|
queryTransaction(hash: string): Promise<Array<EventLog>>;
|
||||||
|
/**
|
||||||
|
* Provide historic access to event data for %%event%% in the range
|
||||||
|
* %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``"latest"``)
|
||||||
|
* inclusive.
|
||||||
|
*/
|
||||||
queryFilter(event: ContractEventName, fromBlock?: BlockTag, toBlock?: BlockTag): Promise<Array<EventLog | Log>>;
|
queryFilter(event: ContractEventName, fromBlock?: BlockTag, toBlock?: BlockTag): Promise<Array<EventLog | Log>>;
|
||||||
|
/**
|
||||||
|
* Add an event %%listener%% for the %%event%%.
|
||||||
|
*/
|
||||||
on(event: ContractEventName, listener: Listener): Promise<this>;
|
on(event: ContractEventName, listener: Listener): Promise<this>;
|
||||||
|
/**
|
||||||
|
* Add an event %%listener%% for the %%event%%, but remove the listener
|
||||||
|
* after it is fired once.
|
||||||
|
*/
|
||||||
once(event: ContractEventName, listener: Listener): Promise<this>;
|
once(event: ContractEventName, listener: Listener): Promise<this>;
|
||||||
|
/**
|
||||||
|
* Emit an %%event%% calling all listeners with %%args%%.
|
||||||
|
*
|
||||||
|
* Resolves to ``true`` if any listeners were called.
|
||||||
|
*/
|
||||||
emit(event: ContractEventName, ...args: Array<any>): Promise<boolean>;
|
emit(event: ContractEventName, ...args: Array<any>): Promise<boolean>;
|
||||||
|
/**
|
||||||
|
* Resolves to the number of listeners of %%event%% or the total number
|
||||||
|
* of listeners if unspecified.
|
||||||
|
*/
|
||||||
listenerCount(event?: ContractEventName): Promise<number>;
|
listenerCount(event?: ContractEventName): Promise<number>;
|
||||||
|
/**
|
||||||
|
* Resolves to the listeners subscribed to %%event%% or all listeners
|
||||||
|
* if unspecified.
|
||||||
|
*/
|
||||||
listeners(event?: ContractEventName): Promise<Array<Listener>>;
|
listeners(event?: ContractEventName): Promise<Array<Listener>>;
|
||||||
|
/**
|
||||||
|
* Remove the %%listener%% from the listeners for %%event%% or remove
|
||||||
|
* all listeners if unspecified.
|
||||||
|
*/
|
||||||
off(event: ContractEventName, listener?: Listener): Promise<this>;
|
off(event: ContractEventName, listener?: Listener): Promise<this>;
|
||||||
|
/**
|
||||||
|
* Remove all the listeners for %%event%% or remove all listeners if
|
||||||
|
* unspecified.
|
||||||
|
*/
|
||||||
removeAllListeners(event?: ContractEventName): Promise<this>;
|
removeAllListeners(event?: ContractEventName): Promise<this>;
|
||||||
|
/**
|
||||||
|
* Alias for [on].
|
||||||
|
*/
|
||||||
addListener(event: ContractEventName, listener: Listener): Promise<this>;
|
addListener(event: ContractEventName, listener: Listener): Promise<this>;
|
||||||
|
/**
|
||||||
|
* Alias for [off].
|
||||||
|
*/
|
||||||
removeListener(event: ContractEventName, listener: Listener): Promise<this>;
|
removeListener(event: ContractEventName, listener: Listener): Promise<this>;
|
||||||
|
/**
|
||||||
|
* Create a new Class for the %%abi%%.
|
||||||
|
*/
|
||||||
static buildClass<T = ContractInterface>(abi: InterfaceAbi): new (target: string, runner?: null | ContractRunner) => BaseContract & Omit<T, keyof BaseContract>;
|
static buildClass<T = ContractInterface>(abi: InterfaceAbi): new (target: string, runner?: null | ContractRunner) => BaseContract & Omit<T, keyof BaseContract>;
|
||||||
|
/**
|
||||||
|
* Create a new BaseContract with a specified Interface.
|
||||||
|
*/
|
||||||
static from<T = ContractInterface>(target: string, abi: InterfaceAbi, 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>;
|
declare const Contract_base: new (target: string, abi: InterfaceAbi, runner?: ContractRunner | null | undefined) => BaseContract & Omit<ContractInterface, keyof BaseContract>;
|
||||||
|
/**
|
||||||
|
* A [[BaseContract]] with no type guards on its methods or events.
|
||||||
|
*/
|
||||||
export declare class Contract extends Contract_base {
|
export declare class Contract extends Contract_base {
|
||||||
}
|
}
|
||||||
export {};
|
export {};
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src.ts/contract/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAS,MAAM,iBAAiB,CAAC;AAInD,OAAO,EAAe,GAAG,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAMjF,OAAO,EAEH,2BAA2B,EAC3B,QAAQ,EACX,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAU,MAAM,iBAAiB,CAAC;AACxG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EACR,QAAQ,EAAE,cAAc,EAC3B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAER,iBAAiB,EACjB,iBAAiB,EAEjB,cAAc,EAEd,aAAa,EACb,mBAA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C,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAgBpE;;;OAGG;IACG,GAAG,CAAC,KAAK,EAAE,iBAAiB,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBvE;;;OAGG;IACG,kBAAkB,CAAC,KAAK,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBlE;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9E;;OAEG;IACG,cAAc,CAAC,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjF;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,iBAAiB,EAAE,GAAG,EAAE,YAAY,GAAG,KAAK,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc,KAAK,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;IAS/J;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc,GAAG,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;CAKpJ;;AAMD;;GAEG;AACH,qBAAa,QAAS,SAAQ,aAAe;CAAI"}
|
@ -474,12 +474,43 @@ async function emit(contract, event, args, payloadFunc) {
|
|||||||
}
|
}
|
||||||
const passProperties = ["then"];
|
const passProperties = ["then"];
|
||||||
class BaseContract {
|
class BaseContract {
|
||||||
|
/**
|
||||||
|
* The target to connect to.
|
||||||
|
*
|
||||||
|
* This can be an address, ENS name or any [[Addressable]], such as
|
||||||
|
* another contract. To get the resovled address, use the ``getAddress``
|
||||||
|
* method.
|
||||||
|
*/
|
||||||
target;
|
target;
|
||||||
|
/**
|
||||||
|
* The contract Interface.
|
||||||
|
*/
|
||||||
interface;
|
interface;
|
||||||
|
/**
|
||||||
|
* The connected runner. This is generally a [[Provider]] or a
|
||||||
|
* [[Signer]], which dictates what operations are supported.
|
||||||
|
*
|
||||||
|
* For example, a **Contract** connected to a [[Provider]] may
|
||||||
|
* only execute read-only operations.
|
||||||
|
*/
|
||||||
runner;
|
runner;
|
||||||
|
/**
|
||||||
|
* All the Events available on this contract.
|
||||||
|
*/
|
||||||
filters;
|
filters;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
[internal];
|
[internal];
|
||||||
|
/**
|
||||||
|
* The fallback or receive function if any.
|
||||||
|
*/
|
||||||
fallback;
|
fallback;
|
||||||
|
/**
|
||||||
|
* Creates a new contract connected to %%target%% with the %%abi%% and
|
||||||
|
* optionally connected to a %%runner%% to perform operations on behalf
|
||||||
|
* of.
|
||||||
|
*/
|
||||||
constructor(target, abi, runner, _deployTx) {
|
constructor(target, abi, runner, _deployTx) {
|
||||||
(0, index_js_3.assertArgument)(typeof (target) === "string" || (0, index_js_2.isAddressable)(target), "invalid value for Contract target", "target", target);
|
(0, index_js_3.assertArgument)(typeof (target) === "string" || (0, index_js_2.isAddressable)(target), "invalid value for Contract target", "target", target);
|
||||||
if (runner == null) {
|
if (runner == null) {
|
||||||
@ -578,10 +609,20 @@ class BaseContract {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return a new Contract instance with the same target and ABI, but
|
||||||
|
* a different %%runner%%.
|
||||||
|
*/
|
||||||
connect(runner) {
|
connect(runner) {
|
||||||
return new BaseContract(this.target, this.interface, runner);
|
return new BaseContract(this.target, this.interface, runner);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return the resolved address of this Contract.
|
||||||
|
*/
|
||||||
async getAddress() { return await getInternal(this).addrPromise; }
|
async getAddress() { return await getInternal(this).addrPromise; }
|
||||||
|
/**
|
||||||
|
* Return the dedployed bytecode or null if no bytecode is found.
|
||||||
|
*/
|
||||||
async getDeployedCode() {
|
async getDeployedCode() {
|
||||||
const provider = getProvider(this.runner);
|
const provider = getProvider(this.runner);
|
||||||
(0, index_js_3.assert)(provider, "runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" });
|
(0, index_js_3.assert)(provider, "runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" });
|
||||||
@ -591,6 +632,10 @@ class BaseContract {
|
|||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Resolve to this Contract once the bytecode has been deployed, or
|
||||||
|
* resolve immediately if already deployed.
|
||||||
|
*/
|
||||||
async waitForDeployment() {
|
async waitForDeployment() {
|
||||||
// We have the deployement transaction; just use that (throws if deployement fails)
|
// We have the deployement transaction; just use that (throws if deployement fails)
|
||||||
const deployTx = this.deploymentTransaction();
|
const deployTx = this.deploymentTransaction();
|
||||||
@ -622,9 +667,20 @@ class BaseContract {
|
|||||||
checkCode();
|
checkCode();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return the transaction used to deploy this contract.
|
||||||
|
*
|
||||||
|
* This is only available if this instance was returned from a
|
||||||
|
* [[ContractFactory]].
|
||||||
|
*/
|
||||||
deploymentTransaction() {
|
deploymentTransaction() {
|
||||||
return getInternal(this).deployTx;
|
return getInternal(this).deployTx;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return the function for a given name. This is useful when a contract
|
||||||
|
* method name conflicts with a JavaScript name such as ``prototype`` or
|
||||||
|
* when using a Contract programatically.
|
||||||
|
*/
|
||||||
getFunction(key) {
|
getFunction(key) {
|
||||||
if (typeof (key) !== "string") {
|
if (typeof (key) !== "string") {
|
||||||
key = key.format();
|
key = key.format();
|
||||||
@ -632,16 +688,29 @@ class BaseContract {
|
|||||||
const func = buildWrappedMethod(this, key);
|
const func = buildWrappedMethod(this, key);
|
||||||
return func;
|
return func;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return the event for a given name. This is useful when a contract
|
||||||
|
* event name conflicts with a JavaScript name such as ``prototype`` or
|
||||||
|
* when using a Contract programatically.
|
||||||
|
*/
|
||||||
getEvent(key) {
|
getEvent(key) {
|
||||||
if (typeof (key) !== "string") {
|
if (typeof (key) !== "string") {
|
||||||
key = key.format();
|
key = key.format();
|
||||||
}
|
}
|
||||||
return buildWrappedEvent(this, key);
|
return buildWrappedEvent(this, key);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
async queryTransaction(hash) {
|
async queryTransaction(hash) {
|
||||||
// Is this useful?
|
// Is this useful?
|
||||||
throw new Error("@TODO");
|
throw new Error("@TODO");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Provide historic access to event data for %%event%% in the range
|
||||||
|
* %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``"latest"``)
|
||||||
|
* inclusive.
|
||||||
|
*/
|
||||||
async queryFilter(event, fromBlock, toBlock) {
|
async queryFilter(event, fromBlock, toBlock) {
|
||||||
if (fromBlock == null) {
|
if (fromBlock == null) {
|
||||||
fromBlock = 0;
|
fromBlock = 0;
|
||||||
@ -671,21 +740,37 @@ class BaseContract {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Add an event %%listener%% for the %%event%%.
|
||||||
|
*/
|
||||||
async on(event, listener) {
|
async on(event, listener) {
|
||||||
const sub = await getSub(this, "on", event);
|
const sub = await getSub(this, "on", event);
|
||||||
sub.listeners.push({ listener, once: false });
|
sub.listeners.push({ listener, once: false });
|
||||||
sub.start();
|
sub.start();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Add an event %%listener%% for the %%event%%, but remove the listener
|
||||||
|
* after it is fired once.
|
||||||
|
*/
|
||||||
async once(event, listener) {
|
async once(event, listener) {
|
||||||
const sub = await getSub(this, "once", event);
|
const sub = await getSub(this, "once", event);
|
||||||
sub.listeners.push({ listener, once: true });
|
sub.listeners.push({ listener, once: true });
|
||||||
sub.start();
|
sub.start();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Emit an %%event%% calling all listeners with %%args%%.
|
||||||
|
*
|
||||||
|
* Resolves to ``true`` if any listeners were called.
|
||||||
|
*/
|
||||||
async emit(event, ...args) {
|
async emit(event, ...args) {
|
||||||
return await emit(this, event, args, null);
|
return await emit(this, event, args, null);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Resolves to the number of listeners of %%event%% or the total number
|
||||||
|
* of listeners if unspecified.
|
||||||
|
*/
|
||||||
async listenerCount(event) {
|
async listenerCount(event) {
|
||||||
if (event) {
|
if (event) {
|
||||||
const sub = await hasSub(this, event);
|
const sub = await hasSub(this, event);
|
||||||
@ -701,6 +786,10 @@ class BaseContract {
|
|||||||
}
|
}
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Resolves to the listeners subscribed to %%event%% or all listeners
|
||||||
|
* if unspecified.
|
||||||
|
*/
|
||||||
async listeners(event) {
|
async listeners(event) {
|
||||||
if (event) {
|
if (event) {
|
||||||
const sub = await hasSub(this, event);
|
const sub = await hasSub(this, event);
|
||||||
@ -716,6 +805,10 @@ class BaseContract {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Remove the %%listener%% from the listeners for %%event%% or remove
|
||||||
|
* all listeners if unspecified.
|
||||||
|
*/
|
||||||
async off(event, listener) {
|
async off(event, listener) {
|
||||||
const sub = await hasSub(this, event);
|
const sub = await hasSub(this, event);
|
||||||
if (!sub) {
|
if (!sub) {
|
||||||
@ -733,6 +826,10 @@ class BaseContract {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Remove all the listeners for %%event%% or remove all listeners if
|
||||||
|
* unspecified.
|
||||||
|
*/
|
||||||
async removeAllListeners(event) {
|
async removeAllListeners(event) {
|
||||||
if (event) {
|
if (event) {
|
||||||
const sub = await hasSub(this, event);
|
const sub = await hasSub(this, event);
|
||||||
@ -751,14 +848,21 @@ class BaseContract {
|
|||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
// Alias for "on"
|
/**
|
||||||
|
* Alias for [on].
|
||||||
|
*/
|
||||||
async addListener(event, listener) {
|
async addListener(event, listener) {
|
||||||
return await this.on(event, listener);
|
return await this.on(event, listener);
|
||||||
}
|
}
|
||||||
// Alias for "off"
|
/**
|
||||||
|
* Alias for [off].
|
||||||
|
*/
|
||||||
async removeListener(event, listener) {
|
async removeListener(event, listener) {
|
||||||
return await this.off(event, listener);
|
return await this.off(event, listener);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Create a new Class for the %%abi%%.
|
||||||
|
*/
|
||||||
static buildClass(abi) {
|
static buildClass(abi) {
|
||||||
class CustomContract extends BaseContract {
|
class CustomContract extends BaseContract {
|
||||||
constructor(address, runner = null) {
|
constructor(address, runner = null) {
|
||||||
@ -768,6 +872,9 @@ class BaseContract {
|
|||||||
return CustomContract;
|
return CustomContract;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
/**
|
||||||
|
* Create a new BaseContract with a specified Interface.
|
||||||
|
*/
|
||||||
static from(target, abi, runner) {
|
static from(target, abi, runner) {
|
||||||
if (runner == null) {
|
if (runner == null) {
|
||||||
runner = null;
|
runner = null;
|
||||||
@ -780,6 +887,9 @@ exports.BaseContract = BaseContract;
|
|||||||
function _ContractBase() {
|
function _ContractBase() {
|
||||||
return BaseContract;
|
return BaseContract;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A [[BaseContract]] with no type guards on its methods or events.
|
||||||
|
*/
|
||||||
class Contract extends _ContractBase() {
|
class Contract extends _ContractBase() {
|
||||||
}
|
}
|
||||||
exports.Contract = Contract;
|
exports.Contract = Contract;
|
||||||
|
File diff suppressed because one or more lines are too long
38
lib.commonjs/contract/factory.d.ts
vendored
38
lib.commonjs/contract/factory.d.ts
vendored
@ -5,18 +5,56 @@ import type { ContractRunner } from "../providers/index.js";
|
|||||||
import type { BytesLike } from "../utils/index.js";
|
import type { BytesLike } from "../utils/index.js";
|
||||||
import type { ContractInterface, ContractMethodArgs, ContractDeployTransaction } from "./types.js";
|
import type { ContractInterface, ContractMethodArgs, ContractDeployTransaction } from "./types.js";
|
||||||
import type { ContractTransactionResponse } from "./wrappers.js";
|
import type { ContractTransactionResponse } from "./wrappers.js";
|
||||||
|
/**
|
||||||
|
* A **ContractFactory** is used to deploy a Contract to the blockchain.
|
||||||
|
*/
|
||||||
export declare class ContractFactory<A extends Array<any> = Array<any>, I = BaseContract> {
|
export declare class ContractFactory<A extends Array<any> = Array<any>, I = BaseContract> {
|
||||||
|
/**
|
||||||
|
* The Contract Interface.
|
||||||
|
*/
|
||||||
readonly interface: Interface;
|
readonly interface: Interface;
|
||||||
|
/**
|
||||||
|
* The Contract deployment bytecode. Often called the initcode.
|
||||||
|
*/
|
||||||
readonly bytecode: string;
|
readonly bytecode: string;
|
||||||
|
/**
|
||||||
|
* The ContractRunner to deploy the Contract as.
|
||||||
|
*/
|
||||||
readonly runner: null | ContractRunner;
|
readonly runner: null | ContractRunner;
|
||||||
|
/**
|
||||||
|
* Create a new **ContractFactory** with %%abi%% and %%bytecode%%,
|
||||||
|
* optionally connected to %%runner%%.
|
||||||
|
*
|
||||||
|
* The %%bytecode%% may be the ``bytecode`` property within the
|
||||||
|
* standard Solidity JSON output.
|
||||||
|
*/
|
||||||
constructor(abi: Interface | InterfaceAbi, bytecode: BytesLike | {
|
constructor(abi: Interface | InterfaceAbi, bytecode: BytesLike | {
|
||||||
object: string;
|
object: string;
|
||||||
}, runner?: null | ContractRunner);
|
}, runner?: null | ContractRunner);
|
||||||
|
/**
|
||||||
|
* Resolves to the transaction to deploy the contract, passing %%args%%
|
||||||
|
* into the constructor.
|
||||||
|
*/
|
||||||
getDeployTransaction(...args: ContractMethodArgs<A>): Promise<ContractDeployTransaction>;
|
getDeployTransaction(...args: ContractMethodArgs<A>): Promise<ContractDeployTransaction>;
|
||||||
|
/**
|
||||||
|
* Resolves to the Contract deployed by passing %%args%% into the
|
||||||
|
* constructor.
|
||||||
|
*
|
||||||
|
* This will resovle to the Contract before it has been deployed to the
|
||||||
|
* network, so the [[BaseContract-waitForDeployment]] should be used before
|
||||||
|
* sending any transactions to it.
|
||||||
|
*/
|
||||||
deploy(...args: ContractMethodArgs<A>): Promise<BaseContract & {
|
deploy(...args: ContractMethodArgs<A>): Promise<BaseContract & {
|
||||||
deploymentTransaction(): ContractTransactionResponse;
|
deploymentTransaction(): ContractTransactionResponse;
|
||||||
} & Omit<I, keyof BaseContract>>;
|
} & Omit<I, keyof BaseContract>>;
|
||||||
|
/**
|
||||||
|
* Return a new **ContractFactory** with the same ABI and bytecode,
|
||||||
|
* but connected to %%runner%%.
|
||||||
|
*/
|
||||||
connect(runner: null | ContractRunner): ContractFactory<A, I>;
|
connect(runner: null | ContractRunner): ContractFactory<A, I>;
|
||||||
|
/**
|
||||||
|
* Create a new **ContractFactory** from the standard Solidity JSON output.
|
||||||
|
*/
|
||||||
static fromSolidity<A extends Array<any> = Array<any>, I = ContractInterface>(output: any, runner?: ContractRunner): ContractFactory<A, I>;
|
static fromSolidity<A extends Array<any> = Array<any>, I = ContractInterface>(output: any, runner?: ContractRunner): ContractFactory<A, I>;
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=factory.d.ts.map
|
//# sourceMappingURL=factory.d.ts.map
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src.ts/contract/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA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mB9F;;;;;;;OAOG;IACG,MAAM,CAAC,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,GAAG;QAAE,qBAAqB,IAAI,2BAA2B,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC,CAAC;IAY5J;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,IAAI,GAAG,cAAc,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IAI7D;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;CAgB7I"}
|
@ -7,10 +7,29 @@ const index_js_3 = require("../utils/index.js");
|
|||||||
const contract_js_1 = require("./contract.js");
|
const contract_js_1 = require("./contract.js");
|
||||||
// A = Arguments to the constructor
|
// A = Arguments to the constructor
|
||||||
// I = Interface of deployed contracts
|
// I = Interface of deployed contracts
|
||||||
|
/**
|
||||||
|
* A **ContractFactory** is used to deploy a Contract to the blockchain.
|
||||||
|
*/
|
||||||
class ContractFactory {
|
class ContractFactory {
|
||||||
|
/**
|
||||||
|
* The Contract Interface.
|
||||||
|
*/
|
||||||
interface;
|
interface;
|
||||||
|
/**
|
||||||
|
* The Contract deployment bytecode. Often called the initcode.
|
||||||
|
*/
|
||||||
bytecode;
|
bytecode;
|
||||||
|
/**
|
||||||
|
* The ContractRunner to deploy the Contract as.
|
||||||
|
*/
|
||||||
runner;
|
runner;
|
||||||
|
/**
|
||||||
|
* Create a new **ContractFactory** with %%abi%% and %%bytecode%%,
|
||||||
|
* optionally connected to %%runner%%.
|
||||||
|
*
|
||||||
|
* The %%bytecode%% may be the ``bytecode`` property within the
|
||||||
|
* standard Solidity JSON output.
|
||||||
|
*/
|
||||||
constructor(abi, bytecode, runner) {
|
constructor(abi, bytecode, runner) {
|
||||||
const iface = index_js_1.Interface.from(abi);
|
const iface = index_js_1.Interface.from(abi);
|
||||||
// Dereference Solidity bytecode objects and allow a missing `0x`-prefix
|
// Dereference Solidity bytecode objects and allow a missing `0x`-prefix
|
||||||
@ -30,6 +49,10 @@ class ContractFactory {
|
|||||||
bytecode, interface: iface, runner: (runner || null)
|
bytecode, interface: iface, runner: (runner || null)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Resolves to the transaction to deploy the contract, passing %%args%%
|
||||||
|
* into the constructor.
|
||||||
|
*/
|
||||||
async getDeployTransaction(...args) {
|
async getDeployTransaction(...args) {
|
||||||
let overrides = {};
|
let overrides = {};
|
||||||
const fragment = this.interface.deploy;
|
const fragment = this.interface.deploy;
|
||||||
@ -43,6 +66,14 @@ class ContractFactory {
|
|||||||
const data = (0, index_js_3.concat)([this.bytecode, this.interface.encodeDeploy(resolvedArgs)]);
|
const data = (0, index_js_3.concat)([this.bytecode, this.interface.encodeDeploy(resolvedArgs)]);
|
||||||
return Object.assign({}, overrides, { data });
|
return Object.assign({}, overrides, { data });
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Resolves to the Contract deployed by passing %%args%% into the
|
||||||
|
* constructor.
|
||||||
|
*
|
||||||
|
* This will resovle to the Contract before it has been deployed to the
|
||||||
|
* network, so the [[BaseContract-waitForDeployment]] should be used before
|
||||||
|
* sending any transactions to it.
|
||||||
|
*/
|
||||||
async deploy(...args) {
|
async deploy(...args) {
|
||||||
const tx = await this.getDeployTransaction(...args);
|
const tx = await this.getDeployTransaction(...args);
|
||||||
(0, index_js_3.assert)(this.runner && typeof (this.runner.sendTransaction) === "function", "factory runner does not support sending transactions", "UNSUPPORTED_OPERATION", {
|
(0, index_js_3.assert)(this.runner && typeof (this.runner.sendTransaction) === "function", "factory runner does not support sending transactions", "UNSUPPORTED_OPERATION", {
|
||||||
@ -52,9 +83,16 @@ class ContractFactory {
|
|||||||
const address = (0, index_js_2.getCreateAddress)(sentTx);
|
const address = (0, index_js_2.getCreateAddress)(sentTx);
|
||||||
return new contract_js_1.BaseContract(address, this.interface, this.runner, sentTx);
|
return new contract_js_1.BaseContract(address, this.interface, this.runner, sentTx);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return a new **ContractFactory** with the same ABI and bytecode,
|
||||||
|
* but connected to %%runner%%.
|
||||||
|
*/
|
||||||
connect(runner) {
|
connect(runner) {
|
||||||
return new ContractFactory(this.interface, this.bytecode, runner);
|
return new ContractFactory(this.interface, this.bytecode, runner);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Create a new **ContractFactory** from the standard Solidity JSON output.
|
||||||
|
*/
|
||||||
static fromSolidity(output, runner) {
|
static fromSolidity(output, runner) {
|
||||||
(0, index_js_3.assertArgument)(output != null, "bad compiler output", "output", output);
|
(0, index_js_3.assertArgument)(output != null, "bad compiler output", "output", output);
|
||||||
if (typeof (output) === "string") {
|
if (typeof (output) === "string") {
|
||||||
|
@ -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,CAAC,GAAG,CAAC,CAAC;QAElC,wEAAwE;QACxE,IAAI,QAAQ,YAAY,UAAU,EAAE;YAChC,QAAQ,GAAG,IAAA,kBAAO,EAAC,IAAA,mBAAQ,EAAC,QAAQ,CAAC,CAAC,CAAC;SAC1C;aAAM;YACH,IAAI,OAAM,CAAC,QAAQ,CAAC,KA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GAAG,IAAA,2BAAgB,EAAC,MAAM,CAAC,CAAC;QACzC,OAAO,IAAU,0BAAa,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjF,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,MAA6B;QACjC,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACtE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY,CAA2D,MAAW,EAAE,MAAuB;QAC9G,IAAA,yBAAc,EAAC,MAAM,IAAI,IAAI,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAExE,IAAI,OAAM,CAAC,MAAM,CAAC,KAAK,QAAQ,EAAE;YAAE,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAAE;QAEjE,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QAEvB,IAAI,QAAQ,GAAG,EAAE,CAAC;QAClB,IAAI,MAAM,CAAC,QAAQ,EAAE;YACjB,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;SAC9B;aAAM,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE;YAC1C,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;SAClC;QAED,OAAO,IAAI,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;CACJ;AA/GD,0CA+GC"}
|
5
lib.commonjs/contract/index.d.ts
vendored
5
lib.commonjs/contract/index.d.ts
vendored
@ -1,5 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* About contracts...
|
* A **Contract** object is a meta-class (a class whose definition is
|
||||||
|
* defined at runtime), which communicates with a deployed smart contract
|
||||||
|
* on the blockchain and provides a simple JavaScript interface to call
|
||||||
|
* methods, send transaction, query historic logs and listen for its events.
|
||||||
*
|
*
|
||||||
* @_section: api/contract:Contracts [about-contracts]
|
* @_section: api/contract:Contracts [about-contracts]
|
||||||
*/
|
*/
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/contract/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACH,YAAY,EAAE,QAAQ,EACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACH,eAAe,EAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACH,oBAAoB,EAAE,2BAA2B,EACjD,0BAA0B,EAAE,2BAA2B,EACvD,QAAQ,GACX,MAAM,eAAe,CAAC;AAEvB,YAAY,EACR,kBAAkB,EAAE,sBAAsB,EAC1C,gBAAgB,EAChB,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EACnD,yBAAyB,EACzB,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAE,mBAAmB,EAC1E,mBAAmB,EAAE,SAAS,EAC9B,eAAe,EAClB,MAAM,YAAY,CAAC"}
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/contract/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACH,YAAY,EAAE,QAAQ,EACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACH,eAAe,EAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACH,oBAAoB,EAAE,2BAA2B,EACjD,0BAA0B,EAAE,2BAA2B,EACvD,QAAQ,GACX,MAAM,eAAe,CAAC;AAEvB,YAAY,EACR,kBAAkB,EAAE,sBAAsB,EAC1C,gBAAgB,EAChB,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EACnD,yBAAyB,EACzB,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAE,mBAAmB,EAC1E,mBAAmB,EAAE,SAAS,EAC9B,eAAe,EAClB,MAAM,YAAY,CAAC"}
|
@ -2,7 +2,10 @@
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.EventLog = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.ContractUnknownEventPayload = exports.ContractEventPayload = exports.ContractFactory = exports.Contract = exports.BaseContract = void 0;
|
exports.EventLog = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.ContractUnknownEventPayload = exports.ContractEventPayload = exports.ContractFactory = exports.Contract = exports.BaseContract = void 0;
|
||||||
/**
|
/**
|
||||||
* About contracts...
|
* A **Contract** object is a meta-class (a class whose definition is
|
||||||
|
* defined at runtime), which communicates with a deployed smart contract
|
||||||
|
* on the blockchain and provides a simple JavaScript interface to call
|
||||||
|
* methods, send transaction, query historic logs and listen for its events.
|
||||||
*
|
*
|
||||||
* @_section: api/contract:Contracts [about-contracts]
|
* @_section: api/contract:Contracts [about-contracts]
|
||||||
*/
|
*/
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/contract/index.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,6CAEuB;AADnB,2GAAA,YAAY,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAG1B,2CAEsB;AADlB,6GAAA,eAAe,OAAA;AAGnB,6CAIuB;AAHnB,mHAAA,oBAAoB,OAAA;AAAE,0HAAA,2BAA2B,OAAA;AACjD,yHAAA,0BAA0B,OAAA;AAAE,0HAAA,2BAA2B,OAAA;AACvD,uGAAA,QAAQ,OAAA"}
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/contract/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,6CAEuB;AADnB,2GAAA,YAAY,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAG1B,2CAEsB;AADlB,6GAAA,eAAe,OAAA;AAGnB,6CAIuB;AAHnB,mHAAA,oBAAoB,OAAA;AAAE,0HAAA,2BAA2B,OAAA;AACjD,yHAAA,0BAA0B,OAAA;AAAE,0HAAA,2BAA2B,OAAA;AACvD,uGAAA,QAAQ,OAAA"}
|
137
lib.commonjs/contract/types.d.ts
vendored
137
lib.commonjs/contract/types.d.ts
vendored
@ -1,56 +1,193 @@
|
|||||||
import type { EventFragment, FunctionFragment, Result, Typed } from "../abi/index.js";
|
import type { EventFragment, FunctionFragment, Result, Typed } from "../abi/index.js";
|
||||||
import type { TransactionRequest, PreparedTransactionRequest, TopicFilter } from "../providers/index.js";
|
import type { TransactionRequest, PreparedTransactionRequest, TopicFilter } from "../providers/index.js";
|
||||||
import type { ContractTransactionResponse } from "./wrappers.js";
|
import type { ContractTransactionResponse } from "./wrappers.js";
|
||||||
|
/**
|
||||||
|
* The name for an event used for subscribing to Contract events.
|
||||||
|
*
|
||||||
|
* **``string``** - An event by name. The event must be non-ambiguous.
|
||||||
|
* The parameters will be dereferenced when passed into the listener.
|
||||||
|
*
|
||||||
|
* [[ContractEvent]] - A filter from the ``contract.filters``, which will
|
||||||
|
* pass only the EventPayload as a single parameter, which includes a
|
||||||
|
* ``.signature`` property that can be used to further filter the event.
|
||||||
|
*
|
||||||
|
* [[TopicFilter]] - A filter defined using the standard Ethereum API
|
||||||
|
* which provides the specific topic hash or topic hashes to watch for along
|
||||||
|
* with any additional values to filter by. This will only pass a single
|
||||||
|
* parameter to the listener, the EventPayload which will include additional
|
||||||
|
* details to refine by, such as the event name and signature.
|
||||||
|
*
|
||||||
|
* [[DeferredTopicFilter]] - A filter created by calling a [[ContractEvent]]
|
||||||
|
* with parameters, which will create a filter for a specific event
|
||||||
|
* signautre and dereference each parameter when calling the listener.
|
||||||
|
*/
|
||||||
export type ContractEventName = string | ContractEvent | TopicFilter | DeferredTopicFilter;
|
export type ContractEventName = string | ContractEvent | TopicFilter | DeferredTopicFilter;
|
||||||
|
/**
|
||||||
|
* A Contract with no method constraints.
|
||||||
|
*/
|
||||||
export interface ContractInterface {
|
export interface ContractInterface {
|
||||||
[name: string]: BaseContractMethod;
|
[name: string]: BaseContractMethod;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* When creating a filter using the ``contract.filters``, this is returned.
|
||||||
|
*/
|
||||||
export interface DeferredTopicFilter {
|
export interface DeferredTopicFilter {
|
||||||
getTopicFilter(): Promise<TopicFilter>;
|
getTopicFilter(): Promise<TopicFilter>;
|
||||||
fragment: EventFragment;
|
fragment: EventFragment;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* When populating a transaction this type is returned.
|
||||||
|
*/
|
||||||
export interface ContractTransaction extends PreparedTransactionRequest {
|
export interface ContractTransaction extends PreparedTransactionRequest {
|
||||||
|
/**
|
||||||
|
* The target address.
|
||||||
|
*/
|
||||||
to: string;
|
to: string;
|
||||||
|
/**
|
||||||
|
* The transaction data.
|
||||||
|
*/
|
||||||
data: string;
|
data: string;
|
||||||
|
/**
|
||||||
|
* The from address, if any.
|
||||||
|
*/
|
||||||
from?: string;
|
from?: string;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A deployment transaction for a contract.
|
||||||
|
*/
|
||||||
export interface ContractDeployTransaction extends Omit<ContractTransaction, "to"> {
|
export interface ContractDeployTransaction extends Omit<ContractTransaction, "to"> {
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The overrides for a contract transaction.
|
||||||
|
*/
|
||||||
export interface Overrides extends Omit<TransactionRequest, "to" | "data"> {
|
export interface Overrides extends Omit<TransactionRequest, "to" | "data"> {
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Arguments to a Contract method can always include an additional and
|
||||||
|
* optional overrides parameter.
|
||||||
|
*
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
export type PostfixOverrides<A extends Array<any>> = A | [...A, Overrides];
|
export type PostfixOverrides<A extends Array<any>> = A | [...A, Overrides];
|
||||||
|
/**
|
||||||
|
* Arguments to a Contract method can always include an additional and
|
||||||
|
* optional overrides parameter, and each parameter can optionally be
|
||||||
|
* [[Typed]].
|
||||||
|
*
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
export type ContractMethodArgs<A extends Array<any>> = PostfixOverrides<{
|
export type ContractMethodArgs<A extends Array<any>> = PostfixOverrides<{
|
||||||
[I in keyof A]-?: A[I] | Typed;
|
[I in keyof A]-?: A[I] | Typed;
|
||||||
}>;
|
}>;
|
||||||
|
/**
|
||||||
|
* A Contract method can be called directly, or used in various ways.
|
||||||
|
*/
|
||||||
export interface BaseContractMethod<A extends Array<any> = Array<any>, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> {
|
export interface BaseContractMethod<A extends Array<any> = Array<any>, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> {
|
||||||
(...args: ContractMethodArgs<A>): Promise<D>;
|
(...args: ContractMethodArgs<A>): Promise<D>;
|
||||||
|
/**
|
||||||
|
* The name of the Contract method.
|
||||||
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
|
/**
|
||||||
|
* The fragment of the Contract method. This will throw on ambiguous
|
||||||
|
* method names.
|
||||||
|
*/
|
||||||
fragment: FunctionFragment;
|
fragment: FunctionFragment;
|
||||||
|
/**
|
||||||
|
* Returns the fragment constrained by %%args%%. This can be used to
|
||||||
|
* resolve ambiguous method names.
|
||||||
|
*/
|
||||||
getFragment(...args: ContractMethodArgs<A>): FunctionFragment;
|
getFragment(...args: ContractMethodArgs<A>): FunctionFragment;
|
||||||
|
/**
|
||||||
|
* Returns a populated transaction that can be used to perform the
|
||||||
|
* contract method with %%args%%.
|
||||||
|
*/
|
||||||
populateTransaction(...args: ContractMethodArgs<A>): Promise<ContractTransaction>;
|
populateTransaction(...args: ContractMethodArgs<A>): Promise<ContractTransaction>;
|
||||||
|
/**
|
||||||
|
* Call the contract method with %%args%% and return the value.
|
||||||
|
*
|
||||||
|
* If the return value is a single type, it will be dereferenced and
|
||||||
|
* returned directly, otherwise the full Result will be returned.
|
||||||
|
*/
|
||||||
staticCall(...args: ContractMethodArgs<A>): Promise<R>;
|
staticCall(...args: ContractMethodArgs<A>): Promise<R>;
|
||||||
|
/**
|
||||||
|
* Send a transaction for the contract method with %%args%%.
|
||||||
|
*/
|
||||||
send(...args: ContractMethodArgs<A>): Promise<ContractTransactionResponse>;
|
send(...args: ContractMethodArgs<A>): Promise<ContractTransactionResponse>;
|
||||||
|
/**
|
||||||
|
* Estimate the gas to send the contract method with %%args%%.
|
||||||
|
*/
|
||||||
estimateGas(...args: ContractMethodArgs<A>): Promise<bigint>;
|
estimateGas(...args: ContractMethodArgs<A>): Promise<bigint>;
|
||||||
|
/**
|
||||||
|
* Call the contract method with %%args%% and return the Result
|
||||||
|
* without any dereferencing.
|
||||||
|
*/
|
||||||
staticCallResult(...args: ContractMethodArgs<A>): Promise<Result>;
|
staticCallResult(...args: ContractMethodArgs<A>): Promise<Result>;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A contract method on a Contract.
|
||||||
|
*/
|
||||||
export interface ContractMethod<A extends Array<any> = Array<any>, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> extends BaseContractMethod<A, R, D> {
|
export interface ContractMethod<A extends Array<any> = Array<any>, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> extends BaseContractMethod<A, R, D> {
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A pure of view method on a Contract.
|
||||||
|
*/
|
||||||
export interface ConstantContractMethod<A extends Array<any>, R = any> extends ContractMethod<A, R, R> {
|
export interface ConstantContractMethod<A extends Array<any>, R = any> extends ContractMethod<A, R, R> {
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Each argument of an event is nullable (to indicate matching //any//.
|
||||||
|
*
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
export type ContractEventArgs<A extends Array<any>> = {
|
export type ContractEventArgs<A extends Array<any>> = {
|
||||||
[I in keyof A]?: A[I] | Typed | null;
|
[I in keyof A]?: A[I] | Typed | null;
|
||||||
};
|
};
|
||||||
export interface ContractEvent<A extends Array<any> = Array<any>> {
|
export interface ContractEvent<A extends Array<any> = Array<any>> {
|
||||||
(...args: ContractEventArgs<A>): DeferredTopicFilter;
|
(...args: ContractEventArgs<A>): DeferredTopicFilter;
|
||||||
|
/**
|
||||||
|
* The name of the Contract event.
|
||||||
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
|
/**
|
||||||
|
* The fragment of the Contract event. This will throw on ambiguous
|
||||||
|
* method names.
|
||||||
|
*/
|
||||||
fragment: EventFragment;
|
fragment: EventFragment;
|
||||||
|
/**
|
||||||
|
* Returns the fragment constrained by %%args%%. This can be used to
|
||||||
|
* resolve ambiguous event names.
|
||||||
|
*/
|
||||||
getFragment(...args: ContractEventArgs<A>): EventFragment;
|
getFragment(...args: ContractEventArgs<A>): EventFragment;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A Fallback or Receive function on a Contract.
|
||||||
|
*/
|
||||||
export interface WrappedFallback {
|
export interface WrappedFallback {
|
||||||
(overrides?: Omit<TransactionRequest, "to">): Promise<ContractTransactionResponse>;
|
(overrides?: Omit<TransactionRequest, "to">): Promise<ContractTransactionResponse>;
|
||||||
|
/**
|
||||||
|
* Returns a populated transaction that can be used to perform the
|
||||||
|
* fallback method.
|
||||||
|
*
|
||||||
|
* For non-receive fallback, ``data`` may be overridden.
|
||||||
|
*/
|
||||||
populateTransaction(overrides?: Omit<TransactionRequest, "to">): Promise<ContractTransaction>;
|
populateTransaction(overrides?: Omit<TransactionRequest, "to">): Promise<ContractTransaction>;
|
||||||
|
/**
|
||||||
|
* Call the contract fallback and return the result.
|
||||||
|
*
|
||||||
|
* For non-receive fallback, ``data`` may be overridden.
|
||||||
|
*/
|
||||||
staticCall(overrides?: Omit<TransactionRequest, "to">): Promise<string>;
|
staticCall(overrides?: Omit<TransactionRequest, "to">): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Send a transaction to the contract fallback.
|
||||||
|
*
|
||||||
|
* For non-receive fallback, ``data`` may be overridden.
|
||||||
|
*/
|
||||||
send(overrides?: Omit<TransactionRequest, "to">): Promise<ContractTransactionResponse>;
|
send(overrides?: Omit<TransactionRequest, "to">): Promise<ContractTransactionResponse>;
|
||||||
|
/**
|
||||||
|
* Estimate the gas to send a transaction to the contract fallback.
|
||||||
|
*
|
||||||
|
* For non-receive fallback, ``data`` may be overridden.
|
||||||
|
*/
|
||||||
estimateGas(overrides?: Omit<TransactionRequest, "to">): Promise<bigint>;
|
estimateGas(overrides?: Omit<TransactionRequest, "to">): Promise<bigint>;
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=types.d.ts.map
|
//# sourceMappingURL=types.d.ts.map
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src.ts/contract/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EACjD,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACR,kBAAkB,EAAE,0BAA0B,EAAE,WAAW,EAC9D,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAIjE,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,aAAa,GAAG,WAAW,GAAG,mBAAmB,CAAC;AAE3F,MAAM,WAAW,iBAAiB;IAC9B,CAAE,IAAI,EAAE,MAAM,GAAI,kBAAkB,CAAC;CACxC;AAED,MAAM,WAAW,mBAAmB;IAChC,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,aAAa,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAoB,SAAQ,0BAA0B;IAEnE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IAGb,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAGD,MAAM,WAAW,yBAA0B,SAAQ,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC;CAAI;AAGtF,MAAM,WAAW,SAAU,SAAQ,IA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QAAQ,EAAE,aAAa,CAAC;IAExB;;;OAGG;IACH,WAAW,CAAC,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC;CAC7D;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAEnF;;;;;OAKG;IACH,mBAAmB,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAE9F;;;;OAIG;IACH,UAAU,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExE;;;;OAIG;IACH,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAEvF;;;;OAIG;IACH,WAAW,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5E"}
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src.ts/contract/types.ts"],"names":[],"mappings":";;AAeC,CAAC;AAoB4E,CAAC;AAkD9E,CAAC"}
|
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src.ts/contract/types.ts"],"names":[],"mappings":";;AAqCC,CAAC;AAsC4E,CAAC;AA4H9E,CAAC"}
|
89
lib.commonjs/contract/wrappers.d.ts
vendored
89
lib.commonjs/contract/wrappers.d.ts
vendored
@ -5,37 +5,126 @@ import type { Listener } from "../utils/index.js";
|
|||||||
import type { Provider } from "../providers/index.js";
|
import type { Provider } from "../providers/index.js";
|
||||||
import type { BaseContract } from "./contract.js";
|
import type { BaseContract } from "./contract.js";
|
||||||
import type { ContractEventName } from "./types.js";
|
import type { ContractEventName } from "./types.js";
|
||||||
|
/**
|
||||||
|
* An **EventLog** contains additional properties parsed from the [[Log]].
|
||||||
|
*/
|
||||||
export declare class EventLog extends Log {
|
export declare class EventLog extends Log {
|
||||||
|
/**
|
||||||
|
* The Contract Interface.
|
||||||
|
*/
|
||||||
readonly interface: Interface;
|
readonly interface: Interface;
|
||||||
|
/**
|
||||||
|
* The matching event.
|
||||||
|
*/
|
||||||
readonly fragment: EventFragment;
|
readonly fragment: EventFragment;
|
||||||
|
/**
|
||||||
|
* The parsed arguments passed to the event by ``emit``.
|
||||||
|
*/
|
||||||
readonly args: Result;
|
readonly args: Result;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(log: Log, iface: Interface, fragment: EventFragment);
|
constructor(log: Log, iface: Interface, fragment: EventFragment);
|
||||||
|
/**
|
||||||
|
* The name of the event.
|
||||||
|
*/
|
||||||
get eventName(): string;
|
get eventName(): string;
|
||||||
|
/**
|
||||||
|
* The signature of the event.
|
||||||
|
*/
|
||||||
get eventSignature(): string;
|
get eventSignature(): string;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A **ContractTransactionReceipt** includes the parsed logs from a
|
||||||
|
* [[TransactionReceipt]].
|
||||||
|
*/
|
||||||
export declare class ContractTransactionReceipt extends TransactionReceipt {
|
export declare class ContractTransactionReceipt extends TransactionReceipt {
|
||||||
#private;
|
#private;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(iface: Interface, provider: Provider, tx: TransactionReceipt);
|
constructor(iface: Interface, provider: Provider, tx: TransactionReceipt);
|
||||||
|
/**
|
||||||
|
* The parsed logs for any [[Log]] which has a matching event in the
|
||||||
|
* Contract ABI.
|
||||||
|
*/
|
||||||
get logs(): Array<EventLog | Log>;
|
get logs(): Array<EventLog | Log>;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A **ContractTransactionResponse** will return a
|
||||||
|
* [[ContractTransactionReceipt]] when waited on.
|
||||||
|
*/
|
||||||
export declare class ContractTransactionResponse extends TransactionResponse {
|
export declare class ContractTransactionResponse extends TransactionResponse {
|
||||||
#private;
|
#private;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(iface: Interface, provider: Provider, tx: TransactionResponse);
|
constructor(iface: Interface, provider: Provider, tx: TransactionResponse);
|
||||||
|
/**
|
||||||
|
* Resolves once this transaction has been mined and has
|
||||||
|
* %%confirms%% blocks including it (default: ``1``) with an
|
||||||
|
* optional %%timeout%%.
|
||||||
|
*
|
||||||
|
* This can resolve to ``null`` only if %%confirms%% is ``0``
|
||||||
|
* and the transaction has not been mined, otherwise this will
|
||||||
|
* wait until enough confirmations have completed.
|
||||||
|
*/
|
||||||
wait(confirms?: number): Promise<null | ContractTransactionReceipt>;
|
wait(confirms?: number): Promise<null | ContractTransactionReceipt>;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A **ContractUnknownEventPayload** is included as the last parameter to
|
||||||
|
* Contract Events when the event does not match any events in the ABI.
|
||||||
|
*/
|
||||||
export declare class ContractUnknownEventPayload extends EventPayload<ContractEventName> {
|
export declare class ContractUnknownEventPayload extends EventPayload<ContractEventName> {
|
||||||
|
/**
|
||||||
|
* The log with no matching events.
|
||||||
|
*/
|
||||||
readonly log: Log;
|
readonly log: Log;
|
||||||
|
/**
|
||||||
|
* @_event:
|
||||||
|
*/
|
||||||
constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, log: Log);
|
constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, log: Log);
|
||||||
|
/**
|
||||||
|
* Resolves to the block the event occured in.
|
||||||
|
*/
|
||||||
getBlock(): Promise<Block>;
|
getBlock(): Promise<Block>;
|
||||||
|
/**
|
||||||
|
* Resolves to the transaction the event occured in.
|
||||||
|
*/
|
||||||
getTransaction(): Promise<TransactionResponse>;
|
getTransaction(): Promise<TransactionResponse>;
|
||||||
|
/**
|
||||||
|
* Resolves to the transaction receipt the event occured in.
|
||||||
|
*/
|
||||||
getTransactionReceipt(): Promise<TransactionReceipt>;
|
getTransactionReceipt(): Promise<TransactionReceipt>;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A **ContractEventPayload** is included as the last parameter to
|
||||||
|
* Contract Events when the event is known.
|
||||||
|
*/
|
||||||
export declare class ContractEventPayload extends ContractUnknownEventPayload {
|
export declare class ContractEventPayload extends ContractUnknownEventPayload {
|
||||||
|
/**
|
||||||
|
* The matching event.
|
||||||
|
*/
|
||||||
readonly fragment: EventFragment;
|
readonly fragment: EventFragment;
|
||||||
|
/**
|
||||||
|
* The log, with parsed properties.
|
||||||
|
*/
|
||||||
readonly log: EventLog;
|
readonly log: EventLog;
|
||||||
|
/**
|
||||||
|
* The parsed arguments passed to the event by ``emit``.
|
||||||
|
*/
|
||||||
readonly args: Result;
|
readonly args: Result;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, fragment: EventFragment, _log: Log);
|
constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, fragment: EventFragment, _log: Log);
|
||||||
|
/**
|
||||||
|
* The event name.
|
||||||
|
*/
|
||||||
get eventName(): string;
|
get eventName(): string;
|
||||||
|
/**
|
||||||
|
* The event signature.
|
||||||
|
*/
|
||||||
get eventSignature(): string;
|
get eventSignature(): string;
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=wrappers.d.ts.map
|
//# sourceMappingURL=wrappers.d.ts.map
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"wrappers.d.ts","sourceRoot":"","sources":["../../src.ts/contract/wrappers.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,EAAE,GAAG,EAAE,kBAAkB,EAAE,mBAAmB,EACtD,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAoB,YAAY,EAAE,MA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2B;IAEjE;;OAEG;IACH,SAAiB,QAAQ,EAAE,aAAa,CAAC;IAEzC;;OAEG;IACH,SAAiB,GAAG,EAAE,QAAQ,CAAC;IAE/B;;OAEG;IACH,SAAiB,IAAI,EAAE,MAAM,CAAC;IAE9B;;OAEG;gBACS,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG;IAM5H;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,MAAM,CAE3B;CACJ"}
|
@ -5,25 +5,57 @@ exports.ContractEventPayload = exports.ContractUnknownEventPayload = exports.Con
|
|||||||
// from EtherscanProvider
|
// from EtherscanProvider
|
||||||
const provider_js_1 = require("../providers/provider.js");
|
const provider_js_1 = require("../providers/provider.js");
|
||||||
const index_js_1 = require("../utils/index.js");
|
const index_js_1 = require("../utils/index.js");
|
||||||
|
/**
|
||||||
|
* An **EventLog** contains additional properties parsed from the [[Log]].
|
||||||
|
*/
|
||||||
class EventLog extends provider_js_1.Log {
|
class EventLog extends provider_js_1.Log {
|
||||||
|
/**
|
||||||
|
* The Contract Interface.
|
||||||
|
*/
|
||||||
interface;
|
interface;
|
||||||
|
/**
|
||||||
|
* The matching event.
|
||||||
|
*/
|
||||||
fragment;
|
fragment;
|
||||||
|
/**
|
||||||
|
* The parsed arguments passed to the event by ``emit``.
|
||||||
|
*/
|
||||||
args;
|
args;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(log, iface, fragment) {
|
constructor(log, iface, fragment) {
|
||||||
super(log, log.provider);
|
super(log, log.provider);
|
||||||
const args = iface.decodeEventLog(fragment, log.data, log.topics);
|
const args = iface.decodeEventLog(fragment, log.data, log.topics);
|
||||||
(0, index_js_1.defineProperties)(this, { args, fragment, interface: iface });
|
(0, index_js_1.defineProperties)(this, { args, fragment, interface: iface });
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The name of the event.
|
||||||
|
*/
|
||||||
get eventName() { return this.fragment.name; }
|
get eventName() { return this.fragment.name; }
|
||||||
|
/**
|
||||||
|
* The signature of the event.
|
||||||
|
*/
|
||||||
get eventSignature() { return this.fragment.format(); }
|
get eventSignature() { return this.fragment.format(); }
|
||||||
}
|
}
|
||||||
exports.EventLog = EventLog;
|
exports.EventLog = EventLog;
|
||||||
|
/**
|
||||||
|
* A **ContractTransactionReceipt** includes the parsed logs from a
|
||||||
|
* [[TransactionReceipt]].
|
||||||
|
*/
|
||||||
class ContractTransactionReceipt extends provider_js_1.TransactionReceipt {
|
class ContractTransactionReceipt extends provider_js_1.TransactionReceipt {
|
||||||
#iface;
|
#iface;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(iface, provider, tx) {
|
constructor(iface, provider, tx) {
|
||||||
super(tx, provider);
|
super(tx, provider);
|
||||||
this.#iface = iface;
|
this.#iface = iface;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The parsed logs for any [[Log]] which has a matching event in the
|
||||||
|
* Contract ABI.
|
||||||
|
*/
|
||||||
get logs() {
|
get logs() {
|
||||||
return super.logs.map((log) => {
|
return super.logs.map((log) => {
|
||||||
const fragment = log.topics.length ? this.#iface.getEvent(log.topics[0]) : null;
|
const fragment = log.topics.length ? this.#iface.getEvent(log.topics[0]) : null;
|
||||||
@ -37,12 +69,28 @@ class ContractTransactionReceipt extends provider_js_1.TransactionReceipt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.ContractTransactionReceipt = ContractTransactionReceipt;
|
exports.ContractTransactionReceipt = ContractTransactionReceipt;
|
||||||
|
/**
|
||||||
|
* A **ContractTransactionResponse** will return a
|
||||||
|
* [[ContractTransactionReceipt]] when waited on.
|
||||||
|
*/
|
||||||
class ContractTransactionResponse extends provider_js_1.TransactionResponse {
|
class ContractTransactionResponse extends provider_js_1.TransactionResponse {
|
||||||
#iface;
|
#iface;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(iface, provider, tx) {
|
constructor(iface, provider, tx) {
|
||||||
super(tx, provider);
|
super(tx, provider);
|
||||||
this.#iface = iface;
|
this.#iface = iface;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Resolves once this transaction has been mined and has
|
||||||
|
* %%confirms%% blocks including it (default: ``1``) with an
|
||||||
|
* optional %%timeout%%.
|
||||||
|
*
|
||||||
|
* This can resolve to ``null`` only if %%confirms%% is ``0``
|
||||||
|
* and the transaction has not been mined, otherwise this will
|
||||||
|
* wait until enough confirmations have completed.
|
||||||
|
*/
|
||||||
async wait(confirms) {
|
async wait(confirms) {
|
||||||
const receipt = await super.wait();
|
const receipt = await super.wait();
|
||||||
if (receipt == null) {
|
if (receipt == null) {
|
||||||
@ -52,32 +100,64 @@ class ContractTransactionResponse extends provider_js_1.TransactionResponse {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.ContractTransactionResponse = ContractTransactionResponse;
|
exports.ContractTransactionResponse = ContractTransactionResponse;
|
||||||
|
/**
|
||||||
|
* A **ContractUnknownEventPayload** is included as the last parameter to
|
||||||
|
* Contract Events when the event does not match any events in the ABI.
|
||||||
|
*/
|
||||||
class ContractUnknownEventPayload extends index_js_1.EventPayload {
|
class ContractUnknownEventPayload extends index_js_1.EventPayload {
|
||||||
|
/**
|
||||||
|
* The log with no matching events.
|
||||||
|
*/
|
||||||
log;
|
log;
|
||||||
|
/**
|
||||||
|
* @_event:
|
||||||
|
*/
|
||||||
constructor(contract, listener, filter, log) {
|
constructor(contract, listener, filter, log) {
|
||||||
super(contract, listener, filter);
|
super(contract, listener, filter);
|
||||||
(0, index_js_1.defineProperties)(this, { log });
|
(0, index_js_1.defineProperties)(this, { log });
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Resolves to the block the event occured in.
|
||||||
|
*/
|
||||||
async getBlock() {
|
async getBlock() {
|
||||||
return await this.log.getBlock();
|
return await this.log.getBlock();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Resolves to the transaction the event occured in.
|
||||||
|
*/
|
||||||
async getTransaction() {
|
async getTransaction() {
|
||||||
return await this.log.getTransaction();
|
return await this.log.getTransaction();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Resolves to the transaction receipt the event occured in.
|
||||||
|
*/
|
||||||
async getTransactionReceipt() {
|
async getTransactionReceipt() {
|
||||||
return await this.log.getTransactionReceipt();
|
return await this.log.getTransactionReceipt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.ContractUnknownEventPayload = ContractUnknownEventPayload;
|
exports.ContractUnknownEventPayload = ContractUnknownEventPayload;
|
||||||
|
/**
|
||||||
|
* A **ContractEventPayload** is included as the last parameter to
|
||||||
|
* Contract Events when the event is known.
|
||||||
|
*/
|
||||||
class ContractEventPayload extends ContractUnknownEventPayload {
|
class ContractEventPayload extends ContractUnknownEventPayload {
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
constructor(contract, listener, filter, fragment, _log) {
|
constructor(contract, listener, filter, fragment, _log) {
|
||||||
super(contract, listener, filter, new EventLog(_log, contract.interface, fragment));
|
super(contract, listener, filter, new EventLog(_log, contract.interface, fragment));
|
||||||
const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics);
|
const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics);
|
||||||
(0, index_js_1.defineProperties)(this, { args, fragment });
|
(0, index_js_1.defineProperties)(this, { args, fragment });
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The event name.
|
||||||
|
*/
|
||||||
get eventName() {
|
get eventName() {
|
||||||
return this.fragment.name;
|
return this.fragment.name;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The event signature.
|
||||||
|
*/
|
||||||
get eventSignature() {
|
get eventSignature() {
|
||||||
return this.fragment.format();
|
return this.frag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AAE,QAAQ,EAAE,MAAM,EAAE,IAAI,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;QACpF,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACzF,IAAA,2BAAgB,EAAuB,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAI,cAAc;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;IAClC,CAAC;CACJ;AAvCD,oDAuCC"}
|
4
lib.commonjs/crypto/index.d.ts
vendored
4
lib.commonjs/crypto/index.d.ts
vendored
@ -14,6 +14,10 @@ import { sha256, sha512 } from "./sha2.js";
|
|||||||
export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync };
|
export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync };
|
||||||
export { SigningKey } from "./signing-key.js";
|
export { SigningKey } from "./signing-key.js";
|
||||||
export { Signature } from "./signature.js";
|
export { Signature } from "./signature.js";
|
||||||
|
/**
|
||||||
|
* Once called, prevents any future change to the underlying cryptographic
|
||||||
|
* primitives using the ``.register`` feature for hooks.
|
||||||
|
*/
|
||||||
declare function lock(): void;
|
declare function lock(): void;
|
||||||
export { lock };
|
export { lock };
|
||||||
export type { ProgressCallback } from "./scrypt.js";
|
export type { ProgressCallback } from "./scrypt.js";
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":"AA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M,WAAW,CAAC;AAE3C,OAAO,EACH,WAAW,EAEX,WAAW,EAEX,SAAS,EACT,SAAS,EACT,MAAM,EAAE,MAAM,EAEd,MAAM,EACN,MAAM,EAAE,UAAU,EACrB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;GAGG;AACH,iBAAS,IAAI,IAAI,IAAI,CAWpB;AAED,OAAO,EAAE,IAAI,EAAE,CAAC;AAKhB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
@ -29,6 +29,10 @@ var signing_key_js_1 = require("./signing-key.js");
|
|||||||
Object.defineProperty(exports, "SigningKey", { enumerable: true, get: function () { return signing_key_js_1.SigningKey; } });
|
Object.defineProperty(exports, "SigningKey", { enumerable: true, get: function () { return signing_key_js_1.SigningKey; } });
|
||||||
var signature_js_1 = require("./signature.js");
|
var signature_js_1 = require("./signature.js");
|
||||||
Object.defineProperty(exports, "Signature", { enumerable: true, get: function () { return signature_js_1.Signature; } });
|
Object.defineProperty(exports, "Signature", { enumerable: true, get: function () { return signature_js_1.Signature; } });
|
||||||
|
/**
|
||||||
|
* Once called, prevents any future change to the underlying cryptographic
|
||||||
|
* primitives using the ``.register`` feature for hooks.
|
||||||
|
*/
|
||||||
function lock() {
|
function lock() {
|
||||||
hmac_js_1.computeHmac.lock();
|
hmac_js_1.computeHmac.lock();
|
||||||
keccak_js_1.keccak256.lock();
|
keccak_js_1.keccak256.lock();
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,IAAI,CAAA;AAEJ,8CAA8C;AAC9C,uCAAwC;AASpC,4FATK,qBAAW,OASL;AARf,2CAAwC;AAYpC,0FAZK,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,mDAA8C;AAArC,4GAAA,UAAU,OAAA;AACnB,+CAA2C;AAAlC,yGAAA,SAAS,OAAA;AAElB;;;GAGG;AACH,SAAS,IAAI;IACT,qBAAW,CAAC,IAAI,EAAE,CAAC;IACnB,qBAAS,CAAC,IAAI,EAAE,CAAC;IACjB,kBAAM,CAAC,IAAI,EAAE,CAAC;IACd,uBAAW,CAAC,IAAI,EAAE,CAAC;IACnB,wBAAS,CAAC,IAAI,EAAE,CAAC;IACjB,kBAAM,CAAC,IAAI,EAAE,CAAC;IACd,sBAAU,CAAC,IAAI,EAAE,CAAC;IAClB,gBAAM,CAAC,IAAI,EAAE,CAAC;IACd,gBAAM,CAAC,IAAI,EAAE,CAAC;IACd,uBAAW,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAEQ,oBAAI"}
|
3
lib.commonjs/hash/index.d.ts
vendored
3
lib.commonjs/hash/index.d.ts
vendored
@ -1,5 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* About hashing here...
|
* Utilities for common tasks involving hashing. Also see
|
||||||
|
* [cryptographic hashing](about-crypto-hashing).
|
||||||
*
|
*
|
||||||
* @_section: api/hashing:Hashing Utilities [about-hashing]
|
* @_section: api/hashing:Hashing Utilities [about-hashing]
|
||||||
*/
|
*/
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/hash/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EACH,cAAc,EAAE,uBAAuB,EAAE,oBAAoB,EAChE,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/hash/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EACH,cAAc,EAAE,uBAAuB,EAAE,oBAAoB,EAChE,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
|
@ -1,6 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
/**
|
/**
|
||||||
* About hashing here...
|
* Utilities for common tasks involving hashing. Also see
|
||||||
|
* [cryptographic hashing](about-crypto-hashing).
|
||||||
*
|
*
|
||||||
* @_section: api/hashing:Hashing Utilities [about-hashing]
|
* @_section: api/hashing:Hashing Utilities [about-hashing]
|
||||||
*/
|
*/
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/hash/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,iCAA4B;AAAnB,2FAAA,EAAE,OAAA;AACX,6CAA+E;AAAtE,2GAAA,YAAY,OAAA;AAAE,0GAAA,WAAW,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAAE,wGAAA,SAAS,OAAA;AACvD,2CAA0D;AAAjD,yGAAA,WAAW,OAAA;AAAE,2GAAA,aAAa,OAAA;AACnC,6CAEuB;AADnB,6GAAA,cAAc,OAAA;AAAE,sHAAA,uBAAuB,OAAA;AAAE,mHAAA,oBAAoB,OAAA;AAEjE,iDAAoE;AAA3D,iHAAA,gBAAgB,OAAA;AAAE,gHAAA,eAAe,OAAA"}
|
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/hash/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,iCAA4B;AAAnB,2FAAA,EAAE,OAAA;AACX,6CAA+E;AAAtE,2GAAA,YAAY,OAAA;AAAE,0GAAA,WAAW,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAAE,wGAAA,SAAS,OAAA;AACvD,2CAA0D;AAAjD,yGAAA,WAAW,OAAA;AAAE,2GAAA,aAAa,OAAA;AACnC,6CAEuB;AADnB,6GAAA,cAAc,OAAA;AAAE,sHAAA,uBAAuB,OAAA;AAAE,mHAAA,oBAAoB,OAAA;AAEjE,iDAAoE;AAA3D,iHAAA,gBAAgB,OAAA;AAAE,gHAAA,eAAe,OAAA"}
|
107
lib.commonjs/hash/typed-data.d.ts
vendored
107
lib.commonjs/hash/typed-data.d.ts
vendored
@ -1,39 +1,146 @@
|
|||||||
import type { SignatureLike } from "../crypto/index.js";
|
import type { SignatureLike } from "../crypto/index.js";
|
||||||
import type { BigNumberish, BytesLike } from "../utils/index.js";
|
import type { BigNumberish, BytesLike } from "../utils/index.js";
|
||||||
|
/**
|
||||||
|
* The domain for an [[link-eip-712]] payload.
|
||||||
|
*/
|
||||||
export interface TypedDataDomain {
|
export interface TypedDataDomain {
|
||||||
|
/**
|
||||||
|
* The human-readable name of the signing domain.
|
||||||
|
*/
|
||||||
name?: null | string;
|
name?: null | string;
|
||||||
|
/**
|
||||||
|
* The major version of the signing domain.
|
||||||
|
*/
|
||||||
version?: null | string;
|
version?: null | string;
|
||||||
|
/**
|
||||||
|
* The chain ID of the signing domain.
|
||||||
|
*/
|
||||||
chainId?: null | BigNumberish;
|
chainId?: null | BigNumberish;
|
||||||
|
/**
|
||||||
|
* The the address of the contract that will verify the signature.
|
||||||
|
*/
|
||||||
verifyingContract?: null | string;
|
verifyingContract?: null | string;
|
||||||
|
/**
|
||||||
|
* A salt used for purposes decided by the specific domain.
|
||||||
|
*/
|
||||||
salt?: null | BytesLike;
|
salt?: null | BytesLike;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A specific field of a structured [[link-eip-712]] type.
|
||||||
|
*/
|
||||||
export interface TypedDataField {
|
export interface TypedDataField {
|
||||||
|
/**
|
||||||
|
* The field name.
|
||||||
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
|
/**
|
||||||
|
* The type of the field.
|
||||||
|
*/
|
||||||
type: string;
|
type: string;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads
|
||||||
|
* for signed typed data.
|
||||||
|
*
|
||||||
|
* This is useful for those that wish to compute various components of a
|
||||||
|
* typed data hash, primary types, or sub-components, but generally the
|
||||||
|
* higher level [[Signer-signTypedData]] is more useful.
|
||||||
|
*/
|
||||||
export declare class TypedDataEncoder {
|
export declare class TypedDataEncoder {
|
||||||
#private;
|
#private;
|
||||||
|
/**
|
||||||
|
* The primary type for the structured [[types]].
|
||||||
|
*
|
||||||
|
* This is derived automatically from the [[types]], since no
|
||||||
|
* recursion is possible, once the DAG for the types is consturcted
|
||||||
|
* internally, the primary type must be the only remaining type with
|
||||||
|
* no parent nodes.
|
||||||
|
*/
|
||||||
readonly primaryType: string;
|
readonly primaryType: string;
|
||||||
|
/**
|
||||||
|
* The types.
|
||||||
|
*/
|
||||||
get types(): Record<string, Array<TypedDataField>>;
|
get types(): Record<string, Array<TypedDataField>>;
|
||||||
|
/**
|
||||||
|
* Create a new **TypedDataEncoder** for %%types%%.
|
||||||
|
*
|
||||||
|
* This performs all necessary checking that types are valid and
|
||||||
|
* do not violate the [[link-eip-712]] structural constraints as
|
||||||
|
* well as computes the [[primaryType]].
|
||||||
|
*/
|
||||||
constructor(types: Record<string, Array<TypedDataField>>);
|
constructor(types: Record<string, Array<TypedDataField>>);
|
||||||
|
/**
|
||||||
|
* Returnthe encoder for the specific %%type%%.
|
||||||
|
*/
|
||||||
getEncoder(type: string): (value: any) => string;
|
getEncoder(type: string): (value: any) => string;
|
||||||
|
/**
|
||||||
|
* Return the full type for %%name%%.
|
||||||
|
*/
|
||||||
encodeType(name: string): string;
|
encodeType(name: string): string;
|
||||||
|
/**
|
||||||
|
* Return the encoded %%value%% for the %%type%%.
|
||||||
|
*/
|
||||||
encodeData(type: string, value: any): string;
|
encodeData(type: string, value: any): string;
|
||||||
|
/**
|
||||||
|
* Returns the hash of %%value%% for the type of %%name%%.
|
||||||
|
*/
|
||||||
hashStruct(name: string, value: Record<string, any>): string;
|
hashStruct(name: string, value: Record<string, any>): string;
|
||||||
|
/**
|
||||||
|
* Return the fulled encoded %%value%% for the [[types]].
|
||||||
|
*/
|
||||||
encode(value: Record<string, any>): string;
|
encode(value: Record<string, any>): string;
|
||||||
|
/**
|
||||||
|
* Return the hash of the fully encoded %%value%% for the [[types]].
|
||||||
|
*/
|
||||||
hash(value: Record<string, any>): string;
|
hash(value: Record<string, any>): string;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
_visit(type: string, value: any, callback: (type: string, data: any) => any): any;
|
_visit(type: string, value: any, callback: (type: string, data: any) => any): any;
|
||||||
|
/**
|
||||||
|
* Call %%calback%% for each value in %%value%%, passing the type and
|
||||||
|
* component within %%value%%.
|
||||||
|
*
|
||||||
|
* This is useful for replacing addresses or other transformation that
|
||||||
|
* may be desired on each component, based on its type.
|
||||||
|
*/
|
||||||
visit(value: Record<string, any>, callback: (type: string, data: any) => any): any;
|
visit(value: Record<string, any>, callback: (type: string, data: any) => any): any;
|
||||||
|
/**
|
||||||
|
* Create a new **TypedDataEncoder** for %%types%%.
|
||||||
|
*/
|
||||||
static from(types: Record<string, Array<TypedDataField>>): TypedDataEncoder;
|
static from(types: Record<string, Array<TypedDataField>>): TypedDataEncoder;
|
||||||
|
/**
|
||||||
|
* Return the primary type for %%types%%.
|
||||||
|
*/
|
||||||
static getPrimaryType(types: Record<string, Array<TypedDataField>>): string;
|
static getPrimaryType(types: Record<string, Array<TypedDataField>>): string;
|
||||||
|
/**
|
||||||
|
* Return the hashed struct for %%value%% using %%types%% and %%name%%.
|
||||||
|
*/
|
||||||
static hashStruct(name: string, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): string;
|
static hashStruct(name: string, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): string;
|
||||||
|
/**
|
||||||
|
* Return the domain hash for %%domain%%.
|
||||||
|
*/
|
||||||
static hashDomain(domain: TypedDataDomain): string;
|
static hashDomain(domain: TypedDataDomain): string;
|
||||||
|
/**
|
||||||
|
* Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.
|
||||||
|
*/
|
||||||
static encode(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): string;
|
static encode(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): string;
|
||||||
|
/**
|
||||||
|
* Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.
|
||||||
|
*/
|
||||||
static hash(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;
|
||||||
|
/**
|
||||||
|
* Resolves to the value from resolving all addresses in %%value%% for
|
||||||
|
* %%types%% and the %%domain%%.
|
||||||
|
*/
|
||||||
static resolveNames(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>, resolveName: (name: string) => Promise<string>): Promise<{
|
static resolveNames(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>, resolveName: (name: string) => Promise<string>): Promise<{
|
||||||
domain: TypedDataDomain;
|
domain: TypedDataDomain;
|
||||||
value: any;
|
value: any;
|
||||||
}>;
|
}>;
|
||||||
|
/**
|
||||||
|
* Returns the JSON-encoded payload expected by nodes which implement
|
||||||
|
* the JSON-RPC [[link-eip-712]] method.
|
||||||
|
*/
|
||||||
static getPayload(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): any;
|
static getPayload(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): any;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"typed-data.d.ts","sourceRoot":"","sources":["../../src.ts/hash/typed-data.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWjE,MAAM,WAAW,eAAe;IAC5B,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAC9B,iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAClC,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAmHD,qBAAa,gBAAgB;;IACzB,QAAQ,CAAC,WAAW,EAAG,MAAM,CAAC;IAG9B,IAAI,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAEjD;gBAMW,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAkFxD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM;IAoDhD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAMhC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MA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,CAAC,GAAG,MAAM;IAKtH;;;OAGG;WACU,YAAY,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,eAAe,CAAC;QAAC,KAAK,EAAE,GAAG,CAAA;KAAE,CAAC;IAiD9N;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG;CAuD5H;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM,CAEnK"}
|
@ -114,14 +114,40 @@ function getBaseEncoder(type) {
|
|||||||
function encodeType(name, fields) {
|
function encodeType(name, fields) {
|
||||||
return `${name}(${fields.map(({ name, type }) => (type + " " + name)).join(",")})`;
|
return `${name}(${fields.map(({ name, type }) => (type + " " + name)).join(",")})`;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads
|
||||||
|
* for signed typed data.
|
||||||
|
*
|
||||||
|
* This is useful for those that wish to compute various components of a
|
||||||
|
* typed data hash, primary types, or sub-components, but generally the
|
||||||
|
* higher level [[Signer-signTypedData]] is more useful.
|
||||||
|
*/
|
||||||
class TypedDataEncoder {
|
class TypedDataEncoder {
|
||||||
|
/**
|
||||||
|
* The primary type for the structured [[types]].
|
||||||
|
*
|
||||||
|
* This is derived automatically from the [[types]], since no
|
||||||
|
* recursion is possible, once the DAG for the types is consturcted
|
||||||
|
* internally, the primary type must be the only remaining type with
|
||||||
|
* no parent nodes.
|
||||||
|
*/
|
||||||
primaryType;
|
primaryType;
|
||||||
#types;
|
#types;
|
||||||
|
/**
|
||||||
|
* The types.
|
||||||
|
*/
|
||||||
get types() {
|
get types() {
|
||||||
return JSON.parse(this.#types);
|
return JSON.parse(this.#types);
|
||||||
}
|
}
|
||||||
#fullTypes;
|
#fullTypes;
|
||||||
#encoderCache;
|
#encoderCache;
|
||||||
|
/**
|
||||||
|
* Create a new **TypedDataEncoder** for %%types%%.
|
||||||
|
*
|
||||||
|
* This performs all necessary checking that types are valid and
|
||||||
|
* do not violate the [[link-eip-712]] structural constraints as
|
||||||
|
* well as computes the [[primaryType]].
|
||||||
|
*/
|
||||||
constructor(types) {
|
constructor(types) {
|
||||||
this.#types = JSON.stringify(types);
|
this.#types = JSON.stringify(types);
|
||||||
this.#fullTypes = new Map();
|
this.#fullTypes = new Map();
|
||||||
@ -187,6 +213,9 @@ class TypedDataEncoder {
|
|||||||
this.#fullTypes.set(name, encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join(""));
|
this.#fullTypes.set(name, encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returnthe encoder for the specific %%type%%.
|
||||||
|
*/
|
||||||
getEncoder(type) {
|
getEncoder(type) {
|
||||||
let encoder = this.#encoderCache.get(type);
|
let encoder = this.#encoderCache.get(type);
|
||||||
if (!encoder) {
|
if (!encoder) {
|
||||||
@ -235,23 +264,41 @@ class TypedDataEncoder {
|
|||||||
}
|
}
|
||||||
(0, index_js_4.assertArgument)(false, `unknown type: ${type}`, "type", type);
|
(0, index_js_4.assertArgument)(false, `unknown type: ${type}`, "type", type);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return the full type for %%name%%.
|
||||||
|
*/
|
||||||
encodeType(name) {
|
encodeType(name) {
|
||||||
const result = this.#fullTypes.get(name);
|
const result = this.#fullTypes.get(name);
|
||||||
(0, index_js_4.assertArgument)(result, `unknown type: ${JSON.stringify(name)}`, "name", name);
|
(0, index_js_4.assertArgument)(result, `unknown type: ${JSON.stringify(name)}`, "name", name);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return the encoded %%value%% for the %%type%%.
|
||||||
|
*/
|
||||||
encodeData(type, value) {
|
encodeData(type, value) {
|
||||||
return this.getEncoder(type)(value);
|
return this.getEncoder(type)(value);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns the hash of %%value%% for the type of %%name%%.
|
||||||
|
*/
|
||||||
hashStruct(name, value) {
|
hashStruct(name, value) {
|
||||||
return (0, index_js_2.keccak256)(this.encodeData(name, value));
|
return (0, index_js_2.keccak256)(this.encodeData(name, value));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return the fulled encoded %%value%% for the [[types]].
|
||||||
|
*/
|
||||||
encode(value) {
|
encode(value) {
|
||||||
return this.encodeData(this.primaryType, value);
|
return this.encodeData(this.primaryType, value);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return the hash of the fully encoded %%value%% for the [[types]].
|
||||||
|
*/
|
||||||
hash(value) {
|
hash(value) {
|
||||||
return this.hashStruct(this.primaryType, value);
|
return this.hashStruct(this.primaryType, value);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
_visit(type, value, callback) {
|
_visit(type, value, callback) {
|
||||||
// Basic encoder type (address, bool, uint256, etc)
|
// Basic encoder type (address, bool, uint256, etc)
|
||||||
{
|
{
|
||||||
@ -276,18 +323,37 @@ class TypedDataEncoder {
|
|||||||
}
|
}
|
||||||
(0, index_js_4.assertArgument)(false, `unknown type: ${type}`, "type", type);
|
(0, index_js_4.assertArgument)(false, `unknown type: ${type}`, "type", type);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Call %%calback%% for each value in %%value%%, passing the type and
|
||||||
|
* component within %%value%%.
|
||||||
|
*
|
||||||
|
* This is useful for replacing addresses or other transformation that
|
||||||
|
* may be desired on each component, based on its type.
|
||||||
|
*/
|
||||||
visit(value, callback) {
|
visit(value, callback) {
|
||||||
return this._visit(this.primaryType, value, callback);
|
return this._visit(this.primaryType, value, callback);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Create a new **TypedDataEncoder** for %%types%%.
|
||||||
|
*/
|
||||||
static from(types) {
|
static from(types) {
|
||||||
return new TypedDataEncoder(types);
|
return new TypedDataEncoder(types);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return the primary type for %%types%%.
|
||||||
|
*/
|
||||||
static getPrimaryType(types) {
|
static getPrimaryType(types) {
|
||||||
return TypedDataEncoder.from(types).primaryType;
|
return TypedDataEncoder.from(types).primaryType;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return the hashed struct for %%value%% using %%types%% and %%name%%.
|
||||||
|
*/
|
||||||
static hashStruct(name, types, value) {
|
static hashStruct(name, types, value) {
|
||||||
return TypedDataEncoder.from(types).hashStruct(name, value);
|
return TypedDataEncoder.from(types).hashStruct(name, value);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return the domain hash for %%domain%%.
|
||||||
|
*/
|
||||||
static hashDomain(domain) {
|
static hashDomain(domain) {
|
||||||
const domainFields = [];
|
const domainFields = [];
|
||||||
for (const name in domain) {
|
for (const name in domain) {
|
||||||
@ -303,6 +369,9 @@ class TypedDataEncoder {
|
|||||||
});
|
});
|
||||||
return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain);
|
return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.
|
||||||
|
*/
|
||||||
static encode(domain, types, value) {
|
static encode(domain, types, value) {
|
||||||
return (0, index_js_4.concat)([
|
return (0, index_js_4.concat)([
|
||||||
"0x1901",
|
"0x1901",
|
||||||
@ -310,10 +379,17 @@ class TypedDataEncoder {
|
|||||||
TypedDataEncoder.from(types).hash(value)
|
TypedDataEncoder.from(types).hash(value)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.
|
||||||
|
*/
|
||||||
static hash(domain, types, value) {
|
static hash(domain, types, value) {
|
||||||
return (0, index_js_2.keccak256)(TypedDataEncoder.encode(domain, types, value));
|
return (0, index_js_2.keccak256)(TypedDataEncoder.encode(domain, types, value));
|
||||||
}
|
}
|
||||||
// Replaces all address types with ENS names with their looked up address
|
// Replaces all address types with ENS names with their looked up address
|
||||||
|
/**
|
||||||
|
* Resolves to the value from resolving all addresses in %%value%% for
|
||||||
|
* %%types%% and the %%domain%%.
|
||||||
|
*/
|
||||||
static async resolveNames(domain, types, value, resolveName) {
|
static async resolveNames(domain, types, value, resolveName) {
|
||||||
// Make a copy to isolate it from the object passed in
|
// Make a copy to isolate it from the object passed in
|
||||||
domain = Object.assign({}, domain);
|
domain = Object.assign({}, domain);
|
||||||
@ -355,6 +431,10 @@ class TypedDataEncoder {
|
|||||||
});
|
});
|
||||||
return { domain, value };
|
return { domain, value };
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns the JSON-encoded payload expected by nodes which implement
|
||||||
|
* the JSON-RPC [[link-eip-712]] method.
|
||||||
|
*/
|
||||||
static getPayload(domain, types, value) {
|
static getPayload(domain, types, value) {
|
||||||
// Validate the domain fields
|
// Validate the domain fields
|
||||||
TypedDataEncoder.hashDomain(domain);
|
TypedDataEncoder.hashDomain(domain);
|
||||||
|
File diff suppressed because one or more lines are too long
213
lib.commonjs/providers/abstract-provider.d.ts
vendored
213
lib.commonjs/providers/abstract-provider.d.ts
vendored
@ -1,5 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* About Subclassing the Provider...
|
* The available providers should suffice for most developers purposes,
|
||||||
|
* but the [[AbstractProvider]] class has many features which enable
|
||||||
|
* sub-classing it for specific purposes.
|
||||||
*
|
*
|
||||||
* @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider]
|
* @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider]
|
||||||
*/
|
*/
|
||||||
@ -13,6 +15,10 @@ import type { Listener } from "../utils/index.js";
|
|||||||
import type { Networkish } from "./network.js";
|
import type { Networkish } from "./network.js";
|
||||||
import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js";
|
import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js";
|
||||||
import type { BlockTag, EventFilter, Filter, FilterByBlockHash, OrphanFilter, PreparedTransactionRequest, Provider, ProviderEvent, TransactionRequest } from "./provider.js";
|
import type { BlockTag, EventFilter, Filter, FilterByBlockHash, OrphanFilter, PreparedTransactionRequest, Provider, ProviderEvent, TransactionRequest } from "./provider.js";
|
||||||
|
/**
|
||||||
|
* The types of additional event values that can be emitted for the
|
||||||
|
* ``"debug"`` event.
|
||||||
|
*/
|
||||||
export type DebugEventAbstractProvider = {
|
export type DebugEventAbstractProvider = {
|
||||||
action: "sendCcipReadFetchRequest";
|
action: "sendCcipReadFetchRequest";
|
||||||
request: FetchRequest;
|
request: FetchRequest;
|
||||||
@ -47,6 +53,12 @@ export type DebugEventAbstractProvider = {
|
|||||||
};
|
};
|
||||||
error: Error;
|
error: Error;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* The value passed to the [[AbstractProvider-_getSubscriber]] method.
|
||||||
|
*
|
||||||
|
* Only developers sub-classing [[AbstractProvider[[ will care about this,
|
||||||
|
* if they are modifying a low-level feature of how subscriptions operate.
|
||||||
|
*/
|
||||||
export type Subscription = {
|
export type Subscription = {
|
||||||
type: "block" | "close" | "debug" | "error" | "network" | "pending";
|
type: "block" | "close" | "debug" | "error" | "network" | "pending";
|
||||||
tag: string;
|
tag: string;
|
||||||
@ -63,25 +75,77 @@ export type Subscription = {
|
|||||||
tag: string;
|
tag: string;
|
||||||
filter: OrphanFilter;
|
filter: OrphanFilter;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* A **Subscriber** manages a subscription.
|
||||||
|
*
|
||||||
|
* Only developers sub-classing [[AbstractProvider[[ will care about this,
|
||||||
|
* if they are modifying a low-level feature of how subscriptions operate.
|
||||||
|
*/
|
||||||
export interface Subscriber {
|
export interface Subscriber {
|
||||||
|
/**
|
||||||
|
* Called initially when a subscriber is added the first time.
|
||||||
|
*/
|
||||||
start(): void;
|
start(): void;
|
||||||
|
/**
|
||||||
|
* Called when there are no more subscribers to the event.
|
||||||
|
*/
|
||||||
stop(): void;
|
stop(): void;
|
||||||
|
/**
|
||||||
|
* Called when the subscription should pause.
|
||||||
|
*
|
||||||
|
* If %%dropWhilePaused%%, events that occur while paused should not
|
||||||
|
* be emitted [[resume]].
|
||||||
|
*/
|
||||||
pause(dropWhilePaused?: boolean): void;
|
pause(dropWhilePaused?: boolean): void;
|
||||||
|
/**
|
||||||
|
* Resume a paused subscriber.
|
||||||
|
*/
|
||||||
resume(): void;
|
resume(): void;
|
||||||
|
/**
|
||||||
|
* The frequency (in ms) to poll for events, if polling is used by
|
||||||
|
* the subscriber.
|
||||||
|
*
|
||||||
|
* For non-polling subscribers, this must return ``undefined``.
|
||||||
|
*/
|
||||||
pollingInterval?: number;
|
pollingInterval?: number;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* An **UnmanagedSubscriber** is useful for events which do not require
|
||||||
|
* any additional management, such as ``"debug"`` which only requires
|
||||||
|
* emit in synchronous event loop triggered calls.
|
||||||
|
*/
|
||||||
export declare class UnmanagedSubscriber implements Subscriber {
|
export declare class UnmanagedSubscriber implements Subscriber {
|
||||||
|
/**
|
||||||
|
* The name fof the event.
|
||||||
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
|
/**
|
||||||
|
* Create a new UnmanagedSubscriber with %%name%%.
|
||||||
|
*/
|
||||||
constructor(name: string);
|
constructor(name: string);
|
||||||
start(): void;
|
start(): void;
|
||||||
stop(): void;
|
stop(): void;
|
||||||
pause(dropWhilePaused?: boolean): void;
|
pause(dropWhilePaused?: boolean): void;
|
||||||
resume(): void;
|
resume(): void;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* An **AbstractPlugin** is used to provide additional internal services
|
||||||
|
* to an [[AbstractProvider]] without adding backwards-incompatible changes
|
||||||
|
* to method signatures or other internal and complex logic.
|
||||||
|
*/
|
||||||
export interface AbstractProviderPlugin {
|
export interface AbstractProviderPlugin {
|
||||||
|
/**
|
||||||
|
* The reverse domain notation of the plugin.
|
||||||
|
*/
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
|
/**
|
||||||
|
* Creates a new instance of the plugin, connected to %%provider%%.
|
||||||
|
*/
|
||||||
connect(provider: AbstractProvider): AbstractProviderPlugin;
|
connect(provider: AbstractProvider): AbstractProviderPlugin;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A normalized filter used for [[PerformActionRequest]] objects.
|
||||||
|
*/
|
||||||
export type PerformActionFilter = {
|
export type PerformActionFilter = {
|
||||||
address?: string | Array<string>;
|
address?: string | Array<string>;
|
||||||
topics?: Array<null | string | Array<string>>;
|
topics?: Array<null | string | Array<string>>;
|
||||||
@ -92,10 +156,23 @@ export type PerformActionFilter = {
|
|||||||
topics?: Array<null | string | Array<string>>;
|
topics?: Array<null | string | Array<string>>;
|
||||||
blockHash?: string;
|
blockHash?: string;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* A normalized transactions used for [[PerformActionRequest]] objects.
|
||||||
|
*/
|
||||||
export interface PerformActionTransaction extends PreparedTransactionRequest {
|
export interface PerformActionTransaction extends PreparedTransactionRequest {
|
||||||
|
/**
|
||||||
|
* The ``to`` address of the transaction.
|
||||||
|
*/
|
||||||
to?: string;
|
to?: string;
|
||||||
|
/**
|
||||||
|
* The sender of the transaction.
|
||||||
|
*/
|
||||||
from?: string;
|
from?: string;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The [[AbstractProvider]] methods will normalize all values and pass this
|
||||||
|
* type to [[AbstractProvider-_perform]].
|
||||||
|
*/
|
||||||
export type PerformActionRequest = {
|
export type PerformActionRequest = {
|
||||||
method: "broadcastTransaction";
|
method: "broadcastTransaction";
|
||||||
signedTransaction: string;
|
signedTransaction: string;
|
||||||
@ -150,26 +227,108 @@ export type PerformActionRequest = {
|
|||||||
method: "getTransactionResult";
|
method: "getTransactionResult";
|
||||||
hash: string;
|
hash: string;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* An **AbstractProvider** provides a base class for other sub-classes to
|
||||||
|
* implement the [[Provider]] API by normalizing input arguments and
|
||||||
|
* formatting output results as well as tracking events for consistent
|
||||||
|
* behaviour on an eventually-consistent network.
|
||||||
|
*/
|
||||||
export declare class AbstractProvider implements Provider {
|
export declare class AbstractProvider implements Provider {
|
||||||
#private;
|
#private;
|
||||||
|
/**
|
||||||
|
* Create a new **AbstractProvider** connected to %%network%%, or
|
||||||
|
* use the various network detection capabilities to discover the
|
||||||
|
* [[Network]] if necessary.
|
||||||
|
*/
|
||||||
constructor(_network?: "any" | Networkish);
|
constructor(_network?: "any" | Networkish);
|
||||||
|
/**
|
||||||
|
* Returns ``this``, to allow an **AbstractProvider** to implement
|
||||||
|
* the [[ContractRunner]] interface.
|
||||||
|
*/
|
||||||
get provider(): this;
|
get provider(): this;
|
||||||
|
/**
|
||||||
|
* Returns all the registered plug-ins.
|
||||||
|
*/
|
||||||
get plugins(): Array<AbstractProviderPlugin>;
|
get plugins(): Array<AbstractProviderPlugin>;
|
||||||
|
/**
|
||||||
|
* Attach a new plug-in.
|
||||||
|
*/
|
||||||
attachPlugin(plugin: AbstractProviderPlugin): this;
|
attachPlugin(plugin: AbstractProviderPlugin): this;
|
||||||
|
/**
|
||||||
|
* Get a plugin by name.
|
||||||
|
*/
|
||||||
getPlugin<T extends AbstractProviderPlugin = AbstractProviderPlugin>(name: string): null | T;
|
getPlugin<T extends AbstractProviderPlugin = AbstractProviderPlugin>(name: string): null | T;
|
||||||
|
/**
|
||||||
|
* Prevent any CCIP-read operation, regardless of whether requested
|
||||||
|
* in a [[call]] using ``enableCcipRead``.
|
||||||
|
*/
|
||||||
get disableCcipRead(): boolean;
|
get disableCcipRead(): boolean;
|
||||||
set disableCcipRead(value: boolean);
|
set disableCcipRead(value: boolean);
|
||||||
|
/**
|
||||||
|
* Resolves to the data for executing the CCIP-read operations.
|
||||||
|
*/
|
||||||
ccipReadFetch(tx: PerformActionTransaction, calldata: string, urls: Array<string>): Promise<null | string>;
|
ccipReadFetch(tx: PerformActionTransaction, calldata: string, urls: Array<string>): Promise<null | string>;
|
||||||
|
/**
|
||||||
|
* Provides the opportunity for a sub-class to wrap a block before
|
||||||
|
* returning it, to add additional properties or an alternate
|
||||||
|
* sub-class of [[Block]].
|
||||||
|
*/
|
||||||
_wrapBlock(value: BlockParams, network: Network): Block;
|
_wrapBlock(value: BlockParams, network: Network): Block;
|
||||||
|
/**
|
||||||
|
* Provides the opportunity for a sub-class to wrap a log before
|
||||||
|
* returning it, to add additional properties or an alternate
|
||||||
|
* sub-class of [[Log]].
|
||||||
|
*/
|
||||||
_wrapLog(value: LogParams, network: Network): Log;
|
_wrapLog(value: LogParams, network: Network): Log;
|
||||||
|
/**
|
||||||
|
* Provides the opportunity for a sub-class to wrap a transaction
|
||||||
|
* receipt before returning it, to add additional properties or an
|
||||||
|
* alternate sub-class of [[TransactionReceipt]].
|
||||||
|
*/
|
||||||
_wrapTransactionReceipt(value: TransactionReceiptParams, network: Network): TransactionReceipt;
|
_wrapTransactionReceipt(value: TransactionReceiptParams, network: Network): TransactionReceipt;
|
||||||
|
/**
|
||||||
|
* Provides the opportunity for a sub-class to wrap a transaction
|
||||||
|
* response before returning it, to add additional properties or an
|
||||||
|
* alternate sub-class of [[TransactionResponse]].
|
||||||
|
*/
|
||||||
_wrapTransactionResponse(tx: TransactionResponseParams, network: Network): TransactionResponse;
|
_wrapTransactionResponse(tx: TransactionResponseParams, network: Network): TransactionResponse;
|
||||||
|
/**
|
||||||
|
* Resolves to the Network, forcing a network detection using whatever
|
||||||
|
* technique the sub-class requires.
|
||||||
|
*
|
||||||
|
* Sub-classes **must** override this.
|
||||||
|
*/
|
||||||
_detectNetwork(): Promise<Network>;
|
_detectNetwork(): Promise<Network>;
|
||||||
|
/**
|
||||||
|
* Sub-classes should use this to perform all built-in operations. All
|
||||||
|
* methods sanitizes and normalizes the values passed into this.
|
||||||
|
*
|
||||||
|
* Sub-classes **must** override this.
|
||||||
|
*/
|
||||||
_perform<T = any>(req: PerformActionRequest): Promise<T>;
|
_perform<T = any>(req: PerformActionRequest): Promise<T>;
|
||||||
getBlockNumber(): Promise<number>;
|
getBlockNumber(): Promise<number>;
|
||||||
|
/**
|
||||||
|
* Returns or resolves to the address for %%address%%, resolving ENS
|
||||||
|
* names and [[Addressable]] objects and returning if already an
|
||||||
|
* address.
|
||||||
|
*/
|
||||||
_getAddress(address: AddressLike): string | Promise<string>;
|
_getAddress(address: AddressLike): string | Promise<string>;
|
||||||
|
/**
|
||||||
|
* Returns or resolves to a valid block tag for %%blockTag%%, resolving
|
||||||
|
* negative values and returning if already a valid block tag.
|
||||||
|
*/
|
||||||
_getBlockTag(blockTag?: BlockTag): string | Promise<string>;
|
_getBlockTag(blockTag?: BlockTag): string | Promise<string>;
|
||||||
|
/**
|
||||||
|
* Returns or resolves to a filter for %%filter%%, resolving any ENS
|
||||||
|
* names or [[Addressable]] object and returning if already a valid
|
||||||
|
* filter.
|
||||||
|
*/
|
||||||
_getFilter(filter: Filter | FilterByBlockHash): PerformActionFilter | Promise<PerformActionFilter>;
|
_getFilter(filter: Filter | FilterByBlockHash): PerformActionFilter | Promise<PerformActionFilter>;
|
||||||
|
/**
|
||||||
|
* Returns or resovles to a transaction for %%request%%, resolving
|
||||||
|
* any ENS names or [[Addressable]] and returning if already a valid
|
||||||
|
* transaction.
|
||||||
|
*/
|
||||||
_getTransactionRequest(_request: TransactionRequest): PerformActionTransaction | Promise<PerformActionTransaction>;
|
_getTransactionRequest(_request: TransactionRequest): PerformActionTransaction | Promise<PerformActionTransaction>;
|
||||||
getNetwork(): Promise<Network>;
|
getNetwork(): Promise<Network>;
|
||||||
getFeeData(): Promise<FeeData>;
|
getFeeData(): Promise<FeeData>;
|
||||||
@ -192,10 +351,37 @@ export declare class AbstractProvider implements Provider {
|
|||||||
lookupAddress(address: string): Promise<null | string>;
|
lookupAddress(address: string): Promise<null | string>;
|
||||||
waitForTransaction(hash: string, _confirms?: null | number, timeout?: null | number): Promise<null | TransactionReceipt>;
|
waitForTransaction(hash: string, _confirms?: null | number, timeout?: null | number): Promise<null | TransactionReceipt>;
|
||||||
waitForBlock(blockTag?: BlockTag): Promise<Block>;
|
waitForBlock(blockTag?: BlockTag): Promise<Block>;
|
||||||
|
/**
|
||||||
|
* Clear a timer created using the [[_setTimeout]] method.
|
||||||
|
*/
|
||||||
_clearTimeout(timerId: number): void;
|
_clearTimeout(timerId: number): void;
|
||||||
|
/**
|
||||||
|
* Create a timer that will execute %%func%% after at least %%timeout%%
|
||||||
|
* (in ms). If %%timeout%% is unspecified, then %%func%% will execute
|
||||||
|
* in the next event loop.
|
||||||
|
*
|
||||||
|
* [Pausing](AbstractProvider-paused) the provider will pause any
|
||||||
|
* associated timers.
|
||||||
|
*/
|
||||||
_setTimeout(_func: () => void, timeout?: number): number;
|
_setTimeout(_func: () => void, timeout?: number): number;
|
||||||
|
/**
|
||||||
|
* Perform %%func%% on each subscriber.
|
||||||
|
*/
|
||||||
_forEachSubscriber(func: (s: Subscriber) => void): void;
|
_forEachSubscriber(func: (s: Subscriber) => void): void;
|
||||||
|
/**
|
||||||
|
* Sub-classes may override this to customize subscription
|
||||||
|
* implementations.
|
||||||
|
*/
|
||||||
_getSubscriber(sub: Subscription): Subscriber;
|
_getSubscriber(sub: Subscription): Subscriber;
|
||||||
|
/**
|
||||||
|
* If a [[Subscriber]] fails and needs to replace itself, this
|
||||||
|
* method may be used.
|
||||||
|
*
|
||||||
|
* For example, this is used for providers when using the
|
||||||
|
* ``eth_getFilterChanges`` method, which can return null if state
|
||||||
|
* filters are not supported by the backend, allowing the Subscriber
|
||||||
|
* to swap in a [[PollingEventSubscriber]].
|
||||||
|
*/
|
||||||
_recoverSubscriber(oldSub: Subscriber, newSub: Subscriber): void;
|
_recoverSubscriber(oldSub: Subscriber, newSub: Subscriber): void;
|
||||||
on(event: ProviderEvent, listener: Listener): Promise<this>;
|
on(event: ProviderEvent, listener: Listener): Promise<this>;
|
||||||
once(event: ProviderEvent, listener: Listener): Promise<this>;
|
once(event: ProviderEvent, listener: Listener): Promise<this>;
|
||||||
@ -206,10 +392,35 @@ export declare class AbstractProvider implements Provider {
|
|||||||
removeAllListeners(event?: ProviderEvent): Promise<this>;
|
removeAllListeners(event?: ProviderEvent): Promise<this>;
|
||||||
addListener(event: ProviderEvent, listener: Listener): Promise<this>;
|
addListener(event: ProviderEvent, listener: Listener): Promise<this>;
|
||||||
removeListener(event: ProviderEvent, listener: Listener): Promise<this>;
|
removeListener(event: ProviderEvent, listener: Listener): Promise<this>;
|
||||||
|
/**
|
||||||
|
* Sub-classes may use this to shutdown any sockets or release their
|
||||||
|
* resources.
|
||||||
|
*
|
||||||
|
* Sub-classes **must** call ``super.destroy()``.
|
||||||
|
*/
|
||||||
destroy(): void;
|
destroy(): void;
|
||||||
|
/**
|
||||||
|
* Whether the provider is currently paused.
|
||||||
|
*
|
||||||
|
* A paused provider will not emit any events, and generally should
|
||||||
|
* not make any requests to the network, but that is up to sub-classes
|
||||||
|
* to manage.
|
||||||
|
*
|
||||||
|
* Setting ``paused = true`` is identical to calling ``.pause(false)``,
|
||||||
|
* which will buffer any events that occur while paused until the
|
||||||
|
* provider is unpaused.
|
||||||
|
*/
|
||||||
get paused(): boolean;
|
get paused(): boolean;
|
||||||
set paused(pause: boolean);
|
set paused(pause: boolean);
|
||||||
|
/**
|
||||||
|
* Pause the provider. If %%dropWhilePaused%%, any events that occur
|
||||||
|
* while paused are dropped, otherwise all events will be emitted once
|
||||||
|
* the provider is unpaused.
|
||||||
|
*/
|
||||||
pause(dropWhilePaused?: boolean): void;
|
pause(dropWhilePaused?: boolean): void;
|
||||||
|
/**
|
||||||
|
* Resume the provider.
|
||||||
|
*/
|
||||||
resume(): void;
|
resume(): void;
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=abstract-provider.d.ts.map
|
//# sourceMappingURL=abstract-provider.d.ts.map
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
/**
|
/**
|
||||||
* About Subclassing the Provider...
|
* The available providers should suffice for most developers purposes,
|
||||||
|
* but the [[AbstractProvider]] class has many features which enable
|
||||||
|
* sub-classing it for specific purposes.
|
||||||
*
|
*
|
||||||
* @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider]
|
* @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider]
|
||||||
*/
|
*/
|
||||||
@ -53,8 +55,19 @@ function getTag(prefix, value) {
|
|||||||
return v;
|
return v;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* An **UnmanagedSubscriber** is useful for events which do not require
|
||||||
|
* any additional management, such as ``"debug"`` which only requires
|
||||||
|
* emit in synchronous event loop triggered calls.
|
||||||
|
*/
|
||||||
class UnmanagedSubscriber {
|
class UnmanagedSubscriber {
|
||||||
|
/**
|
||||||
|
* The name fof the event.
|
||||||
|
*/
|
||||||
name;
|
name;
|
||||||
|
/**
|
||||||
|
* Create a new UnmanagedSubscriber with %%name%%.
|
||||||
|
*/
|
||||||
constructor(name) { (0, index_js_6.defineProperties)(this, { name }); }
|
constructor(name) { (0, index_js_6.defineProperties)(this, { name }); }
|
||||||
start() { }
|
start() { }
|
||||||
stop() { }
|
stop() { }
|
||||||
@ -140,6 +153,12 @@ async function getSubscription(_event, provider) {
|
|||||||
(0, index_js_6.assertArgument)(false, "unknown ProviderEvent", "event", _event);
|
(0, index_js_6.assertArgument)(false, "unknown ProviderEvent", "event", _event);
|
||||||
}
|
}
|
||||||
function getTime() { return (new Date()).getTime(); }
|
function getTime() { return (new Date()).getTime(); }
|
||||||
|
/**
|
||||||
|
* An **AbstractProvider** provides a base class for other sub-classes to
|
||||||
|
* implement the [[Provider]] API by normalizing input arguments and
|
||||||
|
* formatting output results as well as tracking events for consistent
|
||||||
|
* behaviour on an eventually-consistent network.
|
||||||
|
*/
|
||||||
class AbstractProvider {
|
class AbstractProvider {
|
||||||
#subs;
|
#subs;
|
||||||
#plugins;
|
#plugins;
|
||||||
@ -153,8 +172,11 @@ class AbstractProvider {
|
|||||||
#nextTimer;
|
#nextTimer;
|
||||||
#timers;
|
#timers;
|
||||||
#disableCcipRead;
|
#disableCcipRead;
|
||||||
// @TODO: This should be a () => Promise<Network> so network can be
|
/**
|
||||||
// done when needed; or rely entirely on _detectNetwork?
|
* Create a new **AbstractProvider** connected to %%network%%, or
|
||||||
|
* use the various network detection capabilities to discover the
|
||||||
|
* [[Network]] if necessary.
|
||||||
|
*/
|
||||||
constructor(_network) {
|
constructor(_network) {
|
||||||
if (_network === "any") {
|
if (_network === "any") {
|
||||||
this.#anyNetwork = true;
|
this.#anyNetwork = true;
|
||||||
@ -179,10 +201,20 @@ class AbstractProvider {
|
|||||||
this.#timers = new Map();
|
this.#timers = new Map();
|
||||||
this.#disableCcipRead = false;
|
this.#disableCcipRead = false;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns ``this``, to allow an **AbstractProvider** to implement
|
||||||
|
* the [[ContractRunner]] interface.
|
||||||
|
*/
|
||||||
get provider() { return this; }
|
get provider() { return this; }
|
||||||
|
/**
|
||||||
|
* Returns all the registered plug-ins.
|
||||||
|
*/
|
||||||
get plugins() {
|
get plugins() {
|
||||||
return Array.from(this.#plugins.values());
|
return Array.from(this.#plugins.values());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Attach a new plug-in.
|
||||||
|
*/
|
||||||
attachPlugin(plugin) {
|
attachPlugin(plugin) {
|
||||||
if (this.#plugins.get(plugin.name)) {
|
if (this.#plugins.get(plugin.name)) {
|
||||||
throw new Error(`cannot replace existing plugin: ${plugin.name} `);
|
throw new Error(`cannot replace existing plugin: ${plugin.name} `);
|
||||||
@ -190,9 +222,16 @@ class AbstractProvider {
|
|||||||
this.#plugins.set(plugin.name, plugin.connect(this));
|
this.#plugins.set(plugin.name, plugin.connect(this));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get a plugin by name.
|
||||||
|
*/
|
||||||
getPlugin(name) {
|
getPlugin(name) {
|
||||||
return (this.#plugins.get(name)) || null;
|
return (this.#plugins.get(name)) || null;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Prevent any CCIP-read operation, regardless of whether requested
|
||||||
|
* in a [[call]] using ``enableCcipRead``.
|
||||||
|
*/
|
||||||
get disableCcipRead() { return this.#disableCcipRead; }
|
get disableCcipRead() { return this.#disableCcipRead; }
|
||||||
set disableCcipRead(value) { this.#disableCcipRead = !!value; }
|
set disableCcipRead(value) { this.#disableCcipRead = !!value; }
|
||||||
// Shares multiple identical requests made during the same 250ms
|
// Shares multiple identical requests made during the same 250ms
|
||||||
@ -211,6 +250,9 @@ class AbstractProvider {
|
|||||||
}
|
}
|
||||||
return await perform;
|
return await perform;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Resolves to the data for executing the CCIP-read operations.
|
||||||
|
*/
|
||||||
async ccipReadFetch(tx, calldata, urls) {
|
async ccipReadFetch(tx, calldata, urls) {
|
||||||
if (this.disableCcipRead || urls.length === 0 || tx.to == null) {
|
if (this.disableCcipRead || urls.length === 0 || tx.to == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -257,25 +299,55 @@ class AbstractProvider {
|
|||||||
transaction: tx, info: { urls, errorMessages }
|
transaction: tx, info: { urls, errorMessages }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Provides the opportunity for a sub-class to wrap a block before
|
||||||
|
* returning it, to add additional properties or an alternate
|
||||||
|
* sub-class of [[Block]].
|
||||||
|
*/
|
||||||
_wrapBlock(value, network) {
|
_wrapBlock(value, network) {
|
||||||
return new provider_js_1.Block((0, format_js_1.formatBlock)(value), this);
|
return new provider_js_1.Block((0, format_js_1.formatBlock)(value), this);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Provides the opportunity for a sub-class to wrap a log before
|
||||||
|
* returning it, to add additional properties or an alternate
|
||||||
|
* sub-class of [[Log]].
|
||||||
|
*/
|
||||||
_wrapLog(value, network) {
|
_wrapLog(value, network) {
|
||||||
return new provider_js_1.Log((0, format_js_1.formatLog)(value), this);
|
return new provider_js_1.Log((0, format_js_1.formatLog)(value), this);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Provides the opportunity for a sub-class to wrap a transaction
|
||||||
|
* receipt before returning it, to add additional properties or an
|
||||||
|
* alternate sub-class of [[TransactionReceipt]].
|
||||||
|
*/
|
||||||
_wrapTransactionReceipt(value, network) {
|
_wrapTransactionReceipt(value, network) {
|
||||||
return new provider_js_1.TransactionReceipt((0, format_js_1.formatTransactionReceipt)(value), this);
|
return new provider_js_1.TransactionReceipt((0, format_js_1.formatTransactionReceipt)(value), this);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Provides the opportunity for a sub-class to wrap a transaction
|
||||||
|
* response before returning it, to add additional properties or an
|
||||||
|
* alternate sub-class of [[TransactionResponse]].
|
||||||
|
*/
|
||||||
_wrapTransactionResponse(tx, network) {
|
_wrapTransactionResponse(tx, network) {
|
||||||
return new provider_js_1.TransactionResponse((0, format_js_1.formatTransactionResponse)(tx), this);
|
return new provider_js_1.TransactionResponse((0, format_js_1.formatTransactionResponse)(tx), this);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Resolves to the Network, forcing a network detection using whatever
|
||||||
|
* technique the sub-class requires.
|
||||||
|
*
|
||||||
|
* Sub-classes **must** override this.
|
||||||
|
*/
|
||||||
_detectNetwork() {
|
_detectNetwork() {
|
||||||
(0, index_js_6.assert)(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", {
|
(0, index_js_6.assert)(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", {
|
||||||
operation: "_detectNetwork"
|
operation: "_detectNetwork"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Sub-classes should override this and handle PerformActionRequest requests, calling
|
/**
|
||||||
// the super for any unhandled actions.
|
* Sub-classes should use this to perform all built-in operations. All
|
||||||
|
* methods sanitizes and normalizes the values passed into this.
|
||||||
|
*
|
||||||
|
* Sub-classes **must** override this.
|
||||||
|
*/
|
||||||
async _perform(req) {
|
async _perform(req) {
|
||||||
(0, index_js_6.assert)(false, `unsupported method: ${req.method}`, "UNSUPPORTED_OPERATION", {
|
(0, index_js_6.assert)(false, `unsupported method: ${req.method}`, "UNSUPPORTED_OPERATION", {
|
||||||
operation: req.method,
|
operation: req.method,
|
||||||
@ -290,9 +362,18 @@ class AbstractProvider {
|
|||||||
}
|
}
|
||||||
return blockNumber;
|
return blockNumber;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns or resolves to the address for %%address%%, resolving ENS
|
||||||
|
* names and [[Addressable]] objects and returning if already an
|
||||||
|
* address.
|
||||||
|
*/
|
||||||
_getAddress(address) {
|
_getAddress(address) {
|
||||||
return (0, index_js_1.resolveAddress)(address, this);
|
return (0, index_js_1.resolveAddress)(address, this);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns or resolves to a valid block tag for %%blockTag%%, resolving
|
||||||
|
* negative values and returning if already a valid block tag.
|
||||||
|
*/
|
||||||
_getBlockTag(blockTag) {
|
_getBlockTag(blockTag) {
|
||||||
if (blockTag == null) {
|
if (blockTag == null) {
|
||||||
return "latest";
|
return "latest";
|
||||||
@ -326,6 +407,11 @@ class AbstractProvider {
|
|||||||
}
|
}
|
||||||
(0, index_js_6.assertArgument)(false, "invalid blockTag", "blockTag", blockTag);
|
(0, index_js_6.assertArgument)(false, "invalid blockTag", "blockTag", blockTag);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns or resolves to a filter for %%filter%%, resolving any ENS
|
||||||
|
* names or [[Addressable]] object and returning if already a valid
|
||||||
|
* filter.
|
||||||
|
*/
|
||||||
_getFilter(filter) {
|
_getFilter(filter) {
|
||||||
// Create a canonical representation of the topics
|
// Create a canonical representation of the topics
|
||||||
const topics = (filter.topics || []).map((t) => {
|
const topics = (filter.topics || []).map((t) => {
|
||||||
@ -401,6 +487,11 @@ class AbstractProvider {
|
|||||||
}
|
}
|
||||||
return resolve(address, fromBlock, toBlock);
|
return resolve(address, fromBlock, toBlock);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns or resovles to a transaction for %%request%%, resolving
|
||||||
|
* any ENS names or [[Addressable]] and returning if already a valid
|
||||||
|
* transaction.
|
||||||
|
*/
|
||||||
_getTransactionRequest(_request) {
|
_getTransactionRequest(_request) {
|
||||||
const request = (0, provider_js_1.copyRequest)(_request);
|
const request = (0, provider_js_1.copyRequest)(_request);
|
||||||
const promises = [];
|
const promises = [];
|
||||||
@ -730,7 +821,7 @@ class AbstractProvider {
|
|||||||
"function resolver(bytes32) view returns (address)"
|
"function resolver(bytes32) view returns (address)"
|
||||||
], this);
|
], this);
|
||||||
const resolver = await ensContract.resolver(node);
|
const resolver = await ensContract.resolver(node);
|
||||||
if (resolver == null || resolver === index_js_2.ZeroHash) {
|
if (resolver == null || resolver === index_js_2.ZeroAddress) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const resolverContract = new index_js_3.Contract(resolver, [
|
const resolverContract = new index_js_3.Contract(resolver, [
|
||||||
@ -802,6 +893,9 @@ class AbstractProvider {
|
|||||||
operation: "waitForBlock"
|
operation: "waitForBlock"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Clear a timer created using the [[_setTimeout]] method.
|
||||||
|
*/
|
||||||
_clearTimeout(timerId) {
|
_clearTimeout(timerId) {
|
||||||
const timer = this.#timers.get(timerId);
|
const timer = this.#timers.get(timerId);
|
||||||
if (!timer) {
|
if (!timer) {
|
||||||
@ -812,6 +906,14 @@ class AbstractProvider {
|
|||||||
}
|
}
|
||||||
this.#timers.delete(timerId);
|
this.#timers.delete(timerId);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Create a timer that will execute %%func%% after at least %%timeout%%
|
||||||
|
* (in ms). If %%timeout%% is unspecified, then %%func%% will execute
|
||||||
|
* in the next event loop.
|
||||||
|
*
|
||||||
|
* [Pausing](AbstractProvider-paused) the provider will pause any
|
||||||
|
* associated timers.
|
||||||
|
*/
|
||||||
_setTimeout(_func, timeout) {
|
_setTimeout(_func, timeout) {
|
||||||
if (timeout == null) {
|
if (timeout == null) {
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
@ -830,13 +932,18 @@ class AbstractProvider {
|
|||||||
}
|
}
|
||||||
return timerId;
|
return timerId;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Perform %%func%% on each subscriber.
|
||||||
|
*/
|
||||||
_forEachSubscriber(func) {
|
_forEachSubscriber(func) {
|
||||||
for (const sub of this.#subs.values()) {
|
for (const sub of this.#subs.values()) {
|
||||||
func(sub.subscriber);
|
func(sub.subscriber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Event API; sub-classes should override this; any supported
|
/**
|
||||||
// event filter will have been munged into an EventFilter
|
* Sub-classes may override this to customize subscription
|
||||||
|
* implementations.
|
||||||
|
*/
|
||||||
_getSubscriber(sub) {
|
_getSubscriber(sub) {
|
||||||
switch (sub.type) {
|
switch (sub.type) {
|
||||||
case "debug":
|
case "debug":
|
||||||
@ -854,6 +961,15 @@ class AbstractProvider {
|
|||||||
}
|
}
|
||||||
throw new Error(`unsupported event: ${sub.type}`);
|
throw new Error(`unsupported event: ${sub.type}`);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* If a [[Subscriber]] fails and needs to replace itself, this
|
||||||
|
* method may be used.
|
||||||
|
*
|
||||||
|
* For example, this is used for providers when using the
|
||||||
|
* ``eth_getFilterChanges`` method, which can return null if state
|
||||||
|
* filters are not supported by the backend, allowing the Subscriber
|
||||||
|
* to swap in a [[PollingEventSubscriber]].
|
||||||
|
*/
|
||||||
_recoverSubscriber(oldSub, newSub) {
|
_recoverSubscriber(oldSub, newSub) {
|
||||||
for (const sub of this.#subs.values()) {
|
for (const sub of this.#subs.values()) {
|
||||||
if (sub.subscriber === oldSub) {
|
if (sub.subscriber === oldSub) {
|
||||||
@ -1016,8 +1132,12 @@ class AbstractProvider {
|
|||||||
async removeListener(event, listener) {
|
async removeListener(event, listener) {
|
||||||
return this.off(event, listener);
|
return this.off(event, listener);
|
||||||
}
|
}
|
||||||
// Sub-classes should override this to shutdown any sockets, etc.
|
/**
|
||||||
// but MUST call this super.shutdown.
|
* Sub-classes may use this to shutdown any sockets or release their
|
||||||
|
* resources.
|
||||||
|
*
|
||||||
|
* Sub-classes **must** call ``super.destroy()``.
|
||||||
|
*/
|
||||||
destroy() {
|
destroy() {
|
||||||
// Stop all listeners
|
// Stop all listeners
|
||||||
this.removeAllListeners();
|
this.removeAllListeners();
|
||||||
@ -1026,6 +1146,17 @@ class AbstractProvider {
|
|||||||
this._clearTimeout(timerId);
|
this._clearTimeout(timerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Whether the provider is currently paused.
|
||||||
|
*
|
||||||
|
* A paused provider will not emit any events, and generally should
|
||||||
|
* not make any requests to the network, but that is up to sub-classes
|
||||||
|
* to manage.
|
||||||
|
*
|
||||||
|
* Setting ``paused = true`` is identical to calling ``.pause(false)``,
|
||||||
|
* which will buffer any events that occur while paused until the
|
||||||
|
* provider is unpaused.
|
||||||
|
*/
|
||||||
get paused() { return (this.#pausedState != null); }
|
get paused() { return (this.#pausedState != null); }
|
||||||
set paused(pause) {
|
set paused(pause) {
|
||||||
if (!!pause === this.paused) {
|
if (!!pause === this.paused) {
|
||||||
@ -1038,6 +1169,11 @@ class AbstractProvider {
|
|||||||
this.pause(false);
|
this.pause(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Pause the provider. If %%dropWhilePaused%%, any events that occur
|
||||||
|
* while paused are dropped, otherwise all events will be emitted once
|
||||||
|
* the provider is unpaused.
|
||||||
|
*/
|
||||||
pause(dropWhilePaused) {
|
pause(dropWhilePaused) {
|
||||||
this.#lastBlockNumber = -1;
|
this.#lastBlockNumber = -1;
|
||||||
if (this.#pausedState != null) {
|
if (this.#pausedState != null) {
|
||||||
@ -1059,6 +1195,9 @@ class AbstractProvider {
|
|||||||
timer.time = getTime() - timer.time;
|
timer.time = getTime() - timer.time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Resume the provider.
|
||||||
|
*/
|
||||||
resume() {
|
resume() {
|
||||||
if (this.#pausedState == null) {
|
if (this.#pausedState == null) {
|
||||||
return;
|
return;
|
||||||
|
File diff suppressed because one or more lines are too long
36
lib.commonjs/providers/abstract-signer.d.ts
vendored
36
lib.commonjs/providers/abstract-signer.d.ts
vendored
@ -2,10 +2,31 @@ import type { TypedDataDomain, TypedDataField } from "../hash/index.js";
|
|||||||
import type { TransactionLike } from "../transaction/index.js";
|
import type { TransactionLike } from "../transaction/index.js";
|
||||||
import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js";
|
import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js";
|
||||||
import type { Signer } from "./signer.js";
|
import type { Signer } from "./signer.js";
|
||||||
|
/**
|
||||||
|
* An **AbstractSigner** includes most of teh functionality required
|
||||||
|
* to get a [[Signer]] working as expected, but requires a few
|
||||||
|
* Signer-specific methods be overridden.
|
||||||
|
*
|
||||||
|
*/
|
||||||
export declare abstract class AbstractSigner<P extends null | Provider = null | Provider> implements Signer {
|
export declare abstract class AbstractSigner<P extends null | Provider = null | Provider> implements Signer {
|
||||||
|
/**
|
||||||
|
* The provider this signer is connected to.
|
||||||
|
*/
|
||||||
readonly provider: P;
|
readonly provider: P;
|
||||||
|
/**
|
||||||
|
* Creates a new Signer connected to %%provider%%.
|
||||||
|
*/
|
||||||
constructor(provider?: P);
|
constructor(provider?: P);
|
||||||
|
/**
|
||||||
|
* Resolves to the Signer address.
|
||||||
|
*/
|
||||||
abstract getAddress(): Promise<string>;
|
abstract getAddress(): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Returns the signer connected to %%provider%%.
|
||||||
|
*
|
||||||
|
* This may throw, for example, a Signer connected over a Socket or
|
||||||
|
* to a specific instance of a node may not be transferrable.
|
||||||
|
*/
|
||||||
abstract connect(provider: null | Provider): Signer;
|
abstract connect(provider: null | Provider): Signer;
|
||||||
getNonce(blockTag?: BlockTag): Promise<number>;
|
getNonce(blockTag?: BlockTag): Promise<number>;
|
||||||
populateCall(tx: TransactionRequest): Promise<TransactionLike<string>>;
|
populateCall(tx: TransactionRequest): Promise<TransactionLike<string>>;
|
||||||
@ -18,9 +39,24 @@ export declare abstract class AbstractSigner<P extends null | Provider = null |
|
|||||||
abstract signMessage(message: string | Uint8Array): Promise<string>;
|
abstract signMessage(message: string | Uint8Array): Promise<string>;
|
||||||
abstract signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
|
abstract signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A **VoidSigner** is a class deisgned to allow an address to be used
|
||||||
|
* in any API which accepts a Signer, but for which there are no
|
||||||
|
* credentials available to perform any actual signing.
|
||||||
|
*
|
||||||
|
* This for example allow impersonating an account for the purpose of
|
||||||
|
* static calls or estimating gas, but does not allow sending transactions.
|
||||||
|
*/
|
||||||
export declare class VoidSigner extends AbstractSigner {
|
export declare class VoidSigner extends AbstractSigner {
|
||||||
#private;
|
#private;
|
||||||
|
/**
|
||||||
|
* The signer address.
|
||||||
|
*/
|
||||||
readonly address: string;
|
readonly address: string;
|
||||||
|
/**
|
||||||
|
* Creates a new **VoidSigner** with %%address%% attached to
|
||||||
|
* %%provider%%.
|
||||||
|
*/
|
||||||
constructor(address: string, provider?: null | Provider);
|
constructor(address: string, provider?: null | Provider);
|
||||||
getAddress(): Promise<string>;
|
getAddress(): Promise<string>;
|
||||||
connect(provider: null | Provider): VoidSigner;
|
connect(provider: null | Provider): VoidSigner;
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"abstract-signer.d.ts","sourceRoot":"","sources":["../../src.ts/providers/abstract-signer.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EACR,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EAC9D,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA+B1C,8BAAsB,cAAc,CAAC,CAAC,SAAS,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAAE,YAAW,MAAM;IAC/F,QAAQ,CAAC,QAAQ,EAAG,CAAC,CAAC;gBAEV,QAAQ,CAAC,EAAE,CAAC;IAIxB,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IACtC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,MAAM;IAE7C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OA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AK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAG1I"}
|
@ -2,7 +2,9 @@
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.VoidSigner = exports.AbstractSigner = void 0;
|
exports.VoidSigner = exports.AbstractSigner = void 0;
|
||||||
/**
|
/**
|
||||||
* About Abstract Signer and subclassing
|
* Generally the [[Wallet]] and [[JsonRpcSigner]] and their sub-classes
|
||||||
|
* are sufficent for most developers, but this is provided to
|
||||||
|
* fascilitate more complex Signers.
|
||||||
*
|
*
|
||||||
* @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer]
|
* @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer]
|
||||||
*/
|
*/
|
||||||
@ -36,8 +38,20 @@ async function populate(signer, tx) {
|
|||||||
}
|
}
|
||||||
return await (0, index_js_3.resolveProperties)(pop);
|
return await (0, index_js_3.resolveProperties)(pop);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* An **AbstractSigner** includes most of teh functionality required
|
||||||
|
* to get a [[Signer]] working as expected, but requires a few
|
||||||
|
* Signer-specific methods be overridden.
|
||||||
|
*
|
||||||
|
*/
|
||||||
class AbstractSigner {
|
class AbstractSigner {
|
||||||
|
/**
|
||||||
|
* The provider this signer is connected to.
|
||||||
|
*/
|
||||||
provider;
|
provider;
|
||||||
|
/**
|
||||||
|
* Creates a new Signer connected to %%provider%%.
|
||||||
|
*/
|
||||||
constructor(provider) {
|
constructor(provider) {
|
||||||
(0, index_js_3.defineProperties)(this, { provider: (provider || null) });
|
(0, index_js_3.defineProperties)(this, { provider: (provider || null) });
|
||||||
}
|
}
|
||||||
@ -172,8 +186,23 @@ class AbstractSigner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.AbstractSigner = AbstractSigner;
|
exports.AbstractSigner = AbstractSigner;
|
||||||
|
/**
|
||||||
|
* A **VoidSigner** is a class deisgned to allow an address to be used
|
||||||
|
* in any API which accepts a Signer, but for which there are no
|
||||||
|
* credentials available to perform any actual signing.
|
||||||
|
*
|
||||||
|
* This for example allow impersonating an account for the purpose of
|
||||||
|
* static calls or estimating gas, but does not allow sending transactions.
|
||||||
|
*/
|
||||||
class VoidSigner extends AbstractSigner {
|
class VoidSigner extends AbstractSigner {
|
||||||
|
/**
|
||||||
|
* The signer address.
|
||||||
|
*/
|
||||||
address;
|
address;
|
||||||
|
/**
|
||||||
|
* Creates a new **VoidSigner** with %%address%% attached to
|
||||||
|
* %%provider%%.
|
||||||
|
*/
|
||||||
constructor(address, provider) {
|
constructor(address, provider) {
|
||||||
super(provider);
|
super(provider);
|
||||||
(0, index_js_3.defineProperties)(this, { address });
|
(0, index_js_3.defineProperties)(this, { address });
|
||||||
|
File diff suppressed because one or more lines are too long
27
lib.commonjs/providers/contracts.d.ts
vendored
27
lib.commonjs/providers/contracts.d.ts
vendored
@ -1,9 +1,36 @@
|
|||||||
import type { Provider, TransactionRequest, TransactionResponse } from "./provider.js";
|
import type { Provider, TransactionRequest, TransactionResponse } from "./provider.js";
|
||||||
|
/**
|
||||||
|
* A **ContractRunner** is a generic interface which defines an object
|
||||||
|
* capable of interacting with a Contract on the network.
|
||||||
|
*
|
||||||
|
* The more operations supported, the more utility it is capable of.
|
||||||
|
*
|
||||||
|
* The most common ContractRunners are [Providers](Provider) which enable
|
||||||
|
* read-only access and [Signers](Signer) which enable write-access.
|
||||||
|
*/
|
||||||
export interface ContractRunner {
|
export interface ContractRunner {
|
||||||
|
/**
|
||||||
|
* The provider used for necessary state querying operations.
|
||||||
|
*
|
||||||
|
* This can also point to the **ContractRunner** itself, in the
|
||||||
|
* case of an [[AbstractProvider]].
|
||||||
|
*/
|
||||||
provider: null | Provider;
|
provider: null | Provider;
|
||||||
|
/**
|
||||||
|
* Required to estimate gas.
|
||||||
|
*/
|
||||||
estimateGas?: (tx: TransactionRequest) => Promise<bigint>;
|
estimateGas?: (tx: TransactionRequest) => Promise<bigint>;
|
||||||
|
/**
|
||||||
|
* Required for pure, view or static calls to contracts.
|
||||||
|
*/
|
||||||
call?: (tx: TransactionRequest) => Promise<string>;
|
call?: (tx: TransactionRequest) => Promise<string>;
|
||||||
|
/**
|
||||||
|
* Required to support ENS names
|
||||||
|
*/
|
||||||
resolveName?: (name: string) => Promise<null | string>;
|
resolveName?: (name: string) => Promise<null | string>;
|
||||||
|
/**
|
||||||
|
* Required for state mutating calls
|
||||||
|
*/
|
||||||
sendTransaction?: (tx: TransactionRequest) => Promise<TransactionResponse>;
|
sendTransaction?: (tx: TransactionRequest) => Promise<TransactionResponse>;
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=contracts.d.ts.map
|
//# sourceMappingURL=contracts.d.ts.map
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src.ts/providers/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EACpD,MAAM,eAAe,CAAC;AAIvB,MAAM,WAAW,cAAc;IAC3B,QAAQ,EAAE,IAAI,GAAG,QAAQ,CAAC;IAG1B,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAG1D,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAGnD,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAGvD,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC9E"}
|
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src.ts/providers/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EACpD,MAAM,eAAe,CAAC;AAEvB;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC3B;;;;;OAKG;IACH,QAAQ,EAAE,IAAI,GAAG,QAAQ,CAAC;IAE1B;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1D;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnD;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAEvD;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC9E"}
|
40
lib.commonjs/providers/ens-resolver.d.ts
vendored
40
lib.commonjs/providers/ens-resolver.d.ts
vendored
@ -1,5 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* About ENS Resolver
|
* ENS is a service which allows easy-to-remember names to map to
|
||||||
|
* network addresses.
|
||||||
*
|
*
|
||||||
* @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver]
|
* @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver]
|
||||||
*/
|
*/
|
||||||
@ -14,7 +15,13 @@ export type AvatarLinkageType = "name" | "avatar" | "!avatar" | "url" | "data" |
|
|||||||
* An individual record for each step during avatar resolution.
|
* An individual record for each step during avatar resolution.
|
||||||
*/
|
*/
|
||||||
export interface AvatarLinkage {
|
export interface AvatarLinkage {
|
||||||
|
/**
|
||||||
|
* The type of linkage.
|
||||||
|
*/
|
||||||
type: AvatarLinkageType;
|
type: AvatarLinkageType;
|
||||||
|
/**
|
||||||
|
* The linkage value.
|
||||||
|
*/
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -26,24 +33,53 @@ export interface AvatarLinkage {
|
|||||||
* each completed step during avatar resolution.
|
* each completed step during avatar resolution.
|
||||||
*/
|
*/
|
||||||
export interface AvatarResult {
|
export interface AvatarResult {
|
||||||
|
/**
|
||||||
|
* How the [[url]] was arrived at, resolving the many steps required
|
||||||
|
* for an avatar URL.
|
||||||
|
*/
|
||||||
linkage: Array<AvatarLinkage>;
|
linkage: Array<AvatarLinkage>;
|
||||||
|
/**
|
||||||
|
* The avatar URL or null if the avatar was not set, or there was
|
||||||
|
* an issue during validation (such as the address not owning the
|
||||||
|
* avatar or a metadata error).
|
||||||
|
*/
|
||||||
url: null | string;
|
url: null | string;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* A provider plugin super-class for processing multicoin address types.
|
* A provider plugin super-class for processing multicoin address types.
|
||||||
*/
|
*/
|
||||||
export declare abstract class MulticoinProviderPlugin implements AbstractProviderPlugin {
|
export declare abstract class MulticoinProviderPlugin implements AbstractProviderPlugin {
|
||||||
|
/**
|
||||||
|
* The name.
|
||||||
|
*/
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
|
/**
|
||||||
|
* Creates a new **MulticoinProviderPluing** for %%name%%.
|
||||||
|
*/
|
||||||
constructor(name: string);
|
constructor(name: string);
|
||||||
connect(proivder: Provider): MulticoinProviderPlugin;
|
connect(proivder: Provider): MulticoinProviderPlugin;
|
||||||
|
/**
|
||||||
|
* Returns ``true`` if %%coinType%% is supported by this plugin.
|
||||||
|
*/
|
||||||
supportsCoinType(coinType: number): boolean;
|
supportsCoinType(coinType: number): boolean;
|
||||||
|
/**
|
||||||
|
* Resovles to the encoded %%address%% for %%coinType%%.
|
||||||
|
*/
|
||||||
encodeAddress(coinType: number, address: string): Promise<string>;
|
encodeAddress(coinType: number, address: string): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Resovles to the decoded %%data%% for %%coinType%%.
|
||||||
|
*/
|
||||||
decodeAddress(coinType: number, data: BytesLike): Promise<string>;
|
decodeAddress(coinType: number, data: BytesLike): Promise<string>;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* A basic multicoin provider plugin.
|
* A **BasicMulticoinProviderPlugin** provides service for common
|
||||||
|
* coin types, which do not require additional libraries to encode or
|
||||||
|
* decode.
|
||||||
*/
|
*/
|
||||||
export declare class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin {
|
export declare class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin {
|
||||||
|
/**
|
||||||
|
* Creates a new **BasicMulticoinProviderPlugin**.
|
||||||
|
*/
|
||||||
constructor();
|
constructor();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"ens-resolver.d.ts","sourceRoot":"","sources":["../../src.ts/providers/ens-resolver.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEvF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAgB9C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GACnF,QAAQ,GAAG,SAAS,GAAG,cAAc,GAAG,eAAe,GACvD,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAC3C,mBAAmB,GAAG,uBAAuB,GAAG,cAAc,GAAG,eAAe,GAChF,WAAW,GAAG,UAAU,GACxB,WAAW,GAAG,eAAe,GAAG,UAAU,GAAG,gBAAgB,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,MA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EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAoC/D;;;OAGG;WACU,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,WAAW,CAAC;CA2B/F"}
|
@ -1,6 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
/**
|
/**
|
||||||
* About ENS Resolver
|
* ENS is a service which allows easy-to-remember names to map to
|
||||||
|
* network addresses.
|
||||||
*
|
*
|
||||||
* @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver]
|
* @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver]
|
||||||
*/
|
*/
|
||||||
@ -30,19 +31,34 @@ function getIpfsLink(link) {
|
|||||||
* A provider plugin super-class for processing multicoin address types.
|
* A provider plugin super-class for processing multicoin address types.
|
||||||
*/
|
*/
|
||||||
class MulticoinProviderPlugin {
|
class MulticoinProviderPlugin {
|
||||||
|
/**
|
||||||
|
* The name.
|
||||||
|
*/
|
||||||
name;
|
name;
|
||||||
|
/**
|
||||||
|
* Creates a new **MulticoinProviderPluing** for %%name%%.
|
||||||
|
*/
|
||||||
constructor(name) {
|
constructor(name) {
|
||||||
(0, index_js_4.defineProperties)(this, { name });
|
(0, index_js_4.defineProperties)(this, { name });
|
||||||
}
|
}
|
||||||
connect(proivder) {
|
connect(proivder) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns ``true`` if %%coinType%% is supported by this plugin.
|
||||||
|
*/
|
||||||
supportsCoinType(coinType) {
|
supportsCoinType(coinType) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Resovles to the encoded %%address%% for %%coinType%%.
|
||||||
|
*/
|
||||||
async encodeAddress(coinType, address) {
|
async encodeAddress(coinType, address) {
|
||||||
throw new Error("unsupported coin");
|
throw new Error("unsupported coin");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Resovles to the decoded %%data%% for %%coinType%%.
|
||||||
|
*/
|
||||||
async decodeAddress(coinType, data) {
|
async decodeAddress(coinType, data) {
|
||||||
throw new Error("unsupported coin");
|
throw new Error("unsupported coin");
|
||||||
}
|
}
|
||||||
@ -50,9 +66,14 @@ class MulticoinProviderPlugin {
|
|||||||
exports.MulticoinProviderPlugin = MulticoinProviderPlugin;
|
exports.MulticoinProviderPlugin = MulticoinProviderPlugin;
|
||||||
const BasicMulticoinPluginId = "org.ethers.plugins.provider.BasicMulticoin";
|
const BasicMulticoinPluginId = "org.ethers.plugins.provider.BasicMulticoin";
|
||||||
/**
|
/**
|
||||||
* A basic multicoin provider plugin.
|
* A **BasicMulticoinProviderPlugin** provides service for common
|
||||||
|
* coin types, which do not require additional libraries to encode or
|
||||||
|
* decode.
|
||||||
*/
|
*/
|
||||||
class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin {
|
class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin {
|
||||||
|
/**
|
||||||
|
* Creates a new **BasicMulticoinProviderPlugin**.
|
||||||
|
*/
|
||||||
constructor() {
|
constructor() {
|
||||||
super(BasicMulticoinPluginId);
|
super(BasicMulticoinPluginId);
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
198
lib.commonjs/providers/formatting.d.ts
vendored
198
lib.commonjs/providers/formatting.d.ts
vendored
@ -5,66 +5,264 @@
|
|||||||
*/
|
*/
|
||||||
import type { Signature } from "../crypto/index.js";
|
import type { Signature } from "../crypto/index.js";
|
||||||
import type { AccessList } from "../transaction/index.js";
|
import type { AccessList } from "../transaction/index.js";
|
||||||
|
/**
|
||||||
|
* a **BlockParams** encodes the minimal required properties for a
|
||||||
|
* formatted block.
|
||||||
|
*/
|
||||||
export interface BlockParams {
|
export interface BlockParams {
|
||||||
|
/**
|
||||||
|
* The block hash.
|
||||||
|
*/
|
||||||
hash?: null | string;
|
hash?: null | string;
|
||||||
|
/**
|
||||||
|
* The block number.
|
||||||
|
*/
|
||||||
number: number;
|
number: number;
|
||||||
|
/**
|
||||||
|
* The timestamp for this block, which is the number of seconds
|
||||||
|
* since epoch that this block was included.
|
||||||
|
*/
|
||||||
timestamp: number;
|
timestamp: number;
|
||||||
|
/**
|
||||||
|
* The hash of the previous block in the blockchain. The genesis block
|
||||||
|
* has the parentHash of the [[ZeroHash]].
|
||||||
|
*/
|
||||||
parentHash: string;
|
parentHash: string;
|
||||||
|
/**
|
||||||
|
* A random sequence provided during the mining process for
|
||||||
|
* proof-of-work networks.
|
||||||
|
*/
|
||||||
nonce: string;
|
nonce: string;
|
||||||
|
/**
|
||||||
|
* For proof-of-work networks, the difficulty target is used to
|
||||||
|
* adjust the difficulty in mining to ensure a expected block rate.
|
||||||
|
*/
|
||||||
difficulty: bigint;
|
difficulty: bigint;
|
||||||
|
/**
|
||||||
|
* The maximum amount of gas a block can consume.
|
||||||
|
*/
|
||||||
gasLimit: bigint;
|
gasLimit: bigint;
|
||||||
|
/**
|
||||||
|
* The amount of gas a block consumed.
|
||||||
|
*/
|
||||||
gasUsed: bigint;
|
gasUsed: bigint;
|
||||||
|
/**
|
||||||
|
* The miner (or author) of a block.
|
||||||
|
*/
|
||||||
miner: string;
|
miner: string;
|
||||||
|
/**
|
||||||
|
* Additional data the miner choose to include.
|
||||||
|
*/
|
||||||
extraData: string;
|
extraData: string;
|
||||||
|
/**
|
||||||
|
* The protocol-defined base fee per gas in an [[link-eip-1559]]
|
||||||
|
* block.
|
||||||
|
*/
|
||||||
baseFeePerGas: null | bigint;
|
baseFeePerGas: null | bigint;
|
||||||
|
/**
|
||||||
|
* The list of transactions in the block.
|
||||||
|
*/
|
||||||
transactions: ReadonlyArray<string | TransactionResponseParams>;
|
transactions: ReadonlyArray<string | TransactionResponseParams>;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* a **LogParams** encodes the minimal required properties for a
|
||||||
|
* formatted log.
|
||||||
|
*/
|
||||||
export interface LogParams {
|
export interface LogParams {
|
||||||
|
/**
|
||||||
|
* The transaction hash for the transaxction the log occurred in.
|
||||||
|
*/
|
||||||
transactionHash: string;
|
transactionHash: string;
|
||||||
|
/**
|
||||||
|
* The block hash of the block that included the transaction for this
|
||||||
|
* log.
|
||||||
|
*/
|
||||||
blockHash: string;
|
blockHash: string;
|
||||||
|
/**
|
||||||
|
* The block number of the block that included the transaction for this
|
||||||
|
* log.
|
||||||
|
*/
|
||||||
blockNumber: number;
|
blockNumber: number;
|
||||||
|
/**
|
||||||
|
* Whether this log was removed due to the transaction it was included
|
||||||
|
* in being removed dur to an orphaned block.
|
||||||
|
*/
|
||||||
removed: boolean;
|
removed: boolean;
|
||||||
|
/**
|
||||||
|
* The address of the contract that emitted this log.
|
||||||
|
*/
|
||||||
address: string;
|
address: string;
|
||||||
|
/**
|
||||||
|
* The data emitted with this log.
|
||||||
|
*/
|
||||||
data: string;
|
data: string;
|
||||||
|
/**
|
||||||
|
* The topics emitted with this log.
|
||||||
|
*/
|
||||||
topics: ReadonlyArray<string>;
|
topics: ReadonlyArray<string>;
|
||||||
|
/**
|
||||||
|
* The index of this log.
|
||||||
|
*/
|
||||||
index: number;
|
index: number;
|
||||||
|
/**
|
||||||
|
* The transaction index of this log.
|
||||||
|
*/
|
||||||
transactionIndex: number;
|
transactionIndex: number;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* a **TransactionReceiptParams** encodes the minimal required properties
|
||||||
|
* for a formatted transaction receipt.
|
||||||
|
*/
|
||||||
export interface TransactionReceiptParams {
|
export interface TransactionReceiptParams {
|
||||||
|
/**
|
||||||
|
* The target of the transaction. If null, the transaction was trying
|
||||||
|
* to deploy a transaction with the ``data`` as the initi=code.
|
||||||
|
*/
|
||||||
to: null | string;
|
to: null | string;
|
||||||
|
/**
|
||||||
|
* The sender of the transaction.
|
||||||
|
*/
|
||||||
from: string;
|
from: string;
|
||||||
|
/**
|
||||||
|
* If the transaction was directly deploying a contract, the [[to]]
|
||||||
|
* will be null, the ``data`` will be initcode and if successful, this
|
||||||
|
* will be the address of the contract deployed.
|
||||||
|
*/
|
||||||
contractAddress: null | string;
|
contractAddress: null | string;
|
||||||
|
/**
|
||||||
|
* The transaction hash.
|
||||||
|
*/
|
||||||
hash: string;
|
hash: string;
|
||||||
|
/**
|
||||||
|
* The transaction index.
|
||||||
|
*/
|
||||||
index: number;
|
index: number;
|
||||||
|
/**
|
||||||
|
* The block hash of the block that included this transaction.
|
||||||
|
*/
|
||||||
blockHash: string;
|
blockHash: string;
|
||||||
|
/**
|
||||||
|
* The block number of the block that included this transaction.
|
||||||
|
*/
|
||||||
blockNumber: number;
|
blockNumber: number;
|
||||||
|
/**
|
||||||
|
* The bloom filter for the logs emitted during execution of this
|
||||||
|
* transaction.
|
||||||
|
*/
|
||||||
logsBloom: string;
|
logsBloom: string;
|
||||||
|
/**
|
||||||
|
* The logs emitted during the execution of this transaction.
|
||||||
|
*/
|
||||||
logs: ReadonlyArray<LogParams>;
|
logs: ReadonlyArray<LogParams>;
|
||||||
|
/**
|
||||||
|
* The amount of gas consumed executing this transaciton.
|
||||||
|
*/
|
||||||
gasUsed: bigint;
|
gasUsed: bigint;
|
||||||
|
/**
|
||||||
|
* The total amount of gas consumed during the entire block up to
|
||||||
|
* and including this transaction.
|
||||||
|
*/
|
||||||
cumulativeGasUsed: bigint;
|
cumulativeGasUsed: bigint;
|
||||||
|
/**
|
||||||
|
* The actual gas price per gas charged for this transaction.
|
||||||
|
*/
|
||||||
gasPrice?: null | bigint;
|
gasPrice?: null | bigint;
|
||||||
|
/**
|
||||||
|
* The actual gas price per gas charged for this transaction.
|
||||||
|
*/
|
||||||
effectiveGasPrice?: null | bigint;
|
effectiveGasPrice?: null | bigint;
|
||||||
|
/**
|
||||||
|
* The [[link-eip-2718]] envelope type.
|
||||||
|
*/
|
||||||
type: number;
|
type: number;
|
||||||
|
/**
|
||||||
|
* The status of the transaction execution. If ``1`` then the
|
||||||
|
* the transaction returned success, if ``0`` then the transaction
|
||||||
|
* was reverted. For pre-byzantium blocks, this is usually null, but
|
||||||
|
* some nodes may have backfilled this data.
|
||||||
|
*/
|
||||||
status: null | number;
|
status: null | number;
|
||||||
|
/**
|
||||||
|
* The root of this transaction in a pre-bazatium block. In
|
||||||
|
* post-byzantium blocks this is null.
|
||||||
|
*/
|
||||||
root: null | string;
|
root: null | string;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* a **TransactionResponseParams** encodes the minimal required properties
|
||||||
|
* for a formatted transaction response.
|
||||||
|
*/
|
||||||
export interface TransactionResponseParams {
|
export interface TransactionResponseParams {
|
||||||
|
/**
|
||||||
|
* The block number of the block that included this transaction.
|
||||||
|
*/
|
||||||
blockNumber: null | number;
|
blockNumber: null | number;
|
||||||
|
/**
|
||||||
|
* The block hash of the block that included this transaction.
|
||||||
|
*/
|
||||||
blockHash: null | string;
|
blockHash: null | string;
|
||||||
|
/**
|
||||||
|
* The transaction hash.
|
||||||
|
*/
|
||||||
hash: string;
|
hash: string;
|
||||||
|
/**
|
||||||
|
* The transaction index.
|
||||||
|
*/
|
||||||
index: number;
|
index: number;
|
||||||
|
/**
|
||||||
|
* The [[link-eip-2718]] transaction type.
|
||||||
|
*/
|
||||||
type: number;
|
type: number;
|
||||||
|
/**
|
||||||
|
* The target of the transaction. If ``null``, the ``data`` is initcode
|
||||||
|
* and this transaction is a deployment transaction.
|
||||||
|
*/
|
||||||
to: null | string;
|
to: null | string;
|
||||||
|
/**
|
||||||
|
* The sender of the transaction.
|
||||||
|
*/
|
||||||
from: string;
|
from: string;
|
||||||
|
/**
|
||||||
|
* The nonce of the transaction, used for replay protection.
|
||||||
|
*/
|
||||||
nonce: number;
|
nonce: number;
|
||||||
|
/**
|
||||||
|
* The maximum amount of gas this transaction is authorized to consume.
|
||||||
|
*/
|
||||||
gasLimit: bigint;
|
gasLimit: bigint;
|
||||||
|
/**
|
||||||
|
* For legacy transactions, this is the gas price per gas to pay.
|
||||||
|
*/
|
||||||
gasPrice: bigint;
|
gasPrice: bigint;
|
||||||
|
/**
|
||||||
|
* For [[link-eip-1559]] transactions, this is the maximum priority
|
||||||
|
* fee to allow a producer to claim.
|
||||||
|
*/
|
||||||
maxPriorityFeePerGas: null | bigint;
|
maxPriorityFeePerGas: null | bigint;
|
||||||
|
/**
|
||||||
|
* For [[link-eip-1559]] transactions, this is the maximum fee that
|
||||||
|
* will be paid.
|
||||||
|
*/
|
||||||
maxFeePerGas: null | bigint;
|
maxFeePerGas: null | bigint;
|
||||||
|
/**
|
||||||
|
* The transaction data.
|
||||||
|
*/
|
||||||
data: string;
|
data: string;
|
||||||
|
/**
|
||||||
|
* The transaction value (in wei).
|
||||||
|
*/
|
||||||
value: bigint;
|
value: bigint;
|
||||||
|
/**
|
||||||
|
* The chain ID this transaction is valid on.
|
||||||
|
*/
|
||||||
chainId: bigint;
|
chainId: bigint;
|
||||||
|
/**
|
||||||
|
* The signature of the transaction.
|
||||||
|
*/
|
||||||
signature: Signature;
|
signature: Signature;
|
||||||
|
/**
|
||||||
|
* The transaction access list.
|
||||||
|
*/
|
||||||
accessList: null | AccessList;
|
accessList: null | AccessList;
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=formatting.d.ts.map
|
//# sourceMappingURL=formatting.d.ts.map
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../src.ts/providers/formatting.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AA+D1D,MAAM,WAAW,WAAW;IACxB,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAErB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAElB,UAAU,EAAE,MAAM,CAAC;IAEnB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,MAAM,CAAC;IACjB,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iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAElC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAGb;;;;;OAKG;IACH,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC;IAEtB;;;OAGG;IACH,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;CACvB;AAqBD;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACtC;;OAEG;IACH,WAAW,EAAE,IAAI,GAAG,MAAM,CAAC;IAE3B;;OAEG;IACH,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;IAEzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,EAAE,EAAE,IAAI,GAAG,MAAM,CAAC;IAElB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,oBAAoB,EAAE,IAAI,GAAG,MAAM,CAAC;IAEpC;;;OAGG;IACH,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC;IAE5B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,UAAU,EAAE,IAAI,GAAG,UAAU,CAAC;CACjC"}
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"formatting.js","sourceRoot":"","sources":["../../src.ts/providers/formatting.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAsFF,CAAC;AAkGD,CAAC"}
|
{"version":3,"file":"formatting.js","sourceRoot":"","sources":["../../src.ts/providers/formatting.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA8EF,CAAC;AA+QD,CAAC"}
|
8
lib.commonjs/providers/index.d.ts
vendored
8
lib.commonjs/providers/index.d.ts
vendored
@ -1,5 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* About providers.
|
* A **Provider** provides a connection to the blockchain, whch can be
|
||||||
|
* used to query its current state, simulate execution and send transactions
|
||||||
|
* to update the state.
|
||||||
|
*
|
||||||
|
* It is one of the most fundamental components of interacting with a
|
||||||
|
* blockchain application, and there are many ways to connect, such as over
|
||||||
|
* HTTP, WebSockets or injected providers such as [MetaMask](link-metamask).
|
||||||
*
|
*
|
||||||
* @_section: api/providers:Providers [about-providers]
|
* @_section: api/providers:Providers [about-providers]
|
||||||
*/
|
*/
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/providers/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EACH,gBAAgB,EAAE,mBAAmB,EACxC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACH,cAAc,EACd,UAAU,GACb,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACH,mBAAmB,EACtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EACH,aAAa,EACb,aAAa,EACb,SAAS,EACT,oBAAoB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACH,KAAK,EACL,OAAO,EACP,GAAG,EACH,kBAAkB,EAClB,mBAAmB,EAEnB,WAAW,GAEd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,w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aAAa,EACnE,WAAW,EACX,QAAQ,EACR,UAAU,EAAE,wBAAwB,EACvC,MAAM,eAAe,CAAC;AAEvB,YAAY,EACR,yBAAyB,EAAE,eAAe,EAC7C,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACR,cAAc,EAAE,aAAa,EAAE,YAAY,EAC3C,yBAAyB,EACzB,yBAAyB,GAC5B,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACR,gBAAgB,EAAE,aAAa,EAClC,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
@ -1,6 +1,12 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
/**
|
/**
|
||||||
* About providers.
|
* A **Provider** provides a connection to the blockchain, whch can be
|
||||||
|
* used to query its current state, simulate execution and send transactions
|
||||||
|
* to update the state.
|
||||||
|
*
|
||||||
|
* It is one of the most fundamental components of interacting with a
|
||||||
|
* blockchain application, and there are many ways to connect, such as over
|
||||||
|
* HTTP, WebSockets or injected providers such as [MetaMask](link-metamask).
|
||||||
*
|
*
|
||||||
* @_section: api/providers:Providers [about-providers]
|
* @_section: api/providers:Providers [about-providers]
|
||||||
*/
|
*/
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/providers/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAIH,+DAEgC;AAD5B,wHAAA,gBAAgB,OAAA;AAAE,2HAAA,mBAAmB,OAAA;AAGzC,2DAG8B;AAF1B,oHAAA,cAAc,OAAA;AACd,gHAAA,UAAU,OAAA;AAGd,+CAEwB;AADpB,mHAAA,mBAAmB,OAAA;AAGvB,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA;AAE3B,qDAAgD;AAAvC,8GAAA,WAAW,OAAA;AAEpB,2CAAuC;AAA9B,qGAAA,OAAO,OAAA;AAEhB,mEAAwD;AAA/C,sHAAA,YAAY,OAAA;AAErB,2DAK8B;AAJ1B,m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AF1B,sHAAA,gBAAgB,OAAA;AAAE,2HAAA,qBAAqB,OAAA;AAAE,6HAAA,uBAAuB,OAAA;AAChE,2HAAA,qBAAqB,OAAA"}
|
13
lib.commonjs/providers/network.d.ts
vendored
13
lib.commonjs/providers/network.d.ts
vendored
@ -1,5 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* About networks
|
* A **Network** encapsulates the various properties required to
|
||||||
|
* interact with a specific chain.
|
||||||
*
|
*
|
||||||
* @_subsection: api/providers:Networks [networks]
|
* @_subsection: api/providers:Networks [networks]
|
||||||
*/
|
*/
|
||||||
@ -19,9 +20,19 @@ export type Networkish = Network | number | bigint | string | {
|
|||||||
ensAddress?: string;
|
ensAddress?: string;
|
||||||
ensNetwork?: number;
|
ensNetwork?: number;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* A **Network** provides access to a chain's properties and allows
|
||||||
|
* for plug-ins to extend functionality.
|
||||||
|
*/
|
||||||
export declare class Network {
|
export declare class Network {
|
||||||
#private;
|
#private;
|
||||||
|
/**
|
||||||
|
* Creates a new **Network** for %%name%% and %%chainId%%.
|
||||||
|
*/
|
||||||
constructor(name: string, chainId: BigNumberish);
|
constructor(name: string, chainId: BigNumberish);
|
||||||
|
/**
|
||||||
|
* Returns a JSON-compatible representation of a Network.
|
||||||
|
*/
|
||||||
toJSON(): any;
|
toJSON(): any;
|
||||||
/**
|
/**
|
||||||
* The network common name.
|
* The network common name.
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src.ts/providers/network.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GA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aAAa,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC;IAI/E;;OAEG;IACH,KAAK,IAAI,OAAO;IAQhB;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,EAAE,eAAe,GAAG,MAAM;IAyBhD;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO;IA+C1C;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,GAAG,IAAI;CAQ7F"}
|
@ -1,6 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
/**
|
/**
|
||||||
* About networks
|
* A **Network** encapsulates the various properties required to
|
||||||
|
* interact with a specific chain.
|
||||||
*
|
*
|
||||||
* @_subsection: api/providers:Networks [networks]
|
* @_subsection: api/providers:Networks [networks]
|
||||||
*/
|
*/
|
||||||
@ -61,15 +62,25 @@ export class CcipPreflightPlugin extends NetworkPlugin {
|
|||||||
*/
|
*/
|
||||||
const Networks = new Map();
|
const Networks = new Map();
|
||||||
// @TODO: Add a _ethersNetworkObj variable to better detect network ovjects
|
// @TODO: Add a _ethersNetworkObj variable to better detect network ovjects
|
||||||
|
/**
|
||||||
|
* A **Network** provides access to a chain's properties and allows
|
||||||
|
* for plug-ins to extend functionality.
|
||||||
|
*/
|
||||||
class Network {
|
class Network {
|
||||||
#name;
|
#name;
|
||||||
#chainId;
|
#chainId;
|
||||||
#plugins;
|
#plugins;
|
||||||
|
/**
|
||||||
|
* Creates a new **Network** for %%name%% and %%chainId%%.
|
||||||
|
*/
|
||||||
constructor(name, chainId) {
|
constructor(name, chainId) {
|
||||||
this.#name = name;
|
this.#name = name;
|
||||||
this.#chainId = (0, index_js_2.getBigInt)(chainId);
|
this.#chainId = (0, index_js_2.getBigInt)(chainId);
|
||||||
this.#plugins = new Map();
|
this.#plugins = new Map();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns a JSON-compatible representation of a Network.
|
||||||
|
*/
|
||||||
toJSON() {
|
toJSON() {
|
||||||
return { name: this.name, chainId: String(this.chainId) };
|
return { name: this.name, chainId: String(this.chainId) };
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
105
lib.commonjs/providers/plugins-network.d.ts
vendored
105
lib.commonjs/providers/plugins-network.d.ts
vendored
@ -1,38 +1,143 @@
|
|||||||
import type { FeeData, Provider } from "./provider.js";
|
import type { FeeData, Provider } from "./provider.js";
|
||||||
|
/**
|
||||||
|
* A **NetworkPlugin** provides additional functionality on a [[Network]].
|
||||||
|
*/
|
||||||
export declare class NetworkPlugin {
|
export declare class NetworkPlugin {
|
||||||
|
/**
|
||||||
|
* The name of the plugin.
|
||||||
|
*
|
||||||
|
* It is recommended to use reverse-domain-notation, which permits
|
||||||
|
* unique names with a known authority as well as hierarchal entries.
|
||||||
|
*/
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
|
/**
|
||||||
|
* Creates a new **NetworkPlugin**.
|
||||||
|
*/
|
||||||
constructor(name: string);
|
constructor(name: string);
|
||||||
|
/**
|
||||||
|
* Creates a copy of this plugin.
|
||||||
|
*/
|
||||||
clone(): NetworkPlugin;
|
clone(): NetworkPlugin;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The gas cost parameters for a [[GasCostPlugin]].
|
||||||
|
*/
|
||||||
export type GasCostParameters = {
|
export type GasCostParameters = {
|
||||||
|
/**
|
||||||
|
* The transactions base fee.
|
||||||
|
*/
|
||||||
txBase?: number;
|
txBase?: number;
|
||||||
|
/**
|
||||||
|
* The fee for creating a new account.
|
||||||
|
*/
|
||||||
txCreate?: number;
|
txCreate?: number;
|
||||||
|
/**
|
||||||
|
* The fee per zero-byte in the data.
|
||||||
|
*/
|
||||||
txDataZero?: number;
|
txDataZero?: number;
|
||||||
|
/**
|
||||||
|
* The fee per non-zero-byte in the data.
|
||||||
|
*/
|
||||||
txDataNonzero?: number;
|
txDataNonzero?: number;
|
||||||
|
/**
|
||||||
|
* The fee per storage key in the [[link-eip-2930]] access list.
|
||||||
|
*/
|
||||||
txAccessListStorageKey?: number;
|
txAccessListStorageKey?: number;
|
||||||
|
/**
|
||||||
|
* The fee per address in the [[link-eip-2930]] access list.
|
||||||
|
*/
|
||||||
txAccessListAddress?: number;
|
txAccessListAddress?: number;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* A **GasCostPlugin** allows a network to provide alternative values when
|
||||||
|
* computing the intrinsic gas required for a transaction.
|
||||||
|
*/
|
||||||
export declare class GasCostPlugin extends NetworkPlugin implements GasCostParameters {
|
export declare class GasCostPlugin extends NetworkPlugin implements GasCostParameters {
|
||||||
|
/**
|
||||||
|
* The block number to treat these values as valid from.
|
||||||
|
*
|
||||||
|
* This allows a hardfork to have updated values included as well as
|
||||||
|
* mulutiple hardforks to be supported.
|
||||||
|
*/
|
||||||
readonly effectiveBlock: number;
|
readonly effectiveBlock: number;
|
||||||
|
/**
|
||||||
|
* The transactions base fee.
|
||||||
|
*/
|
||||||
readonly txBase: number;
|
readonly txBase: number;
|
||||||
|
/**
|
||||||
|
* The fee for creating a new account.
|
||||||
|
*/
|
||||||
readonly txCreate: number;
|
readonly txCreate: number;
|
||||||
|
/**
|
||||||
|
* The fee per zero-byte in the data.
|
||||||
|
*/
|
||||||
readonly txDataZero: number;
|
readonly txDataZero: number;
|
||||||
|
/**
|
||||||
|
* The fee per non-zero-byte in the data.
|
||||||
|
*/
|
||||||
readonly txDataNonzero: number;
|
readonly txDataNonzero: number;
|
||||||
|
/**
|
||||||
|
* The fee per storage key in the [[link-eip-2930]] access list.
|
||||||
|
*/
|
||||||
readonly txAccessListStorageKey: number;
|
readonly txAccessListStorageKey: number;
|
||||||
|
/**
|
||||||
|
* The fee per address in the [[link-eip-2930]] access list.
|
||||||
|
*/
|
||||||
readonly txAccessListAddress: number;
|
readonly txAccessListAddress: number;
|
||||||
|
/**
|
||||||
|
* Creates a new GasCostPlugin from %%effectiveBlock%% until the
|
||||||
|
* latest block or another GasCostPlugin supercedes that block number,
|
||||||
|
* with the associated %%costs%%.
|
||||||
|
*/
|
||||||
constructor(effectiveBlock?: number, costs?: GasCostParameters);
|
constructor(effectiveBlock?: number, costs?: GasCostParameters);
|
||||||
clone(): GasCostPlugin;
|
clone(): GasCostPlugin;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* An **EnsPlugin** allows a [[Network]] to specify the ENS Registry
|
||||||
|
* Contract address and the target network to use when using that
|
||||||
|
* contract.
|
||||||
|
*
|
||||||
|
* Various testnets have their own instance of the contract to use, but
|
||||||
|
* in general, the mainnet instance supports multi-chain addresses and
|
||||||
|
* should be used.
|
||||||
|
*/
|
||||||
export declare class EnsPlugin extends NetworkPlugin {
|
export declare class EnsPlugin extends NetworkPlugin {
|
||||||
|
/**
|
||||||
|
* The ENS Registrty Contract address.
|
||||||
|
*/
|
||||||
readonly address: string;
|
readonly address: string;
|
||||||
|
/**
|
||||||
|
* The chain ID that the ENS contract lives on.
|
||||||
|
*/
|
||||||
readonly targetNetwork: number;
|
readonly targetNetwork: number;
|
||||||
|
/**
|
||||||
|
* Creates a new **EnsPlugin** connected to %%address%% on the
|
||||||
|
* %%targetNetwork%%. The default ENS address and mainnet is used
|
||||||
|
* if unspecified.
|
||||||
|
*/
|
||||||
constructor(address?: null | string, targetNetwork?: null | number);
|
constructor(address?: null | string, targetNetwork?: null | number);
|
||||||
clone(): EnsPlugin;
|
clone(): EnsPlugin;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* A **FeeDataNetworkPlugin** allows a network to provide and alternate
|
||||||
|
* means to specify its fee data.
|
||||||
|
*
|
||||||
|
* For example, a network which does not support [[link-eip-1559]] may
|
||||||
|
* choose to use a Gas Station site to approximate the gas price.
|
||||||
|
*/
|
||||||
export declare class FeeDataNetworkPlugin extends NetworkPlugin {
|
export declare class FeeDataNetworkPlugin extends NetworkPlugin {
|
||||||
#private;
|
#private;
|
||||||
|
/**
|
||||||
|
* The fee data function provided to the constructor.
|
||||||
|
*/
|
||||||
get feeDataFunc(): (provider: Provider) => Promise<FeeData>;
|
get feeDataFunc(): (provider: Provider) => Promise<FeeData>;
|
||||||
|
/**
|
||||||
|
* Creates a new **FeeDataNetworkPlugin**.
|
||||||
|
*/
|
||||||
constructor(feeDataFunc: (provider: Provider) => Promise<FeeData>);
|
constructor(feeDataFunc: (provider: Provider) => Promise<FeeData>);
|
||||||
|
/**
|
||||||
|
* Resolves to the fee data.
|
||||||
|
*/
|
||||||
getFeeData(provider: Provider): Promise<FeeData>;
|
getFeeData(provider: Provider): Promise<FeeData>;
|
||||||
clone(): FeeDataNetworkPlugin;
|
clone(): FeeDataNetworkPlugin;
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"plugins-network.d.ts","sourceRoot":"","sources":["../../src.ts/providers/plugins-network.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACR,OAAO,EAAE,QAAQ,EACpB,MAAM,eAAe,CAAC;AAMvB,qBAAa,aAAa;IACtB,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;gBAEX,IAAI,EAAE,MAAM;IAIxB,KAAK,IAAI,aAAa;CAOzB;AAKD,MAAM,MAAM,iBAAiB,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,qBAAa,aAAc,SAAQ,aAAc,YAAW,iBAAiB;IACzE,QAAQ,CAAC,cAAc,EAAG,MAAM,CAAC;IAEjC,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAG,MAAM,CAAC;IAC3B,QAAQ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,EAAE,QAAQ,KAAK,OAAO,CAAC,OAAO,CAAC,CAE1D;IAED;;OAEG;gBACS,WAAW,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,OAAO,CAAC;IAKjE;;OAEG;IACG,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAItD,KAAK,IAAI,oBAAoB;CAGhC"}
|
@ -4,24 +4,72 @@ exports.FeeDataNetworkPlugin = exports.EnsPlugin = exports.GasCostPlugin = expor
|
|||||||
const properties_js_1 = require("../utils/properties.js");
|
const properties_js_1 = require("../utils/properties.js");
|
||||||
const index_js_1 = require("../utils/index.js");
|
const index_js_1 = require("../utils/index.js");
|
||||||
const EnsAddress = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
const EnsAddress = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
||||||
|
/**
|
||||||
|
* A **NetworkPlugin** provides additional functionality on a [[Network]].
|
||||||
|
*/
|
||||||
class NetworkPlugin {
|
class NetworkPlugin {
|
||||||
|
/**
|
||||||
|
* The name of the plugin.
|
||||||
|
*
|
||||||
|
* It is recommended to use reverse-domain-notation, which permits
|
||||||
|
* unique names with a known authority as well as hierarchal entries.
|
||||||
|
*/
|
||||||
name;
|
name;
|
||||||
|
/**
|
||||||
|
* Creates a new **NetworkPlugin**.
|
||||||
|
*/
|
||||||
constructor(name) {
|
constructor(name) {
|
||||||
(0, properties_js_1.defineProperties)(this, { name });
|
(0, properties_js_1.defineProperties)(this, { name });
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Creates a copy of this plugin.
|
||||||
|
*/
|
||||||
clone() {
|
clone() {
|
||||||
return new NetworkPlugin(this.name);
|
return new NetworkPlugin(this.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.NetworkPlugin = NetworkPlugin;
|
exports.NetworkPlugin = NetworkPlugin;
|
||||||
|
/**
|
||||||
|
* A **GasCostPlugin** allows a network to provide alternative values when
|
||||||
|
* computing the intrinsic gas required for a transaction.
|
||||||
|
*/
|
||||||
class GasCostPlugin extends NetworkPlugin {
|
class GasCostPlugin extends NetworkPlugin {
|
||||||
|
/**
|
||||||
|
* The block number to treat these values as valid from.
|
||||||
|
*
|
||||||
|
* This allows a hardfork to have updated values included as well as
|
||||||
|
* mulutiple hardforks to be supported.
|
||||||
|
*/
|
||||||
effectiveBlock;
|
effectiveBlock;
|
||||||
|
/**
|
||||||
|
* The transactions base fee.
|
||||||
|
*/
|
||||||
txBase;
|
txBase;
|
||||||
|
/**
|
||||||
|
* The fee for creating a new account.
|
||||||
|
*/
|
||||||
txCreate;
|
txCreate;
|
||||||
|
/**
|
||||||
|
* The fee per zero-byte in the data.
|
||||||
|
*/
|
||||||
txDataZero;
|
txDataZero;
|
||||||
|
/**
|
||||||
|
* The fee per non-zero-byte in the data.
|
||||||
|
*/
|
||||||
txDataNonzero;
|
txDataNonzero;
|
||||||
|
/**
|
||||||
|
* The fee per storage key in the [[link-eip-2930]] access list.
|
||||||
|
*/
|
||||||
txAccessListStorageKey;
|
txAccessListStorageKey;
|
||||||
|
/**
|
||||||
|
* The fee per address in the [[link-eip-2930]] access list.
|
||||||
|
*/
|
||||||
txAccessListAddress;
|
txAccessListAddress;
|
||||||
|
/**
|
||||||
|
* Creates a new GasCostPlugin from %%effectiveBlock%% until the
|
||||||
|
* latest block or another GasCostPlugin supercedes that block number,
|
||||||
|
* with the associated %%costs%%.
|
||||||
|
*/
|
||||||
constructor(effectiveBlock, costs) {
|
constructor(effectiveBlock, costs) {
|
||||||
if (effectiveBlock == null) {
|
if (effectiveBlock == null) {
|
||||||
effectiveBlock = 0;
|
effectiveBlock = 0;
|
||||||
@ -49,13 +97,29 @@ class GasCostPlugin extends NetworkPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.GasCostPlugin = GasCostPlugin;
|
exports.GasCostPlugin = GasCostPlugin;
|
||||||
// Networks shoudl use this plugin to specify the contract address
|
/**
|
||||||
// and network necessary to resolve ENS names.
|
* An **EnsPlugin** allows a [[Network]] to specify the ENS Registry
|
||||||
|
* Contract address and the target network to use when using that
|
||||||
|
* contract.
|
||||||
|
*
|
||||||
|
* Various testnets have their own instance of the contract to use, but
|
||||||
|
* in general, the mainnet instance supports multi-chain addresses and
|
||||||
|
* should be used.
|
||||||
|
*/
|
||||||
class EnsPlugin extends NetworkPlugin {
|
class EnsPlugin extends NetworkPlugin {
|
||||||
// The ENS contract address
|
/**
|
||||||
|
* The ENS Registrty Contract address.
|
||||||
|
*/
|
||||||
address;
|
address;
|
||||||
// The network ID that the ENS contract lives on
|
/**
|
||||||
|
* The chain ID that the ENS contract lives on.
|
||||||
|
*/
|
||||||
targetNetwork;
|
targetNetwork;
|
||||||
|
/**
|
||||||
|
* Creates a new **EnsPlugin** connected to %%address%% on the
|
||||||
|
* %%targetNetwork%%. The default ENS address and mainnet is used
|
||||||
|
* if unspecified.
|
||||||
|
*/
|
||||||
constructor(address, targetNetwork) {
|
constructor(address, targetNetwork) {
|
||||||
super("org.ethers.plugins.network.Ens");
|
super("org.ethers.plugins.network.Ens");
|
||||||
(0, properties_js_1.defineProperties)(this, {
|
(0, properties_js_1.defineProperties)(this, {
|
||||||
@ -68,15 +132,31 @@ class EnsPlugin extends NetworkPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.EnsPlugin = EnsPlugin;
|
exports.EnsPlugin = EnsPlugin;
|
||||||
|
/**
|
||||||
|
* A **FeeDataNetworkPlugin** allows a network to provide and alternate
|
||||||
|
* means to specify its fee data.
|
||||||
|
*
|
||||||
|
* For example, a network which does not support [[link-eip-1559]] may
|
||||||
|
* choose to use a Gas Station site to approximate the gas price.
|
||||||
|
*/
|
||||||
class FeeDataNetworkPlugin extends NetworkPlugin {
|
class FeeDataNetworkPlugin extends NetworkPlugin {
|
||||||
#feeDataFunc;
|
#feeDataFunc;
|
||||||
|
/**
|
||||||
|
* The fee data function provided to the constructor.
|
||||||
|
*/
|
||||||
get feeDataFunc() {
|
get feeDataFunc() {
|
||||||
return this.#feeDataFunc;
|
return this.#feeDataFunc;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Creates a new **FeeDataNetworkPlugin**.
|
||||||
|
*/
|
||||||
constructor(feeDataFunc) {
|
constructor(feeDataFunc) {
|
||||||
super("org.ethers.plugins.network.FeeData");
|
super("org.ethers.plugins.network.FeeData");
|
||||||
this.#feeDataFunc = feeDataFunc;
|
this.#feeDataFunc = feeDataFunc;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Resolves to the fee data.
|
||||||
|
*/
|
||||||
async getFeeData(provider) {
|
async getFeeData(provider) {
|
||||||
return await this.#feeDataFunc(provider);
|
return await this.#feeDataFunc(provider);
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"plugins-network.js","sourceRoot":"","sources":["../../src.ts/providers/plugins-network.ts"],"names":[],"mappings":";;;AAAA,0DAA0D;AAE1D,gDAAmD;AAQnD,MAAM,UAAU,GAAG,4CAA4C,CAAC;AAEhE,MAAa,aAAa;IACb,IAAI,CAAU;IAEvB,YAAY,IAAY;QACpB,IAAA,gCAAgB,EAAgB,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,KAAK;QACD,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CAKJ;AAdD,sCAcC;AAcD,MAAa,aAAc,SAAQ,aAAa;IACnC,cAAc,CAAU;IAExB,MAAM,CAAU;IAChB,QAAQ,CAAU;IAClB,UAAU,CAAU;IACpB,aAAa,CAAU;IACvB,sBAAsB,CAAU;IAChC,mBAAmB,CAAU;IAEtC,YAAY,cAAuB,EAAE,KAAyB;QAC1D,IAAI,cAAc,IAAI,IAAI,EAAE;YAAE,cAAc,GAAG,CAAC,CAAC;SAAE;QACnD,KAAK,CAAC,sCAAuC,CAAC,cAAc,IAAI,CAAC,CAAE,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ts
vendored
24
lib.commonjs/providers/provider-browser.d.ts
vendored
@ -1,12 +1,24 @@
|
|||||||
import { JsonRpcApiPollingProvider } from "./provider-jsonrpc.js";
|
import { JsonRpcApiPollingProvider } from "./provider-jsonrpc.js";
|
||||||
import type { JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcSigner } from "./provider-jsonrpc.js";
|
import type { JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcSigner } from "./provider-jsonrpc.js";
|
||||||
import type { Networkish } from "./network.js";
|
import type { Networkish } from "./network.js";
|
||||||
|
/**
|
||||||
|
* The interface to an [[link-eip-1193]] provider, which is a standard
|
||||||
|
* used by most injected providers, which the [[BrowserProvider]] accepts
|
||||||
|
* and exposes the API of.
|
||||||
|
*/
|
||||||
export interface Eip1193Provider {
|
export interface Eip1193Provider {
|
||||||
|
/**
|
||||||
|
* See [[link-eip-1193]] for details on this method.
|
||||||
|
*/
|
||||||
request(request: {
|
request(request: {
|
||||||
method: string;
|
method: string;
|
||||||
params?: Array<any> | Record<string, any>;
|
params?: Array<any> | Record<string, any>;
|
||||||
}): Promise<any>;
|
}): Promise<any>;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* The possible additional events dispatched when using the ``"debug"``
|
||||||
|
* event on a [[BrowserProvider]].
|
||||||
|
*/
|
||||||
export type DebugEventBrowserProvider = {
|
export type DebugEventBrowserProvider = {
|
||||||
action: "sendEip1193Payload";
|
action: "sendEip1193Payload";
|
||||||
payload: {
|
payload: {
|
||||||
@ -20,12 +32,24 @@ export type DebugEventBrowserProvider = {
|
|||||||
action: "receiveEip1193Error";
|
action: "receiveEip1193Error";
|
||||||
error: Error;
|
error: Error;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* A **BrowserProvider** is intended to wrap an injected provider which
|
||||||
|
* adheres to the [[link-eip-1193]] standard, which most (if not all)
|
||||||
|
* currently do.
|
||||||
|
*/
|
||||||
export declare class BrowserProvider extends JsonRpcApiPollingProvider {
|
export declare class BrowserProvider extends JsonRpcApiPollingProvider {
|
||||||
#private;
|
#private;
|
||||||
|
/**
|
||||||
|
* Connnect to the %%ethereum%% provider, optionally forcing the
|
||||||
|
* %%network%%.
|
||||||
|
*/
|
||||||
constructor(ethereum: Eip1193Provider, network?: Networkish);
|
constructor(ethereum: Eip1193Provider, network?: Networkish);
|
||||||
send(method: string, params: Array<any> | Record<string, any>): Promise<any>;
|
send(method: string, params: Array<any> | Record<string, any>): Promise<any>;
|
||||||
_send(payload: JsonRpcPayload | Array<JsonRpcPayload>): Promise<Array<JsonRpcResult | JsonRpcError>>;
|
_send(payload: JsonRpcPayload | Array<JsonRpcPayload>): Promise<Array<JsonRpcResult | JsonRpcError>>;
|
||||||
getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error;
|
getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error;
|
||||||
|
/**
|
||||||
|
* Resolves to ``true`` if the provider manages the %%address%%.
|
||||||
|
*/
|
||||||
hasSigner(address: number | string): Promise<boolean>;
|
hasSigner(address: number | string): Promise<boolean>;
|
||||||
getSigner(address?: number | string): Promise<JsonRpcSigner>;
|
getSigner(address?: number | string): Promise<JsonRpcSigner>;
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"provider-browser.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-browser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EACR,YAAY,EAAE,cAAc,EAAE,aAAa,EAC3C,aAAa,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,MAAM,WAAW,eAAe;IAC5B,OAAO,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CA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AAC;IAYrD,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAiBrE"}
|
@ -4,8 +4,17 @@ exports.BrowserProvider = void 0;
|
|||||||
const index_js_1 = require("../utils/index.js");
|
const index_js_1 = require("../utils/index.js");
|
||||||
const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js");
|
const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js");
|
||||||
;
|
;
|
||||||
|
/**
|
||||||
|
* A **BrowserProvider** is intended to wrap an injected provider which
|
||||||
|
* adheres to the [[link-eip-1193]] standard, which most (if not all)
|
||||||
|
* currently do.
|
||||||
|
*/
|
||||||
class BrowserProvider extends provider_jsonrpc_js_1.JsonRpcApiPollingProvider {
|
class BrowserProvider extends provider_jsonrpc_js_1.JsonRpcApiPollingProvider {
|
||||||
#request;
|
#request;
|
||||||
|
/**
|
||||||
|
* Connnect to the %%ethereum%% provider, optionally forcing the
|
||||||
|
* %%network%%.
|
||||||
|
*/
|
||||||
constructor(ethereum, network) {
|
constructor(ethereum, network) {
|
||||||
super(network, { batchMaxCount: 1 });
|
super(network, { batchMaxCount: 1 });
|
||||||
this.#request = async (method, params) => {
|
this.#request = async (method, params) => {
|
||||||
@ -57,6 +66,9 @@ class BrowserProvider extends provider_jsonrpc_js_1.JsonRpcApiPollingProvider {
|
|||||||
}
|
}
|
||||||
return super.getRpcError(payload, error);
|
return super.getRpcError(payload, error);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Resolves to ``true`` if the provider manages the %%address%%.
|
||||||
|
*/
|
||||||
async hasSigner(address) {
|
async hasSigner(address) {
|
||||||
if (address == null) {
|
if (address == null) {
|
||||||
address = 0;
|
address = 0;
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"provider-browser.js","sourceRoot":"","sources":["../../src.ts/providers/provider-browser.ts"],"names":[],"mappings":";;;AAAA,gDAAmD;AAEnD,+DAAkE;AAWjE,CAAC;AA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,CAAC;SAAE;QAErC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAG,CAAC,CAAC;QACtD,IAAI,OAAM,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE;YAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC;SACtC;QAED,OAAO,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;QAChC,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IACtF,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,OAAyB;QACrC,IAAI,OAAO,IAAI,IAAI,EAAE;YAAE,OAAO,GAAG,CAAC,CAAC;SAAE;QAErC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE;YAClC,IAAI;gBACA,eAAe;gBACf,MAAM,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,EAAG,CAAC,CAAC;gBAChD,4BAA4B;aAE/B;YAAC,OAAO,KAAU,EAAE;gBACjB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;gBAC9B,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;aAC9D;SACJ;QAED,OAAO,MAAM,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;CACJ;AAlGD,0CAkGC"}
|
64
lib.commonjs/providers/provider-fallback.d.ts
vendored
64
lib.commonjs/providers/provider-fallback.d.ts
vendored
@ -6,22 +6,61 @@ import type { Networkish } from "./network.js";
|
|||||||
* A configuration entry for how to use a [[Provider]].
|
* A configuration entry for how to use a [[Provider]].
|
||||||
*/
|
*/
|
||||||
export interface FallbackProviderConfig {
|
export interface FallbackProviderConfig {
|
||||||
|
/**
|
||||||
|
* The provider.
|
||||||
|
*/
|
||||||
provider: AbstractProvider;
|
provider: AbstractProvider;
|
||||||
|
/**
|
||||||
|
* The amount of time to wait before kicking off the next provider.
|
||||||
|
*
|
||||||
|
* Any providers that have not responded can still respond and be
|
||||||
|
* counted, but this ensures new providers start.
|
||||||
|
*/
|
||||||
stallTimeout?: number;
|
stallTimeout?: number;
|
||||||
|
/**
|
||||||
|
* The priority. Lower priority providers are dispatched first.
|
||||||
|
*/
|
||||||
priority?: number;
|
priority?: number;
|
||||||
|
/**
|
||||||
|
* The amount of weight a provider is given against the quorum.
|
||||||
|
*/
|
||||||
weight?: number;
|
weight?: number;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* The statistics and state maintained for a [[Provider]].
|
* The statistics and state maintained for a [[Provider]].
|
||||||
*/
|
*/
|
||||||
export interface FallbackProviderState extends Required<FallbackProviderConfig> {
|
export interface FallbackProviderState extends Required<FallbackProviderConfig> {
|
||||||
|
/**
|
||||||
|
* The most recent blockNumber this provider has reported (-2 if none).
|
||||||
|
*/
|
||||||
blockNumber: number;
|
blockNumber: number;
|
||||||
|
/**
|
||||||
|
* The number of total requests ever sent to this provider.
|
||||||
|
*/
|
||||||
requests: number;
|
requests: number;
|
||||||
|
/**
|
||||||
|
* The number of responses that errored.
|
||||||
|
*/
|
||||||
errorResponses: number;
|
errorResponses: number;
|
||||||
|
/**
|
||||||
|
* The number of responses that occured after the result resolved.
|
||||||
|
*/
|
||||||
lateResponses: number;
|
lateResponses: number;
|
||||||
|
/**
|
||||||
|
* How many times syncing was required to catch up the expected block.
|
||||||
|
*/
|
||||||
outOfSync: number;
|
outOfSync: number;
|
||||||
|
/**
|
||||||
|
* The number of requests which reported unsupported operation.
|
||||||
|
*/
|
||||||
unsupportedEvents: number;
|
unsupportedEvents: number;
|
||||||
|
/**
|
||||||
|
* A rolling average (5% current duration) for response time.
|
||||||
|
*/
|
||||||
rollingDuration: number;
|
rollingDuration: number;
|
||||||
|
/**
|
||||||
|
* The ratio of quorum-agreed results to total.
|
||||||
|
*/
|
||||||
score: number;
|
score: number;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -33,17 +72,40 @@ export type FallbackProviderOptions = {
|
|||||||
eventWorkers: number;
|
eventWorkers: number;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* A Fallback Provider.
|
* A **FallbackProvider** manages several [[Providers]] providing
|
||||||
|
* resiliance by switching between slow or misbehaving nodes, security
|
||||||
|
* by requiring multiple backends to aggree and performance by allowing
|
||||||
|
* faster backends to respond earlier.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export declare class FallbackProvider extends AbstractProvider {
|
export declare class FallbackProvider extends AbstractProvider {
|
||||||
#private;
|
#private;
|
||||||
|
/**
|
||||||
|
* The number of backends that must agree on a value before it is
|
||||||
|
* accpeted.
|
||||||
|
*/
|
||||||
readonly quorum: number;
|
readonly quorum: number;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
readonly eventQuorum: number;
|
readonly eventQuorum: number;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
readonly eventWorkers: number;
|
readonly eventWorkers: number;
|
||||||
|
/**
|
||||||
|
* Creates a new **FallbackProvider** with %%providers%% connected to
|
||||||
|
* %%network%%.
|
||||||
|
*
|
||||||
|
* If a [[Provider]] is included in %%providers%%, defaults are used
|
||||||
|
* for the configuration.
|
||||||
|
*/
|
||||||
constructor(providers: Array<AbstractProvider | FallbackProviderConfig>, network?: Networkish);
|
constructor(providers: Array<AbstractProvider | FallbackProviderConfig>, network?: Networkish);
|
||||||
get providerConfigs(): Array<FallbackProviderState>;
|
get providerConfigs(): Array<FallbackProviderState>;
|
||||||
_detectNetwork(): Promise<Network>;
|
_detectNetwork(): Promise<Network>;
|
||||||
|
/**
|
||||||
|
* Transforms a %%req%% into the correct method call on %%provider%%.
|
||||||
|
*/
|
||||||
_translatePerform(provider: AbstractProvider, req: PerformActionRequest): Promise<any>;
|
_translatePerform(provider: AbstractProvider, req: PerformActionRequest): Promise<any>;
|
||||||
_perform<T = any>(req: PerformActionRequest): Promise<T>;
|
_perform<T = any>(req: PerformActionRequest): Promise<T>;
|
||||||
destroy(): Promise<void>;
|
destroy(): Promise<void>;
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"provider-fallback.d.ts","sourceRoot":"","sources":["../../src.ts/providers/provider-fallback.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AA6B9C;;GAEG;AACH,MAAM,WAAW,sBAAsB;IAGnC,QAAQ,EAAE,gBAAgB,CAAC;IAI3B,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,QAAQ,CAAC,sBAAsB,CAAC;IAG3E,WAAW,EAAE,MAAM,CAAC;IAGpB,QAAQ,EAAE,MAAM,CAAC;IAGjB,cAAc,EAAE,MAAM,CAAC;IAGvB,aAAa,EAAE,MAAM,CAAC;IAGtB,SAAS,EAAE,MAAM,CAAC;IAGlB,iBAAiB,EAAE,MAAM,CAAC;IAG1B,eAAe,EAAE,MAAM,CAAC;IAGxB,KAAK,EAAE,MAAM,CAAC;CACjB;AAyCD;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IAGlC,MAAM,EAAE,MAAM,CAAC;IAIf,WAAW,EAAE,MAAM,CAAC;IAKpB,YAAY,EAAE,MAAM,CAAC;CACxB,CAAC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@@
|
|||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
exports.FallbackProvider = void 0;
|
exports.FallbackProvider = void 0;
|
||||||
/**
|
/**
|
||||||
* Explain all the nitty-gritty about the **FallbackProvider**.
|
* A **FallbackProvider** providers resiliance, security and performatnce
|
||||||
|
* in a way that is customizable and configurable.
|
||||||
*
|
*
|
||||||
* @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider]
|
* @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider]
|
||||||
*/
|
*/
|
||||||
@ -202,16 +203,36 @@ function getFuzzyMode(quorum, results) {
|
|||||||
return bestResult;
|
return bestResult;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* A Fallback Provider.
|
* A **FallbackProvider** manages several [[Providers]] providing
|
||||||
|
* resiliance by switching between slow or misbehaving nodes, security
|
||||||
|
* by requiring multiple backends to aggree and performance by allowing
|
||||||
|
* faster backends to respond earlier.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class FallbackProvider extends abstract_provider_js_1.AbstractProvider {
|
class FallbackProvider extends abstract_provider_js_1.AbstractProvider {
|
||||||
|
/**
|
||||||
|
* The number of backends that must agree on a value before it is
|
||||||
|
* accpeted.
|
||||||
|
*/
|
||||||
quorum;
|
quorum;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
eventQuorum;
|
eventQuorum;
|
||||||
|
/**
|
||||||
|
* @_ignore:
|
||||||
|
*/
|
||||||
eventWorkers;
|
eventWorkers;
|
||||||
#configs;
|
#configs;
|
||||||
#height;
|
#height;
|
||||||
#initialSyncPromise;
|
#initialSyncPromise;
|
||||||
|
/**
|
||||||
|
* Creates a new **FallbackProvider** with %%providers%% connected to
|
||||||
|
* %%network%%.
|
||||||
|
*
|
||||||
|
* If a [[Provider]] is included in %%providers%%, defaults are used
|
||||||
|
* for the configuration.
|
||||||
|
*/
|
||||||
constructor(providers, network) {
|
constructor(providers, network) {
|
||||||
super(network);
|
super(network);
|
||||||
this.#configs = providers.map((p) => {
|
this.#configs = providers.map((p) => {
|
||||||
@ -247,6 +268,9 @@ class FallbackProvider extends abstract_provider_js_1.AbstractProvider {
|
|||||||
//_getSubscriber(sub: Subscription): Subscriber {
|
//_getSubscriber(sub: Subscription): Subscriber {
|
||||||
// throw new Error("@TODO");
|
// throw new Error("@TODO");
|
||||||
//}
|
//}
|
||||||
|
/**
|
||||||
|
* Transforms a %%req%% into the correct method call on %%provider%%.
|
||||||
|
*/
|
||||||
async _translatePerform(provider, req) {
|
async _translatePerform(provider, req) {
|
||||||
switch (req.method) {
|
switch (req.method) {
|
||||||
case "broadcastTransaction":
|
case "broadcastTransaction":
|
||||||
|
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user