quantumcoin 7.0.9 → 7.0.11
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-SDK.md +1 -5
- package/README.md +18 -3
- package/SPEC.md +2 -63
- package/config.js +10 -2
- package/examples/example.js +0 -5
- package/examples/example.ts +0 -5
- package/examples/node_modules/.bin/esbuild +16 -0
- package/examples/node_modules/.bin/esbuild.cmd +17 -0
- package/examples/node_modules/.bin/esbuild.ps1 +28 -0
- package/examples/node_modules/.bin/sdkgen +16 -0
- package/examples/node_modules/.bin/sdkgen.cmd +17 -0
- package/examples/node_modules/.bin/sdkgen.ps1 +28 -0
- package/examples/node_modules/.bin/tsx +16 -0
- package/examples/node_modules/.bin/tsx.cmd +17 -0
- package/examples/node_modules/.bin/tsx.ps1 +28 -0
- package/examples/node_modules/.package-lock.json +235 -0
- package/examples/node_modules/@esbuild/win32-x64/README.md +3 -0
- package/examples/node_modules/@esbuild/win32-x64/esbuild.exe +0 -0
- package/examples/node_modules/@esbuild/win32-x64/package.json +20 -0
- package/examples/node_modules/esbuild/LICENSE.md +21 -0
- package/examples/node_modules/esbuild/README.md +3 -0
- package/examples/node_modules/esbuild/bin/esbuild +223 -0
- package/examples/node_modules/esbuild/install.js +289 -0
- package/examples/node_modules/esbuild/lib/main.d.ts +716 -0
- package/examples/node_modules/esbuild/lib/main.js +2532 -0
- package/examples/node_modules/esbuild/package.json +49 -0
- package/examples/node_modules/get-tsconfig/LICENSE +21 -0
- package/examples/node_modules/get-tsconfig/README.md +235 -0
- package/examples/node_modules/get-tsconfig/dist/index.cjs +7 -0
- package/examples/node_modules/get-tsconfig/dist/index.d.cts +2088 -0
- package/examples/node_modules/get-tsconfig/dist/index.d.mts +2088 -0
- package/examples/node_modules/get-tsconfig/dist/index.mjs +7 -0
- package/examples/node_modules/get-tsconfig/package.json +46 -0
- package/examples/node_modules/quantum-coin-js-sdk/.github/workflows/publish-npmjs.yaml +22 -0
- package/examples/node_modules/quantum-coin-js-sdk/LICENSE +21 -0
- package/examples/node_modules/quantum-coin-js-sdk/LICENSE-wasm_exec.js.txt +30 -0
- package/examples/node_modules/quantum-coin-js-sdk/README.md +1665 -0
- package/examples/node_modules/quantum-coin-js-sdk/example/README.md +14 -0
- package/examples/node_modules/quantum-coin-js-sdk/example/conversion-example.js +19 -0
- package/examples/node_modules/quantum-coin-js-sdk/example/example-create-contract.js +396 -0
- package/examples/node_modules/quantum-coin-js-sdk/example/example-encode-decode-rlp.js +225 -0
- package/examples/node_modules/quantum-coin-js-sdk/example/example-event-pack-unpack.js +391 -0
- package/examples/node_modules/quantum-coin-js-sdk/example/example-misc.js +101 -0
- package/examples/node_modules/quantum-coin-js-sdk/example/example-rpc-send-signRawTransaction.js +318 -0
- package/examples/node_modules/quantum-coin-js-sdk/example/example-rpc-send.js +116 -0
- package/examples/node_modules/quantum-coin-js-sdk/example/example-send.js +70 -0
- package/examples/node_modules/quantum-coin-js-sdk/example/example-token-pack-unpack.js +961 -0
- package/examples/node_modules/quantum-coin-js-sdk/example/example-wallet-version4.js +35 -0
- package/examples/node_modules/quantum-coin-js-sdk/example/example-wallet.js +43 -0
- package/examples/node_modules/quantum-coin-js-sdk/example/example.js +405 -0
- package/examples/node_modules/quantum-coin-js-sdk/example/package-lock.json +134 -0
- package/examples/node_modules/quantum-coin-js-sdk/example/package.json +15 -0
- package/examples/node_modules/quantum-coin-js-sdk/index.d.ts +1024 -0
- package/examples/node_modules/quantum-coin-js-sdk/index.js +3062 -0
- package/examples/node_modules/quantum-coin-js-sdk/package.json +34 -0
- package/examples/node_modules/quantum-coin-js-sdk/tests/encrypted-32.json +1 -0
- package/examples/node_modules/quantum-coin-js-sdk/tests/encrypted-36.json +1 -0
- package/examples/node_modules/quantum-coin-js-sdk/tests/encrypted-48.json +1 -0
- package/examples/node_modules/quantum-coin-js-sdk/tests/generate-verify-vectors.js +91 -0
- package/examples/node_modules/quantum-coin-js-sdk/tests/non-transactional.preinit.test.js +41 -0
- package/examples/node_modules/quantum-coin-js-sdk/tests/non-transactional.test.js +686 -0
- package/examples/node_modules/quantum-coin-js-sdk/tests/sign-raw-keytype5-context-null.test.js +107 -0
- package/examples/node_modules/quantum-coin-js-sdk/tests/sign-raw-transaction.test.js +196 -0
- package/examples/node_modules/quantum-coin-js-sdk/tests/sign-verify.test.js +311 -0
- package/examples/node_modules/quantum-coin-js-sdk/tests/transactional.relay.test.js +131 -0
- package/examples/node_modules/quantum-coin-js-sdk/tests/transactional.rpc.test.js +103 -0
- package/examples/node_modules/quantum-coin-js-sdk/tests/verify-vectors.json +95035 -0
- package/examples/node_modules/quantum-coin-js-sdk/wasmBase64.d.ts +9 -0
- package/examples/node_modules/quantum-coin-js-sdk/wasmBase64.js +16 -0
- package/examples/node_modules/quantum-coin-js-sdk/wasm_exec.d.ts +0 -0
- package/examples/node_modules/quantum-coin-js-sdk/wasm_exec.js +587 -0
- package/examples/node_modules/resolve-pkg-maps/LICENSE +21 -0
- package/examples/node_modules/resolve-pkg-maps/README.md +216 -0
- package/examples/node_modules/resolve-pkg-maps/dist/index.cjs +1 -0
- package/examples/node_modules/resolve-pkg-maps/dist/index.d.cts +11 -0
- package/examples/node_modules/resolve-pkg-maps/dist/index.d.mts +11 -0
- package/examples/node_modules/resolve-pkg-maps/dist/index.mjs +1 -0
- package/examples/node_modules/resolve-pkg-maps/package.json +42 -0
- package/examples/node_modules/seed-words/.github/workflows/publish-npmjs.yaml +22 -0
- package/examples/node_modules/seed-words/BUILD.md +7 -0
- package/examples/node_modules/seed-words/LICENSE +121 -0
- package/examples/node_modules/seed-words/README.md +67 -0
- package/examples/node_modules/seed-words/dist/seedwords.d.ts +39 -0
- package/examples/node_modules/seed-words/package.json +27 -0
- package/examples/node_modules/seed-words/seedwords.js +315 -0
- package/examples/node_modules/seed-words/seedwords.txt +65536 -0
- package/examples/node_modules/seed-words/tsconfig.json +21 -0
- package/examples/node_modules/tsx/LICENSE +21 -0
- package/examples/node_modules/tsx/README.md +32 -0
- package/examples/node_modules/tsx/dist/cjs/api/index.cjs +1 -0
- package/examples/node_modules/tsx/dist/cjs/api/index.d.cts +35 -0
- package/examples/node_modules/tsx/dist/cjs/api/index.d.mts +35 -0
- package/examples/node_modules/tsx/dist/cjs/api/index.mjs +1 -0
- package/examples/node_modules/tsx/dist/cjs/index.cjs +1 -0
- package/examples/node_modules/tsx/dist/cjs/index.mjs +1 -0
- package/examples/node_modules/tsx/dist/cli.cjs +54 -0
- package/examples/node_modules/tsx/dist/cli.mjs +55 -0
- package/examples/node_modules/tsx/dist/client-BQVF1NaW.mjs +1 -0
- package/examples/node_modules/tsx/dist/client-D6NvIMSC.cjs +1 -0
- package/examples/node_modules/tsx/dist/esm/api/index.cjs +1 -0
- package/examples/node_modules/tsx/dist/esm/api/index.d.cts +35 -0
- package/examples/node_modules/tsx/dist/esm/api/index.d.mts +35 -0
- package/examples/node_modules/tsx/dist/esm/api/index.mjs +1 -0
- package/examples/node_modules/tsx/dist/esm/index.cjs +2 -0
- package/examples/node_modules/tsx/dist/esm/index.mjs +2 -0
- package/examples/node_modules/tsx/dist/get-pipe-path-BHW2eJdv.mjs +1 -0
- package/examples/node_modules/tsx/dist/get-pipe-path-BoR10qr8.cjs +1 -0
- package/examples/node_modules/tsx/dist/index-7AaEi15b.mjs +14 -0
- package/examples/node_modules/tsx/dist/index-BWFBUo6r.cjs +1 -0
- package/examples/node_modules/tsx/dist/index-gbaejti9.mjs +1 -0
- package/examples/node_modules/tsx/dist/index-gckBtVBf.cjs +14 -0
- package/examples/node_modules/tsx/dist/lexer-DQCqS3nf.mjs +3 -0
- package/examples/node_modules/tsx/dist/lexer-DgIbo0BU.cjs +3 -0
- package/examples/node_modules/tsx/dist/loader.cjs +1 -0
- package/examples/node_modules/tsx/dist/loader.mjs +1 -0
- package/examples/node_modules/tsx/dist/node-features-_8ZFwP_x.mjs +1 -0
- package/examples/node_modules/tsx/dist/node-features-roYmp9jK.cjs +1 -0
- package/examples/node_modules/tsx/dist/package-CeBgXWuR.mjs +1 -0
- package/examples/node_modules/tsx/dist/package-Dxt5kIHw.cjs +1 -0
- package/examples/node_modules/tsx/dist/patch-repl.cjs +1 -0
- package/examples/node_modules/tsx/dist/patch-repl.mjs +1 -0
- package/examples/node_modules/tsx/dist/preflight.cjs +1 -0
- package/examples/node_modules/tsx/dist/preflight.mjs +1 -0
- package/examples/node_modules/tsx/dist/register-2sWVXuRQ.cjs +1 -0
- package/examples/node_modules/tsx/dist/register-B7jrtLTO.mjs +1 -0
- package/examples/node_modules/tsx/dist/register-CFH5oNdT.mjs +4 -0
- package/examples/node_modules/tsx/dist/register-D46fvsV_.cjs +4 -0
- package/examples/node_modules/tsx/dist/repl.cjs +3 -0
- package/examples/node_modules/tsx/dist/repl.mjs +3 -0
- package/examples/node_modules/tsx/dist/require-D4F1Lv60.cjs +1 -0
- package/examples/node_modules/tsx/dist/require-DQxpCAr4.mjs +1 -0
- package/examples/node_modules/tsx/dist/suppress-warnings.cjs +1 -0
- package/examples/node_modules/tsx/dist/suppress-warnings.mjs +1 -0
- package/examples/node_modules/tsx/dist/temporary-directory-B83uKxJF.cjs +1 -0
- package/examples/node_modules/tsx/dist/temporary-directory-CwHp0_NW.mjs +1 -0
- package/examples/node_modules/tsx/dist/types-Cxp8y2TL.d.ts +5 -0
- package/examples/node_modules/tsx/package.json +68 -0
- package/examples/offline-signing.js +0 -2
- package/examples/offline-signing.ts +0 -1
- package/examples/package-lock.json +424 -73
- package/examples/package.json +2 -2
- package/examples/wallet-offline.js +10 -9
- package/examples/wallet-offline.ts +1 -9
- package/generate-sdk.js +4 -6
- package/package.json +2 -2
- package/src/abi/interface.js +13 -7
- package/src/abi/js-abi-coder.js +23 -18
- package/src/constants.d.ts +0 -5
- package/src/constants.js +0 -7
- package/src/contract/contract-factory.js +9 -3
- package/src/contract/contract.js +9 -3
- package/src/errors/index.js +12 -0
- package/src/index.d.ts +0 -3
- package/src/providers/extra-providers.js +20 -6
- package/src/providers/json-rpc-provider.js +15 -5
- package/src/providers/provider.d.ts +0 -2
- package/src/providers/provider.js +1 -3
- package/src/utils/address.d.ts +0 -14
- package/src/utils/address.js +12 -49
- package/src/utils/hashing.d.ts +0 -6
- package/src/utils/hashing.js +8 -23
- package/src/utils/index.d.ts +0 -3
- package/src/utils/rlp.js +7 -4
- package/src/wallet/wallet.d.ts +11 -13
- package/src/wallet/wallet.js +135 -96
- package/test/security/malformed-input.test.js +295 -1
- package/test/unit/address-wallet.test.js +277 -128
- package/test/unit/address-wallet.test.ts +276 -127
- package/test/unit/hashing.test.js +0 -11
- package/test/unit/hashing.test.ts +0 -11
- package/test/unit/providers.test.js +3 -1
- package/test/unit/providers.test.ts +3 -1
package/README-SDK.md
CHANGED
|
@@ -303,7 +303,6 @@ Wrapper returned by `provider.sendTransaction(...)` and `provider.getTransaction
|
|
|
303
303
|
- `data: string`
|
|
304
304
|
- `value: bigint`
|
|
305
305
|
- `gasLimit: bigint | null`
|
|
306
|
-
- `gasPrice: bigint | null`
|
|
307
306
|
- `chainId: number | null`
|
|
308
307
|
- `blockNumber: number | null`
|
|
309
308
|
- `txType: number | null` — Transaction type (e.g. `1` for a standard transfer)
|
|
@@ -375,7 +374,6 @@ Core signing implementation.
|
|
|
375
374
|
|
|
376
375
|
**Methods**
|
|
377
376
|
- `getAddress(): Promise<string>`
|
|
378
|
-
- `signMessageSync(message: string | Uint8Array): string`
|
|
379
377
|
- `signTransaction(tx: TransactionRequest): Promise<string>`
|
|
380
378
|
- `sendTransaction(tx: TransactionRequest): Promise<TransactionResponse>`
|
|
381
379
|
|
|
@@ -387,11 +385,11 @@ User-facing wallet class.
|
|
|
387
385
|
|
|
388
386
|
**Static methods**
|
|
389
387
|
- `Wallet.createRandom(provider?: AbstractProvider, keyType?: number | null): Wallet` — `keyType`: `null`/`3` (default, hybrid compact) or `5` (hybrid5)
|
|
390
|
-
- `Wallet.createRandomSeed(keyType?: number | null): string[]` — returns seed words (32 for keyType 3, 36 for keyType 5); pass to `fromPhrase` to open
|
|
391
388
|
- `Wallet.fromSeed(seed: number[], provider?: AbstractProvider): Wallet` — opens wallet from raw seed bytes (64/72/96 length)
|
|
392
389
|
- `Wallet.fromEncryptedJsonSync(json: string, password: string, provider?: AbstractProvider): Wallet`
|
|
393
390
|
- `Wallet.fromPhrase(phrase: string | string[], provider?: AbstractProvider): Wallet`
|
|
394
391
|
- `Wallet.fromKeys(privateKey: Uint8Array | string, publicKey: Uint8Array | string, provider?: AbstractProvider): Wallet`
|
|
392
|
+
- `Wallet.encryptSeedSync(seed: number[] | Uint8Array, password: string | Uint8Array): string` — encrypts raw seed bytes (64/72/96) into a wallet JSON string (version 5 pre-expansion format). The resulting JSON can be opened with `fromEncryptedJsonSync()` or Desktop/Mobile/Web/CLI wallet applications. Password must be at least 12 characters.
|
|
395
393
|
|
|
396
394
|
**Instance methods**
|
|
397
395
|
- `getAddress(): string`
|
|
@@ -560,8 +558,6 @@ From `quantumcoin`:
|
|
|
560
558
|
- `getCreateAddress({ from, nonce }): string`
|
|
561
559
|
- `getCreate2Address(from: string, salt: string, initCodeHash: string): string`
|
|
562
560
|
- `computeAddress(publicKey: string|Uint8Array): string`
|
|
563
|
-
- `verifyMessage(message: string|Uint8Array, signature: string): string`
|
|
564
|
-
- `recoverAddress(message: string|Uint8Array, signature: string): string`
|
|
565
561
|
|
|
566
562
|
**Example(s):**
|
|
567
563
|
- `examples/wallet-offline.js`
|
package/README.md
CHANGED
|
@@ -44,20 +44,35 @@ console.log(await provider.getBlockNumber());
|
|
|
44
44
|
## Wallet (offline + online)
|
|
45
45
|
|
|
46
46
|
```js
|
|
47
|
-
const { Wallet
|
|
47
|
+
const { Wallet } = require("quantumcoin");
|
|
48
48
|
const { Initialize } = require("quantumcoin/config");
|
|
49
49
|
|
|
50
50
|
await Initialize(null);
|
|
51
51
|
|
|
52
52
|
const wallet = Wallet.createRandom();
|
|
53
|
-
const sig = wallet.signMessageSync("Hello, QuantumCoin!");
|
|
54
|
-
console.log(verifyMessage("Hello, QuantumCoin!", sig));
|
|
55
53
|
|
|
56
54
|
const encrypted = wallet.encryptSync("mySecurePassword123");
|
|
57
55
|
const restored = Wallet.fromEncryptedJsonSync(encrypted, "mySecurePassword123");
|
|
58
56
|
console.log(restored.address);
|
|
59
57
|
```
|
|
60
58
|
|
|
59
|
+
### Encrypt a raw seed
|
|
60
|
+
|
|
61
|
+
You can encrypt raw seed bytes (pre-expansion) into a portable wallet JSON (version 5 format) without first opening the wallet:
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
const { Wallet } = require("quantumcoin");
|
|
65
|
+
const { Initialize } = require("quantumcoin/config");
|
|
66
|
+
|
|
67
|
+
await Initialize(null);
|
|
68
|
+
|
|
69
|
+
// 64-byte seed (keyType 3), 72-byte (keyType 5), or 96-byte (legacy)
|
|
70
|
+
const seed = [51,214,149,165, /* ...remaining bytes... */];
|
|
71
|
+
const json = Wallet.encryptSeedSync(seed, "mySecurePassword123");
|
|
72
|
+
const restored = Wallet.fromEncryptedJsonSync(json, "mySecurePassword123");
|
|
73
|
+
console.log(restored.address);
|
|
74
|
+
```
|
|
75
|
+
|
|
61
76
|
## Contracts (read-only)
|
|
62
77
|
|
|
63
78
|
```js
|
package/SPEC.md
CHANGED
|
@@ -380,7 +380,6 @@ Returns prefetched transaction objects (if available).
|
|
|
380
380
|
- `value`: bigint | string - Value in wei
|
|
381
381
|
- `data`: string - Transaction data (hex string)
|
|
382
382
|
- `gasLimit`: bigint | string - Gas limit
|
|
383
|
-
- `gasPrice`: bigint | string - Gas price
|
|
384
383
|
- `nonce`: number - Transaction nonce
|
|
385
384
|
- `chainId`: number - Chain ID
|
|
386
385
|
- `remarks`: string | null - Optional hex string (including 0x) that represents a remark/comment. Maximum 32 bytes length (in bytes). Warning: do not store any sensitive information in this field as it will be public on the blockchain.
|
|
@@ -399,7 +398,6 @@ Returns prefetched transaction objects (if available).
|
|
|
399
398
|
- `value`: bigint - Value in wei
|
|
400
399
|
- `data`: string - Transaction data
|
|
401
400
|
- `gasLimit`: bigint - Gas limit
|
|
402
|
-
- `gasPrice`: bigint | null - Gas price
|
|
403
401
|
- `nonce`: number - Nonce
|
|
404
402
|
- `chainId`: number - Chain ID
|
|
405
403
|
- `remarks`: string | null - Optional hex string (including 0x) that represents a remark/comment. Maximum 32 bytes length (in bytes). Warning: do not store any sensitive information in this field as it will be public on the blockchain.
|
|
@@ -713,12 +711,6 @@ constructor(privateKey: SigningKey, provider?: null | Provider)
|
|
|
713
711
|
Returns the wallet address.
|
|
714
712
|
- Returns: Address string
|
|
715
713
|
|
|
716
|
-
#### `signMessageSync(message: string | Uint8Array): string`
|
|
717
|
-
Returns the signature for message signed with this wallet (synchronous).
|
|
718
|
-
- `message`: Message to sign (string or bytes)
|
|
719
|
-
- Returns: Signature string
|
|
720
|
-
- **Implementation**: Uses quantum-coin-js-sdk for message signing
|
|
721
|
-
|
|
722
714
|
#### `signTransaction(tx: TransactionRequest): Promise<string>`
|
|
723
715
|
Signs a transaction and returns the signed transaction data.
|
|
724
716
|
- `tx`: Transaction request
|
|
@@ -837,7 +829,7 @@ Creates a wallet from a seed phrase.
|
|
|
837
829
|
**Provider Usage**:
|
|
838
830
|
- The provider is optional in the constructor. If not provided, `provider` will be `null`.
|
|
839
831
|
- Methods that require blockchain access (`getBalance()`, `getTransactionCount()`, `sendTransaction()`) will throw an error if `provider` is `null`.
|
|
840
|
-
- Methods that only require signing (`signTransaction()`, `
|
|
832
|
+
- Methods that only require signing (`signTransaction()`, `signTypedData()`) can work without a provider.
|
|
841
833
|
- The provider can be set later using the `connect(provider)` method.
|
|
842
834
|
|
|
843
835
|
**Methods**:
|
|
@@ -868,13 +860,6 @@ Signs a transaction and returns the signed transaction data.
|
|
|
868
860
|
- **Does not require provider**: Can sign transactions offline.
|
|
869
861
|
- Note: The `remarks` field in TransactionRequest is optional and can be used to include a comment (max 32 bytes). Do not store sensitive information in remarks.
|
|
870
862
|
|
|
871
|
-
#### `signMessageSync(message: string | Uint8Array): string`
|
|
872
|
-
Signs a message and returns the signature (synchronous).
|
|
873
|
-
- `message`: Message to sign (string or bytes)
|
|
874
|
-
- Returns: Signature string
|
|
875
|
-
- **Does not require provider**: Can sign messages offline.
|
|
876
|
-
- **Implementation**: Uses quantum-coin-js-sdk for message signing
|
|
877
|
-
|
|
878
863
|
#### `encryptSync(password: string | Uint8Array): string`
|
|
879
864
|
Encrypts and serializes this wallet to a JSON string (synchronous).
|
|
880
865
|
- `password`: Passphrase used to encrypt the wallet (should be at least 12 characters long)
|
|
@@ -1697,7 +1682,6 @@ Creates a Signature from various formats.
|
|
|
1697
1682
|
- `from`: string | null - Sender address (null if not specified)
|
|
1698
1683
|
- `nonce`: number | null - Transaction nonce
|
|
1699
1684
|
- `gasLimit`: bigint | null - Gas limit
|
|
1700
|
-
- `gasPrice`: bigint | null - Gas price
|
|
1701
1685
|
- `value`: bigint | null - Transaction value in wei
|
|
1702
1686
|
- `data`: string | null - Transaction data (hex string)
|
|
1703
1687
|
- `chainId`: bigint | null - Chain ID
|
|
@@ -1816,20 +1800,6 @@ Computes address from public key.
|
|
|
1816
1800
|
- Returns: Computed address (32 bytes, 66 hex characters including 0x)
|
|
1817
1801
|
- **Implementation**: Uses quantum-coin-js-sdk's `addressFromPublicKey()` internally
|
|
1818
1802
|
|
|
1819
|
-
#### `verifyMessage(message: string | Uint8Array, signature: string): string`
|
|
1820
|
-
Verifies a message signature and recovers the address.
|
|
1821
|
-
- `message`: Message that was signed
|
|
1822
|
-
- `signature`: Signature to verify (hex string)
|
|
1823
|
-
- Returns: Address that signed the message
|
|
1824
|
-
- **Implementation**: Uses quantum-coin-js-sdk for signature verification
|
|
1825
|
-
|
|
1826
|
-
#### `recoverAddress(message: string | Uint8Array, signature: string): string`
|
|
1827
|
-
Recovers the address from a message signature.
|
|
1828
|
-
- `message`: Message that was signed
|
|
1829
|
-
- `signature`: Signature (hex string)
|
|
1830
|
-
- Returns: Address that signed the message
|
|
1831
|
-
- **Implementation**: Uses quantum-coin-js-sdk for signature recovery
|
|
1832
|
-
|
|
1833
1803
|
### 5.4.1 Addressable Interface
|
|
1834
1804
|
|
|
1835
1805
|
**Purpose**: An interface for objects which have an address, and can resolve it asynchronously.
|
|
@@ -2602,7 +2572,6 @@ Compute the intrinsic gas required for a transaction using plugin parameters.
|
|
|
2602
2572
|
- `value`: bigint - Value in wei
|
|
2603
2573
|
- `data`: string - Transaction data (hex string)
|
|
2604
2574
|
- `gasLimit`: bigint - Gas limit
|
|
2605
|
-
- `gasPrice`: bigint | null - Gas price
|
|
2606
2575
|
- `nonce`: number - Transaction nonce
|
|
2607
2576
|
- `chainId`: number - Chain ID
|
|
2608
2577
|
- `remarks`: string | null - Optional remarks field
|
|
@@ -2652,27 +2621,6 @@ Resolves to the number of confirmations this transaction has.
|
|
|
2652
2621
|
|
|
2653
2622
|
---
|
|
2654
2623
|
|
|
2655
|
-
### 8.4 FeeData
|
|
2656
|
-
|
|
2657
|
-
**Purpose**: Represents fee data for transactions
|
|
2658
|
-
|
|
2659
|
-
**Constructor**:
|
|
2660
|
-
```javascript
|
|
2661
|
-
constructor(gasPrice: bigint | null)
|
|
2662
|
-
```
|
|
2663
|
-
- `gasPrice`: Legacy gas price
|
|
2664
|
-
|
|
2665
|
-
**Properties**:
|
|
2666
|
-
- `gasPrice`: bigint | null - Gas price
|
|
2667
|
-
|
|
2668
|
-
**Methods**:
|
|
2669
|
-
|
|
2670
|
-
#### `toJSON(): any`
|
|
2671
|
-
Converts to JSON.
|
|
2672
|
-
- Returns: JSON representation of FeeData
|
|
2673
|
-
|
|
2674
|
-
**Note**: For QuantumCoin, only `gasPrice` is used (EIP-1559 style transactions are not applicable).
|
|
2675
|
-
|
|
2676
2624
|
---
|
|
2677
2625
|
|
|
2678
2626
|
### 8.5 WebSocketLike
|
|
@@ -2908,7 +2856,7 @@ Gets the result of a transaction execution.
|
|
|
2908
2856
|
|
|
2909
2857
|
### 9.3 Signer (Abstract Base Class)
|
|
2910
2858
|
|
|
2911
|
-
**Note**: The API matches ethers.js v6 Signer. All methods, properties, and behavior follow the same patterns as ethers.js v6
|
|
2859
|
+
**Note**: The API matches ethers.js v6 Signer. All methods, properties, and behavior follow the same patterns as ethers.js v6.
|
|
2912
2860
|
|
|
2913
2861
|
**Properties**:
|
|
2914
2862
|
- `provider`: Provider | null - Provider instance
|
|
@@ -2933,11 +2881,6 @@ Signs and sends transaction.
|
|
|
2933
2881
|
Signs transaction.
|
|
2934
2882
|
- Note: The `remarks` field in TransactionRequest is optional and can be used to include a comment (max 32 bytes). Do not store sensitive information in remarks.
|
|
2935
2883
|
|
|
2936
|
-
#### `signMessageSync(message: string | Uint8Array): string`
|
|
2937
|
-
Signs message (synchronous).
|
|
2938
|
-
- `message`: Message to sign (string or bytes)
|
|
2939
|
-
- Returns: Signature string
|
|
2940
|
-
|
|
2941
2884
|
#### `connect(provider: Provider): Signer`
|
|
2942
2885
|
Connects to provider.
|
|
2943
2886
|
|
|
@@ -3128,9 +3071,6 @@ const walletFromPhrase2 = Wallet.fromPhrase(seedPhraseString, provider);
|
|
|
3128
3071
|
const encryptedJson = wallet.encryptSync('mySecurePassword123');
|
|
3129
3072
|
// Can be saved to file and opened in Desktop/Mobile/Web/CLI wallet applications
|
|
3130
3073
|
|
|
3131
|
-
// Sign message synchronously
|
|
3132
|
-
const signature = wallet.signMessageSync('Hello, QuantumCoin!');
|
|
3133
|
-
|
|
3134
3074
|
const tx = await wallet.sendTransaction({
|
|
3135
3075
|
to: '0x...',
|
|
3136
3076
|
value: parseEther('1.0')
|
|
@@ -3780,7 +3720,6 @@ Methods that send transactions must return the appropriate transaction object fr
|
|
|
3780
3720
|
- `value`: Transaction value
|
|
3781
3721
|
- `data`: Transaction data
|
|
3782
3722
|
- `gasLimit`: Gas limit
|
|
3783
|
-
- `gasPrice`: Gas price
|
|
3784
3723
|
- `nonce`: Transaction nonce
|
|
3785
3724
|
- `chainId`: Chain ID
|
|
3786
3725
|
- `wait()`: Method to wait for confirmation
|
package/config.js
CHANGED
|
@@ -106,10 +106,18 @@ function getConfig() {
|
|
|
106
106
|
return _config;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Returns the pending initialization promise, or null if Initialize() has not been called.
|
|
111
|
+
* @return {Promise<boolean>|null}
|
|
112
|
+
*/
|
|
113
|
+
function getInitializationPromise() {
|
|
114
|
+
return _initializationPromise;
|
|
115
|
+
}
|
|
116
|
+
|
|
110
117
|
module.exports = {
|
|
111
118
|
Config,
|
|
112
119
|
Initialize,
|
|
113
120
|
isInitialized,
|
|
114
|
-
getConfig
|
|
121
|
+
getConfig,
|
|
122
|
+
getInitializationPromise
|
|
115
123
|
};
|
package/examples/example.js
CHANGED
|
@@ -47,11 +47,6 @@ async function main() {
|
|
|
47
47
|
const wallet = qc.Wallet.createRandom();
|
|
48
48
|
console.log("Random wallet address:", wallet.address);
|
|
49
49
|
logAddress("random_wallet", wallet.address);
|
|
50
|
-
const sig = wallet.signMessageSync("Hello, QuantumCoin!");
|
|
51
|
-
console.log("Signed message signature:", sig.slice(0, 18) + "...");
|
|
52
|
-
const recovered = qc.verifyMessage("Hello, QuantumCoin!", sig);
|
|
53
|
-
console.log("Recovered address:", recovered);
|
|
54
|
-
logAddress("recovered", recovered);
|
|
55
50
|
|
|
56
51
|
const encrypted = wallet.encryptSync("mySecurePassword123");
|
|
57
52
|
console.log("Encrypted wallet JSON length:", encrypted.length);
|
package/examples/example.ts
CHANGED
|
@@ -38,11 +38,6 @@ async function main(): Promise<void> {
|
|
|
38
38
|
const wallet = qc.Wallet.createRandom();
|
|
39
39
|
console.log("Random wallet address:", wallet.address);
|
|
40
40
|
logAddress("random_wallet", wallet.address);
|
|
41
|
-
const sig = wallet.signMessageSync("Hello, QuantumCoin!");
|
|
42
|
-
console.log("Signed message signature:", sig.slice(0, 18) + "...");
|
|
43
|
-
const recovered = qc.verifyMessage("Hello, QuantumCoin!", sig);
|
|
44
|
-
console.log("Recovered address:", recovered);
|
|
45
|
-
logAddress("recovered", recovered);
|
|
46
41
|
|
|
47
42
|
const encrypted = wallet.encryptSync("mySecurePassword123");
|
|
48
43
|
console.log("Encrypted wallet JSON length:", encrypted.length);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -x "$basedir/node" ]; then
|
|
13
|
+
exec "$basedir/node" "$basedir/../esbuild/bin/esbuild" "$@"
|
|
14
|
+
else
|
|
15
|
+
exec node "$basedir/../esbuild/bin/esbuild" "$@"
|
|
16
|
+
fi
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@ECHO off
|
|
2
|
+
GOTO start
|
|
3
|
+
:find_dp0
|
|
4
|
+
SET dp0=%~dp0
|
|
5
|
+
EXIT /b
|
|
6
|
+
:start
|
|
7
|
+
SETLOCAL
|
|
8
|
+
CALL :find_dp0
|
|
9
|
+
|
|
10
|
+
IF EXIST "%dp0%\node.exe" (
|
|
11
|
+
SET "_prog=%dp0%\node.exe"
|
|
12
|
+
) ELSE (
|
|
13
|
+
SET "_prog=node"
|
|
14
|
+
SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\esbuild\bin\esbuild" %*
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
3
|
+
|
|
4
|
+
$exe=""
|
|
5
|
+
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
6
|
+
# Fix case when both the Windows and Linux builds of Node
|
|
7
|
+
# are installed in the same directory
|
|
8
|
+
$exe=".exe"
|
|
9
|
+
}
|
|
10
|
+
$ret=0
|
|
11
|
+
if (Test-Path "$basedir/node$exe") {
|
|
12
|
+
# Support pipeline input
|
|
13
|
+
if ($MyInvocation.ExpectingInput) {
|
|
14
|
+
$input | & "$basedir/node$exe" "$basedir/../esbuild/bin/esbuild" $args
|
|
15
|
+
} else {
|
|
16
|
+
& "$basedir/node$exe" "$basedir/../esbuild/bin/esbuild" $args
|
|
17
|
+
}
|
|
18
|
+
$ret=$LASTEXITCODE
|
|
19
|
+
} else {
|
|
20
|
+
# Support pipeline input
|
|
21
|
+
if ($MyInvocation.ExpectingInput) {
|
|
22
|
+
$input | & "node$exe" "$basedir/../esbuild/bin/esbuild" $args
|
|
23
|
+
} else {
|
|
24
|
+
& "node$exe" "$basedir/../esbuild/bin/esbuild" $args
|
|
25
|
+
}
|
|
26
|
+
$ret=$LASTEXITCODE
|
|
27
|
+
}
|
|
28
|
+
exit $ret
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -x "$basedir/node" ]; then
|
|
13
|
+
exec "$basedir/node" "$basedir/../quantumcoin/generate-sdk.js" "$@"
|
|
14
|
+
else
|
|
15
|
+
exec node "$basedir/../quantumcoin/generate-sdk.js" "$@"
|
|
16
|
+
fi
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@ECHO off
|
|
2
|
+
GOTO start
|
|
3
|
+
:find_dp0
|
|
4
|
+
SET dp0=%~dp0
|
|
5
|
+
EXIT /b
|
|
6
|
+
:start
|
|
7
|
+
SETLOCAL
|
|
8
|
+
CALL :find_dp0
|
|
9
|
+
|
|
10
|
+
IF EXIST "%dp0%\node.exe" (
|
|
11
|
+
SET "_prog=%dp0%\node.exe"
|
|
12
|
+
) ELSE (
|
|
13
|
+
SET "_prog=node"
|
|
14
|
+
SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\quantumcoin\generate-sdk.js" %*
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
3
|
+
|
|
4
|
+
$exe=""
|
|
5
|
+
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
6
|
+
# Fix case when both the Windows and Linux builds of Node
|
|
7
|
+
# are installed in the same directory
|
|
8
|
+
$exe=".exe"
|
|
9
|
+
}
|
|
10
|
+
$ret=0
|
|
11
|
+
if (Test-Path "$basedir/node$exe") {
|
|
12
|
+
# Support pipeline input
|
|
13
|
+
if ($MyInvocation.ExpectingInput) {
|
|
14
|
+
$input | & "$basedir/node$exe" "$basedir/../quantumcoin/generate-sdk.js" $args
|
|
15
|
+
} else {
|
|
16
|
+
& "$basedir/node$exe" "$basedir/../quantumcoin/generate-sdk.js" $args
|
|
17
|
+
}
|
|
18
|
+
$ret=$LASTEXITCODE
|
|
19
|
+
} else {
|
|
20
|
+
# Support pipeline input
|
|
21
|
+
if ($MyInvocation.ExpectingInput) {
|
|
22
|
+
$input | & "node$exe" "$basedir/../quantumcoin/generate-sdk.js" $args
|
|
23
|
+
} else {
|
|
24
|
+
& "node$exe" "$basedir/../quantumcoin/generate-sdk.js" $args
|
|
25
|
+
}
|
|
26
|
+
$ret=$LASTEXITCODE
|
|
27
|
+
}
|
|
28
|
+
exit $ret
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*|*MINGW*|*MSYS*)
|
|
6
|
+
if command -v cygpath > /dev/null 2>&1; then
|
|
7
|
+
basedir=`cygpath -w "$basedir"`
|
|
8
|
+
fi
|
|
9
|
+
;;
|
|
10
|
+
esac
|
|
11
|
+
|
|
12
|
+
if [ -x "$basedir/node" ]; then
|
|
13
|
+
exec "$basedir/node" "$basedir/../tsx/dist/cli.mjs" "$@"
|
|
14
|
+
else
|
|
15
|
+
exec node "$basedir/../tsx/dist/cli.mjs" "$@"
|
|
16
|
+
fi
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@ECHO off
|
|
2
|
+
GOTO start
|
|
3
|
+
:find_dp0
|
|
4
|
+
SET dp0=%~dp0
|
|
5
|
+
EXIT /b
|
|
6
|
+
:start
|
|
7
|
+
SETLOCAL
|
|
8
|
+
CALL :find_dp0
|
|
9
|
+
|
|
10
|
+
IF EXIST "%dp0%\node.exe" (
|
|
11
|
+
SET "_prog=%dp0%\node.exe"
|
|
12
|
+
) ELSE (
|
|
13
|
+
SET "_prog=node"
|
|
14
|
+
SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\tsx\dist\cli.mjs" %*
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env pwsh
|
|
2
|
+
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
|
3
|
+
|
|
4
|
+
$exe=""
|
|
5
|
+
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
|
6
|
+
# Fix case when both the Windows and Linux builds of Node
|
|
7
|
+
# are installed in the same directory
|
|
8
|
+
$exe=".exe"
|
|
9
|
+
}
|
|
10
|
+
$ret=0
|
|
11
|
+
if (Test-Path "$basedir/node$exe") {
|
|
12
|
+
# Support pipeline input
|
|
13
|
+
if ($MyInvocation.ExpectingInput) {
|
|
14
|
+
$input | & "$basedir/node$exe" "$basedir/../tsx/dist/cli.mjs" $args
|
|
15
|
+
} else {
|
|
16
|
+
& "$basedir/node$exe" "$basedir/../tsx/dist/cli.mjs" $args
|
|
17
|
+
}
|
|
18
|
+
$ret=$LASTEXITCODE
|
|
19
|
+
} else {
|
|
20
|
+
# Support pipeline input
|
|
21
|
+
if ($MyInvocation.ExpectingInput) {
|
|
22
|
+
$input | & "node$exe" "$basedir/../tsx/dist/cli.mjs" $args
|
|
23
|
+
} else {
|
|
24
|
+
& "node$exe" "$basedir/../tsx/dist/cli.mjs" $args
|
|
25
|
+
}
|
|
26
|
+
$ret=$LASTEXITCODE
|
|
27
|
+
}
|
|
28
|
+
exit $ret
|