@dynamic-labs/bitcoin 5.14.0 → 5.15.1
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 +30 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +9 -10
- package/src/connectors/DynamicWaasBitcoinConnector/DynamicWaasBitcoinConnector.cjs +0 -1
- package/src/connectors/DynamicWaasBitcoinConnector/DynamicWaasBitcoinConnector.js +0 -1
- package/src/connectors/index.d.ts +0 -1
- package/src/index.cjs +0 -2
- package/src/index.js +0 -2
- package/src/services/MempoolApiService.cjs +0 -1
- package/src/services/MempoolApiService.js +0 -1
- package/src/utils/fetchSatsConnectConnectors/fetchSatsConnectConnectors.cjs +0 -1
- package/src/utils/fetchSatsConnectConnectors/fetchSatsConnectConnectors.js +0 -1
- package/src/connectors/MagicEdenConnector/MagicEdenConnector.cjs +0 -183
- package/src/connectors/MagicEdenConnector/MagicEdenConnector.d.ts +0 -21
- package/src/connectors/MagicEdenConnector/MagicEdenConnector.js +0 -179
- package/src/connectors/MagicEdenConnector/index.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,34 @@
|
|
|
1
1
|
|
|
2
|
+
### [5.15.1](https://github.com/dynamic-labs/dynamic-auth/compare/v5.15.0...v5.15.1) (2026-11-09)
|
|
3
|
+
|
|
4
|
+
## [5.15.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.14.0...v5.15.0) (2026-11-05)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### ⚠ BREAKING CHANGES
|
|
8
|
+
|
|
9
|
+
* **wallet-book:** the ExodusEvm connector export and the exodus,
|
|
10
|
+
exodusevm and exodussol wallet-book entries are removed
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **tron:** support MetaMask via @metamask/connect-tron adapter ([#12671](https://github.com/dynamic-labs/dynamic-auth/issues/12671)) ([9b5bd65](https://github.com/dynamic-labs/dynamic-auth/commit/9b5bd65e51a0827fc06521804301fb4334698db5))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **deps:** bump joi to 17.13.9 for GHSA-4528-x5fx-h6hg ([#12685](https://github.com/dynamic-labs/dynamic-auth/issues/12685)) ([4b48f61](https://github.com/dynamic-labs/dynamic-auth/commit/4b48f6161cfac51820f3c3eb243bdaeedfdb974c))
|
|
20
|
+
* **deps:** override decode-uri-component to 0.5.1 for GHSA-qr28-fpjm-wq7f ([#12674](https://github.com/dynamic-labs/dynamic-auth/issues/12674)) ([5679fbe](https://github.com/dynamic-labs/dynamic-auth/commit/5679fbe96bef807b044d2af55cbef4583263e34a)), closes [#1203](https://github.com/dynamic-labs/dynamic-auth/issues/1203) [#1205](https://github.com/dynamic-labs/dynamic-auth/issues/1205) [#1206](https://github.com/dynamic-labs/dynamic-auth/issues/1206) [#1173](https://github.com/dynamic-labs/dynamic-auth/issues/1173) [#1176](https://github.com/dynamic-labs/dynamic-auth/issues/1176) [#1114](https://github.com/dynamic-labs/dynamic-auth/issues/1114) [#1115](https://github.com/dynamic-labs/dynamic-auth/issues/1115) [#12645](https://github.com/dynamic-labs/dynamic-auth/issues/12645)
|
|
21
|
+
* **iconic:** add Zerion wallet icon ([#12650](https://github.com/dynamic-labs/dynamic-auth/issues/12650)) ([578615c](https://github.com/dynamic-labs/dynamic-auth/commit/578615cc81245295624833ce307ade1c1630d9f7))
|
|
22
|
+
* **sdk-react-core:** default wallet return redirectUrl to current page ([#12659](https://github.com/dynamic-labs/dynamic-auth/issues/12659)) ([c41c9ef](https://github.com/dynamic-labs/dynamic-auth/commit/c41c9ef639ebcc505425d5f7014d695189d02835))
|
|
23
|
+
* **sdk-react-core:** scroll the whole modal box on the collect user data screen ([#12698](https://github.com/dynamic-labs/dynamic-auth/issues/12698)) ([6bafd1f](https://github.com/dynamic-labs/dynamic-auth/commit/6bafd1ff4732b8f9ae8f16622331b9b080300107))
|
|
24
|
+
* **waas-svm:** keep the blockhash of a transaction another key already signed ([#12676](https://github.com/dynamic-labs/dynamic-auth/issues/12676)) ([74bf588](https://github.com/dynamic-labs/dynamic-auth/commit/74bf588ae72a24f7951451ef791a3eebe6f5baf4))
|
|
25
|
+
* **waas:** wire elevated access token provider on all WaaS connectors ([#12711](https://github.com/dynamic-labs/dynamic-auth/issues/12711)) ([1c343be](https://github.com/dynamic-labs/dynamic-auth/commit/1c343bee5b6e04219be513e24afb16d5ac652723))
|
|
26
|
+
* **wallet-book:** restore Magic Eden WalletConnect connect flow on mobile ([#12657](https://github.com/dynamic-labs/dynamic-auth/issues/12657)) ([740026a](https://github.com/dynamic-labs/dynamic-auth/commit/740026a6637f441049678e563d36ffdac5e61e8b))
|
|
27
|
+
* **wallet-book:** use Backpack's ul/v1/browse link for the in-app browser ([#12702](https://github.com/dynamic-labs/dynamic-auth/issues/12702)) ([99f8e95](https://github.com/dynamic-labs/dynamic-auth/commit/99f8e956a51baccba3616a76104ab9fba2545847)), closes [#12053](https://github.com/dynamic-labs/dynamic-auth/issues/12053)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
* **wallet-book:** drop Exodus wallets ([#12664](https://github.com/dynamic-labs/dynamic-auth/issues/12664)) ([e3c850f](https://github.com/dynamic-labs/dynamic-auth/commit/e3c850fefb8db92bcd2706fb9b58f92e4a536533))
|
|
31
|
+
|
|
2
32
|
## [5.14.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.13.0...v5.14.0) (2026-10-30)
|
|
3
33
|
|
|
4
34
|
|
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": "5.
|
|
3
|
+
"version": "5.15.1",
|
|
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",
|
|
@@ -23,20 +23,19 @@
|
|
|
23
23
|
"@dynamic-labs-wallet/forward-mpc-client": "1.0.2",
|
|
24
24
|
"@bitcoinerlab/secp256k1": "1.1.1",
|
|
25
25
|
"@btckit/types": "0.0.19",
|
|
26
|
-
"@dynamic-labs/sdk-api-core": "0.
|
|
26
|
+
"@dynamic-labs/sdk-api-core": "0.142.0",
|
|
27
27
|
"@wallet-standard/app": "1.0.1",
|
|
28
28
|
"@wallet-standard/base": "1.0.1",
|
|
29
29
|
"bitcoinjs-lib": "6.1.5",
|
|
30
30
|
"ecpair": "2.1.0",
|
|
31
31
|
"sats-connect": "4.2.1",
|
|
32
|
-
"
|
|
33
|
-
"@dynamic-labs/
|
|
34
|
-
"@dynamic-labs/
|
|
35
|
-
"@dynamic-labs/
|
|
36
|
-
"@dynamic-labs/
|
|
37
|
-
"@dynamic-labs/
|
|
38
|
-
"@dynamic-labs/wallet-
|
|
39
|
-
"@dynamic-labs/wallet-connector-core": "5.14.0",
|
|
32
|
+
"@dynamic-labs/assert-package-version": "5.15.1",
|
|
33
|
+
"@dynamic-labs/logger": "5.15.1",
|
|
34
|
+
"@dynamic-labs/types": "5.15.1",
|
|
35
|
+
"@dynamic-labs/utils": "5.15.1",
|
|
36
|
+
"@dynamic-labs/waas": "5.15.1",
|
|
37
|
+
"@dynamic-labs/wallet-book": "5.15.1",
|
|
38
|
+
"@dynamic-labs/wallet-connector-core": "5.15.1",
|
|
40
39
|
"eventemitter3": "5.0.1"
|
|
41
40
|
},
|
|
42
41
|
"peerDependencies": {}
|
|
@@ -15,7 +15,6 @@ var PsbtBuilderService = require('../../services/PsbtBuilderService.cjs');
|
|
|
15
15
|
require('sats-connect');
|
|
16
16
|
var BitcoinWalletConnector = require('../BitcoinWalletConnector.cjs');
|
|
17
17
|
require('@wallet-standard/app');
|
|
18
|
-
require('jsontokens');
|
|
19
18
|
var btcToSatoshis = require('../../utils/btcToSatoshis/btcToSatoshis.cjs');
|
|
20
19
|
var getBitcoinNetwork = require('../../utils/getBitcoinNetwork/getBitcoinNetwork.cjs');
|
|
21
20
|
var PsbtParser = require('../../utils/psbtParser/PsbtParser.cjs');
|
|
@@ -11,7 +11,6 @@ import { PsbtBuilderService } from '../../services/PsbtBuilderService.js';
|
|
|
11
11
|
import 'sats-connect';
|
|
12
12
|
import { BitcoinWalletConnector } from '../BitcoinWalletConnector.js';
|
|
13
13
|
import '@wallet-standard/app';
|
|
14
|
-
import 'jsontokens';
|
|
15
14
|
import { btcToSatoshis } from '../../utils/btcToSatoshis/btcToSatoshis.js';
|
|
16
15
|
import { getBitcoinNetwork } from '../../utils/getBitcoinNetwork/getBitcoinNetwork.js';
|
|
17
16
|
import { PsbtParser } from '../../utils/psbtParser/PsbtParser.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './BitcoinWalletConnector';
|
|
2
2
|
export * from './BitcoinBtcKitConnector';
|
|
3
3
|
export * from './BitcoinSatsConnectConnector';
|
|
4
|
-
export * from './MagicEdenConnector';
|
|
5
4
|
export * from './PhantomConnector';
|
|
6
5
|
export * from './OkxConnector';
|
|
7
6
|
export * from './OneKeyConnector';
|
package/src/index.cjs
CHANGED
|
@@ -12,7 +12,6 @@ require('bitcoinjs-lib');
|
|
|
12
12
|
require('@dynamic-labs/wallet-connector-core');
|
|
13
13
|
require('@dynamic-labs/utils');
|
|
14
14
|
var BitcoinSatsConnectConnector = require('./connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.cjs');
|
|
15
|
-
var MagicEdenConnector = require('./connectors/MagicEdenConnector/MagicEdenConnector.cjs');
|
|
16
15
|
var PhantomConnector = require('./connectors/PhantomConnector/PhantomConnector.cjs');
|
|
17
16
|
var OkxConnector = require('./connectors/OkxConnector/OkxConnector.cjs');
|
|
18
17
|
var OneKeyConnector = require('./connectors/OneKeyConnector/OneKeyConnector.cjs');
|
|
@@ -41,7 +40,6 @@ assertPackageVersion.assertPackageVersion('@dynamic-labs/bitcoin', _package.vers
|
|
|
41
40
|
const BitcoinWalletConnectors = (props) => [
|
|
42
41
|
...fetchSatsConnectConnectors.fetchSatsConnectConnectors(props),
|
|
43
42
|
...fetchBtcKitConnectors.fetchBtcKitConnectors(props),
|
|
44
|
-
MagicEdenConnector.MagicEdenConnector,
|
|
45
43
|
PhantomConnector.PhantomConnector,
|
|
46
44
|
OkxConnector.OkxConnector,
|
|
47
45
|
OneKeyConnector.OneKeyConnector,
|
package/src/index.js
CHANGED
|
@@ -8,7 +8,6 @@ import 'bitcoinjs-lib';
|
|
|
8
8
|
import '@dynamic-labs/wallet-connector-core';
|
|
9
9
|
import '@dynamic-labs/utils';
|
|
10
10
|
export { BitcoinSatsConnectConnector } from './connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.js';
|
|
11
|
-
import { MagicEdenConnector } from './connectors/MagicEdenConnector/MagicEdenConnector.js';
|
|
12
11
|
import { PhantomConnector } from './connectors/PhantomConnector/PhantomConnector.js';
|
|
13
12
|
import { OkxConnector } from './connectors/OkxConnector/OkxConnector.js';
|
|
14
13
|
import { OneKeyConnector } from './connectors/OneKeyConnector/OneKeyConnector.js';
|
|
@@ -41,7 +40,6 @@ assertPackageVersion('@dynamic-labs/bitcoin', version);
|
|
|
41
40
|
const BitcoinWalletConnectors = (props) => [
|
|
42
41
|
...fetchSatsConnectConnectors(props),
|
|
43
42
|
...fetchBtcKitConnectors(props),
|
|
44
|
-
MagicEdenConnector,
|
|
45
43
|
PhantomConnector,
|
|
46
44
|
OkxConnector,
|
|
47
45
|
OneKeyConnector,
|
|
@@ -15,7 +15,6 @@ require('@wallet-standard/app');
|
|
|
15
15
|
var getMempoolApiUrl = require('../utils/getMempoolApiUrl.cjs');
|
|
16
16
|
var _const = require('../const.cjs');
|
|
17
17
|
require('@dynamic-labs/types');
|
|
18
|
-
require('jsontokens');
|
|
19
18
|
require('../connectors/DynamicWaasBitcoinConnector/DynamicWaasBitcoinConnector.cjs');
|
|
20
19
|
|
|
21
20
|
const logger = new logger$1.Logger('MempoolApiService');
|
|
@@ -11,7 +11,6 @@ import '@wallet-standard/app';
|
|
|
11
11
|
import { getMempoolApiUrl } from '../utils/getMempoolApiUrl.js';
|
|
12
12
|
import { VSIZE_OVERHEAD, VSIZE_INPUT_P2WPKH, VSIZE_OUTPUT_P2WPKH, MIN_RELAY_FEE, DEFAULT_FEE_ESTIMATE } from '../const.js';
|
|
13
13
|
import '@dynamic-labs/types';
|
|
14
|
-
import 'jsontokens';
|
|
15
14
|
import '../connectors/DynamicWaasBitcoinConnector/DynamicWaasBitcoinConnector.js';
|
|
16
15
|
|
|
17
16
|
const logger = new Logger('MempoolApiService');
|
|
@@ -14,7 +14,6 @@ var _const = require('../../const.cjs');
|
|
|
14
14
|
require('@dynamic-labs/types');
|
|
15
15
|
require('bitcoinjs-lib');
|
|
16
16
|
var BitcoinSatsConnectConnector = require('../../connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.cjs');
|
|
17
|
-
require('jsontokens');
|
|
18
17
|
require('../../connectors/DynamicWaasBitcoinConnector/DynamicWaasBitcoinConnector.cjs');
|
|
19
18
|
var hasSatsConnectFeature = require('../hasSatsConnectFeature.cjs');
|
|
20
19
|
|
|
@@ -10,7 +10,6 @@ import { SATSCONNECT_FEATURE } from '../../const.js';
|
|
|
10
10
|
import '@dynamic-labs/types';
|
|
11
11
|
import 'bitcoinjs-lib';
|
|
12
12
|
import { BitcoinSatsConnectConnector } from '../../connectors/BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.js';
|
|
13
|
-
import 'jsontokens';
|
|
14
13
|
import '../../connectors/DynamicWaasBitcoinConnector/DynamicWaasBitcoinConnector.js';
|
|
15
14
|
import { hasSatsConnectFeature } from '../hasSatsConnectFeature.js';
|
|
16
15
|
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
|
-
var jsontokens = require('jsontokens');
|
|
8
|
-
var satsConnect = require('sats-connect');
|
|
9
|
-
var utils = require('@dynamic-labs/utils');
|
|
10
|
-
var _const = require('../../const.cjs');
|
|
11
|
-
var BitcoinSatsConnectConnector = require('../BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.cjs');
|
|
12
|
-
var getSatsConnectSigningProtocol = require('../../utils/getSatsConnectSigningProtocol/getSatsConnectSigningProtocol.cjs');
|
|
13
|
-
|
|
14
|
-
class MagicEdenConnector extends BitcoinSatsConnectConnector.BitcoinSatsConnectConnector {
|
|
15
|
-
constructor(opts) {
|
|
16
|
-
super(Object.assign(Object.assign({}, opts), { overrideKey: 'magicedenbtc' }));
|
|
17
|
-
this.name = 'Magic Eden';
|
|
18
|
-
this.overrideKey = 'magicedenbtc';
|
|
19
|
-
this.isLegacy = true;
|
|
20
|
-
}
|
|
21
|
-
getAddress() {
|
|
22
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
if (this.handleInAppBrowserGetAddress())
|
|
24
|
-
return;
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
satsConnect.getAddress({
|
|
27
|
-
getProvider: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
var _a, _b;
|
|
29
|
-
return (_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.features[_const.SATSCONNECT_FEATURE]) === null || _b === void 0 ? void 0 : _b.provider;
|
|
30
|
-
}),
|
|
31
|
-
onCancel: () => {
|
|
32
|
-
const error = new Error();
|
|
33
|
-
error.code = '-32000'; // error code for user cancelled
|
|
34
|
-
reject(error);
|
|
35
|
-
},
|
|
36
|
-
onFinish: (response) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
var _c;
|
|
38
|
-
const { addresses } = response;
|
|
39
|
-
const ordinalsAccount = addresses === null || addresses === void 0 ? void 0 : addresses.find((address) => address.purpose === satsConnect.AddressPurpose.Ordinals);
|
|
40
|
-
const paymentAccount = addresses === null || addresses === void 0 ? void 0 : addresses.find((address) => address.purpose === satsConnect.AddressPurpose.Payment);
|
|
41
|
-
const mainAddress = (_c = ordinalsAccount === null || ordinalsAccount === void 0 ? void 0 : ordinalsAccount.address) !== null && _c !== void 0 ? _c : paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.address;
|
|
42
|
-
yield this.setConnectedAccountWithAddresses({
|
|
43
|
-
active: true,
|
|
44
|
-
mainAddress,
|
|
45
|
-
ordinalsAddress: ordinalsAccount,
|
|
46
|
-
paymentAddress: paymentAccount,
|
|
47
|
-
});
|
|
48
|
-
resolve(mainAddress);
|
|
49
|
-
}),
|
|
50
|
-
payload: {
|
|
51
|
-
message: 'Address for receiving Ordinals and payments',
|
|
52
|
-
network: {
|
|
53
|
-
type: this.currentNetwork,
|
|
54
|
-
},
|
|
55
|
-
purposes: [satsConnect.AddressPurpose.Ordinals, satsConnect.AddressPurpose.Payment],
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
signMessage(messageToSign, options) {
|
|
62
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
const { address, protocol } = options;
|
|
64
|
-
return new Promise((resolve, reject) => {
|
|
65
|
-
satsConnect.signMessage({
|
|
66
|
-
getProvider: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
var _a, _b;
|
|
68
|
-
return (_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.features[_const.SATSCONNECT_FEATURE]) === null || _b === void 0 ? void 0 : _b.provider;
|
|
69
|
-
}),
|
|
70
|
-
onCancel: () => {
|
|
71
|
-
const error = new Error();
|
|
72
|
-
error.code = '-32000'; // error code for user cancelled
|
|
73
|
-
reject(error);
|
|
74
|
-
},
|
|
75
|
-
onFinish: (response) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
if (this.isHardwareWalletEnabled) {
|
|
77
|
-
return resolve(JSON.stringify({
|
|
78
|
-
signedTransaction: {
|
|
79
|
-
data: response,
|
|
80
|
-
},
|
|
81
|
-
}));
|
|
82
|
-
}
|
|
83
|
-
resolve(response);
|
|
84
|
-
}),
|
|
85
|
-
payload: {
|
|
86
|
-
address,
|
|
87
|
-
message: messageToSign,
|
|
88
|
-
network: {
|
|
89
|
-
type: this.currentNetwork,
|
|
90
|
-
},
|
|
91
|
-
protocol: getSatsConnectSigningProtocol.getSatsConnectSigningProtocol(protocol),
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
sendBitcoin(transaction) {
|
|
98
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
var _a;
|
|
100
|
-
const mainAddress = yield this.getAddress();
|
|
101
|
-
const senderAddress = (_a = (yield this.getAdditionalAddresses(mainAddress)).find((address) => address.type === 'payment')) === null || _a === void 0 ? void 0 : _a.address;
|
|
102
|
-
if (!senderAddress) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
return new Promise((resolve, reject) => {
|
|
106
|
-
satsConnect.sendBtcTransaction({
|
|
107
|
-
getProvider: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
var _a, _b;
|
|
109
|
-
return (_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.features[_const.SATSCONNECT_FEATURE]) === null || _b === void 0 ? void 0 : _b.provider;
|
|
110
|
-
}),
|
|
111
|
-
onCancel: () => {
|
|
112
|
-
const error = new Error();
|
|
113
|
-
error.code = '-32000'; // error code for user cancelled
|
|
114
|
-
reject(error);
|
|
115
|
-
},
|
|
116
|
-
onFinish: (response) => {
|
|
117
|
-
resolve(response);
|
|
118
|
-
},
|
|
119
|
-
payload: {
|
|
120
|
-
network: {
|
|
121
|
-
type: this.currentNetwork,
|
|
122
|
-
},
|
|
123
|
-
recipients: [
|
|
124
|
-
{
|
|
125
|
-
address: transaction.recipientAddress,
|
|
126
|
-
amountSats: BigInt(transaction.amount),
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
senderAddress,
|
|
130
|
-
},
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
signTransaction(params) {
|
|
136
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
137
|
-
const { message, psbtBase64, broadcast, inputsToSign } = params;
|
|
138
|
-
return new Promise((resolve, reject) => {
|
|
139
|
-
satsConnect.signTransaction({
|
|
140
|
-
getProvider: () => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
141
|
-
var _a, _b;
|
|
142
|
-
return (_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.features[_const.SATSCONNECT_FEATURE]) === null || _b === void 0 ? void 0 : _b.provider;
|
|
143
|
-
}),
|
|
144
|
-
onCancel: () => {
|
|
145
|
-
const error = new Error();
|
|
146
|
-
error.code = '-32000'; // error code for user cancelled
|
|
147
|
-
reject(error);
|
|
148
|
-
},
|
|
149
|
-
onFinish: (response) => {
|
|
150
|
-
resolve(response);
|
|
151
|
-
},
|
|
152
|
-
payload: {
|
|
153
|
-
broadcast,
|
|
154
|
-
inputsToSign,
|
|
155
|
-
message: message || 'Sign Transaction',
|
|
156
|
-
network: {
|
|
157
|
-
type: this.currentNetwork,
|
|
158
|
-
},
|
|
159
|
-
psbtBase64,
|
|
160
|
-
},
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Uses the custom Magic Eden signTransactions feature to sign multiple transactions
|
|
167
|
-
*/
|
|
168
|
-
signTransactions(transactions) {
|
|
169
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
170
|
-
var _a;
|
|
171
|
-
(_a = transactions.message) !== null && _a !== void 0 ? _a : (transactions.message = 'Sign Transaction');
|
|
172
|
-
const request = jsontokens.createUnsecuredToken(transactions);
|
|
173
|
-
// Magic Eden has implemented their own signTransactions feature, and have requested us
|
|
174
|
-
// to ensure we use it rather than the general Sats Connect API for this method
|
|
175
|
-
const provider = this.getProvider();
|
|
176
|
-
if (!provider)
|
|
177
|
-
throw new utils.DynamicError('signTransactions failed: Magic Eden provider not found', 'signtransactions_failed_magic_eden_provider_not');
|
|
178
|
-
return provider.signMultipleTransactions(request);
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
exports.MagicEdenConnector = MagicEdenConnector;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { SignMultipleTransactionsPayload, SignTransactionResponse } from 'sats-connect';
|
|
2
|
-
import { BitcoinSignProtocol, BitcoinTransaction, SatsConnectSignTransactionInput } from '../../types';
|
|
3
|
-
import { BitcoinSatsConnectConnector } from '../BitcoinSatsConnectConnector';
|
|
4
|
-
import { BitcoinWalletConnectorOpts } from '../BitcoinWalletConnector';
|
|
5
|
-
export declare class MagicEdenConnector extends BitcoinSatsConnectConnector {
|
|
6
|
-
name: string;
|
|
7
|
-
overrideKey: string;
|
|
8
|
-
isLegacy: boolean;
|
|
9
|
-
constructor(opts: BitcoinWalletConnectorOpts);
|
|
10
|
-
getAddress(): Promise<string | undefined>;
|
|
11
|
-
signMessage(messageToSign: string, options: {
|
|
12
|
-
address: string;
|
|
13
|
-
protocol?: BitcoinSignProtocol;
|
|
14
|
-
}): Promise<string | undefined>;
|
|
15
|
-
sendBitcoin(transaction: BitcoinTransaction): Promise<string | undefined>;
|
|
16
|
-
signTransaction(params: SatsConnectSignTransactionInput): Promise<SignTransactionResponse | undefined>;
|
|
17
|
-
/**
|
|
18
|
-
* Uses the custom Magic Eden signTransactions feature to sign multiple transactions
|
|
19
|
-
*/
|
|
20
|
-
signTransactions(transactions: SignMultipleTransactionsPayload): Promise<SignTransactionResponse[] | undefined>;
|
|
21
|
-
}
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
|
-
import { createUnsecuredToken } from 'jsontokens';
|
|
4
|
-
import { getAddress, AddressPurpose, signMessage, sendBtcTransaction, signTransaction } from 'sats-connect';
|
|
5
|
-
import { DynamicError } from '@dynamic-labs/utils';
|
|
6
|
-
import { SATSCONNECT_FEATURE } from '../../const.js';
|
|
7
|
-
import { BitcoinSatsConnectConnector } from '../BitcoinSatsConnectConnector/BitcoinSatsConnectConnector.js';
|
|
8
|
-
import { getSatsConnectSigningProtocol } from '../../utils/getSatsConnectSigningProtocol/getSatsConnectSigningProtocol.js';
|
|
9
|
-
|
|
10
|
-
class MagicEdenConnector extends BitcoinSatsConnectConnector {
|
|
11
|
-
constructor(opts) {
|
|
12
|
-
super(Object.assign(Object.assign({}, opts), { overrideKey: 'magicedenbtc' }));
|
|
13
|
-
this.name = 'Magic Eden';
|
|
14
|
-
this.overrideKey = 'magicedenbtc';
|
|
15
|
-
this.isLegacy = true;
|
|
16
|
-
}
|
|
17
|
-
getAddress() {
|
|
18
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
-
if (this.handleInAppBrowserGetAddress())
|
|
20
|
-
return;
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
getAddress({
|
|
23
|
-
getProvider: () => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
var _a, _b;
|
|
25
|
-
return (_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.features[SATSCONNECT_FEATURE]) === null || _b === void 0 ? void 0 : _b.provider;
|
|
26
|
-
}),
|
|
27
|
-
onCancel: () => {
|
|
28
|
-
const error = new Error();
|
|
29
|
-
error.code = '-32000'; // error code for user cancelled
|
|
30
|
-
reject(error);
|
|
31
|
-
},
|
|
32
|
-
onFinish: (response) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
var _c;
|
|
34
|
-
const { addresses } = response;
|
|
35
|
-
const ordinalsAccount = addresses === null || addresses === void 0 ? void 0 : addresses.find((address) => address.purpose === AddressPurpose.Ordinals);
|
|
36
|
-
const paymentAccount = addresses === null || addresses === void 0 ? void 0 : addresses.find((address) => address.purpose === AddressPurpose.Payment);
|
|
37
|
-
const mainAddress = (_c = ordinalsAccount === null || ordinalsAccount === void 0 ? void 0 : ordinalsAccount.address) !== null && _c !== void 0 ? _c : paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.address;
|
|
38
|
-
yield this.setConnectedAccountWithAddresses({
|
|
39
|
-
active: true,
|
|
40
|
-
mainAddress,
|
|
41
|
-
ordinalsAddress: ordinalsAccount,
|
|
42
|
-
paymentAddress: paymentAccount,
|
|
43
|
-
});
|
|
44
|
-
resolve(mainAddress);
|
|
45
|
-
}),
|
|
46
|
-
payload: {
|
|
47
|
-
message: 'Address for receiving Ordinals and payments',
|
|
48
|
-
network: {
|
|
49
|
-
type: this.currentNetwork,
|
|
50
|
-
},
|
|
51
|
-
purposes: [AddressPurpose.Ordinals, AddressPurpose.Payment],
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
signMessage(messageToSign, options) {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
const { address, protocol } = options;
|
|
60
|
-
return new Promise((resolve, reject) => {
|
|
61
|
-
signMessage({
|
|
62
|
-
getProvider: () => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
var _a, _b;
|
|
64
|
-
return (_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.features[SATSCONNECT_FEATURE]) === null || _b === void 0 ? void 0 : _b.provider;
|
|
65
|
-
}),
|
|
66
|
-
onCancel: () => {
|
|
67
|
-
const error = new Error();
|
|
68
|
-
error.code = '-32000'; // error code for user cancelled
|
|
69
|
-
reject(error);
|
|
70
|
-
},
|
|
71
|
-
onFinish: (response) => __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
if (this.isHardwareWalletEnabled) {
|
|
73
|
-
return resolve(JSON.stringify({
|
|
74
|
-
signedTransaction: {
|
|
75
|
-
data: response,
|
|
76
|
-
},
|
|
77
|
-
}));
|
|
78
|
-
}
|
|
79
|
-
resolve(response);
|
|
80
|
-
}),
|
|
81
|
-
payload: {
|
|
82
|
-
address,
|
|
83
|
-
message: messageToSign,
|
|
84
|
-
network: {
|
|
85
|
-
type: this.currentNetwork,
|
|
86
|
-
},
|
|
87
|
-
protocol: getSatsConnectSigningProtocol(protocol),
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
sendBitcoin(transaction) {
|
|
94
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
var _a;
|
|
96
|
-
const mainAddress = yield this.getAddress();
|
|
97
|
-
const senderAddress = (_a = (yield this.getAdditionalAddresses(mainAddress)).find((address) => address.type === 'payment')) === null || _a === void 0 ? void 0 : _a.address;
|
|
98
|
-
if (!senderAddress) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
return new Promise((resolve, reject) => {
|
|
102
|
-
sendBtcTransaction({
|
|
103
|
-
getProvider: () => __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
var _a, _b;
|
|
105
|
-
return (_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.features[SATSCONNECT_FEATURE]) === null || _b === void 0 ? void 0 : _b.provider;
|
|
106
|
-
}),
|
|
107
|
-
onCancel: () => {
|
|
108
|
-
const error = new Error();
|
|
109
|
-
error.code = '-32000'; // error code for user cancelled
|
|
110
|
-
reject(error);
|
|
111
|
-
},
|
|
112
|
-
onFinish: (response) => {
|
|
113
|
-
resolve(response);
|
|
114
|
-
},
|
|
115
|
-
payload: {
|
|
116
|
-
network: {
|
|
117
|
-
type: this.currentNetwork,
|
|
118
|
-
},
|
|
119
|
-
recipients: [
|
|
120
|
-
{
|
|
121
|
-
address: transaction.recipientAddress,
|
|
122
|
-
amountSats: BigInt(transaction.amount),
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
senderAddress,
|
|
126
|
-
},
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
signTransaction(params) {
|
|
132
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
-
const { message, psbtBase64, broadcast, inputsToSign } = params;
|
|
134
|
-
return new Promise((resolve, reject) => {
|
|
135
|
-
signTransaction({
|
|
136
|
-
getProvider: () => __awaiter(this, void 0, void 0, function* () {
|
|
137
|
-
var _a, _b;
|
|
138
|
-
return (_b = (_a = this.wallet) === null || _a === void 0 ? void 0 : _a.features[SATSCONNECT_FEATURE]) === null || _b === void 0 ? void 0 : _b.provider;
|
|
139
|
-
}),
|
|
140
|
-
onCancel: () => {
|
|
141
|
-
const error = new Error();
|
|
142
|
-
error.code = '-32000'; // error code for user cancelled
|
|
143
|
-
reject(error);
|
|
144
|
-
},
|
|
145
|
-
onFinish: (response) => {
|
|
146
|
-
resolve(response);
|
|
147
|
-
},
|
|
148
|
-
payload: {
|
|
149
|
-
broadcast,
|
|
150
|
-
inputsToSign,
|
|
151
|
-
message: message || 'Sign Transaction',
|
|
152
|
-
network: {
|
|
153
|
-
type: this.currentNetwork,
|
|
154
|
-
},
|
|
155
|
-
psbtBase64,
|
|
156
|
-
},
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Uses the custom Magic Eden signTransactions feature to sign multiple transactions
|
|
163
|
-
*/
|
|
164
|
-
signTransactions(transactions) {
|
|
165
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
-
var _a;
|
|
167
|
-
(_a = transactions.message) !== null && _a !== void 0 ? _a : (transactions.message = 'Sign Transaction');
|
|
168
|
-
const request = createUnsecuredToken(transactions);
|
|
169
|
-
// Magic Eden has implemented their own signTransactions feature, and have requested us
|
|
170
|
-
// to ensure we use it rather than the general Sats Connect API for this method
|
|
171
|
-
const provider = this.getProvider();
|
|
172
|
-
if (!provider)
|
|
173
|
-
throw new DynamicError('signTransactions failed: Magic Eden provider not found', 'signtransactions_failed_magic_eden_provider_not');
|
|
174
|
-
return provider.signMultipleTransactions(request);
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export { MagicEdenConnector };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MagicEdenConnector } from './MagicEdenConnector';
|