@dynamic-labs/bitcoin 4.0.0-alpha.11 → 4.0.0-alpha.12
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 +18 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +7 -7
- package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.cjs +38 -0
- package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.d.ts +3 -0
- package/src/connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.js +40 -2
- package/src/connectors/BitcoinWalletConnector.cjs +8 -0
- package/src/connectors/BitcoinWalletConnector.d.ts +1 -1
- package/src/connectors/BitcoinWalletConnector.js +8 -0
- package/src/connectors/OylConnector/OylConnector.cjs +68 -0
- package/src/connectors/OylConnector/OylConnector.d.ts +10 -0
- package/src/connectors/OylConnector/OylConnector.js +64 -0
- package/src/connectors/OylConnector/index.d.ts +1 -0
- package/src/connectors/PhantomConnector/PhantomConnector.cjs +1 -7
- package/src/connectors/PhantomConnector/PhantomConnector.d.ts +1 -2
- package/src/connectors/PhantomConnector/PhantomConnector.js +1 -7
- package/src/connectors/index.d.ts +1 -0
- package/src/index.cjs +2 -0
- package/src/index.d.ts +2 -2
- package/src/index.js +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.0.0-alpha.12](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.11...v4.0.0-alpha.12) (2024-10-18)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add support for xverse account change event ([#7114](https://github.com/dynamic-labs/dynamic-auth/issues/7114)) ([79df047](https://github.com/dynamic-labs/dynamic-auth/commit/79df04775edb297a339e2d74adcc873584a6d8af))
|
|
8
|
+
* solana embedded signall headless ([#7132](https://github.com/dynamic-labs/dynamic-auth/issues/7132)) ([fe16b71](https://github.com/dynamic-labs/dynamic-auth/commit/fe16b71a4c0ad775f8de87ca899cfdd1071f11d6))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* bug where embeddedWalletCreated event was fired before listener … ([#7151](https://github.com/dynamic-labs/dynamic-auth/issues/7151)) ([ae9da56](https://github.com/dynamic-labs/dynamic-auth/commit/ae9da56850130491384a2d5f47c1617815dcce5b))
|
|
14
|
+
* edge case where wallet book fails to load ([#7148](https://github.com/dynamic-labs/dynamic-auth/issues/7148)) ([805dc6d](https://github.com/dynamic-labs/dynamic-auth/commit/805dc6d7cc4cdf0b23748d82b3bd8216d88d55b5))
|
|
15
|
+
* issues where native currency icons were incorrect ([#7126](https://github.com/dynamic-labs/dynamic-auth/issues/7126)) ([8b8891a](https://github.com/dynamic-labs/dynamic-auth/commit/8b8891a52397e17cc127ea3a09ade14c4b70a8ee))
|
|
16
|
+
* remove now-unused sessionTimeout from useSocial ([#7123](https://github.com/dynamic-labs/dynamic-auth/issues/7123)) ([7959a8a](https://github.com/dynamic-labs/dynamic-auth/commit/7959a8a4c8ceb76c5c4f1ae91af204bf9c5cae7b))
|
|
17
|
+
* Revert: Update Exodus extension version " ([#7130](https://github.com/dynamic-labs/dynamic-auth/issues/7130)) ([f2274ae](https://github.com/dynamic-labs/dynamic-auth/commit/f2274aefd29bb9f3fb6de8493e4a5f73946a5600)), closes [#7129](https://github.com/dynamic-labs/dynamic-auth/issues/7129)
|
|
18
|
+
* use embedded primaryChain when passing undefined chains list to createTurnkeyWallet ([#7149](https://github.com/dynamic-labs/dynamic-auth/issues/7149)) ([c73a3ae](https://github.com/dynamic-labs/dynamic-auth/commit/c73a3aeeda8045b936d218f7078ad79967c321ef))
|
|
19
|
+
|
|
2
20
|
## [4.0.0-alpha.11](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.10...v4.0.0-alpha.11) (2024-10-15)
|
|
3
21
|
|
|
4
22
|
|
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.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.12",
|
|
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",
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@btckit/types": "0.0.19",
|
|
22
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
22
|
+
"@dynamic-labs/sdk-api-core": "0.0.547",
|
|
23
23
|
"@wallet-standard/app": "1.0.1",
|
|
24
24
|
"@wallet-standard/base": "1.0.1",
|
|
25
25
|
"bitcoinjs-lib": "6.1.5",
|
|
26
26
|
"sats-connect": "2.8.0",
|
|
27
|
-
"@dynamic-labs/assert-package-version": "4.0.0-alpha.
|
|
28
|
-
"@dynamic-labs/types": "4.0.0-alpha.
|
|
29
|
-
"@dynamic-labs/utils": "4.0.0-alpha.
|
|
30
|
-
"@dynamic-labs/wallet-book": "4.0.0-alpha.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.
|
|
27
|
+
"@dynamic-labs/assert-package-version": "4.0.0-alpha.12",
|
|
28
|
+
"@dynamic-labs/types": "4.0.0-alpha.12",
|
|
29
|
+
"@dynamic-labs/utils": "4.0.0-alpha.12",
|
|
30
|
+
"@dynamic-labs/wallet-book": "4.0.0-alpha.12",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.12",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {}
|
|
@@ -16,9 +16,14 @@ var _const = require('../../const.cjs');
|
|
|
16
16
|
|
|
17
17
|
class BitcoinSatsConnectConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
|
|
18
18
|
constructor(opts) {
|
|
19
|
+
var _a, _b, _c;
|
|
19
20
|
super(opts);
|
|
20
21
|
this.isLegacy = false;
|
|
21
22
|
this.currentNetwork = satsConnect.BitcoinNetworkType.Mainnet;
|
|
23
|
+
if ((_b = (_a = opts.walletData) === null || _a === void 0 ? void 0 : _a.injectedConfig) === null || _b === void 0 ? void 0 : _b.length) {
|
|
24
|
+
this.providerId =
|
|
25
|
+
(_c = opts.walletData.injectedConfig[0].walletStandard) === null || _c === void 0 ? void 0 : _c.providerId;
|
|
26
|
+
}
|
|
22
27
|
}
|
|
23
28
|
getGenericUserCancelledError() {
|
|
24
29
|
const error = new Error();
|
|
@@ -247,6 +252,39 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector.BitcoinWalletCo
|
|
|
247
252
|
return;
|
|
248
253
|
});
|
|
249
254
|
}
|
|
255
|
+
handleXverseAccountChange() {
|
|
256
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
257
|
+
const { handleAccountChange } = walletConnectorCore.eventListenerHandlers(this);
|
|
258
|
+
// xverse doesn't return the new account address, so we need to get it manually
|
|
259
|
+
const accounts = yield this.getAddresses();
|
|
260
|
+
if (!accounts) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
const connectedAccounts = [accounts];
|
|
264
|
+
handleAccountChange(connectedAccounts);
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
setupEventListeners() {
|
|
268
|
+
// even if we pass a providerId, to addListener, it doesn't work
|
|
269
|
+
// the event fires multiple times, so we're using the default implementation for non xverse wallets
|
|
270
|
+
if (this.key !== 'xverse') {
|
|
271
|
+
super.setupEventListeners();
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
try {
|
|
275
|
+
const removeListener = satsConnect.addListener('accountChange', this.handleXverseAccountChange.bind(this));
|
|
276
|
+
this.teardownEventListeners = () => {
|
|
277
|
+
walletConnectorCore.logger.debug('[BitcoinSatsConnectConnector] teardownEventListeners');
|
|
278
|
+
removeListener();
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
catch (error) {
|
|
282
|
+
walletConnectorCore.logger.debug('[BitcoinSatsConnectConnector] setupEventListeners', {
|
|
283
|
+
connector: this.key,
|
|
284
|
+
error,
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
250
288
|
}
|
|
251
289
|
|
|
252
290
|
exports.BitcoinSatsConnectConnector = BitcoinSatsConnectConnector;
|
|
@@ -4,6 +4,7 @@ import { BitcoinWalletConnector, BitcoinWalletConnectorOpts } from '../BitcoinWa
|
|
|
4
4
|
export declare abstract class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
|
|
5
5
|
isLegacy: boolean;
|
|
6
6
|
currentNetwork: BitcoinNetworkType;
|
|
7
|
+
providerId: string | undefined;
|
|
7
8
|
constructor(opts: BitcoinWalletConnectorOpts);
|
|
8
9
|
private getGenericUserCancelledError;
|
|
9
10
|
private getAddresses;
|
|
@@ -15,4 +16,6 @@ export declare abstract class BitcoinSatsConnectConnector extends BitcoinWalletC
|
|
|
15
16
|
signPsbt(request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
|
|
16
17
|
signPsbts(requests: BitcoinSignPsbtRequest[]): Promise<string[] | undefined>;
|
|
17
18
|
validateActiveWallet(expectedAddress: string): Promise<void>;
|
|
19
|
+
private handleXverseAccountChange;
|
|
20
|
+
setupEventListeners(): void;
|
|
18
21
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
3
|
import { Psbt } from 'bitcoinjs-lib';
|
|
4
|
-
import { BitcoinNetworkType, request, AddressPurpose, signMultipleTransactions } from 'sats-connect';
|
|
4
|
+
import { BitcoinNetworkType, request, AddressPurpose, signMultipleTransactions, addListener } from 'sats-connect';
|
|
5
5
|
import { isMobile, template } from '@dynamic-labs/utils';
|
|
6
6
|
import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
|
|
7
|
-
import { logger } from '@dynamic-labs/wallet-connector-core';
|
|
7
|
+
import { logger, eventListenerHandlers } from '@dynamic-labs/wallet-connector-core';
|
|
8
8
|
import { convertNetworkTypeForPsbt } from '../../utils/psbt/bitcoinNetworkTypeToNetworks.js';
|
|
9
9
|
import { BitcoinWalletConnector } from '../BitcoinWalletConnector.js';
|
|
10
10
|
import { createSignPsbtOptionsForSatsConnect } from '../../utils/psbt/createSignPsbtOptions.js';
|
|
@@ -12,9 +12,14 @@ import { SATSCONNECT_FEATURE } from '../../const.js';
|
|
|
12
12
|
|
|
13
13
|
class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
|
|
14
14
|
constructor(opts) {
|
|
15
|
+
var _a, _b, _c;
|
|
15
16
|
super(opts);
|
|
16
17
|
this.isLegacy = false;
|
|
17
18
|
this.currentNetwork = BitcoinNetworkType.Mainnet;
|
|
19
|
+
if ((_b = (_a = opts.walletData) === null || _a === void 0 ? void 0 : _a.injectedConfig) === null || _b === void 0 ? void 0 : _b.length) {
|
|
20
|
+
this.providerId =
|
|
21
|
+
(_c = opts.walletData.injectedConfig[0].walletStandard) === null || _c === void 0 ? void 0 : _c.providerId;
|
|
22
|
+
}
|
|
18
23
|
}
|
|
19
24
|
getGenericUserCancelledError() {
|
|
20
25
|
const error = new Error();
|
|
@@ -243,6 +248,39 @@ class BitcoinSatsConnectConnector extends BitcoinWalletConnector {
|
|
|
243
248
|
return;
|
|
244
249
|
});
|
|
245
250
|
}
|
|
251
|
+
handleXverseAccountChange() {
|
|
252
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
253
|
+
const { handleAccountChange } = eventListenerHandlers(this);
|
|
254
|
+
// xverse doesn't return the new account address, so we need to get it manually
|
|
255
|
+
const accounts = yield this.getAddresses();
|
|
256
|
+
if (!accounts) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const connectedAccounts = [accounts];
|
|
260
|
+
handleAccountChange(connectedAccounts);
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
setupEventListeners() {
|
|
264
|
+
// even if we pass a providerId, to addListener, it doesn't work
|
|
265
|
+
// the event fires multiple times, so we're using the default implementation for non xverse wallets
|
|
266
|
+
if (this.key !== 'xverse') {
|
|
267
|
+
super.setupEventListeners();
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
try {
|
|
271
|
+
const removeListener = addListener('accountChange', this.handleXverseAccountChange.bind(this));
|
|
272
|
+
this.teardownEventListeners = () => {
|
|
273
|
+
logger.debug('[BitcoinSatsConnectConnector] teardownEventListeners');
|
|
274
|
+
removeListener();
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
catch (error) {
|
|
278
|
+
logger.debug('[BitcoinSatsConnectConnector] setupEventListeners', {
|
|
279
|
+
connector: this.key,
|
|
280
|
+
error,
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
246
284
|
}
|
|
247
285
|
|
|
248
286
|
export { BitcoinSatsConnectConnector };
|
|
@@ -184,6 +184,14 @@ class BitcoinWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
|
184
184
|
return response.text();
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
+
// not all wallets support sendBitcoin method
|
|
188
|
+
// so we have a default implementation that returns undefined
|
|
189
|
+
sendBitcoin(transaction) {
|
|
190
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
191
|
+
walletConnectorCore.logger.debug('sendBitcoin - function not implemented', transaction);
|
|
192
|
+
return undefined;
|
|
193
|
+
});
|
|
194
|
+
}
|
|
187
195
|
getProvider() {
|
|
188
196
|
var _a;
|
|
189
197
|
return (_a = this.bitcoinProviderHelper) === null || _a === void 0 ? void 0 : _a.getProvider();
|
|
@@ -38,7 +38,7 @@ export declare abstract class BitcoinWalletConnector extends WalletConnectorBase
|
|
|
38
38
|
getAdditionalAddresses(mainAddress?: string): Promise<WalletAdditionalAddress[]>;
|
|
39
39
|
setAdditionalAddresses(mainAddress: string, additionalAddresses: WalletAdditionalAddress[]): Promise<void>;
|
|
40
40
|
sendRawTransaction(rawTransaction: string): Promise<string>;
|
|
41
|
-
|
|
41
|
+
sendBitcoin(transaction: BitcoinTransaction): Promise<string | undefined>;
|
|
42
42
|
getProvider<T>(): T & EventEmitter<string | symbol, any>;
|
|
43
43
|
abstract signPsbt(request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
|
|
44
44
|
signPsbts(requests: BitcoinSignPsbtRequest[]): Promise<string[] | undefined>;
|
|
@@ -180,6 +180,14 @@ class BitcoinWalletConnector extends WalletConnectorBase {
|
|
|
180
180
|
return response.text();
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
|
+
// not all wallets support sendBitcoin method
|
|
184
|
+
// so we have a default implementation that returns undefined
|
|
185
|
+
sendBitcoin(transaction) {
|
|
186
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
logger.debug('sendBitcoin - function not implemented', transaction);
|
|
188
|
+
return undefined;
|
|
189
|
+
});
|
|
190
|
+
}
|
|
183
191
|
getProvider() {
|
|
184
192
|
var _a;
|
|
185
193
|
return (_a = this.bitcoinProviderHelper) === null || _a === void 0 ? void 0 : _a.getProvider();
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
|
+
var bitcoinjsLib = require('bitcoinjs-lib');
|
|
8
|
+
var BitcoinWalletConnector = require('../BitcoinWalletConnector.cjs');
|
|
9
|
+
var createSignPsbtOptions = require('../../utils/psbt/createSignPsbtOptions.cjs');
|
|
10
|
+
|
|
11
|
+
class OylConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
|
|
12
|
+
constructor(opts) {
|
|
13
|
+
super(Object.assign(Object.assign({}, opts), { overrideKey: 'oylwallet' }));
|
|
14
|
+
this.name = 'Oyl Wallet';
|
|
15
|
+
this.overrideKey = 'oylwallet';
|
|
16
|
+
}
|
|
17
|
+
getAddress() {
|
|
18
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
var _a;
|
|
20
|
+
const provider = this.getProvider();
|
|
21
|
+
if (!provider) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const addresses = yield provider.getAddresses();
|
|
25
|
+
const ordinalsAddress = addresses.taproot;
|
|
26
|
+
const paymentAddress = addresses.nativeSegwit;
|
|
27
|
+
const mainAddress = (_a = ordinalsAddress === null || ordinalsAddress === void 0 ? void 0 : ordinalsAddress.address) !== null && _a !== void 0 ? _a : paymentAddress === null || paymentAddress === void 0 ? void 0 : paymentAddress.address;
|
|
28
|
+
yield this.setConnectedAccountWithAddresses({
|
|
29
|
+
active: true,
|
|
30
|
+
mainAddress,
|
|
31
|
+
ordinalsAddress,
|
|
32
|
+
paymentAddress,
|
|
33
|
+
});
|
|
34
|
+
return mainAddress;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
signMessage(messageToSign, withAddress) {
|
|
38
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const provider = this.getProvider();
|
|
40
|
+
if (!provider) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const { signature } = yield provider.signMessage({
|
|
44
|
+
address: withAddress,
|
|
45
|
+
message: messageToSign,
|
|
46
|
+
});
|
|
47
|
+
return signature;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
signPsbt(request) {
|
|
51
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const provider = this.getProvider();
|
|
53
|
+
if (!provider) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const psbtFromBase64 = bitcoinjsLib.Psbt.fromBase64(request.unsignedPsbtBase64);
|
|
57
|
+
const options = createSignPsbtOptions.createPsbtOptions(psbtFromBase64, request);
|
|
58
|
+
const { psbt: signedPsbtHex } = yield provider.signPsbt({
|
|
59
|
+
broadcast: false,
|
|
60
|
+
finalize: options.autoFinalized,
|
|
61
|
+
psbt: psbtFromBase64.toHex(),
|
|
62
|
+
});
|
|
63
|
+
return { signedPsbt: bitcoinjsLib.Psbt.fromHex(signedPsbtHex).toBase64() };
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
exports.OylConnector = OylConnector;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BitcoinWalletConnector, BitcoinWalletConnectorOpts } from '../BitcoinWalletConnector';
|
|
2
|
+
import { BitcoinSignPsbtRequest, BitcoinSignPsbtResponse } from '../../types';
|
|
3
|
+
export declare class OylConnector extends BitcoinWalletConnector {
|
|
4
|
+
name: string;
|
|
5
|
+
overrideKey: string;
|
|
6
|
+
constructor(opts: BitcoinWalletConnectorOpts);
|
|
7
|
+
getAddress(): Promise<string | undefined>;
|
|
8
|
+
signMessage(messageToSign: string, withAddress: string): Promise<string | undefined>;
|
|
9
|
+
signPsbt(request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
|
+
import { Psbt } from 'bitcoinjs-lib';
|
|
4
|
+
import { BitcoinWalletConnector } from '../BitcoinWalletConnector.js';
|
|
5
|
+
import { createPsbtOptions } from '../../utils/psbt/createSignPsbtOptions.js';
|
|
6
|
+
|
|
7
|
+
class OylConnector extends BitcoinWalletConnector {
|
|
8
|
+
constructor(opts) {
|
|
9
|
+
super(Object.assign(Object.assign({}, opts), { overrideKey: 'oylwallet' }));
|
|
10
|
+
this.name = 'Oyl Wallet';
|
|
11
|
+
this.overrideKey = 'oylwallet';
|
|
12
|
+
}
|
|
13
|
+
getAddress() {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
var _a;
|
|
16
|
+
const provider = this.getProvider();
|
|
17
|
+
if (!provider) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const addresses = yield provider.getAddresses();
|
|
21
|
+
const ordinalsAddress = addresses.taproot;
|
|
22
|
+
const paymentAddress = addresses.nativeSegwit;
|
|
23
|
+
const mainAddress = (_a = ordinalsAddress === null || ordinalsAddress === void 0 ? void 0 : ordinalsAddress.address) !== null && _a !== void 0 ? _a : paymentAddress === null || paymentAddress === void 0 ? void 0 : paymentAddress.address;
|
|
24
|
+
yield this.setConnectedAccountWithAddresses({
|
|
25
|
+
active: true,
|
|
26
|
+
mainAddress,
|
|
27
|
+
ordinalsAddress,
|
|
28
|
+
paymentAddress,
|
|
29
|
+
});
|
|
30
|
+
return mainAddress;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
signMessage(messageToSign, withAddress) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const provider = this.getProvider();
|
|
36
|
+
if (!provider) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const { signature } = yield provider.signMessage({
|
|
40
|
+
address: withAddress,
|
|
41
|
+
message: messageToSign,
|
|
42
|
+
});
|
|
43
|
+
return signature;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
signPsbt(request) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const provider = this.getProvider();
|
|
49
|
+
if (!provider) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const psbtFromBase64 = Psbt.fromBase64(request.unsignedPsbtBase64);
|
|
53
|
+
const options = createPsbtOptions(psbtFromBase64, request);
|
|
54
|
+
const { psbt: signedPsbtHex } = yield provider.signPsbt({
|
|
55
|
+
broadcast: false,
|
|
56
|
+
finalize: options.autoFinalized,
|
|
57
|
+
psbt: psbtFromBase64.toHex(),
|
|
58
|
+
});
|
|
59
|
+
return { signedPsbt: Psbt.fromHex(signedPsbtHex).toBase64() };
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { OylConnector };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { OylConnector } from './OylConnector';
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
7
|
var bitcoinjsLib = require('bitcoinjs-lib');
|
|
8
|
-
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
8
|
var utils = require('@dynamic-labs/utils');
|
|
10
9
|
var BitcoinWalletConnector = require('../BitcoinWalletConnector.cjs');
|
|
11
10
|
var createSignPsbtOptions = require('../../utils/psbt/createSignPsbtOptions.cjs');
|
|
11
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
12
12
|
require('sats-connect');
|
|
13
13
|
var sighashNumberToString = require('../../utils/psbt/sighashNumberToString.cjs');
|
|
14
14
|
var base64 = require('../../utils/base64.cjs');
|
|
@@ -88,12 +88,6 @@ class PhantomConnector extends BitcoinWalletConnector.BitcoinWalletConnector {
|
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
sendBitcoin(transaction) {
|
|
92
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
walletConnectorCore.logger.debug('sendBitcoin - function not implemented', transaction);
|
|
94
|
-
return undefined;
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
91
|
signPsbt(request) {
|
|
98
92
|
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
99
93
|
var _a, _b, _c, _d, _e;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BitcoinSignPsbtRequest, BitcoinSignPsbtResponse } from '../../types';
|
|
2
2
|
import { BitcoinWalletConnector, BitcoinWalletConnectorOpts } from '../BitcoinWalletConnector';
|
|
3
3
|
export declare class PhantomConnector extends BitcoinWalletConnector {
|
|
4
4
|
name: string;
|
|
@@ -6,6 +6,5 @@ export declare class PhantomConnector extends BitcoinWalletConnector {
|
|
|
6
6
|
private connectWithInstalledExtension;
|
|
7
7
|
getAddress(): Promise<string | undefined>;
|
|
8
8
|
signMessage(messageToSign: string, withAddress: string): Promise<string | undefined>;
|
|
9
|
-
sendBitcoin(transaction: BitcoinTransaction): Promise<string | undefined>;
|
|
10
9
|
signPsbt(request: BitcoinSignPsbtRequest): Promise<BitcoinSignPsbtResponse | undefined>;
|
|
11
10
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
3
|
import { Psbt } from 'bitcoinjs-lib';
|
|
4
|
-
import { logger } from '@dynamic-labs/wallet-connector-core';
|
|
5
4
|
import { isMobile, handleMobileWalletRedirect } from '@dynamic-labs/utils';
|
|
6
5
|
import { BitcoinWalletConnector } from '../BitcoinWalletConnector.js';
|
|
7
6
|
import { createPsbtOptions } from '../../utils/psbt/createSignPsbtOptions.js';
|
|
7
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
8
8
|
import 'sats-connect';
|
|
9
9
|
import { sighashNumberToString } from '../../utils/psbt/sighashNumberToString.js';
|
|
10
10
|
import { decodeBase64, encodeBase64 } from '../../utils/base64.js';
|
|
@@ -84,12 +84,6 @@ class PhantomConnector extends BitcoinWalletConnector {
|
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
-
sendBitcoin(transaction) {
|
|
88
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
-
logger.debug('sendBitcoin - function not implemented', transaction);
|
|
90
|
-
return undefined;
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
87
|
signPsbt(request) {
|
|
94
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
95
89
|
var _a, _b, _c, _d, _e;
|
|
@@ -4,6 +4,7 @@ export * from './BitcoinSatsConnectConnector';
|
|
|
4
4
|
export * from './BitcoinSatsConnectLegacyConnector';
|
|
5
5
|
export * from './PhantomConnector';
|
|
6
6
|
export * from './OkxConnector';
|
|
7
|
+
export * from './OylConnector';
|
|
7
8
|
export * from './UnisatConnector';
|
|
8
9
|
export * from './UnknownInjected';
|
|
9
10
|
export * from './FallbackBitcoinConnector';
|
package/src/index.cjs
CHANGED
|
@@ -19,6 +19,7 @@ var supportsSatsConnect = require('./utils/supportsSatsConnect.cjs');
|
|
|
19
19
|
var getMempoolApiUrl = require('./utils/getMempoolApiUrl.cjs');
|
|
20
20
|
var PhantomConnector = require('./connectors/PhantomConnector/PhantomConnector.cjs');
|
|
21
21
|
var OkxConnector = require('./connectors/OkxConnector/OkxConnector.cjs');
|
|
22
|
+
var OylConnector = require('./connectors/OylConnector/OylConnector.cjs');
|
|
22
23
|
var UnisatConnector = require('./connectors/UnisatConnector/UnisatConnector.cjs');
|
|
23
24
|
var UnknownInjected = require('./connectors/UnknownInjected/UnknownInjected.cjs');
|
|
24
25
|
var FallbackBitcoinConnector = require('./connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.cjs');
|
|
@@ -31,6 +32,7 @@ const BitcoinWalletConnectors = (props) => [
|
|
|
31
32
|
...fetchBtcKitConnectors.fetchBtcKitConnectors(props),
|
|
32
33
|
PhantomConnector.PhantomConnector,
|
|
33
34
|
OkxConnector.OkxConnector,
|
|
35
|
+
OylConnector.OylConnector,
|
|
34
36
|
UnisatConnector.UnisatConnector,
|
|
35
37
|
UnknownInjected.UnknownInjectedConnector,
|
|
36
38
|
FallbackBitcoinConnector.FallbackBitcoinConnector,
|
package/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OkxConnector,
|
|
1
|
+
import { OkxConnector, PhantomConnector, OylConnector } from './connectors';
|
|
2
2
|
export { BitcoinWalletConnector } from './connectors';
|
|
3
3
|
export type { BitcoinTransaction } from './types';
|
|
4
4
|
export * from './utils';
|
|
5
5
|
export * from './wallet';
|
|
6
|
-
export declare const BitcoinWalletConnectors: (props: any) => (import("dist/packages/wallet-connector-core/src").WalletConnectorConstructor | typeof PhantomConnector | typeof OkxConnector | typeof
|
|
6
|
+
export declare const BitcoinWalletConnectors: (props: any) => (import("dist/packages/wallet-connector-core/src").WalletConnectorConstructor | typeof PhantomConnector | typeof OkxConnector | typeof OylConnector)[];
|
package/src/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export { supportsSatsConnect } from './utils/supportsSatsConnect.js';
|
|
|
17
17
|
export { getMempoolApiUrl } from './utils/getMempoolApiUrl.js';
|
|
18
18
|
import { PhantomConnector } from './connectors/PhantomConnector/PhantomConnector.js';
|
|
19
19
|
import { OkxConnector } from './connectors/OkxConnector/OkxConnector.js';
|
|
20
|
+
import { OylConnector } from './connectors/OylConnector/OylConnector.js';
|
|
20
21
|
import { UnisatConnector } from './connectors/UnisatConnector/UnisatConnector.js';
|
|
21
22
|
import { UnknownInjectedConnector } from './connectors/UnknownInjected/UnknownInjected.js';
|
|
22
23
|
import { FallbackBitcoinConnector } from './connectors/FallbackBitcoinConnector/FallbackBitcoinConnector.js';
|
|
@@ -29,6 +30,7 @@ const BitcoinWalletConnectors = (props) => [
|
|
|
29
30
|
...fetchBtcKitConnectors(props),
|
|
30
31
|
PhantomConnector,
|
|
31
32
|
OkxConnector,
|
|
33
|
+
OylConnector,
|
|
32
34
|
UnisatConnector,
|
|
33
35
|
UnknownInjectedConnector,
|
|
34
36
|
FallbackBitcoinConnector,
|