Skip to content

Commit d09dad6

Browse files
authored
Merge pull request #60 from synonymdev/feat/sweep-unsupported-addresses
feat: add sweep functionality for unsupported address types
2 parents 539c48d + c245977 commit d09dad6

File tree

26 files changed

+2651
-70
lines changed

26 files changed

+2651
-70
lines changed

Cargo.lock

Lines changed: 246 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bitkitcore"
3-
version = "0.1.33"
3+
version = "0.1.34"
44
edition = "2021"
55

66
[lib]
@@ -34,6 +34,8 @@ bitcoin-address-generator = "0.2.0"
3434
uuid = { version = "1.16.0", features = ["v4"] }
3535
hex = "0.4.3"
3636
bip39 = "2.0"
37+
bdk = { version = "0.30.2", features = ["all-keys"] }
38+
base64 = "0.22"
3739

3840
[dev-dependencies]
3941
tokio = { version = "1.40.0", features = ["full"] }

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import PackageDescription
55

6-
let tag = "v0.1.33"
7-
let checksum = "e5c2119237e84bb4350f7e4e758e451eddfbcaa18ffcc63fed7c779ba3670fef"
6+
let tag = "v0.1.34"
7+
let checksum = "187af3385f9c9bc3f8bf76f4b55c48c79ae0f3e5f419cbc91ae2ce2f69f706b3"
88
let url = "https://github.com/synonymdev/bitkit-core/releases/download/\(tag)/BitkitCore.xcframework.zip"
99

1010
let package = Package(

bindings/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ android.useAndroidX=true
33
android.enableJetifier=true
44
kotlin.code.style=official
55
group=com.synonym
6-
version=0.1.33
6+
version=0.1.34
4.94 MB
Binary file not shown.
Binary file not shown.
5.68 MB
Binary file not shown.
5.12 MB
Binary file not shown.

bindings/android/lib/src/main/kotlin/com/synonym/bitkitcore/bitkitcore.android.kt

Lines changed: 269 additions & 0 deletions
Large diffs are not rendered by default.

bindings/android/lib/src/main/kotlin/com/synonym/bitkitcore/bitkitcore.common.kt

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,6 +1571,102 @@ public data class SignedTransactionResponse (
15711571

15721572

15731573

1574+
@kotlinx.serialization.Serializable
1575+
public data class SweepResult (
1576+
/**
1577+
* The transaction ID of the sweep transaction
1578+
*/
1579+
val `txid`: kotlin.String,
1580+
/**
1581+
* The total amount swept (in satoshis)
1582+
*/
1583+
val `amountSwept`: kotlin.ULong,
1584+
/**
1585+
* The fee paid (in satoshis)
1586+
*/
1587+
val `feePaid`: kotlin.ULong,
1588+
/**
1589+
* The number of UTXOs swept
1590+
*/
1591+
val `utxosSwept`: kotlin.UInt
1592+
) {
1593+
public companion object
1594+
}
1595+
1596+
1597+
1598+
@kotlinx.serialization.Serializable
1599+
public data class SweepTransactionPreview (
1600+
/**
1601+
* The PSBT (Partially Signed Bitcoin Transaction) in base64 format
1602+
*/
1603+
val `psbt`: kotlin.String,
1604+
/**
1605+
* The total amount available to sweep (in satoshis)
1606+
*/
1607+
val `totalAmount`: kotlin.ULong,
1608+
/**
1609+
* The estimated fee for the transaction (in satoshis) - calculated with provided or default fee rate
1610+
*/
1611+
val `estimatedFee`: kotlin.ULong,
1612+
/**
1613+
* The number of UTXOs that will be swept
1614+
*/
1615+
val `utxosCount`: kotlin.UInt,
1616+
/**
1617+
* The destination address
1618+
*/
1619+
val `destinationAddress`: kotlin.String,
1620+
/**
1621+
* The amount that will be sent to destination after fees (in satoshis)
1622+
*/
1623+
val `amountAfterFees`: kotlin.ULong
1624+
) {
1625+
public companion object
1626+
}
1627+
1628+
1629+
1630+
@kotlinx.serialization.Serializable
1631+
public data class SweepableBalances (
1632+
/**
1633+
* Balance in legacy (P2PKH) addresses (in satoshis)
1634+
*/
1635+
val `legacyBalance`: kotlin.ULong,
1636+
/**
1637+
* Balance in P2SH-SegWit (P2SH-P2WPKH) addresses (in satoshis)
1638+
*/
1639+
val `p2shBalance`: kotlin.ULong,
1640+
/**
1641+
* Balance in Taproot (P2TR) addresses (in satoshis)
1642+
*/
1643+
val `taprootBalance`: kotlin.ULong,
1644+
/**
1645+
* Total balance across all wallet types (in satoshis)
1646+
*/
1647+
val `totalBalance`: kotlin.ULong,
1648+
/**
1649+
* Number of UTXOs in legacy wallet
1650+
*/
1651+
val `legacyUtxosCount`: kotlin.UInt,
1652+
/**
1653+
* Number of UTXOs in P2SH-SegWit wallet
1654+
*/
1655+
val `p2shUtxosCount`: kotlin.UInt,
1656+
/**
1657+
* Number of UTXOs in Taproot wallet
1658+
*/
1659+
val `taprootUtxosCount`: kotlin.UInt,
1660+
/**
1661+
* Total number of UTXOs across all wallet types
1662+
*/
1663+
val `totalUtxosCount`: kotlin.UInt
1664+
) {
1665+
public companion object
1666+
}
1667+
1668+
1669+
15741670
/**
15751671
* Text memo
15761672
*/
@@ -2875,6 +2971,33 @@ public enum class SortDirection {
28752971

28762972

28772973

2974+
2975+
public sealed class SweepException: kotlin.Exception() {
2976+
2977+
public class SweepFailed(
2978+
public val v1: kotlin.String,
2979+
) : SweepException() {
2980+
override val message: String
2981+
get() = "v1=${ v1 }"
2982+
}
2983+
2984+
public class NoUtxosFound(
2985+
) : SweepException() {
2986+
override val message: String
2987+
get() = ""
2988+
}
2989+
2990+
public class InvalidMnemonic(
2991+
) : SweepException() {
2992+
override val message: String
2993+
get() = ""
2994+
}
2995+
2996+
}
2997+
2998+
2999+
3000+
28783001
/**
28793002
* Token filter options for getAccountInfo
28803003
*/

0 commit comments

Comments
 (0)