quantum-coin-js-sdk 1.0.39 → 2.1.0
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/.gitignore +2 -1
- package/README.md +109 -768
- package/index.d.ts +76 -545
- package/index.js +319 -1194
- package/package.json +20 -5
- package/wasmBase64.js +7 -16
- package/wasm_exec.js +575 -587
- package/.idea/.name +0 -1
- package/.idea/modules.xml +0 -8
- package/.idea/quantum-coin-js-sdk.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/.vs/ProjectSettings.json +0 -3
- package/.vs/VSWorkspaceState.json +0 -8
- package/.vs/quantum-coin-js-sdk/FileContentIndex/a9d6de82-cfc3-4c22-ac38-06d706ff3673.vsidx +0 -0
- package/.vs/quantum-coin-js-sdk/FileContentIndex/fdc816df-1898-4153-99f2-c69ef4c2283b.vsidx +0 -0
- package/.vs/quantum-coin-js-sdk/config/applicationhost.config +0 -1011
- package/.vs/quantum-coin-js-sdk/v17/.wsuo +0 -0
- package/.vs/quantum-coin-js-sdk/v17/DocumentLayout.backup.json +0 -39
- package/.vs/quantum-coin-js-sdk/v17/DocumentLayout.json +0 -57
- package/.vs/slnx.sqlite +0 -0
- package/example/README.md +0 -14
- package/example/conversion-example.js +0 -19
- package/example/example-create-contract.js +0 -396
- package/example/example-encode-decode-rlp.js +0 -225
- package/example/example-event-pack-unpack.js +0 -391
- package/example/example-misc.js +0 -100
- package/example/example-rpc-send-signRawTransaction.js +0 -318
- package/example/example-rpc-send.js +0 -115
- package/example/example-send.js +0 -69
- package/example/example-token-pack-unpack.js +0 -960
- package/example/example-wallet-version4.js +0 -34
- package/example/example-wallet.js +0 -43
- package/example/example.js +0 -405
- package/example/node_modules/.bin/sdkgen +0 -16
- package/example/node_modules/.bin/sdkgen.cmd +0 -17
- package/example/node_modules/.bin/sdkgen.ps1 +0 -28
- package/example/node_modules/.package-lock.json +0 -47
- package/example/node_modules/quantumcoin/.github/workflows/publish-npmjs.yaml +0 -22
- package/example/node_modules/quantumcoin/LICENSE +0 -21
- package/example/node_modules/quantumcoin/README-SDK.md +0 -828
- package/example/node_modules/quantumcoin/README.md +0 -197
- package/example/node_modules/quantumcoin/config.d.ts +0 -50
- package/example/node_modules/quantumcoin/config.js +0 -123
- package/example/node_modules/quantumcoin/examples/AllSolidityTypes.sol +0 -184
- package/example/node_modules/quantumcoin/examples/SimpleIERC20.sol +0 -74
- package/example/node_modules/quantumcoin/examples/events.js +0 -41
- package/example/node_modules/quantumcoin/examples/events.ts +0 -35
- package/example/node_modules/quantumcoin/examples/example-generator-sdk-js.js +0 -100
- package/example/node_modules/quantumcoin/examples/example-generator-sdk-js.ts +0 -77
- package/example/node_modules/quantumcoin/examples/example-generator-sdk-ts.js +0 -100
- package/example/node_modules/quantumcoin/examples/example-generator-sdk-ts.ts +0 -77
- package/example/node_modules/quantumcoin/examples/example.js +0 -67
- package/example/node_modules/quantumcoin/examples/example.ts +0 -56
- package/example/node_modules/quantumcoin/examples/offline-signing.js +0 -77
- package/example/node_modules/quantumcoin/examples/offline-signing.ts +0 -65
- package/example/node_modules/quantumcoin/examples/package-lock.json +0 -596
- package/example/node_modules/quantumcoin/examples/package.json +0 -32
- package/example/node_modules/quantumcoin/examples/read-operations.js +0 -32
- package/example/node_modules/quantumcoin/examples/read-operations.ts +0 -31
- package/example/node_modules/quantumcoin/examples/sdk-generator-erc20.inline.json +0 -251
- package/example/node_modules/quantumcoin/examples/solidity-types.ts +0 -43
- package/example/node_modules/quantumcoin/examples/wallet-offline.js +0 -36
- package/example/node_modules/quantumcoin/examples/wallet-offline.ts +0 -26
- package/example/node_modules/quantumcoin/generate-sdk.js +0 -1846
- package/example/node_modules/quantumcoin/index.js +0 -12
- package/example/node_modules/quantumcoin/package.json +0 -95
- package/example/node_modules/quantumcoin/scripts/copy-declarations.js +0 -31
- package/example/node_modules/quantumcoin/scripts/run-all-one-by-one.js +0 -151
- package/example/node_modules/quantumcoin/src/abi/fragments.d.ts +0 -42
- package/example/node_modules/quantumcoin/src/abi/fragments.js +0 -63
- package/example/node_modules/quantumcoin/src/abi/index.d.ts +0 -13
- package/example/node_modules/quantumcoin/src/abi/index.js +0 -9
- package/example/node_modules/quantumcoin/src/abi/interface.d.ts +0 -128
- package/example/node_modules/quantumcoin/src/abi/interface.js +0 -605
- package/example/node_modules/quantumcoin/src/abi/js-abi-coder.d.ts +0 -8
- package/example/node_modules/quantumcoin/src/abi/js-abi-coder.js +0 -538
- package/example/node_modules/quantumcoin/src/constants.d.ts +0 -61
- package/example/node_modules/quantumcoin/src/constants.js +0 -94
- package/example/node_modules/quantumcoin/src/contract/contract-factory.d.ts +0 -28
- package/example/node_modules/quantumcoin/src/contract/contract-factory.js +0 -111
- package/example/node_modules/quantumcoin/src/contract/contract.d.ts +0 -113
- package/example/node_modules/quantumcoin/src/contract/contract.js +0 -408
- package/example/node_modules/quantumcoin/src/contract/index.d.ts +0 -9
- package/example/node_modules/quantumcoin/src/contract/index.js +0 -9
- package/example/node_modules/quantumcoin/src/errors/index.d.ts +0 -92
- package/example/node_modules/quantumcoin/src/errors/index.js +0 -200
- package/example/node_modules/quantumcoin/src/generator/index.d.ts +0 -81
- package/example/node_modules/quantumcoin/src/generator/index.js +0 -1571
- package/example/node_modules/quantumcoin/src/index.d.ts +0 -122
- package/example/node_modules/quantumcoin/src/index.js +0 -41
- package/example/node_modules/quantumcoin/src/internal/hex.d.ts +0 -68
- package/example/node_modules/quantumcoin/src/internal/hex.js +0 -180
- package/example/node_modules/quantumcoin/src/providers/extra-providers.d.ts +0 -139
- package/example/node_modules/quantumcoin/src/providers/extra-providers.js +0 -614
- package/example/node_modules/quantumcoin/src/providers/index.d.ts +0 -17
- package/example/node_modules/quantumcoin/src/providers/index.js +0 -10
- package/example/node_modules/quantumcoin/src/providers/json-rpc-provider.d.ts +0 -12
- package/example/node_modules/quantumcoin/src/providers/json-rpc-provider.js +0 -89
- package/example/node_modules/quantumcoin/src/providers/provider.d.ts +0 -206
- package/example/node_modules/quantumcoin/src/providers/provider.js +0 -524
- package/example/node_modules/quantumcoin/src/types/index.d.ts +0 -214
- package/example/node_modules/quantumcoin/src/types/index.js +0 -9
- package/example/node_modules/quantumcoin/src/utils/address.d.ts +0 -58
- package/example/node_modules/quantumcoin/src/utils/address.js +0 -144
- package/example/node_modules/quantumcoin/src/utils/encoding.d.ts +0 -120
- package/example/node_modules/quantumcoin/src/utils/encoding.js +0 -306
- package/example/node_modules/quantumcoin/src/utils/fixednumber.d.ts +0 -57
- package/example/node_modules/quantumcoin/src/utils/fixednumber.js +0 -366
- package/example/node_modules/quantumcoin/src/utils/hashing.d.ts +0 -76
- package/example/node_modules/quantumcoin/src/utils/hashing.js +0 -298
- package/example/node_modules/quantumcoin/src/utils/index.d.ts +0 -63
- package/example/node_modules/quantumcoin/src/utils/index.js +0 -14
- package/example/node_modules/quantumcoin/src/utils/result.d.ts +0 -57
- package/example/node_modules/quantumcoin/src/utils/result.js +0 -128
- package/example/node_modules/quantumcoin/src/utils/rlp.d.ts +0 -12
- package/example/node_modules/quantumcoin/src/utils/rlp.js +0 -215
- package/example/node_modules/quantumcoin/src/utils/units.d.ts +0 -29
- package/example/node_modules/quantumcoin/src/utils/units.js +0 -107
- package/example/node_modules/quantumcoin/src/wallet/index.d.ts +0 -10
- package/example/node_modules/quantumcoin/src/wallet/index.js +0 -8
- package/example/node_modules/quantumcoin/src/wallet/wallet.d.ts +0 -192
- package/example/node_modules/quantumcoin/src/wallet/wallet.js +0 -713
- package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.dynamic.test.js +0 -207
- package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.dynamic.test.ts +0 -191
- package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.fixtures.js +0 -231
- package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.generated-sdks.e2e.test.js +0 -387
- package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.generated-sdks.e2e.test.ts +0 -350
- package/example/node_modules/quantumcoin/test/e2e/generator-interface.e2e.test.js +0 -165
- package/example/node_modules/quantumcoin/test/e2e/generator-interface.e2e.test.ts +0 -160
- package/example/node_modules/quantumcoin/test/e2e/helpers.js +0 -59
- package/example/node_modules/quantumcoin/test/e2e/signing-context-and-fee.e2e.test.js +0 -141
- package/example/node_modules/quantumcoin/test/e2e/signing-context-and-fee.e2e.test.ts +0 -128
- package/example/node_modules/quantumcoin/test/e2e/simple-erc20.generated-sdks.e2e.test.js +0 -168
- package/example/node_modules/quantumcoin/test/e2e/simple-erc20.generated-sdks.e2e.test.ts +0 -141
- package/example/node_modules/quantumcoin/test/e2e/transactional.test.js +0 -245
- package/example/node_modules/quantumcoin/test/e2e/transactional.test.ts +0 -208
- package/example/node_modules/quantumcoin/test/e2e/typed-generator.e2e.test.js +0 -407
- package/example/node_modules/quantumcoin/test/e2e/typed-generator.e2e.test.ts +0 -337
- package/example/node_modules/quantumcoin/test/fixtures/ConstructorParam.sol +0 -23
- package/example/node_modules/quantumcoin/test/fixtures/MultiContracts.sol +0 -37
- package/example/node_modules/quantumcoin/test/fixtures/SimpleStorage.sol +0 -18
- package/example/node_modules/quantumcoin/test/fixtures/StakingContract.abi.json +0 -1
- package/example/node_modules/quantumcoin/test/integration/ipc-provider.test.js +0 -49
- package/example/node_modules/quantumcoin/test/integration/ipc-provider.test.ts +0 -44
- package/example/node_modules/quantumcoin/test/integration/provider.test.js +0 -88
- package/example/node_modules/quantumcoin/test/integration/provider.test.ts +0 -85
- package/example/node_modules/quantumcoin/test/integration/ws-provider.test.js +0 -41
- package/example/node_modules/quantumcoin/test/integration/ws-provider.test.ts +0 -38
- package/example/node_modules/quantumcoin/test/security/abi-decoder-bounds.test.js +0 -122
- package/example/node_modules/quantumcoin/test/security/contract-overrides.test.js +0 -112
- package/example/node_modules/quantumcoin/test/security/generator-injection.test.js +0 -195
- package/example/node_modules/quantumcoin/test/security/malformed-input.test.js +0 -330
- package/example/node_modules/quantumcoin/test/security/malformed-input.test.ts +0 -35
- package/example/node_modules/quantumcoin/test/security/rpc-numeric-bounds.test.js +0 -81
- package/example/node_modules/quantumcoin/test/security/rpc-trust.test.js +0 -202
- package/example/node_modules/quantumcoin/test/unit/_encrypted-output.txt +0 -6
- package/example/node_modules/quantumcoin/test/unit/_log-encrypted-jsons.js +0 -45
- package/example/node_modules/quantumcoin/test/unit/_write-keystore-fixture.js +0 -16
- package/example/node_modules/quantumcoin/test/unit/abi-interface.test.js +0 -110
- package/example/node_modules/quantumcoin/test/unit/abi-interface.test.ts +0 -109
- package/example/node_modules/quantumcoin/test/unit/address-wallet.test.js +0 -923
- package/example/node_modules/quantumcoin/test/unit/address-wallet.test.ts +0 -877
- package/example/node_modules/quantumcoin/test/unit/browser-provider.test.js +0 -85
- package/example/node_modules/quantumcoin/test/unit/browser-provider.test.ts +0 -79
- package/example/node_modules/quantumcoin/test/unit/contract.test.js +0 -85
- package/example/node_modules/quantumcoin/test/unit/contract.test.ts +0 -83
- package/example/node_modules/quantumcoin/test/unit/encoding-units-rlp.test.js +0 -127
- package/example/node_modules/quantumcoin/test/unit/encoding-units-rlp.test.ts +0 -91
- package/example/node_modules/quantumcoin/test/unit/errors.test.js +0 -77
- package/example/node_modules/quantumcoin/test/unit/errors.test.ts +0 -76
- package/example/node_modules/quantumcoin/test/unit/filter-by-blockhash.test.js +0 -55
- package/example/node_modules/quantumcoin/test/unit/filter-by-blockhash.test.ts +0 -54
- package/example/node_modules/quantumcoin/test/unit/fixednumber.test.js +0 -656
- package/example/node_modules/quantumcoin/test/unit/fixednumber.test.ts +0 -660
- package/example/node_modules/quantumcoin/test/unit/fixtures/encrypted-keystores-48-32-36.js +0 -9
- package/example/node_modules/quantumcoin/test/unit/generate-contract-cli.test.js +0 -42
- package/example/node_modules/quantumcoin/test/unit/generate-contract-cli.test.ts +0 -41
- package/example/node_modules/quantumcoin/test/unit/generate-sdk-artifacts-json.test.js +0 -113
- package/example/node_modules/quantumcoin/test/unit/generate-sdk-artifacts-json.test.ts +0 -110
- package/example/node_modules/quantumcoin/test/unit/generator.test.js +0 -149
- package/example/node_modules/quantumcoin/test/unit/generator.test.ts +0 -148
- package/example/node_modules/quantumcoin/test/unit/hashing.test.js +0 -64
- package/example/node_modules/quantumcoin/test/unit/hashing.test.ts +0 -63
- package/example/node_modules/quantumcoin/test/unit/init.test.js +0 -39
- package/example/node_modules/quantumcoin/test/unit/init.test.ts +0 -38
- package/example/node_modules/quantumcoin/test/unit/interface.test.js +0 -56
- package/example/node_modules/quantumcoin/test/unit/interface.test.ts +0 -54
- package/example/node_modules/quantumcoin/test/unit/internal-hex.test.js +0 -81
- package/example/node_modules/quantumcoin/test/unit/internal-hex.test.ts +0 -80
- package/example/node_modules/quantumcoin/test/unit/populate-transaction.test.js +0 -98
- package/example/node_modules/quantumcoin/test/unit/populate-transaction.test.ts +0 -64
- package/example/node_modules/quantumcoin/test/unit/providers.test.js +0 -252
- package/example/node_modules/quantumcoin/test/unit/providers.test.ts +0 -251
- package/example/node_modules/quantumcoin/test/unit/result.test.js +0 -80
- package/example/node_modules/quantumcoin/test/unit/result.test.ts +0 -79
- package/example/node_modules/quantumcoin/test/unit/solidity-types.test.js +0 -49
- package/example/node_modules/quantumcoin/test/unit/solidity-types.test.ts +0 -39
- package/example/node_modules/quantumcoin/test/unit/utils.test.js +0 -57
- package/example/node_modules/quantumcoin/test/unit/utils.test.ts +0 -56
- package/example/node_modules/quantumcoin/test/verbose-logger.js +0 -74
- package/example/node_modules/quantumcoin/tsconfig.build.json +0 -14
- package/example/node_modules/seed-words/.github/workflows/publish-npmjs.yaml +0 -22
- package/example/node_modules/seed-words/BUILD.md +0 -7
- package/example/node_modules/seed-words/LICENSE +0 -121
- package/example/node_modules/seed-words/README.md +0 -67
- package/example/node_modules/seed-words/dist/seedwords.d.ts +0 -39
- package/example/node_modules/seed-words/package.json +0 -27
- package/example/node_modules/seed-words/seedwords.js +0 -315
- package/example/node_modules/seed-words/seedwords.txt +0 -65536
- package/example/node_modules/seed-words/tsconfig.json +0 -21
- package/example/package-lock.json +0 -56
- package/example/package.json +0 -15
- package/tests/encrypted-32.json +0 -1
- package/tests/encrypted-36.json +0 -1
- package/tests/encrypted-48.json +0 -1
- package/tests/generate-verify-vectors.js +0 -91
- package/tests/get-gas-price.test.js +0 -59
- package/tests/non-transactional.preinit.test.js +0 -41
- package/tests/non-transactional.test.js +0 -1389
- package/tests/scrypt.test.js +0 -128
- package/tests/sign-raw-keytype5-context-null.test.js +0 -107
- package/tests/sign-raw-transaction.test.js +0 -196
- package/tests/sign-verify.test.js +0 -311
- package/tests/transactional.relay.test.js +0 -131
- package/tests/transactional.rpc.test.js +0 -103
- package/tests/verify-vectors.json +0 -95035
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Solidity / ABI type aliases for SDK contract generation.
|
|
3
|
-
* Used by generated SDKs via "quantumcoin/types".
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export type BigNumberish = string | number | bigint;
|
|
7
|
-
export type AddressLike = string;
|
|
8
|
-
export type SolAddress = string;
|
|
9
|
-
|
|
10
|
-
export type BytesLike = string | Uint8Array;
|
|
11
|
-
export type HexString = string;
|
|
12
|
-
|
|
13
|
-
export type Bytes32Like = string | Uint8Array;
|
|
14
|
-
export type Bytes32 = string;
|
|
15
|
-
|
|
16
|
-
export type Bytes1Like = string | Uint8Array;
|
|
17
|
-
export type Bytes1 = string;
|
|
18
|
-
export type Bytes2Like = string | Uint8Array;
|
|
19
|
-
export type Bytes2 = string;
|
|
20
|
-
export type Bytes3Like = string | Uint8Array;
|
|
21
|
-
export type Bytes3 = string;
|
|
22
|
-
export type Bytes4Like = string | Uint8Array;
|
|
23
|
-
export type Bytes4 = string;
|
|
24
|
-
export type Bytes5Like = string | Uint8Array;
|
|
25
|
-
export type Bytes5 = string;
|
|
26
|
-
export type Bytes6Like = string | Uint8Array;
|
|
27
|
-
export type Bytes6 = string;
|
|
28
|
-
export type Bytes7Like = string | Uint8Array;
|
|
29
|
-
export type Bytes7 = string;
|
|
30
|
-
export type Bytes8Like = string | Uint8Array;
|
|
31
|
-
export type Bytes8 = string;
|
|
32
|
-
export type Bytes9Like = string | Uint8Array;
|
|
33
|
-
export type Bytes9 = string;
|
|
34
|
-
export type Bytes10Like = string | Uint8Array;
|
|
35
|
-
export type Bytes10 = string;
|
|
36
|
-
export type Bytes11Like = string | Uint8Array;
|
|
37
|
-
export type Bytes11 = string;
|
|
38
|
-
export type Bytes12Like = string | Uint8Array;
|
|
39
|
-
export type Bytes12 = string;
|
|
40
|
-
export type Bytes13Like = string | Uint8Array;
|
|
41
|
-
export type Bytes13 = string;
|
|
42
|
-
export type Bytes14Like = string | Uint8Array;
|
|
43
|
-
export type Bytes14 = string;
|
|
44
|
-
export type Bytes15Like = string | Uint8Array;
|
|
45
|
-
export type Bytes15 = string;
|
|
46
|
-
export type Bytes16Like = string | Uint8Array;
|
|
47
|
-
export type Bytes16 = string;
|
|
48
|
-
export type Bytes17Like = string | Uint8Array;
|
|
49
|
-
export type Bytes17 = string;
|
|
50
|
-
export type Bytes18Like = string | Uint8Array;
|
|
51
|
-
export type Bytes18 = string;
|
|
52
|
-
export type Bytes19Like = string | Uint8Array;
|
|
53
|
-
export type Bytes19 = string;
|
|
54
|
-
export type Bytes20Like = string | Uint8Array;
|
|
55
|
-
export type Bytes20 = string;
|
|
56
|
-
export type Bytes21Like = string | Uint8Array;
|
|
57
|
-
export type Bytes21 = string;
|
|
58
|
-
export type Bytes22Like = string | Uint8Array;
|
|
59
|
-
export type Bytes22 = string;
|
|
60
|
-
export type Bytes23Like = string | Uint8Array;
|
|
61
|
-
export type Bytes23 = string;
|
|
62
|
-
export type Bytes24Like = string | Uint8Array;
|
|
63
|
-
export type Bytes24 = string;
|
|
64
|
-
export type Bytes25Like = string | Uint8Array;
|
|
65
|
-
export type Bytes25 = string;
|
|
66
|
-
export type Bytes26Like = string | Uint8Array;
|
|
67
|
-
export type Bytes26 = string;
|
|
68
|
-
export type Bytes27Like = string | Uint8Array;
|
|
69
|
-
export type Bytes27 = string;
|
|
70
|
-
export type Bytes28Like = string | Uint8Array;
|
|
71
|
-
export type Bytes28 = string;
|
|
72
|
-
export type Bytes29Like = string | Uint8Array;
|
|
73
|
-
export type Bytes29 = string;
|
|
74
|
-
export type Bytes30Like = string | Uint8Array;
|
|
75
|
-
export type Bytes30 = string;
|
|
76
|
-
export type Bytes31Like = string | Uint8Array;
|
|
77
|
-
export type Bytes31 = string;
|
|
78
|
-
|
|
79
|
-
export type Uint8 = bigint;
|
|
80
|
-
export type Uint8Like = string | number | bigint;
|
|
81
|
-
export type Uint16 = bigint;
|
|
82
|
-
export type Uint16Like = string | number | bigint;
|
|
83
|
-
export type Uint24 = bigint;
|
|
84
|
-
export type Uint24Like = string | number | bigint;
|
|
85
|
-
export type Uint32 = bigint;
|
|
86
|
-
export type Uint32Like = string | number | bigint;
|
|
87
|
-
export type Uint40 = bigint;
|
|
88
|
-
export type Uint40Like = string | number | bigint;
|
|
89
|
-
export type Uint48 = bigint;
|
|
90
|
-
export type Uint48Like = string | number | bigint;
|
|
91
|
-
export type Uint56 = bigint;
|
|
92
|
-
export type Uint56Like = string | number | bigint;
|
|
93
|
-
export type Uint64 = bigint;
|
|
94
|
-
export type Uint64Like = string | number | bigint;
|
|
95
|
-
export type Uint72 = bigint;
|
|
96
|
-
export type Uint72Like = string | number | bigint;
|
|
97
|
-
export type Uint80 = bigint;
|
|
98
|
-
export type Uint80Like = string | number | bigint;
|
|
99
|
-
export type Uint88 = bigint;
|
|
100
|
-
export type Uint88Like = string | number | bigint;
|
|
101
|
-
export type Uint96 = bigint;
|
|
102
|
-
export type Uint96Like = string | number | bigint;
|
|
103
|
-
export type Uint104 = bigint;
|
|
104
|
-
export type Uint104Like = string | number | bigint;
|
|
105
|
-
export type Uint112 = bigint;
|
|
106
|
-
export type Uint112Like = string | number | bigint;
|
|
107
|
-
export type Uint120 = bigint;
|
|
108
|
-
export type Uint120Like = string | number | bigint;
|
|
109
|
-
export type Uint128 = bigint;
|
|
110
|
-
export type Uint128Like = string | number | bigint;
|
|
111
|
-
export type Uint136 = bigint;
|
|
112
|
-
export type Uint136Like = string | number | bigint;
|
|
113
|
-
export type Uint144 = bigint;
|
|
114
|
-
export type Uint144Like = string | number | bigint;
|
|
115
|
-
export type Uint152 = bigint;
|
|
116
|
-
export type Uint152Like = string | number | bigint;
|
|
117
|
-
export type Uint160 = bigint;
|
|
118
|
-
export type Uint160Like = string | number | bigint;
|
|
119
|
-
export type Uint168 = bigint;
|
|
120
|
-
export type Uint168Like = string | number | bigint;
|
|
121
|
-
export type Uint176 = bigint;
|
|
122
|
-
export type Uint176Like = string | number | bigint;
|
|
123
|
-
export type Uint184 = bigint;
|
|
124
|
-
export type Uint184Like = string | number | bigint;
|
|
125
|
-
export type Uint192 = bigint;
|
|
126
|
-
export type Uint192Like = string | number | bigint;
|
|
127
|
-
export type Uint200 = bigint;
|
|
128
|
-
export type Uint200Like = string | number | bigint;
|
|
129
|
-
export type Uint208 = bigint;
|
|
130
|
-
export type Uint208Like = string | number | bigint;
|
|
131
|
-
export type Uint216 = bigint;
|
|
132
|
-
export type Uint216Like = string | number | bigint;
|
|
133
|
-
export type Uint224 = bigint;
|
|
134
|
-
export type Uint224Like = string | number | bigint;
|
|
135
|
-
export type Uint232 = bigint;
|
|
136
|
-
export type Uint232Like = string | number | bigint;
|
|
137
|
-
export type Uint240 = bigint;
|
|
138
|
-
export type Uint240Like = string | number | bigint;
|
|
139
|
-
export type Uint248 = bigint;
|
|
140
|
-
export type Uint248Like = string | number | bigint;
|
|
141
|
-
export type Uint256 = bigint;
|
|
142
|
-
export type Uint256Like = string | number | bigint;
|
|
143
|
-
|
|
144
|
-
export type Int8 = bigint;
|
|
145
|
-
export type Int8Like = string | number | bigint;
|
|
146
|
-
export type Int16 = bigint;
|
|
147
|
-
export type Int16Like = string | number | bigint;
|
|
148
|
-
export type Int24 = bigint;
|
|
149
|
-
export type Int24Like = string | number | bigint;
|
|
150
|
-
export type Int32 = bigint;
|
|
151
|
-
export type Int32Like = string | number | bigint;
|
|
152
|
-
export type Int40 = bigint;
|
|
153
|
-
export type Int40Like = string | number | bigint;
|
|
154
|
-
export type Int48 = bigint;
|
|
155
|
-
export type Int48Like = string | number | bigint;
|
|
156
|
-
export type Int56 = bigint;
|
|
157
|
-
export type Int56Like = string | number | bigint;
|
|
158
|
-
export type Int64 = bigint;
|
|
159
|
-
export type Int64Like = string | number | bigint;
|
|
160
|
-
export type Int72 = bigint;
|
|
161
|
-
export type Int72Like = string | number | bigint;
|
|
162
|
-
export type Int80 = bigint;
|
|
163
|
-
export type Int80Like = string | number | bigint;
|
|
164
|
-
export type Int88 = bigint;
|
|
165
|
-
export type Int88Like = string | number | bigint;
|
|
166
|
-
export type Int96 = bigint;
|
|
167
|
-
export type Int96Like = string | number | bigint;
|
|
168
|
-
export type Int104 = bigint;
|
|
169
|
-
export type Int104Like = string | number | bigint;
|
|
170
|
-
export type Int112 = bigint;
|
|
171
|
-
export type Int112Like = string | number | bigint;
|
|
172
|
-
export type Int120 = bigint;
|
|
173
|
-
export type Int120Like = string | number | bigint;
|
|
174
|
-
export type Int128 = bigint;
|
|
175
|
-
export type Int128Like = string | number | bigint;
|
|
176
|
-
export type Int136 = bigint;
|
|
177
|
-
export type Int136Like = string | number | bigint;
|
|
178
|
-
export type Int144 = bigint;
|
|
179
|
-
export type Int144Like = string | number | bigint;
|
|
180
|
-
export type Int152 = bigint;
|
|
181
|
-
export type Int152Like = string | number | bigint;
|
|
182
|
-
export type Int160 = bigint;
|
|
183
|
-
export type Int160Like = string | number | bigint;
|
|
184
|
-
export type Int168 = bigint;
|
|
185
|
-
export type Int168Like = string | number | bigint;
|
|
186
|
-
export type Int176 = bigint;
|
|
187
|
-
export type Int176Like = string | number | bigint;
|
|
188
|
-
export type Int184 = bigint;
|
|
189
|
-
export type Int184Like = string | number | bigint;
|
|
190
|
-
export type Int192 = bigint;
|
|
191
|
-
export type Int192Like = string | number | bigint;
|
|
192
|
-
export type Int200 = bigint;
|
|
193
|
-
export type Int200Like = string | number | bigint;
|
|
194
|
-
export type Int208 = bigint;
|
|
195
|
-
export type Int208Like = string | number | bigint;
|
|
196
|
-
export type Int216 = bigint;
|
|
197
|
-
export type Int216Like = string | number | bigint;
|
|
198
|
-
export type Int224 = bigint;
|
|
199
|
-
export type Int224Like = string | number | bigint;
|
|
200
|
-
export type Int232 = bigint;
|
|
201
|
-
export type Int232Like = string | number | bigint;
|
|
202
|
-
export type Int240 = bigint;
|
|
203
|
-
export type Int240Like = string | number | bigint;
|
|
204
|
-
export type Int248 = bigint;
|
|
205
|
-
export type Int248Like = string | number | bigint;
|
|
206
|
-
export type Int256 = bigint;
|
|
207
|
-
export type Int256Like = string | number | bigint;
|
|
208
|
-
|
|
209
|
-
export type SolArray<T> = T[];
|
|
210
|
-
export type SolFixedArray<T, N extends number> = T[];
|
|
211
|
-
|
|
212
|
-
export type SolidityTypeName = string;
|
|
213
|
-
export type SolidityInputValue = unknown;
|
|
214
|
-
export type SolidityOutputValue = unknown;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if string is a valid address (32 bytes, 66 hex characters).
|
|
3
|
-
* @param {string} address
|
|
4
|
-
* @returns {boolean}
|
|
5
|
-
*/
|
|
6
|
-
export function isAddress(address: string): boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Returns normalized address.
|
|
9
|
-
* Note: QuantumCoin checksumming uses QuantumCoin conventions; currently this normalizes to lowercase.
|
|
10
|
-
* @param {string} address
|
|
11
|
-
* @returns {string}
|
|
12
|
-
*/
|
|
13
|
-
export function getAddress(address: string): string;
|
|
14
|
-
/**
|
|
15
|
-
* Returns true if value is an object implementing Addressable (has getAddress()).
|
|
16
|
-
* @param {any} value
|
|
17
|
-
* @returns {boolean}
|
|
18
|
-
*/
|
|
19
|
-
export function isAddressable(value: any): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Resolve an AddressLike into a string address.
|
|
22
|
-
* For QuantumCoin, ENS is not supported.
|
|
23
|
-
* @param {any} target
|
|
24
|
-
* @returns {string|Promise<string>}
|
|
25
|
-
*/
|
|
26
|
-
export function resolveAddress(target: any): string | Promise<string>;
|
|
27
|
-
/**
|
|
28
|
-
* Calculates contract address from deployer and nonce.
|
|
29
|
-
* @param {{ from: string, nonce: number }} tx
|
|
30
|
-
* @returns {string}
|
|
31
|
-
*/
|
|
32
|
-
export function getContractAddress(tx: {
|
|
33
|
-
from: string;
|
|
34
|
-
nonce: number;
|
|
35
|
-
}): string;
|
|
36
|
-
/**
|
|
37
|
-
* Alias for getContractAddress.
|
|
38
|
-
* @param {{ from: string, nonce: number }} tx
|
|
39
|
-
* @returns {string}
|
|
40
|
-
*/
|
|
41
|
-
export function getCreateAddress(tx: {
|
|
42
|
-
from: string;
|
|
43
|
-
nonce: number;
|
|
44
|
-
}): string;
|
|
45
|
-
/**
|
|
46
|
-
* Calculates CREATE2 contract address.
|
|
47
|
-
* @param {string} from
|
|
48
|
-
* @param {string} salt
|
|
49
|
-
* @param {string} initCodeHash
|
|
50
|
-
* @returns {string}
|
|
51
|
-
*/
|
|
52
|
-
export function getCreate2Address(from: string, salt: string, initCodeHash: string): string;
|
|
53
|
-
/**
|
|
54
|
-
* Computes address from a public key.
|
|
55
|
-
* @param {string|Uint8Array} key
|
|
56
|
-
* @returns {string}
|
|
57
|
-
*/
|
|
58
|
-
export function computeAddress(key: string | Uint8Array): string;
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Address utilities (QuantumCoin 32-byte address format).
|
|
3
|
-
*
|
|
4
|
-
* QuantumCoin addresses are 32 bytes (66 hex characters including 0x).
|
|
5
|
-
* Most helpers here are thin wrappers around `quantum-coin-js-sdk`.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const qcsdk = require("quantum-coin-js-sdk");
|
|
9
|
-
const { assertArgument, makeError } = require("../errors");
|
|
10
|
-
const { arrayify, bytesToHex, hexToBytes, isHexString, normalizeHex } = require("../internal/hex");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function _requireInitialized() {
|
|
14
|
-
// eslint-disable-next-line global-require
|
|
15
|
-
const { isInitialized, getInitializationPromise } = require("../../config");
|
|
16
|
-
if (isInitialized()) return;
|
|
17
|
-
if (getInitializationPromise() != null) {
|
|
18
|
-
throw makeError(
|
|
19
|
-
"QuantumCoin SDK is still initializing. Await the Initialize() promise before using SDK methods.",
|
|
20
|
-
"UNKNOWN_ERROR",
|
|
21
|
-
{ operation: "requireInitialized" },
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
throw makeError("QuantumCoin SDK not initialized. Call Initialize() first.", "UNKNOWN_ERROR", {
|
|
25
|
-
operation: "address-utils",
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Checks if string is a valid address (32 bytes, 66 hex characters).
|
|
31
|
-
* @param {string} address
|
|
32
|
-
* @returns {boolean}
|
|
33
|
-
*/
|
|
34
|
-
function isAddress(address) {
|
|
35
|
-
if (typeof address !== "string") return false;
|
|
36
|
-
_requireInitialized();
|
|
37
|
-
const result = qcsdk.isAddressValid(address);
|
|
38
|
-
return result === true;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Returns normalized address.
|
|
43
|
-
* Note: QuantumCoin checksumming uses QuantumCoin conventions; currently this normalizes to lowercase.
|
|
44
|
-
* @param {string} address
|
|
45
|
-
* @returns {string}
|
|
46
|
-
*/
|
|
47
|
-
function getAddress(address) {
|
|
48
|
-
assertArgument(typeof address === "string", "address must be a string", "address", address);
|
|
49
|
-
_requireInitialized();
|
|
50
|
-
const norm = normalizeHex(address);
|
|
51
|
-
assertArgument(qcsdk.isAddressValid(norm) === true, "invalid address", "address", address);
|
|
52
|
-
return norm;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Returns true if value is an object implementing Addressable (has getAddress()).
|
|
57
|
-
* @param {any} value
|
|
58
|
-
* @returns {boolean}
|
|
59
|
-
*/
|
|
60
|
-
function isAddressable(value) {
|
|
61
|
-
return Boolean(value && typeof value === "object" && typeof value.getAddress === "function");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Resolve an AddressLike into a string address.
|
|
66
|
-
* For QuantumCoin, ENS is not supported.
|
|
67
|
-
* @param {any} target
|
|
68
|
-
* @returns {string|Promise<string>}
|
|
69
|
-
*/
|
|
70
|
-
function resolveAddress(target) {
|
|
71
|
-
if (typeof target === "string") return getAddress(target);
|
|
72
|
-
if (isAddressable(target)) return target.getAddress();
|
|
73
|
-
if (target && typeof target.then === "function") {
|
|
74
|
-
return Promise.resolve(target).then((v) => resolveAddress(v));
|
|
75
|
-
}
|
|
76
|
-
throw makeError("unsupported AddressLike", "INVALID_ARGUMENT", { target });
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Calculates contract address from deployer and nonce.
|
|
81
|
-
* @param {{ from: string, nonce: number }} tx
|
|
82
|
-
* @returns {string}
|
|
83
|
-
*/
|
|
84
|
-
function getContractAddress(tx) {
|
|
85
|
-
_requireInitialized();
|
|
86
|
-
assertArgument(tx && typeof tx === "object", "invalid tx", "tx", tx);
|
|
87
|
-
const from = getAddress(tx.from);
|
|
88
|
-
assertArgument(Number.isInteger(tx.nonce) && tx.nonce >= 0, "invalid nonce", "nonce", tx.nonce);
|
|
89
|
-
const out = qcsdk.createAddress(from, tx.nonce);
|
|
90
|
-
if (typeof out !== "string") throw makeError("createAddress failed", "UNKNOWN_ERROR", { from, nonce: tx.nonce });
|
|
91
|
-
return normalizeHex(out);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Alias for getContractAddress.
|
|
96
|
-
* @param {{ from: string, nonce: number }} tx
|
|
97
|
-
* @returns {string}
|
|
98
|
-
*/
|
|
99
|
-
function getCreateAddress(tx) {
|
|
100
|
-
return getContractAddress(tx);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Calculates CREATE2 contract address.
|
|
105
|
-
* @param {string} from
|
|
106
|
-
* @param {string} salt
|
|
107
|
-
* @param {string} initCodeHash
|
|
108
|
-
* @returns {string}
|
|
109
|
-
*/
|
|
110
|
-
function getCreate2Address(from, salt, initCodeHash) {
|
|
111
|
-
_requireInitialized();
|
|
112
|
-
const f = getAddress(from);
|
|
113
|
-
assertArgument(isHexString(salt), "invalid salt", "salt", salt);
|
|
114
|
-
assertArgument(isHexString(initCodeHash), "invalid initCodeHash", "initCodeHash", initCodeHash);
|
|
115
|
-
const out = qcsdk.createAddress2(f, normalizeHex(salt), normalizeHex(initCodeHash));
|
|
116
|
-
if (typeof out !== "string") throw makeError("createAddress2 failed", "UNKNOWN_ERROR", { from: f });
|
|
117
|
-
return normalizeHex(out);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Computes address from a public key.
|
|
122
|
-
* @param {string|Uint8Array} key
|
|
123
|
-
* @returns {string}
|
|
124
|
-
*/
|
|
125
|
-
function computeAddress(key) {
|
|
126
|
-
_requireInitialized();
|
|
127
|
-
const bytes = typeof key === "string" ? hexToBytes(key) : arrayify(key);
|
|
128
|
-
const pubArr = Array.from(bytes);
|
|
129
|
-
const out = qcsdk.addressFromPublicKey(pubArr);
|
|
130
|
-
if (typeof out !== "string") throw makeError("addressFromPublicKey failed", "UNKNOWN_ERROR", {});
|
|
131
|
-
return normalizeHex(out);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
module.exports = {
|
|
135
|
-
isAddress,
|
|
136
|
-
getAddress,
|
|
137
|
-
isAddressable,
|
|
138
|
-
resolveAddress,
|
|
139
|
-
getContractAddress,
|
|
140
|
-
getCreateAddress,
|
|
141
|
-
getCreate2Address,
|
|
142
|
-
computeAddress,
|
|
143
|
-
};
|
|
144
|
-
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
export type BytesLike = string | Uint8Array;
|
|
2
|
-
/**
|
|
3
|
-
* @typedef {string | Uint8Array} BytesLike
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Converts bytes to UTF-8 string.
|
|
7
|
-
* @param {BytesLike} data
|
|
8
|
-
* @returns {string}
|
|
9
|
-
*/
|
|
10
|
-
export function toUtf8String(data: BytesLike): string;
|
|
11
|
-
/**
|
|
12
|
-
* Converts string to UTF-8 bytes.
|
|
13
|
-
* @param {string} str
|
|
14
|
-
* @returns {Uint8Array}
|
|
15
|
-
*/
|
|
16
|
-
export function toUtf8Bytes(str: string): Uint8Array;
|
|
17
|
-
/**
|
|
18
|
-
* Converts data to hex string.
|
|
19
|
-
* @param {BytesLike} data
|
|
20
|
-
* @returns {string}
|
|
21
|
-
*/
|
|
22
|
-
export function toHex(data: BytesLike): string;
|
|
23
|
-
/**
|
|
24
|
-
* Alias for toHex.
|
|
25
|
-
* @param {BytesLike} data
|
|
26
|
-
* @returns {string}
|
|
27
|
-
*/
|
|
28
|
-
export function hexlify(data: BytesLike): string;
|
|
29
|
-
/**
|
|
30
|
-
* Converts data to byte array.
|
|
31
|
-
* @param {BytesLike} data
|
|
32
|
-
* @returns {Uint8Array}
|
|
33
|
-
*/
|
|
34
|
-
export function arrayify(data: BytesLike): Uint8Array;
|
|
35
|
-
/**
|
|
36
|
-
* Concatenates byte arrays and returns a hex string.
|
|
37
|
-
* @param {BytesLike[]} items
|
|
38
|
-
* @returns {string}
|
|
39
|
-
*/
|
|
40
|
-
export function concat(items: BytesLike[]): string;
|
|
41
|
-
/**
|
|
42
|
-
* Strips leading zeros from a hex string.
|
|
43
|
-
* @param {BytesLike} data
|
|
44
|
-
* @returns {string}
|
|
45
|
-
*/
|
|
46
|
-
export function stripZerosLeft(data: BytesLike): string;
|
|
47
|
-
/**
|
|
48
|
-
* Encodes a short UTF-8 string into a bytes32 hex string.
|
|
49
|
-
* @param {string} text
|
|
50
|
-
* @returns {string}
|
|
51
|
-
*/
|
|
52
|
-
export function encodeBytes32String(text: string): string;
|
|
53
|
-
/**
|
|
54
|
-
* Decodes a bytes32 hex string into a UTF-8 string (trailing zeros stripped).
|
|
55
|
-
* @param {BytesLike} bytes
|
|
56
|
-
* @returns {string}
|
|
57
|
-
*/
|
|
58
|
-
export function decodeBytes32String(bytes: BytesLike): string;
|
|
59
|
-
/**
|
|
60
|
-
* Decode Base58 string to bytes.
|
|
61
|
-
* @param {string} data
|
|
62
|
-
* @returns {Uint8Array}
|
|
63
|
-
*/
|
|
64
|
-
export function decodeBase58(data: string): Uint8Array;
|
|
65
|
-
/**
|
|
66
|
-
* Base64 decode to bytes.
|
|
67
|
-
* @param {string} data
|
|
68
|
-
* @returns {Uint8Array}
|
|
69
|
-
*/
|
|
70
|
-
export function decodeBase64(data: string): Uint8Array;
|
|
71
|
-
/**
|
|
72
|
-
* Encode BytesLike as Base58.
|
|
73
|
-
* @param {BytesLike} data
|
|
74
|
-
* @returns {string}
|
|
75
|
-
*/
|
|
76
|
-
export function encodeBase58(data: BytesLike): string;
|
|
77
|
-
/**
|
|
78
|
-
* Base64 encode BytesLike.
|
|
79
|
-
* @param {BytesLike} data
|
|
80
|
-
* @returns {string}
|
|
81
|
-
*/
|
|
82
|
-
export function encodeBase64(data: BytesLike): string;
|
|
83
|
-
/**
|
|
84
|
-
* Returns UTF-8 code points for a string.
|
|
85
|
-
* @param {string} str
|
|
86
|
-
* @returns {number[]}
|
|
87
|
-
*/
|
|
88
|
-
export function toUtf8CodePoints(str: string): number[];
|
|
89
|
-
import { isHexString } from "../internal/hex";
|
|
90
|
-
/**
|
|
91
|
-
* Returns true if value is BytesLike.
|
|
92
|
-
* @param {any} value
|
|
93
|
-
* @returns {boolean}
|
|
94
|
-
*/
|
|
95
|
-
export function isBytesLike(value: any): boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Pads a BytesLike value to the left with zeros (byte length).
|
|
98
|
-
* @param {BytesLike} value
|
|
99
|
-
* @param {number} length
|
|
100
|
-
* @returns {string}
|
|
101
|
-
*/
|
|
102
|
-
export function zeroPad(value: BytesLike, length: number): string;
|
|
103
|
-
/**
|
|
104
|
-
* Pads a hex value (interpreted as bytes) to the left with zeros (byte length).
|
|
105
|
-
* @param {BytesLike} value
|
|
106
|
-
* @param {number} length
|
|
107
|
-
* @returns {string}
|
|
108
|
-
*/
|
|
109
|
-
export function zeroPadValue(value: BytesLike, length: number): string;
|
|
110
|
-
/**
|
|
111
|
-
* Solidity packed encoding.
|
|
112
|
-
* This is a complex helper in ethers.js; in QuantumCoin.js it is currently not implemented.
|
|
113
|
-
* @throws
|
|
114
|
-
*/
|
|
115
|
-
export function solidityPacked(): void;
|
|
116
|
-
export function solidityPackedKeccak256(): void;
|
|
117
|
-
export function solidityPackedSha256(): void;
|
|
118
|
-
import { bytesToHex } from "../internal/hex";
|
|
119
|
-
import { hexToBytes } from "../internal/hex";
|
|
120
|
-
export { isHexString, bytesToHex, hexToBytes };
|