react-native-bdk-sdk 0.1.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import { type UniffiByteArray, type UniffiGcObject, type UniffiHandle, FfiConverterObject, RustBuffer, UniffiAbstractObject, destructorGuardSymbol, pointerLiteralSymbol, uniffiTypeNameSymbol } from "uniffi-bindgen-react-native";
2
2
  /**
3
3
  * Convert a scriptPubKey (hex) to an address string for the given network.
4
+ * Returns the address string, or an error if the script cannot be converted.
4
5
  */
5
6
  export declare function addressFromScript(scriptHex: string, network: Network): string;
6
7
  /**
@@ -8,7 +9,7 @@ export declare function addressFromScript(scriptHex: string, network: Network):
8
9
  */
9
10
  export declare function createDescriptor(mnemonic: MnemonicLike, template: DescriptorTemplate, keychain: KeychainKind, network: Network): string;
10
11
  /**
11
- * Generate an output descriptor from a mnemonic string directly (convenience).
12
+ * Generate an output descriptor from a mnemonic string (convenience overload).
12
13
  */
13
14
  export declare function createDescriptorFromString(mnemonic: string, template: DescriptorTemplate, keychain: KeychainKind, network: Network): string;
14
15
  /**
@@ -21,7 +22,7 @@ export declare function createPublicDescriptor(xpub: string, template: Descripto
21
22
  export declare function createSingleKeyDescriptor(key: string, template: SingleKeyDescriptorTemplate, network: Network): string;
22
23
  /**
23
24
  * Async wallet factory — creates or loads a wallet without blocking the JS thread.
24
- * Pass null for change_descriptor to use the main descriptor for both keychains.
25
+ * Pass null/undefined for change_descriptor to use the main descriptor for both keychains.
25
26
  */
26
27
  export declare function createWallet(descriptor: string, changeDescriptor: string | undefined, network: Network, dbPath: string, asyncOpts_?: {
27
28
  signal: AbortSignal;
@@ -4511,227 +4512,6 @@ export declare enum TxOrdering {
4511
4512
  Shuffle = 0,
4512
4513
  Untouched = 1
4513
4514
  }
4514
- export declare enum WalletEvent_Tags {
4515
- ChainTipChanged = "ChainTipChanged",
4516
- TxConfirmed = "TxConfirmed",
4517
- TxUnconfirmed = "TxUnconfirmed",
4518
- TxReplaced = "TxReplaced",
4519
- TxDropped = "TxDropped"
4520
- }
4521
- export declare const WalletEvent: Readonly<{
4522
- instanceOf: (obj: any) => obj is WalletEvent;
4523
- ChainTipChanged: {
4524
- new (inner: {
4525
- oldTip: BlockId;
4526
- newTip: BlockId;
4527
- }): {
4528
- readonly tag: WalletEvent_Tags.ChainTipChanged;
4529
- readonly inner: Readonly<{
4530
- oldTip: BlockId;
4531
- newTip: BlockId;
4532
- }>;
4533
- /**
4534
- * @private
4535
- * This field is private and should not be used, use `tag` instead.
4536
- */
4537
- readonly [uniffiTypeNameSymbol]: "WalletEvent";
4538
- };
4539
- "new"(inner: {
4540
- oldTip: BlockId;
4541
- newTip: BlockId;
4542
- }): {
4543
- readonly tag: WalletEvent_Tags.ChainTipChanged;
4544
- readonly inner: Readonly<{
4545
- oldTip: BlockId;
4546
- newTip: BlockId;
4547
- }>;
4548
- /**
4549
- * @private
4550
- * This field is private and should not be used, use `tag` instead.
4551
- */
4552
- readonly [uniffiTypeNameSymbol]: "WalletEvent";
4553
- };
4554
- instanceOf(obj: any): obj is {
4555
- readonly tag: WalletEvent_Tags.ChainTipChanged;
4556
- readonly inner: Readonly<{
4557
- oldTip: BlockId;
4558
- newTip: BlockId;
4559
- }>;
4560
- /**
4561
- * @private
4562
- * This field is private and should not be used, use `tag` instead.
4563
- */
4564
- readonly [uniffiTypeNameSymbol]: "WalletEvent";
4565
- };
4566
- };
4567
- TxConfirmed: {
4568
- new (inner: {
4569
- txid: string;
4570
- blockTime: ConfirmationBlockTime;
4571
- }): {
4572
- readonly tag: WalletEvent_Tags.TxConfirmed;
4573
- readonly inner: Readonly<{
4574
- txid: string;
4575
- blockTime: ConfirmationBlockTime;
4576
- }>;
4577
- /**
4578
- * @private
4579
- * This field is private and should not be used, use `tag` instead.
4580
- */
4581
- readonly [uniffiTypeNameSymbol]: "WalletEvent";
4582
- };
4583
- "new"(inner: {
4584
- txid: string;
4585
- blockTime: ConfirmationBlockTime;
4586
- }): {
4587
- readonly tag: WalletEvent_Tags.TxConfirmed;
4588
- readonly inner: Readonly<{
4589
- txid: string;
4590
- blockTime: ConfirmationBlockTime;
4591
- }>;
4592
- /**
4593
- * @private
4594
- * This field is private and should not be used, use `tag` instead.
4595
- */
4596
- readonly [uniffiTypeNameSymbol]: "WalletEvent";
4597
- };
4598
- instanceOf(obj: any): obj is {
4599
- readonly tag: WalletEvent_Tags.TxConfirmed;
4600
- readonly inner: Readonly<{
4601
- txid: string;
4602
- blockTime: ConfirmationBlockTime;
4603
- }>;
4604
- /**
4605
- * @private
4606
- * This field is private and should not be used, use `tag` instead.
4607
- */
4608
- readonly [uniffiTypeNameSymbol]: "WalletEvent";
4609
- };
4610
- };
4611
- TxUnconfirmed: {
4612
- new (inner: {
4613
- txid: string;
4614
- }): {
4615
- readonly tag: WalletEvent_Tags.TxUnconfirmed;
4616
- readonly inner: Readonly<{
4617
- txid: string;
4618
- }>;
4619
- /**
4620
- * @private
4621
- * This field is private and should not be used, use `tag` instead.
4622
- */
4623
- readonly [uniffiTypeNameSymbol]: "WalletEvent";
4624
- };
4625
- "new"(inner: {
4626
- txid: string;
4627
- }): {
4628
- readonly tag: WalletEvent_Tags.TxUnconfirmed;
4629
- readonly inner: Readonly<{
4630
- txid: string;
4631
- }>;
4632
- /**
4633
- * @private
4634
- * This field is private and should not be used, use `tag` instead.
4635
- */
4636
- readonly [uniffiTypeNameSymbol]: "WalletEvent";
4637
- };
4638
- instanceOf(obj: any): obj is {
4639
- readonly tag: WalletEvent_Tags.TxUnconfirmed;
4640
- readonly inner: Readonly<{
4641
- txid: string;
4642
- }>;
4643
- /**
4644
- * @private
4645
- * This field is private and should not be used, use `tag` instead.
4646
- */
4647
- readonly [uniffiTypeNameSymbol]: "WalletEvent";
4648
- };
4649
- };
4650
- TxReplaced: {
4651
- new (inner: {
4652
- txid: string;
4653
- conflictingTxids: Array<string>;
4654
- }): {
4655
- readonly tag: WalletEvent_Tags.TxReplaced;
4656
- readonly inner: Readonly<{
4657
- txid: string;
4658
- conflictingTxids: Array<string>;
4659
- }>;
4660
- /**
4661
- * @private
4662
- * This field is private and should not be used, use `tag` instead.
4663
- */
4664
- readonly [uniffiTypeNameSymbol]: "WalletEvent";
4665
- };
4666
- "new"(inner: {
4667
- txid: string;
4668
- conflictingTxids: Array<string>;
4669
- }): {
4670
- readonly tag: WalletEvent_Tags.TxReplaced;
4671
- readonly inner: Readonly<{
4672
- txid: string;
4673
- conflictingTxids: Array<string>;
4674
- }>;
4675
- /**
4676
- * @private
4677
- * This field is private and should not be used, use `tag` instead.
4678
- */
4679
- readonly [uniffiTypeNameSymbol]: "WalletEvent";
4680
- };
4681
- instanceOf(obj: any): obj is {
4682
- readonly tag: WalletEvent_Tags.TxReplaced;
4683
- readonly inner: Readonly<{
4684
- txid: string;
4685
- conflictingTxids: Array<string>;
4686
- }>;
4687
- /**
4688
- * @private
4689
- * This field is private and should not be used, use `tag` instead.
4690
- */
4691
- readonly [uniffiTypeNameSymbol]: "WalletEvent";
4692
- };
4693
- };
4694
- TxDropped: {
4695
- new (inner: {
4696
- txid: string;
4697
- }): {
4698
- readonly tag: WalletEvent_Tags.TxDropped;
4699
- readonly inner: Readonly<{
4700
- txid: string;
4701
- }>;
4702
- /**
4703
- * @private
4704
- * This field is private and should not be used, use `tag` instead.
4705
- */
4706
- readonly [uniffiTypeNameSymbol]: "WalletEvent";
4707
- };
4708
- "new"(inner: {
4709
- txid: string;
4710
- }): {
4711
- readonly tag: WalletEvent_Tags.TxDropped;
4712
- readonly inner: Readonly<{
4713
- txid: string;
4714
- }>;
4715
- /**
4716
- * @private
4717
- * This field is private and should not be used, use `tag` instead.
4718
- */
4719
- readonly [uniffiTypeNameSymbol]: "WalletEvent";
4720
- };
4721
- instanceOf(obj: any): obj is {
4722
- readonly tag: WalletEvent_Tags.TxDropped;
4723
- readonly inner: Readonly<{
4724
- txid: string;
4725
- }>;
4726
- /**
4727
- * @private
4728
- * This field is private and should not be used, use `tag` instead.
4729
- */
4730
- readonly [uniffiTypeNameSymbol]: "WalletEvent";
4731
- };
4732
- };
4733
- }>;
4734
- export type WalletEvent = InstanceType<(typeof WalletEvent)[keyof Omit<typeof WalletEvent, "instanceOf">]>;
4735
4515
  export declare enum WordCount {
4736
4516
  Words12 = 0,
4737
4517
  Words15 = 1,
@@ -4741,6 +4521,7 @@ export declare enum WordCount {
4741
4521
  }
4742
4522
  /**
4743
4523
  * A reusable Electrum client that holds a persistent TCP/TLS connection.
4524
+ * Create once, pass to multiple wallet methods to avoid reconnecting each time.
4744
4525
  */
4745
4526
  export interface ElectrumClientLike {
4746
4527
  }
@@ -4750,6 +4531,7 @@ export interface ElectrumClientLike {
4750
4531
  export type ElectrumClientInterface = ElectrumClientLike;
4751
4532
  /**
4752
4533
  * A reusable Electrum client that holds a persistent TCP/TLS connection.
4534
+ * Create once, pass to multiple wallet methods to avoid reconnecting each time.
4753
4535
  */
4754
4536
  export declare class ElectrumClient extends UniffiAbstractObject implements ElectrumClientLike {
4755
4537
  readonly [uniffiTypeNameSymbol] = "ElectrumClient";
@@ -4757,6 +4539,7 @@ export declare class ElectrumClient extends UniffiAbstractObject implements Elec
4757
4539
  readonly [pointerLiteralSymbol]: UniffiHandle;
4758
4540
  /**
4759
4541
  * Connect to an Electrum server.
4542
+ * url: e.g. "ssl://electrum.blockstream.info:60002" or "tcp://localhost:50001"
4760
4543
  */
4761
4544
  constructor(url: string);
4762
4545
  /**
@@ -4766,10 +4549,25 @@ export declare class ElectrumClient extends UniffiAbstractObject implements Elec
4766
4549
  static instanceOf(obj: any): obj is ElectrumClient;
4767
4550
  }
4768
4551
  export interface MnemonicLike {
4552
+ /**
4553
+ * The language of this mnemonic.
4554
+ */
4769
4555
  language(): Language;
4556
+ /**
4557
+ * Derive the 64-byte seed as hex. Pass an empty string for no passphrase.
4558
+ */
4770
4559
  toSeedHex(passphrase: string): string;
4560
+ /**
4561
+ * The mnemonic as a space-separated word string.
4562
+ */
4771
4563
  toString(): string;
4564
+ /**
4565
+ * Number of words (12, 15, 18, 21, or 24).
4566
+ */
4772
4567
  wordCount(): number;
4568
+ /**
4569
+ * List the individual words.
4570
+ */
4773
4571
  words(): Array<string>;
4774
4572
  }
4775
4573
  /**
@@ -4780,15 +4578,45 @@ export declare class Mnemonic extends UniffiAbstractObject implements MnemonicLi
4780
4578
  readonly [uniffiTypeNameSymbol] = "Mnemonic";
4781
4579
  readonly [destructorGuardSymbol]: UniffiGcObject;
4782
4580
  readonly [pointerLiteralSymbol]: UniffiHandle;
4581
+ /**
4582
+ * Generate a new random mnemonic with the given word count (English).
4583
+ */
4783
4584
  constructor(wordCount: WordCount);
4784
- static fromEntropy(entropy: Array</*u8*/ number>): MnemonicLike;
4785
- static fromEntropyIn(entropy: Array</*u8*/ number>, language: Language): MnemonicLike;
4585
+ /**
4586
+ * Create a mnemonic from raw entropy bytes (16–32 bytes).
4587
+ */
4588
+ static fromEntropy(entropy: ArrayBuffer): MnemonicLike;
4589
+ /**
4590
+ * Create a mnemonic from raw entropy bytes in a specific language.
4591
+ */
4592
+ static fromEntropyIn(entropy: ArrayBuffer, language: Language): MnemonicLike;
4593
+ /**
4594
+ * Parse an existing mnemonic string (auto-detects language).
4595
+ */
4786
4596
  static fromString(mnemonic: string): MnemonicLike;
4597
+ /**
4598
+ * Parse a mnemonic string in a specific language.
4599
+ */
4787
4600
  static fromStringIn(mnemonic: string, language: Language): MnemonicLike;
4601
+ /**
4602
+ * The language of this mnemonic.
4603
+ */
4788
4604
  language(): Language;
4605
+ /**
4606
+ * Derive the 64-byte seed as hex. Pass an empty string for no passphrase.
4607
+ */
4789
4608
  toSeedHex(passphrase: string): string;
4609
+ /**
4610
+ * The mnemonic as a space-separated word string.
4611
+ */
4790
4612
  toString(): string;
4613
+ /**
4614
+ * Number of words (12, 15, 18, 21, or 24).
4615
+ */
4791
4616
  wordCount(): number;
4617
+ /**
4618
+ * List the individual words.
4619
+ */
4792
4620
  words(): Array<string>;
4793
4621
  /**
4794
4622
  * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
@@ -4797,11 +4625,29 @@ export declare class Mnemonic extends UniffiAbstractObject implements MnemonicLi
4797
4625
  static instanceOf(obj: any): obj is Mnemonic;
4798
4626
  }
4799
4627
  export interface PsbtLike {
4628
+ /**
4629
+ * Extract the fully-signed transaction as raw hex.
4630
+ */
4800
4631
  extractTxHex(): string;
4632
+ /**
4633
+ * Total fee in satoshis. None if any input UTXO value is unknown.
4634
+ */
4801
4635
  feeAmount(): /*u64*/ bigint | undefined;
4636
+ /**
4637
+ * Fee rate in sat/vbyte. None if any input UTXO value is unknown.
4638
+ */
4802
4639
  feeRate(): /*f64*/ number | undefined;
4640
+ /**
4641
+ * Retrieve the UTXO for a given input index. Returns None if unavailable.
4642
+ */
4803
4643
  getUtxoFor(inputIndex: bigint): TxOut | undefined;
4644
+ /**
4645
+ * Serialize to a base64-encoded string.
4646
+ */
4804
4647
  toBase64(): string;
4648
+ /**
4649
+ * The unsigned txid.
4650
+ */
4805
4651
  txid(): string;
4806
4652
  }
4807
4653
  /**
@@ -4812,12 +4658,33 @@ export declare class Psbt extends UniffiAbstractObject implements PsbtLike {
4812
4658
  readonly [uniffiTypeNameSymbol] = "Psbt";
4813
4659
  readonly [destructorGuardSymbol]: UniffiGcObject;
4814
4660
  readonly [pointerLiteralSymbol]: UniffiHandle;
4661
+ /**
4662
+ * Deserialize from a base64-encoded string.
4663
+ */
4815
4664
  constructor(psbtBase64: string);
4665
+ /**
4666
+ * Extract the fully-signed transaction as raw hex.
4667
+ */
4816
4668
  extractTxHex(): string;
4669
+ /**
4670
+ * Total fee in satoshis. None if any input UTXO value is unknown.
4671
+ */
4817
4672
  feeAmount(): /*u64*/ bigint | undefined;
4673
+ /**
4674
+ * Fee rate in sat/vbyte. None if any input UTXO value is unknown.
4675
+ */
4818
4676
  feeRate(): /*f64*/ number | undefined;
4677
+ /**
4678
+ * Retrieve the UTXO for a given input index. Returns None if unavailable.
4679
+ */
4819
4680
  getUtxoFor(inputIndex: bigint): TxOut | undefined;
4681
+ /**
4682
+ * Serialize to a base64-encoded string.
4683
+ */
4820
4684
  toBase64(): string;
4685
+ /**
4686
+ * The unsigned txid.
4687
+ */
4821
4688
  txid(): string;
4822
4689
  /**
4823
4690
  * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
@@ -4826,7 +4693,7 @@ export declare class Psbt extends UniffiAbstractObject implements PsbtLike {
4826
4693
  static instanceOf(obj: any): obj is Psbt;
4827
4694
  }
4828
4695
  export interface TxBuilderLike {
4829
- addData(data: Array</*u8*/ number>): void;
4696
+ addData(data: ArrayBuffer): void;
4830
4697
  addGlobalXpubs(): void;
4831
4698
  addRecipient(address: string, amountSats: bigint): void;
4832
4699
  addUnspendable(outpoint: OutPoint): void;
@@ -4845,12 +4712,12 @@ export interface TxBuilderLike {
4845
4712
  feeAbsolute(feeSats: bigint): void;
4846
4713
  feeRate(satPerVbyte: number): void;
4847
4714
  /**
4848
- * Build the transaction into a PSBT (async runs on background thread).
4715
+ * Build the transaction into a PSBT using the wallet.
4716
+ * Runs on a background thread to avoid blocking the JS thread.
4849
4717
  */
4850
4718
  finish(wallet: WalletLike, asyncOpts_?: {
4851
4719
  signal: AbortSignal;
4852
4720
  }): Promise<PsbtLike>;
4853
- includeOutputRedeemWitnessScript(): void;
4854
4721
  manuallySelectedOnly(): void;
4855
4722
  nlocktime(lockHeight: number): void;
4856
4723
  onlySpendChange(): void;
@@ -4872,7 +4739,7 @@ export declare class TxBuilder extends UniffiAbstractObject implements TxBuilder
4872
4739
  readonly [destructorGuardSymbol]: UniffiGcObject;
4873
4740
  readonly [pointerLiteralSymbol]: UniffiHandle;
4874
4741
  constructor();
4875
- addData(data: Array</*u8*/ number>): void;
4742
+ addData(data: ArrayBuffer): void;
4876
4743
  addGlobalXpubs(): void;
4877
4744
  addRecipient(address: string, amountSats: bigint): void;
4878
4745
  addUnspendable(outpoint: OutPoint): void;
@@ -4891,12 +4758,12 @@ export declare class TxBuilder extends UniffiAbstractObject implements TxBuilder
4891
4758
  feeAbsolute(feeSats: bigint): void;
4892
4759
  feeRate(satPerVbyte: number): void;
4893
4760
  /**
4894
- * Build the transaction into a PSBT (async runs on background thread).
4761
+ * Build the transaction into a PSBT using the wallet.
4762
+ * Runs on a background thread to avoid blocking the JS thread.
4895
4763
  */
4896
4764
  finish(wallet: WalletLike, asyncOpts_?: {
4897
4765
  signal: AbortSignal;
4898
4766
  }): Promise<PsbtLike>;
4899
- includeOutputRedeemWitnessScript(): void;
4900
4767
  manuallySelectedOnly(): void;
4901
4768
  nlocktime(lockHeight: number): void;
4902
4769
  onlySpendChange(): void;
@@ -4924,7 +4791,6 @@ export interface WalletLike {
4924
4791
  buildFeeBump(txid: string, newFeeRate: number): PsbtLike;
4925
4792
  calculateFee(txHex: string): bigint;
4926
4793
  calculateFeeRate(txHex: string): number;
4927
- cancelTx(txHex: string): void;
4928
4794
  checkpoints(): Array<BlockId>;
4929
4795
  derivationIndex(keychain: KeychainKind): /*u32*/ number | undefined;
4930
4796
  derivationOfSpk(scriptHex: string): DerivationInfo | undefined;
@@ -5001,7 +4867,6 @@ export declare class Wallet extends UniffiAbstractObject implements WalletLike {
5001
4867
  buildFeeBump(txid: string, newFeeRate: number): PsbtLike;
5002
4868
  calculateFee(txHex: string): bigint;
5003
4869
  calculateFeeRate(txHex: string): number;
5004
- cancelTx(txHex: string): void;
5005
4870
  checkpoints(): Array<BlockId>;
5006
4871
  derivationIndex(keychain: KeychainKind): /*u32*/ number | undefined;
5007
4872
  derivationOfSpk(scriptHex: string): DerivationInfo | undefined;
@@ -5235,13 +5100,6 @@ declare const _default: Readonly<{
5235
5100
  lower(value: TxOutput): UniffiByteArray;
5236
5101
  };
5237
5102
  FfiConverterTypeWallet: FfiConverterObject<WalletLike>;
5238
- FfiConverterTypeWalletEvent: {
5239
- read(from: RustBuffer): WalletEvent;
5240
- write(value: WalletEvent, into: RustBuffer): void;
5241
- allocationSize(value: WalletEvent): number;
5242
- lift(value: UniffiByteArray): WalletEvent;
5243
- lower(value: WalletEvent): UniffiByteArray;
5244
- };
5245
5103
  FfiConverterTypeWordCount: {
5246
5104
  read(from: RustBuffer): WordCount;
5247
5105
  write(value: WordCount, into: RustBuffer): void;