@bsv/sdk 1.0.29 → 1.0.32
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/dist/cjs/mod.js +25 -0
- package/dist/cjs/mod.js.map +1 -0
- package/dist/cjs/package.json +49 -0
- package/dist/cjs/src/compat/BSM.js +77 -0
- package/dist/cjs/src/compat/BSM.js.map +1 -0
- package/dist/cjs/src/compat/ECIES.js +512 -0
- package/dist/cjs/src/compat/ECIES.js.map +1 -0
- package/dist/cjs/src/compat/HD.js +344 -0
- package/dist/cjs/src/compat/HD.js.map +1 -0
- package/dist/cjs/src/compat/Mnemonic.js +298 -0
- package/dist/cjs/src/compat/Mnemonic.js.map +1 -0
- package/dist/cjs/src/compat/bip-39-wordlist-en.js +2057 -0
- package/dist/cjs/src/compat/bip-39-wordlist-en.js.map +1 -0
- package/dist/cjs/src/compat/index.js +37 -0
- package/dist/cjs/src/compat/index.js.map +1 -0
- package/dist/cjs/src/messages/EncryptedMessage.js +69 -0
- package/dist/cjs/src/messages/EncryptedMessage.js.map +1 -0
- package/dist/cjs/src/messages/SignedMessage.js +85 -0
- package/dist/cjs/src/messages/SignedMessage.js.map +1 -0
- package/dist/cjs/src/messages/index.js +29 -0
- package/dist/cjs/src/messages/index.js.map +1 -0
- package/dist/cjs/src/primitives/AESGCM.js +384 -0
- package/dist/cjs/src/primitives/AESGCM.js.map +1 -0
- package/dist/cjs/src/primitives/BasePoint.js +19 -0
- package/dist/cjs/src/primitives/BasePoint.js.map +1 -0
- package/dist/cjs/src/primitives/BigNumber.js +4272 -0
- package/dist/cjs/src/primitives/BigNumber.js.map +1 -0
- package/dist/cjs/src/primitives/Curve.js +1126 -0
- package/dist/cjs/src/primitives/Curve.js.map +1 -0
- package/dist/cjs/src/primitives/DRBG.js +99 -0
- package/dist/cjs/src/primitives/DRBG.js.map +1 -0
- package/dist/cjs/src/primitives/ECDSA.js +169 -0
- package/dist/cjs/src/primitives/ECDSA.js.map +1 -0
- package/dist/cjs/src/primitives/Hash.js +1387 -0
- package/dist/cjs/src/primitives/Hash.js.map +1 -0
- package/dist/cjs/src/primitives/JacobianPoint.js +400 -0
- package/dist/cjs/src/primitives/JacobianPoint.js.map +1 -0
- package/dist/cjs/src/primitives/K256.js +111 -0
- package/dist/cjs/src/primitives/K256.js.map +1 -0
- package/dist/cjs/src/primitives/Mersenne.js +118 -0
- package/dist/cjs/src/primitives/Mersenne.js.map +1 -0
- package/dist/cjs/src/primitives/MontgomoryMethod.js +150 -0
- package/dist/cjs/src/primitives/MontgomoryMethod.js.map +1 -0
- package/dist/cjs/src/primitives/Point.js +819 -0
- package/dist/cjs/src/primitives/Point.js.map +1 -0
- package/dist/cjs/src/primitives/PrivateKey.js +246 -0
- package/dist/cjs/src/primitives/PrivateKey.js.map +1 -0
- package/dist/cjs/src/primitives/PublicKey.js +168 -0
- package/dist/cjs/src/primitives/PublicKey.js.map +1 -0
- package/dist/cjs/src/primitives/Random.js +57 -0
- package/dist/cjs/src/primitives/Random.js.map +1 -0
- package/dist/cjs/src/primitives/ReductionContext.js +490 -0
- package/dist/cjs/src/primitives/ReductionContext.js.map +1 -0
- package/dist/cjs/src/primitives/Signature.js +357 -0
- package/dist/cjs/src/primitives/Signature.js.map +1 -0
- package/dist/cjs/src/primitives/SymmetricKey.js +82 -0
- package/dist/cjs/src/primitives/SymmetricKey.js.map +1 -0
- package/dist/cjs/src/primitives/TransactionSignature.js +172 -0
- package/dist/cjs/src/primitives/TransactionSignature.js.map +1 -0
- package/dist/cjs/src/primitives/index.js +51 -0
- package/dist/cjs/src/primitives/index.js.map +1 -0
- package/dist/cjs/src/primitives/utils.js +624 -0
- package/dist/cjs/src/primitives/utils.js.map +1 -0
- package/dist/cjs/src/script/LockingScript.js +35 -0
- package/dist/cjs/src/script/LockingScript.js.map +1 -0
- package/dist/cjs/src/script/OP.js +207 -0
- package/dist/cjs/src/script/OP.js.map +1 -0
- package/dist/cjs/src/script/Script.js +435 -0
- package/dist/cjs/src/script/Script.js.map +1 -0
- package/dist/cjs/src/script/ScriptChunk.js +3 -0
- package/dist/cjs/src/script/ScriptChunk.js.map +1 -0
- package/dist/cjs/src/script/ScriptTemplate.js +3 -0
- package/dist/cjs/src/script/ScriptTemplate.js.map +1 -0
- package/dist/cjs/src/script/Spend.js +1252 -0
- package/dist/cjs/src/script/Spend.js.map +1 -0
- package/dist/cjs/src/script/UnlockingScript.js +35 -0
- package/dist/cjs/src/script/UnlockingScript.js.map +1 -0
- package/dist/cjs/src/script/index.js +32 -0
- package/dist/cjs/src/script/index.js.map +1 -0
- package/dist/cjs/src/script/templates/P2PKH.js +120 -0
- package/dist/cjs/src/script/templates/P2PKH.js.map +1 -0
- package/dist/cjs/src/script/templates/RPuzzle.js +125 -0
- package/dist/cjs/src/script/templates/RPuzzle.js.map +1 -0
- package/dist/cjs/src/script/templates/index.js +11 -0
- package/dist/cjs/src/script/templates/index.js.map +1 -0
- package/dist/cjs/src/transaction/Broadcaster.js +3 -0
- package/dist/cjs/src/transaction/Broadcaster.js.map +1 -0
- package/dist/cjs/src/transaction/ChainTracker.js +3 -0
- package/dist/cjs/src/transaction/ChainTracker.js.map +1 -0
- package/dist/cjs/src/transaction/FeeModel.js +3 -0
- package/dist/cjs/src/transaction/FeeModel.js.map +1 -0
- package/dist/cjs/src/transaction/MerklePath.js +239 -0
- package/dist/cjs/src/transaction/MerklePath.js.map +1 -0
- package/dist/cjs/src/transaction/Transaction.js +616 -0
- package/dist/cjs/src/transaction/Transaction.js.map +1 -0
- package/dist/cjs/src/transaction/TransactionInput.js +3 -0
- package/dist/cjs/src/transaction/TransactionInput.js.map +1 -0
- package/dist/cjs/src/transaction/TransactionOutput.js +3 -0
- package/dist/cjs/src/transaction/TransactionOutput.js.map +1 -0
- package/dist/cjs/src/transaction/broadcasters/ARC.js +112 -0
- package/dist/cjs/src/transaction/broadcasters/ARC.js.map +1 -0
- package/dist/cjs/src/transaction/broadcasters/index.js +9 -0
- package/dist/cjs/src/transaction/broadcasters/index.js.map +1 -0
- package/dist/cjs/src/transaction/fee-models/SatoshisPerKilobyte.js +69 -0
- package/dist/cjs/src/transaction/fee-models/SatoshisPerKilobyte.js.map +1 -0
- package/dist/cjs/src/transaction/fee-models/index.js +9 -0
- package/dist/cjs/src/transaction/fee-models/index.js.map +1 -0
- package/dist/cjs/src/transaction/index.js +11 -0
- package/dist/cjs/src/transaction/index.js.map +1 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/esm/mod.js +9 -0
- package/dist/esm/mod.js.map +1 -0
- package/dist/esm/src/compat/BSM.js +45 -0
- package/dist/esm/src/compat/BSM.js.map +1 -0
- package/dist/esm/src/compat/ECIES.js +483 -0
- package/dist/esm/src/compat/ECIES.js.map +1 -0
- package/dist/esm/src/compat/HD.js +322 -0
- package/dist/esm/src/compat/HD.js.map +1 -0
- package/dist/esm/src/compat/Mnemonic.js +272 -0
- package/dist/esm/src/compat/Mnemonic.js.map +1 -0
- package/dist/esm/src/compat/bip-39-wordlist-en.js +2054 -0
- package/dist/esm/src/compat/bip-39-wordlist-en.js.map +1 -0
- package/dist/esm/src/compat/index.js +5 -0
- package/dist/esm/src/compat/index.js.map +1 -0
- package/dist/esm/src/messages/EncryptedMessage.js +61 -0
- package/dist/esm/src/messages/EncryptedMessage.js.map +1 -0
- package/dist/esm/src/messages/SignedMessage.js +77 -0
- package/dist/esm/src/messages/SignedMessage.js.map +1 -0
- package/dist/esm/src/messages/index.js +3 -0
- package/dist/esm/src/messages/index.js.map +1 -0
- package/dist/esm/src/primitives/AESGCM.js +371 -0
- package/dist/esm/src/primitives/AESGCM.js.map +1 -0
- package/dist/esm/src/primitives/BasePoint.js +16 -0
- package/dist/esm/src/primitives/BasePoint.js.map +1 -0
- package/dist/esm/src/primitives/BigNumber.js +4307 -0
- package/dist/esm/src/primitives/BigNumber.js.map +1 -0
- package/dist/esm/src/primitives/Curve.js +1141 -0
- package/dist/esm/src/primitives/Curve.js.map +1 -0
- package/dist/esm/src/primitives/DRBG.js +98 -0
- package/dist/esm/src/primitives/DRBG.js.map +1 -0
- package/dist/esm/src/primitives/ECDSA.js +161 -0
- package/dist/esm/src/primitives/ECDSA.js.map +1 -0
- package/dist/esm/src/primitives/Hash.js +1391 -0
- package/dist/esm/src/primitives/Hash.js.map +1 -0
- package/dist/esm/src/primitives/JacobianPoint.js +398 -0
- package/dist/esm/src/primitives/JacobianPoint.js.map +1 -0
- package/dist/esm/src/primitives/K256.js +105 -0
- package/dist/esm/src/primitives/K256.js.map +1 -0
- package/dist/esm/src/primitives/Mersenne.js +117 -0
- package/dist/esm/src/primitives/Mersenne.js.map +1 -0
- package/dist/esm/src/primitives/MontgomoryMethod.js +149 -0
- package/dist/esm/src/primitives/MontgomoryMethod.js.map +1 -0
- package/dist/esm/src/primitives/Point.js +816 -0
- package/dist/esm/src/primitives/Point.js.map +1 -0
- package/dist/esm/src/primitives/PrivateKey.js +240 -0
- package/dist/esm/src/primitives/PrivateKey.js.map +1 -0
- package/dist/esm/src/primitives/PublicKey.js +162 -0
- package/dist/esm/src/primitives/PublicKey.js.map +1 -0
- package/dist/esm/src/primitives/Random.js +56 -0
- package/dist/esm/src/primitives/Random.js.map +1 -0
- package/dist/esm/src/primitives/ReductionContext.js +486 -0
- package/dist/esm/src/primitives/ReductionContext.js.map +1 -0
- package/dist/esm/src/primitives/Signature.js +360 -0
- package/dist/esm/src/primitives/Signature.js.map +1 -0
- package/dist/esm/src/primitives/SymmetricKey.js +76 -0
- package/dist/esm/src/primitives/SymmetricKey.js.map +1 -0
- package/dist/esm/src/primitives/TransactionSignature.js +144 -0
- package/dist/esm/src/primitives/TransactionSignature.js.map +1 -0
- package/dist/esm/src/primitives/index.js +13 -0
- package/dist/esm/src/primitives/index.js.map +1 -0
- package/dist/esm/src/primitives/utils.js +609 -0
- package/dist/esm/src/primitives/utils.js.map +1 -0
- package/dist/esm/src/script/LockingScript.js +29 -0
- package/dist/esm/src/script/LockingScript.js.map +1 -0
- package/dist/esm/src/script/OP.js +205 -0
- package/dist/esm/src/script/OP.js.map +1 -0
- package/dist/esm/src/script/Script.js +430 -0
- package/dist/esm/src/script/Script.js.map +1 -0
- package/dist/esm/src/script/ScriptChunk.js +2 -0
- package/dist/esm/src/script/ScriptChunk.js.map +1 -0
- package/dist/esm/src/script/ScriptTemplate.js +2 -0
- package/dist/esm/src/script/ScriptTemplate.js.map +1 -0
- package/dist/esm/src/script/Spend.js +1240 -0
- package/dist/esm/src/script/Spend.js.map +1 -0
- package/dist/esm/src/script/UnlockingScript.js +29 -0
- package/dist/esm/src/script/UnlockingScript.js.map +1 -0
- package/dist/esm/src/script/index.js +7 -0
- package/dist/esm/src/script/index.js.map +1 -0
- package/dist/esm/src/script/templates/P2PKH.js +113 -0
- package/dist/esm/src/script/templates/P2PKH.js.map +1 -0
- package/dist/esm/src/script/templates/RPuzzle.js +119 -0
- package/dist/esm/src/script/templates/RPuzzle.js.map +1 -0
- package/dist/esm/src/script/templates/index.js +3 -0
- package/dist/esm/src/script/templates/index.js.map +1 -0
- package/dist/esm/src/transaction/Broadcaster.js +2 -0
- package/dist/esm/src/transaction/Broadcaster.js.map +1 -0
- package/dist/esm/src/transaction/ChainTracker.js +2 -0
- package/dist/esm/src/transaction/ChainTracker.js.map +1 -0
- package/dist/esm/src/transaction/FeeModel.js +2 -0
- package/dist/esm/src/transaction/FeeModel.js.map +1 -0
- package/dist/esm/src/transaction/MerklePath.js +237 -0
- package/dist/esm/src/transaction/MerklePath.js.map +1 -0
- package/dist/esm/src/transaction/Transaction.js +617 -0
- package/dist/esm/src/transaction/Transaction.js.map +1 -0
- package/dist/esm/src/transaction/TransactionInput.js +2 -0
- package/dist/esm/src/transaction/TransactionInput.js.map +1 -0
- package/dist/esm/src/transaction/TransactionOutput.js +2 -0
- package/dist/esm/src/transaction/TransactionOutput.js.map +1 -0
- package/dist/esm/src/transaction/broadcasters/ARC.js +111 -0
- package/dist/esm/src/transaction/broadcasters/ARC.js.map +1 -0
- package/dist/esm/src/transaction/broadcasters/index.js +2 -0
- package/dist/esm/src/transaction/broadcasters/index.js.map +1 -0
- package/dist/esm/src/transaction/fee-models/SatoshisPerKilobyte.js +71 -0
- package/dist/esm/src/transaction/fee-models/SatoshisPerKilobyte.js.map +1 -0
- package/dist/esm/src/transaction/fee-models/index.js +2 -0
- package/dist/esm/src/transaction/fee-models/index.js.map +1 -0
- package/dist/esm/src/transaction/index.js +3 -0
- package/dist/esm/src/transaction/index.js.map +1 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/types/mod.d.ts +9 -0
- package/dist/types/mod.d.ts.map +1 -0
- package/dist/types/src/compat/BSM.d.ts +28 -0
- package/dist/types/src/compat/BSM.d.ts.map +1 -0
- package/dist/types/src/compat/ECIES.d.ts +62 -0
- package/dist/types/src/compat/ECIES.d.ts.map +1 -0
- package/dist/types/src/compat/HD.d.ts +131 -0
- package/dist/types/src/compat/HD.d.ts.map +1 -0
- package/dist/types/src/compat/Mnemonic.d.ts +132 -0
- package/dist/types/src/compat/Mnemonic.d.ts.map +1 -0
- package/dist/types/src/compat/bip-39-wordlist-en.d.ts +5 -0
- package/dist/types/src/compat/bip-39-wordlist-en.d.ts.map +1 -0
- package/dist/types/src/compat/index.d.ts +5 -0
- package/dist/types/src/compat/index.d.ts.map +1 -0
- package/dist/types/src/messages/EncryptedMessage.d.ts +20 -0
- package/dist/types/src/messages/EncryptedMessage.d.ts.map +1 -0
- package/dist/types/src/messages/SignedMessage.d.ts +21 -0
- package/dist/types/src/messages/SignedMessage.d.ts.map +1 -0
- package/dist/types/src/messages/index.d.ts +3 -0
- package/dist/types/src/messages/index.d.ts.map +1 -0
- package/dist/types/src/primitives/AESGCM.d.ts +14 -0
- package/dist/types/src/primitives/AESGCM.d.ts.map +1 -0
- package/dist/types/src/primitives/BasePoint.d.ts +22 -0
- package/dist/types/src/primitives/BasePoint.d.ts.map +1 -0
- package/dist/types/src/primitives/BigNumber.d.ts +1895 -0
- package/dist/types/src/primitives/BigNumber.d.ts.map +1 -0
- package/dist/types/src/primitives/Curve.d.ts +55 -0
- package/dist/types/src/primitives/Curve.d.ts.map +1 -0
- package/dist/types/src/primitives/DRBG.d.ts +54 -0
- package/dist/types/src/primitives/DRBG.d.ts.map +1 -0
- package/dist/types/src/primitives/ECDSA.d.ts +39 -0
- package/dist/types/src/primitives/ECDSA.d.ts.map +1 -0
- package/dist/types/src/primitives/Hash.d.ts +450 -0
- package/dist/types/src/primitives/Hash.d.ts.map +1 -0
- package/dist/types/src/primitives/JacobianPoint.d.ts +164 -0
- package/dist/types/src/primitives/JacobianPoint.d.ts.map +1 -0
- package/dist/types/src/primitives/K256.d.ts +53 -0
- package/dist/types/src/primitives/K256.d.ts.map +1 -0
- package/dist/types/src/primitives/Mersenne.d.ts +72 -0
- package/dist/types/src/primitives/Mersenne.d.ts.map +1 -0
- package/dist/types/src/primitives/MontgomoryMethod.d.ts +96 -0
- package/dist/types/src/primitives/MontgomoryMethod.d.ts.map +1 -0
- package/dist/types/src/primitives/Point.d.ts +303 -0
- package/dist/types/src/primitives/Point.d.ts.map +1 -0
- package/dist/types/src/primitives/PrivateKey.d.ts +174 -0
- package/dist/types/src/primitives/PrivateKey.d.ts.map +1 -0
- package/dist/types/src/primitives/PublicKey.d.ts +120 -0
- package/dist/types/src/primitives/PublicKey.d.ts.map +1 -0
- package/dist/types/src/primitives/Random.d.ts +14 -0
- package/dist/types/src/primitives/Random.d.ts.map +1 -0
- package/dist/types/src/primitives/ReductionContext.d.ts +308 -0
- package/dist/types/src/primitives/ReductionContext.d.ts.map +1 -0
- package/dist/types/src/primitives/Signature.d.ts +162 -0
- package/dist/types/src/primitives/Signature.d.ts.map +1 -0
- package/dist/types/src/primitives/SymmetricKey.d.ts +55 -0
- package/dist/types/src/primitives/SymmetricKey.d.ts.map +1 -0
- package/dist/types/src/primitives/TransactionSignature.d.ts +36 -0
- package/dist/types/src/primitives/TransactionSignature.d.ts.map +1 -0
- package/dist/types/src/primitives/index.d.ts +13 -0
- package/dist/types/src/primitives/index.d.ts.map +1 -0
- package/dist/types/src/primitives/utils.d.ts +124 -0
- package/dist/types/src/primitives/utils.d.ts.map +1 -0
- package/dist/types/src/script/LockingScript.d.ts +25 -0
- package/dist/types/src/script/LockingScript.d.ts.map +1 -0
- package/dist/types/src/script/OP.d.ts +193 -0
- package/dist/types/src/script/OP.d.ts.map +1 -0
- package/dist/types/src/script/Script.d.ts +148 -0
- package/dist/types/src/script/Script.d.ts.map +1 -0
- package/dist/types/src/script/ScriptChunk.d.ts +8 -0
- package/dist/types/src/script/ScriptChunk.d.ts.map +1 -0
- package/dist/types/src/script/ScriptTemplate.d.ts +33 -0
- package/dist/types/src/script/ScriptTemplate.d.ts.map +1 -0
- package/dist/types/src/script/Spend.d.ts +103 -0
- package/dist/types/src/script/Spend.d.ts.map +1 -0
- package/dist/types/src/script/UnlockingScript.d.ts +25 -0
- package/dist/types/src/script/UnlockingScript.d.ts.map +1 -0
- package/dist/types/src/script/index.d.ts +8 -0
- package/dist/types/src/script/index.d.ts.map +1 -0
- package/dist/types/src/script/templates/P2PKH.d.ts +40 -0
- package/dist/types/src/script/templates/P2PKH.d.ts.map +1 -0
- package/dist/types/src/script/templates/RPuzzle.d.ts +47 -0
- package/dist/types/src/script/templates/RPuzzle.d.ts.map +1 -0
- package/dist/types/src/script/templates/index.d.ts +3 -0
- package/dist/types/src/script/templates/index.d.ts.map +1 -0
- package/dist/types/src/transaction/Broadcaster.d.ts +39 -0
- package/dist/types/src/transaction/Broadcaster.d.ts.map +1 -0
- package/dist/types/src/transaction/ChainTracker.d.ts +23 -0
- package/dist/types/src/transaction/ChainTracker.d.ts.map +1 -0
- package/dist/types/src/transaction/FeeModel.d.ts +12 -0
- package/dist/types/src/transaction/FeeModel.d.ts.map +1 -0
- package/dist/types/src/transaction/MerklePath.d.ts +91 -0
- package/dist/types/src/transaction/MerklePath.d.ts.map +1 -0
- package/dist/types/src/transaction/Transaction.d.ts +215 -0
- package/dist/types/src/transaction/Transaction.d.ts.map +1 -0
- package/dist/types/src/transaction/TransactionInput.d.ts +63 -0
- package/dist/types/src/transaction/TransactionInput.d.ts.map +1 -0
- package/dist/types/src/transaction/TransactionOutput.d.ts +36 -0
- package/dist/types/src/transaction/TransactionOutput.d.ts.map +1 -0
- package/dist/types/src/transaction/broadcasters/ARC.d.ts +28 -0
- package/dist/types/src/transaction/broadcasters/ARC.d.ts.map +1 -0
- package/dist/types/src/transaction/broadcasters/index.d.ts +2 -0
- package/dist/types/src/transaction/broadcasters/index.d.ts.map +1 -0
- package/dist/types/src/transaction/fee-models/SatoshisPerKilobyte.d.ts +26 -0
- package/dist/types/src/transaction/fee-models/SatoshisPerKilobyte.d.ts.map +1 -0
- package/dist/types/src/transaction/fee-models/index.d.ts +2 -0
- package/dist/types/src/transaction/fee-models/index.d.ts.map +1 -0
- package/dist/types/src/transaction/index.d.ts +7 -0
- package/dist/types/src/transaction/index.d.ts.map +1 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Script from './Script.js';
|
|
2
|
+
/**
|
|
3
|
+
* The UnlockingScript class represents an unlocking script in a Bitcoin SV transaction.
|
|
4
|
+
* It extends the Script class and is used specifically for input scripts that unlock funds.
|
|
5
|
+
*
|
|
6
|
+
* Inherits all properties and methods from the Script class.
|
|
7
|
+
*
|
|
8
|
+
* @extends {Script}
|
|
9
|
+
* @see {@link Script} for more information on Script.
|
|
10
|
+
*/
|
|
11
|
+
export default class UnlockingScript extends Script {
|
|
12
|
+
/**
|
|
13
|
+
* @method isLockingScript
|
|
14
|
+
* Determines if the script is a locking script.
|
|
15
|
+
* @returns {boolean} Always returns false for an UnlockingScript instance.
|
|
16
|
+
*/
|
|
17
|
+
isLockingScript(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* @method isUnlockingScript
|
|
20
|
+
* Determines if the script is an unlocking script.
|
|
21
|
+
* @returns {boolean} Always returns true for an UnlockingScript instance.
|
|
22
|
+
*/
|
|
23
|
+
isUnlockingScript(): boolean;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=UnlockingScript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnlockingScript.d.ts","sourceRoot":"","sources":["../../../../src/script/UnlockingScript.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAEhC;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,MAAM;IACjD;;;;OAIG;IACH,eAAe,IAAK,OAAO;IAI3B;;;;OAIG;IACH,iBAAiB,IAAK,OAAO;CAG9B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as OP } from './OP.js';
|
|
2
|
+
export { default as Script } from './Script.js';
|
|
3
|
+
export { default as LockingScript } from './LockingScript.js';
|
|
4
|
+
export { default as UnlockingScript } from './UnlockingScript.js';
|
|
5
|
+
export { default as Spend } from './Spend.js';
|
|
6
|
+
export type { default as ScriptTemplate } from './ScriptTemplate.js';
|
|
7
|
+
export * from './templates/index.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/script/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,YAAY,CAAA;AAC7C,YAAY,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpE,cAAc,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import ScriptTemplate from '../ScriptTemplate.js';
|
|
2
|
+
import LockingScript from '../LockingScript.js';
|
|
3
|
+
import UnlockingScript from '../UnlockingScript.js';
|
|
4
|
+
import Transaction from '../../transaction/Transaction.js';
|
|
5
|
+
import PrivateKey from '../../primitives/PrivateKey.js';
|
|
6
|
+
import Script from '../Script.js';
|
|
7
|
+
/**
|
|
8
|
+
* P2PKH (Pay To Public Key Hash) class implementing ScriptTemplate.
|
|
9
|
+
*
|
|
10
|
+
* This class provides methods to create Pay To Public Key Hash locking and unlocking scripts, including the unlocking of P2PKH UTXOs with the private key.
|
|
11
|
+
*/
|
|
12
|
+
export default class P2PKH implements ScriptTemplate {
|
|
13
|
+
/**
|
|
14
|
+
* Creates a P2PKH locking script for a given public key hash or address string
|
|
15
|
+
*
|
|
16
|
+
* @param {number[] | string} pubkeyhash or address - An array or address representing the public key hash.
|
|
17
|
+
* @returns {LockingScript} - A P2PKH locking script.
|
|
18
|
+
*/
|
|
19
|
+
lock(pubkeyhash: string | number[]): LockingScript;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a function that generates a P2PKH unlocking script along with its signature and length estimation.
|
|
22
|
+
*
|
|
23
|
+
* The returned object contains:
|
|
24
|
+
* 1. `sign` - A function that, when invoked with a transaction and an input index,
|
|
25
|
+
* produces an unlocking script suitable for a P2PKH locked output.
|
|
26
|
+
* 2. `estimateLength` - A function that returns the estimated length of the unlocking script in bytes.
|
|
27
|
+
*
|
|
28
|
+
* @param {PrivateKey} privateKey - The private key used for signing the transaction.
|
|
29
|
+
* @param {'all'|'none'|'single'} signOutputs - The signature scope for outputs.
|
|
30
|
+
* @param {boolean} anyoneCanPay - Flag indicating if the signature allows for other inputs to be added later.
|
|
31
|
+
* @param {number} sourceSatoshis - Optional. The amount being unlocked. Otherwise the input.sourceTransaction is required.
|
|
32
|
+
* @param {Script} lockingScript - Optional. The lockinScript. Otherwise the input.sourceTransaction is required.
|
|
33
|
+
* @returns {Object} - An object containing the `sign` and `estimateLength` functions.
|
|
34
|
+
*/
|
|
35
|
+
unlock(privateKey: PrivateKey, signOutputs?: 'all' | 'none' | 'single', anyoneCanPay?: boolean, sourceSatoshis?: number, lockingScript?: Script): {
|
|
36
|
+
sign: (tx: Transaction, inputIndex: number) => Promise<UnlockingScript>;
|
|
37
|
+
estimateLength: () => Promise<106>;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=P2PKH.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"P2PKH.d.ts","sourceRoot":"","sources":["../../../../../src/script/templates/P2PKH.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,sBAAsB,CAAA;AAEjD,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAC/C,OAAO,eAAe,MAAM,uBAAuB,CAAA;AACnD,OAAO,WAAW,MAAM,kCAAkC,CAAA;AAC1D,OAAO,UAAU,MAAM,gCAAgC,CAAA;AAGvD,OAAO,MAAM,MAAM,cAAc,CAAA;AAEjC;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,KAAM,YAAW,cAAc;IAClD;;;;;OAKG;IACH,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,aAAa;IAkBlD;;;;;;;;;;;;;;OAcG;IACH,MAAM,CACJ,UAAU,EAAE,UAAU,EACtB,WAAW,GAAE,KAAK,GAAG,MAAM,GAAG,QAAgB,EAC9C,YAAY,GAAE,OAAe,EAC7B,cAAc,CAAC,EAAE,MAAM,EACvB,aAAa,CAAC,EAAE,MAAM,GACrB;QACD,IAAI,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;QACvE,cAAc,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAA;KACnC;CAyEF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import ScriptTemplate from '../ScriptTemplate.js';
|
|
2
|
+
import LockingScript from '../LockingScript.js';
|
|
3
|
+
import UnlockingScript from '../UnlockingScript.js';
|
|
4
|
+
import Transaction from '../../transaction/Transaction.js';
|
|
5
|
+
import PrivateKey from '../../primitives/PrivateKey.js';
|
|
6
|
+
import BigNumber from '../../primitives/BigNumber.js';
|
|
7
|
+
/**
|
|
8
|
+
* RPuzzle class implementing ScriptTemplate.
|
|
9
|
+
*
|
|
10
|
+
* This class provides methods to create R Puzzle and R Puzzle Hash locking and unlocking scripts, including the unlocking of UTXOs with the correct K value.
|
|
11
|
+
*/
|
|
12
|
+
export default class RPuzzle implements ScriptTemplate {
|
|
13
|
+
type: 'raw' | 'SHA1' | 'SHA256' | 'HASH256' | 'RIPEMD160' | 'HASH160';
|
|
14
|
+
/**
|
|
15
|
+
* @constructor
|
|
16
|
+
* Constructs an R Puzzle template instance for a given puzzle type
|
|
17
|
+
*
|
|
18
|
+
* @param {'raw'|'SHA1'|'SHA256'|'HASH256'|'RIPEMD160'|'HASH160'} type Denotes the type of puzzle to create
|
|
19
|
+
*/
|
|
20
|
+
constructor(type?: 'raw' | 'SHA1' | 'SHA256' | 'HASH256' | 'RIPEMD160' | 'HASH160');
|
|
21
|
+
/**
|
|
22
|
+
* Creates an R puzzle locking script for a given R value or R value hash.
|
|
23
|
+
*
|
|
24
|
+
* @param {number[]} value - An array representing the R value or its hash.
|
|
25
|
+
* @returns {LockingScript} - An R puzzle locking script.
|
|
26
|
+
*/
|
|
27
|
+
lock(value: number[]): LockingScript;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a function that generates an R puzzle unlocking script along with its signature and length estimation.
|
|
30
|
+
*
|
|
31
|
+
* The returned object contains:
|
|
32
|
+
* 1. `sign` - A function that, when invoked with a transaction and an input index,
|
|
33
|
+
* produces an unlocking script suitable for an R puzzle locked output.
|
|
34
|
+
* 2. `estimateLength` - A function that returns the estimated length of the unlocking script in bytes.
|
|
35
|
+
*
|
|
36
|
+
* @param {BigNumber} k — The K-value used to unlock the R-puzzle.
|
|
37
|
+
* @param {PrivateKey} privateKey - The private key used for signing the transaction. If not provided, a random key will be generated.
|
|
38
|
+
* @param {'all'|'none'|'single'} signOutputs - The signature scope for outputs.
|
|
39
|
+
* @param {boolean} anyoneCanPay - Flag indicating if the signature allows for other inputs to be added later.
|
|
40
|
+
* @returns {Object} - An object containing the `sign` and `estimateLength` functions.
|
|
41
|
+
*/
|
|
42
|
+
unlock(k: BigNumber, privateKey: PrivateKey, signOutputs?: 'all' | 'none' | 'single', anyoneCanPay?: boolean): {
|
|
43
|
+
sign: (tx: Transaction, inputIndex: number) => Promise<UnlockingScript>;
|
|
44
|
+
estimateLength: () => Promise<106>;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=RPuzzle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RPuzzle.d.ts","sourceRoot":"","sources":["../../../../../src/script/templates/RPuzzle.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,sBAAsB,CAAA;AACjD,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAC/C,OAAO,eAAe,MAAM,uBAAuB,CAAA;AACnD,OAAO,WAAW,MAAM,kCAAkC,CAAA;AAC1D,OAAO,UAAU,MAAM,gCAAgC,CAAA;AAIvD,OAAO,SAAS,MAAM,+BAA+B,CAAA;AAErD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,OAAQ,YAAW,cAAc;IACpD,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAQ;IAE7E;;;;;OAKG;gBACU,IAAI,GAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,SAAiB;IAI1F;;;;;OAKG;IACH,IAAI,CAAE,KAAK,EAAE,MAAM,EAAE,GAAG,aAAa;IAuBrC;;;;;;;;;;;;;OAaG;IACH,MAAM,CACJ,CAAC,EAAE,SAAS,EACZ,UAAU,EAAE,UAAU,EACtB,WAAW,GAAE,KAAK,GAAG,MAAM,GAAG,QAAgB,EAC9C,YAAY,GAAE,OAAe,GAC5B;QACC,IAAI,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;QACvE,cAAc,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAA;KACnC;CA2DJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/script/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Transaction from './Transaction.js';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the structure of a successful broadcast response.
|
|
4
|
+
*
|
|
5
|
+
* @interface
|
|
6
|
+
* @property {string} status - The status of the response, indicating success.
|
|
7
|
+
* @property {string} txid - The transaction ID of the broadcasted transaction.
|
|
8
|
+
* @property {string} message - A human-readable success message.
|
|
9
|
+
*/
|
|
10
|
+
export interface BroadcastResponse {
|
|
11
|
+
status: 'success';
|
|
12
|
+
txid: string;
|
|
13
|
+
message: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Defines the structure of a failed broadcast response.
|
|
17
|
+
*
|
|
18
|
+
* @interface
|
|
19
|
+
* @property {string} status - The status of the response, indicating an error.
|
|
20
|
+
* @property {string} code - A machine-readable error code representing the type of error encountered.
|
|
21
|
+
* @property {string} description - A detailed description of the error.
|
|
22
|
+
*/
|
|
23
|
+
export interface BroadcastFailure {
|
|
24
|
+
status: 'error';
|
|
25
|
+
code: string;
|
|
26
|
+
description: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Represents the interface for a transaction broadcaster.
|
|
30
|
+
* This interface defines a standard method for broadcasting transactions.
|
|
31
|
+
*
|
|
32
|
+
* @interface
|
|
33
|
+
* @property {function} broadcast - A function that takes a Transaction object and returns a promise.
|
|
34
|
+
* The promise resolves to either a BroadcastResponse or a BroadcastFailure.
|
|
35
|
+
*/
|
|
36
|
+
export interface Broadcaster {
|
|
37
|
+
broadcast: (transaction: Transaction) => Promise<BroadcastResponse | BroadcastFailure>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=Broadcaster.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Broadcaster.d.ts","sourceRoot":"","sources":["../../../../src/transaction/Broadcaster.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,kBAAkB,CAAA;AAE1C;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,CAAC,WAAW,EAAE,WAAW,KACpC,OAAO,CAAC,iBAAiB,GAAG,gBAAgB,CAAC,CAAA;CAC9C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Chain Tracker is responsible for verifying the validity of a given Merkle root
|
|
3
|
+
* for a specific block height within the blockchain.
|
|
4
|
+
*
|
|
5
|
+
* Chain Trackers ensure the integrity of the blockchain by
|
|
6
|
+
* validating new headers against the chain's history. They use accumulated
|
|
7
|
+
* proof-of-work and protocol adherence as metrics to assess the legitimacy of blocks.
|
|
8
|
+
*
|
|
9
|
+
* @interface ChainTracker
|
|
10
|
+
* @function isValidRootForHeight - A method to verify the validity of a Merkle root
|
|
11
|
+
* for a given block height.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const chainTracker = {
|
|
15
|
+
* isValidRootForHeight: async (root, height) => {
|
|
16
|
+
* // Implementation to check if the Merkle root is valid for the specified block height.
|
|
17
|
+
* }
|
|
18
|
+
* };
|
|
19
|
+
*/
|
|
20
|
+
export default interface ChainTracker {
|
|
21
|
+
isValidRootForHeight: (root: string, height: number) => Promise<boolean>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=ChainTracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChainTracker.d.ts","sourceRoot":"","sources":["../../../../src/transaction/ChainTracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,OAAO,WAAW,YAAY;IACnC,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CACzE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Transaction from './Transaction.js';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the interface for a transaction fee model.
|
|
4
|
+
* This interface defines a standard method for computing a fee when given a transaction.
|
|
5
|
+
*
|
|
6
|
+
* @interface
|
|
7
|
+
* @property {function} computeFee - A function that takes a Transaction object and returns a BigNumber representing the number of satoshis the transaction should cost.
|
|
8
|
+
*/
|
|
9
|
+
export default interface FeeModel {
|
|
10
|
+
computeFee: (transaction: Transaction) => Promise<number>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=FeeModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeeModel.d.ts","sourceRoot":"","sources":["../../../../src/transaction/FeeModel.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,kBAAkB,CAAA;AAG1C;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,WAAW,QAAQ;IAC/B,UAAU,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAC1D"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Reader } from '../primitives/utils.js';
|
|
2
|
+
import ChainTracker from './ChainTracker.js';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a Merkle Path, which is used to provide a compact proof of inclusion for a
|
|
5
|
+
* transaction in a block. This class encapsulates all the details required for creating
|
|
6
|
+
* and verifying Merkle Proofs.
|
|
7
|
+
*
|
|
8
|
+
* @class MerklePath
|
|
9
|
+
* @property {number} blockHeight - The height of the block in which the transaction is included.
|
|
10
|
+
* @property {Array<Array<{offset: number, hash?: string, txid?: boolean, duplicate?: boolean}>>} path -
|
|
11
|
+
* A tree structure representing the Merkle Path, with each level containing information
|
|
12
|
+
* about the nodes involved in constructing the proof.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Creating and verifying a Merkle Path
|
|
16
|
+
* const merklePath = MerklePath.fromHex('...');
|
|
17
|
+
* const isValid = merklePath.verify(txid, chainTracker);
|
|
18
|
+
*
|
|
19
|
+
* @description
|
|
20
|
+
* The MerklePath class is useful for verifying transactions in a lightweight and efficient manner without
|
|
21
|
+
* needing the entire block data. This class offers functionalities for creating, converting,
|
|
22
|
+
* and verifying these proofs.
|
|
23
|
+
*/
|
|
24
|
+
export default class MerklePath {
|
|
25
|
+
blockHeight: number;
|
|
26
|
+
path: Array<Array<{
|
|
27
|
+
offset: number;
|
|
28
|
+
hash?: string;
|
|
29
|
+
txid?: boolean;
|
|
30
|
+
duplicate?: boolean;
|
|
31
|
+
}>>;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a MerklePath instance from a hexadecimal string.
|
|
34
|
+
*
|
|
35
|
+
* @static
|
|
36
|
+
* @param {string} hex - The hexadecimal string representation of the Merkle Path.
|
|
37
|
+
* @returns {MerklePath} - A new MerklePath instance.
|
|
38
|
+
*/
|
|
39
|
+
static fromHex(hex: string): MerklePath;
|
|
40
|
+
static fromReader(reader: Reader): MerklePath;
|
|
41
|
+
/**
|
|
42
|
+
* Creates a MerklePath instance from a binary array.
|
|
43
|
+
*
|
|
44
|
+
* @static
|
|
45
|
+
* @param {number[]} bump - The binary array representation of the Merkle Path.
|
|
46
|
+
* @returns {MerklePath} - A new MerklePath instance.
|
|
47
|
+
*/
|
|
48
|
+
static fromBinary(bump: number[]): MerklePath;
|
|
49
|
+
constructor(blockHeight: number, path: Array<Array<{
|
|
50
|
+
offset: number;
|
|
51
|
+
hash?: string;
|
|
52
|
+
txid?: boolean;
|
|
53
|
+
duplicate?: boolean;
|
|
54
|
+
}>>);
|
|
55
|
+
/**
|
|
56
|
+
* Converts the MerklePath to a binary array format.
|
|
57
|
+
*
|
|
58
|
+
* @returns {number[]} - The binary array representation of the Merkle Path.
|
|
59
|
+
*/
|
|
60
|
+
toBinary(): number[];
|
|
61
|
+
/**
|
|
62
|
+
* Converts the MerklePath to a hexadecimal string format.
|
|
63
|
+
*
|
|
64
|
+
* @returns {string} - The hexadecimal string representation of the Merkle Path.
|
|
65
|
+
*/
|
|
66
|
+
toHex(): string;
|
|
67
|
+
/**
|
|
68
|
+
* Computes the Merkle root from the provided transaction ID.
|
|
69
|
+
*
|
|
70
|
+
* @param {string} txid - The transaction ID to compute the Merkle root for. If not provided, the root will be computed from an unspecified branch, and not all branches will be validated!
|
|
71
|
+
* @returns {string} - The computed Merkle root as a hexadecimal string.
|
|
72
|
+
* @throws {Error} - If the transaction ID is not part of the Merkle Path.
|
|
73
|
+
*/
|
|
74
|
+
computeRoot(txid?: string): string;
|
|
75
|
+
/**
|
|
76
|
+
* Verifies if the given transaction ID is part of the Merkle tree at the specified block height.
|
|
77
|
+
*
|
|
78
|
+
* @param {string} txid - The transaction ID to verify.
|
|
79
|
+
* @param {ChainTracker} chainTracker - The ChainTracker instance used to verify the Merkle root.
|
|
80
|
+
* @returns {boolean} - True if the transaction ID is valid within the Merkle Path at the specified block height.
|
|
81
|
+
*/
|
|
82
|
+
verify(txid: string, chainTracker: ChainTracker): Promise<boolean>;
|
|
83
|
+
/**
|
|
84
|
+
* Combines this MerklePath with another to create a compound proof.
|
|
85
|
+
*
|
|
86
|
+
* @param {MerklePath} other - Another MerklePath to combine with this path.
|
|
87
|
+
* @throws {Error} - If the paths have different block heights or roots.
|
|
88
|
+
*/
|
|
89
|
+
combine(other: MerklePath): void;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=MerklePath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MerklePath.d.ts","sourceRoot":"","sources":["../../../../src/transaction/MerklePath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAA0B,MAAM,wBAAwB,CAAA;AAEvE,OAAO,YAAY,MAAM,mBAAmB,CAAA;AAE5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC;QAChB,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,SAAS,CAAC,EAAE,OAAO,CAAA;KACpB,CAAC,CAAC,CAAA;IAEH;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU;IAIvC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU;IAgC7C;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU;gBAKjC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC;QACjD,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,SAAS,CAAC,EAAE,OAAO,CAAA;KACpB,CAAC,CAAC;IAsCH;;;;OAIG;IACH,QAAQ,IAAI,MAAM,EAAE;IA0BpB;;;;OAIG;IACH,KAAK,IAAI,MAAM;IAIf;;;;;;OAMG;IACH,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM;IAgClC;;;;;;OAMG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;IAMxE;;;;;OAKG;IACH,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;CA4BjC"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import TransactionInput from './TransactionInput.js';
|
|
2
|
+
import TransactionOutput from './TransactionOutput.js';
|
|
3
|
+
import FeeModel from './FeeModel.js';
|
|
4
|
+
import { Broadcaster, BroadcastResponse, BroadcastFailure } from './Broadcaster.js';
|
|
5
|
+
import MerklePath from './MerklePath.js';
|
|
6
|
+
import ChainTracker from './ChainTracker.js';
|
|
7
|
+
/**
|
|
8
|
+
* Represents a complete Bitcoin transaction. This class encapsulates all the details
|
|
9
|
+
* required for creating, signing, and processing a Bitcoin transaction, including
|
|
10
|
+
* inputs, outputs, and various transaction-related methods.
|
|
11
|
+
*
|
|
12
|
+
* @class Transaction
|
|
13
|
+
* @property {number} version - The version number of the transaction. Used to specify
|
|
14
|
+
* which set of rules this transaction follows.
|
|
15
|
+
* @property {TransactionInput[]} inputs - An array of TransactionInput objects, representing
|
|
16
|
+
* the inputs for the transaction. Each input references a previous transaction's output.
|
|
17
|
+
* @property {TransactionOutput[]} outputs - An array of TransactionOutput objects, representing
|
|
18
|
+
* the outputs for the transaction. Each output specifies the amount of satoshis to be
|
|
19
|
+
* transferred and the conditions under which they can be spent.
|
|
20
|
+
* @property {number} lockTime - The lock time of the transaction. If non-zero, it specifies the
|
|
21
|
+
* earliest time or block height at which the transaction can be added to the block chain.
|
|
22
|
+
* @property {Record<string, any>} metadata - A key-value store for attaching additional data to
|
|
23
|
+
* the transaction object, not included in the transaction itself. Useful for adding descriptions, internal reference numbers, or other information.
|
|
24
|
+
* @property {MerkleProof} [merkleProof] - Optional. A merkle proof demonstrating the transaction's
|
|
25
|
+
* inclusion in a block. Useful for transaction verification using SPV.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Creating a new transaction
|
|
29
|
+
* let tx = new Transaction();
|
|
30
|
+
* tx.addInput(...);
|
|
31
|
+
* tx.addOutput(...);
|
|
32
|
+
* await tx.fee();
|
|
33
|
+
* await tx.sign();
|
|
34
|
+
* await tx.broadcast();
|
|
35
|
+
*
|
|
36
|
+
* @description
|
|
37
|
+
* The Transaction class provides comprehensive
|
|
38
|
+
* functionality to handle various aspects of transaction creation, including
|
|
39
|
+
* adding inputs and outputs, computing fees, signing the transaction, and
|
|
40
|
+
* generating its binary or hexadecimal representation.
|
|
41
|
+
*/
|
|
42
|
+
export default class Transaction {
|
|
43
|
+
version: number;
|
|
44
|
+
inputs: TransactionInput[];
|
|
45
|
+
outputs: TransactionOutput[];
|
|
46
|
+
lockTime: number;
|
|
47
|
+
metadata: Record<string, any>;
|
|
48
|
+
merklePath?: MerklePath;
|
|
49
|
+
private cachedHash?;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new transaction, linked to its inputs and their associated merkle paths, from a BEEF (BRC-62) structure.
|
|
52
|
+
* @param beef A binary representation of a transaction in BEEF format.
|
|
53
|
+
* @returns An anchored transaction, linked to its associated inputs populated with merkle paths.
|
|
54
|
+
*/
|
|
55
|
+
static fromBEEF(beef: number[]): Transaction;
|
|
56
|
+
/**
|
|
57
|
+
* Since the validation of blockchain data is atomically transaction data validation,
|
|
58
|
+
* any application seeking to validate data in output scripts must store the entire transaction as well.
|
|
59
|
+
* Since the transaction data includes the output script data, saving a second copy of potentially
|
|
60
|
+
* large scripts can bloat application storage requirements.
|
|
61
|
+
*
|
|
62
|
+
* This function efficiently parses binary transaction data to determine the offsets and lengths of each script.
|
|
63
|
+
* This supports the efficient retreival of script data from transaction data.
|
|
64
|
+
*
|
|
65
|
+
* @param bin binary transaction data
|
|
66
|
+
* @returns {
|
|
67
|
+
* inputs: { vin: number, offset: number, length: number }[]
|
|
68
|
+
* outputs: { vout: number, offset: number, length: number }[]
|
|
69
|
+
* }
|
|
70
|
+
*/
|
|
71
|
+
static parseScriptOffsets(bin: number[]): {
|
|
72
|
+
inputs: {
|
|
73
|
+
vin: number;
|
|
74
|
+
offset: number;
|
|
75
|
+
length: number;
|
|
76
|
+
}[];
|
|
77
|
+
outputs: {
|
|
78
|
+
vout: number;
|
|
79
|
+
offset: number;
|
|
80
|
+
length: number;
|
|
81
|
+
}[];
|
|
82
|
+
};
|
|
83
|
+
private static fromReader;
|
|
84
|
+
/**
|
|
85
|
+
* Creates a Transaction instance from a binary array.
|
|
86
|
+
*
|
|
87
|
+
* @static
|
|
88
|
+
* @param {number[]} bin - The binary array representation of the transaction.
|
|
89
|
+
* @returns {Transaction} - A new Transaction instance.
|
|
90
|
+
*/
|
|
91
|
+
static fromBinary(bin: number[]): Transaction;
|
|
92
|
+
/**
|
|
93
|
+
* Creates a Transaction instance from a hexadecimal string.
|
|
94
|
+
*
|
|
95
|
+
* @static
|
|
96
|
+
* @param {string} hex - The hexadecimal string representation of the transaction.
|
|
97
|
+
* @returns {Transaction} - A new Transaction instance.
|
|
98
|
+
*/
|
|
99
|
+
static fromHex(hex: string): Transaction;
|
|
100
|
+
/**
|
|
101
|
+
* Creates a Transaction instance from a hexadecimal string encoded BEEF.
|
|
102
|
+
*
|
|
103
|
+
* @static
|
|
104
|
+
* @param {string} hex - The hexadecimal string representation of the transaction BEEF.
|
|
105
|
+
* @returns {Transaction} - A new Transaction instance.
|
|
106
|
+
*/
|
|
107
|
+
static fromHexBEEF(hex: string): Transaction;
|
|
108
|
+
constructor(version?: number, inputs?: TransactionInput[], outputs?: TransactionOutput[], lockTime?: number, metadata?: Record<string, any>, merklePath?: MerklePath);
|
|
109
|
+
/**
|
|
110
|
+
* Adds a new input to the transaction.
|
|
111
|
+
*
|
|
112
|
+
* @param {TransactionInput} input - The TransactionInput object to add to the transaction.
|
|
113
|
+
* @throws {Error} - If the input does not have a sourceTXID or sourceTransaction defined.
|
|
114
|
+
*/
|
|
115
|
+
addInput(input: TransactionInput): void;
|
|
116
|
+
/**
|
|
117
|
+
* Adds a new output to the transaction.
|
|
118
|
+
*
|
|
119
|
+
* @param {TransactionOutput} output - The TransactionOutput object to add to the transaction.
|
|
120
|
+
*/
|
|
121
|
+
addOutput(output: TransactionOutput): void;
|
|
122
|
+
/**
|
|
123
|
+
* Updates the transaction's metadata.
|
|
124
|
+
*
|
|
125
|
+
* @param {Record<string, any>} metadata - The metadata object to merge into the existing metadata.
|
|
126
|
+
*/
|
|
127
|
+
updateMetadata(metadata: Record<string, any>): void;
|
|
128
|
+
/**
|
|
129
|
+
* Computes fees prior to signing.
|
|
130
|
+
* If no fee model is provided, uses a SatoshisPerKilobyte fee model that pays 10 sat/kb.
|
|
131
|
+
*
|
|
132
|
+
* @param model - The initialized fee model to use
|
|
133
|
+
* @param changeDistribution - Specifies how the change should be distributed
|
|
134
|
+
* amongst the change outputs
|
|
135
|
+
*
|
|
136
|
+
* TODO: Benford's law change distribution.
|
|
137
|
+
*/
|
|
138
|
+
fee(model?: FeeModel, changeDistribution?: 'equal' | 'random'): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Signs a transaction, hydrating all its unlocking scripts based on the provided script templates where they are available.
|
|
141
|
+
*/
|
|
142
|
+
sign(): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Broadcasts a transaction.
|
|
145
|
+
*
|
|
146
|
+
* @param broadcaster The Broadcaster instance wwhere the transaction will be sent
|
|
147
|
+
* @returns A BroadcastResponse or BroadcastFailure from the Broadcaster
|
|
148
|
+
*/
|
|
149
|
+
broadcast(broadcaster: Broadcaster): Promise<BroadcastResponse | BroadcastFailure>;
|
|
150
|
+
/**
|
|
151
|
+
* Converts the transaction to a binary array format.
|
|
152
|
+
*
|
|
153
|
+
* @returns {number[]} - The binary array representation of the transaction.
|
|
154
|
+
*/
|
|
155
|
+
toBinary(): number[];
|
|
156
|
+
/**
|
|
157
|
+
* Converts the transaction to a BRC-30 EF format.
|
|
158
|
+
*
|
|
159
|
+
* @returns {number[]} - The BRC-30 EF representation of the transaction.
|
|
160
|
+
*/
|
|
161
|
+
toEF(): number[];
|
|
162
|
+
/**
|
|
163
|
+
* Converts the transaction to a hexadecimal string EF.
|
|
164
|
+
*
|
|
165
|
+
* @returns {string} - The hexadecimal string representation of the transaction EF.
|
|
166
|
+
*/
|
|
167
|
+
toHexEF(): string;
|
|
168
|
+
/**
|
|
169
|
+
* Converts the transaction to a hexadecimal string format.
|
|
170
|
+
*
|
|
171
|
+
* @returns {string} - The hexadecimal string representation of the transaction.
|
|
172
|
+
*/
|
|
173
|
+
toHex(): string;
|
|
174
|
+
/**
|
|
175
|
+
* Converts the transaction to a hexadecimal string BEEF.
|
|
176
|
+
*
|
|
177
|
+
* @returns {string} - The hexadecimal string representation of the transaction BEEF.
|
|
178
|
+
*/
|
|
179
|
+
toHexBEEF(): string;
|
|
180
|
+
/**
|
|
181
|
+
* Calculates the transaction's hash.
|
|
182
|
+
*
|
|
183
|
+
* @param {'hex' | undefined} enc - The encoding to use for the hash. If 'hex', returns a hexadecimal string; otherwise returns a binary array.
|
|
184
|
+
* @returns {string | number[]} - The hash of the transaction in the specified format.
|
|
185
|
+
*/
|
|
186
|
+
hash(enc?: 'hex'): number[] | string;
|
|
187
|
+
/**
|
|
188
|
+
* Calculates the transaction's ID in binary array.
|
|
189
|
+
*
|
|
190
|
+
* @returns {number[]} - The ID of the transaction in the binary array format.
|
|
191
|
+
*/
|
|
192
|
+
id(): number[];
|
|
193
|
+
/**
|
|
194
|
+
* Calculates the transaction's ID in hexadecimal format.
|
|
195
|
+
*
|
|
196
|
+
* @param {'hex'} enc - The encoding to use for the ID. If 'hex', returns a hexadecimal string.
|
|
197
|
+
* @returns {string} - The ID of the transaction in the hex format.
|
|
198
|
+
*/
|
|
199
|
+
id(enc: 'hex'): string;
|
|
200
|
+
/**
|
|
201
|
+
* Verifies the legitimacy of the Bitcoin transaction according to the rules of SPV by ensuring all the input transactions link back to valid block headers, the chain of spends for all inputs are valid, and the sum of inputs is not less than the sum of outputs.
|
|
202
|
+
*
|
|
203
|
+
* @param chainTracker - An instance of ChainTracker, a Bitcoin block header tracker. If the value is set to 'scripts only', headers will not be verified.
|
|
204
|
+
*
|
|
205
|
+
* @returns Whether the transaction is valid according to the rules of SPV.
|
|
206
|
+
*/
|
|
207
|
+
verify(chainTracker: ChainTracker | 'scripts only'): Promise<boolean>;
|
|
208
|
+
/**
|
|
209
|
+
* Serializes this transaction, together with its inputs and the respective merkle proofs, into the BEEF (BRC-62) format. This enables efficient verification of its compliance with the rules of SPV.
|
|
210
|
+
*
|
|
211
|
+
* @returns The serialized BEEF structure
|
|
212
|
+
*/
|
|
213
|
+
toBEEF(): number[];
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=Transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Transaction.d.ts","sourceRoot":"","sources":["../../../../src/transaction/Transaction.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,uBAAuB,CAAA;AACpD,OAAO,iBAAiB,MAAM,wBAAwB,CAAA;AAKtD,OAAO,QAAQ,MAAM,eAAe,CAAA;AAEpC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnF,OAAO,UAAU,MAAM,iBAAiB,CAAA;AAExC,OAAO,YAAY,MAAM,mBAAmB,CAAA;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,gBAAgB,EAAE,CAAA;IAC1B,OAAO,EAAE,iBAAiB,EAAE,CAAA;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC7B,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,OAAO,CAAC,UAAU,CAAC,CAAU;IAE7B;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAE,IAAI,EAAE,MAAM,EAAE,GAAG,WAAW;IA4D7C;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,GACrC;QACA,MAAM,EAAE;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;QACzD,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAC5D;IAwBD,OAAO,CAAC,MAAM,CAAC,UAAU;IAkCzB;;;;;;OAMG;IACH,MAAM,CAAC,UAAU,CAAE,GAAG,EAAE,MAAM,EAAE,GAAG,WAAW;IAK9C;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CAAE,GAAG,EAAE,MAAM,GAAG,WAAW;IAIzC;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAE,GAAG,EAAE,MAAM,GAAG,WAAW;gBAK3C,OAAO,GAAE,MAAU,EACnB,MAAM,GAAE,gBAAgB,EAAO,EAC/B,OAAO,GAAE,iBAAiB,EAAO,EACjC,QAAQ,GAAE,MAAU,EACpB,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAClC,UAAU,CAAC,EAAE,UAAU;IAUzB;;;;;OAKG;IACH,QAAQ,CAAE,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAexC;;;;OAIG;IACH,SAAS,CAAE,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAK3C;;;;OAIG;IACH,cAAc,CAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAOpD;;;;;;;;;OASG;IACG,GAAG,CAAE,KAAK,CAAC,EAAE,QAAQ,EAAE,kBAAkB,GAAE,OAAO,GAAG,QAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkD7F;;OAEG;IACG,IAAI,IAAK,OAAO,CAAC,IAAI,CAAC;IAyB5B;;;;;OAKG;IACG,SAAS,CAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;IAIzF;;;;OAIG;IACH,QAAQ,IAAK,MAAM,EAAE;IA2BrB;;;;OAIG;IACH,IAAI,IAAK,MAAM,EAAE;IA+BjB;;;;OAIG;IACH,OAAO,IAAK,MAAM;IAIlB;;;;OAIG;IACH,KAAK,IAAK,MAAM;IAIhB;;;;OAIG;IACH,SAAS,IAAK,MAAM;IAIpB;;;;;OAKG;IACH,IAAI,CAAE,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,GAAG,MAAM;IAerC;;;;OAIG;IACH,EAAE,IAAK,MAAM,EAAE;IACf;;;;;OAKG;IACH,EAAE,CAAE,GAAG,EAAE,KAAK,GAAG,MAAM;IAgBvB;;;;;;OAMG;IACG,MAAM,CAAE,YAAY,EAAE,YAAY,GAAG,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IA+D5E;;;;OAIG;IACH,MAAM,IAAK,MAAM,EAAE;CAoEpB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import UnlockingScript from '../script/UnlockingScript.js';
|
|
2
|
+
import Transaction from './Transaction.js';
|
|
3
|
+
/**
|
|
4
|
+
* Represents an input to a Bitcoin transaction.
|
|
5
|
+
* This interface defines the structure and components required to construct
|
|
6
|
+
* a transaction input in the Bitcoin blockchain.
|
|
7
|
+
*
|
|
8
|
+
* @interface TransactionInput
|
|
9
|
+
* @property {Transaction} [sourceTransaction] - Optional. The source transaction
|
|
10
|
+
* from which this input is derived. This is the transaction whose output
|
|
11
|
+
* is being spent by this input. Preferably provided if available.
|
|
12
|
+
* @property {string} [sourceTXID] - Optional. The transaction ID (TXID) of the source
|
|
13
|
+
* transaction. Required if the source transaction itself is not provided.
|
|
14
|
+
* This uniquely identifies the transaction within the blockchain.
|
|
15
|
+
* @property {number} sourceOutputIndex - The index of the output in the source transaction
|
|
16
|
+
* that this input is spending. It is zero-based, indicating the position of the
|
|
17
|
+
* output in the array of outputs of the source transaction.
|
|
18
|
+
* @property {UnlockingScript} [unlockingScript] - Optional. The script that 'unlocks' the
|
|
19
|
+
* source output for spending. This script typically contains signatures and
|
|
20
|
+
* public keys that evidence the ownership of the output.
|
|
21
|
+
* @property {Object} [unlockingScriptTemplate] - Optional. A template for generating the
|
|
22
|
+
* unlocking script. Useful when the unlocking script needs to be generated
|
|
23
|
+
* dynamically.
|
|
24
|
+
* @property {Function} unlockingScriptTemplate.sign - A function that, when given the
|
|
25
|
+
* current transaction and the index of this input, returns a Promise that
|
|
26
|
+
* resolves to the UnlockingScript.
|
|
27
|
+
* @property {Function} unlockingScriptTemplate.estimateLength - A function that estimates
|
|
28
|
+
* the length of the unlocking script, given the transaction and the input index.
|
|
29
|
+
* @property {number} sequence - A sequence number for the input. Used to enable
|
|
30
|
+
* updates to this input. If set to a non-final value (less than 0xFFFFFFFF),
|
|
31
|
+
* it indicates that the input may be replaced in the future.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* // Creating a simple transaction input
|
|
35
|
+
* let txInput = {
|
|
36
|
+
* sourceTXID: '123abc...',
|
|
37
|
+
* sourceOutputIndex: 0,
|
|
38
|
+
* sequence: 0xFFFFFFFF
|
|
39
|
+
* };
|
|
40
|
+
*
|
|
41
|
+
* // Using an unlocking script template
|
|
42
|
+
* txInput.unlockingScriptTemplate = {
|
|
43
|
+
* sign: async (tx, index) => { ... },
|
|
44
|
+
* estimateLength: async (tx, index) => { ... }
|
|
45
|
+
* };
|
|
46
|
+
*
|
|
47
|
+
* @description
|
|
48
|
+
* This interface links an input to a
|
|
49
|
+
* previous output and provides mechanisms (through unlocking scripts) to authorize the
|
|
50
|
+
* spending of that output.
|
|
51
|
+
*/
|
|
52
|
+
export default interface TransactionInput {
|
|
53
|
+
sourceTransaction?: Transaction;
|
|
54
|
+
sourceTXID?: string;
|
|
55
|
+
sourceOutputIndex: number;
|
|
56
|
+
unlockingScript?: UnlockingScript;
|
|
57
|
+
unlockingScriptTemplate?: {
|
|
58
|
+
sign: (tx: Transaction, inputIndex: number) => Promise<UnlockingScript>;
|
|
59
|
+
estimateLength: (tx: Transaction, inputIndex: number) => Promise<number>;
|
|
60
|
+
};
|
|
61
|
+
sequence: number;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=TransactionInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransactionInput.d.ts","sourceRoot":"","sources":["../../../../src/transaction/TransactionInput.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,8BAA8B,CAAA;AAC1D,OAAO,WAAW,MAAM,kBAAkB,CAAA;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,MAAM,CAAC,OAAO,WAAW,gBAAgB;IACvC,iBAAiB,CAAC,EAAE,WAAW,CAAA;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iBAAiB,EAAE,MAAM,CAAA;IACzB,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,uBAAuB,CAAC,EAAE;QACxB,IAAI,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;QACvE,cAAc,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;KACzE,CAAA;IACD,QAAQ,EAAE,MAAM,CAAA;CACjB"}
|