@dynamic-labs/bitcoin 4.8.4 → 4.8.5
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 +13 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +6 -6
- package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.cjs +11 -0
- package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.d.ts +1 -0
- package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.js +11 -0
- package/src/connectors/BitcoinWalletConnector.cjs +12 -1
- package/src/connectors/BitcoinWalletConnector.d.ts +1 -0
- package/src/connectors/BitcoinWalletConnector.js +12 -1
- package/src/types.d.ts +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.8.5](https://github.com/dynamic-labs/dynamic-auth/compare/v4.8.4...v4.8.5) (2025-03-06)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* evm connector can sign arbitrary transactions ([#8217](https://github.com/dynamic-labs/dynamic-auth/issues/8217)) ([c5b227c](https://github.com/dynamic-labs/dynamic-auth/commit/c5b227c5a5d527f3fc74b8c1c9d0247eaf35a016))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* optimize shadow dom re-renders ([#8193](https://github.com/dynamic-labs/dynamic-auth/issues/8193)) ([c97310c](https://github.com/dynamic-labs/dynamic-auth/commit/c97310c9f3eb73b9f69b0b48a79e6bbd93d2e94a))
|
|
13
|
+
* show multichain wallets with zerodev ([#8220](https://github.com/dynamic-labs/dynamic-auth/issues/8220)) ([a48689d](https://github.com/dynamic-labs/dynamic-auth/commit/a48689da1303512551bdf8114de45493d33221a3))
|
|
14
|
+
|
|
2
15
|
### [4.8.4](https://github.com/dynamic-labs/dynamic-auth/compare/v4.8.3...v4.8.4) (2025-03-05)
|
|
3
16
|
|
|
4
17
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/bitcoin",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.5",
|
|
4
4
|
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"bitcoinjs-lib": "6.1.5",
|
|
26
26
|
"sats-connect": "3.0.1",
|
|
27
27
|
"jsontokens": "4.0.1",
|
|
28
|
-
"@dynamic-labs/assert-package-version": "4.8.
|
|
29
|
-
"@dynamic-labs/types": "4.8.
|
|
30
|
-
"@dynamic-labs/utils": "4.8.
|
|
31
|
-
"@dynamic-labs/wallet-book": "4.8.
|
|
32
|
-
"@dynamic-labs/wallet-connector-core": "4.8.
|
|
28
|
+
"@dynamic-labs/assert-package-version": "4.8.5",
|
|
29
|
+
"@dynamic-labs/types": "4.8.5",
|
|
30
|
+
"@dynamic-labs/utils": "4.8.5",
|
|
31
|
+
"@dynamic-labs/wallet-book": "4.8.5",
|
|
32
|
+
"@dynamic-labs/wallet-connector-core": "4.8.5",
|
|
33
33
|
"eventemitter3": "5.0.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {}
|
|
@@ -13,6 +13,7 @@ var BitcoinWalletConnector = require('../BitcoinWalletConnector.cjs');
|
|
|
13
13
|
var createSignPsbtOptions = require('../../utils/psbt/createSignPsbtOptions.cjs');
|
|
14
14
|
var _const = require('../../const.cjs');
|
|
15
15
|
var getSatsConnectSigningProtocol = require('../../utils/getSatsConnectSigningProtocol/getSatsConnectSigningProtocol.cjs');
|
|
16
|
+
var satoshisToBtc = require('../../utils/satoshisToBtc/satoshisToBtc.cjs');
|
|
16
17
|
|
|
17
18
|
class BitcoinSatsConnectConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
|
|
18
19
|
constructor(opts) {
|
|
@@ -25,6 +26,16 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector.BitcoinWalletCo
|
|
|
25
26
|
(_c = opts.walletData.injectedConfig[0].walletStandard) === null || _c === void 0 ? void 0 : _c.providerId;
|
|
26
27
|
}
|
|
27
28
|
}
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30
|
+
getBalance(address) {
|
|
31
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
const balance = yield satsConnect.request('getBalance', undefined);
|
|
33
|
+
if (balance.status !== 'success') {
|
|
34
|
+
throw balance.error;
|
|
35
|
+
}
|
|
36
|
+
return satoshisToBtc.satoshisToBtc(Number(balance.result.confirmed)).toString();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
28
39
|
getGenericUserCancelledError() {
|
|
29
40
|
const error = new Error();
|
|
30
41
|
error.code = '-32000'; // error code for user cancelled
|
|
@@ -6,6 +6,7 @@ export declare abstract class BitcoinSatsConnectConnector extends BitcoinWalletC
|
|
|
6
6
|
currentNetwork: BitcoinNetworkType;
|
|
7
7
|
providerId: string | undefined;
|
|
8
8
|
constructor(opts: BitcoinWalletConnectorOpts);
|
|
9
|
+
getBalance(address: string): Promise<string | undefined>;
|
|
9
10
|
private getGenericUserCancelledError;
|
|
10
11
|
private getAddresses;
|
|
11
12
|
/**
|
|
@@ -9,6 +9,7 @@ import { BitcoinWalletConnector } from '../BitcoinWalletConnector.js';
|
|
|
9
9
|
import { createSignPsbtOptionsForSatsConnect } from '../../utils/psbt/createSignPsbtOptions.js';
|
|
10
10
|
import { SATSCONNECT_FEATURE } from '../../const.js';
|
|
11
11
|
import { getSatsConnectSigningProtocol } from '../../utils/getSatsConnectSigningProtocol/getSatsConnectSigningProtocol.js';
|
|
12
|
+
import { satoshisToBtc } from '../../utils/satoshisToBtc/satoshisToBtc.js';
|
|
12
13
|
|
|
13
14
|
class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
|
|
14
15
|
constructor(opts) {
|
|
@@ -21,6 +22,16 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
|
|
|
21
22
|
(_c = opts.walletData.injectedConfig[0].walletStandard) === null || _c === void 0 ? void 0 : _c.providerId;
|
|
22
23
|
}
|
|
23
24
|
}
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
26
|
+
getBalance(address) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const balance = yield request('getBalance', undefined);
|
|
29
|
+
if (balance.status !== 'success') {
|
|
30
|
+
throw balance.error;
|
|
31
|
+
}
|
|
32
|
+
return satoshisToBtc(Number(balance.result.confirmed)).toString();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
24
35
|
getGenericUserCancelledError() {
|
|
25
36
|
const error = new Error();
|
|
26
37
|
error.code = '-32000'; // error code for user cancelled
|
|
@@ -65,7 +65,7 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
65
65
|
yield this.cache.clearConnectedAcccounts();
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
apiGetBalance(address) {
|
|
69
69
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
70
70
|
const API_URL = getMempoolApiUrl.getMempoolApiUrl(address);
|
|
71
71
|
const response = yield fetch(`${API_URL}/address/${address}`);
|
|
@@ -92,6 +92,17 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
92
92
|
return balance.toString();
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
+
getBalance(address) {
|
|
96
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
const provider = this.getProvider();
|
|
98
|
+
if (!(provider === null || provider === void 0 ? void 0 : provider.getBalance)) {
|
|
99
|
+
return this.apiGetBalance(address);
|
|
100
|
+
}
|
|
101
|
+
const balanceResponse = yield provider.getBalance();
|
|
102
|
+
const balance = satoshisToBtc.satoshisToBtc(balanceResponse.total);
|
|
103
|
+
return balance.toString();
|
|
104
|
+
});
|
|
105
|
+
}
|
|
95
106
|
getConnectedAccountsFromCache() {
|
|
96
107
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
97
108
|
var _a;
|
|
@@ -33,6 +33,7 @@ export declare abstract class BitcoinWalletConnector extends WalletConnectorBase
|
|
|
33
33
|
isInstalledOnBrowser(): boolean;
|
|
34
34
|
getDeepLink(): string | undefined;
|
|
35
35
|
endSession(): Promise<void>;
|
|
36
|
+
private apiGetBalance;
|
|
36
37
|
getBalance(address: string): Promise<string | undefined>;
|
|
37
38
|
getConnectedAccountsFromCache(): Promise<string[]>;
|
|
38
39
|
getConnectedAccounts(): Promise<string[]>;
|
|
@@ -61,7 +61,7 @@ class BitcoinWalletConnector extends WalletConnectorBase {
|
|
|
61
61
|
yield this.cache.clearConnectedAcccounts();
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
apiGetBalance(address) {
|
|
65
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
66
|
const API_URL = getMempoolApiUrl(address);
|
|
67
67
|
const response = yield fetch(`${API_URL}/address/${address}`);
|
|
@@ -88,6 +88,17 @@ class BitcoinWalletConnector extends WalletConnectorBase {
|
|
|
88
88
|
return balance.toString();
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
+
getBalance(address) {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const provider = this.getProvider();
|
|
94
|
+
if (!(provider === null || provider === void 0 ? void 0 : provider.getBalance)) {
|
|
95
|
+
return this.apiGetBalance(address);
|
|
96
|
+
}
|
|
97
|
+
const balanceResponse = yield provider.getBalance();
|
|
98
|
+
const balance = satoshisToBtc(balanceResponse.total);
|
|
99
|
+
return balance.toString();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
91
102
|
getConnectedAccountsFromCache() {
|
|
92
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
93
104
|
var _a;
|
package/src/types.d.ts
CHANGED
|
@@ -129,3 +129,12 @@ export type BitcoinWalletStandardMethods = {
|
|
|
129
129
|
signAndSendTransaction?: BitcoinSignAndSendTransactionMethod;
|
|
130
130
|
};
|
|
131
131
|
export type BitcoinSignProtocol = 'ecdsa' | 'bip322-simple';
|
|
132
|
+
interface ProviderBalance {
|
|
133
|
+
confirmed: number;
|
|
134
|
+
unconfirmed: number;
|
|
135
|
+
total: number;
|
|
136
|
+
}
|
|
137
|
+
export interface ProviderWithBalance {
|
|
138
|
+
getBalance: () => Promise<ProviderBalance>;
|
|
139
|
+
}
|
|
140
|
+
export {};
|