@dynamic-labs/bitcoin 2.2.8 → 2.2.10

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,26 @@
1
1
 
2
+ ### [2.2.10](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.9...v2.2.10) (2024-07-05)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * Allow user to close connect wallet modal to cancel making a wallet primary. ([#6251](https://github.com/dynamic-labs/DynamicAuth/issues/6251)) ([5a53fac](https://github.com/dynamic-labs/DynamicAuth/commit/5a53fac6e3e77de880e3fe5619b0c2be32fe5a92))
8
+ * Use white color in farcaster qr code when in dark mode to improve scanning. ([#6247](https://github.com/dynamic-labs/DynamicAuth/issues/6247)) ([1967bd7](https://github.com/dynamic-labs/DynamicAuth/commit/1967bd71423ae03c73fdce53adc41ad01f09a52e))
9
+
10
+ ### [2.2.9](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.8...v2.2.9) (2024-07-04)
11
+
12
+
13
+ ### Features
14
+
15
+ * add solana support for multi-asset ([#6239](https://github.com/dynamic-labs/DynamicAuth/issues/6239)) ([4e9a924](https://github.com/dynamic-labs/DynamicAuth/commit/4e9a92464253d60fce1542ca38664330e74cf4d6)), closes [#6222](https://github.com/dynamic-labs/DynamicAuth/issues/6222)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * relax phone number length validation ([#6226](https://github.com/dynamic-labs/DynamicAuth/issues/6226)) ([#6231](https://github.com/dynamic-labs/DynamicAuth/issues/6231)) ([2419441](https://github.com/dynamic-labs/DynamicAuth/commit/2419441f471a5edc3c0e831e24840d9d85d4a570))
21
+ * set last active account on accountChange request ([#6218](https://github.com/dynamic-labs/DynamicAuth/issues/6218)) ([#6228](https://github.com/dynamic-labs/DynamicAuth/issues/6228)) ([1842445](https://github.com/dynamic-labs/DynamicAuth/commit/184244535faeaea09f55ef0c0a62a4ace41432c7))
22
+ * stop auto-switching to connected secondary wallet if primary wallet is not connected ([#6196](https://github.com/dynamic-labs/DynamicAuth/issues/6196)) ([#6233](https://github.com/dynamic-labs/DynamicAuth/issues/6233)) ([82fd872](https://github.com/dynamic-labs/DynamicAuth/commit/82fd87251758b39c31dd334abc85dc05a7e8affa))
23
+
2
24
  ### [2.2.8](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.7...v2.2.8) (2024-07-01)
3
25
 
4
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/bitcoin",
3
- "version": "2.2.8",
3
+ "version": "2.2.10",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -32,9 +32,9 @@
32
32
  "@wallet-standard/base": "1.0.1",
33
33
  "bitcoinjs-lib": "6.1.5",
34
34
  "sats-connect": "2.0.0",
35
- "@dynamic-labs/utils": "2.2.8",
36
- "@dynamic-labs/wallet-book": "2.2.8",
37
- "@dynamic-labs/wallet-connector-core": "2.2.8",
35
+ "@dynamic-labs/utils": "2.2.10",
36
+ "@dynamic-labs/wallet-book": "2.2.10",
37
+ "@dynamic-labs/wallet-connector-core": "2.2.10",
38
38
  "stream": "0.0.2"
39
39
  },
40
40
  "peerDependencies": {}
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../../_virtual/_tslib.cjs');
7
+ var satsConnect = require('sats-connect');
7
8
  var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
8
9
  var walletBook = require('@dynamic-labs/wallet-book');
9
10
  var utils = require('@dynamic-labs/utils');
@@ -234,12 +235,14 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
234
235
  const { handleAccountChange, handleChainChange, handleDisconnect } = walletConnectorCore.eventListenerHandlers(this);
235
236
  const handleBitcoinAccountChange = (accounts) => _tslib.__awaiter(this, void 0, void 0, function* () {
236
237
  let connectedAccounts = accounts;
238
+ let ordinalsAccount, paymentAccount;
237
239
  // if accounts is an array of objects, we need to parse them to return only addresses
238
240
  // since ordinals is the main address we use, we should return it as the first address
239
241
  if (typeof accounts[0] === 'object') {
240
242
  connectedAccounts = accounts
241
- .sort((account) => (account.purpose === 'ordinals' ? -1 : 1))
243
+ .sort((account) => account.purpose === satsConnect.AddressPurpose.Ordinals ? -1 : 1)
242
244
  .map((account) => account.address);
245
+ [ordinalsAccount, paymentAccount] = connectedAccounts;
243
246
  }
244
247
  const currentConnectedAccounts = yield this.getConnectedAccountsFromCache();
245
248
  // don't do anything if the connected accounts haven't changed
@@ -251,6 +254,14 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
251
254
  // set the last account change request with the from and to addresses
252
255
  // to ensure that the requests are not duplicated
253
256
  this.setLastAccountChangeRequest(connectedAccounts[0]);
257
+ if (ordinalsAccount || paymentAccount) {
258
+ this.setConnectedAccountWithAddresses({
259
+ active: true,
260
+ mainAddress: ordinalsAccount !== null && ordinalsAccount !== void 0 ? ordinalsAccount : paymentAccount,
261
+ ordinalsAddress: ordinalsAccount,
262
+ paymentAddress: paymentAccount,
263
+ });
264
+ }
254
265
  handleAccountChange(connectedAccounts);
255
266
  });
256
267
  provider.on('accountsChanged', handleBitcoinAccountChange);
@@ -1,5 +1,6 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../_virtual/_tslib.js';
3
+ import { AddressPurpose } from 'sats-connect';
3
4
  import { WalletConnectorBase, eventListenerHandlers, logger } from '@dynamic-labs/wallet-connector-core';
4
5
  import { getWalletBookWallet, findWalletBookWallet } from '@dynamic-labs/wallet-book';
5
6
  import { isLedgerAddressViaVerifiedCredentials, DynamicError } from '@dynamic-labs/utils';
@@ -230,12 +231,14 @@ class BitcoinWalletConnector extends WalletConnectorBase {
230
231
  const { handleAccountChange, handleChainChange, handleDisconnect } = eventListenerHandlers(this);
231
232
  const handleBitcoinAccountChange = (accounts) => __awaiter(this, void 0, void 0, function* () {
232
233
  let connectedAccounts = accounts;
234
+ let ordinalsAccount, paymentAccount;
233
235
  // if accounts is an array of objects, we need to parse them to return only addresses
234
236
  // since ordinals is the main address we use, we should return it as the first address
235
237
  if (typeof accounts[0] === 'object') {
236
238
  connectedAccounts = accounts
237
- .sort((account) => (account.purpose === 'ordinals' ? -1 : 1))
239
+ .sort((account) => account.purpose === AddressPurpose.Ordinals ? -1 : 1)
238
240
  .map((account) => account.address);
241
+ [ordinalsAccount, paymentAccount] = connectedAccounts;
239
242
  }
240
243
  const currentConnectedAccounts = yield this.getConnectedAccountsFromCache();
241
244
  // don't do anything if the connected accounts haven't changed
@@ -247,6 +250,14 @@ class BitcoinWalletConnector extends WalletConnectorBase {
247
250
  // set the last account change request with the from and to addresses
248
251
  // to ensure that the requests are not duplicated
249
252
  this.setLastAccountChangeRequest(connectedAccounts[0]);
253
+ if (ordinalsAccount || paymentAccount) {
254
+ this.setConnectedAccountWithAddresses({
255
+ active: true,
256
+ mainAddress: ordinalsAccount !== null && ordinalsAccount !== void 0 ? ordinalsAccount : paymentAccount,
257
+ ordinalsAddress: ordinalsAccount,
258
+ paymentAddress: paymentAccount,
259
+ });
260
+ }
250
261
  handleAccountChange(connectedAccounts);
251
262
  });
252
263
  provider.on('accountsChanged', handleBitcoinAccountChange);
@@ -5,12 +5,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _const = require('../../const.cjs');
7
7
  require('../../../_virtual/_tslib.cjs');
8
+ require('sats-connect');
8
9
  require('@dynamic-labs/wallet-connector-core');
9
10
  require('@dynamic-labs/wallet-book');
10
11
  require('@dynamic-labs/utils');
11
12
  require('@dynamic-labs/sdk-api-core');
12
13
  require('@wallet-standard/app');
13
- require('sats-connect');
14
14
  require('bitcoinjs-lib');
15
15
  var BitcoinSatsConnectConnector = require('../../connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.cjs');
16
16
 
@@ -1,12 +1,12 @@
1
1
  'use client'
2
2
  import { SATSCONNECT_FEATURE } from '../../const.js';
3
3
  import '../../../_virtual/_tslib.js';
4
+ import 'sats-connect';
4
5
  import '@dynamic-labs/wallet-connector-core';
5
6
  import '@dynamic-labs/wallet-book';
6
7
  import '@dynamic-labs/utils';
7
8
  import '@dynamic-labs/sdk-api-core';
8
9
  import '@wallet-standard/app';
9
- import 'sats-connect';
10
10
  import 'bitcoinjs-lib';
11
11
  import { BitcoinSatsConnectConnector } from '../../connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.js';
12
12