@tatumio/shared-blockchain-btc-based
Advanced tools
Comparing version 2.0.1-alpha.262 to 2.0.1-alpha.263
{ | ||
"name": "@tatumio/shared-blockchain-btc-based", | ||
"version": "2.0.1-alpha.262", | ||
"version": "2.0.1-alpha.263", | ||
"license": "MIT", | ||
@@ -8,10 +8,10 @@ "main": "./src/index.js", | ||
"dependencies": { | ||
"@tatumio/shared-abstract-sdk": "2.0.1-alpha.262", | ||
"@tatumio/api-client": "2.0.1-alpha.262", | ||
"@tatumio/shared-abstract-sdk": "2.0.1-alpha.263", | ||
"@tatumio/api-client": "2.0.1-alpha.263", | ||
"axios": "^0.26.0", | ||
"form-data": "^4.0.0", | ||
"@tatumio/shared-testing-common": "2.0.1-alpha.262", | ||
"@tatumio/shared-testing-common": "2.0.1-alpha.263", | ||
"bignumber.js": "^9.0.2", | ||
"@tatumio/shared-core": "2.0.1-alpha.262", | ||
"@tatumio/shared-blockchain-abstract": "2.0.1-alpha.262", | ||
"@tatumio/shared-core": "2.0.1-alpha.263", | ||
"@tatumio/shared-blockchain-abstract": "2.0.1-alpha.263", | ||
"bip32": "^2.0.5", | ||
@@ -18,0 +18,0 @@ "bip39": "^3.0.2", |
@@ -1,2 +0,2 @@ | ||
import { ApiServices, BtcTransactionFromAddress, BtcTransactionFromAddressKMS, BtcTransactionFromUTXO, BtcTransactionFromUTXOKMS, TransactionHashKMS } from '@tatumio/api-client'; | ||
import { ApiServices, BtcTransactionFromAddress, BtcTransactionFromAddressKMS, BtcTransactionFromUTXO, BtcTransactionFromUTXOKMS, LtcTransactionAddress, LtcTransactionAddressKMS, LtcTransactionUTXO, LtcTransactionUTXOKMS, TransactionHashKMS } from '@tatumio/api-client'; | ||
export declare type BtcBasedTx<T> = { | ||
@@ -11,7 +11,14 @@ sendTransaction: (body: T, options: { | ||
export declare type BtcTransactionTypes = BtcTransactionFromAddress | BtcTransactionFromAddressKMS | BtcTransactionFromUTXO | BtcTransactionFromUTXOKMS; | ||
export declare const transactions: (apiCalls?: { | ||
btcGetTxByAddress: typeof ApiServices.blockchain.bitcoin.btcGetTxByAddress; | ||
btcGetUtxo: typeof ApiServices.blockchain.bitcoin.btcGetUtxo; | ||
btcBroadcast: typeof ApiServices.blockchain.bitcoin.btcBroadcast; | ||
btcGetRawTransaction: typeof ApiServices.blockchain.bitcoin.btcGetRawTransaction; | ||
}) => BtcBasedTx<BtcTransactionTypes>; | ||
export declare type LtcTransactionTypes = LtcTransactionAddress | LtcTransactionAddressKMS | LtcTransactionUTXO | LtcTransactionUTXOKMS; | ||
declare type BtcBasedTransactionTypes = BtcTransactionTypes | LtcTransactionTypes; | ||
declare type GetTxByAddressType = typeof ApiServices.blockchain.bitcoin.btcGetTxByAddress | typeof ApiServices.blockchain.ltc.ltcGetTxByAddress; | ||
declare type GetUtxoType = typeof ApiServices.blockchain.bitcoin.btcGetUtxo | typeof ApiServices.blockchain.ltc.ltcGetUtxo; | ||
declare type BroadcastType = typeof ApiServices.blockchain.bitcoin.btcBroadcast | typeof ApiServices.blockchain.ltc.ltcBroadcast; | ||
declare type GetRawTransactionType = typeof ApiServices.blockchain.bitcoin.btcGetRawTransaction | typeof ApiServices.blockchain.ltc.ltcGetRawTransaction; | ||
export declare const btcBasedTransactions: (apiCalls: { | ||
getTxByAddress: GetTxByAddressType; | ||
getUtxo: GetUtxoType; | ||
broadcast: BroadcastType; | ||
getRawTransaction: GetRawTransactionType; | ||
}) => BtcBasedTx<BtcBasedTransactionTypes>; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.transactions = void 0; | ||
exports.btcBasedTransactions = void 0; | ||
const tslib_1 = require("tslib"); | ||
const api_client_1 = require("@tatumio/api-client"); | ||
const bitcore_lib_1 = require("bitcore-lib"); | ||
@@ -10,8 +9,3 @@ const shared_abstract_sdk_1 = require("@tatumio/shared-abstract-sdk"); | ||
//TODO prepare to use between btc based | ||
const transactions = (apiCalls = { | ||
btcGetTxByAddress: api_client_1.ApiServices.blockchain.bitcoin.btcGetTxByAddress, | ||
btcGetUtxo: api_client_1.ApiServices.blockchain.bitcoin.btcGetUtxo, | ||
btcBroadcast: api_client_1.ApiServices.blockchain.bitcoin.btcBroadcast, | ||
btcGetRawTransaction: api_client_1.ApiServices.blockchain.bitcoin.btcGetRawTransaction, | ||
}) => { | ||
const btcBasedTransactions = (apiCalls) => { | ||
const privateKeysFromAddress = (transaction, body) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () { | ||
@@ -21,3 +15,3 @@ try { | ||
for (const item of body.fromAddress) { | ||
const txs = yield apiCalls.btcGetTxByAddress(item.address, 50); // @TODO OPENAPI remove pageSize | ||
const txs = yield apiCalls.getTxByAddress(item.address, 50); // @TODO OPENAPI remove pageSize | ||
for (const tx of txs) { | ||
@@ -88,3 +82,3 @@ if (!tx.outputs) | ||
try { | ||
return yield apiCalls.btcGetUtxo(hash, i); | ||
return yield apiCalls.getUtxo(hash, i); | ||
} | ||
@@ -136,3 +130,3 @@ catch (e) { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
return apiCalls.btcBroadcast({ | ||
return apiCalls.broadcast({ | ||
txData: yield prepareSignedTransaction(body, options), | ||
@@ -144,3 +138,3 @@ }); | ||
/** | ||
* Send Bitcoin transaction to the blockchain. This method broadcasts signed transaction to the blockchain. | ||
* Send bitcoin based transaction to the blockchain. This method broadcasts signed transaction to the blockchain. | ||
* This operation is irreversible. | ||
@@ -152,3 +146,3 @@ * @param body content of the transaction to broadcast | ||
/** | ||
* Prepare a signed Btc transaction with the private key locally. Nothing is broadcasted to the blockchain. | ||
* Prepare a signed bitcoin based transaction with the private key locally. Nothing is broadcasted to the blockchain. | ||
* @returns raw transaction data in hex, to be broadcasted to blockchain. | ||
@@ -159,3 +153,3 @@ */ | ||
}; | ||
exports.transactions = transactions; | ||
exports.btcBasedTransactions = btcBasedTransactions; | ||
//# sourceMappingURL=btc-based.tx.js.map |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34953
479
+ Added@tatumio/api-client@2.0.1-alpha.263(transitive)
+ Added@tatumio/shared-abstract-sdk@2.0.1-alpha.263(transitive)
+ Added@tatumio/shared-blockchain-abstract@2.0.1-alpha.263(transitive)
+ Added@tatumio/shared-core@2.0.1-alpha.263(transitive)
+ Added@tatumio/shared-testing-common@2.0.1-alpha.263(transitive)
- Removed@tatumio/api-client@2.0.1-alpha.262(transitive)
- Removed@tatumio/shared-abstract-sdk@2.0.1-alpha.262(transitive)
- Removed@tatumio/shared-blockchain-abstract@2.0.1-alpha.262(transitive)
- Removed@tatumio/shared-core@2.0.1-alpha.262(transitive)
- Removed@tatumio/shared-testing-common@2.0.1-alpha.262(transitive)