@meshconnect/uwc-injected-connector 0.22.1 → 0.23.0
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/dist/injected-connector.d.ts +23 -7
- package/dist/injected-connector.d.ts.map +1 -1
- package/dist/injected-connector.js +54 -9
- package/dist/injected-connector.js.map +1 -1
- package/dist/services/bitcoin/bitcoin-wallet-service.d.ts +136 -0
- package/dist/services/bitcoin/bitcoin-wallet-service.d.ts.map +1 -0
- package/dist/services/bitcoin/bitcoin-wallet-service.js +385 -0
- package/dist/services/bitcoin/bitcoin-wallet-service.js.map +1 -0
- package/dist/services/connection-manager.d.ts +17 -2
- package/dist/services/connection-manager.d.ts.map +1 -1
- package/dist/services/connection-manager.js +129 -3
- package/dist/services/connection-manager.js.map +1 -1
- package/dist/wallet-standard-discovery.d.ts +45 -1
- package/dist/wallet-standard-discovery.d.ts.map +1 -1
- package/dist/wallet-standard-discovery.js +221 -1
- package/dist/wallet-standard-discovery.js.map +1 -1
- package/package.json +13 -12
- package/src/injected-connector.test.ts +1 -1
- package/src/injected-connector.ts +78 -8
- package/src/services/bitcoin/bitcoin-wallet-service.test.ts +646 -0
- package/src/services/bitcoin/bitcoin-wallet-service.ts +493 -0
- package/src/services/connection-manager.test.ts +214 -5
- package/src/services/connection-manager.ts +169 -4
- package/src/wallet-standard-discovery.test.ts +215 -1
- package/src/wallet-standard-discovery.ts +325 -2
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import { BitcoinNamespace, WalletStandardBitcoinAdapter, OkxBitcoinAdapter, bytesToHex } from '@meshconnect/uwc-bitcoin';
|
|
2
|
+
import { bitcoinNetwork } from '@meshconnect/uwc-constants';
|
|
3
|
+
import { getBitcoinWallets } from '../../wallet-standard-discovery';
|
|
4
|
+
import { resolveInjectedProperty } from '../../legacy-injected-solana-adapter';
|
|
5
|
+
/**
|
|
6
|
+
* Bitcoin (bip122) wallet service for the injected transport — the peer of
|
|
7
|
+
* `EthereumWalletService` / `SolanaWalletService` / `TronWalletService` /
|
|
8
|
+
* `TonWalletService`. Owns the namespace-specific work (Wallet Standard
|
|
9
|
+
* `bitcoin:*` discovery, adapter construction, and the connected session
|
|
10
|
+
* state) so `InjectedConnector`/`ConnectionManager` only delegate, keeping
|
|
11
|
+
* chain logic out of the shared classes. Templated on `TonWalletService`,
|
|
12
|
+
* the closest analogue — it also owns its own connect/signMessage/
|
|
13
|
+
* sendTransaction, yet still implements the full shared service shape.
|
|
14
|
+
*
|
|
15
|
+
* Broadcast is not wired yet (sign-only): a PSBT send returns the wallet-signed
|
|
16
|
+
* PSBT (base64), not a txid.
|
|
17
|
+
*/
|
|
18
|
+
export class BitcoinWalletService {
|
|
19
|
+
config;
|
|
20
|
+
detectedWallets = [];
|
|
21
|
+
namespace = null;
|
|
22
|
+
account = null;
|
|
23
|
+
/** uuid of the currently-connected wallet — lets `ConnectionManager` detect a
|
|
24
|
+
* wallet switch (release-other-wallet-connections guard), same as the
|
|
25
|
+
* eip155/solana/tron identity checks. */
|
|
26
|
+
connectedWalletUuid = null;
|
|
27
|
+
/**
|
|
28
|
+
* The connected wallet handle itself (not just the adapter wrapping it) —
|
|
29
|
+
* kept so `getLiveAccount()`/`onAccountsChanged()` can read/observe its
|
|
30
|
+
* live `accounts` and `standard:events` directly. Bitcoin has no adapter
|
|
31
|
+
* class re-emitting connect/disconnect on a switch (unlike Solana's
|
|
32
|
+
* `StandardWalletAdapter`), so both live reads and subscriptions must go
|
|
33
|
+
* straight to the wallet, not through `this.namespace`.
|
|
34
|
+
*/
|
|
35
|
+
connectedWallet = null;
|
|
36
|
+
/**
|
|
37
|
+
* The connected OKX (legacy-injected) provider, when the active session is on
|
|
38
|
+
* OKX rather than a Wallet Standard wallet. OKX isn't Wallet Standard, so it
|
|
39
|
+
* has no `accounts`/`standard:events` on `connectedWallet` — the live-account
|
|
40
|
+
* read and account-change subscription go through this provider instead.
|
|
41
|
+
*/
|
|
42
|
+
connectedOkxProvider = null;
|
|
43
|
+
constructor(config) {
|
|
44
|
+
this.config = config;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Initialize wallet discovery from the Wallet Standard `bitcoin:*` registry,
|
|
48
|
+
* honoring `BitcoinConfig.enabledWallets` when configured.
|
|
49
|
+
*/
|
|
50
|
+
async initializeDiscovery(expectedWallets, usingIntegratedBrowser = false) {
|
|
51
|
+
this.detectedWallets = await getBitcoinWallets(expectedWallets, usingIntegratedBrowser, this.config?.enabledWallets);
|
|
52
|
+
}
|
|
53
|
+
getDetectedWallets() {
|
|
54
|
+
return this.detectedWallets;
|
|
55
|
+
}
|
|
56
|
+
findWalletByUuid(uuid) {
|
|
57
|
+
return this.detectedWallets.find(w => w.uuid === uuid);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Check if a Bitcoin wallet is already authorized (non-prompting). Reads
|
|
61
|
+
* the Wallet Standard wallet's already-exposed `accounts` directly — never
|
|
62
|
+
* calls `bitcoin:connect`, which pops a wallet dialog.
|
|
63
|
+
*/
|
|
64
|
+
async checkExistingConnection(detectedWallet) {
|
|
65
|
+
const wallet = detectedWallet.wallet;
|
|
66
|
+
const account = wallet.accounts?.[0];
|
|
67
|
+
return account?.address ?? null;
|
|
68
|
+
}
|
|
69
|
+
async connect(network, provider) {
|
|
70
|
+
// Resolve the SPECIFIC wallet the session matched by uuid (mirrors every
|
|
71
|
+
// other service) — fails closed rather than picking an arbitrary wallet.
|
|
72
|
+
const uuid = provider.namespaceMetaData?.bip122?.detectedWallet?.uuid;
|
|
73
|
+
const detected = uuid ? this.findWalletByUuid(uuid) : undefined;
|
|
74
|
+
if (!detected) {
|
|
75
|
+
// Covers both kinds — Wallet Standard `bitcoin:*` and OKX legacy-injected.
|
|
76
|
+
throw new Error('No bitcoin wallet found for this connection');
|
|
77
|
+
}
|
|
78
|
+
// Wallet Standard vs OKX (legacy-injected) — build the matching adapter.
|
|
79
|
+
const { namespace, okxProvider } = this.buildNamespace(detected);
|
|
80
|
+
namespace.assertSupportedNetwork(network);
|
|
81
|
+
const accounts = await namespace.getAccounts();
|
|
82
|
+
const primary = accounts[0];
|
|
83
|
+
if (!primary) {
|
|
84
|
+
throw new Error('Bitcoin wallet returned no accounts');
|
|
85
|
+
}
|
|
86
|
+
// Commit session state only now that the (prompting) connect has succeeded.
|
|
87
|
+
this.namespace = namespace;
|
|
88
|
+
this.account = primary;
|
|
89
|
+
this.connectedWalletUuid = uuid ?? null;
|
|
90
|
+
// OKX has no Wallet Standard handle to observe — its live-account reads go
|
|
91
|
+
// through `connectedOkxProvider`, so leave `connectedWallet` null for it.
|
|
92
|
+
this.connectedWallet = detected.legacyInjectedId
|
|
93
|
+
? null
|
|
94
|
+
: detected.wallet;
|
|
95
|
+
this.connectedOkxProvider = okxProvider;
|
|
96
|
+
return {
|
|
97
|
+
networkId: network.id,
|
|
98
|
+
address: primary.address,
|
|
99
|
+
availableAddresses: accounts.map(account => ({
|
|
100
|
+
address: account.address,
|
|
101
|
+
networkId: network.id
|
|
102
|
+
})),
|
|
103
|
+
...(primary.publicKey ? { publicKey: primary.publicKey } : {})
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
async signMessage(message) {
|
|
107
|
+
if (!this.namespace || !this.account) {
|
|
108
|
+
throw new Error('No connected Bitcoin wallet');
|
|
109
|
+
}
|
|
110
|
+
// Refresh `this.account` to the wallet's LIVE active account before signing
|
|
111
|
+
// so `getAccount()` and the returned signer address stay consistent after
|
|
112
|
+
// an in-wallet account switch (otherwise they diverge from
|
|
113
|
+
// `getLiveAccount()`).
|
|
114
|
+
await this.refreshLiveAccount();
|
|
115
|
+
return this.namespace.signMessage({ account: this.account, message });
|
|
116
|
+
}
|
|
117
|
+
async sendTransaction(request) {
|
|
118
|
+
if (!this.namespace) {
|
|
119
|
+
throw new Error('No connected Bitcoin wallet');
|
|
120
|
+
}
|
|
121
|
+
// Broadcast is not wired yet: a PSBT request returns the wallet-signed PSBT
|
|
122
|
+
// (base64), NOT a txid. A high-level transfer is a WalletConnect-only path.
|
|
123
|
+
if ('psbt' in request) {
|
|
124
|
+
return this.namespace.signPsbt(request);
|
|
125
|
+
}
|
|
126
|
+
return this.namespace.sendTransfer(request);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Build available addresses for the supported Bitcoin network. Restricted to
|
|
130
|
+
* Bitcoin MAINNET (`bitcoinNetwork.id`), not any `bip122:` id — this connector
|
|
131
|
+
* only supports Bitcoin (see `assertBitcoinNetwork`), so stamping the address
|
|
132
|
+
* onto other bip122 chains (Dogecoin/Litecoin) would misrepresent it as a
|
|
133
|
+
* valid address there (a fund-loss risk if a consumer renders it as e.g. a
|
|
134
|
+
* DOGE deposit address).
|
|
135
|
+
*/
|
|
136
|
+
buildAvailableAddresses(supportedNetworkIds, address) {
|
|
137
|
+
return supportedNetworkIds
|
|
138
|
+
.filter(id => id === bitcoinNetwork.id)
|
|
139
|
+
.map(networkId => ({ address, networkId: networkId }));
|
|
140
|
+
}
|
|
141
|
+
getAccount() {
|
|
142
|
+
return this.account?.address ?? null;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The LIVE active address, read at call time from the connected wallet's
|
|
146
|
+
* own `accounts` list — never a cache. Unlike Solana's adapter.publicKey
|
|
147
|
+
* pull (which awaits a per-call Comlink read), Bitcoin has nothing to
|
|
148
|
+
* await: the Wallet Standard wallet keeps `accounts` current in place, the
|
|
149
|
+
* same property `checkExistingConnection` already reads without prompting.
|
|
150
|
+
* Returns null when there's no connected wallet or it exposes no accounts;
|
|
151
|
+
* the caller decides whether to throw.
|
|
152
|
+
*/
|
|
153
|
+
async getLiveAccount() {
|
|
154
|
+
if (this.connectedOkxProvider) {
|
|
155
|
+
// OKX exposes its live accounts via a (non-prompting) provider call.
|
|
156
|
+
try {
|
|
157
|
+
const addresses = await this.connectedOkxProvider.getAccounts();
|
|
158
|
+
return addresses?.[0] ?? this.account?.address ?? null;
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
return this.account?.address ?? null;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return this.connectedWallet?.accounts?.[0]?.address ?? null;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Refresh `this.account` to the wallet's live active account. Wallet Standard
|
|
168
|
+
* keeps `connectedWallet.accounts` current in place; OKX exposes it via a
|
|
169
|
+
* (non-prompting) provider call — for OKX only the address is available, so
|
|
170
|
+
* the prior public key is retained (OKX signs with its own active account and
|
|
171
|
+
* ignores the passed one). Best-effort: keeps the cached account on failure.
|
|
172
|
+
*/
|
|
173
|
+
async refreshLiveAccount() {
|
|
174
|
+
if (!this.account)
|
|
175
|
+
return;
|
|
176
|
+
if (this.connectedOkxProvider) {
|
|
177
|
+
try {
|
|
178
|
+
const [address] = await this.connectedOkxProvider.getAccounts();
|
|
179
|
+
if (address)
|
|
180
|
+
this.account = { ...this.account, address };
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
// keep the cached account
|
|
184
|
+
}
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const live = this.connectedWallet?.accounts?.[0];
|
|
188
|
+
if (live) {
|
|
189
|
+
this.account = {
|
|
190
|
+
address: live.address,
|
|
191
|
+
publicKey: bytesToHex(live.publicKey),
|
|
192
|
+
...(live.purpose ? { purpose: live.purpose } : {})
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Subscribe to the connected Bitcoin wallet's account changes. Bitcoin has
|
|
198
|
+
* no adapter-level `connect`/`disconnect` re-emission to lean on the way
|
|
199
|
+
* Solana's `StandardWalletAdapter` does — `standard:events` `change` is the
|
|
200
|
+
* ONLY account-change signal a bitcoin:* wallet exposes, so BOTH the local
|
|
201
|
+
* (direct) and bridged paths read it, unlike Solana where only the bridge
|
|
202
|
+
* side needs to.
|
|
203
|
+
*
|
|
204
|
+
* Bridge guard: in the production iframe the wallet published to this
|
|
205
|
+
* service is the Comlink-marshaled `Bip122WireWallet` shape (name, accounts,
|
|
206
|
+
* three feature methods only — no `standard:events`), so a direct
|
|
207
|
+
* subscription is impossible here. Instead, relay through
|
|
208
|
+
* `window.__uwcSubscribeBip122WalletEvent` (installed by
|
|
209
|
+
* `@meshconnect/uwc-bridge-child`, only present in bridge mode), which asks
|
|
210
|
+
* the PARENT frame — where the live wallet actually lives — to subscribe on
|
|
211
|
+
* our behalf. Falls back to `undefined` (polling remains the fallback) when
|
|
212
|
+
* the global or a connected wallet id isn't available, e.g. an older
|
|
213
|
+
* bridge-parent that predates this capability.
|
|
214
|
+
*/
|
|
215
|
+
onAccountsChanged(listener) {
|
|
216
|
+
// OKX (legacy-injected) is always in-frame — subscribe to its own
|
|
217
|
+
// `accountsChanged` event directly, never the bridge. The provider emits
|
|
218
|
+
// `accountsChanged` with the new address list.
|
|
219
|
+
if (this.connectedOkxProvider) {
|
|
220
|
+
const provider = this.connectedOkxProvider;
|
|
221
|
+
const handler = (accounts) => listener(Array.isArray(accounts) ? accounts : []);
|
|
222
|
+
provider.on('accountsChanged', handler);
|
|
223
|
+
return () => {
|
|
224
|
+
try {
|
|
225
|
+
provider.removeListener('accountsChanged', handler);
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
// Unsubscribe must never throw.
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
if (typeof window !== 'undefined' &&
|
|
233
|
+
window
|
|
234
|
+
.UWCBridgeChildInitialized === true) {
|
|
235
|
+
return this.subscribeAccountsChangedViaBridge(listener);
|
|
236
|
+
}
|
|
237
|
+
const wallet = this
|
|
238
|
+
.connectedWallet;
|
|
239
|
+
const standardEvents = wallet?.features?.['standard:events'];
|
|
240
|
+
if (!wallet || typeof standardEvents?.on !== 'function')
|
|
241
|
+
return undefined;
|
|
242
|
+
const off = standardEvents.on('change', properties => {
|
|
243
|
+
// React only to account-set changes; ignore pure chain/feature deltas.
|
|
244
|
+
if (!properties || !('accounts' in properties))
|
|
245
|
+
return;
|
|
246
|
+
const address = wallet.accounts?.[0]?.address ?? null;
|
|
247
|
+
listener(address ? [address] : []);
|
|
248
|
+
});
|
|
249
|
+
return () => {
|
|
250
|
+
try {
|
|
251
|
+
off?.();
|
|
252
|
+
}
|
|
253
|
+
catch {
|
|
254
|
+
// Unsubscribe must never throw.
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Bridge half of `onAccountsChanged`. `walletId` is `connectedWalletUuid`
|
|
260
|
+
* — the SAME id `BridgeParent`'s `bip122Wallets[].uuid` publishes (see
|
|
261
|
+
* `generateBip122WalletId` in `BridgeParent.ts`), which this service
|
|
262
|
+
* captured at connect time. The bridge global forwards a plain
|
|
263
|
+
* `string | null` address (never the raw account object); we map it to the
|
|
264
|
+
* `[address]` / `[]` shape `onAccountsChanged`'s direct-mode branch already
|
|
265
|
+
* uses (core reads `[]` as a namespace disconnect).
|
|
266
|
+
*/
|
|
267
|
+
subscribeAccountsChangedViaBridge(listener) {
|
|
268
|
+
const walletId = this.connectedWalletUuid;
|
|
269
|
+
const bridgeSubscribe = window.__uwcSubscribeBip122WalletEvent;
|
|
270
|
+
if (!walletId || !bridgeSubscribe)
|
|
271
|
+
return undefined;
|
|
272
|
+
return bridgeSubscribe(walletId, address => {
|
|
273
|
+
listener(address ? [address] : []);
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
isConnected() {
|
|
277
|
+
return this.account !== null;
|
|
278
|
+
}
|
|
279
|
+
getConnectedWalletUuid() {
|
|
280
|
+
return this.connectedWalletUuid;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Set connection state directly — used by the silent existing-connection
|
|
284
|
+
* restore path (`ConnectionManager.checkExistingConnections`). Re-derives
|
|
285
|
+
* the full `BitcoinAccount` (with hex `publicKey`) from the wallet's own
|
|
286
|
+
* `accounts` list so a subsequent `signMessage`/`sendTransaction` has what
|
|
287
|
+
* it needs, without re-prompting.
|
|
288
|
+
*/
|
|
289
|
+
setConnectionState(detectedWallet, address) {
|
|
290
|
+
if (!detectedWallet || !address) {
|
|
291
|
+
this.namespace = null;
|
|
292
|
+
this.account = null;
|
|
293
|
+
this.connectedWalletUuid = null;
|
|
294
|
+
this.connectedWallet = null;
|
|
295
|
+
this.connectedOkxProvider = null;
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
const wallet = detectedWallet.wallet;
|
|
299
|
+
const matched = wallet.accounts?.find(a => a.address === address);
|
|
300
|
+
if (detectedWallet.legacyInjectedId) {
|
|
301
|
+
// OKX restore: rebuild the OKX adapter; the handle's accounts were seeded
|
|
302
|
+
// (non-prompting) at discovery, so `matched` carries the public key.
|
|
303
|
+
const provider = resolveInjectedProperty(detectedWallet.legacyInjectedId);
|
|
304
|
+
if (!provider || !matched) {
|
|
305
|
+
this.namespace = null;
|
|
306
|
+
this.account = null;
|
|
307
|
+
this.connectedWalletUuid = null;
|
|
308
|
+
this.connectedWallet = null;
|
|
309
|
+
this.connectedOkxProvider = null;
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
this.namespace = new BitcoinNamespace(new OkxBitcoinAdapter(provider));
|
|
313
|
+
this.connectedOkxProvider = provider;
|
|
314
|
+
this.connectedWallet = null;
|
|
315
|
+
this.account = {
|
|
316
|
+
address: matched.address,
|
|
317
|
+
publicKey: bytesToHex(matched.publicKey),
|
|
318
|
+
...(matched.purpose ? { purpose: matched.purpose } : {})
|
|
319
|
+
};
|
|
320
|
+
this.connectedWalletUuid = detectedWallet.uuid;
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
if (!matched) {
|
|
324
|
+
// The address to restore isn't among the wallet's exposed accounts —
|
|
325
|
+
// fail closed rather than fabricate a `{ publicKey: '' }` account that
|
|
326
|
+
// could flow into a later sign. (Not reachable via the current caller,
|
|
327
|
+
// which passes `accounts[0].address`, but keeps the restore honest.)
|
|
328
|
+
this.namespace = null;
|
|
329
|
+
this.account = null;
|
|
330
|
+
this.connectedWalletUuid = null;
|
|
331
|
+
this.connectedWallet = null;
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
// Seed the adapter with the wallet's already-authorized accounts so the
|
|
335
|
+
// first sign after a silent restore doesn't re-invoke `bitcoin:connect`.
|
|
336
|
+
this.namespace = new BitcoinNamespace(new WalletStandardBitcoinAdapter(wallet, wallet.accounts));
|
|
337
|
+
this.connectedOkxProvider = null;
|
|
338
|
+
this.account = {
|
|
339
|
+
address: matched.address,
|
|
340
|
+
publicKey: bytesToHex(matched.publicKey),
|
|
341
|
+
...(matched.purpose ? { purpose: matched.purpose } : {})
|
|
342
|
+
};
|
|
343
|
+
this.connectedWalletUuid = detectedWallet.uuid;
|
|
344
|
+
this.connectedWallet = wallet;
|
|
345
|
+
}
|
|
346
|
+
async disconnect() {
|
|
347
|
+
if (this.namespace) {
|
|
348
|
+
await this.namespace.disconnect();
|
|
349
|
+
}
|
|
350
|
+
this.namespace = null;
|
|
351
|
+
this.account = null;
|
|
352
|
+
this.connectedWalletUuid = null;
|
|
353
|
+
this.connectedWallet = null;
|
|
354
|
+
this.connectedOkxProvider = null;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Build the namespace for a detected wallet, selecting the adapter by its
|
|
358
|
+
* kind: OKX legacy-injected (`legacyInjectedId` set) → `OkxBitcoinAdapter`
|
|
359
|
+
* over the resolved `window.*` provider; otherwise the Wallet Standard
|
|
360
|
+
* adapter. Sets `connectedOkxProvider` as a side effect so the live-account
|
|
361
|
+
* reads know which path is active.
|
|
362
|
+
*/
|
|
363
|
+
buildNamespace(detected) {
|
|
364
|
+
if (detected.legacyInjectedId) {
|
|
365
|
+
const provider = resolveInjectedProperty(detected.legacyInjectedId);
|
|
366
|
+
if (!provider) {
|
|
367
|
+
throw new Error(`OKX bitcoin provider not found at "${detected.legacyInjectedId}"`);
|
|
368
|
+
}
|
|
369
|
+
// Return the provider rather than assigning `this.connectedOkxProvider`
|
|
370
|
+
// here: `connect()` commits it only AFTER assertSupportedNetwork /
|
|
371
|
+
// getAccounts succeed, so a rejected prompt can't leave it set on an
|
|
372
|
+
// otherwise-unconnected service.
|
|
373
|
+
return {
|
|
374
|
+
namespace: new BitcoinNamespace(new OkxBitcoinAdapter(provider)),
|
|
375
|
+
okxProvider: provider
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
const wallet = detected.wallet;
|
|
379
|
+
return {
|
|
380
|
+
namespace: new BitcoinNamespace(new WalletStandardBitcoinAdapter(wallet)),
|
|
381
|
+
okxProvider: null
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
//# sourceMappingURL=bitcoin-wallet-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitcoin-wallet-service.js","sourceRoot":"","sources":["../../../src/services/bitcoin/bitcoin-wallet-service.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,gBAAgB,EAChB,4BAA4B,EAC5B,iBAAiB,EACjB,UAAU,EAGX,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EACL,iBAAiB,EAElB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAqB9E;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,oBAAoB;IAyBF;IAxBrB,eAAe,GAA4B,EAAE,CAAA;IAC7C,SAAS,GAA4B,IAAI,CAAA;IACzC,OAAO,GAA0B,IAAI,CAAA;IAC7C;;6CAEyC;IACjC,mBAAmB,GAAkB,IAAI,CAAA;IACjD;;;;;;;OAOG;IACK,eAAe,GAAuC,IAAI,CAAA;IAClE;;;;;OAKG;IACK,oBAAoB,GAA8B,IAAI,CAAA;IAE9D,YAA6B,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;IAAG,CAAC;IAEvD;;;OAGG;IACH,KAAK,CAAC,mBAAmB,CAC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Q,CAAC,CAAC;gBAChE,WAAW,EAAE,QAAQ;aACtB,CAAA;QACH,CAAC;QACD,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAgD,CAAA;QACxE,OAAO;YACL,SAAS,EAAE,IAAI,gBAAgB,CAAC,IAAI,4BAA4B,CAAC,MAAM,CAAC,CAAC;YACzE,WAAW,EAAE,IAAI;SAClB,CAAA;IACH,CAAC;CACF"}
|
|
@@ -3,6 +3,7 @@ import { EthereumWalletService } from './ethereum/ethereum-wallet-service';
|
|
|
3
3
|
import { SolanaWalletService } from './solana/solana-wallet-service';
|
|
4
4
|
import { TronWalletService } from './tron/tron-wallet-service';
|
|
5
5
|
import { TonWalletService } from './ton/ton-wallet-service';
|
|
6
|
+
import { BitcoinWalletService } from './bitcoin/bitcoin-wallet-service';
|
|
6
7
|
/**
|
|
7
8
|
* Payload for the `onSecondarySolanaConnectSkipped` triage sink: the ONC-3536
|
|
8
9
|
* gate was active for a legacy-`injectedId` wallet's secondary Solana gather —
|
|
@@ -130,6 +131,7 @@ export declare class ConnectionManager {
|
|
|
130
131
|
private solanaService;
|
|
131
132
|
private tronService;
|
|
132
133
|
private tonService;
|
|
134
|
+
private bitcoinService;
|
|
133
135
|
private currentNetworkId;
|
|
134
136
|
/** `${injectedId}:${outcome}` keys already reported via
|
|
135
137
|
* `onSecondarySolanaConnectSkipped` — dedupes the emit across repeated
|
|
@@ -145,7 +147,7 @@ export declare class ConnectionManager {
|
|
|
145
147
|
private readonly onWalletConnectionsReleased?;
|
|
146
148
|
private readonly steps;
|
|
147
149
|
private readonly secondaryGatherTimeoutMs;
|
|
148
|
-
constructor(ethereumService: EthereumWalletService, solanaService: SolanaWalletService, tronService: TronWalletService, tonService: TonWalletService, options?: ConnectionManagerOptions);
|
|
150
|
+
constructor(ethereumService: EthereumWalletService, solanaService: SolanaWalletService, tronService: TronWalletService, tonService: TonWalletService, bitcoinService: BitcoinWalletService, options?: ConnectionManagerOptions);
|
|
149
151
|
/** Report a gathered legacy-injectedId Solana address, once per injectedId x source. */
|
|
150
152
|
private reportSecondarySolanaConnectGathered;
|
|
151
153
|
/** Report the ACTIVE gate's observation, once per injectedId x outcome. */
|
|
@@ -183,7 +185,7 @@ export declare class ConnectionManager {
|
|
|
183
185
|
/**
|
|
184
186
|
* Check and add existing connections from other namespaces
|
|
185
187
|
*/
|
|
186
|
-
checkExistingConnections(targetNamespace:
|
|
188
|
+
checkExistingConnections(targetNamespace: Namespace, provider: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider): Promise<{
|
|
187
189
|
address: string | null;
|
|
188
190
|
availableAddresses: AvailableAddress[];
|
|
189
191
|
}>;
|
|
@@ -205,6 +207,15 @@ export declare class ConnectionManager {
|
|
|
205
207
|
* same behavior as Solana/Tron cross-namespace auto-connect.
|
|
206
208
|
*/
|
|
207
209
|
private checkAndAddTonAddresses;
|
|
210
|
+
/**
|
|
211
|
+
* Secondary gather for an already-authorized Bitcoin account. Reads a live
|
|
212
|
+
* session first; if none, probes for an authorized account WITHOUT prompting
|
|
213
|
+
* — `checkExistingConnection` reads the wallet's already-exposed accounts and
|
|
214
|
+
* never calls `bitcoin:connect`. Deliberately has NO connect() fallback
|
|
215
|
+
* (unlike TON): a bitcoin connect prompts, which a best-effort secondary
|
|
216
|
+
* gather must never do.
|
|
217
|
+
*/
|
|
218
|
+
private checkAndAddBitcoinAddresses;
|
|
208
219
|
/**
|
|
209
220
|
* After connecting one namespace, check and add addresses for all OTHER namespaces.
|
|
210
221
|
* E.g. after connecting Ethereum, also gather Solana, Tron, and TON addresses.
|
|
@@ -259,6 +270,10 @@ export declare class ConnectionManager {
|
|
|
259
270
|
* Connect to TON wallet
|
|
260
271
|
*/
|
|
261
272
|
connectTon(network: Network, provider: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider): Promise<ConnectorResult>;
|
|
273
|
+
/**
|
|
274
|
+
* Connect to a Bitcoin (bip122) wallet
|
|
275
|
+
*/
|
|
276
|
+
connectBitcoin(network: Network, provider: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider): Promise<ConnectorResult>;
|
|
262
277
|
/**
|
|
263
278
|
* Switch network
|
|
264
279
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-manager.d.ts","sourceRoot":"","sources":["../../src/services/connection-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,yBAAyB,EACzB,iCAAiC,EACjC,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAEhB,cAAc,EACf,MAAM,wBAAwB,CAAA;AAG/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAA;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"connection-manager.d.ts","sourceRoot":"","sources":["../../src/services/connection-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,yBAAyB,EACzB,iCAAiC,EACjC,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAEhB,cAAc,EACf,MAAM,wBAAwB,CAAA;AAG/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAA;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAyHvE;;;;;;GAMG;AACH,MAAM,WAAW,iCAAiC;IAChD,4FAA4F;IAC5F,UAAU,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,OAAO,EAAE,mBAAmB,GAAG,kBAAkB,CAAA;IACjD;;;OAG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