@ckb-ccc/joy-id 0.0.0-canary-20250214032000
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 +315 -0
- package/README.md +41 -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 +3 -0
- package/dist/advancedBarrel.d.ts.map +1 -0
- package/dist/advancedBarrel.js +2 -0
- package/dist/barrel.d.ts +6 -0
- package/dist/barrel.d.ts.map +1 -0
- package/dist/barrel.js +5 -0
- package/dist/btc/index.d.ts +65 -0
- package/dist/btc/index.d.ts.map +1 -0
- package/dist/btc/index.js +153 -0
- package/dist/ckb/index.d.ts +117 -0
- package/dist/ckb/index.d.ts.map +1 -0
- package/dist/ckb/index.js +270 -0
- package/dist/common/index.d.ts +36 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/index.js +61 -0
- package/dist/connectionsStorage/index.d.ts +86 -0
- package/dist/connectionsStorage/index.d.ts.map +1 -0
- package/dist/connectionsStorage/index.js +58 -0
- package/dist/evm/index.d.ts +66 -0
- package/dist/evm/index.d.ts.map +1 -0
- package/dist/evm/index.js +129 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/nostr/index.d.ts +57 -0
- package/dist/nostr/index.d.ts.map +1 -0
- package/dist/nostr/index.js +116 -0
- package/dist/package.json +3 -0
- package/dist/signerFactory/index.d.ts +14 -0
- package/dist/signerFactory/index.d.ts.map +1 -0
- package/dist/signerFactory/index.js +51 -0
- package/dist.commonjs/advanced.d.ts +2 -0
- package/dist.commonjs/advanced.d.ts.map +1 -0
- package/dist.commonjs/advanced.js +37 -0
- package/dist.commonjs/advancedBarrel.d.ts +3 -0
- package/dist.commonjs/advancedBarrel.d.ts.map +1 -0
- package/dist.commonjs/advancedBarrel.js +18 -0
- package/dist.commonjs/barrel.d.ts +6 -0
- package/dist.commonjs/barrel.d.ts.map +1 -0
- package/dist.commonjs/barrel.js +21 -0
- package/dist.commonjs/btc/index.d.ts +65 -0
- package/dist.commonjs/btc/index.d.ts.map +1 -0
- package/dist.commonjs/btc/index.js +157 -0
- package/dist.commonjs/ckb/index.d.ts +117 -0
- package/dist.commonjs/ckb/index.d.ts.map +1 -0
- package/dist.commonjs/ckb/index.js +274 -0
- package/dist.commonjs/common/index.d.ts +36 -0
- package/dist.commonjs/common/index.d.ts.map +1 -0
- package/dist.commonjs/common/index.js +64 -0
- package/dist.commonjs/connectionsStorage/index.d.ts +86 -0
- package/dist.commonjs/connectionsStorage/index.d.ts.map +1 -0
- package/dist.commonjs/connectionsStorage/index.js +63 -0
- package/dist.commonjs/evm/index.d.ts +66 -0
- package/dist.commonjs/evm/index.d.ts.map +1 -0
- package/dist.commonjs/evm/index.js +133 -0
- package/dist.commonjs/index.d.ts +2 -0
- package/dist.commonjs/index.d.ts.map +1 -0
- package/dist.commonjs/index.js +37 -0
- package/dist.commonjs/nostr/index.d.ts +57 -0
- package/dist.commonjs/nostr/index.d.ts.map +1 -0
- package/dist.commonjs/nostr/index.js +120 -0
- package/dist.commonjs/package.json +3 -0
- package/dist.commonjs/signerFactory/index.d.ts +14 -0
- package/dist.commonjs/signerFactory/index.d.ts.map +1 -0
- package/dist.commonjs/signerFactory/index.js +54 -0
- package/package.json +48 -0
- package/src/advanced.ts +1 -0
- package/src/advancedBarrel.ts +2 -0
- package/src/barrel.ts +5 -0
- package/src/btc/index.ts +201 -0
- package/src/ckb/index.ts +359 -0
- package/src/common/index.ts +114 -0
- package/src/connectionsStorage/index.ts +132 -0
- package/src/evm/index.ts +165 -0
- package/src/index.ts +1 -0
- package/src/nostr/index.ts +147 -0
- package/src/signerFactory/index.ts +70 -0
- package/typedoc.json +6 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
# @ckb-ccc/joy-id
|
|
2
|
+
|
|
3
|
+
## 0.0.0-canary-20250214032000
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`80e605d`](https://github.com/ckb-devrel/ccc/commit/80e605d0645e87b4e8b5be85c63322f7a3926e38), [`def62a0`](https://github.com/ckb-devrel/ccc/commit/def62a08bf908c6a21fe91c8db2c60848a2ada52), [`d584059`](https://github.com/ckb-devrel/ccc/commit/d584059644e8bcd3a0ea8b0314fdcbb68ee66013), [`1e88ad8`](https://github.com/ckb-devrel/ccc/commit/1e88ad8743428b46b28fe790bd559b96df8a6ce4), [`6f10589`](https://github.com/ckb-devrel/ccc/commit/6f1058977e7aa113808fa74793f1ad5d672626d2), [`d7728d9`](https://github.com/ckb-devrel/ccc/commit/d7728d9edb46c9c5a2bfeb342fc68a8b1c0fec5d)]:
|
|
8
|
+
- @ckb-ccc/core@0.0.0-canary-20250214032000
|
|
9
|
+
|
|
10
|
+
## 1.0.11
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`28c211d`](https://github.com/ckb-devrel/ccc/commit/28c211d839a2d2305eca56e82ba7da144aa3df4a)]:
|
|
15
|
+
- @ckb-ccc/core@1.5.0
|
|
16
|
+
|
|
17
|
+
## 1.0.10
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [[`3fdb2c4`](https://github.com/ckb-devrel/ccc/commit/3fdb2c477d0b2766b231e436b8f396f047b02634), [`f429087`](https://github.com/ckb-devrel/ccc/commit/f4290874dfab3fe58844e5169673c5d47bda64e3)]:
|
|
22
|
+
- @ckb-ccc/core@1.4.0
|
|
23
|
+
|
|
24
|
+
## 1.0.9
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [[`a48cccf`](https://github.com/ckb-devrel/ccc/commit/a48cccfae3ce6b3456a5eb863f207e7e5a6e568f)]:
|
|
29
|
+
- @ckb-ccc/core@1.3.1
|
|
30
|
+
|
|
31
|
+
## 1.0.8
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies [[`4dbf4fd`](https://github.com/ckb-devrel/ccc/commit/4dbf4fd8021cf14d05282706a7667ea7d108fb09), [`4c76f9e`](https://github.com/ckb-devrel/ccc/commit/4c76f9e2a93a226fcfc4c32a5378bb531bfff08f), [`c2c4c26`](https://github.com/ckb-devrel/ccc/commit/c2c4c264e04461948e4b913b2f22054e6032ddc8), [`b6a73fa`](https://github.com/ckb-devrel/ccc/commit/b6a73fa9628ebdff51cb8f246309654cd53e36f2), [`8c97c85`](https://github.com/ckb-devrel/ccc/commit/8c97c851db4a2d940c7e59116ca7620cfd0afae1)]:
|
|
36
|
+
- @ckb-ccc/core@1.3.0
|
|
37
|
+
|
|
38
|
+
## 1.0.7
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [[`01263bd`](https://github.com/ckb-devrel/ccc/commit/01263bd8c601fa8fcdfa24be52601716e1864843)]:
|
|
43
|
+
- @ckb-ccc/core@1.2.3
|
|
44
|
+
|
|
45
|
+
## 1.0.6
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [[`7886e3d`](https://github.com/ckb-devrel/ccc/commit/7886e3d89e9ca8f3514a2044c6dd4e8ec6b49933)]:
|
|
50
|
+
- @ckb-ccc/core@1.2.2
|
|
51
|
+
|
|
52
|
+
## 1.0.5
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- Updated dependencies [[`94e2618`](https://github.com/ckb-devrel/ccc/commit/94e26182515e09d6086ec5b653d091f117a499e6)]:
|
|
57
|
+
- @ckb-ccc/core@1.2.1
|
|
58
|
+
|
|
59
|
+
## 1.0.4
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- Updated dependencies [[`128e87b`](https://github.com/ckb-devrel/ccc/commit/128e87b5ca3e97bfe7842e76f786aa6aec010797)]:
|
|
64
|
+
- @ckb-ccc/core@1.2.0
|
|
65
|
+
|
|
66
|
+
## 1.0.3
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- Updated dependencies [[`925991c`](https://github.com/ckb-devrel/ccc/commit/925991c8a24b1f34667e30b28b69812e936e3928)]:
|
|
71
|
+
- @ckb-ccc/core@1.1.1
|
|
72
|
+
|
|
73
|
+
## 1.0.2
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- Updated dependencies [[`ddc0a28`](https://github.com/ckb-devrel/ccc/commit/ddc0a281c3d1dfa6ebc990dae92994f026dfddcc)]:
|
|
78
|
+
- @ckb-ccc/core@1.1.0
|
|
79
|
+
|
|
80
|
+
## 1.0.1
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- Updated dependencies [[`719055b`](https://github.com/ckb-devrel/ccc/commit/719055b404f31b40362f51714b9f11c85b857581), [`94caaca`](https://github.com/ckb-devrel/ccc/commit/94caaca11c63752a25282d42f51161c94397dec6)]:
|
|
85
|
+
- @ckb-ccc/core@1.0.1
|
|
86
|
+
|
|
87
|
+
## 1.0.0
|
|
88
|
+
|
|
89
|
+
### Major Changes
|
|
90
|
+
|
|
91
|
+
- [#107](https://github.com/ckb-devrel/ccc/pull/107) [`b99f55f`](https://github.com/ckb-devrel/ccc/commit/b99f55f74e64106391ce53f7d0bd0fa7522023cc) Thanks [@Hanssen0](https://github.com/Hanssen0)! - feat: molecule
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- Updated dependencies [[`b99f55f`](https://github.com/ckb-devrel/ccc/commit/b99f55f74e64106391ce53f7d0bd0fa7522023cc)]:
|
|
96
|
+
- @ckb-ccc/core@1.0.0
|
|
97
|
+
|
|
98
|
+
## 0.0.18
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- Updated dependencies [[`c1cb910`](https://github.com/ckb-devrel/ccc/commit/c1cb91091780c7b33fbbd683ef8edc9f11452ecd)]:
|
|
103
|
+
- @ckb-ccc/core@0.1.2
|
|
104
|
+
|
|
105
|
+
## 0.0.17
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- [#101](https://github.com/ckb-devrel/ccc/pull/101) [`d9affcc`](https://github.com/ckb-devrel/ccc/commit/d9affcc01c7b839b227e4d79bcb66e717577502a) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix: commonjs
|
|
110
|
+
|
|
111
|
+
- Updated dependencies [[`d9affcc`](https://github.com/ckb-devrel/ccc/commit/d9affcc01c7b839b227e4d79bcb66e717577502a)]:
|
|
112
|
+
- @ckb-ccc/core@0.1.1
|
|
113
|
+
|
|
114
|
+
## 0.0.16
|
|
115
|
+
|
|
116
|
+
### Patch Changes
|
|
117
|
+
|
|
118
|
+
- [#70](https://github.com/ckb-devrel/ccc/pull/70) [`acfc050`](https://github.com/ckb-devrel/ccc/commit/acfc0502cd6beb48b9310dec8411dcd630507366) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix(core): websocket transport
|
|
119
|
+
|
|
120
|
+
- Updated dependencies [[`a3d5359`](https://github.com/ckb-devrel/ccc/commit/a3d53595f6dd11f2f59cdf0086b3d7ce558a2fdd), [`8824ff2`](https://github.com/ckb-devrel/ccc/commit/8824ff27af3b76186f1a7d6db8c907cd66f09d6a), [`f07a506`](https://github.com/ckb-devrel/ccc/commit/f07a506bd6fc27fe659a17d2f7baaeec54716d81), [`f21d7e4`](https://github.com/ckb-devrel/ccc/commit/f21d7e4cf422edab4a836ef6d678b620594fef8d), [`acfc050`](https://github.com/ckb-devrel/ccc/commit/acfc0502cd6beb48b9310dec8411dcd630507366), [`1720d5a`](https://github.com/ckb-devrel/ccc/commit/1720d5a398543f1c6e24763eeaf15d84cd2214bf), [`e63a06e`](https://github.com/ckb-devrel/ccc/commit/e63a06ee75ac8595208d216dec88a4228c465e23), [`c092988`](https://github.com/ckb-devrel/ccc/commit/c092988e7765b9ac79498d6bd72a6a2f62859b6f), [`50f2ce0`](https://github.com/ckb-devrel/ccc/commit/50f2ce08e74cb3fbeae926267d42e28b426fd7f4), [`4709384`](https://github.com/ckb-devrel/ccc/commit/4709384e37188991cb937b16f99f47ca82c912b8)]:
|
|
121
|
+
- @ckb-ccc/core@0.1.0
|
|
122
|
+
|
|
123
|
+
## 0.0.16-alpha.7
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- Updated dependencies [[`f07a506`](https://github.com/ckb-devrel/ccc/commit/f07a506bd6fc27fe659a17d2f7baaeec54716d81)]:
|
|
128
|
+
- @ckb-ccc/core@0.1.0-alpha.7
|
|
129
|
+
|
|
130
|
+
## 0.0.16-alpha.6
|
|
131
|
+
|
|
132
|
+
### Patch Changes
|
|
133
|
+
|
|
134
|
+
- Updated dependencies [[`4709384`](https://github.com/ckb-devrel/ccc/commit/4709384e37188991cb937b16f99f47ca82c912b8)]:
|
|
135
|
+
- @ckb-ccc/core@0.1.0-alpha.6
|
|
136
|
+
|
|
137
|
+
## 0.0.16-alpha.5
|
|
138
|
+
|
|
139
|
+
### Patch Changes
|
|
140
|
+
|
|
141
|
+
- Updated dependencies [[`50f2ce0`](https://github.com/ckb-devrel/ccc/commit/50f2ce08e74cb3fbeae926267d42e28b426fd7f4)]:
|
|
142
|
+
- @ckb-ccc/core@0.1.0-alpha.5
|
|
143
|
+
|
|
144
|
+
## 0.0.16-alpha.4
|
|
145
|
+
|
|
146
|
+
### Patch Changes
|
|
147
|
+
|
|
148
|
+
- Updated dependencies [[`f21d7e4`](https://github.com/ckb-devrel/ccc/commit/f21d7e4cf422edab4a836ef6d678b620594fef8d)]:
|
|
149
|
+
- @ckb-ccc/core@0.1.0-alpha.4
|
|
150
|
+
|
|
151
|
+
## 0.0.16-alpha.3
|
|
152
|
+
|
|
153
|
+
### Patch Changes
|
|
154
|
+
|
|
155
|
+
- Updated dependencies [[`a3d5359`](https://github.com/ckb-devrel/ccc/commit/a3d53595f6dd11f2f59cdf0086b3d7ce558a2fdd)]:
|
|
156
|
+
- @ckb-ccc/core@0.0.16-alpha.3
|
|
157
|
+
|
|
158
|
+
## 0.0.16-alpha.2
|
|
159
|
+
|
|
160
|
+
### Patch Changes
|
|
161
|
+
|
|
162
|
+
- [#70](https://github.com/ckb-devrel/ccc/pull/70) [`acfc050`](https://github.com/ckb-devrel/ccc/commit/acfc0502cd6beb48b9310dec8411dcd630507366) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix(core): websocket transport
|
|
163
|
+
|
|
164
|
+
- Updated dependencies [[`acfc050`](https://github.com/ckb-devrel/ccc/commit/acfc0502cd6beb48b9310dec8411dcd630507366)]:
|
|
165
|
+
- @ckb-ccc/core@0.0.16-alpha.2
|
|
166
|
+
|
|
167
|
+
## 0.0.16-alpha.1
|
|
168
|
+
|
|
169
|
+
### Patch Changes
|
|
170
|
+
|
|
171
|
+
- Updated dependencies [[`8824ff2`](https://github.com/ckb-devrel/ccc/commit/8824ff27af3b76186f1a7d6db8c907cd66f09d6a), [`c092988`](https://github.com/ckb-devrel/ccc/commit/c092988e7765b9ac79498d6bd72a6a2f62859b6f)]:
|
|
172
|
+
- @ckb-ccc/core@0.0.16-alpha.1
|
|
173
|
+
|
|
174
|
+
## 0.0.16-alpha.0
|
|
175
|
+
|
|
176
|
+
### Patch Changes
|
|
177
|
+
|
|
178
|
+
- Updated dependencies [[`1720d5a`](https://github.com/ckb-devrel/ccc/commit/1720d5a398543f1c6e24763eeaf15d84cd2214bf)]:
|
|
179
|
+
- @ckb-ccc/core@0.0.16-alpha.0
|
|
180
|
+
|
|
181
|
+
## 0.0.15
|
|
182
|
+
|
|
183
|
+
### Patch Changes
|
|
184
|
+
|
|
185
|
+
- Updated dependencies [[`8f2560a`](https://github.com/ckb-devrel/ccc/commit/8f2560ab0e5619654fff7c5eacda8425385f908e)]:
|
|
186
|
+
- @ckb-ccc/core@0.0.15
|
|
187
|
+
|
|
188
|
+
## 0.0.14
|
|
189
|
+
|
|
190
|
+
### Patch Changes
|
|
191
|
+
|
|
192
|
+
- Updated dependencies [[`5e942f8`](https://github.com/ckb-devrel/ccc/commit/5e942f8f1ed678abdb7ab9716f5449f0714cea53), [`f5b5938`](https://github.com/ckb-devrel/ccc/commit/f5b5938ab8f9c0a338dfd6765fe717f7ad1b1dd8), [`f13f4d3`](https://github.com/ckb-devrel/ccc/commit/f13f4d319ca66b571029a65e945e3a038bfeea25), [`7ba62a0`](https://github.com/ckb-devrel/ccc/commit/7ba62a056f17808fe5684786c00c2dff80bb7d1d), [`2164efd`](https://github.com/ckb-devrel/ccc/commit/2164efd6d834c1917ad5f4a514dc25941f937185), [`e5bd2ad`](https://github.com/ckb-devrel/ccc/commit/e5bd2ad5de4b42a22c422ecfc42056750f69b88b), [`aae3e06`](https://github.com/ckb-devrel/ccc/commit/aae3e0679fb940dd8c12ac9be12a4b53277a339d)]:
|
|
193
|
+
- @ckb-ccc/core@0.0.14
|
|
194
|
+
|
|
195
|
+
## 0.0.14-alpha.2
|
|
196
|
+
|
|
197
|
+
### Patch Changes
|
|
198
|
+
|
|
199
|
+
- Updated dependencies [[`7ba62a0`](https://github.com/ckb-devrel/ccc/commit/7ba62a056f17808fe5684786c00c2dff80bb7d1d)]:
|
|
200
|
+
- @ckb-ccc/core@0.0.14-alpha.2
|
|
201
|
+
|
|
202
|
+
## 0.0.14-alpha.1
|
|
203
|
+
|
|
204
|
+
### Patch Changes
|
|
205
|
+
|
|
206
|
+
- Updated dependencies [[`5e942f8`](https://github.com/ckb-devrel/ccc/commit/5e942f8f1ed678abdb7ab9716f5449f0714cea53), [`e5bd2ad`](https://github.com/ckb-devrel/ccc/commit/e5bd2ad5de4b42a22c422ecfc42056750f69b88b), [`aae3e06`](https://github.com/ckb-devrel/ccc/commit/aae3e0679fb940dd8c12ac9be12a4b53277a339d)]:
|
|
207
|
+
- @ckb-ccc/core@0.0.14-alpha.1
|
|
208
|
+
|
|
209
|
+
## 0.0.14-alpha.0
|
|
210
|
+
|
|
211
|
+
### Patch Changes
|
|
212
|
+
|
|
213
|
+
- Updated dependencies [[`f5b5938`](https://github.com/ckb-devrel/ccc/commit/f5b5938ab8f9c0a338dfd6765fe717f7ad1b1dd8), [`2164efd`](https://github.com/ckb-devrel/ccc/commit/2164efd6d834c1917ad5f4a514dc25941f937185)]:
|
|
214
|
+
- @ckb-ccc/core@0.0.14-alpha.0
|
|
215
|
+
|
|
216
|
+
## 0.0.13
|
|
217
|
+
|
|
218
|
+
### Patch Changes
|
|
219
|
+
|
|
220
|
+
- [`6d62032`](https://github.com/ckb-devrel/ccc/commit/6d620326f42f8c48eff9deb95578cf28d7bf5c97) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix(core): recordCells should not add usableCells
|
|
221
|
+
|
|
222
|
+
- [`3658797`](https://github.com/ckb-devrel/ccc/commit/3658797e67c42c56b20fa66481d0455ed019e69f) Thanks [@Hanssen0](https://github.com/Hanssen0)! - feat(core): node.js websocket
|
|
223
|
+
|
|
224
|
+
- [`588db84`](https://github.com/ckb-devrel/ccc/commit/588db8434d76a5a9ea6dd1d4c5b03f356ec1fb7d) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix: joyid CkbSigner appUri
|
|
225
|
+
|
|
226
|
+
- [`44c7fee`](https://github.com/ckb-devrel/ccc/commit/44c7feed37369836268fba21884418682f15254b) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix(core): completeInputs
|
|
227
|
+
|
|
228
|
+
- [`079e20e`](https://github.com/ckb-devrel/ccc/commit/079e20ef14cf9a7c06bbaddf3e92cbfbb005da11) Thanks [@Hanssen0](https://github.com/Hanssen0)! - feat(core): more APIs. Since parsing.
|
|
229
|
+
|
|
230
|
+
- [`ed154d1`](https://github.com/ckb-devrel/ccc/commit/ed154d189e239907ad686ec51ac8133b6d5eb895) Thanks [@Hanssen0](https://github.com/Hanssen0)! - feat(core): Signer.findCells
|
|
231
|
+
|
|
232
|
+
- Updated dependencies [[`3378e85`](https://github.com/ckb-devrel/ccc/commit/3378e85b32797f5cdc1943b9ecaca1fd1d9fad5e), [`8629449`](https://github.com/ckb-devrel/ccc/commit/86294490e76fc2a1cee20f827883e02fceca6e8b), [`6d62032`](https://github.com/ckb-devrel/ccc/commit/6d620326f42f8c48eff9deb95578cf28d7bf5c97), [`3658797`](https://github.com/ckb-devrel/ccc/commit/3658797e67c42c56b20fa66481d0455ed019e69f), [`69c10fd`](https://github.com/ckb-devrel/ccc/commit/69c10fdfcd507433c13b15d17015dca4687afb97), [`600cc13`](https://github.com/ckb-devrel/ccc/commit/600cc137ac6eb7c5b2533670de6df29d82f1b9e1), [`642f731`](https://github.com/ckb-devrel/ccc/commit/642f7317f4951ef801f1245aea96c40b4b6fb73e), [`96dbb61`](https://github.com/ckb-devrel/ccc/commit/96dbb6107d2071b9383350ddd578557746227054), [`0462a4e`](https://github.com/ckb-devrel/ccc/commit/0462a4ee101926f0da857173626dc4ab879e3b56), [`52156f9`](https://github.com/ckb-devrel/ccc/commit/52156f9df9cae9e0b71b77b49cda0e4d73e76142), [`63606db`](https://github.com/ckb-devrel/ccc/commit/63606db908f95bfc857430083932144d1ef4deef), [`44c7fee`](https://github.com/ckb-devrel/ccc/commit/44c7feed37369836268fba21884418682f15254b), [`1043c2b`](https://github.com/ckb-devrel/ccc/commit/1043c2bc211ec283b88dba3b81feef98e4185c0e), [`079e20e`](https://github.com/ckb-devrel/ccc/commit/079e20ef14cf9a7c06bbaddf3e92cbfbb005da11), [`1f999f8`](https://github.com/ckb-devrel/ccc/commit/1f999f854beb255b3cd9dbbc5a7268e75442b3db), [`a69a9dc`](https://github.com/ckb-devrel/ccc/commit/a69a9dc0c722f7b4cfa36b2ae8ecba4dcde0db90), [`ed154d1`](https://github.com/ckb-devrel/ccc/commit/ed154d189e239907ad686ec51ac8133b6d5eb895)]:
|
|
233
|
+
- @ckb-ccc/core@0.0.13
|
|
234
|
+
|
|
235
|
+
## 0.0.13-alpha.8
|
|
236
|
+
|
|
237
|
+
### Patch Changes
|
|
238
|
+
|
|
239
|
+
- Updated dependencies [[`8629449`](https://github.com/ckb-devrel/ccc/commit/86294490e76fc2a1cee20f827883e02fceca6e8b), [`52156f9`](https://github.com/ckb-devrel/ccc/commit/52156f9df9cae9e0b71b77b49cda0e4d73e76142), [`63606db`](https://github.com/ckb-devrel/ccc/commit/63606db908f95bfc857430083932144d1ef4deef)]:
|
|
240
|
+
- @ckb-ccc/core@0.0.13-alpha.8
|
|
241
|
+
|
|
242
|
+
## 0.0.13-alpha.7
|
|
243
|
+
|
|
244
|
+
### Patch Changes
|
|
245
|
+
|
|
246
|
+
- [`079e20e`](https://github.com/ckb-devrel/ccc/commit/079e20ef14cf9a7c06bbaddf3e92cbfbb005da11) Thanks [@Hanssen0](https://github.com/Hanssen0)! - feat(core): more APIs. Since parsing.
|
|
247
|
+
|
|
248
|
+
- [`ed154d1`](https://github.com/ckb-devrel/ccc/commit/ed154d189e239907ad686ec51ac8133b6d5eb895) Thanks [@Hanssen0](https://github.com/Hanssen0)! - feat(core): Signer.findCells
|
|
249
|
+
|
|
250
|
+
- Updated dependencies [[`1043c2b`](https://github.com/ckb-devrel/ccc/commit/1043c2bc211ec283b88dba3b81feef98e4185c0e), [`079e20e`](https://github.com/ckb-devrel/ccc/commit/079e20ef14cf9a7c06bbaddf3e92cbfbb005da11), [`ed154d1`](https://github.com/ckb-devrel/ccc/commit/ed154d189e239907ad686ec51ac8133b6d5eb895)]:
|
|
251
|
+
- @ckb-ccc/core@0.0.13-alpha.7
|
|
252
|
+
|
|
253
|
+
## 0.0.13-alpha.6
|
|
254
|
+
|
|
255
|
+
### Patch Changes
|
|
256
|
+
|
|
257
|
+
- [`44c7fee`](https://github.com/ckb-devrel/ccc/commit/44c7feed37369836268fba21884418682f15254b) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix(core): completeInputs
|
|
258
|
+
|
|
259
|
+
- Updated dependencies [[`69c10fd`](https://github.com/ckb-devrel/ccc/commit/69c10fdfcd507433c13b15d17015dca4687afb97), [`44c7fee`](https://github.com/ckb-devrel/ccc/commit/44c7feed37369836268fba21884418682f15254b)]:
|
|
260
|
+
- @ckb-ccc/core@0.0.13-alpha.6
|
|
261
|
+
|
|
262
|
+
## 0.0.13-alpha.5
|
|
263
|
+
|
|
264
|
+
### Patch Changes
|
|
265
|
+
|
|
266
|
+
- [`6d62032`](https://github.com/ckb-devrel/ccc/commit/6d620326f42f8c48eff9deb95578cf28d7bf5c97) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix(core): recordCells should not add usableCells
|
|
267
|
+
|
|
268
|
+
- Updated dependencies [[`6d62032`](https://github.com/ckb-devrel/ccc/commit/6d620326f42f8c48eff9deb95578cf28d7bf5c97)]:
|
|
269
|
+
- @ckb-ccc/core@0.0.13-alpha.5
|
|
270
|
+
|
|
271
|
+
## 0.0.13-alpha.4
|
|
272
|
+
|
|
273
|
+
### Patch Changes
|
|
274
|
+
|
|
275
|
+
- [`3658797`](https://github.com/ckb-devrel/ccc/commit/3658797e67c42c56b20fa66481d0455ed019e69f) Thanks [@Hanssen0](https://github.com/Hanssen0)! - feat(core): node.js websocket
|
|
276
|
+
|
|
277
|
+
- Updated dependencies [[`3658797`](https://github.com/ckb-devrel/ccc/commit/3658797e67c42c56b20fa66481d0455ed019e69f), [`642f731`](https://github.com/ckb-devrel/ccc/commit/642f7317f4951ef801f1245aea96c40b4b6fb73e)]:
|
|
278
|
+
- @ckb-ccc/core@0.0.13-alpha.4
|
|
279
|
+
|
|
280
|
+
## 0.0.13-alpha.3
|
|
281
|
+
|
|
282
|
+
### Patch Changes
|
|
283
|
+
|
|
284
|
+
- Updated dependencies [[`1f999f8`](https://github.com/ckb-devrel/ccc/commit/1f999f854beb255b3cd9dbbc5a7268e75442b3db)]:
|
|
285
|
+
- @ckb-ccc/core@0.0.13-alpha.3
|
|
286
|
+
|
|
287
|
+
## 0.0.13-alpha.2
|
|
288
|
+
|
|
289
|
+
### Patch Changes
|
|
290
|
+
|
|
291
|
+
- Updated dependencies [[`96dbb61`](https://github.com/ckb-devrel/ccc/commit/96dbb6107d2071b9383350ddd578557746227054)]:
|
|
292
|
+
- @ckb-ccc/core@0.0.13-alpha.2
|
|
293
|
+
|
|
294
|
+
## 0.0.13-alpha.1
|
|
295
|
+
|
|
296
|
+
### Patch Changes
|
|
297
|
+
|
|
298
|
+
- [`588db84`](https://github.com/ckb-devrel/ccc/commit/588db8434d76a5a9ea6dd1d4c5b03f356ec1fb7d) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix: joyid CkbSigner appUri
|
|
299
|
+
|
|
300
|
+
- Updated dependencies [[`3378e85`](https://github.com/ckb-devrel/ccc/commit/3378e85b32797f5cdc1943b9ecaca1fd1d9fad5e), [`a69a9dc`](https://github.com/ckb-devrel/ccc/commit/a69a9dc0c722f7b4cfa36b2ae8ecba4dcde0db90)]:
|
|
301
|
+
- @ckb-ccc/core@0.0.13-alpha.1
|
|
302
|
+
|
|
303
|
+
## 0.0.13-alpha.0
|
|
304
|
+
|
|
305
|
+
### Patch Changes
|
|
306
|
+
|
|
307
|
+
- Updated dependencies [[`600cc13`](https://github.com/ckb-devrel/ccc/commit/600cc137ac6eb7c5b2533670de6df29d82f1b9e1)]:
|
|
308
|
+
- @ckb-ccc/core@0.0.13-alpha.0
|
|
309
|
+
|
|
310
|
+
## 0.0.12
|
|
311
|
+
|
|
312
|
+
### Patch Changes
|
|
313
|
+
|
|
314
|
+
- Updated dependencies []:
|
|
315
|
+
- @ckb-ccc/core@0.0.12
|
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://app.ckbccc.com/">
|
|
3
|
+
<img alt="Logo" src="https://raw.githubusercontent.com/ckb-devrel/ccc/master/assets/logoAndText.svg" style="height: 8rem; max-width: 90%; padding: 0.5rem 0;" />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<h1 align="center" style="font-size: 48px;">
|
|
8
|
+
CCC's support for JoyID
|
|
9
|
+
</h1>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/@ckb-ccc/joy-id"><img
|
|
13
|
+
alt="NPM Version" src="https://img.shields.io/npm/v/%40ckb-ccc%2Fjoy-id"
|
|
14
|
+
/></a>
|
|
15
|
+
<img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/ckb-devrel/ccc" />
|
|
16
|
+
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/ckb-devrel/ccc/master" />
|
|
17
|
+
<img alt="GitHub branch check runs" src="https://img.shields.io/github/check-runs/ckb-devrel/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 a one-stop solution for your CKB JS/TS ecosystem development.
|
|
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
|
+
<h3 align="center">
|
|
40
|
+
Read more about CCC on <a href="https://docs.ckbccc.com">our website</a> or <a href="https://github.com/ckb-devrel/ccc">GitHub Repo</a>.
|
|
41
|
+
</h3>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advanced.d.ts","sourceRoot":"","sources":["../src/advanced.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC"}
|
package/dist/advanced.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as JoyIdA from "./advancedBarrel.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advancedBarrel.d.ts","sourceRoot":"","sources":["../src/advancedBarrel.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,+BAA+B,CAAC"}
|
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,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC"}
|
package/dist/barrel.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ccc } from "@ckb-ccc/core";
|
|
2
|
+
import { ConnectionsRepo } from "../connectionsStorage/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Class representing a Bitcoin signer that extends SignerBtc
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare class BitcoinSigner extends ccc.SignerBtc {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly icon: string;
|
|
10
|
+
private readonly preferredNetworks;
|
|
11
|
+
readonly addressType: "auto" | "p2wpkh" | "p2tr";
|
|
12
|
+
private readonly _appUri?;
|
|
13
|
+
private readonly connectionsRepo;
|
|
14
|
+
private connection?;
|
|
15
|
+
private network;
|
|
16
|
+
/**
|
|
17
|
+
* Ensures that the signer is connected and returns the connection.
|
|
18
|
+
* @throws Will throw an error if not connected.
|
|
19
|
+
* @returns The current connection.
|
|
20
|
+
*/
|
|
21
|
+
private assertConnection;
|
|
22
|
+
/**
|
|
23
|
+
* Creates an instance of BitcoinSigner.
|
|
24
|
+
* @param client - The client instance.
|
|
25
|
+
* @param name - The name of the signer.
|
|
26
|
+
* @param icon - The icon URL of the signer.
|
|
27
|
+
* @param addressType - The address type.
|
|
28
|
+
* @param _appUri - The application URI.
|
|
29
|
+
* @param connectionsRepo - The connections repository.
|
|
30
|
+
*/
|
|
31
|
+
constructor(client: ccc.Client, name: string, icon: string, preferredNetworks?: ccc.NetworkPreference[], addressType?: "auto" | "p2wpkh" | "p2tr", _appUri?: string | undefined, connectionsRepo?: ConnectionsRepo);
|
|
32
|
+
/**
|
|
33
|
+
* Gets the configuration for JoyID.
|
|
34
|
+
* @returns The configuration object.
|
|
35
|
+
*/
|
|
36
|
+
private getConfig;
|
|
37
|
+
disconnect(): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Gets the Bitcoin account address.
|
|
40
|
+
* @returns A promise that resolves to the Bitcoin account address.
|
|
41
|
+
*/
|
|
42
|
+
getBtcAccount(): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the Bitcoin public key.
|
|
45
|
+
* @returns A promise that resolves to the Bitcoin public key.
|
|
46
|
+
*/
|
|
47
|
+
getBtcPublicKey(): Promise<ccc.Hex>;
|
|
48
|
+
/**
|
|
49
|
+
* Connects to the provider by requesting authentication.
|
|
50
|
+
* @returns A promise that resolves when the connection is established.
|
|
51
|
+
*/
|
|
52
|
+
connect(): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Checks if the signer is connected.
|
|
55
|
+
* @returns A promise that resolves to true if connected, false otherwise.
|
|
56
|
+
*/
|
|
57
|
+
isConnected(): Promise<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* Signs a raw message with the Bitcoin account.
|
|
60
|
+
* @param message - The message to sign.
|
|
61
|
+
* @returns A promise that resolves to the signed message.
|
|
62
|
+
*/
|
|
63
|
+
signMessageRaw(message: string | ccc.BytesLike): Promise<string>;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/btc/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAEL,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AAExC;;;GAGG;AACH,qBAAa,aAAc,SAAQ,GAAG,CAAC,SAAS;aA4B5B,IAAI,EAAE,MAAM;aACZ,IAAI,EAAE,MAAM;IAC5B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;aAYlB,WAAW,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,eAAe;IA3ClC,OAAO,CAAC,UAAU,CAAC,CAAa;IAChC,OAAO,CAAC,OAAO,CAAgB;IAE/B;;;;OAIG;YACW,gBAAgB;IAQ9B;;;;;;;;OAQG;gBAED,MAAM,EAAE,GAAG,CAAC,MAAM,EACF,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACX,iBAAiB,GAAE,GAAG,CAAC,iBAAiB,EAWxD,EACe,WAAW,GAAE,MAAM,GAAG,QAAQ,GAAG,MAAe,EAC/C,OAAO,CAAC,EAAE,MAAM,YAAA,EAChB,eAAe,GAAE,eAAmD;IAKvF;;;OAGG;IACH,OAAO,CAAC,SAAS;IA6BX,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IASjC;;;OAGG;IACG,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAKtC;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IAKzC;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA+B9B;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAYrC;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;CAsBvE"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { ccc } from "@ckb-ccc/core";
|
|
2
|
+
import { DappRequestType, buildJoyIDURL } from "@joyid/common";
|
|
3
|
+
import { createPopup } from "../common/index.js";
|
|
4
|
+
import { ConnectionsRepoLocalStorage, } from "../connectionsStorage/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Class representing a Bitcoin signer that extends SignerBtc
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export class BitcoinSigner extends ccc.SignerBtc {
|
|
10
|
+
/**
|
|
11
|
+
* Ensures that the signer is connected and returns the connection.
|
|
12
|
+
* @throws Will throw an error if not connected.
|
|
13
|
+
* @returns The current connection.
|
|
14
|
+
*/
|
|
15
|
+
async assertConnection() {
|
|
16
|
+
if (!(await this.isConnected()) || !this.connection) {
|
|
17
|
+
throw new Error("Not connected");
|
|
18
|
+
}
|
|
19
|
+
return this.connection;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates an instance of BitcoinSigner.
|
|
23
|
+
* @param client - The client instance.
|
|
24
|
+
* @param name - The name of the signer.
|
|
25
|
+
* @param icon - The icon URL of the signer.
|
|
26
|
+
* @param addressType - The address type.
|
|
27
|
+
* @param _appUri - The application URI.
|
|
28
|
+
* @param connectionsRepo - The connections repository.
|
|
29
|
+
*/
|
|
30
|
+
constructor(client, name, icon, preferredNetworks = [
|
|
31
|
+
{
|
|
32
|
+
addressPrefix: "ckb",
|
|
33
|
+
signerType: ccc.SignerType.BTC,
|
|
34
|
+
network: "btc",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
addressPrefix: "ckt",
|
|
38
|
+
signerType: ccc.SignerType.BTC,
|
|
39
|
+
network: "btcTestnet",
|
|
40
|
+
},
|
|
41
|
+
], addressType = "auto", _appUri, connectionsRepo = new ConnectionsRepoLocalStorage()) {
|
|
42
|
+
super(client);
|
|
43
|
+
this.name = name;
|
|
44
|
+
this.icon = icon;
|
|
45
|
+
this.preferredNetworks = preferredNetworks;
|
|
46
|
+
this.addressType = addressType;
|
|
47
|
+
this._appUri = _appUri;
|
|
48
|
+
this.connectionsRepo = connectionsRepo;
|
|
49
|
+
this.network = "btcTestnet";
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Gets the configuration for JoyID.
|
|
53
|
+
* @returns The configuration object.
|
|
54
|
+
*/
|
|
55
|
+
getConfig() {
|
|
56
|
+
const { network } = this.matchNetworkPreference(this.preferredNetworks, this.network) ?? { network: this.network };
|
|
57
|
+
if (this.network !== network) {
|
|
58
|
+
this.connection = undefined;
|
|
59
|
+
}
|
|
60
|
+
this.network = network;
|
|
61
|
+
const url = {
|
|
62
|
+
btc: "https://app.joy.id",
|
|
63
|
+
btcTestnet: "https://testnet.joyid.dev",
|
|
64
|
+
}[network];
|
|
65
|
+
if (!url) {
|
|
66
|
+
throw new Error(`JoyID wallet doesn't support the requested chain ${this.network}`);
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
redirectURL: location.href,
|
|
70
|
+
joyidAppURL: this._appUri ?? url,
|
|
71
|
+
requestNetwork: `btc-${this.addressType}`,
|
|
72
|
+
name: this.name,
|
|
73
|
+
logo: this.icon,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
async disconnect() {
|
|
77
|
+
await super.disconnect();
|
|
78
|
+
await this.connectionsRepo.set({ uri: this.getConfig().joyidAppURL, addressType: "btc" }, undefined);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Gets the Bitcoin account address.
|
|
82
|
+
* @returns A promise that resolves to the Bitcoin account address.
|
|
83
|
+
*/
|
|
84
|
+
async getBtcAccount() {
|
|
85
|
+
const { address } = await this.assertConnection();
|
|
86
|
+
return address;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Gets the Bitcoin public key.
|
|
90
|
+
* @returns A promise that resolves to the Bitcoin public key.
|
|
91
|
+
*/
|
|
92
|
+
async getBtcPublicKey() {
|
|
93
|
+
const { publicKey } = await this.assertConnection();
|
|
94
|
+
return publicKey;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Connects to the provider by requesting authentication.
|
|
98
|
+
* @returns A promise that resolves when the connection is established.
|
|
99
|
+
*/
|
|
100
|
+
async connect() {
|
|
101
|
+
const config = this.getConfig();
|
|
102
|
+
const res = await createPopup(buildJoyIDURL(config, "popup", "/auth"), {
|
|
103
|
+
...config,
|
|
104
|
+
type: DappRequestType.Auth,
|
|
105
|
+
});
|
|
106
|
+
const { address, pubkey } = (() => {
|
|
107
|
+
if (this.addressType === "auto") {
|
|
108
|
+
return res.btcAddressType === "p2wpkh" ? res.nativeSegwit : res.taproot;
|
|
109
|
+
}
|
|
110
|
+
return this.addressType === "p2wpkh" ? res.nativeSegwit : res.taproot;
|
|
111
|
+
})();
|
|
112
|
+
this.connection = {
|
|
113
|
+
address,
|
|
114
|
+
publicKey: ccc.hexFrom(pubkey),
|
|
115
|
+
keyType: res.keyType,
|
|
116
|
+
};
|
|
117
|
+
await Promise.all([
|
|
118
|
+
this.connectionsRepo.set({ uri: config.joyidAppURL, addressType: `btc-${res.btcAddressType}` }, this.connection),
|
|
119
|
+
this.connectionsRepo.set({ uri: config.joyidAppURL, addressType: "btc-auto" }, this.connection),
|
|
120
|
+
]);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Checks if the signer is connected.
|
|
124
|
+
* @returns A promise that resolves to true if connected, false otherwise.
|
|
125
|
+
*/
|
|
126
|
+
async isConnected() {
|
|
127
|
+
if (this.connection) {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
this.connection = await this.connectionsRepo.get({
|
|
131
|
+
uri: this.getConfig().joyidAppURL,
|
|
132
|
+
addressType: `btc-${this.addressType}`,
|
|
133
|
+
});
|
|
134
|
+
return this.connection !== undefined;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Signs a raw message with the Bitcoin account.
|
|
138
|
+
* @param message - The message to sign.
|
|
139
|
+
* @returns A promise that resolves to the signed message.
|
|
140
|
+
*/
|
|
141
|
+
async signMessageRaw(message) {
|
|
142
|
+
const { address } = await this.assertConnection();
|
|
143
|
+
const challenge = typeof message === "string" ? message : ccc.hexFrom(message).slice(2);
|
|
144
|
+
const config = this.getConfig();
|
|
145
|
+
const { signature } = await createPopup(buildJoyIDURL({
|
|
146
|
+
...config,
|
|
147
|
+
challenge,
|
|
148
|
+
address,
|
|
149
|
+
signMessageType: "ecdsa",
|
|
150
|
+
}, "popup", "/sign-message"), { ...config, type: DappRequestType.SignMessage });
|
|
151
|
+
return signature;
|
|
152
|
+
}
|
|
153
|
+
}
|