@ckb-ccc/xverse 0.0.15-alpha.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/CHANGELOG.md +7 -0
- package/README.md +51 -0
- package/dist/advanced.d.ts +2 -0
- package/dist/advanced.d.ts.map +1 -0
- package/dist/advanced.js +1 -0
- package/dist/advancedBarrel.d.ts +2 -0
- package/dist/advancedBarrel.d.ts.map +1 -0
- package/dist/advancedBarrel.js +1 -0
- package/dist/barrel.d.ts +3 -0
- package/dist/barrel.d.ts.map +1 -0
- package/dist/barrel.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/package.json +3 -0
- package/dist/sat-connect-core/advanced.d.ts +5 -0
- package/dist/sat-connect-core/advanced.d.ts.map +1 -0
- package/dist/sat-connect-core/advanced.js +4 -0
- package/dist/sat-connect-core/btcMethods.advanced.d.ts +280 -0
- package/dist/sat-connect-core/btcMethods.advanced.d.ts.map +1 -0
- package/dist/sat-connect-core/btcMethods.advanced.js +179 -0
- package/dist/sat-connect-core/provider.advanced.d.ts +48 -0
- package/dist/sat-connect-core/provider.advanced.d.ts.map +1 -0
- package/dist/sat-connect-core/provider.advanced.js +21 -0
- package/dist/sat-connect-core/requests.advanced.d.ts +21 -0
- package/dist/sat-connect-core/requests.advanced.d.ts.map +1 -0
- package/dist/sat-connect-core/requests.advanced.js +1 -0
- package/dist/sat-connect-core/types.advanced.d.ts +124 -0
- package/dist/sat-connect-core/types.advanced.d.ts.map +1 -0
- package/dist/sat-connect-core/types.advanced.js +79 -0
- package/dist/sat-connect-core/walletMethods.advanced.d.ts +36 -0
- package/dist/sat-connect-core/walletMethods.advanced.d.ts.map +1 -0
- package/dist/sat-connect-core/walletMethods.advanced.js +37 -0
- package/dist/signer.d.ts +47 -0
- package/dist/signer.d.ts.map +1 -0
- package/dist/signer.js +123 -0
- package/dist/signersFactory.d.ts +13 -0
- package/dist/signersFactory.d.ts.map +1 -0
- package/dist/signersFactory.js +30 -0
- package/dist.commonjs/advanced.d.ts +2 -0
- package/dist.commonjs/advanced.d.ts.map +1 -0
- package/dist.commonjs/advanced.js +27 -0
- package/dist.commonjs/advancedBarrel.d.ts +2 -0
- package/dist.commonjs/advancedBarrel.d.ts.map +1 -0
- package/dist.commonjs/advancedBarrel.js +17 -0
- package/dist.commonjs/barrel.d.ts +3 -0
- package/dist.commonjs/barrel.d.ts.map +1 -0
- package/dist.commonjs/barrel.js +18 -0
- package/dist.commonjs/index.d.ts +2 -0
- package/dist.commonjs/index.d.ts.map +1 -0
- package/dist.commonjs/index.js +27 -0
- package/dist.commonjs/package.json +3 -0
- package/dist.commonjs/sat-connect-core/advanced.d.ts +5 -0
- package/dist.commonjs/sat-connect-core/advanced.d.ts.map +1 -0
- package/dist.commonjs/sat-connect-core/advanced.js +20 -0
- package/dist.commonjs/sat-connect-core/btcMethods.advanced.d.ts +280 -0
- package/dist.commonjs/sat-connect-core/btcMethods.advanced.d.ts.map +1 -0
- package/dist.commonjs/sat-connect-core/btcMethods.advanced.js +205 -0
- package/dist.commonjs/sat-connect-core/provider.advanced.d.ts +48 -0
- package/dist.commonjs/sat-connect-core/provider.advanced.d.ts.map +1 -0
- package/dist.commonjs/sat-connect-core/provider.advanced.js +47 -0
- package/dist.commonjs/sat-connect-core/requests.advanced.d.ts +21 -0
- package/dist.commonjs/sat-connect-core/requests.advanced.d.ts.map +1 -0
- package/dist.commonjs/sat-connect-core/requests.advanced.js +2 -0
- package/dist.commonjs/sat-connect-core/types.advanced.d.ts +124 -0
- package/dist.commonjs/sat-connect-core/types.advanced.d.ts.map +1 -0
- package/dist.commonjs/sat-connect-core/types.advanced.js +105 -0
- package/dist.commonjs/sat-connect-core/walletMethods.advanced.d.ts +36 -0
- package/dist.commonjs/sat-connect-core/walletMethods.advanced.d.ts.map +1 -0
- package/dist.commonjs/sat-connect-core/walletMethods.advanced.js +63 -0
- package/dist.commonjs/signer.d.ts +47 -0
- package/dist.commonjs/signer.d.ts.map +1 -0
- package/dist.commonjs/signer.js +150 -0
- package/dist.commonjs/signersFactory.d.ts +13 -0
- package/dist.commonjs/signersFactory.d.ts.map +1 -0
- package/dist.commonjs/signersFactory.js +34 -0
- package/package.json +57 -0
- package/src/advanced.ts +1 -0
- package/src/advancedBarrel.ts +1 -0
- package/src/barrel.ts +2 -0
- package/src/index.ts +1 -0
- package/src/sat-connect-core/advanced.ts +4 -0
- package/src/sat-connect-core/btcMethods.advanced.ts +304 -0
- package/src/sat-connect-core/provider.advanced.ts +61 -0
- package/src/sat-connect-core/requests.advanced.ts +41 -0
- package/src/sat-connect-core/types.advanced.ts +159 -0
- package/src/sat-connect-core/walletMethods.advanced.ts +58 -0
- package/src/signer.ts +170 -0
- package/src/signersFactory.ts +50 -0
- package/typedoc.json +6 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @ckb-ccc/xverse
|
|
2
|
+
|
|
3
|
+
## 0.0.15-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#60](https://github.com/ckb-ecofund/ccc/pull/60) [`e904963`](https://github.com/ckb-ecofund/ccc/commit/e904963a16f12c410d861eb3ae01b87d68cb3e34) Thanks [@Hanssen0](https://github.com/Hanssen0)! - feat: support Xverse
|
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://app.ckbccc.com/">
|
|
3
|
+
<img alt="Logo" src="https://raw.githubusercontent.com/ckb-ecofund/ccc/master/assets/logo.svg" width="20%" />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<h1 align="center" style="font-size: 48px;">
|
|
8
|
+
CCC's support for Xverse
|
|
9
|
+
</h1>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/@ckb-ccc/xverse"><img
|
|
13
|
+
alt="NPM Version" src="https://img.shields.io/npm/v/%40ckb-ccc%2Fxverse"
|
|
14
|
+
/></a>
|
|
15
|
+
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/ckb-ecofund/ccc" />
|
|
16
|
+
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/ckb-ecofund/ccc/master" />
|
|
17
|
+
<img alt="GitHub branch check runs" src="https://img.shields.io/github/check-runs/ckb-ecofund/ccc/master" />
|
|
18
|
+
<a href="https://live.ckbccc.com/"><img
|
|
19
|
+
alt="Playground" src="https://img.shields.io/website?url=https%3A%2F%2Flive.ckbccc.com%2F&label=Playground"
|
|
20
|
+
/></a>
|
|
21
|
+
<a href="https://app.ckbccc.com/"><img
|
|
22
|
+
alt="App" src="https://img.shields.io/website?url=https%3A%2F%2Fapp.ckbccc.com%2F&label=App"
|
|
23
|
+
/></a>
|
|
24
|
+
<a href="https://docs.ckbccc.com/"><img
|
|
25
|
+
alt="Docs" src="https://img.shields.io/website?url=https%3A%2F%2Fdocs.ckbccc.com%2F&label=Docs"
|
|
26
|
+
/></a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
<p align="center">
|
|
30
|
+
"CCC - CKBers' Codebase" is the next step of "Common Chains Connector".
|
|
31
|
+
<br />
|
|
32
|
+
Empower yourself with CCC to discover the unlimited potential of CKB.
|
|
33
|
+
<br />
|
|
34
|
+
Interoperate with wallets from different chain ecosystems.
|
|
35
|
+
<br />
|
|
36
|
+
Fully enabling CKB's Turing completeness and cryptographic freedom power.
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
## Preview
|
|
40
|
+
|
|
41
|
+
<p align="center">
|
|
42
|
+
<a href="https://app.ckbccc.com/">
|
|
43
|
+
<img src="https://raw.githubusercontent.com/ckb-ecofund/ccc/master/assets/preview.png" width="30%" />
|
|
44
|
+
</a>
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
This project is still under active development, and we are looking forward to your feedback. [Try its demo now here](https://app.ckbccc.com/). It showcases how to use CCC for some basic scenarios in CKB.
|
|
48
|
+
|
|
49
|
+
<h3 align="center">
|
|
50
|
+
Read more about CCC on <a href="https://docs.ckbccc.com">our website</a> or <a href="https://github.com/ckb-ecofund/ccc">GitHub Repo</a>.
|
|
51
|
+
</h3>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advanced.d.ts","sourceRoot":"","sources":["../src/advanced.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,qBAAqB,CAAC"}
|
package/dist/advanced.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as XverseA from "./advancedBarrel.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advancedBarrel.d.ts","sourceRoot":"","sources":["../src/advancedBarrel.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./sat-connect-core/advanced.js";
|
package/dist/barrel.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"barrel.d.ts","sourceRoot":"","sources":["../src/barrel.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC"}
|
package/dist/barrel.js
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as Xverse from "./barrel.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advanced.d.ts","sourceRoot":"","sources":["../../src/sat-connect-core/advanced.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the types and interfaces related to BTC methods.
|
|
3
|
+
*/
|
|
4
|
+
import * as v from "valibot";
|
|
5
|
+
import { MethodParamsAndResult } from "./types.advanced";
|
|
6
|
+
export declare enum AddressPurpose {
|
|
7
|
+
Ordinals = "ordinals",
|
|
8
|
+
Payment = "payment",
|
|
9
|
+
Stacks = "stacks"
|
|
10
|
+
}
|
|
11
|
+
export declare enum AddressType {
|
|
12
|
+
p2pkh = "p2pkh",
|
|
13
|
+
p2sh = "p2sh",
|
|
14
|
+
p2wpkh = "p2wpkh",
|
|
15
|
+
p2wsh = "p2wsh",
|
|
16
|
+
p2tr = "p2tr",
|
|
17
|
+
stacks = "stacks"
|
|
18
|
+
}
|
|
19
|
+
export declare const addressSchema: v.ObjectSchema<{
|
|
20
|
+
readonly address: v.StringSchema<undefined>;
|
|
21
|
+
readonly publicKey: v.StringSchema<undefined>;
|
|
22
|
+
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
|
|
23
|
+
readonly addressType: v.EnumSchema<typeof AddressType, undefined>;
|
|
24
|
+
}, undefined>;
|
|
25
|
+
export type Address = v.InferOutput<typeof addressSchema>;
|
|
26
|
+
export declare const getInfoMethodName = "getInfo";
|
|
27
|
+
export declare const getInfoParamsSchema: v.NullishSchema<v.NullSchema<undefined>, never>;
|
|
28
|
+
export type GetInfoParams = v.InferOutput<typeof getInfoParamsSchema>;
|
|
29
|
+
export declare const getInfoResultSchema: v.ObjectSchema<{
|
|
30
|
+
/**
|
|
31
|
+
* Version of the wallet.
|
|
32
|
+
*/
|
|
33
|
+
readonly version: v.StringSchema<undefined>;
|
|
34
|
+
/**
|
|
35
|
+
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
36
|
+
*/
|
|
37
|
+
readonly methods: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, never>;
|
|
38
|
+
/**
|
|
39
|
+
* List of WBIP standards supported by the wallet. Not currently used.
|
|
40
|
+
*/
|
|
41
|
+
readonly supports: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
42
|
+
}, undefined>;
|
|
43
|
+
export type GetInfoResult = v.InferOutput<typeof getInfoResultSchema>;
|
|
44
|
+
export declare const getInfoRequestMessageSchema: v.ObjectSchema<{
|
|
45
|
+
readonly method: v.LiteralSchema<"getInfo", undefined>;
|
|
46
|
+
readonly params: v.NullishSchema<v.NullSchema<undefined>, never>;
|
|
47
|
+
readonly id: v.StringSchema<undefined>;
|
|
48
|
+
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
49
|
+
}, undefined>;
|
|
50
|
+
export type GetInfoRequestMessage = v.InferOutput<typeof getInfoRequestMessageSchema>;
|
|
51
|
+
export type GetInfo = MethodParamsAndResult<v.InferOutput<typeof getInfoParamsSchema>, v.InferOutput<typeof getInfoResultSchema>>;
|
|
52
|
+
export declare const getAddressesMethodName = "getAddresses";
|
|
53
|
+
export declare const getAddressesParamsSchema: v.ObjectSchema<{
|
|
54
|
+
/**
|
|
55
|
+
* The purposes for which to generate addresses. See
|
|
56
|
+
* {@linkcode AddressPurpose} for available purposes.
|
|
57
|
+
*/
|
|
58
|
+
readonly purposes: v.ArraySchema<v.EnumSchema<typeof AddressPurpose, undefined>, undefined>;
|
|
59
|
+
/**
|
|
60
|
+
* A message to be displayed to the user in the request prompt.
|
|
61
|
+
*/
|
|
62
|
+
readonly message: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
63
|
+
}, undefined>;
|
|
64
|
+
export type GetAddressesParams = v.InferOutput<typeof getAddressesParamsSchema>;
|
|
65
|
+
export declare const getAddressesResultSchema: v.ObjectSchema<{
|
|
66
|
+
/**
|
|
67
|
+
* The addresses generated for the given purposes.
|
|
68
|
+
*/
|
|
69
|
+
readonly addresses: v.ArraySchema<v.ObjectSchema<{
|
|
70
|
+
readonly address: v.StringSchema<undefined>;
|
|
71
|
+
readonly publicKey: v.StringSchema<undefined>;
|
|
72
|
+
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
|
|
73
|
+
readonly addressType: v.EnumSchema<typeof AddressType, undefined>;
|
|
74
|
+
}, undefined>, undefined>;
|
|
75
|
+
}, undefined>;
|
|
76
|
+
export type GetAddressesResult = v.InferOutput<typeof getAddressesResultSchema>;
|
|
77
|
+
export declare const getAddressesRequestMessageSchema: v.ObjectSchema<{
|
|
78
|
+
readonly method: v.LiteralSchema<"getAddresses", undefined>;
|
|
79
|
+
readonly params: v.ObjectSchema<{
|
|
80
|
+
/**
|
|
81
|
+
* The purposes for which to generate addresses. See
|
|
82
|
+
* {@linkcode AddressPurpose} for available purposes.
|
|
83
|
+
*/
|
|
84
|
+
readonly purposes: v.ArraySchema<v.EnumSchema<typeof AddressPurpose, undefined>, undefined>;
|
|
85
|
+
/**
|
|
86
|
+
* A message to be displayed to the user in the request prompt.
|
|
87
|
+
*/
|
|
88
|
+
readonly message: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
89
|
+
}, undefined>;
|
|
90
|
+
readonly id: v.StringSchema<undefined>;
|
|
91
|
+
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
92
|
+
}, undefined>;
|
|
93
|
+
export type GetAddressesRequestMessage = v.InferOutput<typeof getAddressesRequestMessageSchema>;
|
|
94
|
+
export type GetAddresses = MethodParamsAndResult<v.InferOutput<typeof getAddressesParamsSchema>, v.InferOutput<typeof getAddressesResultSchema>>;
|
|
95
|
+
export declare const signMessageMethodName = "signMessage";
|
|
96
|
+
export declare enum MessageSigningProtocols {
|
|
97
|
+
ECDSA = "ECDSA",
|
|
98
|
+
BIP322 = "BIP322"
|
|
99
|
+
}
|
|
100
|
+
export declare const signMessageParamsSchema: v.ObjectSchema<{
|
|
101
|
+
/**
|
|
102
|
+
* The address used for signing.
|
|
103
|
+
**/
|
|
104
|
+
readonly address: v.StringSchema<undefined>;
|
|
105
|
+
/**
|
|
106
|
+
* The message to sign.
|
|
107
|
+
**/
|
|
108
|
+
readonly message: v.StringSchema<undefined>;
|
|
109
|
+
/**
|
|
110
|
+
* The protocol to use for signing the message.
|
|
111
|
+
*/
|
|
112
|
+
readonly protocol: v.OptionalSchema<v.EnumSchema<typeof MessageSigningProtocols, undefined>, never>;
|
|
113
|
+
}, undefined>;
|
|
114
|
+
export type SignMessageParams = v.InferOutput<typeof signMessageParamsSchema>;
|
|
115
|
+
export declare const signMessageResultSchema: v.ObjectSchema<{
|
|
116
|
+
/**
|
|
117
|
+
* The signature of the message.
|
|
118
|
+
*/
|
|
119
|
+
readonly signature: v.StringSchema<undefined>;
|
|
120
|
+
/**
|
|
121
|
+
* hash of the message.
|
|
122
|
+
*/
|
|
123
|
+
readonly messageHash: v.StringSchema<undefined>;
|
|
124
|
+
/**
|
|
125
|
+
* The address used for signing.
|
|
126
|
+
*/
|
|
127
|
+
readonly address: v.StringSchema<undefined>;
|
|
128
|
+
/**
|
|
129
|
+
* The protocol to use for signing the message.
|
|
130
|
+
*/
|
|
131
|
+
readonly protocol: v.EnumSchema<typeof MessageSigningProtocols, undefined>;
|
|
132
|
+
}, undefined>;
|
|
133
|
+
export type SignMessageResult = v.InferOutput<typeof signMessageResultSchema>;
|
|
134
|
+
export declare const signMessageRequestMessageSchema: v.ObjectSchema<{
|
|
135
|
+
readonly method: v.LiteralSchema<"signMessage", undefined>;
|
|
136
|
+
readonly params: v.ObjectSchema<{
|
|
137
|
+
/**
|
|
138
|
+
* The address used for signing.
|
|
139
|
+
**/
|
|
140
|
+
readonly address: v.StringSchema<undefined>;
|
|
141
|
+
/**
|
|
142
|
+
* The message to sign.
|
|
143
|
+
**/
|
|
144
|
+
readonly message: v.StringSchema<undefined>;
|
|
145
|
+
/**
|
|
146
|
+
* The protocol to use for signing the message.
|
|
147
|
+
*/
|
|
148
|
+
readonly protocol: v.OptionalSchema<v.EnumSchema<typeof MessageSigningProtocols, undefined>, never>;
|
|
149
|
+
}, undefined>;
|
|
150
|
+
readonly id: v.StringSchema<undefined>;
|
|
151
|
+
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
152
|
+
}, undefined>;
|
|
153
|
+
export type SignMessageRequestMessage = v.InferOutput<typeof signMessageRequestMessageSchema>;
|
|
154
|
+
export type SignMessage = MethodParamsAndResult<v.InferOutput<typeof signMessageParamsSchema>, v.InferOutput<typeof signMessageResultSchema>>;
|
|
155
|
+
type Recipient = {
|
|
156
|
+
/**
|
|
157
|
+
* The recipient's address.
|
|
158
|
+
**/
|
|
159
|
+
address: string;
|
|
160
|
+
/**
|
|
161
|
+
* The amount to send to the recipient in satoshis.
|
|
162
|
+
*/
|
|
163
|
+
amount: number;
|
|
164
|
+
};
|
|
165
|
+
export type SendTransferParams = {
|
|
166
|
+
/**
|
|
167
|
+
* Array of recipients to send to.
|
|
168
|
+
* The amount to send to each recipient is in satoshis.
|
|
169
|
+
*/
|
|
170
|
+
recipients: Array<Recipient>;
|
|
171
|
+
};
|
|
172
|
+
type SendTransferResult = {
|
|
173
|
+
/**
|
|
174
|
+
* The transaction id as a hex-encoded string.
|
|
175
|
+
*/
|
|
176
|
+
txid: string;
|
|
177
|
+
};
|
|
178
|
+
export type SendTransfer = MethodParamsAndResult<SendTransferParams, SendTransferResult>;
|
|
179
|
+
export type SignPsbtParams = {
|
|
180
|
+
/**
|
|
181
|
+
* The base64 encoded PSBT to sign.
|
|
182
|
+
*/
|
|
183
|
+
psbt: string;
|
|
184
|
+
/**
|
|
185
|
+
* The inputs to sign.
|
|
186
|
+
* The key is the address and the value is an array of indexes of the inputs to sign.
|
|
187
|
+
*/
|
|
188
|
+
signInputs: Record<string, number[]>;
|
|
189
|
+
/**
|
|
190
|
+
* the sigHash type to use for signing.
|
|
191
|
+
* will default to the sighash type of the input if not provided.
|
|
192
|
+
**/
|
|
193
|
+
allowedSignHash?: number;
|
|
194
|
+
/**
|
|
195
|
+
* Whether to broadcast the transaction after signing.
|
|
196
|
+
**/
|
|
197
|
+
broadcast?: boolean;
|
|
198
|
+
};
|
|
199
|
+
export type SignPsbtResult = {
|
|
200
|
+
/**
|
|
201
|
+
* The base64 encoded PSBT after signing.
|
|
202
|
+
*/
|
|
203
|
+
psbt: string;
|
|
204
|
+
/**
|
|
205
|
+
* The transaction id as a hex-encoded string.
|
|
206
|
+
* This is only returned if the transaction was broadcast.
|
|
207
|
+
**/
|
|
208
|
+
txid?: string;
|
|
209
|
+
};
|
|
210
|
+
export type SignPsbt = MethodParamsAndResult<SignPsbtParams, SignPsbtResult>;
|
|
211
|
+
export declare const getAccountsMethodName = "getAccounts";
|
|
212
|
+
export declare const getAccountsParamsSchema: v.ObjectSchema<{
|
|
213
|
+
/**
|
|
214
|
+
* The purposes for which to generate addresses. See
|
|
215
|
+
* {@linkcode AddressPurpose} for available purposes.
|
|
216
|
+
*/
|
|
217
|
+
readonly purposes: v.ArraySchema<v.EnumSchema<typeof AddressPurpose, undefined>, undefined>;
|
|
218
|
+
/**
|
|
219
|
+
* A message to be displayed to the user in the request prompt.
|
|
220
|
+
*/
|
|
221
|
+
readonly message: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
222
|
+
}, undefined>;
|
|
223
|
+
export type GetAccountsParams = v.InferOutput<typeof getAccountsParamsSchema>;
|
|
224
|
+
export declare const getAccountsResultSchema: v.ArraySchema<v.ObjectSchema<{
|
|
225
|
+
readonly walletType: v.PicklistSchema<readonly ["software", "ledger"], undefined>;
|
|
226
|
+
readonly address: v.StringSchema<undefined>;
|
|
227
|
+
readonly publicKey: v.StringSchema<undefined>;
|
|
228
|
+
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
|
|
229
|
+
readonly addressType: v.EnumSchema<typeof AddressType, undefined>;
|
|
230
|
+
}, undefined>, undefined>;
|
|
231
|
+
export type GetAccountsResult = v.InferOutput<typeof getAccountsResultSchema>;
|
|
232
|
+
export declare const getAccountsRequestMessageSchema: v.ObjectSchema<{
|
|
233
|
+
readonly method: v.LiteralSchema<"getAccounts", undefined>;
|
|
234
|
+
readonly params: v.ObjectSchema<{
|
|
235
|
+
/**
|
|
236
|
+
* The purposes for which to generate addresses. See
|
|
237
|
+
* {@linkcode AddressPurpose} for available purposes.
|
|
238
|
+
*/
|
|
239
|
+
readonly purposes: v.ArraySchema<v.EnumSchema<typeof AddressPurpose, undefined>, undefined>;
|
|
240
|
+
/**
|
|
241
|
+
* A message to be displayed to the user in the request prompt.
|
|
242
|
+
*/
|
|
243
|
+
readonly message: v.OptionalSchema<v.StringSchema<undefined>, never>;
|
|
244
|
+
}, undefined>;
|
|
245
|
+
readonly id: v.StringSchema<undefined>;
|
|
246
|
+
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
247
|
+
}, undefined>;
|
|
248
|
+
export type GetAccountsRequestMessage = v.InferOutput<typeof getAccountsRequestMessageSchema>;
|
|
249
|
+
export type GetAccounts = MethodParamsAndResult<v.InferOutput<typeof getAccountsParamsSchema>, v.InferOutput<typeof getAccountsResultSchema>>;
|
|
250
|
+
export declare const getBalanceMethodName = "getBalance";
|
|
251
|
+
export declare const getBalanceParamsSchema: v.NullishSchema<v.NullSchema<undefined>, never>;
|
|
252
|
+
export declare const getBalanceResultSchema: v.ObjectSchema<{
|
|
253
|
+
/**
|
|
254
|
+
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
255
|
+
* messages not supporting bigint
|
|
256
|
+
* (https://issues.chromium.org/issues/40116184).
|
|
257
|
+
*/
|
|
258
|
+
readonly confirmed: v.StringSchema<undefined>;
|
|
259
|
+
/**
|
|
260
|
+
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
261
|
+
* messages not supporting bigint
|
|
262
|
+
* (https://issues.chromium.org/issues/40116184).
|
|
263
|
+
*/
|
|
264
|
+
readonly unconfirmed: v.StringSchema<undefined>;
|
|
265
|
+
/**
|
|
266
|
+
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
267
|
+
* sats. Using a string due to chrome messages not supporting bigint
|
|
268
|
+
* (https://issues.chromium.org/issues/40116184).
|
|
269
|
+
*/
|
|
270
|
+
readonly total: v.StringSchema<undefined>;
|
|
271
|
+
}, undefined>;
|
|
272
|
+
export declare const getBalanceRequestMessageSchema: v.ObjectSchema<{
|
|
273
|
+
readonly method: v.LiteralSchema<"getBalance", undefined>;
|
|
274
|
+
readonly id: v.StringSchema<undefined>;
|
|
275
|
+
readonly jsonrpc: v.LiteralSchema<"2.0", undefined>;
|
|
276
|
+
readonly params: v.OptionalSchema<v.UnionSchema<[v.ArraySchema<v.UnknownSchema, undefined>, v.LooseObjectSchema<{}, undefined>, v.NullSchema<undefined>], undefined>, never>;
|
|
277
|
+
}, undefined>;
|
|
278
|
+
export type GetBalance = MethodParamsAndResult<v.InferOutput<typeof getBalanceParamsSchema>, v.InferOutput<typeof getBalanceResultSchema>>;
|
|
279
|
+
export {};
|
|
280
|
+
//# sourceMappingURL=btcMethods.advanced.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"btcMethods.advanced.d.ts","sourceRoot":"","sources":["../../src/sat-connect-core/btcMethods.advanced.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EACL,qBAAqB,EAEtB,MAAM,kBAAkB,CAAC;AAG1B,oBAAY,cAAc;IACxB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,aAAa;;;;;aAKxB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,mBAAmB,iDAAsB,CAAC;A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C5C,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,EAC5C,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAC7C,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// From https://github.com/secretkeylabs/sats-connect-core/
|
|
2
|
+
/**
|
|
3
|
+
* Represents the types and interfaces related to BTC methods.
|
|
4
|
+
*/
|
|
5
|
+
import * as v from "valibot";
|
|
6
|
+
import { rpcRequestMessageSchema, } from "./types.advanced";
|
|
7
|
+
import { walletTypeSchema } from "./walletMethods.advanced";
|
|
8
|
+
export var AddressPurpose;
|
|
9
|
+
(function (AddressPurpose) {
|
|
10
|
+
AddressPurpose["Ordinals"] = "ordinals";
|
|
11
|
+
AddressPurpose["Payment"] = "payment";
|
|
12
|
+
AddressPurpose["Stacks"] = "stacks";
|
|
13
|
+
})(AddressPurpose || (AddressPurpose = {}));
|
|
14
|
+
export var AddressType;
|
|
15
|
+
(function (AddressType) {
|
|
16
|
+
AddressType["p2pkh"] = "p2pkh";
|
|
17
|
+
AddressType["p2sh"] = "p2sh";
|
|
18
|
+
AddressType["p2wpkh"] = "p2wpkh";
|
|
19
|
+
AddressType["p2wsh"] = "p2wsh";
|
|
20
|
+
AddressType["p2tr"] = "p2tr";
|
|
21
|
+
AddressType["stacks"] = "stacks";
|
|
22
|
+
})(AddressType || (AddressType = {}));
|
|
23
|
+
export const addressSchema = v.object({
|
|
24
|
+
address: v.string(),
|
|
25
|
+
publicKey: v.string(),
|
|
26
|
+
purpose: v.enum(AddressPurpose),
|
|
27
|
+
addressType: v.enum(AddressType),
|
|
28
|
+
});
|
|
29
|
+
export const getInfoMethodName = "getInfo";
|
|
30
|
+
export const getInfoParamsSchema = v.nullish(v.null());
|
|
31
|
+
export const getInfoResultSchema = v.object({
|
|
32
|
+
/**
|
|
33
|
+
* Version of the wallet.
|
|
34
|
+
*/
|
|
35
|
+
version: v.string(),
|
|
36
|
+
/**
|
|
37
|
+
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
38
|
+
*/
|
|
39
|
+
methods: v.optional(v.array(v.string())),
|
|
40
|
+
/**
|
|
41
|
+
* List of WBIP standards supported by the wallet. Not currently used.
|
|
42
|
+
*/
|
|
43
|
+
supports: v.array(v.string()),
|
|
44
|
+
});
|
|
45
|
+
export const getInfoRequestMessageSchema = v.object({
|
|
46
|
+
...rpcRequestMessageSchema.entries,
|
|
47
|
+
...v.object({
|
|
48
|
+
method: v.literal(getInfoMethodName),
|
|
49
|
+
params: getInfoParamsSchema,
|
|
50
|
+
id: v.string(),
|
|
51
|
+
}).entries,
|
|
52
|
+
});
|
|
53
|
+
export const getAddressesMethodName = "getAddresses";
|
|
54
|
+
export const getAddressesParamsSchema = v.object({
|
|
55
|
+
/**
|
|
56
|
+
* The purposes for which to generate addresses. See
|
|
57
|
+
* {@linkcode AddressPurpose} for available purposes.
|
|
58
|
+
*/
|
|
59
|
+
purposes: v.array(v.enum(AddressPurpose)),
|
|
60
|
+
/**
|
|
61
|
+
* A message to be displayed to the user in the request prompt.
|
|
62
|
+
*/
|
|
63
|
+
message: v.optional(v.string()),
|
|
64
|
+
});
|
|
65
|
+
export const getAddressesResultSchema = v.object({
|
|
66
|
+
/**
|
|
67
|
+
* The addresses generated for the given purposes.
|
|
68
|
+
*/
|
|
69
|
+
addresses: v.array(addressSchema),
|
|
70
|
+
});
|
|
71
|
+
export const getAddressesRequestMessageSchema = v.object({
|
|
72
|
+
...rpcRequestMessageSchema.entries,
|
|
73
|
+
...v.object({
|
|
74
|
+
method: v.literal(getAddressesMethodName),
|
|
75
|
+
params: getAddressesParamsSchema,
|
|
76
|
+
id: v.string(),
|
|
77
|
+
}).entries,
|
|
78
|
+
});
|
|
79
|
+
export const signMessageMethodName = "signMessage";
|
|
80
|
+
export var MessageSigningProtocols;
|
|
81
|
+
(function (MessageSigningProtocols) {
|
|
82
|
+
MessageSigningProtocols["ECDSA"] = "ECDSA";
|
|
83
|
+
MessageSigningProtocols["BIP322"] = "BIP322";
|
|
84
|
+
})(MessageSigningProtocols || (MessageSigningProtocols = {}));
|
|
85
|
+
export const signMessageParamsSchema = v.object({
|
|
86
|
+
/**
|
|
87
|
+
* The address used for signing.
|
|
88
|
+
**/
|
|
89
|
+
address: v.string(),
|
|
90
|
+
/**
|
|
91
|
+
* The message to sign.
|
|
92
|
+
**/
|
|
93
|
+
message: v.string(),
|
|
94
|
+
/**
|
|
95
|
+
* The protocol to use for signing the message.
|
|
96
|
+
*/
|
|
97
|
+
protocol: v.optional(v.enum(MessageSigningProtocols)),
|
|
98
|
+
});
|
|
99
|
+
export const signMessageResultSchema = v.object({
|
|
100
|
+
/**
|
|
101
|
+
* The signature of the message.
|
|
102
|
+
*/
|
|
103
|
+
signature: v.string(),
|
|
104
|
+
/**
|
|
105
|
+
* hash of the message.
|
|
106
|
+
*/
|
|
107
|
+
messageHash: v.string(),
|
|
108
|
+
/**
|
|
109
|
+
* The address used for signing.
|
|
110
|
+
*/
|
|
111
|
+
address: v.string(),
|
|
112
|
+
/**
|
|
113
|
+
* The protocol to use for signing the message.
|
|
114
|
+
*/
|
|
115
|
+
protocol: v.enum(MessageSigningProtocols),
|
|
116
|
+
});
|
|
117
|
+
export const signMessageRequestMessageSchema = v.object({
|
|
118
|
+
...rpcRequestMessageSchema.entries,
|
|
119
|
+
...v.object({
|
|
120
|
+
method: v.literal(signMessageMethodName),
|
|
121
|
+
params: signMessageParamsSchema,
|
|
122
|
+
id: v.string(),
|
|
123
|
+
}).entries,
|
|
124
|
+
});
|
|
125
|
+
export const getAccountsMethodName = "getAccounts";
|
|
126
|
+
export const getAccountsParamsSchema = v.object({
|
|
127
|
+
/**
|
|
128
|
+
* The purposes for which to generate addresses. See
|
|
129
|
+
* {@linkcode AddressPurpose} for available purposes.
|
|
130
|
+
*/
|
|
131
|
+
purposes: v.array(v.enum(AddressPurpose)),
|
|
132
|
+
/**
|
|
133
|
+
* A message to be displayed to the user in the request prompt.
|
|
134
|
+
*/
|
|
135
|
+
message: v.optional(v.string()),
|
|
136
|
+
});
|
|
137
|
+
export const getAccountsResultSchema = v.array(v.object({
|
|
138
|
+
...addressSchema.entries,
|
|
139
|
+
...v.object({
|
|
140
|
+
walletType: walletTypeSchema,
|
|
141
|
+
}).entries,
|
|
142
|
+
}));
|
|
143
|
+
export const getAccountsRequestMessageSchema = v.object({
|
|
144
|
+
...rpcRequestMessageSchema.entries,
|
|
145
|
+
...v.object({
|
|
146
|
+
method: v.literal(getAccountsMethodName),
|
|
147
|
+
params: getAccountsParamsSchema,
|
|
148
|
+
id: v.string(),
|
|
149
|
+
}).entries,
|
|
150
|
+
});
|
|
151
|
+
export const getBalanceMethodName = "getBalance";
|
|
152
|
+
export const getBalanceParamsSchema = v.nullish(v.null());
|
|
153
|
+
export const getBalanceResultSchema = v.object({
|
|
154
|
+
/**
|
|
155
|
+
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
156
|
+
* messages not supporting bigint
|
|
157
|
+
* (https://issues.chromium.org/issues/40116184).
|
|
158
|
+
*/
|
|
159
|
+
confirmed: v.string(),
|
|
160
|
+
/**
|
|
161
|
+
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
162
|
+
* messages not supporting bigint
|
|
163
|
+
* (https://issues.chromium.org/issues/40116184).
|
|
164
|
+
*/
|
|
165
|
+
unconfirmed: v.string(),
|
|
166
|
+
/**
|
|
167
|
+
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
168
|
+
* sats. Using a string due to chrome messages not supporting bigint
|
|
169
|
+
* (https://issues.chromium.org/issues/40116184).
|
|
170
|
+
*/
|
|
171
|
+
total: v.string(),
|
|
172
|
+
});
|
|
173
|
+
export const getBalanceRequestMessageSchema = v.object({
|
|
174
|
+
...rpcRequestMessageSchema.entries,
|
|
175
|
+
...v.object({
|
|
176
|
+
method: v.literal(getBalanceMethodName),
|
|
177
|
+
id: v.string(),
|
|
178
|
+
}).entries,
|
|
179
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { Requests, Params } from "./requests.advanced";
|
|
3
|
+
import { RpcResponse } from "./types.advanced";
|
|
4
|
+
export declare const accountChangeEventName = "accountChange";
|
|
5
|
+
export declare const accountChangeSchema: v.ObjectSchema<{
|
|
6
|
+
readonly type: v.LiteralSchema<"accountChange", undefined>;
|
|
7
|
+
}, undefined>;
|
|
8
|
+
export type AccountChangeEvent = v.InferOutput<typeof accountChangeSchema>;
|
|
9
|
+
export declare const networkChangeEventName = "networkChange";
|
|
10
|
+
export declare const networkChangeSchema: v.ObjectSchema<{
|
|
11
|
+
readonly type: v.LiteralSchema<"networkChange", undefined>;
|
|
12
|
+
}, undefined>;
|
|
13
|
+
export type NetworkChangeEvent = v.InferOutput<typeof networkChangeSchema>;
|
|
14
|
+
export declare const disconnectEventName = "disconnect";
|
|
15
|
+
export declare const disconnectSchema: v.ObjectSchema<{
|
|
16
|
+
readonly type: v.LiteralSchema<"disconnect", undefined>;
|
|
17
|
+
}, undefined>;
|
|
18
|
+
export type DisconnectEvent = v.InferOutput<typeof disconnectSchema>;
|
|
19
|
+
export declare const walletEventSchema: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
20
|
+
readonly type: v.LiteralSchema<"accountChange", undefined>;
|
|
21
|
+
}, undefined>, v.ObjectSchema<{
|
|
22
|
+
readonly type: v.LiteralSchema<"networkChange", undefined>;
|
|
23
|
+
}, undefined>, v.ObjectSchema<{
|
|
24
|
+
readonly type: v.LiteralSchema<"disconnect", undefined>;
|
|
25
|
+
}, undefined>], undefined>;
|
|
26
|
+
export type WalletEvent = v.InferOutput<typeof walletEventSchema>;
|
|
27
|
+
export type AddListener = <const WalletEventName extends WalletEvent["type"]>(eventName: WalletEventName, cb: (event: Extract<WalletEvent, {
|
|
28
|
+
type: WalletEventName;
|
|
29
|
+
}>) => void) => () => void;
|
|
30
|
+
/**
|
|
31
|
+
* Interface representing a provider for interacting with accounts and signing messages.
|
|
32
|
+
*/
|
|
33
|
+
export interface BtcProvider {
|
|
34
|
+
request: <Method extends keyof Requests>(method: Method, options: Params<Method>, providerId?: string) => Promise<RpcResponse<Method>>;
|
|
35
|
+
addListener: AddListener;
|
|
36
|
+
}
|
|
37
|
+
export interface Provider {
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
icon: string;
|
|
41
|
+
webUrl?: string;
|
|
42
|
+
chromeWebStoreUrl?: string;
|
|
43
|
+
mozillaAddOnsUrl?: string;
|
|
44
|
+
googlePlayStoreUrl?: string;
|
|
45
|
+
iOSAppStoreUrl?: string;
|
|
46
|
+
methods?: string[];
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=provider.advanced.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.advanced.d.ts","sourceRoot":"","sources":["../../src/sat-connect-core/provider.advanced.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,eAAO,MAAM,sBAAsB,kBAAkB,CAAC;AACtD,eAAO,MAAM,mBAAmB;;aAE9B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAG3E,eAAO,MAAM,sBAAsB,kBAAkB,CAAC;AACtD,eAAO,MAAM,mBAAmB;;aAE9B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAG3E,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAChD,eAAO,MAAM,gBAAgB;;aAE3B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAErE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