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,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "quantumcoinjs-sdk-examples",
|
|
3
|
-
"version": "1.0.1",
|
|
4
|
-
"description": "QuantumCoin.js SDK Examples",
|
|
5
|
-
"main": "example.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
-
"example": "node example.js",
|
|
9
|
-
"example:ts": "npx tsx example.ts",
|
|
10
|
-
"example:wallet": "node wallet-offline.js",
|
|
11
|
-
"example:wallet:ts": "npx tsx wallet-offline.ts",
|
|
12
|
-
"example:read": "node read-operations.js",
|
|
13
|
-
"example:read:ts": "npx tsx read-operations.ts",
|
|
14
|
-
"example:events": "node events.js",
|
|
15
|
-
"example:events:ts": "npx tsx events.ts",
|
|
16
|
-
"example:offline-signing": "node offline-signing.js",
|
|
17
|
-
"example:offline-signing:ts": "npx tsx offline-signing.ts",
|
|
18
|
-
"example:generator-js": "node example-generator-sdk-js.js",
|
|
19
|
-
"example:generator-js:ts": "npx tsx example-generator-sdk-js.ts",
|
|
20
|
-
"example:generator-ts": "node example-generator-sdk-ts.js",
|
|
21
|
-
"example:generator-ts:ts": "npx tsx example-generator-sdk-ts.ts"
|
|
22
|
-
},
|
|
23
|
-
"author": "QuantumCoin Community",
|
|
24
|
-
"license": "MIT",
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"tsx": "^4.19.0"
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"quantum-coin-js-sdk": "1.0.36",
|
|
30
|
-
"quantumcoin": "file:.."
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Example: Read-only operations using JsonRpcProvider + Contract.
|
|
3
|
-
* Run with VERBOSE=1 for addresses and operation details.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const { Initialize } = require("../config");
|
|
7
|
-
const { getProvider, Contract } = require("..");
|
|
8
|
-
const { logExample, logAddress } = require("../test/verbose-logger");
|
|
9
|
-
|
|
10
|
-
const RPC = "https://public.rpc.quantumcoinapi.com";
|
|
11
|
-
const CHAIN_ID = 123123;
|
|
12
|
-
const STAKING_CONTRACT = "0x" + "00".repeat(30) + "10" + "00"; // 0x...1000
|
|
13
|
-
|
|
14
|
-
async function readOperations() {
|
|
15
|
-
logExample("read-operations.js", "starting", { rpc: RPC, chainId: CHAIN_ID });
|
|
16
|
-
await Initialize(null);
|
|
17
|
-
|
|
18
|
-
const provider = getProvider(RPC, CHAIN_ID);
|
|
19
|
-
logAddress("staking_contract", STAKING_CONTRACT);
|
|
20
|
-
const abi = require("../test/fixtures/StakingContract.abi.json");
|
|
21
|
-
const contract = new Contract(STAKING_CONTRACT, abi, provider);
|
|
22
|
-
|
|
23
|
-
const total = await contract.getTotalDepositedBalance();
|
|
24
|
-
console.log("Total deposited balance:", total.toString());
|
|
25
|
-
logExample("read-operations.js", "getTotalDepositedBalance", { total: total.toString() });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
readOperations().catch((e) => {
|
|
29
|
-
console.error(e);
|
|
30
|
-
process.exitCode = 1;
|
|
31
|
-
});
|
|
32
|
-
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Example: Read-only operations (JsonRpcProvider + Contract) - TypeScript.
|
|
3
|
-
* Run: npx tsx examples/read-operations.ts
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { Initialize } from "../config";
|
|
7
|
-
import { getProvider, Contract } from "..";
|
|
8
|
-
import { logExample, logAddress } from "../test/verbose-logger";
|
|
9
|
-
|
|
10
|
-
const RPC = "https://public.rpc.quantumcoinapi.com";
|
|
11
|
-
const CHAIN_ID = 123123;
|
|
12
|
-
const STAKING_CONTRACT = "0x" + "00".repeat(30) + "10" + "00";
|
|
13
|
-
|
|
14
|
-
async function readOperations(): Promise<void> {
|
|
15
|
-
logExample("read-operations.ts", "starting", { rpc: RPC, chainId: CHAIN_ID });
|
|
16
|
-
await Initialize(null);
|
|
17
|
-
|
|
18
|
-
const provider = getProvider(RPC, CHAIN_ID);
|
|
19
|
-
logAddress("staking_contract", STAKING_CONTRACT);
|
|
20
|
-
const abi = require("../test/fixtures/StakingContract.abi.json");
|
|
21
|
-
const contract = new Contract(STAKING_CONTRACT, abi, provider);
|
|
22
|
-
|
|
23
|
-
const total = await contract.getTotalDepositedBalance();
|
|
24
|
-
console.log("Total deposited balance:", total.toString());
|
|
25
|
-
logExample("read-operations.ts", "getTotalDepositedBalance", { total: total.toString() });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
readOperations().catch((e) => {
|
|
29
|
-
console.error(e);
|
|
30
|
-
process.exitCode = 1;
|
|
31
|
-
});
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"name": "SimpleERC20",
|
|
4
|
-
"abi": [
|
|
5
|
-
{
|
|
6
|
-
"inputs": [
|
|
7
|
-
{
|
|
8
|
-
"internalType": "string",
|
|
9
|
-
"name": "_name",
|
|
10
|
-
"type": "string"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"internalType": "string",
|
|
14
|
-
"name": "_symbol",
|
|
15
|
-
"type": "string"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"internalType": "uint256",
|
|
19
|
-
"name": "_initialSupply",
|
|
20
|
-
"type": "uint256"
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
"stateMutability": "nonpayable",
|
|
24
|
-
"type": "constructor"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"anonymous": false,
|
|
28
|
-
"inputs": [
|
|
29
|
-
{
|
|
30
|
-
"indexed": true,
|
|
31
|
-
"internalType": "address",
|
|
32
|
-
"name": "owner",
|
|
33
|
-
"type": "address"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"indexed": true,
|
|
37
|
-
"internalType": "address",
|
|
38
|
-
"name": "spender",
|
|
39
|
-
"type": "address"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"indexed": false,
|
|
43
|
-
"internalType": "uint256",
|
|
44
|
-
"name": "value",
|
|
45
|
-
"type": "uint256"
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
"name": "Approval",
|
|
49
|
-
"type": "event"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"anonymous": false,
|
|
53
|
-
"inputs": [
|
|
54
|
-
{
|
|
55
|
-
"indexed": true,
|
|
56
|
-
"internalType": "address",
|
|
57
|
-
"name": "from",
|
|
58
|
-
"type": "address"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"indexed": true,
|
|
62
|
-
"internalType": "address",
|
|
63
|
-
"name": "to",
|
|
64
|
-
"type": "address"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"indexed": false,
|
|
68
|
-
"internalType": "uint256",
|
|
69
|
-
"name": "value",
|
|
70
|
-
"type": "uint256"
|
|
71
|
-
}
|
|
72
|
-
],
|
|
73
|
-
"name": "Transfer",
|
|
74
|
-
"type": "event"
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"inputs": [
|
|
78
|
-
{
|
|
79
|
-
"internalType": "address",
|
|
80
|
-
"name": "",
|
|
81
|
-
"type": "address"
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"internalType": "address",
|
|
85
|
-
"name": "",
|
|
86
|
-
"type": "address"
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
"name": "allowance",
|
|
90
|
-
"outputs": [
|
|
91
|
-
{
|
|
92
|
-
"internalType": "uint256",
|
|
93
|
-
"name": "",
|
|
94
|
-
"type": "uint256"
|
|
95
|
-
}
|
|
96
|
-
],
|
|
97
|
-
"stateMutability": "view",
|
|
98
|
-
"type": "function"
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"inputs": [
|
|
102
|
-
{
|
|
103
|
-
"internalType": "address",
|
|
104
|
-
"name": "spender",
|
|
105
|
-
"type": "address"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"internalType": "uint256",
|
|
109
|
-
"name": "value",
|
|
110
|
-
"type": "uint256"
|
|
111
|
-
}
|
|
112
|
-
],
|
|
113
|
-
"name": "approve",
|
|
114
|
-
"outputs": [
|
|
115
|
-
{
|
|
116
|
-
"internalType": "bool",
|
|
117
|
-
"name": "",
|
|
118
|
-
"type": "bool"
|
|
119
|
-
}
|
|
120
|
-
],
|
|
121
|
-
"stateMutability": "nonpayable",
|
|
122
|
-
"type": "function"
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
"inputs": [
|
|
126
|
-
{
|
|
127
|
-
"internalType": "address",
|
|
128
|
-
"name": "",
|
|
129
|
-
"type": "address"
|
|
130
|
-
}
|
|
131
|
-
],
|
|
132
|
-
"name": "balanceOf",
|
|
133
|
-
"outputs": [
|
|
134
|
-
{
|
|
135
|
-
"internalType": "uint256",
|
|
136
|
-
"name": "",
|
|
137
|
-
"type": "uint256"
|
|
138
|
-
}
|
|
139
|
-
],
|
|
140
|
-
"stateMutability": "view",
|
|
141
|
-
"type": "function"
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
"inputs": [],
|
|
145
|
-
"name": "decimals",
|
|
146
|
-
"outputs": [
|
|
147
|
-
{
|
|
148
|
-
"internalType": "uint8",
|
|
149
|
-
"name": "",
|
|
150
|
-
"type": "uint8"
|
|
151
|
-
}
|
|
152
|
-
],
|
|
153
|
-
"stateMutability": "view",
|
|
154
|
-
"type": "function"
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
"inputs": [],
|
|
158
|
-
"name": "name",
|
|
159
|
-
"outputs": [
|
|
160
|
-
{
|
|
161
|
-
"internalType": "string",
|
|
162
|
-
"name": "",
|
|
163
|
-
"type": "string"
|
|
164
|
-
}
|
|
165
|
-
],
|
|
166
|
-
"stateMutability": "view",
|
|
167
|
-
"type": "function"
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
"inputs": [],
|
|
171
|
-
"name": "symbol",
|
|
172
|
-
"outputs": [
|
|
173
|
-
{
|
|
174
|
-
"internalType": "string",
|
|
175
|
-
"name": "",
|
|
176
|
-
"type": "string"
|
|
177
|
-
}
|
|
178
|
-
],
|
|
179
|
-
"stateMutability": "view",
|
|
180
|
-
"type": "function"
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
"inputs": [],
|
|
184
|
-
"name": "totalSupply",
|
|
185
|
-
"outputs": [
|
|
186
|
-
{
|
|
187
|
-
"internalType": "uint256",
|
|
188
|
-
"name": "",
|
|
189
|
-
"type": "uint256"
|
|
190
|
-
}
|
|
191
|
-
],
|
|
192
|
-
"stateMutability": "view",
|
|
193
|
-
"type": "function"
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
"inputs": [
|
|
197
|
-
{
|
|
198
|
-
"internalType": "address",
|
|
199
|
-
"name": "to",
|
|
200
|
-
"type": "address"
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
"internalType": "uint256",
|
|
204
|
-
"name": "value",
|
|
205
|
-
"type": "uint256"
|
|
206
|
-
}
|
|
207
|
-
],
|
|
208
|
-
"name": "transfer",
|
|
209
|
-
"outputs": [
|
|
210
|
-
{
|
|
211
|
-
"internalType": "bool",
|
|
212
|
-
"name": "",
|
|
213
|
-
"type": "bool"
|
|
214
|
-
}
|
|
215
|
-
],
|
|
216
|
-
"stateMutability": "nonpayable",
|
|
217
|
-
"type": "function"
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
"inputs": [
|
|
221
|
-
{
|
|
222
|
-
"internalType": "address",
|
|
223
|
-
"name": "from",
|
|
224
|
-
"type": "address"
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
"internalType": "address",
|
|
228
|
-
"name": "to",
|
|
229
|
-
"type": "address"
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
"internalType": "uint256",
|
|
233
|
-
"name": "value",
|
|
234
|
-
"type": "uint256"
|
|
235
|
-
}
|
|
236
|
-
],
|
|
237
|
-
"name": "transferFrom",
|
|
238
|
-
"outputs": [
|
|
239
|
-
{
|
|
240
|
-
"internalType": "bool",
|
|
241
|
-
"name": "",
|
|
242
|
-
"type": "bool"
|
|
243
|
-
}
|
|
244
|
-
],
|
|
245
|
-
"stateMutability": "nonpayable",
|
|
246
|
-
"type": "function"
|
|
247
|
-
}
|
|
248
|
-
],
|
|
249
|
-
"bin": "0x608060405234801561001057600080fd5b506040516108ab3803806108ab8339818101604052606081101561003357600080fd5b810190808051604051939291908464010000000082111561005357600080fd5b90830190602082018581111561006857600080fd5b825164010000000081118282018810171561008257600080fd5b82525081516020918201929091019080838360005b838110156100af578181015183820152602001610097565b50505050905090810190601f1680156100dc5780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156100ff57600080fd5b90830190602082018581111561011457600080fd5b825164010000000081118282018810171561012e57600080fd5b82525081516020918201929091019080838360005b8381101561015b578181015183820152602001610143565b50505050905090810190601f1680156101885780820380516001836020036101000a031916815260200191505b5060405260209081015185519093506101a79250600091860190610264565b5081516101bb906001906020850190610264565b506101c633826101ce565b505050610305565b8161020f576040805162461bcd60e51b815260206004820152600c60248201526b4d494e545f544f5f5a45524f60a01b604482015290519081900360640190fd5b60028054820190556000828152600360209081526040808320805485019055805184815290518593927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef928290030190a35050565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261029a57600085556102e0565b82601f106102b357805160ff19168380011785556102e0565b828001600101855582156102e0579182015b828111156102e05782518255916020019190600101906102c5565b506102ec9291506102f0565b5090565b5b808211156102ec57600081556001016102f1565b610597806103146000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461018f57806370a08231146101ad57806395d89b41146101ca578063a9059cbb146101d2578063dd62ed3e146101f557610093565b806306fdde0314610098578063095ea7b31461011557806318160ddd1461014c57806323b872dd14610166575b600080fd5b6100a0610218565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100da5781810151838201526020016100c2565b50505050905090810190601f1680156101075780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101386004803603604081101561012b57600080fd5b50803590602001356102a6565b604080519115158252519081900360200190f35b610154610301565b60408051918252519081900360200190f35b6101386004803603606081101561017c57600080fd5b5080359060208101359060400135610307565b6101976103d6565b6040805160ff9092168252519081900360200190f35b610154600480360360208110156101c357600080fd5b50356103db565b6100a06103ed565b610138600480360360408110156101e857600080fd5b5080359060200135610447565b6101546004803603604081101561020b57600080fd5b508035906020013561045d565b6000805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561029e5780601f106102735761010080835404028352916020019161029e565b820191906000526020600020905b81548152906001019060200180831161028157829003601f168201915b505050505081565b3360008181526004602090815260408083208684528252808320859055805185815290519293869390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025481565b600083815260046020908152604080832033845290915281205482811015610362576040805162461bcd60e51b8152602060048201526009602482015268414c4c4f57414e434560b81b604482015290519081900360640190fd5b60001981146103c05760008581526004602090815260408083203380855290835292819020868503908190558151908152905188927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35b6103cb85858561047a565b506001949350505050565b601281565b60036020526000908152604090205481565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561029e5780601f106102735761010080835404028352916020019161029e565b600061045433848461047a565b50600192915050565b600460209081526000928352604080842090915290825290205481565b816104b6576040805162461bcd60e51b8152602060048201526007602482015266544f5f5a45524f60c81b604482015290519081900360640190fd5b60008381526003602052604090205481811015610504576040805162461bcd60e51b815260206004820152600760248201526642414c414e434560c81b604482015290519081900360640190fd5b600084815260036020908152604080832085850390558583529182902080548501905581518481529151859287927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35050505056fea26469706673582212202ed1f601becde0e5fba43ade631c5e20fa87ca86747a7c41488643b1eb14a89664736f6c63430007060033"
|
|
250
|
-
}
|
|
251
|
-
]
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TypeScript-only example: core Solidity types.
|
|
3
|
-
*
|
|
4
|
-
* This file is intended for developers using QuantumCoin.js from TypeScript.
|
|
5
|
-
* It is not executed by `npm run example`.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type {
|
|
9
|
-
AddressLike,
|
|
10
|
-
BigNumberish,
|
|
11
|
-
BytesLike,
|
|
12
|
-
SolidityInputValue,
|
|
13
|
-
SolidityOutputValue,
|
|
14
|
-
SolidityTypeName,
|
|
15
|
-
} from "quantumcoin/types";
|
|
16
|
-
|
|
17
|
-
// AddressLike is currently a string (32-byte QuantumCoin address).
|
|
18
|
-
const addr: AddressLike = "0x0000000000000000000000000000000000000000000000000000000000001000";
|
|
19
|
-
|
|
20
|
-
// BigNumberish is accepted for uint/int inputs (string | number | bigint).
|
|
21
|
-
const amount: BigNumberish = "123";
|
|
22
|
-
|
|
23
|
-
// BytesLike is a hex string or Uint8Array.
|
|
24
|
-
const data: BytesLike = "0x1234";
|
|
25
|
-
|
|
26
|
-
// Generic mappings for ABI input/output values:
|
|
27
|
-
type T1 = SolidityInputValue<"uint256">; // BigNumberish
|
|
28
|
-
type T2 = SolidityOutputValue<"uint256">; // bigint
|
|
29
|
-
type T3 = SolidityInputValue<"address">; // AddressLike
|
|
30
|
-
type T4 = SolidityOutputValue<"address">; // string
|
|
31
|
-
|
|
32
|
-
// Example: using SolidityTypeName
|
|
33
|
-
const t: SolidityTypeName = "bytes32";
|
|
34
|
-
|
|
35
|
-
void addr;
|
|
36
|
-
void amount;
|
|
37
|
-
void data;
|
|
38
|
-
void t;
|
|
39
|
-
void (null as any as T1);
|
|
40
|
-
void (null as any as T2);
|
|
41
|
-
void (null as any as T3);
|
|
42
|
-
void (null as any as T4);
|
|
43
|
-
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Example: Offline wallet operations (no blockchain connectivity required).
|
|
3
|
-
* Run with VERBOSE=1 for wallet addresses and recovered address.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const { Initialize } = require("../config");
|
|
7
|
-
const { Wallet } = require("..");
|
|
8
|
-
const { logExample, logAddress } = require("../test/verbose-logger");
|
|
9
|
-
|
|
10
|
-
async function walletOffline() {
|
|
11
|
-
logExample("wallet-offline.js", "starting");
|
|
12
|
-
await Initialize(null);
|
|
13
|
-
|
|
14
|
-
const wallet = Wallet.createRandom();
|
|
15
|
-
console.log("Wallet address:", wallet.address);
|
|
16
|
-
logAddress("wallet", wallet.address);
|
|
17
|
-
|
|
18
|
-
const json = wallet.encryptSync("mySecurePassword123");
|
|
19
|
-
console.log("Encrypted wallet JSON length:", json.length);
|
|
20
|
-
logExample("wallet-offline.js", "encryptSync", { jsonLength: json.length });
|
|
21
|
-
|
|
22
|
-
// Encrypt a raw seed (pre-expansion format) and restore it
|
|
23
|
-
const seed = [51,214,149,165,206,96,227,5,173,247,83,219,210,2,221,2,4,48,117,55,88,109,241,204,31,62,23,128,47,21,168,247,28,118,30,185,229,255,17,27,34,107,225,138,254,156,55,9,253,255,142,148,234,189,232,43,173,84,159,108,8,35,58,77];
|
|
24
|
-
const seedJson = Wallet.encryptSeedSync(seed, "mySecurePassword123");
|
|
25
|
-
console.log("Seed-encrypted wallet JSON length:", seedJson.length);
|
|
26
|
-
const restored = Wallet.fromEncryptedJsonSync(seedJson, "mySecurePassword123");
|
|
27
|
-
console.log("Restored from seed address:", restored.address);
|
|
28
|
-
logExample("wallet-offline.js", "encryptSeedSync", { jsonLength: seedJson.length });
|
|
29
|
-
logAddress("restored", restored.address);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
walletOffline().catch((e) => {
|
|
33
|
-
console.error(e);
|
|
34
|
-
process.exitCode = 1;
|
|
35
|
-
});
|
|
36
|
-
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Example: Offline wallet operations (no blockchain) - TypeScript.
|
|
3
|
-
* Run: npx tsx examples/wallet-offline.ts
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { Initialize } from "../config";
|
|
7
|
-
import { Wallet } from "..";
|
|
8
|
-
import { logExample, logAddress } from "../test/verbose-logger";
|
|
9
|
-
|
|
10
|
-
async function walletOffline(): Promise<void> {
|
|
11
|
-
logExample("wallet-offline.ts", "starting");
|
|
12
|
-
await Initialize(null);
|
|
13
|
-
|
|
14
|
-
const wallet = Wallet.createRandom();
|
|
15
|
-
console.log("Wallet address:", wallet.address);
|
|
16
|
-
logAddress("wallet", wallet.address);
|
|
17
|
-
|
|
18
|
-
const json = wallet.encryptSync("mySecurePassword123");
|
|
19
|
-
console.log("Encrypted wallet JSON length:", json.length);
|
|
20
|
-
logExample("wallet-offline.ts", "encryptSync", { jsonLength: json.length });
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
walletOffline().catch((e) => {
|
|
24
|
-
console.error(e);
|
|
25
|
-
process.exitCode = 1;
|
|
26
|
-
});
|