ccxt 4.2.60 → 4.2.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/build.sh +1 -1
- package/dist/ccxt.browser.js +11280 -3407
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +4 -1
- package/dist/cjs/src/abstract/hyperliquid.js +9 -0
- package/dist/cjs/src/base/Exchange.js +22 -1
- package/dist/cjs/src/base/functions/encode.js +5 -0
- package/dist/cjs/src/base/functions.js +1 -0
- package/dist/cjs/src/bitfinex2.js +1 -1
- package/dist/cjs/src/bitget.js +74 -23
- package/dist/cjs/src/coinbase.js +108 -103
- package/dist/cjs/src/coinex.js +61 -1
- package/dist/cjs/src/hyperliquid.js +2035 -0
- package/dist/cjs/src/kraken.js +8 -2
- package/dist/cjs/src/krakenfutures.js +28 -0
- package/dist/cjs/src/kucoinfutures.js +2 -2
- package/dist/cjs/src/okx.js +1 -1
- package/dist/cjs/src/phemex.js +2 -2
- package/dist/cjs/src/pro/bingx.js +1 -0
- package/dist/cjs/src/static_dependencies/ethers/abi-coder.js +158 -0
- package/dist/cjs/src/static_dependencies/ethers/address/address.js +144 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/abstract-coder.js +407 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/address.js +45 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/anonymous.js +28 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/array.js +176 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/boolean.js +27 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/bytes.js +52 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/fixed-bytes.js +45 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/null.js +30 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/number.js +60 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/string.js +27 -0
- package/dist/cjs/src/static_dependencies/ethers/coders/tuple.js +68 -0
- package/dist/cjs/src/static_dependencies/ethers/fragments.js +614 -0
- package/dist/cjs/src/static_dependencies/ethers/hash/typed-data.js +492 -0
- package/dist/cjs/src/static_dependencies/ethers/index.js +35 -0
- package/dist/cjs/src/static_dependencies/ethers/interface.js +44 -0
- package/dist/cjs/src/static_dependencies/ethers/typed.js +618 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/base58.js +20 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/data.js +134 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/errors.js +228 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/events.js +13 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/fixednumber.js +29 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/index.js +53 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/maths.js +231 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/properties.js +47 -0
- package/dist/cjs/src/static_dependencies/ethers/utils/utf8.js +218 -0
- package/dist/cjs/src/static_dependencies/messagepack/msgpack.js +292 -0
- package/dist/cjs/src/tokocrypto.js +22 -2
- package/dist/cjs/src/wazirx.js +308 -3
- package/js/ccxt.d.ts +5 -2
- package/js/ccxt.js +4 -2
- package/js/src/abstract/coinbase.d.ts +3 -3
- package/js/src/abstract/hyperliquid.d.ts +9 -0
- package/js/src/abstract/hyperliquid.js +11 -0
- package/js/src/base/Exchange.d.ts +4 -0
- package/js/src/base/Exchange.js +13 -1
- package/js/src/base/functions/encode.d.ts +2 -1
- package/js/src/base/functions/encode.js +5 -1
- package/js/src/bitfinex2.js +1 -1
- package/js/src/bitget.js +74 -23
- package/js/src/coinbase.js +108 -103
- package/js/src/coinex.d.ts +3 -1
- package/js/src/coinex.js +61 -1
- package/js/src/hyperliquid.d.ts +83 -0
- package/js/src/hyperliquid.js +2036 -0
- package/js/src/kraken.js +8 -2
- package/js/src/krakenfutures.d.ts +2 -1
- package/js/src/krakenfutures.js +28 -0
- package/js/src/kucoinfutures.js +2 -2
- package/js/src/okx.js +1 -1
- package/js/src/phemex.js +2 -2
- package/js/src/pro/bingx.js +1 -0
- package/js/src/static_dependencies/ethers/abi-coder.d.ts +50 -0
- package/js/src/static_dependencies/ethers/abi-coder.js +148 -0
- package/js/src/static_dependencies/ethers/address/address.d.ts +55 -0
- package/js/src/static_dependencies/ethers/address/address.js +162 -0
- package/js/src/static_dependencies/ethers/address/checks.d.ts +80 -0
- package/js/src/static_dependencies/ethers/address/checks.js +119 -0
- package/js/src/static_dependencies/ethers/address/contract-address.d.ts +47 -0
- package/js/src/static_dependencies/ethers/address/contract-address.js +73 -0
- package/js/src/static_dependencies/ethers/address/index.d.ts +48 -0
- package/js/src/static_dependencies/ethers/address/index.js +24 -0
- package/js/src/static_dependencies/ethers/bytes32.d.ts +14 -0
- package/js/src/static_dependencies/ethers/bytes32.js +45 -0
- package/js/src/static_dependencies/ethers/coders/abstract-coder.d.ts +120 -0
- package/js/src/static_dependencies/ethers/coders/abstract-coder.js +424 -0
- package/js/src/static_dependencies/ethers/coders/address.d.ts +12 -0
- package/js/src/static_dependencies/ethers/coders/address.js +34 -0
- package/js/src/static_dependencies/ethers/coders/anonymous.d.ts +14 -0
- package/js/src/static_dependencies/ethers/coders/anonymous.js +27 -0
- package/js/src/static_dependencies/ethers/coders/array.d.ts +24 -0
- package/js/src/static_dependencies/ethers/coders/array.js +162 -0
- package/js/src/static_dependencies/ethers/coders/boolean.d.ts +12 -0
- package/js/src/static_dependencies/ethers/coders/boolean.js +26 -0
- package/js/src/static_dependencies/ethers/coders/bytes.d.ts +18 -0
- package/js/src/static_dependencies/ethers/coders/bytes.js +39 -0
- package/js/src/static_dependencies/ethers/coders/fixed-bytes.d.ts +14 -0
- package/js/src/static_dependencies/ethers/coders/fixed-bytes.js +32 -0
- package/js/src/static_dependencies/ethers/coders/null.d.ts +11 -0
- package/js/src/static_dependencies/ethers/coders/null.js +29 -0
- package/js/src/static_dependencies/ethers/coders/number.d.ts +15 -0
- package/js/src/static_dependencies/ethers/coders/number.js +48 -0
- package/js/src/static_dependencies/ethers/coders/string.d.ts +12 -0
- package/js/src/static_dependencies/ethers/coders/string.js +26 -0
- package/js/src/static_dependencies/ethers/coders/tuple.d.ts +15 -0
- package/js/src/static_dependencies/ethers/coders/tuple.js +67 -0
- package/js/src/static_dependencies/ethers/fragments.d.ts +458 -0
- package/js/src/static_dependencies/ethers/fragments.js +1252 -0
- package/js/src/static_dependencies/ethers/hash/index.d.ts +10 -0
- package/js/src/static_dependencies/ethers/hash/index.js +15 -0
- package/js/src/static_dependencies/ethers/hash/solidity.d.ts +30 -0
- package/js/src/static_dependencies/ethers/hash/solidity.js +107 -0
- package/js/src/static_dependencies/ethers/hash/typed-data.d.ts +144 -0
- package/js/src/static_dependencies/ethers/hash/typed-data.js +490 -0
- package/js/src/static_dependencies/ethers/index.d.ts +19 -0
- package/js/src/static_dependencies/ethers/index.js +22 -0
- package/js/src/static_dependencies/ethers/interface.d.ts +380 -0
- package/js/src/static_dependencies/ethers/interface.js +990 -0
- package/js/src/static_dependencies/ethers/typed.d.ts +569 -0
- package/js/src/static_dependencies/ethers/typed.js +608 -0
- package/js/src/static_dependencies/ethers/utils/base58.d.ts +22 -0
- package/js/src/static_dependencies/ethers/utils/base58.js +68 -0
- package/js/src/static_dependencies/ethers/utils/base64-browser.d.ts +3 -0
- package/js/src/static_dependencies/ethers/utils/base64-browser.js +24 -0
- package/js/src/static_dependencies/ethers/utils/base64.d.ts +39 -0
- package/js/src/static_dependencies/ethers/utils/base64.js +58 -0
- package/js/src/static_dependencies/ethers/utils/data.d.ts +92 -0
- package/js/src/static_dependencies/ethers/utils/data.js +175 -0
- package/js/src/static_dependencies/ethers/utils/errors.d.ts +509 -0
- package/js/src/static_dependencies/ethers/utils/errors.js +227 -0
- package/js/src/static_dependencies/ethers/utils/events.d.ts +76 -0
- package/js/src/static_dependencies/ethers/utils/events.js +52 -0
- package/js/src/static_dependencies/ethers/utils/fixednumber.d.ts +251 -0
- package/js/src/static_dependencies/ethers/utils/fixednumber.js +529 -0
- package/js/src/static_dependencies/ethers/utils/index.d.ts +30 -0
- package/js/src/static_dependencies/ethers/utils/index.js +38 -0
- package/js/src/static_dependencies/ethers/utils/maths.d.ts +65 -0
- package/js/src/static_dependencies/ethers/utils/maths.js +220 -0
- package/js/src/static_dependencies/ethers/utils/properties.d.ts +22 -0
- package/js/src/static_dependencies/ethers/utils/properties.js +59 -0
- package/js/src/static_dependencies/ethers/utils/rlp-decode.d.ts +5 -0
- package/js/src/static_dependencies/ethers/utils/rlp-decode.js +84 -0
- package/js/src/static_dependencies/ethers/utils/rlp-encode.d.ts +5 -0
- package/js/src/static_dependencies/ethers/utils/rlp-encode.js +54 -0
- package/js/src/static_dependencies/ethers/utils/rlp.d.ts +16 -0
- package/js/src/static_dependencies/ethers/utils/rlp.js +14 -0
- package/js/src/static_dependencies/ethers/utils/units.d.ts +23 -0
- package/js/src/static_dependencies/ethers/utils/units.js +88 -0
- package/js/src/static_dependencies/ethers/utils/utf8.d.ts +95 -0
- package/js/src/static_dependencies/ethers/utils/utf8.js +225 -0
- package/js/src/static_dependencies/ethers/utils/uuid.d.ts +7 -0
- package/js/src/static_dependencies/ethers/utils/uuid.js +35 -0
- package/js/src/static_dependencies/messagepack/msgpack.d.ts +2 -0
- package/js/src/static_dependencies/messagepack/msgpack.js +572 -0
- package/js/src/tokocrypto.js +22 -2
- package/js/src/wazirx.d.ts +12 -1
- package/js/src/wazirx.js +308 -3
- package/package.json +1 -1
- package/skip-tests.json +18 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for common tasks involving hashing. Also see
|
|
3
|
+
* [cryptographic hashing](about-crypto-hashing).
|
|
4
|
+
*
|
|
5
|
+
* @_section: api/hashing:Hashing Utilities [about-hashing]
|
|
6
|
+
*/
|
|
7
|
+
export { id } from "../utils/index.js";
|
|
8
|
+
export { solidityPacked, solidityPackedKeccak256, solidityPackedSha256 } from "./solidity.js";
|
|
9
|
+
export { TypedDataEncoder } from "./typed-data.js";
|
|
10
|
+
export type { TypedDataDomain, TypedDataField } from "./typed-data.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// ----------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
|
4
|
+
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
|
5
|
+
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Utilities for common tasks involving hashing. Also see
|
|
9
|
+
* [cryptographic hashing](about-crypto-hashing).
|
|
10
|
+
*
|
|
11
|
+
* @_section: api/hashing:Hashing Utilities [about-hashing]
|
|
12
|
+
*/
|
|
13
|
+
export { id } from "../utils/index.js";
|
|
14
|
+
export { solidityPacked, solidityPackedKeccak256, solidityPackedSha256 } from "./solidity.js";
|
|
15
|
+
export { TypedDataEncoder } from "./typed-data.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computes the [[link-solc-packed]] representation of %%values%%
|
|
3
|
+
* respectively to their %%types%%.
|
|
4
|
+
*
|
|
5
|
+
* @example:
|
|
6
|
+
* addr = "0x8ba1f109551bd432803012645ac136ddd64dba72"
|
|
7
|
+
* solidityPacked([ "address", "uint" ], [ addr, 45 ]);
|
|
8
|
+
* //_result:
|
|
9
|
+
*/
|
|
10
|
+
export declare function solidityPacked(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
|
|
11
|
+
/**
|
|
12
|
+
* Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%%
|
|
13
|
+
* respectively to their %%types%%.
|
|
14
|
+
*
|
|
15
|
+
* @example:
|
|
16
|
+
* addr = "0x8ba1f109551bd432803012645ac136ddd64dba72"
|
|
17
|
+
* solidityPackedKeccak256([ "address", "uint" ], [ addr, 45 ]);
|
|
18
|
+
* //_result:
|
|
19
|
+
*/
|
|
20
|
+
export declare function solidityPackedKeccak256(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
|
|
21
|
+
/**
|
|
22
|
+
* Computes the [[link-solc-packed]] [[sha256]] hash of %%values%%
|
|
23
|
+
* respectively to their %%types%%.
|
|
24
|
+
*
|
|
25
|
+
* @example:
|
|
26
|
+
* addr = "0x8ba1f109551bd432803012645ac136ddd64dba72"
|
|
27
|
+
* solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]);
|
|
28
|
+
* //_result:
|
|
29
|
+
*/
|
|
30
|
+
export declare function solidityPackedSha256(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// ----------------------------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
|
4
|
+
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
|
5
|
+
// EDIT THE CORRESPONDENT .ts FILE INSTEAD
|
|
6
|
+
|
|
7
|
+
import { getAddress } from "../address/index.js";
|
|
8
|
+
import { concat, dataLength, getBytes, hexlify, toBeArray, toTwos, toUtf8Bytes, zeroPadBytes, zeroPadValue, assertArgument, keccak256 as _keccak256, sha256 as _sha256 } from "../utils/index.js";
|
|
9
|
+
const regexBytes = new RegExp("^bytes([0-9]+)$");
|
|
10
|
+
const regexNumber = new RegExp("^(u?int)([0-9]*)$");
|
|
11
|
+
const regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$");
|
|
12
|
+
function _pack(type, value, isArray) {
|
|
13
|
+
switch (type) {
|
|
14
|
+
case "address":
|
|
15
|
+
if (isArray) {
|
|
16
|
+
return getBytes(zeroPadValue(value, 32));
|
|
17
|
+
}
|
|
18
|
+
return getBytes(getAddress(value));
|
|
19
|
+
case "string":
|
|
20
|
+
return toUtf8Bytes(value);
|
|
21
|
+
case "bytes":
|
|
22
|
+
return getBytes(value);
|
|
23
|
+
case "bool":
|
|
24
|
+
value = (!!value ? "0x01" : "0x00");
|
|
25
|
+
if (isArray) {
|
|
26
|
+
return getBytes(zeroPadValue(value, 32));
|
|
27
|
+
}
|
|
28
|
+
return getBytes(value);
|
|
29
|
+
}
|
|
30
|
+
let match = type.match(regexNumber);
|
|
31
|
+
if (match) {
|
|
32
|
+
let signed = (match[1] === "int");
|
|
33
|
+
let size = parseInt(match[2] || "256");
|
|
34
|
+
assertArgument((!match[2] || match[2] === String(size)) && (size % 8 === 0) && size !== 0 && size <= 256, "invalid number type", "type", type);
|
|
35
|
+
if (isArray) {
|
|
36
|
+
size = 256;
|
|
37
|
+
}
|
|
38
|
+
if (signed) {
|
|
39
|
+
value = toTwos(value, size);
|
|
40
|
+
}
|
|
41
|
+
return getBytes(zeroPadValue(toBeArray(value), size / 8));
|
|
42
|
+
}
|
|
43
|
+
match = type.match(regexBytes);
|
|
44
|
+
if (match) {
|
|
45
|
+
const size = parseInt(match[1]);
|
|
46
|
+
assertArgument(String(size) === match[1] && size !== 0 && size <= 32, "invalid bytes type", "type", type);
|
|
47
|
+
assertArgument(dataLength(value) === size, `invalid value for ${type}`, "value", value);
|
|
48
|
+
if (isArray) {
|
|
49
|
+
return getBytes(zeroPadBytes(value, 32));
|
|
50
|
+
}
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
match = type.match(regexArray);
|
|
54
|
+
if (match && Array.isArray(value)) {
|
|
55
|
+
const baseType = match[1];
|
|
56
|
+
const count = parseInt(match[2] || String(value.length));
|
|
57
|
+
assertArgument(count === value.length, `invalid array length for ${type}`, "value", value);
|
|
58
|
+
const result = [];
|
|
59
|
+
value.forEach(function (value) {
|
|
60
|
+
result.push(_pack(baseType, value, true));
|
|
61
|
+
});
|
|
62
|
+
return getBytes(concat(result));
|
|
63
|
+
}
|
|
64
|
+
assertArgument(false, "invalid type", "type", type);
|
|
65
|
+
}
|
|
66
|
+
// @TODO: Array Enum
|
|
67
|
+
/**
|
|
68
|
+
* Computes the [[link-solc-packed]] representation of %%values%%
|
|
69
|
+
* respectively to their %%types%%.
|
|
70
|
+
*
|
|
71
|
+
* @example:
|
|
72
|
+
* addr = "0x8ba1f109551bd432803012645ac136ddd64dba72"
|
|
73
|
+
* solidityPacked([ "address", "uint" ], [ addr, 45 ]);
|
|
74
|
+
* //_result:
|
|
75
|
+
*/
|
|
76
|
+
export function solidityPacked(types, values) {
|
|
77
|
+
assertArgument(types.length === values.length, "wrong number of values; expected ${ types.length }", "values", values);
|
|
78
|
+
const tight = [];
|
|
79
|
+
types.forEach(function (type, index) {
|
|
80
|
+
tight.push(_pack(type, values[index]));
|
|
81
|
+
});
|
|
82
|
+
return hexlify(concat(tight));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%%
|
|
86
|
+
* respectively to their %%types%%.
|
|
87
|
+
*
|
|
88
|
+
* @example:
|
|
89
|
+
* addr = "0x8ba1f109551bd432803012645ac136ddd64dba72"
|
|
90
|
+
* solidityPackedKeccak256([ "address", "uint" ], [ addr, 45 ]);
|
|
91
|
+
* //_result:
|
|
92
|
+
*/
|
|
93
|
+
export function solidityPackedKeccak256(types, values) {
|
|
94
|
+
return _keccak256(solidityPacked(types, values));
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Computes the [[link-solc-packed]] [[sha256]] hash of %%values%%
|
|
98
|
+
* respectively to their %%types%%.
|
|
99
|
+
*
|
|
100
|
+
* @example:
|
|
101
|
+
* addr = "0x8ba1f109551bd432803012645ac136ddd64dba72"
|
|
102
|
+
* solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]);
|
|
103
|
+
* //_result:
|
|
104
|
+
*/
|
|
105
|
+
export function solidityPackedSha256(types, values) {
|
|
106
|
+
return _sha256(solidityPacked(types, values));
|
|
107
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { BigNumberish, BytesLike } from "../utils/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* The domain for an [[link-eip-712]] payload.
|
|
4
|
+
*/
|
|
5
|
+
export interface TypedDataDomain {
|
|
6
|
+
/**
|
|
7
|
+
* The human-readable name of the signing domain.
|
|
8
|
+
*/
|
|
9
|
+
name?: null | string;
|
|
10
|
+
/**
|
|
11
|
+
* The major version of the signing domain.
|
|
12
|
+
*/
|
|
13
|
+
version?: null | string;
|
|
14
|
+
/**
|
|
15
|
+
* The chain ID of the signing domain.
|
|
16
|
+
*/
|
|
17
|
+
chainId?: null | BigNumberish;
|
|
18
|
+
/**
|
|
19
|
+
* The the address of the contract that will verify the signature.
|
|
20
|
+
*/
|
|
21
|
+
verifyingContract?: null | string;
|
|
22
|
+
/**
|
|
23
|
+
* A salt used for purposes decided by the specific domain.
|
|
24
|
+
*/
|
|
25
|
+
salt?: null | BytesLike;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A specific field of a structured [[link-eip-712]] type.
|
|
29
|
+
*/
|
|
30
|
+
export interface TypedDataField {
|
|
31
|
+
/**
|
|
32
|
+
* The field name.
|
|
33
|
+
*/
|
|
34
|
+
name: string;
|
|
35
|
+
/**
|
|
36
|
+
* The type of the field.
|
|
37
|
+
*/
|
|
38
|
+
type: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads
|
|
42
|
+
* for signed typed data.
|
|
43
|
+
*
|
|
44
|
+
* This is useful for those that wish to compute various components of a
|
|
45
|
+
* typed data hash, primary types, or sub-components, but generally the
|
|
46
|
+
* higher level [[Signer-signTypedData]] is more useful.
|
|
47
|
+
*/
|
|
48
|
+
export declare class TypedDataEncoder {
|
|
49
|
+
#private;
|
|
50
|
+
/**
|
|
51
|
+
* The primary type for the structured [[types]].
|
|
52
|
+
*
|
|
53
|
+
* This is derived automatically from the [[types]], since no
|
|
54
|
+
* recursion is possible, once the DAG for the types is consturcted
|
|
55
|
+
* internally, the primary type must be the only remaining type with
|
|
56
|
+
* no parent nodes.
|
|
57
|
+
*/
|
|
58
|
+
readonly primaryType: string;
|
|
59
|
+
/**
|
|
60
|
+
* The types.
|
|
61
|
+
*/
|
|
62
|
+
get types(): Record<string, Array<TypedDataField>>;
|
|
63
|
+
/**
|
|
64
|
+
* Create a new **TypedDataEncoder** for %%types%%.
|
|
65
|
+
*
|
|
66
|
+
* This performs all necessary checking that types are valid and
|
|
67
|
+
* do not violate the [[link-eip-712]] structural constraints as
|
|
68
|
+
* well as computes the [[primaryType]].
|
|
69
|
+
*/
|
|
70
|
+
constructor(types: Record<string, Array<TypedDataField>>);
|
|
71
|
+
/**
|
|
72
|
+
* Returnthe encoder for the specific %%type%%.
|
|
73
|
+
*/
|
|
74
|
+
getEncoder(type: string): (value: any) => string;
|
|
75
|
+
/**
|
|
76
|
+
* Return the full type for %%name%%.
|
|
77
|
+
*/
|
|
78
|
+
encodeType(name: string): string;
|
|
79
|
+
/**
|
|
80
|
+
* Return the encoded %%value%% for the %%type%%.
|
|
81
|
+
*/
|
|
82
|
+
encodeData(type: string, value: any): string;
|
|
83
|
+
/**
|
|
84
|
+
* Returns the hash of %%value%% for the type of %%name%%.
|
|
85
|
+
*/
|
|
86
|
+
hashStruct(name: string, value: Record<string, any>): string;
|
|
87
|
+
/**
|
|
88
|
+
* Return the fulled encoded %%value%% for the [[types]].
|
|
89
|
+
*/
|
|
90
|
+
encode(value: Record<string, any>): string;
|
|
91
|
+
/**
|
|
92
|
+
* Return the hash of the fully encoded %%value%% for the [[types]].
|
|
93
|
+
*/
|
|
94
|
+
hash(value: Record<string, any>): string;
|
|
95
|
+
/**
|
|
96
|
+
* @_ignore:
|
|
97
|
+
*/
|
|
98
|
+
_visit(type: string, value: any, callback: (type: string, data: any) => any): any;
|
|
99
|
+
/**
|
|
100
|
+
* Call %%calback%% for each value in %%value%%, passing the type and
|
|
101
|
+
* component within %%value%%.
|
|
102
|
+
*
|
|
103
|
+
* This is useful for replacing addresses or other transformation that
|
|
104
|
+
* may be desired on each component, based on its type.
|
|
105
|
+
*/
|
|
106
|
+
visit(value: Record<string, any>, callback: (type: string, data: any) => any): any;
|
|
107
|
+
/**
|
|
108
|
+
* Create a new **TypedDataEncoder** for %%types%%.
|
|
109
|
+
*/
|
|
110
|
+
static from(types: Record<string, Array<TypedDataField>>): TypedDataEncoder;
|
|
111
|
+
/**
|
|
112
|
+
* Return the primary type for %%types%%.
|
|
113
|
+
*/
|
|
114
|
+
static getPrimaryType(types: Record<string, Array<TypedDataField>>): string;
|
|
115
|
+
/**
|
|
116
|
+
* Return the hashed struct for %%value%% using %%types%% and %%name%%.
|
|
117
|
+
*/
|
|
118
|
+
static hashStruct(name: string, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): string;
|
|
119
|
+
/**
|
|
120
|
+
* Return the domain hash for %%domain%%.
|
|
121
|
+
*/
|
|
122
|
+
static hashDomain(domain: TypedDataDomain): string;
|
|
123
|
+
/**
|
|
124
|
+
* Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.
|
|
125
|
+
*/
|
|
126
|
+
static encode(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): string;
|
|
127
|
+
/**
|
|
128
|
+
* Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%.
|
|
129
|
+
*/
|
|
130
|
+
static hash(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): string;
|
|
131
|
+
/**
|
|
132
|
+
* Resolves to the value from resolving all addresses in %%value%% for
|
|
133
|
+
* %%types%% and the %%domain%%.
|
|
134
|
+
*/
|
|
135
|
+
static resolveNames(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>, resolveName: (name: string) => Promise<string>): Promise<{
|
|
136
|
+
domain: TypedDataDomain;
|
|
137
|
+
value: any;
|
|
138
|
+
}>;
|
|
139
|
+
/**
|
|
140
|
+
* Returns the JSON-encoded payload expected by nodes which implement
|
|
141
|
+
* the JSON-RPC [[link-eip-712]] method.
|
|
142
|
+
*/
|
|
143
|
+
static getPayload(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): any;
|
|
144
|
+
}
|