@btc-vision/bitcoin 7.0.0-alpha.0 → 7.0.0-alpha.10
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 +455 -155
- package/browser/address.d.ts +6 -2
- package/browser/address.d.ts.map +1 -1
- package/browser/block.d.ts.map +1 -1
- package/browser/branded.d.ts +3 -14
- package/browser/branded.d.ts.map +1 -1
- package/browser/chunks/psbt-parallel-BBFlkmiv.js +10717 -0
- package/browser/crypto.d.ts +1 -1
- package/browser/ecc/context.d.ts +25 -24
- package/browser/ecc/context.d.ts.map +1 -1
- package/browser/ecc/index.d.ts +1 -1
- package/browser/ecc/index.d.ts.map +1 -1
- package/browser/ecc/types.d.ts +10 -123
- package/browser/ecc/types.d.ts.map +1 -1
- package/browser/env.d.ts +13 -0
- package/browser/env.d.ts.map +1 -0
- package/browser/index.d.ts +7 -7
- package/browser/index.d.ts.map +1 -1
- package/browser/index.js +2497 -11686
- package/browser/io/BinaryReader.d.ts +15 -15
- package/browser/io/BinaryReader.d.ts.map +1 -1
- package/browser/io/BinaryWriter.d.ts +17 -17
- package/browser/io/BinaryWriter.d.ts.map +1 -1
- package/browser/io/hex.d.ts.map +1 -1
- package/browser/io/index.d.ts +0 -1
- package/browser/io/index.d.ts.map +1 -1
- package/browser/opcodes.d.ts +11 -0
- package/browser/opcodes.d.ts.map +1 -1
- package/browser/payments/bip341.d.ts +1 -1
- package/browser/payments/bip341.d.ts.map +1 -1
- package/browser/payments/embed.d.ts +1 -1
- package/browser/payments/embed.d.ts.map +1 -1
- package/browser/payments/p2ms.d.ts.map +1 -1
- package/browser/payments/p2op.d.ts +1 -1
- package/browser/payments/p2op.d.ts.map +1 -1
- package/browser/payments/p2pk.d.ts +1 -1
- package/browser/payments/p2pk.d.ts.map +1 -1
- package/browser/payments/p2pkh.d.ts +1 -1
- package/browser/payments/p2pkh.d.ts.map +1 -1
- package/browser/payments/p2sh.d.ts.map +1 -1
- package/browser/payments/p2tr.d.ts +2 -2
- package/browser/payments/p2tr.d.ts.map +1 -1
- package/browser/payments/p2wpkh.d.ts +1 -1
- package/browser/payments/p2wpkh.d.ts.map +1 -1
- package/browser/payments/p2wsh.d.ts.map +1 -1
- package/browser/payments/types.d.ts +1 -1
- package/browser/payments/types.d.ts.map +1 -1
- package/browser/psbt/PsbtCache.d.ts +54 -0
- package/browser/psbt/PsbtCache.d.ts.map +1 -0
- package/browser/psbt/PsbtFinalizer.d.ts +21 -0
- package/browser/psbt/PsbtFinalizer.d.ts.map +1 -0
- package/browser/psbt/PsbtSigner.d.ts +32 -0
- package/browser/psbt/PsbtSigner.d.ts.map +1 -0
- package/browser/psbt/PsbtTransaction.d.ts +25 -0
- package/browser/psbt/PsbtTransaction.d.ts.map +1 -0
- package/browser/psbt/bip371.d.ts.map +1 -1
- package/browser/psbt/types.d.ts +5 -71
- package/browser/psbt/types.d.ts.map +1 -1
- package/browser/psbt/validation.d.ts +1 -1
- package/browser/psbt/validation.d.ts.map +1 -1
- package/browser/psbt.d.ts +26 -40
- package/browser/psbt.d.ts.map +1 -1
- package/browser/script.d.ts.map +1 -1
- package/browser/transaction.d.ts +4 -4
- package/browser/transaction.d.ts.map +1 -1
- package/browser/types.d.ts +5 -3
- package/browser/types.d.ts.map +1 -1
- package/browser/workers/WorkerSigningPool.d.ts +24 -17
- package/browser/workers/WorkerSigningPool.d.ts.map +1 -1
- package/browser/workers/WorkerSigningPool.node.d.ts +19 -12
- package/browser/workers/WorkerSigningPool.node.d.ts.map +1 -1
- package/browser/workers/WorkerSigningPool.sequential.d.ts +67 -0
- package/browser/workers/WorkerSigningPool.sequential.d.ts.map +1 -0
- package/browser/workers/WorkerSigningPool.worklet.d.ts +64 -0
- package/browser/workers/WorkerSigningPool.worklet.d.ts.map +1 -0
- package/browser/workers/index.browser.d.ts +16 -0
- package/browser/workers/index.browser.d.ts.map +1 -0
- package/browser/workers/index.d.ts +4 -64
- package/browser/workers/index.d.ts.map +1 -1
- package/browser/workers/index.js +28 -0
- package/browser/workers/index.node.d.ts +17 -0
- package/browser/workers/index.node.d.ts.map +1 -0
- package/browser/workers/index.react-native.d.ts +28 -0
- package/browser/workers/index.react-native.d.ts.map +1 -0
- package/browser/workers/index.shared.d.ts +15 -0
- package/browser/workers/index.shared.d.ts.map +1 -0
- package/browser/workers/psbt-parallel.d.ts +2 -3
- package/browser/workers/psbt-parallel.d.ts.map +1 -1
- package/browser/workers/types.d.ts +17 -0
- package/browser/workers/types.d.ts.map +1 -1
- package/build/address.d.ts +6 -2
- package/build/address.d.ts.map +1 -1
- package/build/address.js +32 -19
- package/build/address.js.map +1 -1
- package/build/bech32utils.js.map +1 -1
- package/build/block.d.ts.map +1 -1
- package/build/block.js +2 -4
- package/build/block.js.map +1 -1
- package/build/branded.d.ts +3 -14
- package/build/branded.d.ts.map +1 -1
- package/build/branded.js +0 -5
- package/build/branded.js.map +1 -1
- package/build/crypto.d.ts +1 -1
- package/build/ecc/context.d.ts +25 -24
- package/build/ecc/context.d.ts.map +1 -1
- package/build/ecc/context.js +29 -101
- package/build/ecc/context.js.map +1 -1
- package/build/ecc/index.d.ts +1 -1
- package/build/ecc/index.d.ts.map +1 -1
- package/build/ecc/types.d.ts +7 -126
- package/build/ecc/types.d.ts.map +1 -1
- package/build/ecc/types.js +4 -1
- package/build/ecc/types.js.map +1 -1
- package/build/env.d.ts +13 -0
- package/build/env.d.ts.map +1 -0
- package/build/env.js +198 -0
- package/build/env.js.map +1 -0
- package/build/index.d.ts +8 -7
- package/build/index.d.ts.map +1 -1
- package/build/index.js +9 -7
- package/build/index.js.map +1 -1
- package/build/io/BinaryReader.d.ts +15 -15
- package/build/io/BinaryReader.d.ts.map +1 -1
- package/build/io/BinaryReader.js +17 -17
- package/build/io/BinaryReader.js.map +1 -1
- package/build/io/BinaryWriter.d.ts +17 -17
- package/build/io/BinaryWriter.d.ts.map +1 -1
- package/build/io/BinaryWriter.js +39 -39
- package/build/io/BinaryWriter.js.map +1 -1
- package/build/io/hex.d.ts.map +1 -1
- package/build/io/hex.js +2 -1
- package/build/io/hex.js.map +1 -1
- package/build/io/index.d.ts +0 -1
- package/build/io/index.d.ts.map +1 -1
- package/build/io/index.js +0 -2
- package/build/io/index.js.map +1 -1
- package/build/opcodes.d.ts +11 -0
- package/build/opcodes.d.ts.map +1 -1
- package/build/opcodes.js +19 -4
- package/build/opcodes.js.map +1 -1
- package/build/payments/bip341.d.ts +1 -2
- package/build/payments/bip341.d.ts.map +1 -1
- package/build/payments/bip341.js +1 -2
- package/build/payments/bip341.js.map +1 -1
- package/build/payments/embed.d.ts +1 -1
- package/build/payments/embed.d.ts.map +1 -1
- package/build/payments/embed.js +14 -14
- package/build/payments/embed.js.map +1 -1
- package/build/payments/p2ms.d.ts.map +1 -1
- package/build/payments/p2ms.js +21 -21
- package/build/payments/p2ms.js.map +1 -1
- package/build/payments/p2op.d.ts +1 -1
- package/build/payments/p2op.d.ts.map +1 -1
- package/build/payments/p2op.js +18 -18
- package/build/payments/p2op.js.map +1 -1
- package/build/payments/p2pk.d.ts +1 -1
- package/build/payments/p2pk.d.ts.map +1 -1
- package/build/payments/p2pk.js +17 -17
- package/build/payments/p2pk.js.map +1 -1
- package/build/payments/p2pkh.d.ts +1 -1
- package/build/payments/p2pkh.d.ts.map +1 -1
- package/build/payments/p2pkh.js +20 -20
- package/build/payments/p2pkh.js.map +1 -1
- package/build/payments/p2sh.d.ts.map +1 -1
- package/build/payments/p2sh.js +22 -20
- package/build/payments/p2sh.js.map +1 -1
- package/build/payments/p2tr.d.ts +2 -2
- package/build/payments/p2tr.d.ts.map +1 -1
- package/build/payments/p2tr.js +25 -26
- package/build/payments/p2tr.js.map +1 -1
- package/build/payments/p2wpkh.d.ts +1 -1
- package/build/payments/p2wpkh.d.ts.map +1 -1
- package/build/payments/p2wpkh.js +20 -20
- package/build/payments/p2wpkh.js.map +1 -1
- package/build/payments/p2wsh.d.ts.map +1 -1
- package/build/payments/p2wsh.js +22 -22
- package/build/payments/p2wsh.js.map +1 -1
- package/build/payments/types.d.ts +1 -1
- package/build/payments/types.d.ts.map +1 -1
- package/build/psbt/PsbtCache.d.ts +54 -0
- package/build/psbt/PsbtCache.d.ts.map +1 -0
- package/build/psbt/PsbtCache.js +249 -0
- package/build/psbt/PsbtCache.js.map +1 -0
- package/build/psbt/PsbtFinalizer.d.ts +21 -0
- package/build/psbt/PsbtFinalizer.d.ts.map +1 -0
- package/build/psbt/PsbtFinalizer.js +157 -0
- package/build/psbt/PsbtFinalizer.js.map +1 -0
- package/build/psbt/PsbtSigner.d.ts +32 -0
- package/build/psbt/PsbtSigner.d.ts.map +1 -0
- package/build/psbt/PsbtSigner.js +192 -0
- package/build/psbt/PsbtSigner.js.map +1 -0
- package/build/psbt/PsbtTransaction.d.ts +25 -0
- package/build/psbt/PsbtTransaction.d.ts.map +1 -0
- package/build/psbt/PsbtTransaction.js +61 -0
- package/build/psbt/PsbtTransaction.js.map +1 -0
- package/build/psbt/bip371.d.ts.map +1 -1
- package/build/psbt/bip371.js +6 -2
- package/build/psbt/bip371.js.map +1 -1
- package/build/psbt/psbtutils.js +1 -1
- package/build/psbt/psbtutils.js.map +1 -1
- package/build/psbt/types.d.ts +5 -71
- package/build/psbt/types.d.ts.map +1 -1
- package/build/psbt/validation.d.ts +1 -1
- package/build/psbt/validation.d.ts.map +1 -1
- package/build/psbt/validation.js +1 -1
- package/build/psbt/validation.js.map +1 -1
- package/build/psbt.d.ts +26 -40
- package/build/psbt.d.ts.map +1 -1
- package/build/psbt.js +180 -808
- package/build/psbt.js.map +1 -1
- package/build/script.d.ts.map +1 -1
- package/build/script.js +4 -4
- package/build/script.js.map +1 -1
- package/build/transaction.d.ts +4 -4
- package/build/transaction.d.ts.map +1 -1
- package/build/transaction.js +6 -5
- package/build/transaction.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/build/types.d.ts +5 -3
- package/build/types.d.ts.map +1 -1
- package/build/types.js +14 -25
- package/build/types.js.map +1 -1
- package/build/workers/WorkerSigningPool.d.ts +24 -17
- package/build/workers/WorkerSigningPool.d.ts.map +1 -1
- package/build/workers/WorkerSigningPool.js +36 -25
- package/build/workers/WorkerSigningPool.js.map +1 -1
- package/build/workers/WorkerSigningPool.node.d.ts +19 -12
- package/build/workers/WorkerSigningPool.node.d.ts.map +1 -1
- package/build/workers/WorkerSigningPool.node.js +60 -28
- package/build/workers/WorkerSigningPool.node.js.map +1 -1
- package/build/workers/WorkerSigningPool.sequential.d.ts +76 -0
- package/build/workers/WorkerSigningPool.sequential.d.ts.map +1 -0
- package/build/workers/WorkerSigningPool.sequential.js +160 -0
- package/build/workers/WorkerSigningPool.sequential.js.map +1 -0
- package/build/workers/WorkerSigningPool.worklet.d.ts +79 -0
- package/build/workers/WorkerSigningPool.worklet.d.ts.map +1 -0
- package/build/workers/WorkerSigningPool.worklet.js +390 -0
- package/build/workers/WorkerSigningPool.worklet.js.map +1 -0
- package/build/workers/index.browser.d.ts +24 -0
- package/build/workers/index.browser.d.ts.map +1 -0
- package/build/workers/index.browser.js +30 -0
- package/build/workers/index.browser.js.map +1 -0
- package/build/workers/index.d.ts +6 -18
- package/build/workers/index.d.ts.map +1 -1
- package/build/workers/index.js +12 -14
- package/build/workers/index.js.map +1 -1
- package/build/workers/index.node.d.ts +38 -0
- package/build/workers/index.node.d.ts.map +1 -0
- package/build/workers/index.node.js +45 -0
- package/build/workers/index.node.js.map +1 -0
- package/build/workers/index.react-native.d.ts +28 -0
- package/build/workers/index.react-native.d.ts.map +1 -0
- package/build/workers/index.react-native.js +67 -0
- package/build/workers/index.react-native.js.map +1 -0
- package/build/workers/index.shared.d.ts +15 -0
- package/build/workers/index.shared.d.ts.map +1 -0
- package/build/workers/index.shared.js +20 -0
- package/build/workers/index.shared.js.map +1 -0
- package/build/workers/psbt-parallel.d.ts +2 -3
- package/build/workers/psbt-parallel.d.ts.map +1 -1
- package/build/workers/psbt-parallel.js +4 -4
- package/build/workers/psbt-parallel.js.map +1 -1
- package/build/workers/types.d.ts +17 -0
- package/build/workers/types.d.ts.map +1 -1
- package/build/workers/types.js.map +1 -1
- package/package.json +48 -9
- package/src/address.ts +53 -21
- package/src/bech32utils.ts +3 -3
- package/src/block.ts +17 -10
- package/src/branded.ts +15 -13
- package/src/crypto.ts +1 -1
- package/src/ecc/context.ts +36 -136
- package/src/ecc/index.ts +2 -2
- package/src/ecc/types.ts +7 -145
- package/src/env.ts +239 -0
- package/src/index.ts +57 -22
- package/src/io/BinaryReader.ts +18 -18
- package/src/io/BinaryWriter.ts +43 -43
- package/src/io/hex.ts +2 -1
- package/src/io/index.ts +0 -3
- package/src/opcodes.ts +21 -4
- package/src/payments/bip341.ts +5 -7
- package/src/payments/embed.ts +19 -19
- package/src/payments/p2ms.ts +34 -27
- package/src/payments/p2op.ts +22 -22
- package/src/payments/p2pk.ts +22 -22
- package/src/payments/p2pkh.ts +28 -28
- package/src/payments/p2sh.ts +33 -30
- package/src/payments/p2tr.ts +40 -40
- package/src/payments/p2wpkh.ts +30 -30
- package/src/payments/p2wsh.ts +29 -29
- package/src/payments/types.ts +1 -1
- package/src/psbt/PsbtCache.ts +325 -0
- package/src/psbt/PsbtFinalizer.ts +213 -0
- package/src/psbt/PsbtSigner.ts +302 -0
- package/src/psbt/PsbtTransaction.ts +82 -0
- package/src/psbt/bip371.ts +7 -3
- package/src/psbt/psbtutils.ts +1 -1
- package/src/psbt/types.ts +5 -94
- package/src/psbt/validation.ts +5 -12
- package/src/psbt.ts +376 -1201
- package/src/script.ts +6 -9
- package/src/transaction.ts +19 -15
- package/src/types.ts +33 -45
- package/src/workers/WorkerSigningPool.node.ts +72 -36
- package/src/workers/WorkerSigningPool.sequential.ts +191 -0
- package/src/workers/WorkerSigningPool.ts +48 -39
- package/src/workers/WorkerSigningPool.worklet.ts +522 -0
- package/src/workers/index.browser.ts +34 -0
- package/src/workers/index.node.ts +50 -0
- package/src/workers/index.react-native.ts +110 -0
- package/src/workers/index.shared.ts +58 -0
- package/src/workers/index.ts +14 -65
- package/src/workers/psbt-parallel.ts +8 -13
- package/src/workers/types.ts +26 -1
- package/test/address.spec.ts +2 -2
- package/test/bitcoin.core.spec.ts +5 -2
- package/test/browser/payments.spec.ts +151 -0
- package/test/browser/psbt.spec.ts +1510 -0
- package/test/browser/script.spec.ts +223 -0
- package/test/browser/setup.ts +13 -0
- package/test/browser/workers-signing.spec.ts +537 -0
- package/test/crypto.spec.ts +2 -2
- package/test/env.spec.ts +418 -0
- package/test/fixtures/core/base58_encode_decode.json +12 -48
- package/test/fixtures/core/base58_keys_invalid.json +50 -150
- package/test/fixtures/core/sighash.json +1 -3
- package/test/fixtures/core/tx_valid.json +133 -501
- package/test/fixtures/embed.json +3 -11
- package/test/fixtures/p2ms.json +21 -91
- package/test/fixtures/p2pk.json +5 -24
- package/test/fixtures/p2pkh.json +7 -36
- package/test/fixtures/p2sh.json +8 -54
- package/test/fixtures/p2tr.json +2 -6
- package/test/fixtures/p2wpkh.json +7 -36
- package/test/fixtures/p2wsh.json +14 -59
- package/test/fixtures/psbt.json +2 -6
- package/test/fixtures/script.json +12 -48
- package/test/integration/addresses.spec.ts +11 -5
- package/test/integration/bip32.spec.ts +1 -1
- package/test/integration/cltv.spec.ts +10 -6
- package/test/integration/csv.spec.ts +10 -9
- package/test/integration/payments.spec.ts +8 -4
- package/test/integration/taproot.spec.ts +26 -6
- package/test/integration/transactions.spec.ts +22 -8
- package/test/payments.spec.ts +1 -1
- package/test/payments.utils.ts +1 -1
- package/test/psbt.spec.ts +250 -64
- package/test/script_signature.spec.ts +1 -1
- package/test/transaction.spec.ts +18 -5
- package/test/tsconfig.json +6 -20
- package/test/workers-pool.spec.ts +65 -23
- package/test/workers-sequential.spec.ts +669 -0
- package/test/workers-signing.spec.ts +7 -3
- package/test/workers-worklet.spec.ts +500 -0
- package/test/workers.spec.ts +6 -7
- package/typedoc.json +39 -0
- package/vite.config.browser.ts +31 -6
- package/vitest.config.browser.ts +68 -0
- package/browser/ecpair.d.ts +0 -99
- package/browser/io/MemoryPool.d.ts +0 -220
- package/browser/io/MemoryPool.d.ts.map +0 -1
- package/build/io/MemoryPool.d.ts +0 -220
- package/build/io/MemoryPool.d.ts.map +0 -1
- package/build/io/MemoryPool.js +0 -309
- package/build/io/MemoryPool.js.map +0 -1
- package/src/ecpair.d.ts +0 -99
- package/src/io/MemoryPool.ts +0 -343
- package/test/taproot-cache.spec.ts +0 -694
package/browser/ecpair.d.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ambient module declaration for ecpair.
|
|
3
|
-
*
|
|
4
|
-
* The upstream ecpair@3 .d.ts files depend on valibot@^0.37 type-level APIs.
|
|
5
|
-
* When a different valibot major is hoisted (e.g. v1.x required by bip32),
|
|
6
|
-
* @typescript-eslint resolves valibot from the project root instead of
|
|
7
|
-
* ecpair's nested node_modules, turning every ecpair type into an error type.
|
|
8
|
-
*
|
|
9
|
-
* This local declaration re-exports the subset of ecpair's public API that
|
|
10
|
-
* this project actually uses, without any valibot dependency.
|
|
11
|
-
*/
|
|
12
|
-
declare module 'ecpair' {
|
|
13
|
-
interface Network {
|
|
14
|
-
messagePrefix: string | Uint8Array;
|
|
15
|
-
bech32: string;
|
|
16
|
-
bip32: {
|
|
17
|
-
public: number;
|
|
18
|
-
private: number;
|
|
19
|
-
};
|
|
20
|
-
pubKeyHash: number;
|
|
21
|
-
scriptHash: number;
|
|
22
|
-
wif: number;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface Signer {
|
|
26
|
-
publicKey: Uint8Array;
|
|
27
|
-
network?: unknown;
|
|
28
|
-
sign(hash: Uint8Array, lowR?: boolean): Uint8Array;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface SignerAsync {
|
|
32
|
-
publicKey: Uint8Array;
|
|
33
|
-
network?: unknown;
|
|
34
|
-
sign(hash: Uint8Array, lowR?: boolean): Promise<Uint8Array>;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface ECPairInterface extends Signer {
|
|
38
|
-
compressed: boolean;
|
|
39
|
-
network: Network;
|
|
40
|
-
lowR: boolean;
|
|
41
|
-
privateKey?: Uint8Array;
|
|
42
|
-
toWIF(): string;
|
|
43
|
-
tweak(t: Uint8Array): ECPairInterface;
|
|
44
|
-
verify(hash: Uint8Array, signature: Uint8Array): boolean;
|
|
45
|
-
verifySchnorr(hash: Uint8Array, signature: Uint8Array): boolean;
|
|
46
|
-
signSchnorr(hash: Uint8Array): Uint8Array;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
interface ECPairOptions {
|
|
50
|
-
compressed?: boolean;
|
|
51
|
-
network?: Network;
|
|
52
|
-
rng?: (arg?: number) => Uint8Array;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
interface ECPairAPI {
|
|
56
|
-
isPoint(maybePoint: unknown): boolean;
|
|
57
|
-
fromPrivateKey(buffer: Uint8Array, options?: ECPairOptions): ECPairInterface;
|
|
58
|
-
fromPublicKey(buffer: Uint8Array, options?: ECPairOptions): ECPairInterface;
|
|
59
|
-
fromWIF(wifString: string, network?: Network | Network[]): ECPairInterface;
|
|
60
|
-
makeRandom(options?: ECPairOptions): ECPairInterface;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
interface TinySecp256k1Interface {
|
|
64
|
-
isPoint(p: Uint8Array): boolean;
|
|
65
|
-
pointCompress(p: Uint8Array, compressed?: boolean): Uint8Array;
|
|
66
|
-
isPrivate(d: Uint8Array): boolean;
|
|
67
|
-
pointFromScalar(d: Uint8Array, compressed?: boolean): Uint8Array | null;
|
|
68
|
-
xOnlyPointAddTweak(
|
|
69
|
-
p: Uint8Array,
|
|
70
|
-
tweak: Uint8Array,
|
|
71
|
-
): { parity: 1 | 0; xOnlyPubkey: Uint8Array } | null;
|
|
72
|
-
privateAdd(d: Uint8Array, tweak: Uint8Array): Uint8Array | null;
|
|
73
|
-
privateNegate(d: Uint8Array): Uint8Array;
|
|
74
|
-
sign(h: Uint8Array, d: Uint8Array, e?: Uint8Array): Uint8Array;
|
|
75
|
-
signSchnorr?(h: Uint8Array, d: Uint8Array, e?: Uint8Array): Uint8Array;
|
|
76
|
-
verify(h: Uint8Array, Q: Uint8Array, signature: Uint8Array, strict?: boolean): boolean;
|
|
77
|
-
verifySchnorr?(h: Uint8Array, Q: Uint8Array, signature: Uint8Array): boolean;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const networks: {
|
|
81
|
-
bitcoin: Network;
|
|
82
|
-
testnet: Network;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
function ECPairFactory(ecc: TinySecp256k1Interface): ECPairAPI;
|
|
86
|
-
export default ECPairFactory;
|
|
87
|
-
|
|
88
|
-
export {
|
|
89
|
-
ECPairFactory,
|
|
90
|
-
Signer,
|
|
91
|
-
SignerAsync,
|
|
92
|
-
ECPairAPI,
|
|
93
|
-
ECPairInterface,
|
|
94
|
-
ECPairOptions,
|
|
95
|
-
TinySecp256k1Interface,
|
|
96
|
-
Network,
|
|
97
|
-
networks,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory pool using SharedArrayBuffer for zero-allocation operations.
|
|
3
|
-
*
|
|
4
|
-
* Provides thread-safe memory allocation using Atomics for concurrent access.
|
|
5
|
-
* Ideal for parsing operations where temporary buffers are needed.
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Thread-safe memory pool using SharedArrayBuffer.
|
|
11
|
-
*
|
|
12
|
-
* Allocates memory from a pre-allocated SharedArrayBuffer pool,
|
|
13
|
-
* eliminating garbage collection pressure from repeated allocations.
|
|
14
|
-
*
|
|
15
|
-
* Uses Atomics for thread-safe allocation when used with Workers.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* import { MemoryPool } from '@btc-vision/bitcoin';
|
|
20
|
-
*
|
|
21
|
-
* // Create a 1MB pool
|
|
22
|
-
* const pool = new MemoryPool(1024 * 1024);
|
|
23
|
-
*
|
|
24
|
-
* // Allocate memory for transaction parsing
|
|
25
|
-
* const txBuffer = pool.alloc(500);
|
|
26
|
-
* // ... use txBuffer ...
|
|
27
|
-
*
|
|
28
|
-
* // Reset pool when done (all allocations become invalid)
|
|
29
|
-
* pool.reset();
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare class MemoryPool {
|
|
33
|
-
#private;
|
|
34
|
-
/**
|
|
35
|
-
* Creates a new MemoryPool.
|
|
36
|
-
*
|
|
37
|
-
* @param size - Size of the pool in bytes (default 4MB)
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```typescript
|
|
41
|
-
* import { MemoryPool } from '@btc-vision/bitcoin';
|
|
42
|
-
*
|
|
43
|
-
* // 4MB pool (default)
|
|
44
|
-
* const pool = new MemoryPool();
|
|
45
|
-
*
|
|
46
|
-
* // 16MB pool
|
|
47
|
-
* const largePool = new MemoryPool(16 * 1024 * 1024);
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
constructor(size?: number);
|
|
51
|
-
/**
|
|
52
|
-
* Creates a MemoryPool from an existing SharedArrayBuffer.
|
|
53
|
-
*
|
|
54
|
-
* Useful for sharing a pool between Workers.
|
|
55
|
-
*
|
|
56
|
-
* @param buffer - Existing SharedArrayBuffer
|
|
57
|
-
* @returns A new MemoryPool instance wrapping the buffer
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```typescript
|
|
61
|
-
* // Main thread
|
|
62
|
-
* const pool = new MemoryPool(1024 * 1024);
|
|
63
|
-
* worker.postMessage({ buffer: pool.sharedBuffer });
|
|
64
|
-
*
|
|
65
|
-
* // Worker thread
|
|
66
|
-
* self.onmessage = (e) => {
|
|
67
|
-
* const pool = MemoryPool.fromSharedBuffer(e.data.buffer);
|
|
68
|
-
* const mem = pool.alloc(100);
|
|
69
|
-
* };
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
static fromSharedBuffer(buffer: SharedArrayBuffer): MemoryPool;
|
|
73
|
-
/**
|
|
74
|
-
* Total capacity of the pool in bytes.
|
|
75
|
-
*/
|
|
76
|
-
get capacity(): number;
|
|
77
|
-
/**
|
|
78
|
-
* Current allocation offset (bytes used).
|
|
79
|
-
*
|
|
80
|
-
* Uses Atomics for thread-safe reading.
|
|
81
|
-
*/
|
|
82
|
-
get used(): number;
|
|
83
|
-
/**
|
|
84
|
-
* Remaining available bytes.
|
|
85
|
-
*/
|
|
86
|
-
get available(): number;
|
|
87
|
-
/**
|
|
88
|
-
* The underlying SharedArrayBuffer.
|
|
89
|
-
*
|
|
90
|
-
* Can be transferred to Workers for shared memory access.
|
|
91
|
-
*/
|
|
92
|
-
get sharedBuffer(): SharedArrayBuffer;
|
|
93
|
-
/**
|
|
94
|
-
* Allocates memory from the pool.
|
|
95
|
-
*
|
|
96
|
-
* Thread-safe using Atomics.add for concurrent access.
|
|
97
|
-
*
|
|
98
|
-
* @param size - Number of bytes to allocate
|
|
99
|
-
* @returns Uint8Array view into the pool
|
|
100
|
-
* @throws RangeError if pool is exhausted
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```typescript
|
|
104
|
-
* const pool = new MemoryPool(1024);
|
|
105
|
-
* const buf1 = pool.alloc(100); // First 100 bytes
|
|
106
|
-
* const buf2 = pool.alloc(200); // Next 200 bytes
|
|
107
|
-
* ```
|
|
108
|
-
*/
|
|
109
|
-
alloc(size: number): Uint8Array;
|
|
110
|
-
/**
|
|
111
|
-
* Allocates memory and fills it with zeros.
|
|
112
|
-
*
|
|
113
|
-
* @param size - Number of bytes to allocate
|
|
114
|
-
* @returns Uint8Array view into the pool, filled with zeros
|
|
115
|
-
* @throws RangeError if pool is exhausted
|
|
116
|
-
*/
|
|
117
|
-
allocZeroed(size: number): Uint8Array;
|
|
118
|
-
/**
|
|
119
|
-
* Allocates memory for a specific typed array.
|
|
120
|
-
*
|
|
121
|
-
* @param length - Number of elements
|
|
122
|
-
* @param bytesPerElement - Size of each element in bytes
|
|
123
|
-
* @returns Uint8Array view (use constructor of target type on underlying buffer)
|
|
124
|
-
* @throws RangeError if pool is exhausted
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ```typescript
|
|
128
|
-
* const pool = new MemoryPool(1024);
|
|
129
|
-
* const bytes = pool.allocTyped(10, 4); // 40 bytes for 10 Uint32
|
|
130
|
-
* const u32View = new Uint32Array(bytes.buffer, bytes.byteOffset, 10);
|
|
131
|
-
* ```
|
|
132
|
-
*/
|
|
133
|
-
allocTyped(length: number, bytesPerElement: number): Uint8Array;
|
|
134
|
-
/**
|
|
135
|
-
* Resets the pool, making all memory available again.
|
|
136
|
-
*
|
|
137
|
-
* WARNING: All previously allocated views become invalid.
|
|
138
|
-
* Only call when you're sure no references are held.
|
|
139
|
-
*
|
|
140
|
-
* Thread-safe using Atomics.store.
|
|
141
|
-
*
|
|
142
|
-
* @example
|
|
143
|
-
* ```typescript
|
|
144
|
-
* const pool = new MemoryPool(1024);
|
|
145
|
-
* const buf = pool.alloc(100);
|
|
146
|
-
* // ... use buf ...
|
|
147
|
-
* pool.reset(); // buf is now invalid!
|
|
148
|
-
* ```
|
|
149
|
-
*/
|
|
150
|
-
reset(): void;
|
|
151
|
-
/**
|
|
152
|
-
* Checks if the pool can accommodate an allocation.
|
|
153
|
-
*
|
|
154
|
-
* @param size - Number of bytes needed
|
|
155
|
-
* @returns True if allocation would succeed
|
|
156
|
-
*/
|
|
157
|
-
canAlloc(size: number): boolean;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Non-shared memory pool using regular ArrayBuffer.
|
|
161
|
-
*
|
|
162
|
-
* Use when SharedArrayBuffer is not available (e.g., browsers without
|
|
163
|
-
* proper COOP/COEP headers) or when thread-safety is not needed.
|
|
164
|
-
*
|
|
165
|
-
* @example
|
|
166
|
-
* ```typescript
|
|
167
|
-
* import { SimpleMemoryPool } from '@btc-vision/bitcoin';
|
|
168
|
-
*
|
|
169
|
-
* const pool = new SimpleMemoryPool(1024 * 1024);
|
|
170
|
-
* const buf = pool.alloc(100);
|
|
171
|
-
* ```
|
|
172
|
-
*/
|
|
173
|
-
export declare class SimpleMemoryPool {
|
|
174
|
-
#private;
|
|
175
|
-
/**
|
|
176
|
-
* Creates a new SimpleMemoryPool.
|
|
177
|
-
*
|
|
178
|
-
* @param size - Size of the pool in bytes
|
|
179
|
-
*/
|
|
180
|
-
constructor(size: number);
|
|
181
|
-
/**
|
|
182
|
-
* Total capacity of the pool in bytes.
|
|
183
|
-
*/
|
|
184
|
-
get capacity(): number;
|
|
185
|
-
/**
|
|
186
|
-
* Current allocation offset (bytes used).
|
|
187
|
-
*/
|
|
188
|
-
get used(): number;
|
|
189
|
-
/**
|
|
190
|
-
* Remaining available bytes.
|
|
191
|
-
*/
|
|
192
|
-
get available(): number;
|
|
193
|
-
/**
|
|
194
|
-
* Allocates memory from the pool.
|
|
195
|
-
*
|
|
196
|
-
* @param size - Number of bytes to allocate
|
|
197
|
-
* @returns Uint8Array view into the pool
|
|
198
|
-
* @throws RangeError if pool is exhausted
|
|
199
|
-
*/
|
|
200
|
-
alloc(size: number): Uint8Array;
|
|
201
|
-
/**
|
|
202
|
-
* Allocates memory and fills it with zeros.
|
|
203
|
-
*
|
|
204
|
-
* @param size - Number of bytes to allocate
|
|
205
|
-
* @returns Uint8Array view into the pool, filled with zeros
|
|
206
|
-
*/
|
|
207
|
-
allocZeroed(size: number): Uint8Array;
|
|
208
|
-
/**
|
|
209
|
-
* Resets the pool, making all memory available again.
|
|
210
|
-
*/
|
|
211
|
-
reset(): void;
|
|
212
|
-
/**
|
|
213
|
-
* Checks if the pool can accommodate an allocation.
|
|
214
|
-
*
|
|
215
|
-
* @param size - Number of bytes needed
|
|
216
|
-
* @returns True if allocation would succeed
|
|
217
|
-
*/
|
|
218
|
-
canAlloc(size: number): boolean;
|
|
219
|
-
}
|
|
220
|
-
//# sourceMappingURL=MemoryPool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryPool.d.ts","sourceRoot":"","sources":["../../src/io/MemoryPool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,UAAU;;IAsBnB;;;;;;;;;;;;;;;OAeG;gBACgB,IAAI,GAAE,MAAwB;IASjD;;;;;;;;;;;;;;;;;;;;OAoBG;WACW,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU;IAarE;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED;;;;OAIG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED;;;;OAIG;IACH,IAAW,YAAY,IAAI,iBAAiB,CAE3C;IAED;;;;;;;;;;;;;;;OAeG;IACI,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAmBtC;;;;;;OAMG;IACI,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAM5C;;;;;;;;;;;;;;OAcG;IACI,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,UAAU;IAItE;;;;;;;;;;;;;;;OAeG;IACI,KAAK,IAAI,IAAI;IAIpB;;;;;OAKG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAGzC;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,gBAAgB;;IAIzB;;;;OAIG;gBACgB,IAAI,EAAE,MAAM;IAI/B;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED;;;;;;OAMG;IACI,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAgBtC;;;;;OAKG;IACI,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAM5C;;OAEG;IACI,KAAK,IAAI,IAAI;IAIpB;;;;;OAKG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAGzC"}
|
package/build/io/MemoryPool.d.ts
DELETED
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory pool using SharedArrayBuffer for zero-allocation operations.
|
|
3
|
-
*
|
|
4
|
-
* Provides thread-safe memory allocation using Atomics for concurrent access.
|
|
5
|
-
* Ideal for parsing operations where temporary buffers are needed.
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Thread-safe memory pool using SharedArrayBuffer.
|
|
11
|
-
*
|
|
12
|
-
* Allocates memory from a pre-allocated SharedArrayBuffer pool,
|
|
13
|
-
* eliminating garbage collection pressure from repeated allocations.
|
|
14
|
-
*
|
|
15
|
-
* Uses Atomics for thread-safe allocation when used with Workers.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* import { MemoryPool } from '@btc-vision/bitcoin';
|
|
20
|
-
*
|
|
21
|
-
* // Create a 1MB pool
|
|
22
|
-
* const pool = new MemoryPool(1024 * 1024);
|
|
23
|
-
*
|
|
24
|
-
* // Allocate memory for transaction parsing
|
|
25
|
-
* const txBuffer = pool.alloc(500);
|
|
26
|
-
* // ... use txBuffer ...
|
|
27
|
-
*
|
|
28
|
-
* // Reset pool when done (all allocations become invalid)
|
|
29
|
-
* pool.reset();
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare class MemoryPool {
|
|
33
|
-
#private;
|
|
34
|
-
/**
|
|
35
|
-
* Creates a new MemoryPool.
|
|
36
|
-
*
|
|
37
|
-
* @param size - Size of the pool in bytes (default 4MB)
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```typescript
|
|
41
|
-
* import { MemoryPool } from '@btc-vision/bitcoin';
|
|
42
|
-
*
|
|
43
|
-
* // 4MB pool (default)
|
|
44
|
-
* const pool = new MemoryPool();
|
|
45
|
-
*
|
|
46
|
-
* // 16MB pool
|
|
47
|
-
* const largePool = new MemoryPool(16 * 1024 * 1024);
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
constructor(size?: number);
|
|
51
|
-
/**
|
|
52
|
-
* Creates a MemoryPool from an existing SharedArrayBuffer.
|
|
53
|
-
*
|
|
54
|
-
* Useful for sharing a pool between Workers.
|
|
55
|
-
*
|
|
56
|
-
* @param buffer - Existing SharedArrayBuffer
|
|
57
|
-
* @returns A new MemoryPool instance wrapping the buffer
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```typescript
|
|
61
|
-
* // Main thread
|
|
62
|
-
* const pool = new MemoryPool(1024 * 1024);
|
|
63
|
-
* worker.postMessage({ buffer: pool.sharedBuffer });
|
|
64
|
-
*
|
|
65
|
-
* // Worker thread
|
|
66
|
-
* self.onmessage = (e) => {
|
|
67
|
-
* const pool = MemoryPool.fromSharedBuffer(e.data.buffer);
|
|
68
|
-
* const mem = pool.alloc(100);
|
|
69
|
-
* };
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
static fromSharedBuffer(buffer: SharedArrayBuffer): MemoryPool;
|
|
73
|
-
/**
|
|
74
|
-
* Total capacity of the pool in bytes.
|
|
75
|
-
*/
|
|
76
|
-
get capacity(): number;
|
|
77
|
-
/**
|
|
78
|
-
* Current allocation offset (bytes used).
|
|
79
|
-
*
|
|
80
|
-
* Uses Atomics for thread-safe reading.
|
|
81
|
-
*/
|
|
82
|
-
get used(): number;
|
|
83
|
-
/**
|
|
84
|
-
* Remaining available bytes.
|
|
85
|
-
*/
|
|
86
|
-
get available(): number;
|
|
87
|
-
/**
|
|
88
|
-
* The underlying SharedArrayBuffer.
|
|
89
|
-
*
|
|
90
|
-
* Can be transferred to Workers for shared memory access.
|
|
91
|
-
*/
|
|
92
|
-
get sharedBuffer(): SharedArrayBuffer;
|
|
93
|
-
/**
|
|
94
|
-
* Allocates memory from the pool.
|
|
95
|
-
*
|
|
96
|
-
* Thread-safe using Atomics.add for concurrent access.
|
|
97
|
-
*
|
|
98
|
-
* @param size - Number of bytes to allocate
|
|
99
|
-
* @returns Uint8Array view into the pool
|
|
100
|
-
* @throws RangeError if pool is exhausted
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```typescript
|
|
104
|
-
* const pool = new MemoryPool(1024);
|
|
105
|
-
* const buf1 = pool.alloc(100); // First 100 bytes
|
|
106
|
-
* const buf2 = pool.alloc(200); // Next 200 bytes
|
|
107
|
-
* ```
|
|
108
|
-
*/
|
|
109
|
-
alloc(size: number): Uint8Array;
|
|
110
|
-
/**
|
|
111
|
-
* Allocates memory and fills it with zeros.
|
|
112
|
-
*
|
|
113
|
-
* @param size - Number of bytes to allocate
|
|
114
|
-
* @returns Uint8Array view into the pool, filled with zeros
|
|
115
|
-
* @throws RangeError if pool is exhausted
|
|
116
|
-
*/
|
|
117
|
-
allocZeroed(size: number): Uint8Array;
|
|
118
|
-
/**
|
|
119
|
-
* Allocates memory for a specific typed array.
|
|
120
|
-
*
|
|
121
|
-
* @param length - Number of elements
|
|
122
|
-
* @param bytesPerElement - Size of each element in bytes
|
|
123
|
-
* @returns Uint8Array view (use constructor of target type on underlying buffer)
|
|
124
|
-
* @throws RangeError if pool is exhausted
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ```typescript
|
|
128
|
-
* const pool = new MemoryPool(1024);
|
|
129
|
-
* const bytes = pool.allocTyped(10, 4); // 40 bytes for 10 Uint32
|
|
130
|
-
* const u32View = new Uint32Array(bytes.buffer, bytes.byteOffset, 10);
|
|
131
|
-
* ```
|
|
132
|
-
*/
|
|
133
|
-
allocTyped(length: number, bytesPerElement: number): Uint8Array;
|
|
134
|
-
/**
|
|
135
|
-
* Resets the pool, making all memory available again.
|
|
136
|
-
*
|
|
137
|
-
* WARNING: All previously allocated views become invalid.
|
|
138
|
-
* Only call when you're sure no references are held.
|
|
139
|
-
*
|
|
140
|
-
* Thread-safe using Atomics.store.
|
|
141
|
-
*
|
|
142
|
-
* @example
|
|
143
|
-
* ```typescript
|
|
144
|
-
* const pool = new MemoryPool(1024);
|
|
145
|
-
* const buf = pool.alloc(100);
|
|
146
|
-
* // ... use buf ...
|
|
147
|
-
* pool.reset(); // buf is now invalid!
|
|
148
|
-
* ```
|
|
149
|
-
*/
|
|
150
|
-
reset(): void;
|
|
151
|
-
/**
|
|
152
|
-
* Checks if the pool can accommodate an allocation.
|
|
153
|
-
*
|
|
154
|
-
* @param size - Number of bytes needed
|
|
155
|
-
* @returns True if allocation would succeed
|
|
156
|
-
*/
|
|
157
|
-
canAlloc(size: number): boolean;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Non-shared memory pool using regular ArrayBuffer.
|
|
161
|
-
*
|
|
162
|
-
* Use when SharedArrayBuffer is not available (e.g., browsers without
|
|
163
|
-
* proper COOP/COEP headers) or when thread-safety is not needed.
|
|
164
|
-
*
|
|
165
|
-
* @example
|
|
166
|
-
* ```typescript
|
|
167
|
-
* import { SimpleMemoryPool } from '@btc-vision/bitcoin';
|
|
168
|
-
*
|
|
169
|
-
* const pool = new SimpleMemoryPool(1024 * 1024);
|
|
170
|
-
* const buf = pool.alloc(100);
|
|
171
|
-
* ```
|
|
172
|
-
*/
|
|
173
|
-
export declare class SimpleMemoryPool {
|
|
174
|
-
#private;
|
|
175
|
-
/**
|
|
176
|
-
* Creates a new SimpleMemoryPool.
|
|
177
|
-
*
|
|
178
|
-
* @param size - Size of the pool in bytes
|
|
179
|
-
*/
|
|
180
|
-
constructor(size: number);
|
|
181
|
-
/**
|
|
182
|
-
* Total capacity of the pool in bytes.
|
|
183
|
-
*/
|
|
184
|
-
get capacity(): number;
|
|
185
|
-
/**
|
|
186
|
-
* Current allocation offset (bytes used).
|
|
187
|
-
*/
|
|
188
|
-
get used(): number;
|
|
189
|
-
/**
|
|
190
|
-
* Remaining available bytes.
|
|
191
|
-
*/
|
|
192
|
-
get available(): number;
|
|
193
|
-
/**
|
|
194
|
-
* Allocates memory from the pool.
|
|
195
|
-
*
|
|
196
|
-
* @param size - Number of bytes to allocate
|
|
197
|
-
* @returns Uint8Array view into the pool
|
|
198
|
-
* @throws RangeError if pool is exhausted
|
|
199
|
-
*/
|
|
200
|
-
alloc(size: number): Uint8Array;
|
|
201
|
-
/**
|
|
202
|
-
* Allocates memory and fills it with zeros.
|
|
203
|
-
*
|
|
204
|
-
* @param size - Number of bytes to allocate
|
|
205
|
-
* @returns Uint8Array view into the pool, filled with zeros
|
|
206
|
-
*/
|
|
207
|
-
allocZeroed(size: number): Uint8Array;
|
|
208
|
-
/**
|
|
209
|
-
* Resets the pool, making all memory available again.
|
|
210
|
-
*/
|
|
211
|
-
reset(): void;
|
|
212
|
-
/**
|
|
213
|
-
* Checks if the pool can accommodate an allocation.
|
|
214
|
-
*
|
|
215
|
-
* @param size - Number of bytes needed
|
|
216
|
-
* @returns True if allocation would succeed
|
|
217
|
-
*/
|
|
218
|
-
canAlloc(size: number): boolean;
|
|
219
|
-
}
|
|
220
|
-
//# sourceMappingURL=MemoryPool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryPool.d.ts","sourceRoot":"","sources":["../../src/io/MemoryPool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,UAAU;;IAsBnB;;;;;;;;;;;;;;;OAeG;gBACgB,IAAI,GAAE,MAAwB;IASjD;;;;;;;;;;;;;;;;;;;;OAoBG;WACW,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU;IAarE;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED;;;;OAIG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED;;;;OAIG;IACH,IAAW,YAAY,IAAI,iBAAiB,CAE3C;IAED;;;;;;;;;;;;;;;OAeG;IACI,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAmBtC;;;;;;OAMG;IACI,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAM5C;;;;;;;;;;;;;;OAcG;IACI,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,UAAU;IAItE;;;;;;;;;;;;;;;OAeG;IACI,KAAK,IAAI,IAAI;IAIpB;;;;;OAKG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAGzC;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,gBAAgB;;IAIzB;;;;OAIG;gBACgB,IAAI,EAAE,MAAM;IAI/B;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED;;;;;;OAMG;IACI,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAgBtC;;;;;OAKG;IACI,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAM5C;;OAEG;IACI,KAAK,IAAI,IAAI;IAIpB;;;;;OAKG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAGzC"}
|