@dynamic-labs-wallet/btc 1.1.35 → 1.1.37
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/index.cjs +26 -2
- package/index.esm.js +26 -2
- package/package.json +3 -3
- package/src/client/client.d.ts +15 -2
- package/src/client/client.d.ts.map +1 -1
package/index.cjs
CHANGED
|
@@ -360,7 +360,29 @@ class DynamicBtcWalletClient extends browser.DynamicWalletClient {
|
|
|
360
360
|
* @param mfaToken - The MFA token to use for the private key
|
|
361
361
|
* @param network - The network to use for the private key
|
|
362
362
|
* @returns The private key
|
|
363
|
-
*/
|
|
363
|
+
*/ /**
|
|
364
|
+
* Builds the export Intent for a BTC wallet.
|
|
365
|
+
*
|
|
366
|
+
* Overridden so BTC can supply the address type the signer needs. It selects
|
|
367
|
+
* the derivation path, so without it the export id cannot be computed. It is
|
|
368
|
+
* resolved from the wallet exactly as `exportPrivateKey` does, so the Intent
|
|
369
|
+
* binds the same export id the export itself will compute.
|
|
370
|
+
*/ async prepareExportIntent(params) {
|
|
371
|
+
var _params_bitcoinConfig;
|
|
372
|
+
const walletProperties = this.getWalletFromMap(params.accountAddress);
|
|
373
|
+
var _params_bitcoinConfig_addressType;
|
|
374
|
+
const addressType = btcUtils.resolveBitcoinAddressType({
|
|
375
|
+
accountAddress: params.accountAddress,
|
|
376
|
+
addressType: (_params_bitcoinConfig_addressType = (_params_bitcoinConfig = params.bitcoinConfig) == null ? void 0 : _params_bitcoinConfig.addressType) != null ? _params_bitcoinConfig_addressType : walletProperties == null ? void 0 : walletProperties.addressType,
|
|
377
|
+
derivationPath: walletProperties == null ? void 0 : walletProperties.derivationPath
|
|
378
|
+
});
|
|
379
|
+
return await super.prepareExportIntent(_extends({}, params, {
|
|
380
|
+
bitcoinConfig: {
|
|
381
|
+
addressType
|
|
382
|
+
}
|
|
383
|
+
}));
|
|
384
|
+
}
|
|
385
|
+
async exportPrivateKey({ accountAddress, password = undefined, signedSessionId, mfaToken, elevatedAccessToken, approvalQuorum, proposalId }) {
|
|
364
386
|
await this.verifyPassword({
|
|
365
387
|
accountAddress,
|
|
366
388
|
password,
|
|
@@ -389,7 +411,9 @@ class DynamicBtcWalletClient extends browser.DynamicWalletClient {
|
|
|
389
411
|
password,
|
|
390
412
|
signedSessionId,
|
|
391
413
|
mfaToken,
|
|
392
|
-
elevatedAccessToken
|
|
414
|
+
elevatedAccessToken,
|
|
415
|
+
approvalQuorum,
|
|
416
|
+
proposalId
|
|
393
417
|
});
|
|
394
418
|
if (!derivedPrivateKey) {
|
|
395
419
|
throw new Error('Failed to derive private key');
|
package/index.esm.js
CHANGED
|
@@ -339,7 +339,29 @@ class DynamicBtcWalletClient extends DynamicWalletClient {
|
|
|
339
339
|
* @param mfaToken - The MFA token to use for the private key
|
|
340
340
|
* @param network - The network to use for the private key
|
|
341
341
|
* @returns The private key
|
|
342
|
-
*/
|
|
342
|
+
*/ /**
|
|
343
|
+
* Builds the export Intent for a BTC wallet.
|
|
344
|
+
*
|
|
345
|
+
* Overridden so BTC can supply the address type the signer needs. It selects
|
|
346
|
+
* the derivation path, so without it the export id cannot be computed. It is
|
|
347
|
+
* resolved from the wallet exactly as `exportPrivateKey` does, so the Intent
|
|
348
|
+
* binds the same export id the export itself will compute.
|
|
349
|
+
*/ async prepareExportIntent(params) {
|
|
350
|
+
var _params_bitcoinConfig;
|
|
351
|
+
const walletProperties = this.getWalletFromMap(params.accountAddress);
|
|
352
|
+
var _params_bitcoinConfig_addressType;
|
|
353
|
+
const addressType = resolveBitcoinAddressType({
|
|
354
|
+
accountAddress: params.accountAddress,
|
|
355
|
+
addressType: (_params_bitcoinConfig_addressType = (_params_bitcoinConfig = params.bitcoinConfig) == null ? void 0 : _params_bitcoinConfig.addressType) != null ? _params_bitcoinConfig_addressType : walletProperties == null ? void 0 : walletProperties.addressType,
|
|
356
|
+
derivationPath: walletProperties == null ? void 0 : walletProperties.derivationPath
|
|
357
|
+
});
|
|
358
|
+
return await super.prepareExportIntent(_extends({}, params, {
|
|
359
|
+
bitcoinConfig: {
|
|
360
|
+
addressType
|
|
361
|
+
}
|
|
362
|
+
}));
|
|
363
|
+
}
|
|
364
|
+
async exportPrivateKey({ accountAddress, password = undefined, signedSessionId, mfaToken, elevatedAccessToken, approvalQuorum, proposalId }) {
|
|
343
365
|
await this.verifyPassword({
|
|
344
366
|
accountAddress,
|
|
345
367
|
password,
|
|
@@ -368,7 +390,9 @@ class DynamicBtcWalletClient extends DynamicWalletClient {
|
|
|
368
390
|
password,
|
|
369
391
|
signedSessionId,
|
|
370
392
|
mfaToken,
|
|
371
|
-
elevatedAccessToken
|
|
393
|
+
elevatedAccessToken,
|
|
394
|
+
approvalQuorum,
|
|
395
|
+
proposalId
|
|
372
396
|
});
|
|
373
397
|
if (!derivedPrivateKey) {
|
|
374
398
|
throw new Error('Failed to derive private key');
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/btc",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.37",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "0.50.0",
|
|
9
|
-
"@dynamic-labs-wallet/browser": "1.1.
|
|
10
|
-
"@dynamic-labs-wallet/btc-utils": "1.1.
|
|
9
|
+
"@dynamic-labs-wallet/browser": "1.1.37",
|
|
10
|
+
"@dynamic-labs-wallet/btc-utils": "1.1.37",
|
|
11
11
|
"@bitcoinerlab/secp256k1": "^1.2.0",
|
|
12
12
|
"bitcoinjs-lib": "^7.0.0"
|
|
13
13
|
},
|
package/src/client/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BitcoinAddressType, BitcoinNetwork, DynamicWalletClient, type BIP340KeygenResult, type BitcoinConfig, type DynamicWalletClientInternalOptions, type DynamicWalletClientProps, type EcdsaPublicKey, type EcdsaSignature, type ThresholdSignatureScheme, type RequestWithElevatedAccessToken, type BaseSignParams, type ApprovalQuorumRequestContext } from '@dynamic-labs-wallet/browser';
|
|
1
|
+
import { BitcoinAddressType, BitcoinNetwork, DynamicWalletClient, type BIP340KeygenResult, type BitcoinConfig, type DynamicWalletClientInternalOptions, type DynamicWalletClientProps, type EcdsaPublicKey, type EcdsaSignature, type ThresholdSignatureScheme, type RequestWithElevatedAccessToken, type BaseSignParams, type ApprovalQuorumRequestContext, type ExportApprovalQuorumRequest } from '@dynamic-labs-wallet/browser';
|
|
2
2
|
export declare class DynamicBtcWalletClient extends DynamicWalletClient {
|
|
3
3
|
readonly chainName = "BTC";
|
|
4
4
|
/**
|
|
@@ -105,11 +105,24 @@ export declare class DynamicBtcWalletClient extends DynamicWalletClient {
|
|
|
105
105
|
* @param network - The network to use for the private key
|
|
106
106
|
* @returns The private key
|
|
107
107
|
*/
|
|
108
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Builds the export Intent for a BTC wallet.
|
|
110
|
+
*
|
|
111
|
+
* Overridden so BTC can supply the address type the signer needs. It selects
|
|
112
|
+
* the derivation path, so without it the export id cannot be computed. It is
|
|
113
|
+
* resolved from the wallet exactly as `exportPrivateKey` does, so the Intent
|
|
114
|
+
* binds the same export id the export itself will compute.
|
|
115
|
+
*/
|
|
116
|
+
prepareExportIntent(params: Parameters<DynamicWalletClient['prepareExportIntent']>[0]): Promise<import("@dynamic-labs-wallet/core").ExportIntent>;
|
|
117
|
+
exportPrivateKey({ accountAddress, password, signedSessionId, mfaToken, elevatedAccessToken, approvalQuorum, proposalId, }: RequestWithElevatedAccessToken<{
|
|
109
118
|
accountAddress: string;
|
|
110
119
|
password?: string;
|
|
111
120
|
signedSessionId: string;
|
|
112
121
|
mfaToken?: string;
|
|
122
|
+
/** The initiator's signed export Intent, from `prepareExportIntent`. */
|
|
123
|
+
approvalQuorum?: ExportApprovalQuorumRequest;
|
|
124
|
+
/** The approved export proposal being redeemed, from the consent error the export call raised. */
|
|
125
|
+
proposalId?: string;
|
|
113
126
|
}>): Promise<string>;
|
|
114
127
|
/**
|
|
115
128
|
* Imports a private key and creates a Bitcoin wallet account
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EAQnB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,kCAAkC,EACvC,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,8BAA8B,EACnC,KAAK,cAAc,EAEnB,KAAK,4BAA4B,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EAQnB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,kCAAkC,EACvC,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,8BAA8B,EACnC,KAAK,cAAc,EAEnB,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EACjC,MAAM,8BAA8B,CAAC;AAiCtC,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,QAAQ,CAAC,SAAS,SAAS;IAE3B;;;OAGG;gBACS,KAAK,EAAE,wBAAwB,EAAE,eAAe,CAAC,EAAE,kCAAkC;IAOjG;;;;;;;;OAQG;IACG,mBAAmB,CAAC,EACxB,wBAAwB,EACxB,QAAoB,EACpB,OAAO,EACP,eAAe,EACf,aAAa,EACb,iBAAiB,GAClB,EAAE;QACD,wBAAwB,EAAE,wBAAwB,CAAC;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,CAAC,KAA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