Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add send utxo methods to AbstractKit #637

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package io.horizontalsystems.bitcoincore

import io.horizontalsystems.bitcoincore.core.IPluginData
import io.horizontalsystems.bitcoincore.models.*
import io.horizontalsystems.bitcoincore.models.BitcoinPaymentData
import io.horizontalsystems.bitcoincore.models.PublicKey
import io.horizontalsystems.bitcoincore.models.TransactionDataSortType
import io.horizontalsystems.bitcoincore.models.TransactionFilterType
import io.horizontalsystems.bitcoincore.models.TransactionInfo
import io.horizontalsystems.bitcoincore.models.UsedAddress
import io.horizontalsystems.bitcoincore.network.Network
import io.horizontalsystems.bitcoincore.storage.FullTransaction
import io.horizontalsystems.bitcoincore.storage.UnspentOutput
Expand Down Expand Up @@ -47,6 +52,8 @@ abstract class AbstractKit {
bitcoinCore.onEnterBackground()
}

fun getSpendableUtxo() = bitcoinCore.getSpendableUtxo()

fun transactions(fromUid: String? = null, type: TransactionFilterType? = null, limit: Int? = null): Single<List<TransactionInfo>> {
return bitcoinCore.transactions(fromUid, type, limit)
}
Expand All @@ -55,10 +62,29 @@ abstract class AbstractKit {
return bitcoinCore.getTransaction(hash)
}

fun fee(
unspentOutputs: List<UnspentOutput>,
address: String? = null,
feeRate: Int,
pluginData: Map<Byte, IPluginData>
): Long {
return bitcoinCore.fee(unspentOutputs, address, feeRate, pluginData)
}

fun fee(value: Long, address: String? = null, senderPay: Boolean = true, feeRate: Int, pluginData: Map<Byte, IPluginData> = mapOf()): Long {
return bitcoinCore.fee(value, address, senderPay, feeRate, pluginData)
}

fun send(
address: String,
unspentOutputs: List<UnspentOutput>,
feeRate: Int,
sortType: TransactionDataSortType,
pluginData: Map<Byte, IPluginData>
): FullTransaction {
return bitcoinCore.send(address, unspentOutputs, feeRate, sortType, pluginData)
}

fun send(
address: String,
value: Long,
Expand Down
Loading