-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add tabs for swift and kotlin to the starter (quickstart) example
- Loading branch information
1 parent
0a37f84
commit 82624dd
Showing
5 changed files
with
210 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
// for jvm | ||
implementation 'org.bitcoindevkit:bdk-jvm:<version>' | ||
// OR for android | ||
implementation 'org.bitcoindevkit:bdk-android:<version>' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// --8<-- [start:file] | ||
|
||
// --8<-- [start:descriptors] | ||
val descriptor = "tr([12071a7c/86'/1'/0']tpubDCaLkqfh67Qr7ZuRrUNrCYQ54sMjHfsJ4yQSGb3aBr1yqt3yXpamRBUwnGSnyNnxQYu7rqeBiPfw3mjBcFNX4ky2vhjj9bDrGstkfUbLB9T/0/*)#z3x5097m" | ||
val changeDescriptor = "tr([12071a7c/86'/1'/0']tpubDCaLkqfh67Qr7ZuRrUNrCYQ54sMjHfsJ4yQSGb3aBr1yqt3yXpamRBUwnGSnyNnxQYu7rqeBiPfw3mjBcFNX4ky2vhjj9bDrGstkfUbLB9T/1/*)#n9r4jswr" | ||
// --8<-- [end:descriptors] | ||
|
||
val wallet = Wallet( | ||
descriptor, | ||
changeDescriptor, | ||
Network.SIGNET | ||
) | ||
|
||
// --8<-- [start:address] | ||
val addressInfo = wallet.revealNextAddress(KeychainKind.EXTERNAL) | ||
println("Generated address ${addressInfo.address} at index ${addressInfo.index}") | ||
// --8<-- [end:address] | ||
|
||
// --8<-- [start:client] | ||
val esploraClient: EsploraClient = EsploraClient("https://mutinynet.com/api") | ||
// --8<-- [end:client] | ||
|
||
// --8<-- [start:scan] | ||
val syncRequest = wallet.startSyncWithRevealedSpks() | ||
val update = try esploraClient.sync( | ||
syncRequest, | ||
5uL | ||
) | ||
wallet.applyUpdate(update) | ||
val balance = wallet.balance() | ||
println("Wallet balance: ${balance.total()} sat") | ||
// --8<-- [end:scan] | ||
|
||
// --8<-- [end:file] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// --8<-- [start:file] | ||
|
||
// --8<-- [start:descriptors] | ||
let descriptor = "tr([12071a7c/86'/1'/0']tpubDCaLkqfh67Qr7ZuRrUNrCYQ54sMjHfsJ4yQSGb3aBr1yqt3yXpamRBUwnGSnyNnxQYu7rqeBiPfw3mjBcFNX4ky2vhjj9bDrGstkfUbLB9T/0/*)#z3x5097m" | ||
let changeDescriptor = "tr([12071a7c/86'/1'/0']tpubDCaLkqfh67Qr7ZuRrUNrCYQ54sMjHfsJ4yQSGb3aBr1yqt3yXpamRBUwnGSnyNnxQYu7rqeBiPfw3mjBcFNX4ky2vhjj9bDrGstkfUbLB9T/1/*)#n9r4jswr" | ||
// --8<-- [end:descriptors] | ||
|
||
let wallet = try Wallet( | ||
descriptor: descriptor, | ||
changeDescriptor: changeDescriptor, | ||
network: Network.signet | ||
) | ||
|
||
// --8<-- [start:address] | ||
let addressInfo = wallet.revealNextAddress(keychain: .external) | ||
print("Generated address \(addressInfo.address) at index \(addressInfo.index)") | ||
// --8<-- [end:address] | ||
|
||
// --8<-- [start:client] | ||
let esploraClient = EsploraClient(url: "https://mutinynet.com/api") | ||
// --8<-- [end:client] | ||
|
||
// --8<-- [start:scan] | ||
let syncRequest = wallet.startSyncWithRevealedSpks() | ||
let update = try esploraClient.sync( | ||
syncRequest: syncRequest, | ||
parallelRequests: UInt64(5) | ||
) | ||
try wallet.applyUpdate(update: update) | ||
let balance = wallet.balance() | ||
print("Wallet balance: \(balance.total) sat") | ||
// --8<-- [end:scan] | ||
|
||
// --8<-- [end:file] |