Skip to content

Commit

Permalink
Merge pull request #155 from LtbLightning/upgrade-31.3
Browse files Browse the repository at this point in the history
v0.31.3
  • Loading branch information
BitcoinZavior authored Dec 18, 2024
2 parents b9d5af6 + 07c0048 commit 6bf7dbb
Show file tree
Hide file tree
Showing 24 changed files with 2,918 additions and 3,236 deletions.
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
android {
namespace = "io.bdk.f.bdk_flutter_example"
compileSdk = flutter.compileSdkVersion
ndkVersion "25.1.8937393"
ndkVersion = "25.1.8937393"

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
Expand Down
5 changes: 2 additions & 3 deletions example/lib/bdk_library.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class BdkLibrary {
Future<Input> getPsbtInput(
Wallet wallet, LocalUtxo utxo, bool onlyWitnessUtxo) async {
final input =
await wallet.getPsbtInput(utxo: utxo, onlyWitnessUtxo: onlyWitnessUtxo);
wallet.getPsbtInput(utxo: utxo, onlyWitnessUtxo: onlyWitnessUtxo);
return input;
}

Expand All @@ -68,7 +68,6 @@ class BdkLibrary {
List<TransactionDetails> getConfirmedTransactions(Wallet wallet) {
List<TransactionDetails> confirmed = [];
final res = wallet.listTransactions(includeRaw: true);

for (var e in res) {
if (e.confirmationTime != null) confirmed.add(e);
}
Expand Down Expand Up @@ -103,7 +102,7 @@ class BdkLibrary {
.addRecipient(script, BigInt.from(amountSat))
.feeRate(feeRate.satPerVb)
.finish(wallet);
final isFinalized = await wallet.sign(psbt: psbt);
final isFinalized = wallet.sign(psbt: psbt);
if (isFinalized) {
final tx = psbt.extractTx();
final res = await blockchain.broadcast(transaction: tx);
Expand Down
7 changes: 4 additions & 3 deletions example/lib/wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class _ExampleWalletState extends State<ExampleWallet> {
displayText = "You have ${unConfirmed.length} unConfirmed transactions";
});
for (var e in unConfirmed) {
final txOut = await e.transaction!.output();
final txOut = e.transaction!.output();
if (kDebugMode) {
print(" txid: ${e.txid}");
print(" fee: ${e.fee}");
Expand All @@ -86,10 +86,11 @@ class _ExampleWalletState extends State<ExampleWallet> {
print(" txid: ${e.txid}");
print(" confirmationTime: ${e.confirmationTime?.timestamp}");
print(" confirmationTime Height: ${e.confirmationTime?.height}");
final txIn = await e.transaction!.input();
final txOut = await e.transaction!.output();
final txIn = e.transaction!.input();
final txOut = e.transaction!.output();
print("=============TxIn==============");
for (var e in txIn) {
print(" script: ${e.scriptSig}");
print(" previousOutout Txid: ${e.previousOutput.txid}");
print(" previousOutout vout: ${e.previousOutput.vout}");
print(" witness: ${e.witness}");
Expand Down
2 changes: 1 addition & 1 deletion example/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral

SPEC CHECKSUMS:
bdk_flutter: d0437c6116753242241fed48270587542a636d40
bdk_flutter: 6897321c2433d56f1fc780982b6d94d5894258dd
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24

PODFILE CHECKSUM: 6acf97521436d16fc31cd5e1a02000905acdb3ae
Expand Down
364 changes: 162 additions & 202 deletions ios/Classes/frb_generated.h

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions lib/bdk_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export './src/generated/api/types.dart'
FeeRate,
Input,
KeychainKind,
LocalUtxo,
LockTime,
Network,
OutPoint,
Expand All @@ -37,8 +36,6 @@ export './src/generated/api/types.dart'
Variant,
WitnessVersion,
WordCount;
export './src/generated/api/wallet.dart'
hide BdkWallet, finishBumpFeeTxBuilder, txBuilderFinish;
export './src/root.dart';
export 'src/utils/exceptions.dart'
hide
Expand Down
27 changes: 13 additions & 14 deletions lib/src/generated/api/descriptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,24 @@ class BdkDescriptor {
that: this,
);

static BdkDescriptor create(
{required String descriptor, required Network network}) =>
core.instance.api.crateApiDescriptorBdkDescriptorCreate(
descriptor: descriptor, network: network);

BigInt maxSatisfactionWeight() =>
core.instance.api.crateApiDescriptorBdkDescriptorMaxSatisfactionWeight(
that: this,
);

// HINT: Make it `#[frb(sync)]` to let it become the default constructor of Dart class.
static Future<BdkDescriptor> newInstance(
{required String descriptor, required Network network}) =>
core.instance.api.crateApiDescriptorBdkDescriptorNew(
descriptor: descriptor, network: network);

static Future<BdkDescriptor> newBip44(
static BdkDescriptor newBip44(
{required BdkDescriptorSecretKey secretKey,
required KeychainKind keychainKind,
required Network network}) =>
core.instance.api.crateApiDescriptorBdkDescriptorNewBip44(
secretKey: secretKey, keychainKind: keychainKind, network: network);

static Future<BdkDescriptor> newBip44Public(
static BdkDescriptor newBip44Public(
{required BdkDescriptorPublicKey publicKey,
required String fingerprint,
required KeychainKind keychainKind,
Expand All @@ -55,14 +54,14 @@ class BdkDescriptor {
keychainKind: keychainKind,
network: network);

static Future<BdkDescriptor> newBip49(
static BdkDescriptor newBip49(
{required BdkDescriptorSecretKey secretKey,
required KeychainKind keychainKind,
required Network network}) =>
core.instance.api.crateApiDescriptorBdkDescriptorNewBip49(
secretKey: secretKey, keychainKind: keychainKind, network: network);

static Future<BdkDescriptor> newBip49Public(
static BdkDescriptor newBip49Public(
{required BdkDescriptorPublicKey publicKey,
required String fingerprint,
required KeychainKind keychainKind,
Expand All @@ -73,14 +72,14 @@ class BdkDescriptor {
keychainKind: keychainKind,
network: network);

static Future<BdkDescriptor> newBip84(
static BdkDescriptor newBip84(
{required BdkDescriptorSecretKey secretKey,
required KeychainKind keychainKind,
required Network network}) =>
core.instance.api.crateApiDescriptorBdkDescriptorNewBip84(
secretKey: secretKey, keychainKind: keychainKind, network: network);

static Future<BdkDescriptor> newBip84Public(
static BdkDescriptor newBip84Public(
{required BdkDescriptorPublicKey publicKey,
required String fingerprint,
required KeychainKind keychainKind,
Expand All @@ -91,14 +90,14 @@ class BdkDescriptor {
keychainKind: keychainKind,
network: network);

static Future<BdkDescriptor> newBip86(
static BdkDescriptor newBip86(
{required BdkDescriptorSecretKey secretKey,
required KeychainKind keychainKind,
required Network network}) =>
core.instance.api.crateApiDescriptorBdkDescriptorNewBip86(
secretKey: secretKey, keychainKind: keychainKind, network: network);

static Future<BdkDescriptor> newBip86Public(
static BdkDescriptor newBip86Public(
{required BdkDescriptorPublicKey publicKey,
required String fingerprint,
required KeychainKind keychainKind,
Expand Down
28 changes: 13 additions & 15 deletions lib/src/generated/api/key.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BdkDerivationPath {
that: this,
);

static Future<BdkDerivationPath> fromString({required String path}) =>
static BdkDerivationPath fromString({required String path}) =>
core.instance.api.crateApiKeyBdkDerivationPathFromString(path: path);

@override
Expand All @@ -48,20 +48,19 @@ class BdkDescriptorPublicKey {
that: this,
);

static Future<BdkDescriptorPublicKey> derive(
static BdkDescriptorPublicKey derive(
{required BdkDescriptorPublicKey ptr,
required BdkDerivationPath path}) =>
core.instance.api
.crateApiKeyBdkDescriptorPublicKeyDerive(ptr: ptr, path: path);

static Future<BdkDescriptorPublicKey> extend(
static BdkDescriptorPublicKey extend(
{required BdkDescriptorPublicKey ptr,
required BdkDerivationPath path}) =>
core.instance.api
.crateApiKeyBdkDescriptorPublicKeyExtend(ptr: ptr, path: path);

static Future<BdkDescriptorPublicKey> fromString(
{required String publicKey}) =>
static BdkDescriptorPublicKey fromString({required String publicKey}) =>
core.instance.api
.crateApiKeyBdkDescriptorPublicKeyFromString(publicKey: publicKey);

Expand Down Expand Up @@ -92,20 +91,20 @@ class BdkDescriptorSecretKey {
that: this,
);

static Future<BdkDescriptorSecretKey> create(
static BdkDescriptorSecretKey create(
{required Network network,
required BdkMnemonic mnemonic,
String? password}) =>
core.instance.api.crateApiKeyBdkDescriptorSecretKeyCreate(
network: network, mnemonic: mnemonic, password: password);

static Future<BdkDescriptorSecretKey> derive(
static BdkDescriptorSecretKey derive(
{required BdkDescriptorSecretKey ptr,
required BdkDerivationPath path}) =>
core.instance.api
.crateApiKeyBdkDescriptorSecretKeyDerive(ptr: ptr, path: path);

static Future<BdkDescriptorSecretKey> extend(
static BdkDescriptorSecretKey extend(
{required BdkDescriptorSecretKey ptr,
required BdkDerivationPath path}) =>
core.instance.api
Expand Down Expand Up @@ -144,20 +143,19 @@ class BdkMnemonic {
that: this,
);

/// Generates Mnemonic with a random entropy
static BdkMnemonic create({required WordCount wordCount}) =>
core.instance.api.crateApiKeyBdkMnemonicCreate(wordCount: wordCount);

/// Create a new Mnemonic in the specified language from the given entropy.
/// Entropy must be a multiple of 32 bits (4 bytes) and 128-256 bits in length.
static Future<BdkMnemonic> fromEntropy({required List<int> entropy}) =>
static BdkMnemonic fromEntropy({required List<int> entropy}) =>
core.instance.api.crateApiKeyBdkMnemonicFromEntropy(entropy: entropy);

/// Parse a Mnemonic with given string
static Future<BdkMnemonic> fromString({required String mnemonic}) =>
static BdkMnemonic fromString({required String mnemonic}) =>
core.instance.api.crateApiKeyBdkMnemonicFromString(mnemonic: mnemonic);

// HINT: Make it `#[frb(sync)]` to let it become the default constructor of Dart class.
/// Generates Mnemonic with a random entropy
static Future<BdkMnemonic> newInstance({required WordCount wordCount}) =>
core.instance.api.crateApiKeyBdkMnemonicNew(wordCount: wordCount);

@override
int get hashCode => ptr.hashCode;

Expand Down
5 changes: 2 additions & 3 deletions lib/src/generated/api/psbt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ class BdkPsbt {
/// Combines this PartiallySignedTransaction with other PSBT as described by BIP 174.
///
/// In accordance with BIP 174 this function is commutative i.e., `A.combine(B) == B.combine(A)`
static Future<BdkPsbt> combine(
{required BdkPsbt ptr, required BdkPsbt other}) =>
static BdkPsbt combine({required BdkPsbt ptr, required BdkPsbt other}) =>
core.instance.api.crateApiPsbtBdkPsbtCombine(ptr: ptr, other: other);

/// Return the transaction.
Expand All @@ -47,7 +46,7 @@ class BdkPsbt {
that: this,
);

static Future<BdkPsbt> fromStr({required String psbtBase64}) =>
static BdkPsbt fromStr({required String psbtBase64}) =>
core.instance.api.crateApiPsbtBdkPsbtFromStr(psbtBase64: psbtBase64);

/// Serialize the PSBT data structure as a String of JSON.
Expand Down
Loading

0 comments on commit 6bf7dbb

Please sign in to comment.