@dynamic-labs/bitcoin 3.0.0-alpha.5 → 3.0.0-alpha.6
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 +17 -0
- package/package.json +5 -5
- package/src/bitcoinProviderHelper.d.ts +4 -0
- package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.cjs +4 -12
- package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.js +4 -12
- package/src/connectors/BitcoinWalletConnector.cjs +4 -1
- package/src/connectors/BitcoinWalletConnector.js +4 -1
- package/src/connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.cjs +38 -0
- package/src/connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.d.ts +12 -0
- package/src/connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.js +34 -0
- package/src/connectors/FallbackBitcoinConnector/index.d.ts +1 -0
- package/src/connectors/index.d.ts +1 -0
- package/src/index.cjs +2 -1
- package/src/index.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.0.0-alpha.6](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.5...v3.0.0-alpha.6) (2024-06-18)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* implement useExternalAuth hook to signin using external jwt auth ([#6039](https://github.com/dynamic-labs/DynamicAuth/issues/6039)) ([ba90908](https://github.com/dynamic-labs/DynamicAuth/commit/ba90908509ec21f708a4a0782a7f94861fc3b484))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* allow sign-in with different ME BTC wallet after initial connection ([a527b46](https://github.com/dynamic-labs/DynamicAuth/commit/a527b464f321b4fc27730f57c3812e996b5ed878))
|
|
13
|
+
* close sign modal when signing in with a wallet when embedded wallet is enabled ([#6013](https://github.com/dynamic-labs/DynamicAuth/issues/6013)) ([0f4f3c8](https://github.com/dynamic-labs/DynamicAuth/commit/0f4f3c83db162f7a1794a3549b60bbad6b03e2c0))
|
|
14
|
+
* custom network without a valid icon should still display its name in network picker ([#6018](https://github.com/dynamic-labs/DynamicAuth/issues/6018)) ([0b10df6](https://github.com/dynamic-labs/DynamicAuth/commit/0b10df68950bfc9b8492443158a6bb030dc1122c))
|
|
15
|
+
* e2e: remove page pause ([#6045](https://github.com/dynamic-labs/DynamicAuth/issues/6045)) ([55bba00](https://github.com/dynamic-labs/DynamicAuth/commit/55bba0034255055d6ae266b1296542f47ed48e2b))
|
|
16
|
+
* more fixes for connect starknet button ([#6046](https://github.com/dynamic-labs/DynamicAuth/issues/6046)) ([0fb570a](https://github.com/dynamic-labs/DynamicAuth/commit/0fb570a44e65f8dd6d4d2bf5edb2ee54985ec9d4))
|
|
17
|
+
* set verified credentials on embedded wallet creation ([#6044](https://github.com/dynamic-labs/DynamicAuth/issues/6044)) ([b52a96d](https://github.com/dynamic-labs/DynamicAuth/commit/b52a96d321e7efdb30dce9cdb3f6f176c24ceb81))
|
|
18
|
+
|
|
2
19
|
## [3.0.0-alpha.5](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.4...v3.0.0-alpha.5) (2024-06-14)
|
|
3
20
|
|
|
4
21
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/bitcoin",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.6",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@btckit/types": "0.0.19",
|
|
30
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
30
|
+
"@dynamic-labs/sdk-api-core": "0.0.470",
|
|
31
31
|
"@wallet-standard/app": "1.0.1",
|
|
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": "3.0.0-alpha.
|
|
36
|
-
"@dynamic-labs/wallet-book": "3.0.0-alpha.
|
|
37
|
-
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.
|
|
35
|
+
"@dynamic-labs/utils": "3.0.0-alpha.6",
|
|
36
|
+
"@dynamic-labs/wallet-book": "3.0.0-alpha.6",
|
|
37
|
+
"@dynamic-labs/wallet-connector-core": "3.0.0-alpha.6",
|
|
38
38
|
"stream": "0.0.2"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {}
|
|
@@ -15,6 +15,10 @@ export declare class BitcoinProviderHelper {
|
|
|
15
15
|
features: string[];
|
|
16
16
|
name: string;
|
|
17
17
|
} | undefined;
|
|
18
|
+
walletStandardLocators?: {
|
|
19
|
+
name: string;
|
|
20
|
+
locator: string;
|
|
21
|
+
}[] | undefined;
|
|
18
22
|
windowLocations?: string[] | undefined;
|
|
19
23
|
} | undefined;
|
|
20
24
|
getProvider(): any;
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
7
|
var bitcoinjsLib = require('bitcoinjs-lib');
|
|
8
8
|
var satsConnect = require('sats-connect');
|
|
9
|
-
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
10
9
|
var utils = require('@dynamic-labs/utils');
|
|
11
10
|
var walletBook = require('@dynamic-labs/wallet-book');
|
|
12
11
|
var _const = require('../../const.cjs');
|
|
@@ -21,14 +20,13 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector.BitcoinWalletCo
|
|
|
21
20
|
constructor(opts) {
|
|
22
21
|
super(opts);
|
|
23
22
|
this.currentNetwork = satsConnect.BitcoinNetworkType.Mainnet;
|
|
24
|
-
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
this.canFetchConnectedAccounts = this.key !== 'xverse';
|
|
23
|
+
// satsconnect wallets don't support fetching connected accounts without prompting
|
|
24
|
+
// for a connection, so we handle getConnectedAccounts differently.
|
|
25
|
+
this.canFetchConnectedAccounts = false;
|
|
28
26
|
}
|
|
29
27
|
getAddress() {
|
|
30
28
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
var _a
|
|
29
|
+
var _a;
|
|
32
30
|
// xverse doesn't support wallet standard, so we won't have a wallet object,
|
|
33
31
|
// but it's already the default provider for sats-connect, so it's ok
|
|
34
32
|
// for getProvider in getAddress to return undefined
|
|
@@ -47,12 +45,6 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector.BitcoinWalletCo
|
|
|
47
45
|
window.location.href = deepLink;
|
|
48
46
|
return;
|
|
49
47
|
}
|
|
50
|
-
const cachedActiveAccount = yield this.cache.getActiveAccount();
|
|
51
|
-
if (cachedActiveAccount) {
|
|
52
|
-
const ordinalsAddress = cachedActiveAccount.additionalAddresses.find((address) => address.type === sdkApiCore.WalletAddressType.Ordinals);
|
|
53
|
-
const paymentAddress = cachedActiveAccount.additionalAddresses.find((address) => address.type === sdkApiCore.WalletAddressType.Payment);
|
|
54
|
-
return (_b = ordinalsAddress === null || ordinalsAddress === void 0 ? void 0 : ordinalsAddress.address) !== null && _b !== void 0 ? _b : paymentAddress === null || paymentAddress === void 0 ? void 0 : paymentAddress.address;
|
|
55
|
-
}
|
|
56
48
|
return new Promise((resolve, reject) => {
|
|
57
49
|
satsConnect.getAddress({
|
|
58
50
|
getProvider: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
3
|
import { Psbt } from 'bitcoinjs-lib';
|
|
4
4
|
import { BitcoinNetworkType, getAddress, AddressPurpose, signMessage, sendBtcTransaction, signTransaction } from 'sats-connect';
|
|
5
|
-
import { WalletAddressType } from '@dynamic-labs/sdk-api-core';
|
|
6
5
|
import { isMobile, template } from '@dynamic-labs/utils';
|
|
7
6
|
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
8
7
|
import { SATSCONNECT_FEATURE } from '../../const.js';
|
|
@@ -17,14 +16,13 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
|
|
|
17
16
|
constructor(opts) {
|
|
18
17
|
super(opts);
|
|
19
18
|
this.currentNetwork = BitcoinNetworkType.Mainnet;
|
|
20
|
-
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
this.canFetchConnectedAccounts = this.key !== 'xverse';
|
|
19
|
+
// satsconnect wallets don't support fetching connected accounts without prompting
|
|
20
|
+
// for a connection, so we handle getConnectedAccounts differently.
|
|
21
|
+
this.canFetchConnectedAccounts = false;
|
|
24
22
|
}
|
|
25
23
|
getAddress() {
|
|
26
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
var _a
|
|
25
|
+
var _a;
|
|
28
26
|
// xverse doesn't support wallet standard, so we won't have a wallet object,
|
|
29
27
|
// but it's already the default provider for sats-connect, so it's ok
|
|
30
28
|
// for getProvider in getAddress to return undefined
|
|
@@ -43,12 +41,6 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
|
|
|
43
41
|
window.location.href = deepLink;
|
|
44
42
|
return;
|
|
45
43
|
}
|
|
46
|
-
const cachedActiveAccount = yield this.cache.getActiveAccount();
|
|
47
|
-
if (cachedActiveAccount) {
|
|
48
|
-
const ordinalsAddress = cachedActiveAccount.additionalAddresses.find((address) => address.type === WalletAddressType.Ordinals);
|
|
49
|
-
const paymentAddress = cachedActiveAccount.additionalAddresses.find((address) => address.type === WalletAddressType.Payment);
|
|
50
|
-
return (_b = ordinalsAddress === null || ordinalsAddress === void 0 ? void 0 : ordinalsAddress.address) !== null && _b !== void 0 ? _b : paymentAddress === null || paymentAddress === void 0 ? void 0 : paymentAddress.address;
|
|
51
|
-
}
|
|
52
44
|
return new Promise((resolve, reject) => {
|
|
53
45
|
getAddress({
|
|
54
46
|
getProvider: () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -53,7 +53,10 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
53
53
|
}
|
|
54
54
|
endSession() {
|
|
55
55
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
yield
|
|
56
|
+
yield Promise.all([
|
|
57
|
+
this.cache.clearConnectedAcccounts(),
|
|
58
|
+
this.cache.clearLastBalance(),
|
|
59
|
+
]);
|
|
57
60
|
});
|
|
58
61
|
}
|
|
59
62
|
getBalance() {
|
|
@@ -49,7 +49,10 @@ class BitcoinWalletConnector extends WalletConnectorBase {
|
|
|
49
49
|
}
|
|
50
50
|
endSession() {
|
|
51
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
yield
|
|
52
|
+
yield Promise.all([
|
|
53
|
+
this.cache.clearConnectedAcccounts(),
|
|
54
|
+
this.cache.clearLastBalance(),
|
|
55
|
+
]);
|
|
53
56
|
});
|
|
54
57
|
}
|
|
55
58
|
getBalance() {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
|
+
var BitcoinWalletConnector = require('../BitcoinWalletConnector.cjs');
|
|
8
|
+
|
|
9
|
+
class FallbackBitcoinConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
|
|
10
|
+
constructor(opts) {
|
|
11
|
+
super(Object.assign(Object.assign({}, opts), { overrideKey: 'fallbackconnector' }));
|
|
12
|
+
this.name = 'Fallback Connector';
|
|
13
|
+
this.overrideKey = 'fallbackconnector';
|
|
14
|
+
this.isAvailable = false;
|
|
15
|
+
this.canFetchConnectedAccounts = false;
|
|
16
|
+
}
|
|
17
|
+
getAddress() {
|
|
18
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
return;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
signPsbt(
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
24
|
+
_request) {
|
|
25
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
return;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
sendBitcoin(
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
|
+
_transaction) {
|
|
32
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
return;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.FallbackBitcoinConnector = FallbackBitcoinConnector;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BitcoinSignPsbtRequest, BitcoinSignPsbtResponse, BitcoinTransaction } from '../../types';
|
|
2
|
+
import { BitcoinWalletConnector, BitcoinWalletConnectorOpts } from '../BitcoinWalletConnector';
|
|
3
|
+
export declare class FallbackBitcoinConnector extends BitcoinWalletConnector {
|
|
4
|
+
name: string;
|
|
5
|
+
overrideKey: string;
|
|
6
|
+
isAvailable: boolean;
|
|
7
|
+
canFetchConnectedAccounts: boolean;
|
|
8
|
+
constructor(opts: BitcoinWalletConnectorOpts);
|
|
9
|
+
getAddress(): Promise<string | undefined>;
|
|
10
|
+
signPsbt(_request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
|
|
11
|
+
sendBitcoin(_transaction: BitcoinTransaction): Promise<string | undefined>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
|
+
import { BitcoinWalletConnector } from '../BitcoinWalletConnector.js';
|
|
4
|
+
|
|
5
|
+
class FallbackBitcoinConnector extends BitcoinWalletConnector {
|
|
6
|
+
constructor(opts) {
|
|
7
|
+
super(Object.assign(Object.assign({}, opts), { overrideKey: 'fallbackconnector' }));
|
|
8
|
+
this.name = 'Fallback Connector';
|
|
9
|
+
this.overrideKey = 'fallbackconnector';
|
|
10
|
+
this.isAvailable = false;
|
|
11
|
+
this.canFetchConnectedAccounts = false;
|
|
12
|
+
}
|
|
13
|
+
getAddress() {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
return;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
signPsbt(
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
|
+
_request) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
return;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
sendBitcoin(
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
27
|
+
_transaction) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { FallbackBitcoinConnector };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FallbackBitcoinConnector } from './FallbackBitcoinConnector';
|
package/src/index.cjs
CHANGED
|
@@ -9,7 +9,6 @@ require('sats-connect');
|
|
|
9
9
|
require('bitcoinjs-lib');
|
|
10
10
|
require('@dynamic-labs/wallet-connector-core');
|
|
11
11
|
require('@dynamic-labs/utils');
|
|
12
|
-
require('@dynamic-labs/sdk-api-core');
|
|
13
12
|
require('@dynamic-labs/wallet-book');
|
|
14
13
|
var fetchBtcKitConnectors = require('./utils/fetchBtcKitConnectors/fetchBtcKitConnectors.cjs');
|
|
15
14
|
var fetchSatsConnectConnectors = require('./utils/fetchSatsConnectConnectors/fetchSatsConnectConnectors.cjs');
|
|
@@ -20,6 +19,7 @@ var PhantomConnector = require('./connectors/PhantomConnector/PhantomConnector.c
|
|
|
20
19
|
var OkxConnector = require('./connectors/OkxConnector/OkxConnector.cjs');
|
|
21
20
|
var UnisatConnector = require('./connectors/UnisatConnector/UnisatConnector.cjs');
|
|
22
21
|
var UnknownInjected = require('./connectors/UnknownInjected/UnknownInjected.cjs');
|
|
22
|
+
var FallbackBitcoinConnector = require('./connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.cjs');
|
|
23
23
|
|
|
24
24
|
const BitcoinWalletConnectors = (props) => [
|
|
25
25
|
...fetchSatsConnectConnectors.fetchSatsConnectConnectors(props),
|
|
@@ -28,6 +28,7 @@ const BitcoinWalletConnectors = (props) => [
|
|
|
28
28
|
OkxConnector.OkxConnector,
|
|
29
29
|
UnisatConnector.UnisatConnector,
|
|
30
30
|
UnknownInjected.UnknownInjectedConnector,
|
|
31
|
+
FallbackBitcoinConnector.FallbackBitcoinConnector,
|
|
31
32
|
];
|
|
32
33
|
|
|
33
34
|
exports.BitcoinWalletConnector = BitcoinWalletConnector.BitcoinWalletConnector;
|
package/src/index.js
CHANGED
|
@@ -5,7 +5,6 @@ import 'sats-connect';
|
|
|
5
5
|
import 'bitcoinjs-lib';
|
|
6
6
|
import '@dynamic-labs/wallet-connector-core';
|
|
7
7
|
import '@dynamic-labs/utils';
|
|
8
|
-
import '@dynamic-labs/sdk-api-core';
|
|
9
8
|
import '@dynamic-labs/wallet-book';
|
|
10
9
|
import { fetchBtcKitConnectors } from './utils/fetchBtcKitConnectors/fetchBtcKitConnectors.js';
|
|
11
10
|
export { fetchBtcKitConnectors } from './utils/fetchBtcKitConnectors/fetchBtcKitConnectors.js';
|
|
@@ -18,6 +17,7 @@ import { PhantomConnector } from './connectors/PhantomConnector/PhantomConnector
|
|
|
18
17
|
import { OkxConnector } from './connectors/OkxConnector/OkxConnector.js';
|
|
19
18
|
import { UnisatConnector } from './connectors/UnisatConnector/UnisatConnector.js';
|
|
20
19
|
import { UnknownInjectedConnector } from './connectors/UnknownInjected/UnknownInjected.js';
|
|
20
|
+
import { FallbackBitcoinConnector } from './connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.js';
|
|
21
21
|
|
|
22
22
|
const BitcoinWalletConnectors = (props) => [
|
|
23
23
|
...fetchSatsConnectConnectors(props),
|
|
@@ -26,6 +26,7 @@ const BitcoinWalletConnectors = (props) => [
|
|
|
26
26
|
OkxConnector,
|
|
27
27
|
UnisatConnector,
|
|
28
28
|
UnknownInjectedConnector,
|
|
29
|
+
FallbackBitcoinConnector,
|
|
29
30
|
];
|
|
30
31
|
|
|
31
32
|
export { BitcoinWalletConnectors };
|