quantumcoin 7.0.3 → 7.0.4
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/.github/workflows/publish-npmjs.yaml +22 -22
- package/.gitignore +15 -15
- package/LICENSE +21 -21
- package/README-SDK.md +756 -754
- package/README.md +165 -150
- package/SPEC.md +3845 -3843
- package/config.d.ts +50 -50
- package/config.js +115 -115
- package/examples/AllSolidityTypes.sol +184 -184
- package/examples/SimpleIERC20.sol +74 -74
- package/examples/events.js +41 -35
- package/examples/events.ts +35 -0
- package/examples/example-generator-sdk-js.js +100 -95
- package/examples/example-generator-sdk-js.ts +77 -0
- package/examples/example-generator-sdk-ts.js +100 -95
- package/examples/example-generator-sdk-ts.ts +77 -0
- package/examples/example.js +72 -61
- package/examples/example.ts +61 -0
- package/examples/offline-signing.js +79 -73
- package/examples/offline-signing.ts +66 -0
- package/examples/package-lock.json +48 -57
- package/examples/package.json +32 -16
- package/examples/read-operations.js +32 -27
- package/examples/read-operations.ts +31 -0
- package/examples/sdk-generator-erc20.inline.json +251 -251
- package/examples/solidity-types.ts +43 -43
- package/examples/wallet-offline.js +35 -29
- package/examples/wallet-offline.ts +34 -0
- package/generate-sdk.js +1824 -1490
- package/index.js +12 -12
- package/package.json +95 -75
- package/scripts/copy-declarations.js +31 -0
- package/scripts/run-all-one-by-one.js +151 -0
- package/src/abi/fragments.d.ts +42 -42
- package/src/abi/fragments.js +63 -63
- package/src/abi/index.d.ts +13 -13
- package/src/abi/index.js +9 -9
- package/src/abi/interface.d.ts +128 -132
- package/src/abi/interface.js +590 -590
- package/src/abi/js-abi-coder.d.ts +8 -0
- package/src/abi/js-abi-coder.js +474 -474
- package/src/constants.d.ts +66 -61
- package/src/constants.js +101 -94
- package/src/contract/contract-factory.d.ts +28 -28
- package/src/contract/contract-factory.js +105 -105
- package/src/contract/contract.d.ts +113 -114
- package/src/contract/contract.js +354 -354
- package/src/contract/index.d.ts +9 -9
- package/src/contract/index.js +9 -9
- package/src/errors/index.d.ts +92 -92
- package/src/errors/index.js +188 -188
- package/src/generator/index.d.ts +74 -0
- package/src/generator/index.js +1404 -1404
- package/src/index.d.ts +125 -127
- package/src/index.js +41 -41
- package/src/internal/hex.d.ts +61 -61
- package/src/internal/hex.js +144 -144
- package/src/providers/extra-providers.d.ts +139 -128
- package/src/providers/extra-providers.js +600 -575
- package/src/providers/index.d.ts +17 -16
- package/src/providers/index.js +10 -10
- package/src/providers/json-rpc-provider.d.ts +12 -12
- package/src/providers/json-rpc-provider.js +79 -79
- package/src/providers/provider.d.ts +207 -203
- package/src/providers/provider.js +392 -371
- package/src/types/index.d.ts +214 -462
- package/src/types/index.js +9 -9
- package/src/utils/address.d.ts +72 -72
- package/src/utils/address.js +181 -182
- package/src/utils/encoding.d.ts +120 -120
- package/src/utils/encoding.js +306 -306
- package/src/utils/hashing.d.ts +82 -76
- package/src/utils/hashing.js +313 -298
- package/src/utils/index.d.ts +65 -55
- package/src/utils/index.js +13 -13
- package/src/utils/result.d.ts +57 -57
- package/src/utils/result.js +128 -128
- package/src/utils/rlp.d.ts +12 -12
- package/src/utils/rlp.js +200 -200
- package/src/utils/units.d.ts +29 -29
- package/src/utils/units.js +107 -107
- package/src/wallet/index.d.ts +10 -10
- package/src/wallet/index.js +8 -8
- package/src/wallet/wallet.d.ts +160 -160
- package/src/wallet/wallet.js +483 -489
- package/test/e2e/all-solidity-types.dynamic.test.js +207 -200
- package/test/e2e/all-solidity-types.dynamic.test.ts +191 -0
- package/test/e2e/all-solidity-types.fixtures.js +231 -231
- package/test/e2e/all-solidity-types.generated-sdks.e2e.test.js +387 -368
- package/test/e2e/all-solidity-types.generated-sdks.e2e.test.ts +350 -0
- package/test/e2e/helpers.js +59 -47
- package/test/e2e/signing-context-and-fee.e2e.test.js +137 -0
- package/test/e2e/signing-context-and-fee.e2e.test.ts +128 -0
- package/test/e2e/simple-erc20.generated-sdks.e2e.test.js +168 -151
- package/test/e2e/simple-erc20.generated-sdks.e2e.test.ts +141 -0
- package/test/e2e/transactional.test.js +245 -191
- package/test/e2e/transactional.test.ts +208 -0
- package/test/e2e/typed-generator.e2e.test.js +407 -404
- package/test/e2e/typed-generator.e2e.test.ts +337 -0
- package/test/fixtures/ConstructorParam.sol +23 -23
- package/test/fixtures/MultiContracts.sol +37 -37
- package/test/fixtures/SimpleStorage.sol +18 -18
- package/test/fixtures/StakingContract.abi.json +1 -1
- package/test/integration/ipc-provider.test.js +49 -44
- package/test/integration/ipc-provider.test.ts +44 -0
- package/test/integration/provider.test.js +88 -72
- package/test/integration/provider.test.ts +85 -0
- package/test/integration/ws-provider.test.js +41 -33
- package/test/integration/ws-provider.test.ts +38 -0
- package/test/security/malformed-input.test.js +37 -31
- package/test/security/malformed-input.test.ts +35 -0
- package/test/unit/_encrypted-output.txt +6 -0
- package/test/unit/_log-encrypted-jsons.js +45 -0
- package/test/unit/_write-keystore-fixture.js +16 -0
- package/test/unit/abi-interface.test.js +103 -98
- package/test/unit/abi-interface.test.ts +102 -0
- package/test/unit/address-wallet.test.js +355 -257
- package/test/unit/address-wallet.test.ts +342 -0
- package/test/unit/browser-provider.test.js +85 -82
- package/test/unit/browser-provider.test.ts +79 -0
- package/test/unit/contract.test.js +85 -82
- package/test/unit/contract.test.ts +83 -0
- package/test/unit/encoding-units-rlp.test.js +92 -89
- package/test/unit/encoding-units-rlp.test.ts +91 -0
- package/test/unit/errors.test.js +77 -74
- package/test/unit/errors.test.ts +76 -0
- package/test/unit/filter-by-blockhash.test.js +55 -52
- package/test/unit/filter-by-blockhash.test.ts +54 -0
- package/test/unit/fixtures/encrypted-keystores-48-32-36.js +9 -0
- package/test/unit/generate-contract-cli.test.js +42 -39
- package/test/unit/generate-contract-cli.test.ts +41 -0
- package/test/unit/generate-sdk-artifacts-json.test.js +113 -110
- package/test/unit/generate-sdk-artifacts-json.test.ts +110 -0
- package/test/unit/generator.test.js +102 -99
- package/test/unit/generator.test.ts +101 -0
- package/test/unit/hashing.test.js +68 -54
- package/test/unit/hashing.test.ts +67 -0
- package/test/unit/init.test.js +39 -36
- package/test/unit/init.test.ts +38 -0
- package/test/unit/interface.test.js +56 -53
- package/test/unit/interface.test.ts +54 -0
- package/test/unit/internal-hex.test.js +50 -47
- package/test/unit/internal-hex.test.ts +49 -0
- package/test/unit/populate-transaction.test.js +65 -62
- package/test/unit/populate-transaction.test.ts +64 -0
- package/test/unit/providers.test.js +200 -144
- package/test/unit/providers.test.ts +196 -0
- package/test/unit/result.test.js +80 -77
- package/test/unit/result.test.ts +79 -0
- package/test/unit/solidity-types.test.js +49 -46
- package/test/unit/solidity-types.test.ts +39 -0
- package/test/unit/utils.test.js +57 -54
- package/test/unit/utils.test.ts +56 -0
- package/test/verbose-logger.js +74 -0
- package/tsconfig.build.json +14 -0
package/src/index.d.ts
CHANGED
|
@@ -1,127 +1,125 @@
|
|
|
1
|
-
declare const _exports: {
|
|
2
|
-
isError:
|
|
3
|
-
isCallException:
|
|
4
|
-
makeError:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
export type SolidityStruct = import("./types").SolidityStruct;
|
|
127
|
-
}
|
|
1
|
+
declare const _exports: {
|
|
2
|
+
isError(error: any, code: string): boolean;
|
|
3
|
+
isCallException(error: any): boolean;
|
|
4
|
+
makeError(message: string, code: errors.ErrorCode, info?: Record<string, any> | undefined): Error & {
|
|
5
|
+
code: errors.ErrorCode;
|
|
6
|
+
shortMessage: string;
|
|
7
|
+
};
|
|
8
|
+
assert(check: any, message: string, code: errors.ErrorCode, info?: Record<string, any> | undefined): void;
|
|
9
|
+
assertArgument(check: any, message: string, name: string, value: any): void;
|
|
10
|
+
ProviderError: typeof errors.ProviderError;
|
|
11
|
+
TransactionError: typeof errors.TransactionError;
|
|
12
|
+
ContractError: typeof errors.ContractError;
|
|
13
|
+
formatUnits(value: import("./utils/units").BigNumberish, decimals?: number | undefined): string;
|
|
14
|
+
parseUnits(value: string, decimals?: number | undefined): bigint;
|
|
15
|
+
formatEther(value: import("./utils/units").BigNumberish): string;
|
|
16
|
+
parseEther(value: string): bigint;
|
|
17
|
+
WeiPerEther: bigint;
|
|
18
|
+
checkResultErrors(result: any): Array<{
|
|
19
|
+
error: Error;
|
|
20
|
+
path: Array<string | number>;
|
|
21
|
+
}>;
|
|
22
|
+
Result: typeof import("./utils/result").Result;
|
|
23
|
+
encodeRlp(value: any): string;
|
|
24
|
+
decodeRlp(data: string): any;
|
|
25
|
+
keccak256(data: string | Uint8Array): string;
|
|
26
|
+
hashMessage(message: string | Uint8Array): string;
|
|
27
|
+
sha256(data: string | Uint8Array): string;
|
|
28
|
+
sha512(data: string | Uint8Array): string;
|
|
29
|
+
ripemd160(data: string | Uint8Array): string;
|
|
30
|
+
id(text: string): string;
|
|
31
|
+
randomBytes(length: number): Uint8Array;
|
|
32
|
+
computeHmac(algorithm: string, key: string | Uint8Array, data: string | Uint8Array): string;
|
|
33
|
+
pbkdf2(password: string | Uint8Array, salt: string | Uint8Array, iterations: number, keylen: number, algorithm?: string | undefined): string;
|
|
34
|
+
scrypt(password: string | Uint8Array, salt: string | Uint8Array, N: number, r: number, p: number, dkLen: number): Promise<string>;
|
|
35
|
+
scryptSync(password: string | Uint8Array, salt: string | Uint8Array, N: number, r: number, p: number, dkLen: number): string;
|
|
36
|
+
toUtf8String(data: import("./utils/encoding").BytesLike): string;
|
|
37
|
+
toUtf8Bytes(str: string): Uint8Array;
|
|
38
|
+
toHex(data: import("./utils/encoding").BytesLike): string;
|
|
39
|
+
hexlify(data: import("./utils/encoding").BytesLike): string;
|
|
40
|
+
arrayify(data: import("./utils/encoding").BytesLike): Uint8Array;
|
|
41
|
+
concat(items: import("./utils/encoding").BytesLike[]): string;
|
|
42
|
+
stripZerosLeft(data: import("./utils/encoding").BytesLike): string;
|
|
43
|
+
encodeBytes32String(text: string): string;
|
|
44
|
+
decodeBytes32String(bytes: import("./utils/encoding").BytesLike): string;
|
|
45
|
+
decodeBase58(data: string): Uint8Array;
|
|
46
|
+
decodeBase64(data: string): Uint8Array;
|
|
47
|
+
encodeBase58(data: import("./utils/encoding").BytesLike): string;
|
|
48
|
+
encodeBase64(data: import("./utils/encoding").BytesLike): string;
|
|
49
|
+
toUtf8CodePoints(str: string): number[];
|
|
50
|
+
isBytesLike(value: any): boolean;
|
|
51
|
+
zeroPad(value: import("./utils/encoding").BytesLike, length: number): string;
|
|
52
|
+
zeroPadValue(value: import("./utils/encoding").BytesLike, length: number): string;
|
|
53
|
+
solidityPacked(): void;
|
|
54
|
+
solidityPackedKeccak256(): void;
|
|
55
|
+
solidityPackedSha256(): void;
|
|
56
|
+
isHexString: typeof import("./internal/hex").isHexString;
|
|
57
|
+
bytesToHex: typeof import("./internal/hex").bytesToHex;
|
|
58
|
+
hexToBytes: typeof import("./internal/hex").hexToBytes;
|
|
59
|
+
isAddress(address: string): boolean;
|
|
60
|
+
getAddress(address: string): string;
|
|
61
|
+
isAddressable(value: any): boolean;
|
|
62
|
+
resolveAddress(target: any): string | Promise<string>;
|
|
63
|
+
getContractAddress(tx: {
|
|
64
|
+
from: string;
|
|
65
|
+
nonce: number;
|
|
66
|
+
}): string;
|
|
67
|
+
getCreateAddress(tx: {
|
|
68
|
+
from: string;
|
|
69
|
+
nonce: number;
|
|
70
|
+
}): string;
|
|
71
|
+
getCreate2Address(from: string, salt: string, initCodeHash: string): string;
|
|
72
|
+
computeAddress(key: string | Uint8Array): string;
|
|
73
|
+
verifyMessage(message: string | Uint8Array, signature: string): string;
|
|
74
|
+
recoverAddress(message: string | Uint8Array, signature: string): string;
|
|
75
|
+
Interface: typeof import("./abi/interface").Interface;
|
|
76
|
+
AbiCoder: typeof import("./abi/interface").AbiCoder;
|
|
77
|
+
Fragment: typeof import("./abi/fragments").Fragment;
|
|
78
|
+
NamedFragment: typeof import("./abi/fragments").NamedFragment;
|
|
79
|
+
FunctionFragment: typeof import("./abi/fragments").FunctionFragment;
|
|
80
|
+
EventFragment: typeof import("./abi/fragments").EventFragment;
|
|
81
|
+
ErrorFragment: typeof import("./abi/fragments").ErrorFragment;
|
|
82
|
+
ConstructorFragment: typeof import("./abi/fragments").ConstructorFragment;
|
|
83
|
+
StructFragment: typeof import("./abi/fragments").StructFragment;
|
|
84
|
+
FallbackFragment: typeof import("./abi/fragments").FallbackFragment;
|
|
85
|
+
ContractFactory: typeof import("./contract/contract-factory").ContractFactory;
|
|
86
|
+
BaseContract: typeof import("./contract/contract").BaseContract;
|
|
87
|
+
Contract: typeof import("./contract/contract").Contract;
|
|
88
|
+
ContractTransactionResponse: typeof import("./contract/contract").ContractTransactionResponse;
|
|
89
|
+
ContractTransactionReceipt: typeof import("./contract/contract").ContractTransactionReceipt;
|
|
90
|
+
EventLog: typeof import("./contract/contract").EventLog;
|
|
91
|
+
SigningKey: typeof import("./wallet/wallet").SigningKey;
|
|
92
|
+
AbstractSigner: typeof import("./wallet/wallet").AbstractSigner;
|
|
93
|
+
BaseWallet: typeof import("./wallet/wallet").BaseWallet;
|
|
94
|
+
Wallet: typeof import("./wallet/wallet").Wallet;
|
|
95
|
+
NonceManager: typeof import("./wallet/wallet").NonceManager;
|
|
96
|
+
JsonRpcSigner: typeof import("./wallet/wallet").JsonRpcSigner;
|
|
97
|
+
VoidSigner: typeof import("./wallet/wallet").VoidSigner;
|
|
98
|
+
getProvider(endpoint?: string | undefined, chainId?: number | undefined): import("./providers/provider").AbstractProvider;
|
|
99
|
+
WebSocketProvider: typeof import("./providers/extra-providers").WebSocketProvider;
|
|
100
|
+
IpcSocketProvider: typeof import("./providers/extra-providers").IpcSocketProvider;
|
|
101
|
+
BrowserProvider: typeof import("./providers/extra-providers").BrowserProvider;
|
|
102
|
+
FallbackProvider: typeof import("./providers/extra-providers").FallbackProvider;
|
|
103
|
+
FilterByBlockHash: typeof import("./providers/extra-providers").FilterByBlockHash;
|
|
104
|
+
JsonRpcProvider: typeof import("./providers/json-rpc-provider").JsonRpcProvider;
|
|
105
|
+
JsonRpcApiProvider: typeof import("./providers/json-rpc-provider").JsonRpcApiProvider;
|
|
106
|
+
Provider: typeof import("./providers/provider").Provider;
|
|
107
|
+
AbstractProvider: typeof import("./providers/provider").AbstractProvider;
|
|
108
|
+
Block: typeof import("./providers/provider").Block;
|
|
109
|
+
TransactionResponse: typeof import("./providers/provider").TransactionResponse;
|
|
110
|
+
TransactionReceipt: typeof import("./providers/provider").TransactionReceipt;
|
|
111
|
+
Log: typeof import("./providers/provider").Log;
|
|
112
|
+
version: string;
|
|
113
|
+
ZeroAddress: string;
|
|
114
|
+
ZeroHash: string;
|
|
115
|
+
MaxUint256: bigint;
|
|
116
|
+
MaxUint160: bigint;
|
|
117
|
+
MinInt256: bigint;
|
|
118
|
+
MaxInt256: bigint;
|
|
119
|
+
NumericFault: string;
|
|
120
|
+
NumericFaultCode: string;
|
|
121
|
+
EtherSymbol: string;
|
|
122
|
+
N: bigint;
|
|
123
|
+
};
|
|
124
|
+
export = _exports;
|
|
125
|
+
import errors = require("./errors");
|
package/src/index.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview QuantumCoin.js main entrypoint (ethers.js v6 compatible API surface).
|
|
3
|
-
*
|
|
4
|
-
* IMPORTANT: Call `Initialize()` (from `quantumcoin/config`) before using
|
|
5
|
-
* any functionality that relies on `quantum-coin-js-sdk` (address validation,
|
|
6
|
-
* ABI packing/unpacking, signing, etc.).
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
// Core constants
|
|
10
|
-
const constants = require("./constants");
|
|
11
|
-
|
|
12
|
-
// Modules
|
|
13
|
-
const providers = require("./providers");
|
|
14
|
-
const wallet = require("./wallet");
|
|
15
|
-
const contract = require("./contract");
|
|
16
|
-
const abi = require("./abi");
|
|
17
|
-
const utils = require("./utils");
|
|
18
|
-
const errors = require("./errors");
|
|
19
|
-
|
|
20
|
-
module.exports = {
|
|
21
|
-
...constants,
|
|
22
|
-
|
|
23
|
-
// Providers
|
|
24
|
-
...providers,
|
|
25
|
-
|
|
26
|
-
// Wallet / signers
|
|
27
|
-
...wallet,
|
|
28
|
-
|
|
29
|
-
// Contracts
|
|
30
|
-
...contract,
|
|
31
|
-
|
|
32
|
-
// ABI
|
|
33
|
-
...abi,
|
|
34
|
-
|
|
35
|
-
// Utils
|
|
36
|
-
...utils,
|
|
37
|
-
|
|
38
|
-
// Errors
|
|
39
|
-
...errors,
|
|
40
|
-
};
|
|
41
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview QuantumCoin.js main entrypoint (ethers.js v6 compatible API surface).
|
|
3
|
+
*
|
|
4
|
+
* IMPORTANT: Call `Initialize()` (from `quantumcoin/config`) before using
|
|
5
|
+
* any functionality that relies on `quantum-coin-js-sdk` (address validation,
|
|
6
|
+
* ABI packing/unpacking, signing, etc.).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// Core constants
|
|
10
|
+
const constants = require("./constants");
|
|
11
|
+
|
|
12
|
+
// Modules
|
|
13
|
+
const providers = require("./providers");
|
|
14
|
+
const wallet = require("./wallet");
|
|
15
|
+
const contract = require("./contract");
|
|
16
|
+
const abi = require("./abi");
|
|
17
|
+
const utils = require("./utils");
|
|
18
|
+
const errors = require("./errors");
|
|
19
|
+
|
|
20
|
+
module.exports = {
|
|
21
|
+
...constants,
|
|
22
|
+
|
|
23
|
+
// Providers
|
|
24
|
+
...providers,
|
|
25
|
+
|
|
26
|
+
// Wallet / signers
|
|
27
|
+
...wallet,
|
|
28
|
+
|
|
29
|
+
// Contracts
|
|
30
|
+
...contract,
|
|
31
|
+
|
|
32
|
+
// ABI
|
|
33
|
+
...abi,
|
|
34
|
+
|
|
35
|
+
// Utils
|
|
36
|
+
...utils,
|
|
37
|
+
|
|
38
|
+
// Errors
|
|
39
|
+
...errors,
|
|
40
|
+
};
|
|
41
|
+
|
package/src/internal/hex.d.ts
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Return true if `value` is a Uint8Array.
|
|
3
|
-
* @param {any} value
|
|
4
|
-
* @returns {value is Uint8Array}
|
|
5
|
-
*/
|
|
6
|
-
export function isUint8Array(value: any): value is Uint8Array;
|
|
7
|
-
/**
|
|
8
|
-
* Normalize a hex string.
|
|
9
|
-
* @param {string} hex
|
|
10
|
-
* @returns {string}
|
|
11
|
-
*/
|
|
12
|
-
export function normalizeHex(hex: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* Returns true if value is a hex string.
|
|
15
|
-
* @param {any} value
|
|
16
|
-
* @param {number=} lengthBytes Optional exact byte length.
|
|
17
|
-
* @returns {boolean}
|
|
18
|
-
*/
|
|
19
|
-
export function isHexString(value: any, lengthBytes?: number | undefined): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Strip 0x prefix.
|
|
22
|
-
* @param {string} hex
|
|
23
|
-
* @returns {string}
|
|
24
|
-
*/
|
|
25
|
-
export function strip0x(hex: string): string;
|
|
26
|
-
/**
|
|
27
|
-
* Ensure a 0x prefix.
|
|
28
|
-
* @param {string} hex
|
|
29
|
-
* @returns {string}
|
|
30
|
-
*/
|
|
31
|
-
export function add0x(hex: string): string;
|
|
32
|
-
/**
|
|
33
|
-
* Convert a hex string to bytes.
|
|
34
|
-
* @param {string} hex
|
|
35
|
-
* @returns {Uint8Array}
|
|
36
|
-
*/
|
|
37
|
-
export function hexToBytes(hex: string): Uint8Array;
|
|
38
|
-
/**
|
|
39
|
-
* Convert bytes to hex string.
|
|
40
|
-
* @param {Uint8Array} bytes
|
|
41
|
-
* @returns {string}
|
|
42
|
-
*/
|
|
43
|
-
export function bytesToHex(bytes: Uint8Array): string;
|
|
44
|
-
/**
|
|
45
|
-
* UTF-8 encode a string to bytes.
|
|
46
|
-
* @param {string} str
|
|
47
|
-
* @returns {Uint8Array}
|
|
48
|
-
*/
|
|
49
|
-
export function utf8ToBytes(str: string): Uint8Array;
|
|
50
|
-
/**
|
|
51
|
-
* UTF-8 decode bytes to a string.
|
|
52
|
-
* @param {Uint8Array} bytes
|
|
53
|
-
* @returns {string}
|
|
54
|
-
*/
|
|
55
|
-
export function bytesToUtf8(bytes: Uint8Array): string;
|
|
56
|
-
/**
|
|
57
|
-
* Convert BytesLike to Uint8Array.
|
|
58
|
-
* @param {string | Uint8Array} data
|
|
59
|
-
* @returns {Uint8Array}
|
|
60
|
-
*/
|
|
61
|
-
export function arrayify(data: string | Uint8Array): Uint8Array;
|
|
1
|
+
/**
|
|
2
|
+
* Return true if `value` is a Uint8Array.
|
|
3
|
+
* @param {any} value
|
|
4
|
+
* @returns {value is Uint8Array}
|
|
5
|
+
*/
|
|
6
|
+
export function isUint8Array(value: any): value is Uint8Array;
|
|
7
|
+
/**
|
|
8
|
+
* Normalize a hex string.
|
|
9
|
+
* @param {string} hex
|
|
10
|
+
* @returns {string}
|
|
11
|
+
*/
|
|
12
|
+
export function normalizeHex(hex: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Returns true if value is a hex string.
|
|
15
|
+
* @param {any} value
|
|
16
|
+
* @param {number=} lengthBytes Optional exact byte length.
|
|
17
|
+
* @returns {boolean}
|
|
18
|
+
*/
|
|
19
|
+
export function isHexString(value: any, lengthBytes?: number | undefined): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Strip 0x prefix.
|
|
22
|
+
* @param {string} hex
|
|
23
|
+
* @returns {string}
|
|
24
|
+
*/
|
|
25
|
+
export function strip0x(hex: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Ensure a 0x prefix.
|
|
28
|
+
* @param {string} hex
|
|
29
|
+
* @returns {string}
|
|
30
|
+
*/
|
|
31
|
+
export function add0x(hex: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Convert a hex string to bytes.
|
|
34
|
+
* @param {string} hex
|
|
35
|
+
* @returns {Uint8Array}
|
|
36
|
+
*/
|
|
37
|
+
export function hexToBytes(hex: string): Uint8Array;
|
|
38
|
+
/**
|
|
39
|
+
* Convert bytes to hex string.
|
|
40
|
+
* @param {Uint8Array} bytes
|
|
41
|
+
* @returns {string}
|
|
42
|
+
*/
|
|
43
|
+
export function bytesToHex(bytes: Uint8Array): string;
|
|
44
|
+
/**
|
|
45
|
+
* UTF-8 encode a string to bytes.
|
|
46
|
+
* @param {string} str
|
|
47
|
+
* @returns {Uint8Array}
|
|
48
|
+
*/
|
|
49
|
+
export function utf8ToBytes(str: string): Uint8Array;
|
|
50
|
+
/**
|
|
51
|
+
* UTF-8 decode bytes to a string.
|
|
52
|
+
* @param {Uint8Array} bytes
|
|
53
|
+
* @returns {string}
|
|
54
|
+
*/
|
|
55
|
+
export function bytesToUtf8(bytes: Uint8Array): string;
|
|
56
|
+
/**
|
|
57
|
+
* Convert BytesLike to Uint8Array.
|
|
58
|
+
* @param {string | Uint8Array} data
|
|
59
|
+
* @returns {Uint8Array}
|
|
60
|
+
*/
|
|
61
|
+
export function arrayify(data: string | Uint8Array): Uint8Array;
|