@dynamic-labs-wallet/node-btc 0.0.319 → 0.0.321

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.
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@dynamic-labs-wallet/node-btc",
3
- "version": "0.0.319",
3
+ "version": "0.0.321",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "dependencies": {
7
- "@dynamic-labs-wallet/core": "0.0.319",
8
- "@dynamic-labs-wallet/node": "0.0.319",
9
- "@dynamic-labs-wallet/btc-utils": "0.0.319",
7
+ "@dynamic-labs-wallet/core": "0.0.321",
8
+ "@dynamic-labs-wallet/node": "0.0.321",
9
+ "@dynamic-labs-wallet/btc-utils": "0.0.321",
10
10
  "@dynamic-labs/sdk-api-core": "^0.0.900",
11
11
  "bitcoinjs-lib": "^7.0.0",
12
12
  "tiny-secp256k1": "^2.2.3"
@@ -1,175 +0,0 @@
1
- import { DynamicWalletClient, type DynamicWalletClientProps, type ServerKeyShare, type ThresholdSignatureScheme, type EcdsaPublicKey, type BIP340KeygenResult, type EcdsaKeygenResult, type WalletProperties } from '@dynamic-labs-wallet/node';
2
- import type { SignMessageContext } from '@dynamic-labs/sdk-api-core';
3
- import { BitcoinAddressType, BitcoinNetwork, type BitcoinConfig } from '@dynamic-labs-wallet/core';
4
- export declare class DynamicBtcWalletClient extends DynamicWalletClient {
5
- readonly chainName = "BTC";
6
- constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, enableMPCAccelerator, logger, debug, }: DynamicWalletClientProps);
7
- /**
8
- * Derives the Bitcoin account address
9
- * - BIP340 keys (32 bytes x-only): Only for Taproot addresses
10
- * - ECDSA keys (33/65 bytes): For all other address types (Legacy, SegWit, Native SegWit)
11
- * - Algorithm selection is automatic based on addressType
12
- * @param rawPublicKey - The raw public key to derive the account address from
13
- * @param addressType - The address type to derive the account address for
14
- * @param network - The network to derive the account address for
15
- * @returns The account address
16
- */
17
- deriveAccountAddress({ rawPublicKey, addressType, network, }: {
18
- rawPublicKey: any;
19
- addressType: BitcoinAddressType;
20
- network: BitcoinNetwork;
21
- }): {
22
- accountAddress: string;
23
- };
24
- /**
25
- * Gets wallet properties and derivation info for a given account address
26
- * @param accountAddress - The account address
27
- * @returns The wallet properties, derivation path, and address type
28
- */
29
- private getWalletDerivationInfo;
30
- /**
31
- * Verifies that the derived address matches the expected address
32
- * @param rawPublicKey - The raw public key
33
- * @param addressType - The address type
34
- * @param network - The network
35
- * @param expectedAddress - The expected address
36
- */
37
- private verifyWalletAddress;
38
- /**
39
- * Creates a new wallet account and stores the key shares in the wallet map.
40
- * @param thresholdSignatureScheme - The threshold signature scheme to use for the wallet.
41
- * @param password - The password to use for the wallet.
42
- * @param onError - The function to call if an error occurs.
43
- * @param backUpToClientShareService - Whether to back up the external server key shares to the client share service. By default, it is false.
44
- * @param bitcoinConfig - Bitcoin configuration (addressType, network)
45
- * @returns The account address, public key, raw public key, external server key shares, and wallet id.
46
- */
47
- createWalletAccount({ thresholdSignatureScheme, password, onError, backUpToClientShareService, bitcoinConfig, }: {
48
- thresholdSignatureScheme: ThresholdSignatureScheme;
49
- password?: string;
50
- onError?: (error: Error) => void;
51
- backUpToClientShareService?: boolean;
52
- bitcoinConfig: BitcoinConfig;
53
- }): Promise<{
54
- accountAddress: string;
55
- publicKeyHex: string;
56
- rawPublicKey: EcdsaPublicKey | Uint8Array | string | undefined;
57
- /** @deprecated Use externalKeySharesWithBackupStatus instead */
58
- externalServerKeyShares: ServerKeyShare[];
59
- externalKeySharesWithBackupStatus: Array<{
60
- share: ServerKeyShare;
61
- backedUpToClientKeyShareService: boolean;
62
- }>;
63
- }>;
64
- /**
65
- * Signs a message for BTC using BIP-322 format
66
- *
67
- * The address type is automatically derived from the wallet's derivation path.
68
- * Supports both TAPROOT (BIP-86) and NATIVE_SEGWIT (BIP-84) address types.
69
- *
70
- * @param message - The message to sign
71
- * @param accountAddress - The account address
72
- * @param network - The Bitcoin network (MAINNET or TESTNET)
73
- * @param password - Optional password for encrypted backup shares
74
- * @param externalServerKeyShares - Optional external server key shares
75
- * @param context - Optional. Sign message context for API tracking
76
- * @param onError - Optional. Error callback function
77
- * @returns Promise resolving to the BIP-322 signature as a base64 string
78
- * @throws Error if required parameters are missing, derivation path is invalid, or signing fails
79
- */
80
- signMessage({ message, accountAddress, network, password, externalServerKeyShares, context, onError, }: {
81
- message: string;
82
- accountAddress: string;
83
- network: BitcoinNetwork;
84
- password?: string;
85
- externalServerKeyShares?: ServerKeyShare[];
86
- context?: SignMessageContext;
87
- onError?: (error: Error) => void;
88
- }): Promise<string>;
89
- /**
90
- * Signs a Bitcoin transaction (PSBT)
91
- *
92
- * The address type is automatically derived from the wallet's derivation path.
93
- * Only inputs belonging to the sender address are signed. Supports both TAPROOT
94
- * (BIP-341) and Native SegWit (BIP-143) signing methods.
95
- *
96
- * @param transaction - The PSBT to sign as a base64 string
97
- * @param senderAddress - The sender address (must match inputs to be signed)
98
- * @param network - The Bitcoin network (MAINNET or TESTNET)
99
- * @param password - Optional password for encrypted backup shares
100
- * @param externalServerKeyShares - Optional external server key shares
101
- * @param context - Optional. Sign message context for API tracking
102
- * @param onError - Optional. Error callback function
103
- * @returns Promise resolving to the signed PSBT as a base64 string
104
- * @throws Error if required parameters are missing, no inputs belong to sender address, or signing fails
105
- */
106
- signTransaction({ transaction, senderAddress, network, password, externalServerKeyShares, context, onError, }: {
107
- transaction: string;
108
- senderAddress: string;
109
- network: BitcoinNetwork;
110
- password?: string;
111
- externalServerKeyShares?: ServerKeyShare[];
112
- context?: SignMessageContext;
113
- onError?: (error: Error) => void;
114
- }): Promise<string>;
115
- /**
116
- * Exports the private key for a wallet
117
- * @param accountAddress - The account address to export the private key for
118
- * @param password - The password for encrypted backup shares
119
- * @param externalServerKeyShares - Optional external server key shares
120
- * @returns The private key in WIF format
121
- */
122
- exportPrivateKey({ accountAddress, password, externalServerKeyShares, }: {
123
- accountAddress: string;
124
- password?: string;
125
- externalServerKeyShares?: ServerKeyShare[];
126
- }): Promise<string>;
127
- /**
128
- * Exports the private key for a given account address offline using key shares
129
- * @param keyShares - The key shares to export the private key for
130
- * @param derivationPath - Optional derivation path
131
- * @param bitcoinConfig - Bitcoin configuration (address type, network)
132
- * @returns The private key in WIF format
133
- */
134
- offlineExportPrivateKey({ keyShares, derivationPath, bitcoinConfig, }: {
135
- keyShares: (EcdsaKeygenResult | BIP340KeygenResult)[];
136
- derivationPath?: string;
137
- bitcoinConfig?: BitcoinConfig;
138
- }): Promise<string>;
139
- /**
140
- * Imports a private key and stores the key shares in the wallet map.
141
- * @param privateKey - The private key to import (WIF format)
142
- * @param chainName - The chain name to use for the wallet
143
- * @param thresholdSignatureScheme - The threshold signature scheme to use for the wallet
144
- * @param password - The password to use for the wallet
145
- * @param onError - The function to call if an error occurs
146
- * @param backUpToClientShareService - Whether to back up the external server key shares to the client share service. By default, it is false.
147
- * @param bitcoinConfig - Bitcoin configuration (addressType, network)
148
- * @returns The account address, public key, raw public key, external server key shares
149
- */
150
- importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, backUpToClientShareService, onError, bitcoinConfig, }: {
151
- privateKey: string;
152
- chainName: string;
153
- thresholdSignatureScheme: ThresholdSignatureScheme;
154
- password?: string;
155
- backUpToClientShareService?: boolean;
156
- onError?: (error: Error) => void;
157
- bitcoinConfig: BitcoinConfig;
158
- }): Promise<{
159
- accountAddress: string;
160
- publicKeyHex: string;
161
- rawPublicKey: EcdsaPublicKey | Uint8Array | string | undefined;
162
- /** @deprecated Use externalKeySharesWithBackupStatus instead */
163
- externalServerKeyShares: ServerKeyShare[];
164
- externalKeySharesWithBackupStatus: Array<{
165
- share: ServerKeyShare;
166
- backedUpToClientKeyShareService: boolean;
167
- }>;
168
- }>;
169
- /**
170
- * Gets the Bitcoin wallets
171
- * @returns The Bitcoin wallets
172
- */
173
- getBitcoinWallets(): Promise<WalletProperties[]>;
174
- }
175
- //# sourceMappingURL=client.d.ts.map
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AC;KACJ,CAAC;IAiHF;;;OAGG;IACG,iBAAiB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAQvD"}
@@ -1,7 +0,0 @@
1
- export declare const ERROR_CREATE_WALLET_ACCOUNT = "Error creating wallet account";
2
- export declare const ERROR_ACCOUNT_ADDRESS_REQUIRED = "Account address is required";
3
- export declare const ERROR_SIGN_MESSAGE = "Error signing message";
4
- export declare const ERROR_SIGN_TRANSACTION = "Error signing transaction";
5
- export declare const ERROR_IMPORT_PRIVATE_KEY = "Error importing private key";
6
- export declare const ERROR_KEYGEN_FAILED = "Error with keygen";
7
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/client/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,kCAAkC,CAAC;AAC3E,eAAO,MAAM,8BAA8B,gCAAgC,CAAC;AAC5E,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAC1D,eAAO,MAAM,sBAAsB,8BAA8B,CAAC;AAClE,eAAO,MAAM,wBAAwB,gCAAgC,CAAC;AACtE,eAAO,MAAM,mBAAmB,sBAAsB,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from './client.js';
2
- export * from './constants.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC"}
package/src/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './client/index.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}