@dynamic-labs-sdk/bitcoin 0.5.0 → 0.6.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.
Files changed (71) hide show
  1. package/dist/{addBitcoinInjectedWalletsExtension-DNUJc7N7.cjs.js → addBitcoinInjectedWalletsExtension-BRn8yV6c.cjs.js} +3 -2
  2. package/dist/{addBitcoinInjectedWalletsExtension-DNUJc7N7.cjs.js.map → addBitcoinInjectedWalletsExtension-BRn8yV6c.cjs.js.map} +1 -1
  3. package/dist/{addBitcoinInjectedWalletsExtension-BjijCDrr.esm.js → addBitcoinInjectedWalletsExtension-CkICdKHm.esm.js} +2 -2
  4. package/dist/{addBitcoinInjectedWalletsExtension-BjijCDrr.esm.js.map → addBitcoinInjectedWalletsExtension-CkICdKHm.esm.js.map} +1 -1
  5. package/dist/buildPsbt/buildPsbt.d.ts +24 -0
  6. package/dist/buildPsbt/buildPsbt.d.ts.map +1 -0
  7. package/dist/buildPsbt/index.d.ts +2 -0
  8. package/dist/buildPsbt/index.d.ts.map +1 -0
  9. package/dist/errors/InsufficientFundsError.d.ts +12 -0
  10. package/dist/errors/InsufficientFundsError.d.ts.map +1 -0
  11. package/dist/errors/InvalidAmountError.d.ts +11 -0
  12. package/dist/errors/InvalidAmountError.d.ts.map +1 -0
  13. package/dist/errors/NoUTXOsFoundError.d.ts +10 -0
  14. package/dist/errors/NoUTXOsFoundError.d.ts.map +1 -0
  15. package/dist/errors/PublicKeyNotFoundError.d.ts +5 -0
  16. package/dist/errors/PublicKeyNotFoundError.d.ts.map +1 -0
  17. package/dist/errors/SegwitOutputScriptError.d.ts +5 -0
  18. package/dist/errors/SegwitOutputScriptError.d.ts.map +1 -0
  19. package/dist/errors/TaprootAddressNotSupportedError.d.ts +5 -0
  20. package/dist/errors/TaprootAddressNotSupportedError.d.ts.map +1 -0
  21. package/dist/exports/waas.d.ts +2 -0
  22. package/dist/exports/waas.d.ts.map +1 -1
  23. package/dist/index.cjs.js +636 -40
  24. package/dist/index.cjs.js.map +1 -1
  25. package/dist/index.esm.js +609 -42
  26. package/dist/index.esm.js.map +1 -1
  27. package/dist/injected.cjs.js +2 -1
  28. package/dist/injected.cjs.js.map +1 -1
  29. package/dist/injected.esm.js +1 -1
  30. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  31. package/dist/waas/WaasBitcoinWalletProvider.types.d.ts +24 -5
  32. package/dist/waas/WaasBitcoinWalletProvider.types.d.ts.map +1 -1
  33. package/dist/waas/utils/addInputsToPsbt/addInputsToPsbt.d.ts +21 -0
  34. package/dist/waas/utils/addInputsToPsbt/addInputsToPsbt.d.ts.map +1 -0
  35. package/dist/waas/utils/addInputsToPsbt/index.d.ts +2 -0
  36. package/dist/waas/utils/addInputsToPsbt/index.d.ts.map +1 -0
  37. package/dist/waas/utils/addOutputsToPsbt/addOutputsToPsbt.d.ts +24 -0
  38. package/dist/waas/utils/addOutputsToPsbt/addOutputsToPsbt.d.ts.map +1 -0
  39. package/dist/waas/utils/addOutputsToPsbt/index.d.ts +2 -0
  40. package/dist/waas/utils/addOutputsToPsbt/index.d.ts.map +1 -0
  41. package/dist/waas/utils/broadcastTransaction/broadcastTransaction.d.ts.map +1 -1
  42. package/dist/waas/utils/buildPsbt/buildPsbt.d.ts +26 -0
  43. package/dist/waas/utils/buildPsbt/buildPsbt.d.ts.map +1 -0
  44. package/dist/waas/utils/buildPsbt/index.d.ts +2 -0
  45. package/dist/waas/utils/buildPsbt/index.d.ts.map +1 -0
  46. package/dist/waas/utils/calculateFeeAndChange/calculateFeeAndChange.d.ts +24 -0
  47. package/dist/waas/utils/calculateFeeAndChange/calculateFeeAndChange.d.ts.map +1 -0
  48. package/dist/waas/utils/calculateFeeAndChange/index.d.ts +2 -0
  49. package/dist/waas/utils/calculateFeeAndChange/index.d.ts.map +1 -0
  50. package/dist/waas/utils/calculateUTXOTotal/calculateUTXOTotal.d.ts +9 -0
  51. package/dist/waas/utils/calculateUTXOTotal/calculateUTXOTotal.d.ts.map +1 -0
  52. package/dist/waas/utils/calculateUTXOTotal/index.d.ts +2 -0
  53. package/dist/waas/utils/calculateUTXOTotal/index.d.ts.map +1 -0
  54. package/dist/waas/utils/createWalletProviderForWaasBitcoin/createWalletProviderForWaasBitcoin.d.ts.map +1 -1
  55. package/dist/waas/utils/estimateTransactionFee/estimateTransactionFee.d.ts +10 -4
  56. package/dist/waas/utils/estimateTransactionFee/estimateTransactionFee.d.ts.map +1 -1
  57. package/dist/waas/utils/getPublicKeyForWalletAccount/getPublicKeyForWalletAccount.d.ts +6 -0
  58. package/dist/waas/utils/getPublicKeyForWalletAccount/getPublicKeyForWalletAccount.d.ts.map +1 -0
  59. package/dist/waas/utils/selectUTXOsLargestFirst/index.d.ts +2 -0
  60. package/dist/waas/utils/selectUTXOsLargestFirst/index.d.ts.map +1 -0
  61. package/dist/waas/utils/selectUTXOsLargestFirst/selectUTXOsLargestFirst.d.ts +16 -0
  62. package/dist/waas/utils/selectUTXOsLargestFirst/selectUTXOsLargestFirst.d.ts.map +1 -0
  63. package/dist/waas/utils/validateAndSelectUTXOs/index.d.ts +2 -0
  64. package/dist/waas/utils/validateAndSelectUTXOs/index.d.ts.map +1 -0
  65. package/dist/waas/utils/validateAndSelectUTXOs/validateAndSelectUTXOs.d.ts +22 -0
  66. package/dist/waas/utils/validateAndSelectUTXOs/validateAndSelectUTXOs.d.ts.map +1 -0
  67. package/dist/waas/utils/validateNotTaproot/index.d.ts +2 -0
  68. package/dist/waas/utils/validateNotTaproot/index.d.ts.map +1 -0
  69. package/dist/waas/utils/validateNotTaproot/validateNotTaproot.d.ts +9 -0
  70. package/dist/waas/utils/validateNotTaproot/validateNotTaproot.d.ts.map +1 -0
  71. package/package.json +6 -4
@@ -1,6 +1,29 @@
1
+ import type { WalletAccount } from '@dynamic-labs-sdk/client';
1
2
  import type { WaasProvider } from '@dynamic-labs-sdk/client/waas/core';
2
3
  import type { BitcoinWalletProvider } from '../BitcoinWalletProvider.types';
3
- export type WaasBitcoinWalletProvider = Omit<WaasProvider, 'signMessage'> & BitcoinWalletProvider;
4
+ /**
5
+ * WaaS Bitcoin Wallet Provider type
6
+ * Combines base WaasProvider with Bitcoin-specific functionality
7
+ */
8
+ export type WaasBitcoinWalletProvider = Omit<WaasProvider, 'signMessage'> & BitcoinWalletProvider & {
9
+ buildPsbt: (args: {
10
+ transaction: WaasBitcoinTransaction;
11
+ walletAccount: WalletAccount;
12
+ }) => Promise<string>;
13
+ };
14
+ /**
15
+ * Fee priority levels for transaction fee estimation
16
+ */
17
+ export type FeePriority = 'high' | 'medium' | 'low';
18
+ /**
19
+ * Bitcoin transaction with optional fee priority
20
+ * Extends the base BitcoinTransaction with fee priority for WaaS
21
+ */
22
+ export type WaasBitcoinTransaction = {
23
+ amount: bigint;
24
+ feePriority?: FeePriority;
25
+ recipientAddress: string;
26
+ };
4
27
  /**
5
28
  * Unspent Transaction Output (UTXO) from mempool.space
6
29
  */
@@ -12,10 +35,6 @@ export type UTXO = {
12
35
  value: number;
13
36
  vout: number;
14
37
  };
15
- /**
16
- * Fee priority levels for transaction fee estimation
17
- */
18
- export type FeePriority = 'high' | 'medium' | 'low';
19
38
  /**
20
39
  * Fee recommendations from mempool.space API
21
40
  * All values are in sat/vB
@@ -1 +1 @@
1
- {"version":3,"file":"WaasBitcoinWalletProvider.types.d.ts","sourceRoot":"","sources":["../../src/waas/WaasBitcoinWalletProvider.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5E,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC,GACvE,qBAAqB,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG;IACjB,MAAM,CAAC,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEpD;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}
1
+ {"version":3,"file":"WaasBitcoinWalletProvider.types.d.ts","sourceRoot":"","sources":["../../src/waas/WaasBitcoinWalletProvider.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE5E;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC,GACvE,qBAAqB,GAAG;IACtB,SAAS,EAAE,CAAC,IAAI,EAAE;QAChB,WAAW,EAAE,sBAAsB,CAAC;QACpC,aAAa,EAAE,aAAa,CAAC;KAC9B,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACvB,CAAC;AAEJ;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEpD;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG;IACjB,MAAM,CAAC,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { Network, Psbt } from 'bitcoinjs-lib';
2
+ import type { UTXO } from '../../WaasBitcoinWalletProvider.types';
3
+ type AddInputsToPsbtOptions = {
4
+ network: Network;
5
+ psbt: Psbt;
6
+ publicKeyPair: {
7
+ publicKey: Uint8Array;
8
+ };
9
+ selectedUTXOs: UTXO[];
10
+ };
11
+ /**
12
+ * Adds inputs to PSBT from selected UTXOs
13
+ *
14
+ * @param options.network - Bitcoin network configuration (mainnet or testnet)
15
+ * @param options.psbt - The PSBT instance to add inputs to
16
+ * @param options.publicKeyPair - Key pair containing the public key for witness script
17
+ * @param options.selectedUTXOs - Array of UTXOs to add as inputs
18
+ */
19
+ export declare const addInputsToPsbt: (options: AddInputsToPsbtOptions) => void;
20
+ export {};
21
+ //# sourceMappingURL=addInputsToPsbt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addInputsToPsbt.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/addInputsToPsbt/addInputsToPsbt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAKnD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAElE,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC;IACX,aAAa,EAAE;QAAE,SAAS,EAAE,UAAU,CAAA;KAAE,CAAC;IACzC,aAAa,EAAE,IAAI,EAAE,CAAC;CACvB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,YAAa,sBAAsB,KAAG,IA2BjE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { addInputsToPsbt } from './addInputsToPsbt';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/addInputsToPsbt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { Network, Psbt } from 'bitcoinjs-lib';
2
+ type AddOutputsToPsbtOptions = {
3
+ accountAddress: string;
4
+ amountInSatoshis: number;
5
+ changeAmount: number;
6
+ hasChangeOutput: boolean;
7
+ network: Network;
8
+ psbt: Psbt;
9
+ recipientAddress: string;
10
+ };
11
+ /**
12
+ * Adds outputs to PSBT (recipient and optionally change)
13
+ *
14
+ * @param options.accountAddress - The sender's address for receiving change
15
+ * @param options.amountInSatoshis - Amount to send to the recipient in satoshis
16
+ * @param options.changeAmount - Amount to return as change in satoshis
17
+ * @param options.hasChangeOutput - Whether to include a change output
18
+ * @param options.network - Bitcoin network configuration (mainnet or testnet)
19
+ * @param options.psbt - The PSBT instance to add outputs to
20
+ * @param options.recipientAddress - The recipient's Bitcoin address
21
+ */
22
+ export declare const addOutputsToPsbt: (options: AddOutputsToPsbtOptions) => void;
23
+ export {};
24
+ //# sourceMappingURL=addOutputsToPsbt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addOutputsToPsbt.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/addOutputsToPsbt/addOutputsToPsbt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAMnD,KAAK,uBAAuB,GAAG;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC;IACX,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,YAAa,uBAAuB,KAAG,IA6BnE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { addOutputsToPsbt } from './addOutputsToPsbt';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/addOutputsToPsbt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"broadcastTransaction.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/broadcastTransaction/broadcastTransaction.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,mBAA0B,MAAM,KAAG,OAAO,CAAC,MAAM,CAkBjF,CAAC"}
1
+ {"version":3,"file":"broadcastTransaction.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/broadcastTransaction/broadcastTransaction.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,mBACf,MAAM,KACrB,OAAO,CAAC,MAAM,CAkBhB,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { Network } from 'bitcoinjs-lib';
2
+ import type { FeePriority } from '../../WaasBitcoinWalletProvider.types';
3
+ type BuildPsbtOptions = {
4
+ accountAddress: string;
5
+ amountInSatoshis: bigint;
6
+ feePriority?: FeePriority;
7
+ network: Network;
8
+ publicKeyHex: string;
9
+ recipientAddress: string;
10
+ };
11
+ /**
12
+ * Builds a PSBT for a Bitcoin transaction with real UTXOs
13
+ * Uses Largest-First UTXO selection strategy with accurate vSize fee estimation
14
+ *
15
+ * @param options.accountAddress - The sender's Bitcoin address
16
+ * @param options.amountInSatoshis - Amount to send in satoshis
17
+ * @param options.feePriority - Priority level for fee estimation ('low', 'medium', or 'high')
18
+ * @param options.network - Bitcoin network configuration (mainnet or testnet)
19
+ * @param options.publicKeyHex - The sender's public key in hexadecimal format
20
+ * @param options.recipientAddress - The recipient's Bitcoin address
21
+ * @returns A PSBT in Base64 format
22
+ * @throws Error if insufficient funds, no UTXOs, or other errors
23
+ */
24
+ export declare const buildPsbt: ({ accountAddress, amountInSatoshis, feePriority, network, publicKeyHex, recipientAddress, }: BuildPsbtOptions) => Promise<string>;
25
+ export {};
26
+ //# sourceMappingURL=buildPsbt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildPsbt.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/buildPsbt/buildPsbt.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAQ7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAWzE,KAAK,gBAAgB,GAAG;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,gGAOnB,gBAAgB,KAAG,OAAO,CAAC,MAAM,CAwFnC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { buildPsbt } from './buildPsbt';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/buildPsbt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { FeePriority, UTXO } from '../../WaasBitcoinWalletProvider.types';
2
+ type CalculateFeeAndChangeOptions = {
3
+ amountInSatoshis: bigint;
4
+ feePriority: FeePriority;
5
+ selectedTotalValue: number;
6
+ selectedUTXOs: UTXO[];
7
+ };
8
+ type CalculateFeeAndChangeResult = {
9
+ changeAmountNumber: number;
10
+ feeEstimate: number;
11
+ hasChangeOutput: boolean;
12
+ };
13
+ /**
14
+ * Calculates fee estimate and change amount, handling dust limit
15
+ *
16
+ * @param options.amountInSatoshis - Amount to send in satoshis
17
+ * @param options.feePriority - Priority level for fee estimation ('low', 'medium', or 'high')
18
+ * @param options.selectedTotalValue - Total value of selected UTXOs in satoshis
19
+ * @param options.selectedUTXOs - Array of selected UTXOs for the transaction
20
+ * @returns Object with feeEstimate, changeAmountNumber, and hasChangeOutput
21
+ */
22
+ export declare const calculateFeeAndChange: ({ amountInSatoshis, feePriority, selectedTotalValue, selectedUTXOs, }: CalculateFeeAndChangeOptions) => Promise<CalculateFeeAndChangeResult>;
23
+ export {};
24
+ //# sourceMappingURL=calculateFeeAndChange.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculateFeeAndChange.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/calculateFeeAndChange/calculateFeeAndChange.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAG/E,KAAK,4BAA4B,GAAG;IAClC,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,aAAa,EAAE,IAAI,EAAE,CAAC;CACvB,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,0EAK/B,4BAA4B,KAAG,OAAO,CAAC,2BAA2B,CAmCpE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { calculateFeeAndChange } from './calculateFeeAndChange';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/calculateFeeAndChange/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { UTXO } from '../../WaasBitcoinWalletProvider.types';
2
+ /**
3
+ * Calculates the total value of UTXOs
4
+ *
5
+ * @param utxos - Array of UTXOs
6
+ * @returns Total value in satoshis
7
+ */
8
+ export declare const calculateUTXOTotal: (utxos: UTXO[]) => number;
9
+ //# sourceMappingURL=calculateUTXOTotal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculateUTXOTotal.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/calculateUTXOTotal/calculateUTXOTotal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,UAAW,IAAI,EAAE,KAAG,MACiB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { calculateUTXOTotal } from './calculateUTXOTotal';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/calculateUTXOTotal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createWalletProviderForWaasBitcoin.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/createWalletProviderForWaasBitcoin/createWalletProviderForWaasBitcoin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAiB9D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAEvF,eAAO,MAAM,kCAAkC,cAClC,aAAa,KACvB,yBA2FF,CAAC"}
1
+ {"version":3,"file":"createWalletProviderForWaasBitcoin.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/createWalletProviderForWaasBitcoin/createWalletProviderForWaasBitcoin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAoB9D,OAAO,KAAK,EAEV,yBAAyB,EAC1B,MAAM,uCAAuC,CAAC;AAK/C,eAAO,MAAM,kCAAkC,cAClC,aAAa,KACvB,yBAqLF,CAAC"}
@@ -1,11 +1,17 @@
1
1
  import type { FeePriority } from '../../WaasBitcoinWalletProvider.types';
2
+ type EstimateTransactionFeeOptions = {
3
+ feePriority?: FeePriority;
4
+ numInputs: number;
5
+ numOutputs: number;
6
+ };
2
7
  /**
3
8
  * Estimates transaction fees based on number of inputs and outputs using accurate vSize
4
9
  *
5
- * @param numInputs - Number of transaction inputs
6
- * @param numOutputs - Number of transaction outputs
7
- * @param feePriority - Fee priority level (high/medium/low)
10
+ * @param options.feePriority - Priority level for fee estimation ('low', 'medium', or 'high')
11
+ * @param options.numInputs - Number of transaction inputs (UTXOs being spent)
12
+ * @param options.numOutputs - Number of transaction outputs
8
13
  * @returns Estimated fee in satoshis
9
14
  */
10
- export declare const estimateTransactionFee: (numInputs: number, numOutputs: number, feePriority?: FeePriority) => Promise<number>;
15
+ export declare const estimateTransactionFee: ({ feePriority, numInputs, numOutputs, }: EstimateTransactionFeeOptions) => Promise<number>;
16
+ export {};
11
17
  //# sourceMappingURL=estimateTransactionFee.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"estimateTransactionFee.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/estimateTransactionFee/estimateTransactionFee.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGzE;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,cACtB,MAAM,cACL,MAAM,gBACL,WAAW,KACvB,OAAO,CAAC,MAAM,CAqBhB,CAAC"}
1
+ {"version":3,"file":"estimateTransactionFee.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/estimateTransactionFee/estimateTransactionFee.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGzE,KAAK,6BAA6B,GAAG;IACnC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,4CAIhC,6BAA6B,KAAG,OAAO,CAAC,MAAM,CAwBhD,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { DynamicClient, WalletAccount } from '@dynamic-labs-sdk/client';
2
+ /**
3
+ * Gets the public key for a wallet account from the user's verified credentials
4
+ */
5
+ export declare const getPublicKeyForWalletAccount: (walletAccount: WalletAccount, client: DynamicClient) => string;
6
+ //# sourceMappingURL=getPublicKeyForWalletAccount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPublicKeyForWalletAccount.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/getPublicKeyForWalletAccount/getPublicKeyForWalletAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK7E;;GAEG;AACH,eAAO,MAAM,4BAA4B,kBACxB,aAAa,UACpB,aAAa,KACpB,MAcF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { selectUTXOsLargestFirst } from './selectUTXOsLargestFirst';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/selectUTXOsLargestFirst/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { UTXO } from '../../WaasBitcoinWalletProvider.types';
2
+ type SelectUTXOsLargestFirstOptions = {
3
+ targetAmount: number;
4
+ utxos: UTXO[];
5
+ };
6
+ /**
7
+ * Selects UTXOs using Largest-First (Accumulator) strategy
8
+ * Sorts UTXOs by value (descending) and selects until we have enough to cover amount + fees
9
+ *
10
+ * @param options.targetAmount - Target amount in satoshis (amount + fees + dust limit)
11
+ * @param options.utxos - Array of available UTXOs to select from
12
+ * @returns Selected UTXOs
13
+ */
14
+ export declare const selectUTXOsLargestFirst: (options: SelectUTXOsLargestFirstOptions) => UTXO[];
15
+ export {};
16
+ //# sourceMappingURL=selectUTXOsLargestFirst.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectUTXOsLargestFirst.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/selectUTXOsLargestFirst/selectUTXOsLargestFirst.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAElE,KAAK,8BAA8B,GAAG;IACpC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,YACzB,8BAA8B,WAmBxC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { validateAndSelectUTXOs } from './validateAndSelectUTXOs';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/validateAndSelectUTXOs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { UTXO } from '../../WaasBitcoinWalletProvider.types';
2
+ type ValidateAndSelectUTXOsOptions = {
3
+ allUTXOs: UTXO[];
4
+ amountInSatoshis: number;
5
+ feeEstimate: number;
6
+ selectedTotal: number;
7
+ selectedUTXOs: UTXO[];
8
+ };
9
+ /**
10
+ * Validates and ensures sufficient funds for the transaction
11
+ *
12
+ * @param options.allUTXOs - Complete array of available UTXOs for the address
13
+ * @param options.amountInSatoshis - Amount to send in satoshis
14
+ * @param options.feeEstimate - Estimated transaction fee in satoshis
15
+ * @param options.selectedTotal - Total value of initially selected UTXOs in satoshis
16
+ * @param options.selectedUTXOs - Array of initially selected UTXOs
17
+ * @returns Validated selected UTXOs
18
+ * @throws InsufficientFundsError if insufficient funds
19
+ */
20
+ export declare const validateAndSelectUTXOs: (options: ValidateAndSelectUTXOsOptions) => UTXO[];
21
+ export {};
22
+ //# sourceMappingURL=validateAndSelectUTXOs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateAndSelectUTXOs.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/validateAndSelectUTXOs/validateAndSelectUTXOs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uCAAuC,CAAC;AAGlE,KAAK,6BAA6B,GAAG;IACnC,QAAQ,EAAE,IAAI,EAAE,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,IAAI,EAAE,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,YACxB,6BAA6B,WAiCvC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { validateNotTaproot } from './validateNotTaproot';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/validateNotTaproot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Validates that the address is not a Taproot address
3
+ * Only Native SegWit (P2WPKH) is supported for PSBT building
4
+ *
5
+ * @param accountAddress - The account address to check
6
+ * @throws TaprootAddressNotSupportedError if address is Taproot
7
+ */
8
+ export declare const validateNotTaproot: (accountAddress: string) => void;
9
+ //# sourceMappingURL=validateNotTaproot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateNotTaproot.d.ts","sourceRoot":"","sources":["../../../../src/waas/utils/validateNotTaproot/validateNotTaproot.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,mBAAoB,MAAM,KAAG,IAO3D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs-sdk/bitcoin",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
@@ -27,13 +27,15 @@
27
27
  }
28
28
  },
29
29
  "dependencies": {
30
- "@dynamic-labs/sdk-api-core": "0.0.860",
30
+ "@bitcoinerlab/secp256k1": "1.2.0",
31
+ "@dynamic-labs/sdk-api-core": "0.0.864",
31
32
  "@leather.io/rpc": "2.20.20",
32
33
  "bitcoinjs-lib": "7.0.0",
34
+ "ecpair": "3.0.0",
33
35
  "jsontokens": "4.0.1",
34
36
  "sats-connect": "4.2.1",
35
- "@dynamic-labs-sdk/assert-package-version": "0.5.0",
36
- "@dynamic-labs-sdk/client": "0.5.0"
37
+ "@dynamic-labs-sdk/assert-package-version": "0.6.0",
38
+ "@dynamic-labs-sdk/client": "0.6.0"
37
39
  },
38
40
  "devDependencies": {
39
41
  "vitest": "1.6.1"