@meshconnect/uwc-bitcoin 0.2.4 → 0.3.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/adapter.d.ts +20 -7
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapters/okx.d.ts +60 -0
- package/dist/adapters/okx.d.ts.map +1 -0
- package/dist/adapters/okx.js +93 -0
- package/dist/adapters/okx.js.map +1 -0
- package/dist/adapters/wallet-standard.d.ts +88 -0
- package/dist/adapters/wallet-standard.d.ts.map +1 -0
- package/dist/adapters/wallet-standard.js +118 -0
- package/dist/adapters/wallet-standard.js.map +1 -0
- package/dist/bitcoin-namespace.d.ts +20 -3
- package/dist/bitcoin-namespace.d.ts.map +1 -1
- package/dist/bitcoin-namespace.js +39 -2
- package/dist/bitcoin-namespace.js.map +1 -1
- package/dist/encoding.d.ts +12 -0
- package/dist/encoding.d.ts.map +1 -0
- package/dist/encoding.js +46 -0
- package/dist/encoding.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/adapter.ts +25 -7
- package/src/adapters/okx.test.ts +176 -0
- package/src/adapters/okx.ts +155 -0
- package/src/adapters/wallet-standard.test.ts +148 -0
- package/src/adapters/wallet-standard.ts +194 -0
- package/src/bitcoin-namespace.test.ts +92 -1
- package/src/bitcoin-namespace.ts +46 -3
- package/src/encoding.ts +47 -0
- package/src/index.ts +8 -0
package/dist/adapter.d.ts
CHANGED
|
@@ -1,24 +1,37 @@
|
|
|
1
|
-
import type { BitcoinAccount, BitcoinSignMessageParams, SignatureType } from '@meshconnect/uwc-types';
|
|
1
|
+
import type { BitcoinAccount, BitcoinPsbtSignRequest, BitcoinSendTransferRequest, BitcoinSignMessageParams, SignatureType, TransactionResult } from '@meshconnect/uwc-types';
|
|
2
2
|
/**
|
|
3
3
|
* The seam between the Bitcoin namespace module and a single transport.
|
|
4
4
|
*
|
|
5
|
-
* A concrete adapter
|
|
5
|
+
* A concrete adapter is constructed by its transport bound to an
|
|
6
6
|
* already-connected provider/session — Wallet Standard `bitcoin:*` for the
|
|
7
7
|
* injected transport, WalletConnect bip122 for the WalletConnect transport —
|
|
8
8
|
* so the port carries no `connect`/provider argument: connecting is the
|
|
9
9
|
* transport's job. Each adapter converts between these transport-agnostic
|
|
10
|
-
* domain shapes and its wallet's native interface (e.g. hex ↔
|
|
10
|
+
* domain shapes and its wallet's native interface (e.g. hex/base64 strings ↔
|
|
11
|
+
* `Uint8Array`).
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* `getAccounts` + `signMessage` are the always-present verify-flow methods.
|
|
14
|
+
* `signPsbt` and `sendTransfer` are optional because they map to distinct wallet
|
|
15
|
+
* paths — a Wallet Standard wallet signs a PSBT (Path B); a WalletConnect wallet
|
|
16
|
+
* does a high-level `sendTransfer` (Path A) — and not every adapter offers both.
|
|
16
17
|
*/
|
|
17
18
|
export interface BitcoinTransportAdapter {
|
|
18
19
|
/** Enumerate the bip122 accounts available on the connected session. */
|
|
19
20
|
getAccounts(): Promise<BitcoinAccount[]>;
|
|
20
21
|
/** Sign a message with the given account. */
|
|
21
22
|
signMessage(params: BitcoinSignMessageParams): Promise<SignatureType>;
|
|
23
|
+
/**
|
|
24
|
+
* Sign a PSBT (Path B). Returns the wallet-signed PSBT, base64-encoded — the
|
|
25
|
+
* wallet does NOT broadcast; finalizing + broadcasting is a separate step.
|
|
26
|
+
* Optional: only adapters whose wallet exposes PSBT signing implement it.
|
|
27
|
+
*/
|
|
28
|
+
signPsbt?(request: BitcoinPsbtSignRequest): Promise<string>;
|
|
29
|
+
/**
|
|
30
|
+
* High-level transfer (Path A): the wallet does coin selection, fee, signing,
|
|
31
|
+
* and broadcast, returning a txid. Optional: only adapters whose transport
|
|
32
|
+
* offers it (e.g. WalletConnect `sendTransfer`) implement it.
|
|
33
|
+
*/
|
|
34
|
+
sendTransfer?(request: BitcoinSendTransferRequest): Promise<TransactionResult>;
|
|
22
35
|
/** Release any session resources the adapter holds. Optional. */
|
|
23
36
|
disconnect?(): Promise<void>;
|
|
24
37
|
}
|
package/dist/adapter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,wBAAwB,EACxB,aAAa,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,aAAa,EACb,iBAAiB,EAClB,MAAM,wBAAwB,CAAA;AAE/B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,uBAAuB;IACtC,wEAAwE;IACxE,WAAW,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAA;IAExC,6CAA6C;IAC7C,WAAW,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;IAErE;;;;OAIG;IACH,QAAQ,CAAC,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAE3D;;;;OAIG;IACH,YAAY,CAAC,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAE9E,iEAAiE;IACjE,UAAU,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { BitcoinAccount, BitcoinPsbtSignRequest, BitcoinSignMessageParams, SignatureType } from '@meshconnect/uwc-types';
|
|
2
|
+
import type { BitcoinTransportAdapter } from '../adapter';
|
|
3
|
+
/**
|
|
4
|
+
* The subset of OKX's injected Bitcoin provider this adapter drives
|
|
5
|
+
* (`window.okxwallet.bitcoin`). OKX does NOT expose Bitcoin through Wallet
|
|
6
|
+
* Standard — only this legacy injected provider — so it needs a dedicated
|
|
7
|
+
* adapter, not `WalletStandardBitcoinAdapter`.
|
|
8
|
+
*
|
|
9
|
+
* Wire conventions the provider follows:
|
|
10
|
+
* - `requestAccounts()` prompts + returns the authorized addresses; the caller
|
|
11
|
+
* pairs `getPublicKey()` for the active account's compressed key (hex).
|
|
12
|
+
* - `signMessage(msg, type)` returns a base64 signature.
|
|
13
|
+
* - `signPsbt(psbtHex, options)` takes AND returns PSBT as HEX — so this adapter
|
|
14
|
+
* converts base64 ↔ hex at the boundary (our domain is base64/BIP-174).
|
|
15
|
+
*/
|
|
16
|
+
export interface OkxBitcoinProvider {
|
|
17
|
+
/** Prompt for connection; returns the authorized addresses. */
|
|
18
|
+
requestAccounts(): Promise<string[]>;
|
|
19
|
+
/** Non-prompting: the already-authorized addresses ([] if not connected). */
|
|
20
|
+
getAccounts(): Promise<string[]>;
|
|
21
|
+
/** The active account's compressed public key, hex-encoded. */
|
|
22
|
+
getPublicKey(): Promise<string>;
|
|
23
|
+
/** Sign a message; returns a base64 signature. */
|
|
24
|
+
signMessage(message: string, type?: 'ecdsa' | 'bip322-simple'): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Sign a PSBT (hex in, signed PSBT hex out). `toSignInputs` scopes which
|
|
27
|
+
* inputs to sign (index + expected address, optional sighash), mirroring the
|
|
28
|
+
* Wallet Standard adapter's `inputsToSign`; omitted → the wallet signs all it
|
|
29
|
+
* can.
|
|
30
|
+
*/
|
|
31
|
+
signPsbt(psbtHex: string, options?: {
|
|
32
|
+
autoFinalized?: boolean;
|
|
33
|
+
toSignInputs?: {
|
|
34
|
+
index: number;
|
|
35
|
+
address: string;
|
|
36
|
+
sighashTypes?: number[];
|
|
37
|
+
}[];
|
|
38
|
+
}): Promise<string>;
|
|
39
|
+
on(event: string, handler: (accounts: string[]) => void): void;
|
|
40
|
+
removeListener(event: string, handler: (accounts: string[]) => void): void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* OKX (legacy injected) Bitcoin transport adapter — the non-Wallet-Standard
|
|
44
|
+
* injected path. The injected transport resolves `window.okxwallet.bitcoin` by
|
|
45
|
+
* its `injectedId` and hands it here; this adapter maps our domain shapes onto
|
|
46
|
+
* the provider's methods.
|
|
47
|
+
*
|
|
48
|
+
* `sendTransfer` is intentionally not implemented — that is the WalletConnect
|
|
49
|
+
* high-level path. (OKX has `sendBitcoin`, but broadcast is out of scope here:
|
|
50
|
+
* this stays sign-only, matching `WalletStandardBitcoinAdapter`.)
|
|
51
|
+
*/
|
|
52
|
+
export declare class OkxBitcoinAdapter implements BitcoinTransportAdapter {
|
|
53
|
+
private readonly provider;
|
|
54
|
+
constructor(provider: OkxBitcoinProvider);
|
|
55
|
+
getAccounts(): Promise<BitcoinAccount[]>;
|
|
56
|
+
signMessage(params: BitcoinSignMessageParams): Promise<SignatureType>;
|
|
57
|
+
signPsbt(request: BitcoinPsbtSignRequest): Promise<string>;
|
|
58
|
+
disconnect(): Promise<void>;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=okx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"okx.d.ts","sourceRoot":"","sources":["../../src/adapters/okx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EAEtB,wBAAwB,EACxB,aAAa,EACd,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AAQzD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,kBAAkB;IACjC,+DAA+D;IAC/D,eAAe,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IACpC,6EAA6E;IAC7E,WAAW,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAChC,+DAA+D;IAC/D,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IAC/B,kDAAkD;IAClD,WAAW,CACT,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,OAAO,GAAG,eAAe,GAC/B,OAAO,CAAC,MAAM,CAAC,CAAA;IAClB;;;;;OAKG;IACH,QAAQ,CACN,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,aAAa,CAAC,EAAE,OAAO,CAAA;QACvB,YAAY,CAAC,EAAE;YACb,KAAK,EAAE,MAAM,CAAA;YACb,OAAO,EAAE,MAAM,CAAA;YACf,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;SACxB,EAAE,CAAA;KACJ,GACA,OAAO,CAAC,MAAM,CAAC,CAAA;IAClB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,GAAG,IAAI,CAAA;IAC9D,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,GAAG,IAAI,CAAA;CAC3E;AAaD;;;;;;;;;GASG;AACH,qBAAa,iBAAkB,YAAW,uBAAuB;IACnD,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,kBAAkB;IAEnD,WAAW,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAgBxC,WAAW,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,aAAa,CAAC;IAgBrE,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC;IA+BhE,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAK5B"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { WalletConnectorError } from '@meshconnect/uwc-types';
|
|
2
|
+
import { base64ToBytes, bytesToBase64, bytesToHex, hexToBytes } from '../encoding';
|
|
3
|
+
/** Bitcoin SIGHASH flag → numeric value (Bitcoin Core encoding) for the
|
|
4
|
+
* provider's `toSignInputs.sighashTypes`. */
|
|
5
|
+
const SIGHASH_VALUES = {
|
|
6
|
+
ALL: 0x01,
|
|
7
|
+
NONE: 0x02,
|
|
8
|
+
SINGLE: 0x03,
|
|
9
|
+
'ALL|ANYONECANPAY': 0x81,
|
|
10
|
+
'NONE|ANYONECANPAY': 0x82,
|
|
11
|
+
'SINGLE|ANYONECANPAY': 0x83
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* OKX (legacy injected) Bitcoin transport adapter — the non-Wallet-Standard
|
|
15
|
+
* injected path. The injected transport resolves `window.okxwallet.bitcoin` by
|
|
16
|
+
* its `injectedId` and hands it here; this adapter maps our domain shapes onto
|
|
17
|
+
* the provider's methods.
|
|
18
|
+
*
|
|
19
|
+
* `sendTransfer` is intentionally not implemented — that is the WalletConnect
|
|
20
|
+
* high-level path. (OKX has `sendBitcoin`, but broadcast is out of scope here:
|
|
21
|
+
* this stays sign-only, matching `WalletStandardBitcoinAdapter`.)
|
|
22
|
+
*/
|
|
23
|
+
export class OkxBitcoinAdapter {
|
|
24
|
+
provider;
|
|
25
|
+
constructor(provider) {
|
|
26
|
+
this.provider = provider;
|
|
27
|
+
}
|
|
28
|
+
async getAccounts() {
|
|
29
|
+
const addresses = await this.provider.requestAccounts();
|
|
30
|
+
// The provider exposes one active public key; pair it with the first
|
|
31
|
+
// (active) address. Tolerate a missing key rather than failing the connect.
|
|
32
|
+
let publicKey = '';
|
|
33
|
+
try {
|
|
34
|
+
publicKey = await this.provider.getPublicKey();
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
publicKey = '';
|
|
38
|
+
}
|
|
39
|
+
return addresses.map((address, index) => ({
|
|
40
|
+
address,
|
|
41
|
+
publicKey: index === 0 ? publicKey : ''
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
async signMessage(params) {
|
|
45
|
+
// OKX signs with its OWN active account (no address param), so the caller's
|
|
46
|
+
// `params.account` is advisory here. Map our protocol name to the
|
|
47
|
+
// provider's ('bip322' → 'bip322-simple').
|
|
48
|
+
const type = params.protocol === 'bip322' ? 'bip322-simple' : 'ecdsa';
|
|
49
|
+
const signature = await this.provider.signMessage(params.message, type);
|
|
50
|
+
if (!signature) {
|
|
51
|
+
throw new WalletConnectorError({
|
|
52
|
+
type: 'unknown',
|
|
53
|
+
message: 'okx bitcoin: signMessage returned no signature'
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// OKX returns a base64 signature — matches our contract.
|
|
57
|
+
return { type: 'standard', signature };
|
|
58
|
+
}
|
|
59
|
+
async signPsbt(request) {
|
|
60
|
+
// Our domain is base64 (BIP-174); OKX speaks hex. autoFinalized:false keeps
|
|
61
|
+
// this sign-only (the wallet returns the signed-but-unfinalized PSBT).
|
|
62
|
+
const psbtHex = bytesToHex(base64ToBytes(request.psbt));
|
|
63
|
+
// Forward which inputs to sign (index + address, optional sighash) so the
|
|
64
|
+
// wallet signs exactly the requested set — matching the Wallet Standard
|
|
65
|
+
// adapter's `inputsToSign`. `request.from` isn't forwarded: OKX signs with
|
|
66
|
+
// its single active account, so there's no per-`from` routing. Omitted →
|
|
67
|
+
// OKX signs all inputs it can.
|
|
68
|
+
const toSignInputs = request.inputsToSign?.flatMap(input => input.signingIndexes.map(index => ({
|
|
69
|
+
index,
|
|
70
|
+
address: input.address,
|
|
71
|
+
...(input.sigHash
|
|
72
|
+
? { sighashTypes: [SIGHASH_VALUES[input.sigHash]] }
|
|
73
|
+
: {})
|
|
74
|
+
})));
|
|
75
|
+
const signedHex = await this.provider.signPsbt(psbtHex, {
|
|
76
|
+
autoFinalized: false,
|
|
77
|
+
...(toSignInputs ? { toSignInputs } : {})
|
|
78
|
+
});
|
|
79
|
+
if (!signedHex) {
|
|
80
|
+
throw new WalletConnectorError({
|
|
81
|
+
type: 'unknown',
|
|
82
|
+
message: 'okx bitcoin: signPsbt returned no PSBT'
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return bytesToBase64(hexToBytes(signedHex));
|
|
86
|
+
}
|
|
87
|
+
disconnect() {
|
|
88
|
+
// OKX's injected provider has no disconnect RPC; clearing session state is
|
|
89
|
+
// the caller's job.
|
|
90
|
+
return Promise.resolve();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=okx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"okx.js","sourceRoot":"","sources":["../../src/adapters/okx.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,UAAU,EACX,MAAM,aAAa,CAAA;AAgDpB;6CAC6C;AAC7C,MAAM,cAAc,GAAmC;IACrD,GAAG,EAAE,IAAI;IACT,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,IAAI;IACZ,kBAAkB,EAAE,IAAI;IACxB,mBAAmB,EAAE,IAAI;IACzB,qBAAqB,EAAE,IAAI;CAC5B,CAAA;AAED;;;;;;;;;GASG;AACH,MAAM,OAAO,iBAAiB;IACC;IAA7B,YAA6B,QAA4B;QAA5B,aAAQ,GAAR,QAAQ,CAAoB;IAAG,CAAC;IAE7D,KAAK,CAAC,WAAW;QACf,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAA;QACvD,qEAAqE;QACrE,4EAA4E;QAC5E,IAAI,SAAS,GAAG,EAAE,CAAA;QAClB,IAAI,CAAC;YACH,SAAS,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAA;QAChD,CAAC;QAAC,MAAM,CAAC;YACP,SAAS,GAAG,EAAE,CAAA;QAChB,CAAC;QACD,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YACxC,OAAO;YACP,SAAS,EAAE,KAAK,KAAK,CAAC,CAAC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D,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE;YACtD,aAAa,EAAE,KAAK;YACpB,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1C,CAAC,CAAA;QACF,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,oBAAoB,CAAC;gBAC7B,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,wCAAwC;aAClD,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,aAAa,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAA;IAC7C,CAAC;IAED,UAAU;QACR,2EAA2E;QAC3E,oBAAoB;QACpB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { BitcoinAccount, BitcoinPsbtSignRequest, BitcoinSignMessageParams, SignatureType } from '@meshconnect/uwc-types';
|
|
2
|
+
import type { BitcoinTransportAdapter } from '../adapter';
|
|
3
|
+
/**
|
|
4
|
+
* The subset of the Wallet Standard `bitcoin:*` interface this adapter drives.
|
|
5
|
+
* Structural (no `@wallet-standard/*` dependency); grounded on the community
|
|
6
|
+
* bitcoin-wallet-standard interface that MetaMask exposes. (OKX signs BTC too,
|
|
7
|
+
* but via a legacy injected provider, not Wallet Standard — it needs a separate
|
|
8
|
+
* adapter, not this one.)
|
|
9
|
+
* @see https://github.com/ExodusMovement/bitcoin-wallet-standard
|
|
10
|
+
*/
|
|
11
|
+
export interface WalletStandardBitcoinAccount {
|
|
12
|
+
address: string;
|
|
13
|
+
publicKey: Uint8Array;
|
|
14
|
+
purpose?: 'payment' | 'ordinals';
|
|
15
|
+
}
|
|
16
|
+
interface BitcoinConnectFeature {
|
|
17
|
+
connect(input: {
|
|
18
|
+
purposes: ('payment' | 'ordinals')[];
|
|
19
|
+
}): Promise<{
|
|
20
|
+
accounts: WalletStandardBitcoinAccount[];
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
interface BitcoinSignMessageFeature {
|
|
24
|
+
signMessage(input: {
|
|
25
|
+
account: WalletStandardBitcoinAccount;
|
|
26
|
+
message: Uint8Array;
|
|
27
|
+
protocol?: 'ecdsa' | 'bip322';
|
|
28
|
+
}): Promise<{
|
|
29
|
+
signature: Uint8Array;
|
|
30
|
+
signedMessage: Uint8Array;
|
|
31
|
+
}[]>;
|
|
32
|
+
}
|
|
33
|
+
interface BitcoinSignTransactionFeature {
|
|
34
|
+
signTransaction(input: {
|
|
35
|
+
account: WalletStandardBitcoinAccount;
|
|
36
|
+
psbt: Uint8Array;
|
|
37
|
+
inputsToSign?: {
|
|
38
|
+
account: WalletStandardBitcoinAccount;
|
|
39
|
+
signingIndexes: number[];
|
|
40
|
+
sigHash?: string;
|
|
41
|
+
}[];
|
|
42
|
+
}): Promise<{
|
|
43
|
+
psbt: Uint8Array;
|
|
44
|
+
}[]>;
|
|
45
|
+
}
|
|
46
|
+
/** The handle the injected transport passes in (a discovered `bitcoin:*` wallet). */
|
|
47
|
+
export interface WalletStandardBitcoinWallet {
|
|
48
|
+
name: string;
|
|
49
|
+
accounts: readonly WalletStandardBitcoinAccount[];
|
|
50
|
+
features: Record<string, unknown> & {
|
|
51
|
+
'bitcoin:connect'?: BitcoinConnectFeature;
|
|
52
|
+
'bitcoin:signMessage'?: BitcoinSignMessageFeature;
|
|
53
|
+
'bitcoin:signTransaction'?: BitcoinSignTransactionFeature;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Wallet Standard (`bitcoin:*`) transport adapter — the injected path for
|
|
58
|
+
* wallets that speak Wallet Standard (verified: MetaMask). The injected
|
|
59
|
+
* transport discovers the wallet and hands it here; this adapter performs the
|
|
60
|
+
* bip122-specific operations against it, converting hex/base64 ↔ `Uint8Array`
|
|
61
|
+
* at the boundary.
|
|
62
|
+
*
|
|
63
|
+
* `sendTransfer` is intentionally not implemented — Wallet Standard has no
|
|
64
|
+
* high-level transfer; that is the WalletConnect adapter's path.
|
|
65
|
+
*/
|
|
66
|
+
export declare class WalletStandardBitcoinAdapter implements BitcoinTransportAdapter {
|
|
67
|
+
private readonly wallet;
|
|
68
|
+
private accounts;
|
|
69
|
+
/**
|
|
70
|
+
* @param wallet The discovered `bitcoin:*` wallet.
|
|
71
|
+
* @param initialAccounts Optional already-authorized accounts to seed the
|
|
72
|
+
* cache with. Passed on the SILENT restore path so the first
|
|
73
|
+
* `signMessage`/`signPsbt` doesn't re-invoke `bitcoin:connect` (which some
|
|
74
|
+
* wallets surface as UI) via `requireAccount`→`getAccounts`. Omit on a
|
|
75
|
+
* fresh connect, where `getAccounts()` should call `bitcoin:connect` to
|
|
76
|
+
* authorize.
|
|
77
|
+
*/
|
|
78
|
+
constructor(wallet: WalletStandardBitcoinWallet, initialAccounts?: readonly WalletStandardBitcoinAccount[]);
|
|
79
|
+
getAccounts(): Promise<BitcoinAccount[]>;
|
|
80
|
+
signMessage(params: BitcoinSignMessageParams): Promise<SignatureType>;
|
|
81
|
+
signPsbt(request: BitcoinPsbtSignRequest): Promise<string>;
|
|
82
|
+
disconnect(): Promise<void>;
|
|
83
|
+
/** Look up the wallet-native account for an address, connecting first if needed. */
|
|
84
|
+
private requireAccount;
|
|
85
|
+
private unsupported;
|
|
86
|
+
}
|
|
87
|
+
export {};
|
|
88
|
+
//# sourceMappingURL=wallet-standard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-standard.d.ts","sourceRoot":"","sources":["../../src/adapters/wallet-standard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,wBAAwB,EACxB,aAAa,EACd,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AAQzD;;;;;;;GAOG;AACH,MAAM,WAAW,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A6B,CAAA;KAC1D,CAAA;CACF;AAED;;;;;;;;;GASG;AACH,qBAAa,4BAA6B,YAAW,uBAAuB;IAaxE,OAAO,CAAC,QAAQ,CAAC,MAAM;IAZzB,OAAO,CAAC,QAAQ,CAAuD;IAEvE;;;;;;;;OAQG;gBAEgB,MAAM,EAAE,2BAA2B,EACpD,eAAe,CAAC,EAAE,SAAS,4BAA4B,EAAE;IAOrD,WAAW,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAexC,WAAW,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,aAAa,CAAC;IAoBrE,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC;IA6BhE,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3B,oFAAoF;YACtE,cAAc;IAoB5B,OAAO,CAAC,WAAW;CAMpB"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { WalletConnectorError } from '@meshconnect/uwc-types';
|
|
2
|
+
import { base64ToBytes, bytesToBase64, bytesToHex, utf8ToBytes } from '../encoding';
|
|
3
|
+
/**
|
|
4
|
+
* Wallet Standard (`bitcoin:*`) transport adapter — the injected path for
|
|
5
|
+
* wallets that speak Wallet Standard (verified: MetaMask). The injected
|
|
6
|
+
* transport discovers the wallet and hands it here; this adapter performs the
|
|
7
|
+
* bip122-specific operations against it, converting hex/base64 ↔ `Uint8Array`
|
|
8
|
+
* at the boundary.
|
|
9
|
+
*
|
|
10
|
+
* `sendTransfer` is intentionally not implemented — Wallet Standard has no
|
|
11
|
+
* high-level transfer; that is the WalletConnect adapter's path.
|
|
12
|
+
*/
|
|
13
|
+
export class WalletStandardBitcoinAdapter {
|
|
14
|
+
wallet;
|
|
15
|
+
accounts = null;
|
|
16
|
+
/**
|
|
17
|
+
* @param wallet The discovered `bitcoin:*` wallet.
|
|
18
|
+
* @param initialAccounts Optional already-authorized accounts to seed the
|
|
19
|
+
* cache with. Passed on the SILENT restore path so the first
|
|
20
|
+
* `signMessage`/`signPsbt` doesn't re-invoke `bitcoin:connect` (which some
|
|
21
|
+
* wallets surface as UI) via `requireAccount`→`getAccounts`. Omit on a
|
|
22
|
+
* fresh connect, where `getAccounts()` should call `bitcoin:connect` to
|
|
23
|
+
* authorize.
|
|
24
|
+
*/
|
|
25
|
+
constructor(wallet, initialAccounts) {
|
|
26
|
+
this.wallet = wallet;
|
|
27
|
+
if (initialAccounts && initialAccounts.length > 0) {
|
|
28
|
+
this.accounts = initialAccounts;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async getAccounts() {
|
|
32
|
+
const connect = this.wallet.features['bitcoin:connect'];
|
|
33
|
+
// The wallet exposes accounts only after `bitcoin:connect`; fall back to any
|
|
34
|
+
// it already lists (a wallet without the connect feature).
|
|
35
|
+
this.accounts = connect
|
|
36
|
+
? (await connect.connect({ purposes: ['payment'] })).accounts
|
|
37
|
+
: this.wallet.accounts;
|
|
38
|
+
return this.accounts.map(account => ({
|
|
39
|
+
address: account.address,
|
|
40
|
+
publicKey: bytesToHex(account.publicKey),
|
|
41
|
+
...(account.purpose ? { purpose: account.purpose } : {})
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
async signMessage(params) {
|
|
45
|
+
const feature = this.wallet.features['bitcoin:signMessage'];
|
|
46
|
+
if (!feature) {
|
|
47
|
+
throw this.unsupported('signMessage');
|
|
48
|
+
}
|
|
49
|
+
const account = await this.requireAccount(params.account.address);
|
|
50
|
+
const [result] = await feature.signMessage({
|
|
51
|
+
account,
|
|
52
|
+
message: utf8ToBytes(params.message),
|
|
53
|
+
...(params.protocol ? { protocol: params.protocol } : {})
|
|
54
|
+
});
|
|
55
|
+
if (!result) {
|
|
56
|
+
throw new WalletConnectorError({
|
|
57
|
+
type: 'unknown',
|
|
58
|
+
message: 'wallet-standard bitcoin: signMessage returned no signature'
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return { type: 'standard', signature: bytesToBase64(result.signature) };
|
|
62
|
+
}
|
|
63
|
+
async signPsbt(request) {
|
|
64
|
+
const feature = this.wallet.features['bitcoin:signTransaction'];
|
|
65
|
+
if (!feature) {
|
|
66
|
+
throw this.unsupported('signPsbt');
|
|
67
|
+
}
|
|
68
|
+
const account = await this.requireAccount(request.from);
|
|
69
|
+
const inputsToSign = request.inputsToSign
|
|
70
|
+
? await Promise.all(request.inputsToSign.map(async (input) => ({
|
|
71
|
+
account: await this.requireAccount(input.address),
|
|
72
|
+
signingIndexes: input.signingIndexes,
|
|
73
|
+
...(input.sigHash ? { sigHash: input.sigHash } : {})
|
|
74
|
+
})))
|
|
75
|
+
: undefined;
|
|
76
|
+
const [result] = await feature.signTransaction({
|
|
77
|
+
account,
|
|
78
|
+
psbt: base64ToBytes(request.psbt),
|
|
79
|
+
...(inputsToSign ? { inputsToSign } : {})
|
|
80
|
+
});
|
|
81
|
+
if (!result) {
|
|
82
|
+
throw new WalletConnectorError({
|
|
83
|
+
type: 'unknown',
|
|
84
|
+
message: 'wallet-standard bitcoin: signTransaction returned no PSBT'
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return bytesToBase64(result.psbt);
|
|
88
|
+
}
|
|
89
|
+
disconnect() {
|
|
90
|
+
this.accounts = null;
|
|
91
|
+
return Promise.resolve();
|
|
92
|
+
}
|
|
93
|
+
/** Look up the wallet-native account for an address, connecting first if needed. */
|
|
94
|
+
async requireAccount(address) {
|
|
95
|
+
if (!this.accounts)
|
|
96
|
+
await this.getAccounts();
|
|
97
|
+
const account = this.accounts?.find(a => a.address === address) ??
|
|
98
|
+
// The cached set is from an earlier authorize; the wallet may have since
|
|
99
|
+
// switched accounts (its `accounts` update in place). Re-check the
|
|
100
|
+
// wallet's CURRENT accounts before failing — so signing the live account
|
|
101
|
+
// after a switch resolves without re-invoking `bitcoin:connect`.
|
|
102
|
+
this.wallet.accounts?.find(a => a.address === address);
|
|
103
|
+
if (!account) {
|
|
104
|
+
throw new WalletConnectorError({
|
|
105
|
+
type: 'unknown',
|
|
106
|
+
message: `wallet-standard bitcoin: no connected account for "${address}"`
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return account;
|
|
110
|
+
}
|
|
111
|
+
unsupported(method) {
|
|
112
|
+
return new WalletConnectorError({
|
|
113
|
+
type: 'unknown',
|
|
114
|
+
message: `wallet-standard bitcoin: this wallet does not support ${method}`
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=wallet-standard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-standard.js","sourceRoot":"","sources":["../../src/adapters/wallet-standard.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACZ,MAAM,aAAa,CAAA;AAqDpB;;;;;;;;;GASG;AACH,MAAM,OAAO,4BAA4B;IAapB;IAZX,QAAQ,GAAmD,IAAI,CAAA;IAEvE;;;;;;;;OAQG;IACH,YACmB,MAAmC,EACpD,eAAyD;QADxC,WAAM,GAAN,MAAM,CAA6B;QAGpD,IAAI,eAAe,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClD,IAAI,CAAC,QAAQ,GAAG,eAAe,CAAA;QACjC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,WAAW;QACf,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAA;QACvD,6EAA6E;QAC7E,2DAA2D;QAC3D,IAAI,CAAC,QAAQ,GAAG,OAAO;YACrB,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;YAC7D,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAA;QAExB,OAAO,IAAI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CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;IAED,oFAAoF;IAC5E,KAAK,CAAC,cAAc,CAC1B,OAAe;QAEf,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,CAAC,WAAW,EAAE,CAAA;QAC5C,MAAM,OAAO,GACX,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC;YAC/C,yEAAyE;YACzE,mEAAmE;YACnE,yEAAyE;YACzE,iEAAiE;YACjE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,CAAA;QACxD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,oBAAoB,CAAC;gBAC7B,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,sDAAsD,OAAO,GAAG;aAC1E,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;IAEO,WAAW,CAAC,MAAc;QAChC,OAAO,IAAI,oBAAoB,CAAC;YAC9B,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,yDAAyD,MAAM,EAAE;SAC3E,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import type { BitcoinAccount, BitcoinSignMessageParams, Namespace, Network, SignatureType } from '@meshconnect/uwc-types';
|
|
1
|
+
import type { BitcoinAccount, BitcoinPsbtSignRequest, BitcoinSendTransferRequest, BitcoinSignMessageParams, Namespace, Network, SignatureType, TransactionResult } from '@meshconnect/uwc-types';
|
|
2
2
|
import type { BitcoinTransportAdapter } from './adapter';
|
|
3
3
|
/** CAIP-2 namespace this module serves. */
|
|
4
4
|
export declare const BITCOIN_NAMESPACE: Namespace;
|
|
5
5
|
/**
|
|
6
|
-
* Assert `network` is
|
|
7
|
-
*
|
|
6
|
+
* Assert `network` is the bip122 network this module actually supports
|
|
7
|
+
* (Bitcoin mainnet), else throw. Other bip122 chains (Dogecoin, Litecoin,
|
|
8
|
+
* etc.) share the namespace but differ in chain id — accepting them here
|
|
9
|
+
* would let a Bitcoin-only wallet silently return a Bitcoin address stamped
|
|
10
|
+
* with the wrong network id, so they must be rejected explicitly rather than
|
|
11
|
+
* only checking the namespace. Shared by the namespace module and its
|
|
12
|
+
* transport adapters so the boundary check lives in one place.
|
|
8
13
|
*/
|
|
9
14
|
export declare function assertBitcoinNetwork(network: Network, method: string): void;
|
|
10
15
|
/**
|
|
@@ -38,7 +43,19 @@ export declare class BitcoinNamespace {
|
|
|
38
43
|
getAccounts(): Promise<BitcoinAccount[]>;
|
|
39
44
|
/** Sign a message with the given account. */
|
|
40
45
|
signMessage(params: BitcoinSignMessageParams): Promise<SignatureType>;
|
|
46
|
+
/**
|
|
47
|
+
* Sign a PSBT (Path B). Returns the wallet-signed PSBT (base64); finalizing +
|
|
48
|
+
* broadcasting is a separate step. Rejects if the active adapter's wallet
|
|
49
|
+
* does not support PSBT signing.
|
|
50
|
+
*/
|
|
51
|
+
signPsbt(request: BitcoinPsbtSignRequest): Promise<string>;
|
|
52
|
+
/**
|
|
53
|
+
* High-level transfer (Path A): the wallet signs and broadcasts, returning a
|
|
54
|
+
* txid. Rejects if the active adapter's transport does not offer it.
|
|
55
|
+
*/
|
|
56
|
+
sendTransfer(request: BitcoinSendTransferRequest): Promise<TransactionResult>;
|
|
41
57
|
/** Release any session resources the adapter holds. */
|
|
42
58
|
disconnect(): Promise<void>;
|
|
59
|
+
private unsupported;
|
|
43
60
|
}
|
|
44
61
|
//# sourceMappingURL=bitcoin-namespace.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitcoin-namespace.d.ts","sourceRoot":"","sources":["../src/bitcoin-namespace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,wBAAwB,EACxB,SAAS,EACT,OAAO,EACP,aAAa,
|
|
1
|
+
{"version":3,"file":"bitcoin-namespace.d.ts","sourceRoot":"","sources":["../src/bitcoin-namespace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,SAAS,EACT,OAAO,EACP,aAAa,EACb,iBAAiB,EAClB,MAAM,wBAAwB,CAAA;AAG/B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAA;AAExD,2CAA2C;AAC3C,eAAO,MAAM,iBAAiB,EAAE,SAAoB,CAAA;AAEpD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAa3E;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,gBAAgB;IAIf,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,2CAA2C;IAC3C,QAAQ,CAAC,SAAS,YAAoB;gBAET,OAAO,EAAE,uBAAuB;IAE7D,mDAAmD;IACnD,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAI9C,8DAA8D;IAC9D,WAAW,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAIxC,6CAA6C;IAC7C,WAAW,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,aAAa,CAAC;IAIrE;;;;OAIG;IACG,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC;IAKhE;;;OAGG;IACG,YAAY,CAChB,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,iBAAiB,CAAC;IAK7B,uDAAuD;IACjD,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC,OAAO,CAAC,WAAW;CAMpB"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { bitcoinNetwork } from '@meshconnect/uwc-constants';
|
|
1
2
|
import { WalletConnectorError } from '@meshconnect/uwc-types';
|
|
2
3
|
/** CAIP-2 namespace this module serves. */
|
|
3
4
|
export const BITCOIN_NAMESPACE = 'bip122';
|
|
4
5
|
/**
|
|
5
|
-
* Assert `network` is
|
|
6
|
-
*
|
|
6
|
+
* Assert `network` is the bip122 network this module actually supports
|
|
7
|
+
* (Bitcoin mainnet), else throw. Other bip122 chains (Dogecoin, Litecoin,
|
|
8
|
+
* etc.) share the namespace but differ in chain id — accepting them here
|
|
9
|
+
* would let a Bitcoin-only wallet silently return a Bitcoin address stamped
|
|
10
|
+
* with the wrong network id, so they must be rejected explicitly rather than
|
|
11
|
+
* only checking the namespace. Shared by the namespace module and its
|
|
12
|
+
* transport adapters so the boundary check lives in one place.
|
|
7
13
|
*/
|
|
8
14
|
export function assertBitcoinNetwork(network, method) {
|
|
9
15
|
if (network.namespace !== BITCOIN_NAMESPACE) {
|
|
@@ -12,6 +18,12 @@ export function assertBitcoinNetwork(network, method) {
|
|
|
12
18
|
message: `${method}: expected a bip122 network but got "${network.id}"`
|
|
13
19
|
});
|
|
14
20
|
}
|
|
21
|
+
if (network.id !== bitcoinNetwork.id) {
|
|
22
|
+
throw new WalletConnectorError({
|
|
23
|
+
type: 'unknown',
|
|
24
|
+
message: `${method}: unsupported bip122 chain "${network.id}" — only Bitcoin mainnet ("${bitcoinNetwork.id}") is supported`
|
|
25
|
+
});
|
|
26
|
+
}
|
|
15
27
|
}
|
|
16
28
|
/**
|
|
17
29
|
* Bitcoin (bip122) namespace module.
|
|
@@ -52,9 +64,34 @@ export class BitcoinNamespace {
|
|
|
52
64
|
signMessage(params) {
|
|
53
65
|
return this.adapter.signMessage(params);
|
|
54
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Sign a PSBT (Path B). Returns the wallet-signed PSBT (base64); finalizing +
|
|
69
|
+
* broadcasting is a separate step. Rejects if the active adapter's wallet
|
|
70
|
+
* does not support PSBT signing.
|
|
71
|
+
*/
|
|
72
|
+
async signPsbt(request) {
|
|
73
|
+
if (!this.adapter.signPsbt)
|
|
74
|
+
throw this.unsupported('signPsbt');
|
|
75
|
+
return this.adapter.signPsbt(request);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* High-level transfer (Path A): the wallet signs and broadcasts, returning a
|
|
79
|
+
* txid. Rejects if the active adapter's transport does not offer it.
|
|
80
|
+
*/
|
|
81
|
+
async sendTransfer(request) {
|
|
82
|
+
if (!this.adapter.sendTransfer)
|
|
83
|
+
throw this.unsupported('sendTransfer');
|
|
84
|
+
return this.adapter.sendTransfer(request);
|
|
85
|
+
}
|
|
55
86
|
/** Release any session resources the adapter holds. */
|
|
56
87
|
async disconnect() {
|
|
57
88
|
await this.adapter.disconnect?.();
|
|
58
89
|
}
|
|
90
|
+
unsupported(method) {
|
|
91
|
+
return new WalletConnectorError({
|
|
92
|
+
type: 'unknown',
|
|
93
|
+
message: `BitcoinNamespace.${method}: the active adapter does not support it`
|
|
94
|
+
});
|
|
95
|
+
}
|
|
59
96
|
}
|
|
60
97
|
//# sourceMappingURL=bitcoin-namespace.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitcoin-namespace.js","sourceRoot":"","sources":["../src/bitcoin-namespace.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bitcoin-namespace.js","sourceRoot":"","sources":["../src/bitcoin-namespace.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAG7D,2CAA2C;AAC3C,MAAM,CAAC,MAAM,iBAAiB,GAAc,QAAQ,CAAA;AAEpD;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAgB,EAAE,MAAc;IACnE,IAAI,OAAO,CAAC,SAAS,KAAK,iBAAiB,EAAE,CAAC;QAC5C,MAAM,IAAI,oBAAoB,CAAC;YAC7B,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,GA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I,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;IAC3C,CAAC;IAED,uDAAuD;IACvD,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAA;IACnC,CAAC;IAEO,WAAW,CAAC,MAAc;QAChC,OAAO,IAAI,oBAAoB,CAAC;YAC9B,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,oBAAoB,MAAM,0CAA0C;SAC9E,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal encoding helpers for the boundary between our transport-agnostic
|
|
3
|
+
* domain shapes (hex/base64 strings, JSON-safe) and the Wallet Standard
|
|
4
|
+
* `bitcoin:*` interface (raw `Uint8Array`). Uses only Web-standard APIs
|
|
5
|
+
* (`TextEncoder`, `atob`/`btoa`) so `uwc-bitcoin` stays dependency-free.
|
|
6
|
+
*/
|
|
7
|
+
export declare function utf8ToBytes(text: string): Uint8Array;
|
|
8
|
+
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
9
|
+
export declare function bytesToBase64(bytes: Uint8Array): string;
|
|
10
|
+
export declare function base64ToBytes(base64: string): Uint8Array;
|
|
11
|
+
export declare function hexToBytes(hex: string): Uint8Array;
|
|
12
|
+
//# sourceMappingURL=encoding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAEpD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIpD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIvD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAKxD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAgBlD"}
|
package/dist/encoding.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal encoding helpers for the boundary between our transport-agnostic
|
|
3
|
+
* domain shapes (hex/base64 strings, JSON-safe) and the Wallet Standard
|
|
4
|
+
* `bitcoin:*` interface (raw `Uint8Array`). Uses only Web-standard APIs
|
|
5
|
+
* (`TextEncoder`, `atob`/`btoa`) so `uwc-bitcoin` stays dependency-free.
|
|
6
|
+
*/
|
|
7
|
+
export function utf8ToBytes(text) {
|
|
8
|
+
return new TextEncoder().encode(text);
|
|
9
|
+
}
|
|
10
|
+
export function bytesToHex(bytes) {
|
|
11
|
+
let hex = '';
|
|
12
|
+
for (const byte of bytes)
|
|
13
|
+
hex += byte.toString(16).padStart(2, '0');
|
|
14
|
+
return hex;
|
|
15
|
+
}
|
|
16
|
+
export function bytesToBase64(bytes) {
|
|
17
|
+
let binary = '';
|
|
18
|
+
for (const byte of bytes)
|
|
19
|
+
binary += String.fromCharCode(byte);
|
|
20
|
+
return btoa(binary);
|
|
21
|
+
}
|
|
22
|
+
export function base64ToBytes(base64) {
|
|
23
|
+
const binary = atob(base64);
|
|
24
|
+
const bytes = new Uint8Array(binary.length);
|
|
25
|
+
for (let i = 0; i < binary.length; i++)
|
|
26
|
+
bytes[i] = binary.charCodeAt(i);
|
|
27
|
+
return bytes;
|
|
28
|
+
}
|
|
29
|
+
export function hexToBytes(hex) {
|
|
30
|
+
const clean = /^0x/i.test(hex) ? hex.slice(2) : hex;
|
|
31
|
+
if (clean.length % 2 !== 0) {
|
|
32
|
+
throw new Error('hexToBytes: odd-length hex string');
|
|
33
|
+
}
|
|
34
|
+
// Validate before parsing: `parseInt` on a non-hex pair yields NaN, which a
|
|
35
|
+
// Uint8Array silently coerces to 0 — so bad input would corrupt data (a PSBT
|
|
36
|
+
// or public key) instead of failing fast. Reject it.
|
|
37
|
+
if (!/^[0-9a-fA-F]*$/.test(clean)) {
|
|
38
|
+
throw new Error('hexToBytes: non-hex characters');
|
|
39
|
+
}
|
|
40
|
+
const bytes = new Uint8Array(clean.length / 2);
|
|
41
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
42
|
+
bytes[i] = parseInt(clean.slice(i * 2, i * 2 + 2), 16);
|
|
43
|
+
}
|
|
44
|
+
return bytes;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=encoding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../src/encoding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AACvC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAiB;IAC1C,IAAI,GAAG,GAAG,EAAE,CAAA;IACZ,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;IACnE,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAiB;IAC7C,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;IAC7D,OAAO,IAAI,CAAC,MAAM,CAAC,CAAA;AACrB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3B,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;IACvE,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IACnD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;IACtD,CAAC;IACD,4EAA4E;IAC5E,6EAA6E;IAC7E,qDAAqD;IACrD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;IACnD,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IAC9C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,KAAK,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACxD,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export { BitcoinNamespace, assertBitcoinNetwork, BITCOIN_NAMESPACE } from './bitcoin-namespace';
|
|
2
2
|
export type { BitcoinTransportAdapter } from './adapter';
|
|
3
|
+
export { WalletStandardBitcoinAdapter } from './adapters/wallet-standard';
|
|
4
|
+
export type { WalletStandardBitcoinWallet, WalletStandardBitcoinAccount } from './adapters/wallet-standard';
|
|
5
|
+
export { OkxBitcoinAdapter } from './adapters/okx';
|
|
6
|
+
export type { OkxBitcoinProvider } from './adapters/okx';
|
|
7
|
+
export { bytesToHex, hexToBytes } from './encoding';
|
|
3
8
|
//# sourceMappingURL=index.d.ts.map
|