@dynamic-labs/bitcoin 1.2.1 → 1.3.1
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
### [1.
|
|
2
|
+
### [1.3.1](https://github.com/dynamic-labs/DynamicAuth/compare/v1.3.0...v1.3.1) (2024-03-08)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* pass account and chain to walletClient ([#4865](https://github.com/dynamic-labs/DynamicAuth/issues/4865)) ([#4905](https://github.com/dynamic-labs/DynamicAuth/issues/4905)) ([0f4e79f](https://github.com/dynamic-labs/DynamicAuth/commit/0f4e79ff36f8a3ef63c59bb9f80429cdefbe7307))
|
|
8
|
+
* update btckit network conversion for signpsbt to use correct network ([#4882](https://github.com/dynamic-labs/DynamicAuth/issues/4882)) ([3c14f55](https://github.com/dynamic-labs/DynamicAuth/commit/3c14f55f6e37718a095752d0e04bfbac45fee75c))
|
|
9
|
+
* better auth state handling when logged in with disabled wallets ([#4862](https://github.com/dynamic-labs/DynamicAuth/issues/4862)) ([8cc2a1c](https://github.com/dynamic-labs/DynamicAuth/commit/8cc2a1c4f31cf6acb61d814a3410c5e77da21c50))
|
|
10
|
+
|
|
11
|
+
## [1.3.0](https://github.com/dynamic-labs/DynamicAuth/compare/v1.2.0...v1.3.0) (2024-03-05)
|
|
3
12
|
|
|
4
13
|
|
|
5
14
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/bitcoin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"@wallet-standard/base": "^1.0.1",
|
|
33
33
|
"bitcoinjs-lib": "^6.1.5",
|
|
34
34
|
"sats-connect": "^1.1.2",
|
|
35
|
-
"@dynamic-labs/utils": "1.
|
|
36
|
-
"@dynamic-labs/wallet-book": "1.
|
|
37
|
-
"@dynamic-labs/wallet-connector-core": "1.
|
|
35
|
+
"@dynamic-labs/utils": "1.3.1",
|
|
36
|
+
"@dynamic-labs/wallet-book": "1.3.1",
|
|
37
|
+
"@dynamic-labs/wallet-connector-core": "1.3.1",
|
|
38
38
|
"stream": "0.0.2"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {}
|
|
@@ -74,6 +74,11 @@ class BitcoinBtcKitConnector extends BitcoinWalletConnector.BitcoinWalletConnect
|
|
|
74
74
|
return response.result.txid;
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
+
convertNetworkTypeToNetworkMode() {
|
|
78
|
+
return this.currentNetwork === satsConnect.BitcoinNetworkType.Mainnet
|
|
79
|
+
? 'mainnet'
|
|
80
|
+
: 'testnet';
|
|
81
|
+
}
|
|
77
82
|
signPsbt(request) {
|
|
78
83
|
var _a, _b;
|
|
79
84
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -93,7 +98,7 @@ class BitcoinBtcKitConnector extends BitcoinWalletConnector.BitcoinWalletConnect
|
|
|
93
98
|
hex: psbtFromBase64.toHex(),
|
|
94
99
|
signAtIndex: (_b = request.signature) === null || _b === void 0 ? void 0 : _b.flatMap((sig) => sig.signingIndexes).filter(Number.isInteger),
|
|
95
100
|
};
|
|
96
|
-
const signedPsbtResponse = (yield this.btcKit.request('signPsbt', Object.assign({ broadcast: false, network }, signPsbtRequestParams)));
|
|
101
|
+
const signedPsbtResponse = (yield this.btcKit.request('signPsbt', Object.assign({ broadcast: false, network: this.convertNetworkTypeToNetworkMode() }, signPsbtRequestParams)));
|
|
97
102
|
if (!signedPsbtResponse ||
|
|
98
103
|
!('result' in signedPsbtResponse) ||
|
|
99
104
|
!('hex' in signedPsbtResponse.result)) {
|
|
@@ -13,5 +13,6 @@ export declare abstract class BitcoinBtcKitConnector extends BitcoinWalletConnec
|
|
|
13
13
|
fetchPublicAddress(): Promise<string | undefined>;
|
|
14
14
|
signMessage(messageToSign: string): Promise<string | undefined>;
|
|
15
15
|
sendBitcoin(transaction: BitcoinTransaction): Promise<string | undefined>;
|
|
16
|
+
convertNetworkTypeToNetworkMode(): "mainnet" | "testnet";
|
|
16
17
|
signPsbt(request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
|
|
17
18
|
}
|
|
@@ -70,6 +70,11 @@ class BitcoinBtcKitConnector extends BitcoinWalletConnector {
|
|
|
70
70
|
return response.result.txid;
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
+
convertNetworkTypeToNetworkMode() {
|
|
74
|
+
return this.currentNetwork === BitcoinNetworkType.Mainnet
|
|
75
|
+
? 'mainnet'
|
|
76
|
+
: 'testnet';
|
|
77
|
+
}
|
|
73
78
|
signPsbt(request) {
|
|
74
79
|
var _a, _b;
|
|
75
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -89,7 +94,7 @@ class BitcoinBtcKitConnector extends BitcoinWalletConnector {
|
|
|
89
94
|
hex: psbtFromBase64.toHex(),
|
|
90
95
|
signAtIndex: (_b = request.signature) === null || _b === void 0 ? void 0 : _b.flatMap((sig) => sig.signingIndexes).filter(Number.isInteger),
|
|
91
96
|
};
|
|
92
|
-
const signedPsbtResponse = (yield this.btcKit.request('signPsbt', Object.assign({ broadcast: false, network }, signPsbtRequestParams)));
|
|
97
|
+
const signedPsbtResponse = (yield this.btcKit.request('signPsbt', Object.assign({ broadcast: false, network: this.convertNetworkTypeToNetworkMode() }, signPsbtRequestParams)));
|
|
93
98
|
if (!signedPsbtResponse ||
|
|
94
99
|
!('result' in signedPsbtResponse) ||
|
|
95
100
|
!('hex' in signedPsbtResponse.result)) {
|