quantum-coin-js-sdk 2.0.1 → 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/README.md +13 -0
- package/index.d.ts +9 -0
- package/index.js +37 -4
- package/package.json +12 -4
- package/wasmBase64.js +3 -2
- 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 -96
- package/example/example-token-pack-unpack.js +0 -960
- package/example/example-wallet-version4.js +0 -34
- package/example/example-wallet.js +0 -39
- package/example/example.js +0 -115
- 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 -51
- 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 -60
- package/example/package.json +0 -15
- package/scripts/build-browser-tests.js +0 -29
- package/scripts/build-wasm.js +0 -85
- package/tests/browser/bundle.js +0 -97643
- package/tests/browser/entry.js +0 -57
- package/tests/browser/harness.html +0 -20
- package/tests/browser/run-browser.js +0 -50
- 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 -88
- package/tests/get-gas-price.test.js +0 -59
- package/tests/hashing.test.js +0 -34
- package/tests/non-transactional.preinit.test.js +0 -33
- package/tests/non-transactional.test.js +0 -1318
- package/tests/sign-raw-keytype5-context-null.test.js +0 -105
- package/tests/sign-raw-transaction.test.js +0 -194
- package/tests/sign-verify.test.js +0 -308
- package/tests/specs/assert.js +0 -74
- package/tests/specs/crypto.spec.js +0 -104
- package/tests/specs/hex.js +0 -31
- package/tests/specs/preinit.spec.js +0 -19
- package/tests/specs/sign.spec.js +0 -90
- package/tests/specs/wallet.spec.js +0 -98
- package/tests/transactional.rpc.test.js +0 -102
- package/tests/verify-vectors.json +0 -95035
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Change this to match your project
|
|
3
|
-
"include": ["seedwords.js"],
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
// Tells TypeScript to read JS files, as
|
|
6
|
-
// normally they are ignored as source files
|
|
7
|
-
"allowJs": true,
|
|
8
|
-
// Generate d.ts files
|
|
9
|
-
"declaration": true,
|
|
10
|
-
// This compiler run should
|
|
11
|
-
// only output d.ts files
|
|
12
|
-
"emitDeclarationOnly": true,
|
|
13
|
-
// Types should go into this directory.
|
|
14
|
-
// Removing this would place the .d.ts files
|
|
15
|
-
// next to the .js files
|
|
16
|
-
"outDir": "dist",
|
|
17
|
-
// go to js file when using IDE functions like
|
|
18
|
-
// "Go to Definition" in VSCode
|
|
19
|
-
"declarationMap": true
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "qc-sdk-example",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"lockfileVersion": 3,
|
|
5
|
-
"requires": true,
|
|
6
|
-
"packages": {
|
|
7
|
-
"": {
|
|
8
|
-
"name": "qc-sdk-example",
|
|
9
|
-
"version": "1.0.0",
|
|
10
|
-
"license": "MIT",
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"quantum-coin-js-sdk": "file:..",
|
|
13
|
-
"quantumcoin": "^7.0.14"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"..": {
|
|
17
|
-
"version": "2.0.1",
|
|
18
|
-
"license": "MIT",
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"seed-words": "1.0.3"
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@playwright/test": "^1.61.1",
|
|
24
|
-
"esbuild": "^0.28.1"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"node_modules/quantum-coin-js-sdk": {
|
|
28
|
-
"resolved": "..",
|
|
29
|
-
"link": true
|
|
30
|
-
},
|
|
31
|
-
"node_modules/quantumcoin": {
|
|
32
|
-
"version": "7.0.14",
|
|
33
|
-
"resolved": "https://registry.npmjs.org/quantumcoin/-/quantumcoin-7.0.14.tgz",
|
|
34
|
-
"integrity": "sha512-yWqgIZcx51z3iAcK7kJJ400WeI1pzYbz3A6OasTvPfYYx9MhRTspfOlfeVtRZob1bky4f5san5+rD+76kTGncA==",
|
|
35
|
-
"license": "MIT",
|
|
36
|
-
"dependencies": {
|
|
37
|
-
"quantum-coin-js-sdk": "1.0.36",
|
|
38
|
-
"seed-words": "^1.0.2"
|
|
39
|
-
},
|
|
40
|
-
"bin": {
|
|
41
|
-
"sdkgen": "generate-sdk.js"
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"node_modules/quantumcoin/node_modules/quantum-coin-js-sdk": {
|
|
45
|
-
"version": "1.0.36",
|
|
46
|
-
"resolved": "https://registry.npmjs.org/quantum-coin-js-sdk/-/quantum-coin-js-sdk-1.0.36.tgz",
|
|
47
|
-
"integrity": "sha512-FfK+xPTrylc2rKbQzC6AXodlLWOtXerGHZ34de6d1XmvDKduO7Q2zeHrp3YDa4UgSB0Di8zzNV15LgXz7ll2Nw==",
|
|
48
|
-
"license": "MIT",
|
|
49
|
-
"dependencies": {
|
|
50
|
-
"seed-words": "1.0.2"
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"node_modules/seed-words": {
|
|
54
|
-
"version": "1.0.2",
|
|
55
|
-
"resolved": "https://registry.npmjs.org/seed-words/-/seed-words-1.0.2.tgz",
|
|
56
|
-
"integrity": "sha512-ia58deuPjcR8DpJ8uIgZ7gqDnIWD8vnjb4jX/sEsIDcuQaH/AJj9J8L3DXkUHfUGqAq9Y6pVMuG90t3XUJH90g==",
|
|
57
|
-
"license": "MIT"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
package/example/package.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "qc-sdk-example",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "Quantum Coin SDK Example",
|
|
5
|
-
"main": "example.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
-
},
|
|
9
|
-
"author": "Quantum Coin Community",
|
|
10
|
-
"license": "MIT",
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"quantumcoin": "^7.0.14",
|
|
13
|
-
"quantum-coin-js-sdk": "file:.."
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Bundles the browser test entry (SDK + wasm_exec + base64 WASM + seed-words +
|
|
3
|
-
// shared specs) into tests/browser/bundle.js via esbuild. platform:'browser'
|
|
4
|
-
// fails the build if any Node-only builtin sneaks into the runtime graph - a
|
|
5
|
-
// useful guard for browser compatibility.
|
|
6
|
-
'use strict';
|
|
7
|
-
|
|
8
|
-
const path = require('path');
|
|
9
|
-
const esbuild = require('esbuild');
|
|
10
|
-
|
|
11
|
-
const root = path.resolve(__dirname, '..');
|
|
12
|
-
|
|
13
|
-
esbuild
|
|
14
|
-
.build({
|
|
15
|
-
entryPoints: [path.join(root, 'tests', 'browser', 'entry.js')],
|
|
16
|
-
bundle: true,
|
|
17
|
-
outfile: path.join(root, 'tests', 'browser', 'bundle.js'),
|
|
18
|
-
platform: 'browser',
|
|
19
|
-
format: 'iife',
|
|
20
|
-
loader: { '.json': 'json' },
|
|
21
|
-
logLevel: 'info',
|
|
22
|
-
})
|
|
23
|
-
.then(() => {
|
|
24
|
-
console.log('Built tests/browser/bundle.js');
|
|
25
|
-
})
|
|
26
|
-
.catch((err) => {
|
|
27
|
-
console.error(err);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
});
|
package/scripts/build-wasm.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/*
|
|
3
|
-
* Rebuilds the accounts WASM from quantum-coin-go and regenerates:
|
|
4
|
-
* - wasmBase64.js (base64-encoded WASM, exported via getBase64Wasm())
|
|
5
|
-
* - wasm_exec.js (synced from the building Go toolchain's GOROOT)
|
|
6
|
-
* - EXPECTED_WASM_SHA256 (patched into index.js; build-time hash)
|
|
7
|
-
*
|
|
8
|
-
* The ~10MB base64 blob is generated here and must NOT be opened by hand.
|
|
9
|
-
* Only the printed sha256 / sizes are meant to be read.
|
|
10
|
-
*
|
|
11
|
-
* Usage:
|
|
12
|
-
* node scripts/build-wasm.js # uses ../quantum-coin-go
|
|
13
|
-
* QC_GO_DIR=/path/to/quantum-coin-go node scripts/build-wasm.js
|
|
14
|
-
*/
|
|
15
|
-
'use strict';
|
|
16
|
-
|
|
17
|
-
const fs = require('fs');
|
|
18
|
-
const os = require('os');
|
|
19
|
-
const path = require('path');
|
|
20
|
-
const crypto = require('crypto');
|
|
21
|
-
const { execFileSync } = require('child_process');
|
|
22
|
-
|
|
23
|
-
const sdkDir = path.resolve(__dirname, '..');
|
|
24
|
-
const goDir = process.env.QC_GO_DIR
|
|
25
|
-
? path.resolve(process.env.QC_GO_DIR)
|
|
26
|
-
: path.resolve(sdkDir, '..', 'quantum-coin-go');
|
|
27
|
-
|
|
28
|
-
function run(cmd, args, opts) {
|
|
29
|
-
return execFileSync(cmd, args, { encoding: 'utf8', ...opts }).trim();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function main() {
|
|
33
|
-
if (!fs.existsSync(goDir)) {
|
|
34
|
-
throw new Error(`quantum-coin-go not found at ${goDir} (set QC_GO_DIR)`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const goroot = run('go', ['env', 'GOROOT']);
|
|
38
|
-
const wasmExecSrc = path.join(goroot, 'lib', 'wasm', 'wasm_exec.js');
|
|
39
|
-
if (!fs.existsSync(wasmExecSrc)) {
|
|
40
|
-
throw new Error(`wasm_exec.js not found at ${wasmExecSrc}`);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const outWasm = path.join(os.tmpdir(), `libgodp.${process.pid}.wasm`);
|
|
44
|
-
console.log(`Building WASM from ${goDir} ...`);
|
|
45
|
-
run('go', ['build', '-o', outWasm, './wasm/web'], {
|
|
46
|
-
cwd: goDir,
|
|
47
|
-
env: { ...process.env, GOOS: 'js', GOARCH: 'wasm' },
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const wasmBytes = fs.readFileSync(outWasm);
|
|
51
|
-
const sha256 = crypto.createHash('sha256').update(wasmBytes).digest('hex');
|
|
52
|
-
const base64 = wasmBytes.toString('base64');
|
|
53
|
-
|
|
54
|
-
// Sync the Go runtime shim so it matches the toolchain that built the WASM.
|
|
55
|
-
fs.copyFileSync(wasmExecSrc, path.join(sdkDir, 'wasm_exec.js'));
|
|
56
|
-
|
|
57
|
-
// Write wasmBase64.js (whole-file write; never hand-edited).
|
|
58
|
-
const wasmBase64Js =
|
|
59
|
-
'// AUTO-GENERATED by scripts/build-wasm.js - do not edit by hand.\n' +
|
|
60
|
-
'// Base64-encoded quantum-coin-go accounts WASM (GOOS=js GOARCH=wasm).\n' +
|
|
61
|
-
'function getBase64Wasm() {\n' +
|
|
62
|
-
' return "' + base64 + '";\n' +
|
|
63
|
-
'}\n' +
|
|
64
|
-
'module.exports = { getBase64Wasm };\n';
|
|
65
|
-
fs.writeFileSync(path.join(sdkDir, 'wasmBase64.js'), wasmBase64Js);
|
|
66
|
-
|
|
67
|
-
// Patch EXPECTED_WASM_SHA256 in index.js.
|
|
68
|
-
const indexPath = path.join(sdkDir, 'index.js');
|
|
69
|
-
let indexSrc = fs.readFileSync(indexPath, 'utf8');
|
|
70
|
-
const constRe = /const EXPECTED_WASM_SHA256 = "[0-9a-fA-F]*";/;
|
|
71
|
-
if (!constRe.test(indexSrc)) {
|
|
72
|
-
throw new Error('Could not find EXPECTED_WASM_SHA256 constant in index.js');
|
|
73
|
-
}
|
|
74
|
-
indexSrc = indexSrc.replace(constRe, `const EXPECTED_WASM_SHA256 = "${sha256}";`);
|
|
75
|
-
fs.writeFileSync(indexPath, indexSrc);
|
|
76
|
-
|
|
77
|
-
fs.rmSync(outWasm, { force: true });
|
|
78
|
-
|
|
79
|
-
console.log(`wasm bytes : ${wasmBytes.length}`);
|
|
80
|
-
console.log(`base64 length : ${base64.length}`);
|
|
81
|
-
console.log(`sha256 : ${sha256}`);
|
|
82
|
-
console.log('Updated: wasmBase64.js, wasm_exec.js, index.js (EXPECTED_WASM_SHA256)');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
main();
|