@dynamic-labs/bitcoin 1.4.6 → 1.4.7

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,14 @@
1
1
 
2
+ ### [1.4.7](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.6...v1.4.7) (2024-04-12)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * ui and layout improvements ([#5269](https://github.com/dynamic-labs/DynamicAuth/issues/5269)) ([#5296](https://github.com/dynamic-labs/DynamicAuth/issues/5296)) ([a1f7204](https://github.com/dynamic-labs/DynamicAuth/commit/a1f7204e44b4ae1650f86b76663c0802530935cb)) ([#5270](https://github.com/dynamic-labs/DynamicAuth/issues/5270)) ([#5278](https://github.com/dynamic-labs/DynamicAuth/issues/5278)) ([5f262f5](https://github.com/dynamic-labs/DynamicAuth/commit/5f262f54bba8eb2fa6346040478dd0417f42d2d1))
8
+ * callback trigger fixes ([#5310](https://github.com/dynamic-labs/DynamicAuth/issues/5310)) ([e6f7720](https://github.com/dynamic-labs/DynamicAuth/commit/e6f7720781a68b9d36448e4edea834e6478e7263))
9
+ * improve bridge connect experience on mobile ([#5284](https://github.com/dynamic-labs/DynamicAuth/issues/5284)) ([c8eab02](https://github.com/dynamic-labs/DynamicAuth/commit/c8eab0243ca5752d365fd907fde36b7c08669d5e))
10
+ * improve integration with i18n ([#5267](https://github.com/dynamic-labs/DynamicAuth/issues/5267)) ([#5313](https://github.com/dynamic-labs/DynamicAuth/issues/5313)) ([5f02f72](https://github.com/dynamic-labs/DynamicAuth/commit/5f02f72fe547e93d59a2545ffcce62c20fb22dbe))
11
+
2
12
  ### [1.4.6](https://github.com/dynamic-labs/DynamicAuth/compare/v1.4.5...v1.4.6) (2024-04-09)
3
13
 
4
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/bitcoin",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
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.4.6",
36
- "@dynamic-labs/wallet-book": "1.4.6",
37
- "@dynamic-labs/wallet-connector-core": "1.4.6",
35
+ "@dynamic-labs/utils": "1.4.7",
36
+ "@dynamic-labs/wallet-book": "1.4.7",
37
+ "@dynamic-labs/wallet-connector-core": "1.4.7",
38
38
  "stream": "0.0.2"
39
39
  },
40
40
  "peerDependencies": {}
@@ -42,13 +42,19 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
42
42
  });
43
43
  }
44
44
  getBalance() {
45
+ var _a;
45
46
  return _tslib.__awaiter(this, void 0, void 0, function* () {
46
47
  const [connectedAddress] = yield this.getConnectedAccounts();
47
48
  if (!connectedAddress) {
48
49
  throw new utils.DynamicError('getBalance - No connected address found!');
49
50
  }
50
- const API_URL = getMempoolApiUrl.getMempoolApiUrl(connectedAddress);
51
- const response = yield fetch(`${API_URL}/address/${connectedAddress}`);
51
+ const additionalAddresses = yield this.getAdditionalAddresses(connectedAddress);
52
+ const paymentAddress = (_a = additionalAddresses.find((address) => address.type === sdkApi.WalletAddressType.Payment)) === null || _a === void 0 ? void 0 : _a.address;
53
+ if (!paymentAddress) {
54
+ throw new utils.DynamicError('getBalance - No payment address found!');
55
+ }
56
+ const API_URL = getMempoolApiUrl.getMempoolApiUrl(paymentAddress);
57
+ const response = yield fetch(`${API_URL}/address/${paymentAddress}`);
52
58
  if (!response.ok) {
53
59
  // if the request fails due to rate limits, return cached value
54
60
  if (response.status === _const.HTTP_STATUS_TOO_MANY_REQUESTS) {
@@ -38,13 +38,19 @@ class BitcoinWalletConnector extends WalletConnectorBase {
38
38
  });
39
39
  }
40
40
  getBalance() {
41
+ var _a;
41
42
  return __awaiter(this, void 0, void 0, function* () {
42
43
  const [connectedAddress] = yield this.getConnectedAccounts();
43
44
  if (!connectedAddress) {
44
45
  throw new DynamicError('getBalance - No connected address found!');
45
46
  }
46
- const API_URL = getMempoolApiUrl(connectedAddress);
47
- const response = yield fetch(`${API_URL}/address/${connectedAddress}`);
47
+ const additionalAddresses = yield this.getAdditionalAddresses(connectedAddress);
48
+ const paymentAddress = (_a = additionalAddresses.find((address) => address.type === WalletAddressType.Payment)) === null || _a === void 0 ? void 0 : _a.address;
49
+ if (!paymentAddress) {
50
+ throw new DynamicError('getBalance - No payment address found!');
51
+ }
52
+ const API_URL = getMempoolApiUrl(paymentAddress);
53
+ const response = yield fetch(`${API_URL}/address/${paymentAddress}`);
48
54
  if (!response.ok) {
49
55
  // if the request fails due to rate limits, return cached value
50
56
  if (response.status === HTTP_STATUS_TOO_MANY_REQUESTS) {