@ledgerhq/coin-kaspa 1.1.0-nightly.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +20 -0
- package/.turbo/turbo-build.log +4 -0
- package/.unimportedrc.json +87 -0
- package/CHANGELOG.md +978 -0
- package/LICENSE.txt +21 -0
- package/jest-global-setup.js +9 -0
- package/jest.config.js +21 -0
- package/jest.integ.config.js +8 -0
- package/lib/bridge/broadcast.d.ts +8 -0
- package/lib/bridge/broadcast.d.ts.map +1 -0
- package/lib/bridge/broadcast.js +16 -0
- package/lib/bridge/broadcast.js.map +1 -0
- package/lib/bridge/buildInitialOperation.d.ts +5 -0
- package/lib/bridge/buildInitialOperation.d.ts.map +1 -0
- package/lib/bridge/buildInitialOperation.js +31 -0
- package/lib/bridge/buildInitialOperation.js.map +1 -0
- package/lib/bridge/buildTransaction.d.ts +16 -0
- package/lib/bridge/buildTransaction.d.ts.map +1 -0
- package/lib/bridge/buildTransaction.js +63 -0
- package/lib/bridge/buildTransaction.js.map +1 -0
- package/lib/bridge/createTransaction.d.ts +4 -0
- package/lib/bridge/createTransaction.d.ts.map +1 -0
- package/lib/bridge/createTransaction.js +15 -0
- package/lib/bridge/createTransaction.js.map +1 -0
- package/lib/bridge/estimateMaxSpendable.d.ts +4 -0
- package/lib/bridge/estimateMaxSpendable.d.ts.map +1 -0
- package/lib/bridge/estimateMaxSpendable.js +19 -0
- package/lib/bridge/estimateMaxSpendable.js.map +1 -0
- package/lib/bridge/getTransactionStatus.d.ts +4 -0
- package/lib/bridge/getTransactionStatus.d.ts.map +1 -0
- package/lib/bridge/getTransactionStatus.js +68 -0
- package/lib/bridge/getTransactionStatus.js.map +1 -0
- package/lib/bridge/index.d.ts +9 -0
- package/lib/bridge/index.d.ts.map +1 -0
- package/lib/bridge/index.js +75 -0
- package/lib/bridge/index.js.map +1 -0
- package/lib/bridge/initAccount.d.ts +2 -0
- package/lib/bridge/initAccount.d.ts.map +1 -0
- package/lib/bridge/initAccount.js +6 -0
- package/lib/bridge/initAccount.js.map +1 -0
- package/lib/bridge/prepareTransaction.d.ts +14 -0
- package/lib/bridge/prepareTransaction.d.ts.map +1 -0
- package/lib/bridge/prepareTransaction.js +46 -0
- package/lib/bridge/prepareTransaction.js.map +1 -0
- package/lib/bridge/signOperation.d.ts +8 -0
- package/lib/bridge/signOperation.d.ts.map +1 -0
- package/lib/bridge/signOperation.js +34 -0
- package/lib/bridge/signOperation.js.map +1 -0
- package/lib/bridge/synchronization.d.ts +4 -0
- package/lib/bridge/synchronization.d.ts.map +1 -0
- package/lib/bridge/synchronization.js +66 -0
- package/lib/bridge/synchronization.js.map +1 -0
- package/lib/config.d.ts +8 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +9 -0
- package/lib/config.js.map +1 -0
- package/lib/deviceTransactionConfig.d.ts +11 -0
- package/lib/deviceTransactionConfig.d.ts.map +1 -0
- package/lib/deviceTransactionConfig.js +32 -0
- package/lib/deviceTransactionConfig.js.map +1 -0
- package/lib/errors.d.ts +8 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +8 -0
- package/lib/errors.js.map +1 -0
- package/lib/hw-getAddress.d.ts +6 -0
- package/lib/hw-getAddress.d.ts.map +1 -0
- package/lib/hw-getAddress.js +14 -0
- package/lib/hw-getAddress.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/lib/logic/base32.d.ts +30 -0
- package/lib/logic/base32.d.ts.map +1 -0
- package/lib/logic/base32.js +99 -0
- package/lib/logic/base32.js.map +1 -0
- package/lib/logic/bip32.d.ts +9 -0
- package/lib/logic/bip32.d.ts.map +1 -0
- package/lib/logic/bip32.js +23 -0
- package/lib/logic/bip32.js.map +1 -0
- package/lib/logic/getAllTransactions.d.ts +3 -0
- package/lib/logic/getAllTransactions.d.ts.map +1 -0
- package/lib/logic/getAllTransactions.js +19 -0
- package/lib/logic/getAllTransactions.js.map +1 -0
- package/lib/logic/getFeeRate.d.ts +4 -0
- package/lib/logic/getFeeRate.d.ts.map +1 -0
- package/lib/logic/getFeeRate.js +19 -0
- package/lib/logic/getFeeRate.js.map +1 -0
- package/lib/logic/index.d.ts +11 -0
- package/lib/logic/index.d.ts.map +1 -0
- package/lib/logic/index.js +27 -0
- package/lib/logic/index.js.map +1 -0
- package/lib/logic/kaspaAddresses.d.ts +30 -0
- package/lib/logic/kaspaAddresses.d.ts.map +1 -0
- package/lib/logic/kaspaAddresses.js +231 -0
- package/lib/logic/kaspaAddresses.js.map +1 -0
- package/lib/logic/massCalcluation.d.ts +4 -0
- package/lib/logic/massCalcluation.d.ts.map +1 -0
- package/lib/logic/massCalcluation.js +40 -0
- package/lib/logic/massCalcluation.js.map +1 -0
- package/lib/logic/scanAddresses.d.ts +13 -0
- package/lib/logic/scanAddresses.d.ts.map +1 -0
- package/lib/logic/scanAddresses.js +147 -0
- package/lib/logic/scanAddresses.js.map +1 -0
- package/lib/logic/scanOperations.d.ts +3 -0
- package/lib/logic/scanOperations.d.ts.map +1 -0
- package/lib/logic/scanOperations.js +43 -0
- package/lib/logic/scanOperations.js.map +1 -0
- package/lib/logic/scanUtxos.d.ts +8 -0
- package/lib/logic/scanUtxos.d.ts.map +1 -0
- package/lib/logic/scanUtxos.js +39 -0
- package/lib/logic/scanUtxos.js.map +1 -0
- package/lib/logic/tests/bip32.test.d.ts +2 -0
- package/lib/logic/tests/bip32.test.d.ts.map +1 -0
- package/lib/logic/tests/bip32.test.js +64 -0
- package/lib/logic/tests/bip32.test.js.map +1 -0
- package/lib/logic/tests/getFeeRate.test.d.ts +2 -0
- package/lib/logic/tests/getFeeRate.test.d.ts.map +1 -0
- package/lib/logic/tests/getFeeRate.test.js +57 -0
- package/lib/logic/tests/getFeeRate.test.js.map +1 -0
- package/lib/logic/tests/kaspaAddresses.test.d.ts +2 -0
- package/lib/logic/tests/kaspaAddresses.test.d.ts.map +1 -0
- package/lib/logic/tests/kaspaAddresses.test.js +172 -0
- package/lib/logic/tests/kaspaAddresses.test.js.map +1 -0
- package/lib/logic/tests/massCalcluation.test.d.ts +2 -0
- package/lib/logic/tests/massCalcluation.test.d.ts.map +1 -0
- package/lib/logic/tests/massCalcluation.test.js +27 -0
- package/lib/logic/tests/massCalcluation.test.js.map +1 -0
- package/lib/logic/tests/scanAddresses.integ.test.d.ts +2 -0
- package/lib/logic/tests/scanAddresses.integ.test.d.ts.map +1 -0
- package/lib/logic/tests/scanAddresses.integ.test.js +18 -0
- package/lib/logic/tests/scanAddresses.integ.test.js.map +1 -0
- package/lib/logic/tests/scanOperations.integ.test.d.ts +2 -0
- package/lib/logic/tests/scanOperations.integ.test.d.ts.map +1 -0
- package/lib/logic/tests/scanOperations.integ.test.js +254 -0
- package/lib/logic/tests/scanOperations.integ.test.js.map +1 -0
- package/lib/logic/tests/scanOperations.test.d.ts +2 -0
- package/lib/logic/tests/scanOperations.test.d.ts.map +1 -0
- package/lib/logic/tests/scanOperations.test.js +184 -0
- package/lib/logic/tests/scanOperations.test.js.map +1 -0
- package/lib/logic/tests/scanUtxos.integ.test.d.ts +2 -0
- package/lib/logic/tests/scanUtxos.integ.test.d.ts.map +1 -0
- package/lib/logic/tests/scanUtxos.integ.test.js +13 -0
- package/lib/logic/tests/scanUtxos.integ.test.js.map +1 -0
- package/lib/logic/tests/scanUtxos.test.d.ts +2 -0
- package/lib/logic/tests/scanUtxos.test.d.ts.map +1 -0
- package/lib/logic/tests/scanUtxos.test.js +167 -0
- package/lib/logic/tests/scanUtxos.test.js.map +1 -0
- package/lib/logic/tests/utxoLib.test.d.ts +2 -0
- package/lib/logic/tests/utxoLib.test.d.ts.map +1 -0
- package/lib/logic/tests/utxoLib.test.js +26 -0
- package/lib/logic/tests/utxoLib.test.js.map +1 -0
- package/lib/logic/tests/utxoSelection.test.d.ts +10 -0
- package/lib/logic/tests/utxoSelection.test.d.ts.map +1 -0
- package/lib/logic/tests/utxoSelection.test.js +256 -0
- package/lib/logic/tests/utxoSelection.test.js.map +1 -0
- package/lib/logic/tests/validAddress.test.d.ts +2 -0
- package/lib/logic/tests/validAddress.test.d.ts.map +1 -0
- package/lib/logic/tests/validAddress.test.js +56 -0
- package/lib/logic/tests/validAddress.test.js.map +1 -0
- package/lib/logic/utxos/lib.d.ts +6 -0
- package/lib/logic/utxos/lib.d.ts.map +1 -0
- package/lib/logic/utxos/lib.js +27 -0
- package/lib/logic/utxos/lib.js.map +1 -0
- package/lib/logic/utxos/selection.d.ts +8 -0
- package/lib/logic/utxos/selection.d.ts.map +1 -0
- package/lib/logic/utxos/selection.js +80 -0
- package/lib/logic/utxos/selection.js.map +1 -0
- package/lib/network/config.d.ts +3 -0
- package/lib/network/config.d.ts.map +1 -0
- package/lib/network/config.js +8 -0
- package/lib/network/config.js.map +1 -0
- package/lib/network/getAddressesActive.d.ts +3 -0
- package/lib/network/getAddressesActive.d.ts.map +1 -0
- package/lib/network/getAddressesActive.js +25 -0
- package/lib/network/getAddressesActive.js.map +1 -0
- package/lib/network/getBalancesForAddresses.d.ts +3 -0
- package/lib/network/getBalancesForAddresses.d.ts.map +1 -0
- package/lib/network/getBalancesForAddresses.js +25 -0
- package/lib/network/getBalancesForAddresses.js.map +1 -0
- package/lib/network/getBlockDagInfo.d.ts +3 -0
- package/lib/network/getBlockDagInfo.d.ts.map +1 -0
- package/lib/network/getBlockDagInfo.js +24 -0
- package/lib/network/getBlockDagInfo.js.map +1 -0
- package/lib/network/getFeeEstimate.d.ts +3 -0
- package/lib/network/getFeeEstimate.d.ts.map +1 -0
- package/lib/network/getFeeEstimate.js +23 -0
- package/lib/network/getFeeEstimate.js.map +1 -0
- package/lib/network/getTransactions.d.ts +6 -0
- package/lib/network/getTransactions.d.ts.map +1 -0
- package/lib/network/getTransactions.js +19 -0
- package/lib/network/getTransactions.js.map +1 -0
- package/lib/network/getUtxosForAddresses.d.ts +3 -0
- package/lib/network/getUtxosForAddresses.d.ts.map +1 -0
- package/lib/network/getUtxosForAddresses.js +25 -0
- package/lib/network/getUtxosForAddresses.js.map +1 -0
- package/lib/network/getVirtualChainBlueScore.d.ts +2 -0
- package/lib/network/getVirtualChainBlueScore.d.ts.map +1 -0
- package/lib/network/getVirtualChainBlueScore.js +24 -0
- package/lib/network/getVirtualChainBlueScore.js.map +1 -0
- package/lib/network/index.d.ts +9 -0
- package/lib/network/index.d.ts.map +1 -0
- package/lib/network/index.js +20 -0
- package/lib/network/index.js.map +1 -0
- package/lib/network/submitTransaction.d.ts +3 -0
- package/lib/network/submitTransaction.d.ts.map +1 -0
- package/lib/network/submitTransaction.js +27 -0
- package/lib/network/submitTransaction.js.map +1 -0
- package/lib/network/tests/getAddressesActive.test.d.ts +2 -0
- package/lib/network/tests/getAddressesActive.test.d.ts.map +1 -0
- package/lib/network/tests/getAddressesActive.test.js +65 -0
- package/lib/network/tests/getAddressesActive.test.js.map +1 -0
- package/lib/network/tests/getBalancesForAddresss.test.d.ts +2 -0
- package/lib/network/tests/getBalancesForAddresss.test.d.ts.map +1 -0
- package/lib/network/tests/getBalancesForAddresss.test.js +40 -0
- package/lib/network/tests/getBalancesForAddresss.test.js.map +1 -0
- package/lib/network/tests/getBlockDagInfo.test.d.ts +2 -0
- package/lib/network/tests/getBlockDagInfo.test.d.ts.map +1 -0
- package/lib/network/tests/getBlockDagInfo.test.js +36 -0
- package/lib/network/tests/getBlockDagInfo.test.js.map +1 -0
- package/lib/network/tests/getFeeEstimate.test.d.ts +2 -0
- package/lib/network/tests/getFeeEstimate.test.d.ts.map +1 -0
- package/lib/network/tests/getFeeEstimate.test.js +54 -0
- package/lib/network/tests/getFeeEstimate.test.js.map +1 -0
- package/lib/network/tests/getTransactions.test.d.ts +2 -0
- package/lib/network/tests/getTransactions.test.d.ts.map +1 -0
- package/lib/network/tests/getTransactions.test.js +157 -0
- package/lib/network/tests/getTransactions.test.js.map +1 -0
- package/lib/network/tests/getUtxosForAddress.test.d.ts +2 -0
- package/lib/network/tests/getUtxosForAddress.test.d.ts.map +1 -0
- package/lib/network/tests/getUtxosForAddress.test.js +142 -0
- package/lib/network/tests/getUtxosForAddress.test.js.map +1 -0
- package/lib/network/tests/getVirtualChainBlueScore.test.d.ts +2 -0
- package/lib/network/tests/getVirtualChainBlueScore.test.d.ts.map +1 -0
- package/lib/network/tests/getVirtualChainBlueScore.test.js +27 -0
- package/lib/network/tests/getVirtualChainBlueScore.test.js.map +1 -0
- package/lib/network/tests/submitTransaction.test.d.ts +2 -0
- package/lib/network/tests/submitTransaction.test.d.ts.map +1 -0
- package/lib/network/tests/submitTransaction.test.js +43 -0
- package/lib/network/tests/submitTransaction.test.js.map +1 -0
- package/lib/test/bridgeDatasetTest.d.ts +4 -0
- package/lib/test/bridgeDatasetTest.d.ts.map +1 -0
- package/lib/test/bridgeDatasetTest.js +46 -0
- package/lib/test/bridgeDatasetTest.js.map +1 -0
- package/lib/test/cli.d.ts +16 -0
- package/lib/test/cli.d.ts.map +1 -0
- package/lib/test/cli.js +30 -0
- package/lib/test/cli.js.map +1 -0
- package/lib/test/index.d.ts +2 -0
- package/lib/test/index.d.ts.map +1 -0
- package/lib/test/index.js +18 -0
- package/lib/test/index.js.map +1 -0
- package/lib/transaction.d.ts +16 -0
- package/lib/transaction.d.ts.map +1 -0
- package/lib/transaction.js +66 -0
- package/lib/transaction.js.map +1 -0
- package/lib/types/addresses.d.ts +18 -0
- package/lib/types/addresses.d.ts.map +1 -0
- package/lib/types/addresses.js +3 -0
- package/lib/types/addresses.js.map +1 -0
- package/lib/types/bridge.d.ts +34 -0
- package/lib/types/bridge.d.ts.map +1 -0
- package/lib/types/bridge.js +3 -0
- package/lib/types/bridge.js.map +1 -0
- package/lib/types/errors.d.ts +10 -0
- package/lib/types/errors.d.ts.map +1 -0
- package/lib/types/errors.js +8 -0
- package/lib/types/errors.js.map +1 -0
- package/lib/types/index.d.ts +8 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +18 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/kaspaHwTransaction.d.ts +89 -0
- package/lib/types/kaspaHwTransaction.d.ts.map +1 -0
- package/lib/types/kaspaHwTransaction.js +167 -0
- package/lib/types/kaspaHwTransaction.js.map +1 -0
- package/lib/types/kaspaNetwork.d.ts +22 -0
- package/lib/types/kaspaNetwork.d.ts.map +1 -0
- package/lib/types/kaspaNetwork.js +3 -0
- package/lib/types/kaspaNetwork.js.map +1 -0
- package/lib/types/network.d.ts +91 -0
- package/lib/types/network.d.ts.map +1 -0
- package/lib/types/network.js +3 -0
- package/lib/types/network.js.map +1 -0
- package/lib/types/signer.d.ts +14 -0
- package/lib/types/signer.d.ts.map +1 -0
- package/lib/types/signer.js +3 -0
- package/lib/types/signer.js.map +1 -0
- package/lib-es/bridge/broadcast.d.ts +8 -0
- package/lib-es/bridge/broadcast.d.ts.map +1 -0
- package/lib-es/bridge/broadcast.js +12 -0
- package/lib-es/bridge/broadcast.js.map +1 -0
- package/lib-es/bridge/buildInitialOperation.d.ts +5 -0
- package/lib-es/bridge/buildInitialOperation.d.ts.map +1 -0
- package/lib-es/bridge/buildInitialOperation.js +27 -0
- package/lib-es/bridge/buildInitialOperation.js.map +1 -0
- package/lib-es/bridge/buildTransaction.d.ts +16 -0
- package/lib-es/bridge/buildTransaction.d.ts.map +1 -0
- package/lib-es/bridge/buildTransaction.js +59 -0
- package/lib-es/bridge/buildTransaction.js.map +1 -0
- package/lib-es/bridge/createTransaction.d.ts +4 -0
- package/lib-es/bridge/createTransaction.d.ts.map +1 -0
- package/lib-es/bridge/createTransaction.js +11 -0
- package/lib-es/bridge/createTransaction.js.map +1 -0
- package/lib-es/bridge/estimateMaxSpendable.d.ts +4 -0
- package/lib-es/bridge/estimateMaxSpendable.d.ts.map +1 -0
- package/lib-es/bridge/estimateMaxSpendable.js +15 -0
- package/lib-es/bridge/estimateMaxSpendable.js.map +1 -0
- package/lib-es/bridge/getTransactionStatus.d.ts +4 -0
- package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -0
- package/lib-es/bridge/getTransactionStatus.js +66 -0
- package/lib-es/bridge/getTransactionStatus.js.map +1 -0
- package/lib-es/bridge/index.d.ts +9 -0
- package/lib-es/bridge/index.d.ts.map +1 -0
- package/lib-es/bridge/index.js +68 -0
- package/lib-es/bridge/index.js.map +1 -0
- package/lib-es/bridge/initAccount.d.ts +2 -0
- package/lib-es/bridge/initAccount.d.ts.map +1 -0
- package/lib-es/bridge/initAccount.js +2 -0
- package/lib-es/bridge/initAccount.js.map +1 -0
- package/lib-es/bridge/prepareTransaction.d.ts +14 -0
- package/lib-es/bridge/prepareTransaction.d.ts.map +1 -0
- package/lib-es/bridge/prepareTransaction.js +39 -0
- package/lib-es/bridge/prepareTransaction.js.map +1 -0
- package/lib-es/bridge/signOperation.d.ts +8 -0
- package/lib-es/bridge/signOperation.d.ts.map +1 -0
- package/lib-es/bridge/signOperation.js +27 -0
- package/lib-es/bridge/signOperation.js.map +1 -0
- package/lib-es/bridge/synchronization.d.ts +4 -0
- package/lib-es/bridge/synchronization.d.ts.map +1 -0
- package/lib-es/bridge/synchronization.js +62 -0
- package/lib-es/bridge/synchronization.js.map +1 -0
- package/lib-es/config.d.ts +8 -0
- package/lib-es/config.d.ts.map +1 -0
- package/lib-es/config.js +4 -0
- package/lib-es/config.js.map +1 -0
- package/lib-es/deviceTransactionConfig.d.ts +11 -0
- package/lib-es/deviceTransactionConfig.d.ts.map +1 -0
- package/lib-es/deviceTransactionConfig.js +30 -0
- package/lib-es/deviceTransactionConfig.js.map +1 -0
- package/lib-es/errors.d.ts +8 -0
- package/lib-es/errors.d.ts.map +1 -0
- package/lib-es/errors.js +5 -0
- package/lib-es/errors.js.map +1 -0
- package/lib-es/hw-getAddress.d.ts +6 -0
- package/lib-es/hw-getAddress.d.ts.map +1 -0
- package/lib-es/hw-getAddress.js +12 -0
- package/lib-es/hw-getAddress.js.map +1 -0
- package/lib-es/index.d.ts +2 -0
- package/lib-es/index.d.ts.map +1 -0
- package/lib-es/index.js +2 -0
- package/lib-es/index.js.map +1 -0
- package/lib-es/logic/base32.d.ts +30 -0
- package/lib-es/logic/base32.d.ts.map +1 -0
- package/lib-es/logic/base32.js +95 -0
- package/lib-es/logic/base32.js.map +1 -0
- package/lib-es/logic/bip32.d.ts +9 -0
- package/lib-es/logic/bip32.d.ts.map +1 -0
- package/lib-es/logic/bip32.js +17 -0
- package/lib-es/logic/bip32.js.map +1 -0
- package/lib-es/logic/getAllTransactions.d.ts +3 -0
- package/lib-es/logic/getAllTransactions.d.ts.map +1 -0
- package/lib-es/logic/getAllTransactions.js +15 -0
- package/lib-es/logic/getAllTransactions.js.map +1 -0
- package/lib-es/logic/getFeeRate.d.ts +4 -0
- package/lib-es/logic/getFeeRate.d.ts.map +1 -0
- package/lib-es/logic/getFeeRate.js +15 -0
- package/lib-es/logic/getFeeRate.js.map +1 -0
- package/lib-es/logic/index.d.ts +11 -0
- package/lib-es/logic/index.d.ts.map +1 -0
- package/lib-es/logic/index.js +11 -0
- package/lib-es/logic/index.js.map +1 -0
- package/lib-es/logic/kaspaAddresses.d.ts +30 -0
- package/lib-es/logic/kaspaAddresses.d.ts.map +1 -0
- package/lib-es/logic/kaspaAddresses.js +219 -0
- package/lib-es/logic/kaspaAddresses.js.map +1 -0
- package/lib-es/logic/massCalcluation.d.ts +4 -0
- package/lib-es/logic/massCalcluation.d.ts.map +1 -0
- package/lib-es/logic/massCalcluation.js +35 -0
- package/lib-es/logic/massCalcluation.js.map +1 -0
- package/lib-es/logic/scanAddresses.d.ts +13 -0
- package/lib-es/logic/scanAddresses.d.ts.map +1 -0
- package/lib-es/logic/scanAddresses.js +140 -0
- package/lib-es/logic/scanAddresses.js.map +1 -0
- package/lib-es/logic/scanOperations.d.ts +3 -0
- package/lib-es/logic/scanOperations.d.ts.map +1 -0
- package/lib-es/logic/scanOperations.js +39 -0
- package/lib-es/logic/scanOperations.js.map +1 -0
- package/lib-es/logic/scanUtxos.d.ts +8 -0
- package/lib-es/logic/scanUtxos.d.ts.map +1 -0
- package/lib-es/logic/scanUtxos.js +35 -0
- package/lib-es/logic/scanUtxos.js.map +1 -0
- package/lib-es/logic/tests/bip32.test.d.ts +2 -0
- package/lib-es/logic/tests/bip32.test.d.ts.map +1 -0
- package/lib-es/logic/tests/bip32.test.js +59 -0
- package/lib-es/logic/tests/bip32.test.js.map +1 -0
- package/lib-es/logic/tests/getFeeRate.test.d.ts +2 -0
- package/lib-es/logic/tests/getFeeRate.test.d.ts.map +1 -0
- package/lib-es/logic/tests/getFeeRate.test.js +55 -0
- package/lib-es/logic/tests/getFeeRate.test.js.map +1 -0
- package/lib-es/logic/tests/kaspaAddresses.test.d.ts +2 -0
- package/lib-es/logic/tests/kaspaAddresses.test.d.ts.map +1 -0
- package/lib-es/logic/tests/kaspaAddresses.test.js +170 -0
- package/lib-es/logic/tests/kaspaAddresses.test.js.map +1 -0
- package/lib-es/logic/tests/massCalcluation.test.d.ts +2 -0
- package/lib-es/logic/tests/massCalcluation.test.d.ts.map +1 -0
- package/lib-es/logic/tests/massCalcluation.test.js +22 -0
- package/lib-es/logic/tests/massCalcluation.test.js.map +1 -0
- package/lib-es/logic/tests/scanAddresses.integ.test.d.ts +2 -0
- package/lib-es/logic/tests/scanAddresses.integ.test.d.ts.map +1 -0
- package/lib-es/logic/tests/scanAddresses.integ.test.js +16 -0
- package/lib-es/logic/tests/scanAddresses.integ.test.js.map +1 -0
- package/lib-es/logic/tests/scanOperations.integ.test.d.ts +2 -0
- package/lib-es/logic/tests/scanOperations.integ.test.d.ts.map +1 -0
- package/lib-es/logic/tests/scanOperations.integ.test.js +249 -0
- package/lib-es/logic/tests/scanOperations.integ.test.js.map +1 -0
- package/lib-es/logic/tests/scanOperations.test.d.ts +2 -0
- package/lib-es/logic/tests/scanOperations.test.d.ts.map +1 -0
- package/lib-es/logic/tests/scanOperations.test.js +156 -0
- package/lib-es/logic/tests/scanOperations.test.js.map +1 -0
- package/lib-es/logic/tests/scanUtxos.integ.test.d.ts +2 -0
- package/lib-es/logic/tests/scanUtxos.integ.test.d.ts.map +1 -0
- package/lib-es/logic/tests/scanUtxos.integ.test.js +11 -0
- package/lib-es/logic/tests/scanUtxos.integ.test.js.map +1 -0
- package/lib-es/logic/tests/scanUtxos.test.d.ts +2 -0
- package/lib-es/logic/tests/scanUtxos.test.d.ts.map +1 -0
- package/lib-es/logic/tests/scanUtxos.test.js +139 -0
- package/lib-es/logic/tests/scanUtxos.test.js.map +1 -0
- package/lib-es/logic/tests/utxoLib.test.d.ts +2 -0
- package/lib-es/logic/tests/utxoLib.test.d.ts.map +1 -0
- package/lib-es/logic/tests/utxoLib.test.js +24 -0
- package/lib-es/logic/tests/utxoLib.test.js.map +1 -0
- package/lib-es/logic/tests/utxoSelection.test.d.ts +10 -0
- package/lib-es/logic/tests/utxoSelection.test.d.ts.map +1 -0
- package/lib-es/logic/tests/utxoSelection.test.js +229 -0
- package/lib-es/logic/tests/utxoSelection.test.js.map +1 -0
- package/lib-es/logic/tests/validAddress.test.d.ts +2 -0
- package/lib-es/logic/tests/validAddress.test.d.ts.map +1 -0
- package/lib-es/logic/tests/validAddress.test.js +54 -0
- package/lib-es/logic/tests/validAddress.test.js.map +1 -0
- package/lib-es/logic/utxos/lib.d.ts +6 -0
- package/lib-es/logic/utxos/lib.d.ts.map +1 -0
- package/lib-es/logic/utxos/lib.js +21 -0
- package/lib-es/logic/utxos/lib.js.map +1 -0
- package/lib-es/logic/utxos/selection.d.ts +8 -0
- package/lib-es/logic/utxos/selection.d.ts.map +1 -0
- package/lib-es/logic/utxos/selection.js +76 -0
- package/lib-es/logic/utxos/selection.js.map +1 -0
- package/lib-es/network/config.d.ts +3 -0
- package/lib-es/network/config.d.ts.map +1 -0
- package/lib-es/network/config.js +5 -0
- package/lib-es/network/config.js.map +1 -0
- package/lib-es/network/getAddressesActive.d.ts +3 -0
- package/lib-es/network/getAddressesActive.d.ts.map +1 -0
- package/lib-es/network/getAddressesActive.js +21 -0
- package/lib-es/network/getAddressesActive.js.map +1 -0
- package/lib-es/network/getBalancesForAddresses.d.ts +3 -0
- package/lib-es/network/getBalancesForAddresses.d.ts.map +1 -0
- package/lib-es/network/getBalancesForAddresses.js +21 -0
- package/lib-es/network/getBalancesForAddresses.js.map +1 -0
- package/lib-es/network/getBlockDagInfo.d.ts +3 -0
- package/lib-es/network/getBlockDagInfo.d.ts.map +1 -0
- package/lib-es/network/getBlockDagInfo.js +20 -0
- package/lib-es/network/getBlockDagInfo.js.map +1 -0
- package/lib-es/network/getFeeEstimate.d.ts +3 -0
- package/lib-es/network/getFeeEstimate.d.ts.map +1 -0
- package/lib-es/network/getFeeEstimate.js +19 -0
- package/lib-es/network/getFeeEstimate.js.map +1 -0
- package/lib-es/network/getTransactions.d.ts +6 -0
- package/lib-es/network/getTransactions.d.ts.map +1 -0
- package/lib-es/network/getTransactions.js +15 -0
- package/lib-es/network/getTransactions.js.map +1 -0
- package/lib-es/network/getUtxosForAddresses.d.ts +3 -0
- package/lib-es/network/getUtxosForAddresses.d.ts.map +1 -0
- package/lib-es/network/getUtxosForAddresses.js +21 -0
- package/lib-es/network/getUtxosForAddresses.js.map +1 -0
- package/lib-es/network/getVirtualChainBlueScore.d.ts +2 -0
- package/lib-es/network/getVirtualChainBlueScore.d.ts.map +1 -0
- package/lib-es/network/getVirtualChainBlueScore.js +20 -0
- package/lib-es/network/getVirtualChainBlueScore.js.map +1 -0
- package/lib-es/network/index.d.ts +9 -0
- package/lib-es/network/index.d.ts.map +1 -0
- package/lib-es/network/index.js +9 -0
- package/lib-es/network/index.js.map +1 -0
- package/lib-es/network/submitTransaction.d.ts +3 -0
- package/lib-es/network/submitTransaction.d.ts.map +1 -0
- package/lib-es/network/submitTransaction.js +23 -0
- package/lib-es/network/submitTransaction.js.map +1 -0
- package/lib-es/network/tests/getAddressesActive.test.d.ts +2 -0
- package/lib-es/network/tests/getAddressesActive.test.d.ts.map +1 -0
- package/lib-es/network/tests/getAddressesActive.test.js +63 -0
- package/lib-es/network/tests/getAddressesActive.test.js.map +1 -0
- package/lib-es/network/tests/getBalancesForAddresss.test.d.ts +2 -0
- package/lib-es/network/tests/getBalancesForAddresss.test.d.ts.map +1 -0
- package/lib-es/network/tests/getBalancesForAddresss.test.js +38 -0
- package/lib-es/network/tests/getBalancesForAddresss.test.js.map +1 -0
- package/lib-es/network/tests/getBlockDagInfo.test.d.ts +2 -0
- package/lib-es/network/tests/getBlockDagInfo.test.d.ts.map +1 -0
- package/lib-es/network/tests/getBlockDagInfo.test.js +34 -0
- package/lib-es/network/tests/getBlockDagInfo.test.js.map +1 -0
- package/lib-es/network/tests/getFeeEstimate.test.d.ts +2 -0
- package/lib-es/network/tests/getFeeEstimate.test.d.ts.map +1 -0
- package/lib-es/network/tests/getFeeEstimate.test.js +52 -0
- package/lib-es/network/tests/getFeeEstimate.test.js.map +1 -0
- package/lib-es/network/tests/getTransactions.test.d.ts +2 -0
- package/lib-es/network/tests/getTransactions.test.d.ts.map +1 -0
- package/lib-es/network/tests/getTransactions.test.js +155 -0
- package/lib-es/network/tests/getTransactions.test.js.map +1 -0
- package/lib-es/network/tests/getUtxosForAddress.test.d.ts +2 -0
- package/lib-es/network/tests/getUtxosForAddress.test.d.ts.map +1 -0
- package/lib-es/network/tests/getUtxosForAddress.test.js +140 -0
- package/lib-es/network/tests/getUtxosForAddress.test.js.map +1 -0
- package/lib-es/network/tests/getVirtualChainBlueScore.test.d.ts +2 -0
- package/lib-es/network/tests/getVirtualChainBlueScore.test.d.ts.map +1 -0
- package/lib-es/network/tests/getVirtualChainBlueScore.test.js +25 -0
- package/lib-es/network/tests/getVirtualChainBlueScore.test.js.map +1 -0
- package/lib-es/network/tests/submitTransaction.test.d.ts +2 -0
- package/lib-es/network/tests/submitTransaction.test.d.ts.map +1 -0
- package/lib-es/network/tests/submitTransaction.test.js +41 -0
- package/lib-es/network/tests/submitTransaction.test.js.map +1 -0
- package/lib-es/test/bridgeDatasetTest.d.ts +4 -0
- package/lib-es/test/bridgeDatasetTest.d.ts.map +1 -0
- package/lib-es/test/bridgeDatasetTest.js +43 -0
- package/lib-es/test/bridgeDatasetTest.js.map +1 -0
- package/lib-es/test/cli.d.ts +16 -0
- package/lib-es/test/cli.d.ts.map +1 -0
- package/lib-es/test/cli.js +25 -0
- package/lib-es/test/cli.js.map +1 -0
- package/lib-es/test/index.d.ts +2 -0
- package/lib-es/test/index.d.ts.map +1 -0
- package/lib-es/test/index.js +2 -0
- package/lib-es/test/index.js.map +1 -0
- package/lib-es/transaction.d.ts +16 -0
- package/lib-es/transaction.d.ts.map +1 -0
- package/lib-es/transaction.js +59 -0
- package/lib-es/transaction.js.map +1 -0
- package/lib-es/types/addresses.d.ts +18 -0
- package/lib-es/types/addresses.d.ts.map +1 -0
- package/lib-es/types/addresses.js +2 -0
- package/lib-es/types/addresses.js.map +1 -0
- package/lib-es/types/bridge.d.ts +34 -0
- package/lib-es/types/bridge.d.ts.map +1 -0
- package/lib-es/types/bridge.js +2 -0
- package/lib-es/types/bridge.js.map +1 -0
- package/lib-es/types/errors.d.ts +10 -0
- package/lib-es/types/errors.d.ts.map +1 -0
- package/lib-es/types/errors.js +5 -0
- package/lib-es/types/errors.js.map +1 -0
- package/lib-es/types/index.d.ts +8 -0
- package/lib-es/types/index.d.ts.map +1 -0
- package/lib-es/types/index.js +2 -0
- package/lib-es/types/index.js.map +1 -0
- package/lib-es/types/kaspaHwTransaction.d.ts +89 -0
- package/lib-es/types/kaspaHwTransaction.d.ts.map +1 -0
- package/lib-es/types/kaspaHwTransaction.js +160 -0
- package/lib-es/types/kaspaHwTransaction.js.map +1 -0
- package/lib-es/types/kaspaNetwork.d.ts +22 -0
- package/lib-es/types/kaspaNetwork.d.ts.map +1 -0
- package/lib-es/types/kaspaNetwork.js +2 -0
- package/lib-es/types/kaspaNetwork.js.map +1 -0
- package/lib-es/types/network.d.ts +91 -0
- package/lib-es/types/network.d.ts.map +1 -0
- package/lib-es/types/network.js +2 -0
- package/lib-es/types/network.js.map +1 -0
- package/lib-es/types/signer.d.ts +14 -0
- package/lib-es/types/signer.d.ts.map +1 -0
- package/lib-es/types/signer.js +2 -0
- package/lib-es/types/signer.js.map +1 -0
- package/package.json +138 -0
- package/src/bridge/broadcast.ts +14 -0
- package/src/bridge/buildInitialOperation.ts +38 -0
- package/src/bridge/buildTransaction.ts +80 -0
- package/src/bridge/createTransaction.ts +13 -0
- package/src/bridge/estimateMaxSpendable.ts +23 -0
- package/src/bridge/getTransactionStatus.ts +116 -0
- package/src/bridge/index.ts +106 -0
- package/src/bridge/initAccount.ts +1 -0
- package/src/bridge/prepareTransaction.ts +48 -0
- package/src/bridge/signOperation.ts +43 -0
- package/src/bridge/synchronization.ts +80 -0
- package/src/config.ts +7 -0
- package/src/deviceTransactionConfig.ts +44 -0
- package/src/errors.ts +6 -0
- package/src/hw-getAddress.ts +17 -0
- package/src/index.ts +1 -0
- package/src/logic/base32.ts +100 -0
- package/src/logic/bip32.ts +21 -0
- package/src/logic/getAllTransactions.ts +22 -0
- package/src/logic/getFeeRate.ts +20 -0
- package/src/logic/index.ts +10 -0
- package/src/logic/kaspaAddresses.ts +274 -0
- package/src/logic/massCalcluation.ts +50 -0
- package/src/logic/scanAddresses.ts +173 -0
- package/src/logic/scanOperations.ts +59 -0
- package/src/logic/scanUtxos.ts +44 -0
- package/src/logic/tests/bip32.test.ts +78 -0
- package/src/logic/tests/getFeeRate.test.ts +64 -0
- package/src/logic/tests/kaspaAddresses.test.ts +278 -0
- package/src/logic/tests/massCalcluation.test.ts +37 -0
- package/src/logic/tests/scanAddresses.integ.test.ts +27 -0
- package/src/logic/tests/scanOperations.integ.test.ts +271 -0
- package/src/logic/tests/scanOperations.test.ts +191 -0
- package/src/logic/tests/scanUtxos.integ.test.ts +14 -0
- package/src/logic/tests/scanUtxos.test.ts +153 -0
- package/src/logic/tests/utxoLib.test.ts +29 -0
- package/src/logic/tests/utxoSelection.test.ts +290 -0
- package/src/logic/tests/validAddress.test.ts +55 -0
- package/src/logic/utxos/lib.ts +40 -0
- package/src/logic/utxos/selection.ts +100 -0
- package/src/network/config.ts +6 -0
- package/src/network/getAddressesActive.ts +27 -0
- package/src/network/getBalancesForAddresses.ts +27 -0
- package/src/network/getBlockDagInfo.ts +22 -0
- package/src/network/getFeeEstimate.ts +21 -0
- package/src/network/getTransactions.ts +25 -0
- package/src/network/getUtxosForAddresses.ts +23 -0
- package/src/network/getVirtualChainBlueScore.ts +21 -0
- package/src/network/index.ts +8 -0
- package/src/network/submitTransaction.ts +27 -0
- package/src/network/tests/getAddressesActive.test.ts +77 -0
- package/src/network/tests/getBalancesForAddresss.test.ts +44 -0
- package/src/network/tests/getBlockDagInfo.test.ts +40 -0
- package/src/network/tests/getFeeEstimate.test.ts +57 -0
- package/src/network/tests/getTransactions.test.ts +173 -0
- package/src/network/tests/getUtxosForAddress.test.ts +159 -0
- package/src/network/tests/getVirtualChainBlueScore.test.ts +29 -0
- package/src/network/tests/submitTransaction.test.ts +53 -0
- package/src/test/bridgeDatasetTest.ts +47 -0
- package/src/test/cli.ts +33 -0
- package/src/test/index.ts +1 -0
- package/src/transaction.ts +84 -0
- package/src/types/addresses.ts +19 -0
- package/src/types/bridge.ts +43 -0
- package/src/types/errors.ts +7 -0
- package/src/types/index.ts +7 -0
- package/src/types/kaspaHwTransaction.ts +234 -0
- package/src/types/kaspaNetwork.ts +21 -0
- package/src/types/network.ts +101 -0
- package/src/types/signer.ts +22 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { getFeeRate } from "../getFeeRate";
|
|
2
|
+
import { BigNumber } from "bignumber.js";
|
|
3
|
+
import { Transaction } from "../../types";
|
|
4
|
+
|
|
5
|
+
describe("getFeeRate", () => {
|
|
6
|
+
it("should return 0 for null transaction", () => {
|
|
7
|
+
const result = getFeeRate(null);
|
|
8
|
+
expect(result.toNumber()).toBe(0);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it("should return custom fee rate when feesStrategy is 'custom'", () => {
|
|
12
|
+
const transaction: Transaction = {
|
|
13
|
+
family: "kaspa",
|
|
14
|
+
feesStrategy: "custom",
|
|
15
|
+
customFeeRate: new BigNumber(123),
|
|
16
|
+
amount: new BigNumber(0),
|
|
17
|
+
recipient: "recipient_placeholder",
|
|
18
|
+
networkInfo: [{ label: "custom", amount: new BigNumber(123), estimatedSeconds: 10 }],
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const result = getFeeRate(transaction);
|
|
22
|
+
expect(result.toNumber()).toBe(123);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should return custom fee rate when feesStrategy is 'custom', default value", () => {
|
|
26
|
+
const transaction: Transaction = {
|
|
27
|
+
family: "kaspa",
|
|
28
|
+
feesStrategy: "custom",
|
|
29
|
+
amount: new BigNumber(0),
|
|
30
|
+
recipient: "recipient_placeholder",
|
|
31
|
+
networkInfo: [{ label: "custom", amount: new BigNumber(123), estimatedSeconds: 10 }],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const result = getFeeRate(transaction);
|
|
35
|
+
expect(result.toNumber()).toBe(0);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("should return custom fee rate when feesStrategy is 'fast'", () => {
|
|
39
|
+
const transaction: Transaction = {
|
|
40
|
+
family: "kaspa",
|
|
41
|
+
feesStrategy: "fast",
|
|
42
|
+
customFeeRate: new BigNumber(123),
|
|
43
|
+
amount: new BigNumber(0),
|
|
44
|
+
recipient: "recipient_placeholder",
|
|
45
|
+
networkInfo: [{ label: "fast", amount: new BigNumber(123), estimatedSeconds: 10 }],
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const result = getFeeRate(transaction);
|
|
49
|
+
expect(result.toNumber()).toBe(123);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("should return custom fee rate when feesStrategy is 'fast'", () => {
|
|
53
|
+
const transaction: Transaction = {
|
|
54
|
+
family: "kaspa",
|
|
55
|
+
feesStrategy: "fast",
|
|
56
|
+
customFeeRate: new BigNumber(123),
|
|
57
|
+
amount: new BigNumber(0),
|
|
58
|
+
recipient: "recipient_placeholder",
|
|
59
|
+
networkInfo: [],
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
expect(() => getFeeRate(transaction)).toThrowError("Invalid fee strategy provided");
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addressToPublicKey,
|
|
3
|
+
addressToScriptPublicKey,
|
|
4
|
+
isValidKaspaAddress,
|
|
5
|
+
parseExtendedPublicKey,
|
|
6
|
+
publicKeyToAddress,
|
|
7
|
+
scriptPublicKeyToAddress,
|
|
8
|
+
ScriptTypeVersion,
|
|
9
|
+
} from "../kaspaAddresses";
|
|
10
|
+
|
|
11
|
+
describe("addressToPublicKey", () => {
|
|
12
|
+
it("should be able to round-trip", () => {
|
|
13
|
+
const testAddr = "kaspa:qqs7krzzwqfgk9kf830smtzg64s9rf3r0khfj76cjynf2pfgrr35saatu88xq";
|
|
14
|
+
const pubkey = addressToPublicKey(testAddr);
|
|
15
|
+
const roundtripPublicKey = publicKeyToAddress(Buffer.from(pubkey.publicKey), false);
|
|
16
|
+
|
|
17
|
+
expect(roundtripPublicKey).toBe(testAddr);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("should be able to convert a schnorr-based address to a public key", () => {
|
|
21
|
+
const expectedPublicKey = Buffer.from(
|
|
22
|
+
"21eb0c4270128b16c93c5f0dac48d56051a6237dae997b58912695052818e348",
|
|
23
|
+
"hex",
|
|
24
|
+
);
|
|
25
|
+
const expectedVersion = 0;
|
|
26
|
+
const address = "kaspa:qqs7krzzwqfgk9kf830smtzg64s9rf3r0khfj76cjynf2pfgrr35saatu88xq";
|
|
27
|
+
|
|
28
|
+
const result = addressToPublicKey(address);
|
|
29
|
+
expect(Buffer.from(result.publicKey)).toStrictEqual(expectedPublicKey);
|
|
30
|
+
expect(result.version).toBe(expectedVersion);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("should be able to convert a p2sh address to a public key", () => {
|
|
34
|
+
const expectedPublicKey = Buffer.from(
|
|
35
|
+
"f38031f61ca23d70844f63a477d07f0b2c2decab907c2e096e548b0e08721c79",
|
|
36
|
+
"hex",
|
|
37
|
+
);
|
|
38
|
+
const expectedVersion = 8;
|
|
39
|
+
const address = "kaspa:precqv0krj3r6uyyfa36ga7s0u9jct0v4wg8ctsfde2gkrsgwgw8jgxfzfc98";
|
|
40
|
+
|
|
41
|
+
const result = addressToPublicKey(address);
|
|
42
|
+
expect(Buffer.from(result.publicKey)).toStrictEqual(expectedPublicKey);
|
|
43
|
+
expect(result.version).toBe(expectedVersion);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("should be able to convert a ECDSA-based address to a public key", () => {
|
|
47
|
+
const expectedPublicKey = Buffer.from(
|
|
48
|
+
"02d5fdc7ad11a65d0bbe7882fc3dbc91b5861d182dcce79f7c1be5bfd30a677cd6",
|
|
49
|
+
"hex",
|
|
50
|
+
);
|
|
51
|
+
const expectedVersion = 1;
|
|
52
|
+
const address = "kaspa:qypdtlw845g6vhgtheug9lpahjgmtpsarqkueeul0sd7t07npfnhe4s7fd82n0v";
|
|
53
|
+
|
|
54
|
+
const result = addressToPublicKey(address);
|
|
55
|
+
expect(Buffer.from(result.publicKey)).toStrictEqual(expectedPublicKey);
|
|
56
|
+
expect(result.version).toBe(expectedVersion);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("should throw error for unknown type", () => {
|
|
60
|
+
const address = "kaspa:dppdtlw845g6vhgtheug9lpahjgmtpsarqkueeul0sd7t07npfnhe4s7fd82n0v";
|
|
61
|
+
expect(() => addressToPublicKey(address)).toThrowError(
|
|
62
|
+
/Unable to translate address to ScriptPublicKey/,
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe("publicKeyToAddress", () => {
|
|
68
|
+
it("should be able to convert to a schnorr-based address", () => {
|
|
69
|
+
const expectedAddress = "kaspa:qqs7krzzwqfgk9kf830smtzg64s9rf3r0khfj76cjynf2pfgrr35saatu88xq";
|
|
70
|
+
const publicKey = Buffer.from(
|
|
71
|
+
"21eb0c4270128b16c93c5f0dac48d56051a6237dae997b58912695052818e348",
|
|
72
|
+
"hex",
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
expect(publicKeyToAddress(publicKey)).toBe(expectedAddress);
|
|
76
|
+
expect(publicKeyToAddress(publicKey, false)).toBe(expectedAddress);
|
|
77
|
+
expect(publicKeyToAddress(publicKey, false, ScriptTypeVersion.SCHNORR)).toBe(expectedAddress);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("should be able to convert to a schnorr-based address without prefix", () => {
|
|
81
|
+
const expectedAddress = "qqs7krzzwqfgk9kf830smtzg64s9rf3r0khfj76cjynf2pfgrr35saatu88xq";
|
|
82
|
+
const publicKey = Buffer.from(
|
|
83
|
+
"21eb0c4270128b16c93c5f0dac48d56051a6237dae997b58912695052818e348",
|
|
84
|
+
"hex",
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
expect(publicKeyToAddress(publicKey, true)).toBe(expectedAddress);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("should be able to convert to a p2sh address", () => {
|
|
91
|
+
const expectedAddress = "kaspa:precqv0krj3r6uyyfa36ga7s0u9jct0v4wg8ctsfde2gkrsgwgw8jgxfzfc98";
|
|
92
|
+
const publicKey = Buffer.from(
|
|
93
|
+
"f38031f61ca23d70844f63a477d07f0b2c2decab907c2e096e548b0e08721c79",
|
|
94
|
+
"hex",
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
expect(publicKeyToAddress(publicKey, false, ScriptTypeVersion.P2SH)).toBe(expectedAddress);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it("should be able to convert to a ECDSA-based address", () => {
|
|
101
|
+
const expectedAddress = "kaspa:qypdtlw845g6vhgtheug9lpahjgmtpsarqkueeul0sd7t07npfnhe4s7fd82n0v";
|
|
102
|
+
const publicKey = Buffer.from(
|
|
103
|
+
"02d5fdc7ad11a65d0bbe7882fc3dbc91b5861d182dcce79f7c1be5bfd30a677cd6",
|
|
104
|
+
"hex",
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
expect(publicKeyToAddress(publicKey, false, ScriptTypeVersion.ECDSA)).toBe(expectedAddress);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
describe("addressToScriptPublicKey", () => {
|
|
112
|
+
it("should be able to convert a schnorr address into script public key", () => {
|
|
113
|
+
const expectedScriptPublicKey =
|
|
114
|
+
"2021eb0c4270128b16c93c5f0dac48d56051a6237dae997b58912695052818e348ac";
|
|
115
|
+
const address = "kaspa:qqs7krzzwqfgk9kf830smtzg64s9rf3r0khfj76cjynf2pfgrr35saatu88xq";
|
|
116
|
+
|
|
117
|
+
const result = addressToScriptPublicKey(address);
|
|
118
|
+
expect(result).toBe(expectedScriptPublicKey);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it("should be able to convert an ecdsa address into script public key", () => {
|
|
122
|
+
const expectedScriptPublicKey =
|
|
123
|
+
"2102d5fdc7ad11a65d0bbe7882fc3dbc91b5861d182dcce79f7c1be5bfd30a677cd6ab";
|
|
124
|
+
const address = "kaspa:qypdtlw845g6vhgtheug9lpahjgmtpsarqkueeul0sd7t07npfnhe4s7fd82n0v";
|
|
125
|
+
|
|
126
|
+
const result = addressToScriptPublicKey(address);
|
|
127
|
+
expect(result).toBe(expectedScriptPublicKey);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("should be able to convert a p2sh address into script public key", () => {
|
|
131
|
+
const expectedScriptPublicKey =
|
|
132
|
+
"aa20f38031f61ca23d70844f63a477d07f0b2c2decab907c2e096e548b0e08721c7987";
|
|
133
|
+
const address = "kaspa:precqv0krj3r6uyyfa36ga7s0u9jct0v4wg8ctsfde2gkrsgwgw8jgxfzfc98";
|
|
134
|
+
|
|
135
|
+
const result = addressToScriptPublicKey(address);
|
|
136
|
+
expect(result).toBe(expectedScriptPublicKey);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
//4120
|
|
141
|
+
|
|
142
|
+
describe("parseExtendedPublicKey", () => {
|
|
143
|
+
it("should correctly parse an extended public key", () => {
|
|
144
|
+
const extendedPublicKey = Buffer.from(
|
|
145
|
+
"41" + // length of public key
|
|
146
|
+
"0404cd27f15b8a73039972cdd131a93754ef3fa90bee794222737f5ca26a12f887f2fd493acf13230fa42c418d2c1be53a6fc66fbbec3ea9c37a675acc53a65e08" +
|
|
147
|
+
"20" + // length of chain code
|
|
148
|
+
"3a35a71b1d8c10f7b03cf84c50570ee21af9b830b25bbe16ec661e7de8a51563",
|
|
149
|
+
"hex",
|
|
150
|
+
);
|
|
151
|
+
const expectedParsedKey = {
|
|
152
|
+
uncompressedPublicKey: Buffer.from(
|
|
153
|
+
"0404cd27f15b8a73039972cdd131a93754ef3fa90bee794222737f5ca26a12f887f2fd493acf13230fa42c418d2c1be53a6fc66fbbec3ea9c37a675acc53a65e08",
|
|
154
|
+
"hex",
|
|
155
|
+
),
|
|
156
|
+
chainCode: Buffer.from(
|
|
157
|
+
"3a35a71b1d8c10f7b03cf84c50570ee21af9b830b25bbe16ec661e7de8a51563",
|
|
158
|
+
"hex",
|
|
159
|
+
),
|
|
160
|
+
compressedPublicKey: Buffer.from(
|
|
161
|
+
"0204cd27f15b8a73039972cdd131a93754ef3fa90bee794222737f5ca26a12f887",
|
|
162
|
+
"hex",
|
|
163
|
+
),
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const result = parseExtendedPublicKey(extendedPublicKey);
|
|
167
|
+
|
|
168
|
+
expect(result.uncompressedPublicKey).toStrictEqual(expectedParsedKey.uncompressedPublicKey);
|
|
169
|
+
expect(result.chainCode).toStrictEqual(expectedParsedKey.chainCode);
|
|
170
|
+
expect(result.compressedPublicKey).toStrictEqual(expectedParsedKey.compressedPublicKey);
|
|
171
|
+
});
|
|
172
|
+
it("throw error when inputs is broken", () => {
|
|
173
|
+
const extendedPublicKey = Buffer.from("41", "hex");
|
|
174
|
+
|
|
175
|
+
expect(() => parseExtendedPublicKey(extendedPublicKey)).toThrowError(
|
|
176
|
+
/Invalid extended public key length. Expected length is 99 bytes./,
|
|
177
|
+
);
|
|
178
|
+
});
|
|
179
|
+
it("another public key", () => {
|
|
180
|
+
const extendedPublicKey = Buffer.from(
|
|
181
|
+
"41" +
|
|
182
|
+
"04bb257a3f0b6bc2104539be649e6f7fe0b42e38c660500598fb1dc833b7ecbb1ae936620f824c868b223e57fe3596aef893a0158acf399811ed5c9aecd3aa7daa" +
|
|
183
|
+
"20" +
|
|
184
|
+
"27a38ef4c76455946be71692ee422b1fc40dc30952a8bf1ce961a534476035c8",
|
|
185
|
+
"hex",
|
|
186
|
+
);
|
|
187
|
+
const expectedParsedKey = {
|
|
188
|
+
uncompressedPublicKey: Buffer.from(
|
|
189
|
+
"04bb257a3f0b6bc2104539be649e6f7fe0b42e38c660500598fb1dc833b7ecbb1ae936620f824c868b223e57fe3596aef893a0158acf399811ed5c9aecd3aa7daa",
|
|
190
|
+
"hex",
|
|
191
|
+
),
|
|
192
|
+
chainCode: Buffer.from(
|
|
193
|
+
"27a38ef4c76455946be71692ee422b1fc40dc30952a8bf1ce961a534476035c8",
|
|
194
|
+
"hex",
|
|
195
|
+
),
|
|
196
|
+
compressedPublicKey: Buffer.from(
|
|
197
|
+
"02bb257a3f0b6bc2104539be649e6f7fe0b42e38c660500598fb1dc833b7ecbb1a",
|
|
198
|
+
"hex",
|
|
199
|
+
),
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const result = parseExtendedPublicKey(extendedPublicKey);
|
|
203
|
+
|
|
204
|
+
expect(result.uncompressedPublicKey).toStrictEqual(expectedParsedKey.uncompressedPublicKey);
|
|
205
|
+
expect(result.chainCode).toStrictEqual(expectedParsedKey.chainCode);
|
|
206
|
+
expect(result.compressedPublicKey).toStrictEqual(expectedParsedKey.compressedPublicKey);
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
describe("isValidKaspaAddress", () => {
|
|
211
|
+
it("Schnorr - should verify that a valid Kaspa address returns true", () => {
|
|
212
|
+
const address = "kaspa:qqs7krzzwqfgk9kf830smtzg64s9rf3r0khfj76cjynf2pfgrr35saatu88xq";
|
|
213
|
+
const verificationStatus = isValidKaspaAddress(address);
|
|
214
|
+
expect(verificationStatus).toBe(true);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// it("ECDSA - should verify that a valid Kaspa address returns true", () => {
|
|
218
|
+
// const address = "kaspa:qpc6twj20gxqpeyxvgqe3v4y2ng8t0tawfax89jkf8f24wazmcreu9ggw3crl00";
|
|
219
|
+
// const verificationStatus = isValidKaspaAddress(address);
|
|
220
|
+
// expect(verificationStatus).toBe(true);
|
|
221
|
+
// });
|
|
222
|
+
|
|
223
|
+
it("should verify that an invalid Kaspa address returns false", () => {
|
|
224
|
+
const address = "invalid:qqs7krzzwqfgk9kf830smtzg64s9rf3r0khfj76cjynf2pfgrr35saatu88xq";
|
|
225
|
+
const verificationStatus = isValidKaspaAddress(address);
|
|
226
|
+
expect(verificationStatus).toBe(false);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it("should verify that a Kaspa address without prefix returns false", () => {
|
|
230
|
+
const address = "qqs7krzzwqfgk9kf830smtzg64s9rf3r0khfj76cjynf2pfgrr35saatu88xq";
|
|
231
|
+
const verificationStatus = isValidKaspaAddress(address);
|
|
232
|
+
expect(verificationStatus).toBe(false);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it("Error", () => {
|
|
236
|
+
const address = "kaspa:rqs7krzzwqfgk9kf830smttg64s9rf3r0khfj76cjynf2pfgrr35saatu88xq";
|
|
237
|
+
const verificationStatus = isValidKaspaAddress(address);
|
|
238
|
+
expect(verificationStatus).toBe(false);
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
describe("scriptPublicKeyToAddress", () => {
|
|
243
|
+
it("should correctly convert a schnorr scriptPublicKey to an address", () => {
|
|
244
|
+
const scriptPublicKey = "202c0b0a4c1f84e31b7234adb319ae970b6943592f0eae5e8513fcc476d0d211a5ac";
|
|
245
|
+
const expectedAddress = "kaspa:qqkqkzjvr7zwxxmjxjkmxxdwju9kjs6e9u82uh59z07vgaks6gg62v8707g73";
|
|
246
|
+
|
|
247
|
+
const result = scriptPublicKeyToAddress(scriptPublicKey);
|
|
248
|
+
|
|
249
|
+
expect(result).toBe(expectedAddress);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
it("should correctly convert a ECDSA scriptPublicKey to an address", () => {
|
|
253
|
+
const scriptPublicKey =
|
|
254
|
+
"2103bfa30686df5a375dc145bf69722d99c482c2b12c37ec9e6c5d459133b18230bdab";
|
|
255
|
+
const expectedAddress = "kaspa:qypmlgcxsm045d6ac9zm76tj9kvufqkzkykr0my7d3w5tyfnkxprp0g9lhr329c";
|
|
256
|
+
|
|
257
|
+
const result = scriptPublicKeyToAddress(scriptPublicKey);
|
|
258
|
+
|
|
259
|
+
expect(result).toBe(expectedAddress);
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it("should correctly convert a P2SH scriptPublicKey to an address", () => {
|
|
263
|
+
const scriptPublicKey =
|
|
264
|
+
"aa209c5809e7f2aad6f0eaec0389083d6c2beae8dbabf47cd3d354cf4b15dacee4a987";
|
|
265
|
+
const expectedAddress = "kaspa:pzw9sz08724ddu82aspcjzpads4746xm4068e57n2n85k9w6emj2j450rc47a";
|
|
266
|
+
|
|
267
|
+
const result = scriptPublicKeyToAddress(scriptPublicKey);
|
|
268
|
+
|
|
269
|
+
expect(result).toBe(expectedAddress);
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
it("incorrect scriptPublicKey throws error", () => {
|
|
273
|
+
const scriptPublicKey =
|
|
274
|
+
"aa219c5809e7f2aad6f0eaec0389083d6c2beae8dbabf47cd3d354cf4b15dacee4a987";
|
|
275
|
+
|
|
276
|
+
expect(() => scriptPublicKeyToAddress(scriptPublicKey)).toThrow();
|
|
277
|
+
});
|
|
278
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import expect from "expect";
|
|
2
|
+
import { calcComputeMass, calcStorageMass } from "../massCalcluation";
|
|
3
|
+
import { BigNumber } from "bignumber.js";
|
|
4
|
+
|
|
5
|
+
describe("Check storage mass calculation", () => {
|
|
6
|
+
test("Storage mass for different in- and outputs", () => {
|
|
7
|
+
expect(
|
|
8
|
+
calcStorageMass([BigNumber(1_0000_0000), BigNumber(1_0000_0000)], [BigNumber(9000_0000)]),
|
|
9
|
+
).toBe(0);
|
|
10
|
+
expect(
|
|
11
|
+
calcStorageMass(
|
|
12
|
+
[BigNumber(1_0000_0000), BigNumber(1_0000_0000)],
|
|
13
|
+
[BigNumber(9000_0000), BigNumber(1000)],
|
|
14
|
+
),
|
|
15
|
+
).toBe(999991111);
|
|
16
|
+
expect(
|
|
17
|
+
calcStorageMass(
|
|
18
|
+
[BigNumber(1_1000_0000)],
|
|
19
|
+
[BigNumber(9000_0000), BigNumber(1000), BigNumber(1000), BigNumber(1000)],
|
|
20
|
+
),
|
|
21
|
+
).toBe(3000002021);
|
|
22
|
+
expect(
|
|
23
|
+
calcStorageMass([BigNumber(1_0000_0000)], [BigNumber(7900_0000), BigNumber(2000_0000)]),
|
|
24
|
+
).toBe(52658);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe("Check compute mass calculation", () => {
|
|
28
|
+
test("Storage mass for 1 input", () => {
|
|
29
|
+
expect(calcComputeMass(2, true)).toBe(918 + 2 * 1118);
|
|
30
|
+
expect(calcComputeMass(5, true)).toBe(918 + 5 * 1118);
|
|
31
|
+
expect(calcComputeMass(2, false)).toBe(506 + 2 * 1118);
|
|
32
|
+
expect(calcComputeMass(5, false)).toBe(506 + 5 * 1118);
|
|
33
|
+
expect(calcComputeMass(5, false, true)).toBe(506 + 5 * 1118 + 11);
|
|
34
|
+
expect(calcComputeMass(88, true, true)).toBe(99313);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BigNumber } from "bignumber.js";
|
|
2
|
+
import { parseExtendedPublicKey } from "../kaspaAddresses";
|
|
3
|
+
import { scanAddresses } from "../scanAddresses";
|
|
4
|
+
import { AccountAddresses } from "../../types";
|
|
5
|
+
|
|
6
|
+
describe("scanAddresses function", () => {
|
|
7
|
+
it("Gets information about addresses being active or not", async () => {
|
|
8
|
+
const xpub =
|
|
9
|
+
"410404cd27f15b8a73039972cdd131a93754ef3fa90bee794222737f5ca26a12f887f2fd493acf13230fa42c418d2c1be53a6fc66fbbec3ea9c37a675acc53a65e08203a35a71b1d8c10f7b03cf84c50570ee21af9b830b25bbe16ec661e7de8a51563";
|
|
10
|
+
const { compressedPublicKey, chainCode } = parseExtendedPublicKey(Buffer.from(xpub, "hex"));
|
|
11
|
+
|
|
12
|
+
const accountAddresses: AccountAddresses = await scanAddresses(
|
|
13
|
+
compressedPublicKey,
|
|
14
|
+
chainCode,
|
|
15
|
+
0,
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const sumBalance = accountAddresses.usedReceiveAddresses
|
|
19
|
+
.reduce((acc, v) => acc.plus(v.balance), BigNumber(0))
|
|
20
|
+
.plus(
|
|
21
|
+
accountAddresses.usedChangeAddresses.reduce((acc, v) => acc.plus(v.balance), BigNumber(0)),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
expect(accountAddresses.usedReceiveAddresses.length).toBeGreaterThan(0);
|
|
25
|
+
expect(accountAddresses.totalBalance.eq(sumBalance)).toBe(true);
|
|
26
|
+
}, 10000);
|
|
27
|
+
});
|