@reown/appkit-adapter-bitcoin 1.6.6-8edd53b.0 → 1.6.6-basic-test.2.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/esm/src/utils/WalletConnectProvider.js +115 -0
- package/dist/esm/src/utils/WalletConnectProvider.js.map +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/utils/WalletConnectProvider.d.ts +90 -0
- package/package.json +6 -6
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import UniversalProvider from '@walletconnect/universal-provider';
|
|
2
|
+
import type { CaipNetwork } from '@reown/appkit-common';
|
|
3
|
+
import { type RequestArguments } from '@reown/appkit';
|
|
4
|
+
import type { BitcoinConnector } from './BitcoinConnector.js';
|
|
5
|
+
import { ProviderEventEmitter } from './ProviderEventEmitter.js';
|
|
6
|
+
export type WalletConnectProviderConfig = {
|
|
7
|
+
provider: UniversalProvider;
|
|
8
|
+
chains: CaipNetwork[];
|
|
9
|
+
getActiveChain: () => CaipNetwork | undefined;
|
|
10
|
+
};
|
|
11
|
+
export declare class WalletConnectProvider extends ProviderEventEmitter implements BitcoinConnector {
|
|
12
|
+
readonly id = "WalletConnect";
|
|
13
|
+
readonly name = "WalletConnect";
|
|
14
|
+
readonly type = "WALLET_CONNECT";
|
|
15
|
+
readonly chain = "bip122";
|
|
16
|
+
readonly icon = "https://imagedelivery.net/_aTEfDRm7z3tKgu9JhfeKA/05338e12-4f75-4982-4e8a-83c67b826b00/md";
|
|
17
|
+
provider: UniversalProvider;
|
|
18
|
+
private readonly requestedChains;
|
|
19
|
+
private readonly getActiveChain;
|
|
20
|
+
constructor({ provider, chains, getActiveChain }: WalletConnectProviderConfig);
|
|
21
|
+
get chains(): CaipNetwork[];
|
|
22
|
+
connect(): Promise<never>;
|
|
23
|
+
disconnect(): Promise<void>;
|
|
24
|
+
signMessage({ message, address }: BitcoinConnector.SignMessageParams): Promise<string>;
|
|
25
|
+
sendTransfer({ recipient, amount }: BitcoinConnector.SendTransferParams): Promise<string>;
|
|
26
|
+
getAccountAddresses(): Promise<BitcoinConnector.AccountAddress[]>;
|
|
27
|
+
signPSBT(params: BitcoinConnector.SignPSBTParams): Promise<BitcoinConnector.SignPSBTResponse>;
|
|
28
|
+
request<T>(args: RequestArguments): T;
|
|
29
|
+
private get sessionChains();
|
|
30
|
+
private getAccount;
|
|
31
|
+
private checkIfMethodIsSupported;
|
|
32
|
+
private internalRequest;
|
|
33
|
+
}
|
|
34
|
+
export declare namespace WalletConnectProvider {
|
|
35
|
+
type Request<Params, Result> = {
|
|
36
|
+
params: Params;
|
|
37
|
+
returns: Result;
|
|
38
|
+
};
|
|
39
|
+
type WCSignMessageParams = {
|
|
40
|
+
message: string;
|
|
41
|
+
account: string;
|
|
42
|
+
address: string;
|
|
43
|
+
};
|
|
44
|
+
type WCSignMessageResponse = {
|
|
45
|
+
signature: string;
|
|
46
|
+
address: string;
|
|
47
|
+
messageHash: string;
|
|
48
|
+
};
|
|
49
|
+
type WCSendTransferParams = {
|
|
50
|
+
account: string;
|
|
51
|
+
recipientAddress: string;
|
|
52
|
+
amount: string;
|
|
53
|
+
changeAddress?: string;
|
|
54
|
+
memo?: string;
|
|
55
|
+
};
|
|
56
|
+
type WCGetAccountAddressesResponse = {
|
|
57
|
+
address: string;
|
|
58
|
+
publicKey: Uint8Array;
|
|
59
|
+
path: string;
|
|
60
|
+
intention: 'payment' | 'ordinal';
|
|
61
|
+
}[];
|
|
62
|
+
type WCSendTransferResponse = {
|
|
63
|
+
txid: string;
|
|
64
|
+
};
|
|
65
|
+
type WCSignPSBTParams = {
|
|
66
|
+
account: string;
|
|
67
|
+
psbt: string;
|
|
68
|
+
signInputs: {
|
|
69
|
+
address: string;
|
|
70
|
+
index: number;
|
|
71
|
+
sighashTypes?: number[];
|
|
72
|
+
}[];
|
|
73
|
+
broadcast?: boolean;
|
|
74
|
+
};
|
|
75
|
+
type WCSignPSBTResponse = {
|
|
76
|
+
psbt: string;
|
|
77
|
+
txid?: string;
|
|
78
|
+
};
|
|
79
|
+
type RequestMethods = {
|
|
80
|
+
signMessage: Request<WCSignMessageParams, WCSignMessageResponse>;
|
|
81
|
+
sendTransfer: Request<WCSendTransferParams, WCSendTransferResponse>;
|
|
82
|
+
getAccountAddresses: Request<undefined, string[]>;
|
|
83
|
+
signPsbt: Request<WCSignPSBTParams, WCSignPSBTResponse>;
|
|
84
|
+
};
|
|
85
|
+
type RequestMethod = keyof RequestMethods;
|
|
86
|
+
type InternalRequestParams<Method extends RequestMethod> = {
|
|
87
|
+
method: Method;
|
|
88
|
+
params: RequestMethods[Method]['params'];
|
|
89
|
+
};
|
|
90
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reown/appkit-adapter-bitcoin",
|
|
3
|
-
"version": "1.6.6-
|
|
3
|
+
"version": "1.6.6-basic-test.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/esm/exports/index.js",
|
|
6
6
|
"types": "./dist/types/exports/index.d.ts",
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
"@exodus/bitcoin-wallet-standard": "0.0.0",
|
|
20
20
|
"@wallet-standard/app": "1.1.0",
|
|
21
21
|
"@wallet-standard/base": "1.1.0",
|
|
22
|
-
"@walletconnect/universal-provider": "2.
|
|
22
|
+
"@walletconnect/universal-provider": "2.17.5",
|
|
23
23
|
"bitcoinjs-lib": "6.1.7",
|
|
24
24
|
"sats-connect": "3.0.1",
|
|
25
|
-
"@reown/appkit": "1.6.6-
|
|
26
|
-
"@reown/appkit-
|
|
27
|
-
"@reown/appkit
|
|
25
|
+
"@reown/appkit-common": "1.6.6-basic-test.2.0",
|
|
26
|
+
"@reown/appkit-core": "1.6.6-basic-test.2.0",
|
|
27
|
+
"@reown/appkit": "1.6.6-basic-test.2.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@leather.io/rpc": "2.1.21",
|
|
31
31
|
"@vitest/coverage-v8": "2.1.3",
|
|
32
32
|
"@wallet-standard/features": "1.0.3",
|
|
33
|
-
"@walletconnect/types": "2.
|
|
33
|
+
"@walletconnect/types": "2.17.5",
|
|
34
34
|
"vitest": "2.1.3"
|
|
35
35
|
},
|
|
36
36
|
"author": "Reown <support@reown.com> (https://reown.com)",
|