@dynamic-labs/bitcoin 2.0.0 → 2.0.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,4 +1,18 @@
1
1
 
2
+ ### [2.0.1](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0...v2.0.1) (2024-04-18)
3
+
4
+
5
+ ### Features
6
+
7
+ * add redirectUri to farcaster connect ([#5373](https://github.com/dynamic-labs/DynamicAuth/issues/5373)) ([#5383](https://github.com/dynamic-labs/DynamicAuth/issues/5383)) ([d031d7e](https://github.com/dynamic-labs/DynamicAuth/commit/d031d7ee5705de5ec83ef328f03633d5f3524786))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * copy and ui fixes ([#5367](https://github.com/dynamic-labs/DynamicAuth/issues/5367)) ([e39ea97](https://github.com/dynamic-labs/DynamicAuth/commit/e39ea97d98de6b7087c24f2326a5fdc07ab9c8c3))
13
+ * bitcoin connector improvements
14
+ * solana package improvements ([#5360](https://github.com/dynamic-labs/DynamicAuth/issues/5360)) ([#5385](https://github.com/dynamic-labs/DynamicAuth/issues/5385)) ([9010bce](https://github.com/dynamic-labs/DynamicAuth/commit/9010bcebb4b0f2d293d517347187d38accbac0d3))
15
+
2
16
  ## [2.0.0-alpha.32](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.31...v2.0.0-alpha.32) (2024-04-15)
3
17
 
4
18
  ## [2.0.0-alpha.31](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.30...v2.0.0-alpha.31) (2024-04-11)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/bitcoin",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -31,10 +31,10 @@
31
31
  "@wallet-standard/app": "1.0.1",
32
32
  "@wallet-standard/base": "1.0.1",
33
33
  "bitcoinjs-lib": "6.1.5",
34
- "sats-connect": "1.1.2",
35
- "@dynamic-labs/utils": "2.0.0",
36
- "@dynamic-labs/wallet-book": "2.0.0",
37
- "@dynamic-labs/wallet-connector-core": "2.0.0",
34
+ "sats-connect": "2.0.0",
35
+ "@dynamic-labs/utils": "2.0.1",
36
+ "@dynamic-labs/wallet-book": "2.0.1",
37
+ "@dynamic-labs/wallet-connector-core": "2.0.1",
38
38
  "stream": "0.0.2"
39
39
  },
40
40
  "peerDependencies": {}
@@ -17,8 +17,8 @@ class BitcoinBtcKitConnector extends BitcoinWalletConnector.BitcoinWalletConnect
17
17
  this.btcKit = btcKit;
18
18
  }
19
19
  getAddress() {
20
- var _a;
21
20
  return _tslib.__awaiter(this, void 0, void 0, function* () {
21
+ var _a;
22
22
  const [connectedAccount] = yield this.getConnectedAccounts();
23
23
  if (connectedAccount) {
24
24
  return connectedAccount;
@@ -65,7 +65,8 @@ class BitcoinBtcKitConnector extends BitcoinWalletConnector.BitcoinWalletConnect
65
65
  }
66
66
  const response = yield this.btcKit.request('sendTransfer', {
67
67
  address: transaction.recipientAddress,
68
- amount: transaction.amount,
68
+ amount: transaction.amount.toString(),
69
+ network: this.convertNetworkTypeToNetworkMode(),
69
70
  });
70
71
  if (!('result' in response)) {
71
72
  walletConnectorCore.logger.error('Transaction error', response);
@@ -80,8 +81,8 @@ class BitcoinBtcKitConnector extends BitcoinWalletConnector.BitcoinWalletConnect
80
81
  : 'testnet';
81
82
  }
82
83
  signPsbt(request) {
83
- var _a, _b;
84
84
  return _tslib.__awaiter(this, void 0, void 0, function* () {
85
+ var _a, _b;
85
86
  const connectedAddress = yield this.getAddress();
86
87
  if (!connectedAddress || !this.btcKit) {
87
88
  return;
@@ -13,8 +13,8 @@ class BitcoinBtcKitConnector extends BitcoinWalletConnector {
13
13
  this.btcKit = btcKit;
14
14
  }
15
15
  getAddress() {
16
- var _a;
17
16
  return __awaiter(this, void 0, void 0, function* () {
17
+ var _a;
18
18
  const [connectedAccount] = yield this.getConnectedAccounts();
19
19
  if (connectedAccount) {
20
20
  return connectedAccount;
@@ -61,7 +61,8 @@ class BitcoinBtcKitConnector extends BitcoinWalletConnector {
61
61
  }
62
62
  const response = yield this.btcKit.request('sendTransfer', {
63
63
  address: transaction.recipientAddress,
64
- amount: transaction.amount,
64
+ amount: transaction.amount.toString(),
65
+ network: this.convertNetworkTypeToNetworkMode(),
65
66
  });
66
67
  if (!('result' in response)) {
67
68
  logger.error('Transaction error', response);
@@ -76,8 +77,8 @@ class BitcoinBtcKitConnector extends BitcoinWalletConnector {
76
77
  : 'testnet';
77
78
  }
78
79
  signPsbt(request) {
79
- var _a, _b;
80
80
  return __awaiter(this, void 0, void 0, function* () {
81
+ var _a, _b;
81
82
  const connectedAddress = yield this.getAddress();
82
83
  if (!connectedAddress || !this.btcKit) {
83
84
  return;
@@ -96,8 +96,8 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector.BitcoinWalletCo
96
96
  });
97
97
  }
98
98
  sendBitcoin(transaction) {
99
- var _a;
100
99
  return _tslib.__awaiter(this, void 0, void 0, function* () {
100
+ var _a;
101
101
  const mainAddress = yield this.getAddress();
102
102
  const senderAddress = (_a = (yield this.getAdditionalAddresses(mainAddress)).find((address) => address.type === 'payment')) === null || _a === void 0 ? void 0 : _a.address;
103
103
  if (!senderAddress || !supportsSatsConnect.supportsSatsConnect(this)) {
@@ -164,8 +164,8 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector.BitcoinWalletCo
164
164
  });
165
165
  }
166
166
  signPsbt(request) {
167
- var _a, _b, _c, _d;
168
167
  return _tslib.__awaiter(this, void 0, void 0, function* () {
168
+ var _a, _b, _c, _d;
169
169
  if (!((_a = request.allowedSighash) === null || _a === void 0 ? void 0 : _a.length))
170
170
  throw new Error('allowedSighash cannot be an empty array');
171
171
  const network = bitcoinNetworkTypeToNetworks.convertNetworkTypeForPsbt(this.currentNetwork);
@@ -92,8 +92,8 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
92
92
  });
93
93
  }
94
94
  sendBitcoin(transaction) {
95
- var _a;
96
95
  return __awaiter(this, void 0, void 0, function* () {
96
+ var _a;
97
97
  const mainAddress = yield this.getAddress();
98
98
  const senderAddress = (_a = (yield this.getAdditionalAddresses(mainAddress)).find((address) => address.type === 'payment')) === null || _a === void 0 ? void 0 : _a.address;
99
99
  if (!senderAddress || !supportsSatsConnect(this)) {
@@ -160,8 +160,8 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
160
160
  });
161
161
  }
162
162
  signPsbt(request) {
163
- var _a, _b, _c, _d;
164
163
  return __awaiter(this, void 0, void 0, function* () {
164
+ var _a, _b, _c, _d;
165
165
  if (!((_a = request.allowedSighash) === null || _a === void 0 ? void 0 : _a.length))
166
166
  throw new Error('allowedSighash cannot be an empty array');
167
167
  const network = convertNetworkTypeForPsbt(this.currentNetwork);
@@ -42,8 +42,8 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
42
42
  });
43
43
  }
44
44
  getBalance() {
45
- var _a;
46
45
  return _tslib.__awaiter(this, void 0, void 0, function* () {
46
+ var _a;
47
47
  const [connectedAddress] = yield this.getConnectedAccounts();
48
48
  if (!connectedAddress) {
49
49
  throw new utils.DynamicError('getBalance - No connected address found!');
@@ -78,8 +78,8 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
78
78
  });
79
79
  }
80
80
  getConnectedAccountsFromCache() {
81
- var _a;
82
81
  return _tslib.__awaiter(this, void 0, void 0, function* () {
82
+ var _a;
83
83
  const currentAccount = yield this.cache.getActiveAccount();
84
84
  const allAccounts = yield this.cache.getConnectedAccounts();
85
85
  const allConnectedAddresses = (_a = Object.keys(allAccounts || {})) !== null && _a !== void 0 ? _a : [];
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { EventEmitter } from 'stream';
3
4
  import type { Wallet } from '@wallet-standard/base';
4
5
  import { Chain, IBitcoinWalletConnector, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
@@ -38,8 +38,8 @@ class BitcoinWalletConnector extends WalletConnectorBase {
38
38
  });
39
39
  }
40
40
  getBalance() {
41
- var _a;
42
41
  return __awaiter(this, void 0, void 0, function* () {
42
+ var _a;
43
43
  const [connectedAddress] = yield this.getConnectedAccounts();
44
44
  if (!connectedAddress) {
45
45
  throw new DynamicError('getBalance - No connected address found!');
@@ -74,8 +74,8 @@ class BitcoinWalletConnector extends WalletConnectorBase {
74
74
  });
75
75
  }
76
76
  getConnectedAccountsFromCache() {
77
- var _a;
78
77
  return __awaiter(this, void 0, void 0, function* () {
78
+ var _a;
79
79
  const currentAccount = yield this.cache.getActiveAccount();
80
80
  const allAccounts = yield this.cache.getConnectedAccounts();
81
81
  const allConnectedAddresses = (_a = Object.keys(allAccounts || {})) !== null && _a !== void 0 ? _a : [];
@@ -44,7 +44,7 @@ class OkxConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
44
44
  if (!connectedAddress || !provider) {
45
45
  return;
46
46
  }
47
- return provider.sendBitcoin(transaction.recipientAddress, transaction.amount);
47
+ return provider.sendBitcoin(transaction.recipientAddress, transaction.amount.toString());
48
48
  });
49
49
  }
50
50
  signPsbt(request) {
@@ -40,7 +40,7 @@ class OkxConnector extends BitcoinWalletConnector {
40
40
  if (!connectedAddress || !provider) {
41
41
  return;
42
42
  }
43
- return provider.sendBitcoin(transaction.recipientAddress, transaction.amount);
43
+ return provider.sendBitcoin(transaction.recipientAddress, transaction.amount.toString());
44
44
  });
45
45
  }
46
46
  signPsbt(request) {
@@ -46,7 +46,7 @@ class UnisatConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
46
46
  if (!connectedAddress || !provider) {
47
47
  return;
48
48
  }
49
- return provider.sendBitcoin(transaction.recipientAddress, transaction.amount);
49
+ return provider.sendBitcoin(transaction.recipientAddress, transaction.amount.toString());
50
50
  });
51
51
  }
52
52
  signPsbt(request) {
@@ -42,7 +42,7 @@ class UnisatConnector extends BitcoinWalletConnector {
42
42
  if (!connectedAddress || !provider) {
43
43
  return;
44
44
  }
45
- return provider.sendBitcoin(transaction.recipientAddress, transaction.amount);
45
+ return provider.sendBitcoin(transaction.recipientAddress, transaction.amount.toString());
46
46
  });
47
47
  }
48
48
  signPsbt(request) {