@rango-dev/provider-phantom 0.64.0 → 0.64.2
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 +341 -0
- package/dist/mod.js +1 -1
- package/dist/mod.js.map +2 -2
- package/dist/signers/utxoSigner.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/signers/utxoSigner.ts +3 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
## [0.64.2](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.64.1...provider-phantom@0.64.2) (2026-09-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add jsonrpc field to btc broadcast requests ([2b96692](https://github.com/rango-exchange/rango-client/commit/2b96692a9e8941ec46285a2060593158ac9693e2))
|
|
7
|
+
## [0.64.1](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.64.0...provider-phantom@0.64.1) (2026-09-16)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* ship dist and changelog when publishing with npm ([0a8bd5d](https://github.com/rango-exchange/rango-client/commit/0a8bd5d779bd652b6ca7195cda4ce465ba196f0e))
|
|
13
|
+
# [0.64.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.63.0...provider-phantom@0.64.0) (2026-09-15)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* add support for ledger wallet ([eacfd0b](https://github.com/rango-exchange/rango-client/commit/eacfd0bd32f87629e6cc9f6170368e1e208a6bd0))
|
|
19
|
+
* migrate wallet connect provider to hub ([efa6aef](https://github.com/rango-exchange/rango-client/commit/efa6aeff2c9dc406707024417c2307f3c345b71d))
|
|
20
|
+
# [0.63.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.62.0...provider-phantom@0.63.0) (2026-08-18)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# [0.62.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.61.0...provider-phantom@0.62.0) (2026-07-07)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* **phantom:** temporarily disable bitcoin (utxo) namespace ([4bc807d](https://github.com/rango-exchange/rango-client/commit/4bc807d92663414067ef1901c08f10e79aaade67))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# [0.61.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.60.1...provider-phantom@0.61.0) (2026-05-31)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## [0.60.1](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.60.0...provider-phantom@0.60.1) (2026-05-02)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# [0.60.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.59.0...provider-phantom@0.60.0) (2026-04-29)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# [0.59.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.58.0...provider-phantom@0.59.0) (2025-12-30)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# [0.58.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.57.0...provider-phantom@0.58.0) (2025-12-15)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# [0.57.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.56.0...provider-phantom@0.57.0) (2025-12-09)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
# [0.56.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.55.1...provider-phantom@0.56.0) (2025-12-02)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## [0.55.1](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.55.0...provider-phantom@0.55.1) (2025-11-22)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# [0.53.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.52.0...provider-phantom@0.53.0) (2025-10-29)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Reverts
|
|
69
|
+
|
|
70
|
+
* Revert "feat: implement deep linking" ([a0b0edc](https://github.com/rango-exchange/rango-client/commit/a0b0edcc052bfea69af2037b73c0bb6a9b38c2a9))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
# [0.52.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.51.0...provider-phantom@0.52.0) (2025-09-29)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### Features
|
|
78
|
+
|
|
79
|
+
* implement changeAccountSubscriber builder ([8e2ca97](https://github.com/rango-exchange/rango-client/commit/8e2ca9783fcd57445ca558e688c402a30aba3686))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
# [0.51.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.50.0...provider-phantom@0.51.0) (2025-09-06)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### Features
|
|
87
|
+
|
|
88
|
+
* implement deep linking ([1dec48e](https://github.com/rango-exchange/rango-client/commit/1dec48e4db944977fb6d3797d7aa49527940fab6))
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
# [0.50.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.49.0...provider-phantom@0.50.0) (2025-08-19)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
### Bug Fixes
|
|
96
|
+
|
|
97
|
+
* add rango-dev/wallets-core to dependencies of providers ([84b4b2b](https://github.com/rango-exchange/rango-client/commit/84b4b2b7c3a7f5631228fb6ebf04617c3c4428e9))
|
|
98
|
+
* remove retry dynamic import and throw refined error on dynamic import failure ([a2944ac](https://github.com/rango-exchange/rango-client/commit/a2944ac3c05a0e945f6e5621fa5693ab89625485))
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
### Features
|
|
102
|
+
|
|
103
|
+
* implement retry mechanism for lazy imports ([9a8e191](https://github.com/rango-exchange/rango-client/commit/9a8e191711d2319990ca4d0613e8188a5f86842f))
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
# [0.49.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.48.0...provider-phantom@0.49.0) (2025-08-05)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
### Features
|
|
111
|
+
|
|
112
|
+
* implement canSwitchNetwork for hub providers ([5a4eced](https://github.com/rango-exchange/rango-client/commit/5a4eced221046b5474176aca7c569092e36f1bde))
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
# [0.48.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.47.0...provider-phantom@0.48.0) (2025-07-22)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
### Reverts
|
|
120
|
+
|
|
121
|
+
* Revert "chore(release): publish" ([064ce15](https://github.com/rango-exchange/rango-client/commit/064ce157a2f819856f647f83aeb1c0410542e8d7))
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
# [0.46.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.45.1...provider-phantom@0.46.0) (2025-06-09)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
### Bug Fixes
|
|
129
|
+
|
|
130
|
+
* fix phantom transaction failure on sui namespace disabled ([213b235](https://github.com/rango-exchange/rango-client/commit/213b23565b2729a48605d3d06ef5dd6daf66900f))
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
### Features
|
|
134
|
+
|
|
135
|
+
* migrate trust wallet to use hub and add support for solana ([61497fd](https://github.com/rango-exchange/rango-client/commit/61497fd40d48d48030e5a6d7ece53b5b7daf7b09))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
## [0.45.1](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.45.0...provider-phantom@0.45.1) (2025-05-04)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
# [0.45.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.44.0...provider-phantom@0.45.0) (2025-04-30)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
### Bug Fixes
|
|
147
|
+
|
|
148
|
+
* error rethrow in or action ([61bc658](https://github.com/rango-exchange/rango-client/commit/61bc658f6a0dab513bb595e2943c85b675c65ada))
|
|
149
|
+
* rename pbt to ptb for sui ([3d6d89f](https://github.com/rango-exchange/rango-client/commit/3d6d89f2265766607a15d61e0df92643fb33072b))
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
### Features
|
|
153
|
+
|
|
154
|
+
* add can eager connect to namespaces ([16b4792](https://github.com/rango-exchange/rango-client/commit/16b4792f877b565ccf767be22ebe14fa79ddd8c6))
|
|
155
|
+
* implement updated design for initial connect modal ([2873c63](https://github.com/rango-exchange/rango-client/commit/2873c630de0740bb3b9f4e52bfa018857bd54dcd))
|
|
156
|
+
* Sui support for Phantom ([3769b8b](https://github.com/rango-exchange/rango-client/commit/3769b8ba174783190e242103548bcf4da28cff14))
|
|
157
|
+
* update sui to consider recent api changes ([d764b25](https://github.com/rango-exchange/rango-client/commit/d764b2501df9bb295f63cdbc0b05acd4a3abb4b9))
|
|
158
|
+
* update wallets readme ([0d52ecb](https://github.com/rango-exchange/rango-client/commit/0d52ecbee31b0d3241be71a6f77d508e4a15d3c4))
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
# [0.44.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.43.0...provider-phantom@0.44.0) (2025-03-11)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
### Features
|
|
166
|
+
|
|
167
|
+
* add bitcoin signer for phantom on hub ([750124e](https://github.com/rango-exchange/rango-client/commit/750124e693753078abb537d4043964e2eebdbc01))
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
# [0.43.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.42.0...provider-phantom@0.43.0) (2025-02-23)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
### Bug Fixes
|
|
175
|
+
|
|
176
|
+
* make hub compatible with external wallets ([316f18c](https://github.com/rango-exchange/rango-client/commit/316f18c4b270b5e94b7e475d6bf7922cdcc9c712))
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
### Features
|
|
180
|
+
|
|
181
|
+
* add an adapter for Hub for wallets-react and enabling Hub by default. ([a14bdf9](https://github.com/rango-exchange/rango-client/commit/a14bdf9619e448bc4568d6b758ca86d2359e1740))
|
|
182
|
+
* add base chain to phantom evm supported chains ([58a2d54](https://github.com/rango-exchange/rango-client/commit/58a2d54c0eff18e8d5ecf980b2487f7c8dada59f))
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
# [0.42.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.41.0...provider-phantom@0.42.0) (2025-01-20)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
# [0.41.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.40.0...provider-phantom@0.41.0) (2024-12-30)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
# [0.40.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.39.0...provider-phantom@0.40.0) (2024-11-27)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
### Features
|
|
198
|
+
|
|
199
|
+
* add ton connect provider ([2a2dbb7](https://github.com/rango-exchange/rango-client/commit/2a2dbb79022263f19446ced49d298e04d63f927f))
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
# [0.39.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.38.0...provider-phantom@0.39.0) (2024-11-12)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
# [0.38.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.37.0...provider-phantom@0.38.0) (2024-10-12)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
### Bug Fixes
|
|
211
|
+
|
|
212
|
+
* bump sdk and fix type issues ([d442208](https://github.com/rango-exchange/rango-client/commit/d4422083bf5dd27d5f509ce1db7f9560d05428c8))
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
### Performance Improvements
|
|
216
|
+
|
|
217
|
+
* lazy load signer packages ([7b88f18](https://github.com/rango-exchange/rango-client/commit/7b88f1834f7b29b4b81ab6c81a07bb88e8ccf55c))
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
# [0.37.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.36.0...provider-phantom@0.37.0) (2024-09-10)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
# [0.36.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.35.1...provider-phantom@0.36.0) (2024-08-11)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
## [0.35.1](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.35.0...provider-phantom@0.35.1) (2024-07-14)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
# [0.35.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.33.0...provider-phantom@0.35.0) (2024-07-09)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
# [0.34.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.33.0...provider-phantom@0.34.0) (2024-06-01)
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
# [0.33.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.32.0...provider-phantom@0.33.0) (2024-05-14)
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
# [0.32.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.31.0...provider-phantom@0.32.0) (2024-04-24)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
# [0.31.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.30.0...provider-phantom@0.31.0) (2024-04-23)
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
# [0.30.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.29.0...provider-phantom@0.30.0) (2024-04-09)
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
### Bug Fixes
|
|
257
|
+
|
|
258
|
+
* fix the connection problem that happens when another wallet takes over the requested one ([42df212](https://github.com/rango-exchange/rango-client/commit/42df2120aadd84c95045b0bf76844c19305fb59a))
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
# [0.29.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.28.0...provider-phantom@0.29.0) (2024-03-12)
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
# [0.28.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.27.0...provider-phantom@0.28.0) (2024-02-20)
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
# [0.27.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.26.0...provider-phantom@0.27.0) (2024-02-07)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
# [0.26.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.25.0...provider-phantom@0.26.0) (2024-01-22)
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
### Bug Fixes
|
|
278
|
+
|
|
279
|
+
* cleanup wallets' subscriber when setProvider get null ([88d6a42](https://github.com/rango-exchange/rango-client/commit/88d6a423c49b34b3d9ff567e22df36c3b009bb76))
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
# [0.25.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.23.0...provider-phantom@0.25.0) (2023-12-24)
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
### Bug Fixes
|
|
287
|
+
|
|
288
|
+
* fix HMR for widget and playground ([8524820](https://github.com/rango-exchange/rango-client/commit/8524820f10cf0b8921f3db0c4f620ff98daa4103))
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
# [0.14.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.13.0...provider-phantom@0.14.0) (2023-08-03)
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
# [0.13.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.12.0...provider-phantom@0.13.0) (2023-08-01)
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
# [0.9.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.8.0...provider-phantom@0.9.0) (2023-07-31)
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
# [0.7.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.6.0...provider-phantom@0.7.0) (2023-07-11)
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
# [0.6.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.5.0...provider-phantom@0.6.0) (2023-07-11)
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
### Reverts
|
|
312
|
+
|
|
313
|
+
* Revert "support for rango-types cjs format" ([ed4e050](https://github.com/rango-exchange/rango-client/commit/ed4e050bfc0dcde7aeffa6b0d73b02080a5721eb))
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
# [0.5.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.4.0...provider-phantom@0.5.0) (2023-05-31)
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
# [0.4.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.3.0...provider-phantom@0.4.0) (2023-05-31)
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
# [0.3.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.2.0...provider-phantom@0.3.0) (2023-05-30)
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
# [0.2.0](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.1.15...provider-phantom@0.2.0) (2023-05-30)
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
## [0.1.14](https://github.com/rango-exchange/rango-client/compare/provider-phantom@0.1.13...provider-phantom@0.1.14) (2023-05-15)
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
### Bug Fixes
|
|
337
|
+
|
|
338
|
+
* update rango-types and fix notification bugs ([993f185](https://github.com/rango-exchange/rango-client/commit/993f185e0b8c5e5e15a2c65ba2d85d1f9c8daa90))
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
package/dist/mod.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var v=Object.defineProperty;var r=(n,o)=>v(n,"name",{value:o,configurable:!0});var V=(n,o)=>()=>(n&&(o=n(n=0)),o);var R=(n,o)=>{for(var t in o)v(n,t,{get:o[t],enumerable:!0})};var w={};R(w,{BTCSigner:()=>P});import*as H from"@bitcoinerlab/secp256k1";import{isBitcoinBlockchain as F}from"@rango-dev/internal-blockchains";import*as h from"bitcoinjs-lib";import{SignerError as z}from"rango-types";function G(n){let o=atob(n),t=o.length,e=new Uint8Array(t);for(let i=0;i<t;i++)e[i]=o.charCodeAt(i);return e}var $,P,T=V(()=>{"use strict";$="https://go.getblock.io/f37bad28a991436483c0a3679a3acbee";r(G,"base64ToUint8Array");P=class{static{r(this,"BTCSigner")}provider;constructor(o){this.provider=o}async signMessage(){throw z.UnimplementedError("signMessage")}async signAndSendTx(o){let{asset:t,psbt:e}=o;if(!e)throw new Error("No PSBT found to sign. Ensure a valid PSBT is provided.");if(!F(t.blockchain))throw new Error(`Signing ${t.blockchain} transaction is not implemented by the signer.`);h.initEccLib(H);let i=await this.provider.signPSBT(G(e.unsignedPsbtBase64),{inputsToSign:e.inputsToSign}),a=h.Psbt.fromBuffer(Buffer.from(i));a.finalizeAllInputs();let E=a.extractTransaction().toHex(),d=await fetch($,{method:"POST",body:JSON.stringify({method:"sendrawtransaction",params:[E]})});if(!d.ok){let c=await d.text();throw new Error(`Error broadcasting transaction: ${c}`)}let m=await d.json();if(!m.result)throw new Error(`Error broadcasting transaction. Error Code ${m.error.code}: ${m.error.message}`);return{hash:m.result}}}});import{defineVersions as Uo}from"@hub3js/core/utils";import{ProviderBuilder as Oo}from"@hub3js/core";import{CAIP_BASE_CHAIN_ID as oo,CAIP_ETHEREUM_CHAIN_ID as no,CAIP_POLYGON_CHAIN_ID as to,isEvmNamespace as ro}from"@hub3js/evm";import{isSolanaNamespace as eo}from"@hub3js/solana";import{getChainIdFromCaip2ChainId as io}from"@hub3js/std/utils";import{isSuiNamespace as ao}from"@hub3js/sui";import{EVM_NAMESPACE as X,SOLANA_NAMESPACE as J,UTXO_NAMESPACE as K}from"@hub3js/namespaces";import{getInstance as Y}from"@hub3js/sui";import{DefaultSignerFactory as q,TransactionType as A}from"rango-types";async function b(n){let o=n.get(J),t=n.get(X),e=n.get(K),i=Y(l),{DefaultEvmSigner:a}=await import("@rango-dev/signer-evm"),{DefaultSolanaSigner:E}=await import("@rango-dev/signer-solana"),{BTCSigner:d}=await Promise.resolve().then(()=>(T(),w)),{DefaultSuiSigner:m}=await import("@rango-dev/signer-sui"),c=new q;return o&&c.registerSigner(A.SOLANA,new E(o)),t&&c.registerSigner(A.EVM,new a(t)),e&&c.registerSigner(A.TRANSFER,new d(e)),i&&c.registerSigner(A.SUI,new m(i)),c}r(b,"getSigners");import{EVM_NAMESPACE as y,SOLANA_NAMESPACE as C,SUI_NAMESPACE as Q,UTXO_NAMESPACE as Z}from"@hub3js/namespaces";function u(){let{phantom:n}=window;if(!n)return null;let{solana:o,ethereum:t,bitcoin:e,sui:i}=n,a=new Map;return t&&t.isPhantom&&a.set(y,t),o&&o.isPhantom&&a.set(C,o),e&&e.isPhantom&&a.set(Z,e),i&&i.isPhantom&&a.set(Q,i),a}r(u,"phantom");function I(){let n=u();if(!n)throw new Error("Phantom is not injected. Please check your wallet.");return n}r(I,"getInstanceOrThrow");function f(){let o=u()?.get(y);if(!o)throw new Error("Phantom not injected or EVM not enabled. Please check your wallet.");return o}r(f,"evmPhantom");function p(){let o=u()?.get(C);if(!o)throw new Error("Phantom not injected or Solana not enabled. Please check your wallet.");return o}r(p,"solanaPhantom");var so=[no,to,oo],s="phantom",l="Phantom",N={name:"Phantom",icon:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/phantom/icon.svg",extensions:{chrome:"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa",homepage:"https://phantom.app/"},properties:[{name:"namespaces",value:{selection:"multiple",data:[{label:"EVM",value:"EVM",id:"ETH",isChainSupported:n=>ro(n)&&so.includes(io(n))},{label:"Solana",value:"Solana",id:"SOLANA",isChainSupported:eo},{label:"Sui",value:"Sui",id:"SUI",isChainSupported:ao}]}},{name:"signers",value:{getSigners:async()=>b(I())}}]};import{NamespaceBuilder as co}from"@hub3js/core";import{actions as g,builders as S,hooks as mo}from"@hub3js/evm";import*as _ from"@hub3js/std/builders";import{standardizeAndThrowError as po}from"@hub3js/std/operators";var[lo,x]=mo.changeAccountSubscriber(f),uo=S.connect().action(g.connect(f)).before(lo).or(x).or(po).build(),fo=_.disconnect().after(x).build(),ho=S.canEagerConnect().action(g.canEagerConnect(f)).build(),Ao=S.canSwitchNetwork().action(g.canSwitchNetwork()).build(),go=S.getChainId().action(g.getChainId(f)).build(),L=new co("EVM",s).action(uo).action(fo).action(ho).action(Ao).action(go).build();import{ActionBuilder as So,NamespaceBuilder as Eo}from"@hub3js/core";import{actions as M,builders as Po,hooks as bo}from"@hub3js/solana";import*as B from"@hub3js/std/builders";import{standardizeAndThrowError as vo}from"@hub3js/std/operators";var[wo,j]=bo.changeAccountSubscriber(p),To=Po.connect().action(M.connect(p)).before(wo).or(j).or(vo).build(),yo=B.disconnect().after(j).build(),Co=new So("canEagerConnect").action(M.canEagerConnect(p)).build(),k=new Eo("Solana",s).action(To).action(yo).action(Co).build();import{ActionBuilder as Io,NamespaceBuilder as No}from"@hub3js/core";import{actions as _o}from"@hub3js/solana";import*as D from"@hub3js/std/builders";import{standardizeAndThrowError as xo}from"@hub3js/std/operators";import{builders as Lo,hooks as Mo}from"@hub3js/sui";var[Bo,O]=Mo.changeAccountSubscriber({name:l}),jo=Lo.connect({name:l}).before(Bo).or(O).or(xo).build(),ko=D.disconnect().after(O).build(),Do=new Io("canEagerConnect").action(_o.canEagerConnect(p)).build(),U=new No("Sui",s).action(jo).action(ko).action(Do).build();var W=r(()=>new Oo(s).init(function(n){let[,o]=n.state();u()&&(o("installed",!0),console.debug("[phantom] instance detected.",n))}).config("metadata",N).add("solana",k).add("evm",L).add("sui",U).build(),"buildProvider");var kn=r(()=>Uo().version("1.0.0",W()).build(),"versions");export{s as WALLET_ID,kn as versions};
|
|
1
|
+
var v=Object.defineProperty;var r=(n,o)=>v(n,"name",{value:o,configurable:!0});var V=(n,o)=>()=>(n&&(o=n(n=0)),o);var R=(n,o)=>{for(var t in o)v(n,t,{get:o[t],enumerable:!0})};var w={};R(w,{BTCSigner:()=>P});import*as H from"@bitcoinerlab/secp256k1";import{isBitcoinBlockchain as F}from"@rango-dev/internal-blockchains";import*as h from"bitcoinjs-lib";import{SignerError as z}from"rango-types";function G(n){let o=atob(n),t=o.length,e=new Uint8Array(t);for(let i=0;i<t;i++)e[i]=o.charCodeAt(i);return e}var $,P,T=V(()=>{"use strict";$="https://go.getblock.io/f37bad28a991436483c0a3679a3acbee";r(G,"base64ToUint8Array");P=class{static{r(this,"BTCSigner")}provider;constructor(o){this.provider=o}async signMessage(){throw z.UnimplementedError("signMessage")}async signAndSendTx(o){let{asset:t,psbt:e}=o;if(!e)throw new Error("No PSBT found to sign. Ensure a valid PSBT is provided.");if(!F(t.blockchain))throw new Error(`Signing ${t.blockchain} transaction is not implemented by the signer.`);h.initEccLib(H);let i=await this.provider.signPSBT(G(e.unsignedPsbtBase64),{inputsToSign:e.inputsToSign}),a=h.Psbt.fromBuffer(Buffer.from(i));a.finalizeAllInputs();let E=a.extractTransaction().toHex(),d=await fetch($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"sendrawtransaction",params:[E]})});if(!d.ok){let c=await d.text();throw new Error(`Error broadcasting transaction: ${c}`)}let m=await d.json();if(!m.result)throw new Error(`Error broadcasting transaction. Error Code ${m.error.code}: ${m.error.message}`);return{hash:m.result}}}});import{defineVersions as Uo}from"@hub3js/core/utils";import{ProviderBuilder as Oo}from"@hub3js/core";import{CAIP_BASE_CHAIN_ID as oo,CAIP_ETHEREUM_CHAIN_ID as no,CAIP_POLYGON_CHAIN_ID as to,isEvmNamespace as ro}from"@hub3js/evm";import{isSolanaNamespace as eo}from"@hub3js/solana";import{getChainIdFromCaip2ChainId as io}from"@hub3js/std/utils";import{isSuiNamespace as ao}from"@hub3js/sui";import{EVM_NAMESPACE as X,SOLANA_NAMESPACE as J,UTXO_NAMESPACE as K}from"@hub3js/namespaces";import{getInstance as Y}from"@hub3js/sui";import{DefaultSignerFactory as q,TransactionType as A}from"rango-types";async function b(n){let o=n.get(J),t=n.get(X),e=n.get(K),i=Y(l),{DefaultEvmSigner:a}=await import("@rango-dev/signer-evm"),{DefaultSolanaSigner:E}=await import("@rango-dev/signer-solana"),{BTCSigner:d}=await Promise.resolve().then(()=>(T(),w)),{DefaultSuiSigner:m}=await import("@rango-dev/signer-sui"),c=new q;return o&&c.registerSigner(A.SOLANA,new E(o)),t&&c.registerSigner(A.EVM,new a(t)),e&&c.registerSigner(A.TRANSFER,new d(e)),i&&c.registerSigner(A.SUI,new m(i)),c}r(b,"getSigners");import{EVM_NAMESPACE as y,SOLANA_NAMESPACE as C,SUI_NAMESPACE as Q,UTXO_NAMESPACE as Z}from"@hub3js/namespaces";function u(){let{phantom:n}=window;if(!n)return null;let{solana:o,ethereum:t,bitcoin:e,sui:i}=n,a=new Map;return t&&t.isPhantom&&a.set(y,t),o&&o.isPhantom&&a.set(C,o),e&&e.isPhantom&&a.set(Z,e),i&&i.isPhantom&&a.set(Q,i),a}r(u,"phantom");function I(){let n=u();if(!n)throw new Error("Phantom is not injected. Please check your wallet.");return n}r(I,"getInstanceOrThrow");function f(){let o=u()?.get(y);if(!o)throw new Error("Phantom not injected or EVM not enabled. Please check your wallet.");return o}r(f,"evmPhantom");function p(){let o=u()?.get(C);if(!o)throw new Error("Phantom not injected or Solana not enabled. Please check your wallet.");return o}r(p,"solanaPhantom");var so=[no,to,oo],s="phantom",l="Phantom",N={name:"Phantom",icon:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/phantom/icon.svg",extensions:{chrome:"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa",homepage:"https://phantom.app/"},properties:[{name:"namespaces",value:{selection:"multiple",data:[{label:"EVM",value:"EVM",id:"ETH",isChainSupported:n=>ro(n)&&so.includes(io(n))},{label:"Solana",value:"Solana",id:"SOLANA",isChainSupported:eo},{label:"Sui",value:"Sui",id:"SUI",isChainSupported:ao}]}},{name:"signers",value:{getSigners:async()=>b(I())}}]};import{NamespaceBuilder as co}from"@hub3js/core";import{actions as g,builders as S,hooks as mo}from"@hub3js/evm";import*as _ from"@hub3js/std/builders";import{standardizeAndThrowError as po}from"@hub3js/std/operators";var[lo,x]=mo.changeAccountSubscriber(f),uo=S.connect().action(g.connect(f)).before(lo).or(x).or(po).build(),fo=_.disconnect().after(x).build(),ho=S.canEagerConnect().action(g.canEagerConnect(f)).build(),Ao=S.canSwitchNetwork().action(g.canSwitchNetwork()).build(),go=S.getChainId().action(g.getChainId(f)).build(),L=new co("EVM",s).action(uo).action(fo).action(ho).action(Ao).action(go).build();import{ActionBuilder as So,NamespaceBuilder as Eo}from"@hub3js/core";import{actions as M,builders as Po,hooks as bo}from"@hub3js/solana";import*as B from"@hub3js/std/builders";import{standardizeAndThrowError as vo}from"@hub3js/std/operators";var[wo,j]=bo.changeAccountSubscriber(p),To=Po.connect().action(M.connect(p)).before(wo).or(j).or(vo).build(),yo=B.disconnect().after(j).build(),Co=new So("canEagerConnect").action(M.canEagerConnect(p)).build(),k=new Eo("Solana",s).action(To).action(yo).action(Co).build();import{ActionBuilder as Io,NamespaceBuilder as No}from"@hub3js/core";import{actions as _o}from"@hub3js/solana";import*as D from"@hub3js/std/builders";import{standardizeAndThrowError as xo}from"@hub3js/std/operators";import{builders as Lo,hooks as Mo}from"@hub3js/sui";var[Bo,O]=Mo.changeAccountSubscriber({name:l}),jo=Lo.connect({name:l}).before(Bo).or(O).or(xo).build(),ko=D.disconnect().after(O).build(),Do=new Io("canEagerConnect").action(_o.canEagerConnect(p)).build(),U=new No("Sui",s).action(jo).action(ko).action(Do).build();var W=r(()=>new Oo(s).init(function(n){let[,o]=n.state();u()&&(o("installed",!0),console.debug("[phantom] instance detected.",n))}).config("metadata",N).add("solana",k).add("evm",L).add("sui",U).build(),"buildProvider");var kn=r(()=>Uo().version("1.0.0",W()).build(),"versions");export{s as WALLET_ID,kn as versions};
|
|
2
2
|
//# sourceMappingURL=mod.js.map
|
package/dist/mod.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/signers/utxoSigner.ts", "../src/mod.ts", "../src/provider.ts", "../src/constants.ts", "../src/signer.ts", "../src/utils.ts", "../src/namespaces/evm.ts", "../src/namespaces/solana.ts", "../src/namespaces/sui.ts"],
|
|
4
|
-
"sourcesContent": ["import type { GenericSigner, Transfer } from 'rango-types';\n\nimport * as secp256k1 from '@bitcoinerlab/secp256k1';\nimport { isBitcoinBlockchain } from '@rango-dev/internal-blockchains';\nimport * as bitcoin from 'bitcoinjs-lib';\nimport { SignerError } from 'rango-types';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype TransferExternalProvider = any;\n\nconst BTC_RPC_URL = 'https://go.getblock.io/f37bad28a991436483c0a3679a3acbee';\n\n// TODO: use Uint8Array.fromBase64() static method and use this function as a polyfill after updating TypeScript DOM lib\nfunction base64ToUint8Array(base64String: string) {\n const binaryString = atob(base64String);\n const length = binaryString.length;\n const uint8Array = new Uint8Array(length);\n\n for (let i = 0; i < length; i++) {\n uint8Array[i] = binaryString.charCodeAt(i);\n }\n\n return uint8Array;\n}\n\nexport class BTCSigner implements GenericSigner<Transfer> {\n private provider: TransferExternalProvider;\n constructor(provider: TransferExternalProvider) {\n this.provider = provider;\n }\n\n async signMessage(): Promise<string> {\n throw SignerError.UnimplementedError('signMessage');\n }\n\n async signAndSendTx(tx: Transfer): Promise<{ hash: string }> {\n const { asset, psbt } = tx;\n\n if (!psbt) {\n throw new Error(\n 'No PSBT found to sign. Ensure a valid PSBT is provided.'\n );\n }\n\n if (!isBitcoinBlockchain(asset.blockchain)) {\n throw new Error(\n `Signing ${asset.blockchain} transaction is not implemented by the signer.`\n );\n }\n // Initialize ECC library\n bitcoin.initEccLib(secp256k1);\n\n const signedPSBTBytes = await this.provider.signPSBT(\n base64ToUint8Array(psbt.unsignedPsbtBase64),\n {\n inputsToSign: psbt.inputsToSign,\n }\n );\n\n // Finalize PSBT\n const finalPsbt = bitcoin.Psbt.fromBuffer(Buffer.from(signedPSBTBytes));\n finalPsbt.finalizeAllInputs();\n\n const finalPsbtBaseHex = finalPsbt.extractTransaction().toHex();\n\n // Broadcast PSBT to rpc node\n const response = await fetch(BTC_RPC_URL, {\n method: 'POST',\n body: JSON.stringify({\n method: 'sendrawtransaction',\n params: [finalPsbtBaseHex],\n }),\n });\n\n if (!response.ok) {\n // Handle network and fetch errors\n const errorText = await response.text();\n throw new Error(`Error broadcasting transaction: ${errorText}`);\n }\n\n const data = await response.json();\n\n if (!data.result) {\n // Handle Bitcoin specific errors\n throw new Error(\n `Error broadcasting transaction. Error Code ${data.error.code}: ${data.error.message}`\n );\n }\n\n return { hash: data.result };\n }\n}\n", "import { defineVersions } from '@hub3js/core/utils';\n\nimport { buildProvider } from './provider.js';\n\nconst versions = () =>\n defineVersions().version('1.0.0', buildProvider()).build();\n\nexport { versions };\nexport { WALLET_ID } from './constants.js';\n", "import { ProviderBuilder } from '@hub3js/core';\n\nimport { metadata, WALLET_ID } from './constants.js';\nimport { evm } from './namespaces/evm.js';\nimport { solana } from './namespaces/solana.js';\nimport { sui } from './namespaces/sui.js';\nimport { phantom as phantomInstance } from './utils.js';\n\nconst buildProvider = () =>\n new ProviderBuilder(WALLET_ID)\n .init(function (context) {\n const [, setState] = context.state();\n\n if (phantomInstance()) {\n setState('installed', true);\n console.debug('[phantom] instance detected.', context);\n }\n })\n .config('metadata', metadata)\n .add('solana', solana)\n .add('evm', evm)\n .add('sui', sui)\n .build();\n\nexport { buildProvider };\n", "import type { ProviderMetadata } from '@hub3js/core';\n\nimport {\n CAIP_BASE_CHAIN_ID,\n CAIP_ETHEREUM_CHAIN_ID,\n CAIP_POLYGON_CHAIN_ID,\n isEvmNamespace,\n} from '@hub3js/evm';\nimport { isSolanaNamespace } from '@hub3js/solana';\nimport { getChainIdFromCaip2ChainId } from '@hub3js/std/utils';\nimport { isSuiNamespace } from '@hub3js/sui';\n\nimport getSigners from './signer.js';\nimport { getInstanceOrThrow } from './utils.js';\n\nexport const EVM_SUPPORTED_CHAINS = [\n CAIP_ETHEREUM_CHAIN_ID,\n CAIP_POLYGON_CHAIN_ID,\n CAIP_BASE_CHAIN_ID,\n];\n\nexport const WALLET_ID = 'phantom';\nexport const WALLET_NAME_IN_WALLET_STANDARD = 'Phantom';\n\nexport const metadata: ProviderMetadata = {\n name: 'Phantom',\n icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/phantom/icon.svg',\n extensions: {\n chrome:\n 'https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa',\n homepage: 'https://phantom.app/',\n },\n properties: [\n {\n name: 'namespaces',\n value: {\n selection: 'multiple',\n data: [\n {\n label: 'EVM',\n value: 'EVM',\n id: 'ETH',\n isChainSupported: (chainId: string) =>\n isEvmNamespace(chainId) &&\n EVM_SUPPORTED_CHAINS.includes(\n getChainIdFromCaip2ChainId(chainId)\n ),\n },\n {\n label: 'Solana',\n value: 'Solana',\n id: 'SOLANA',\n isChainSupported: isSolanaNamespace,\n },\n {\n label: 'Sui',\n value: 'Sui',\n id: 'SUI',\n isChainSupported: isSuiNamespace,\n },\n ],\n },\n },\n {\n name: 'signers',\n value: { getSigners: async () => getSigners(getInstanceOrThrow()) },\n },\n ],\n};\n", "import type { Provider } from './utils.js';\nimport type { SignerFactory } from 'rango-types';\n\nimport {\n EVM_NAMESPACE,\n SOLANA_NAMESPACE,\n UTXO_NAMESPACE,\n} from '@hub3js/namespaces';\nimport { getInstance as getSuiInstance } from '@hub3js/sui';\nimport { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';\n\nimport { WALLET_NAME_IN_WALLET_STANDARD } from './constants.js';\n\nexport default async function getSigners(\n provider: Provider\n): Promise<SignerFactory> {\n const solProvider = provider.get(SOLANA_NAMESPACE);\n const evmProvider = provider.get(EVM_NAMESPACE);\n const bitcoinInstance = provider.get(UTXO_NAMESPACE);\n\n const suiProvider = getSuiInstance(WALLET_NAME_IN_WALLET_STANDARD);\n\n const { DefaultEvmSigner } = await import('@rango-dev/signer-evm');\n const { DefaultSolanaSigner } = await import('@rango-dev/signer-solana');\n const { BTCSigner } = await import('./signers/utxoSigner.js');\n const { DefaultSuiSigner } = await import('@rango-dev/signer-sui');\n const signers = new DefaultSignerFactory();\n if (!!solProvider) {\n signers.registerSigner(TxType.SOLANA, new DefaultSolanaSigner(solProvider));\n }\n if (!!evmProvider) {\n signers.registerSigner(TxType.EVM, new DefaultEvmSigner(evmProvider));\n }\n if (!!bitcoinInstance) {\n signers.registerSigner(TxType.TRANSFER, new BTCSigner(bitcoinInstance));\n }\n if (!!suiProvider) {\n signers.registerSigner(TxType.SUI, new DefaultSuiSigner(suiProvider));\n }\n return signers;\n}\n", "import type { ProviderAPI as UtxoProviderApi } from '@hub3js/bip122';\nimport type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';\nimport type { ProviderAPI as SolanaProviderApi } from '@hub3js/solana';\nimport type { InstanceMap } from '@hub3js/std/types';\nimport type { ProviderAPI as SuiProviderApi } from '@hub3js/sui';\nimport type { SolanaExternalProvider } from '@rango-dev/signer-solana';\n\nimport {\n EVM_NAMESPACE,\n SOLANA_NAMESPACE,\n SUI_NAMESPACE,\n UTXO_NAMESPACE,\n} from '@hub3js/namespaces';\n\nexport type ProviderObject = {\n [EVM_NAMESPACE]: EvmProviderApi;\n [SOLANA_NAMESPACE]: SolanaExternalProvider;\n [UTXO_NAMESPACE]: UtxoProviderApi;\n [SUI_NAMESPACE]: SuiProviderApi;\n};\nexport type Provider = InstanceMap<ProviderObject>;\n\nexport function phantom(): Provider | null {\n const { phantom } = window;\n\n if (!phantom) {\n return null;\n }\n\n const { solana, ethereum, bitcoin, sui } = phantom;\n\n const instances: Provider = new Map();\n\n if (ethereum && ethereum.isPhantom) {\n instances.set(EVM_NAMESPACE, ethereum);\n }\n\n if (solana && solana.isPhantom) {\n instances.set(SOLANA_NAMESPACE, solana);\n }\n\n if (bitcoin && bitcoin.isPhantom) {\n instances.set(UTXO_NAMESPACE, bitcoin);\n }\n if (sui && sui.isPhantom) {\n instances.set(SUI_NAMESPACE, sui);\n }\n\n return instances;\n}\n\nexport function getInstanceOrThrow(): Provider {\n const instances = phantom();\n\n if (!instances) {\n throw new Error('Phantom is not injected. Please check your wallet.');\n }\n\n return instances;\n}\n\nexport function evmPhantom(): EvmProviderApi {\n const instances = phantom();\n\n const evmInstance = instances?.get(EVM_NAMESPACE);\n\n if (!evmInstance) {\n throw new Error(\n 'Phantom not injected or EVM not enabled. Please check your wallet.'\n );\n }\n\n return evmInstance;\n}\n\nexport function solanaPhantom(): SolanaProviderApi {\n const instance = phantom();\n const solanaInstance = instance?.get(SOLANA_NAMESPACE);\n\n if (!solanaInstance) {\n throw new Error(\n 'Phantom not injected or Solana not enabled. Please check your wallet.'\n );\n }\n\n return solanaInstance;\n}\n\nexport function bitcoinPhantom(): SolanaProviderApi {\n const instance = phantom();\n const bitcoinInstance = instance?.get(UTXO_NAMESPACE);\n\n if (!bitcoinInstance) {\n throw new Error(\n 'Phantom not injected or Bitcoin not enabled. Please check your wallet.'\n );\n }\n\n return bitcoinInstance;\n}\nexport function suiPhantom(): SuiProviderApi {\n const instance = phantom();\n const suiInstance = instance?.get(SUI_NAMESPACE);\n\n if (!suiInstance) {\n throw new Error(\n 'Phantom not injected or Sui not enabled. Please check your wallet.'\n );\n }\n\n return suiInstance;\n}\n\nexport type BtcAccount = {\n address: string;\n publicKey: string;\n addressType: 'p2tr' | 'p2wpkh' | 'p2sh' | 'p2pkh';\n purpose: 'payment' | 'ordinals';\n};\n", "import type { EvmActions } from '@hub3js/evm';\n\nimport { NamespaceBuilder } from '@hub3js/core';\nimport { actions, builders, hooks } from '@hub3js/evm';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\n\nimport { WALLET_ID } from '../constants.js';\nimport { evmPhantom } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] =\n hooks.changeAccountSubscriber(evmPhantom);\n\n/*\n * TODO: If user imported a private key for EVM, it hasn't solana.\n * when trying to connect to solana for this user we go through `-32603` which is an internal error.\n * If phantom added an specific error code for this situation, we can consider handling the error here.\n * @see https://docs.phantom.app/solana/errors\n */\nconst connect = builders\n .connect()\n .action(actions.connect(evmPhantom))\n .before(changeAccountSubscriber)\n .or(changeAccountCleanup)\n .or(standardizeAndThrowError)\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<EvmActions>()\n .after(changeAccountCleanup)\n .build();\n\nconst canEagerConnect = builders\n .canEagerConnect()\n .action(actions.canEagerConnect(evmPhantom))\n .build();\n\nconst canSwitchNetwork = builders\n .canSwitchNetwork()\n .action(actions.canSwitchNetwork())\n .build();\n\nconst getChainId = builders\n .getChainId()\n .action(actions.getChainId(evmPhantom))\n .build();\n\nconst evm = new NamespaceBuilder<EvmActions>('EVM', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .action(canSwitchNetwork)\n .action(getChainId)\n .build();\n\nexport { evm };\n", "import type { SolanaActions } from '@hub3js/solana';\n\nimport { ActionBuilder, NamespaceBuilder } from '@hub3js/core';\nimport { actions, builders, hooks } from '@hub3js/solana';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\n\nimport { WALLET_ID } from '../constants.js';\nimport { solanaPhantom } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] =\n hooks.changeAccountSubscriber(solanaPhantom);\n\n/*\n * TODO: If user imported a private key for EVM, it hasn't solana.\n * when trying to connect to solana for this user we go through `-32603` which is an internal error.\n * If phantom added an specific error code for this situation, we can consider handling the error here.\n * @see https://docs.phantom.app/solana/errors\n */\nconst connect = builders\n .connect()\n .action(actions.connect(solanaPhantom))\n .before(changeAccountSubscriber)\n .or(changeAccountCleanup)\n .or(standardizeAndThrowError)\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<SolanaActions>()\n .after(changeAccountCleanup)\n .build();\n\nconst canEagerConnect = new ActionBuilder<SolanaActions, 'canEagerConnect'>(\n 'canEagerConnect'\n)\n .action(actions.canEagerConnect(solanaPhantom))\n .build();\n\nconst solana = new NamespaceBuilder<SolanaActions>('Solana', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .build();\n\nexport { solana };\n", "import type { SolanaActions } from '@hub3js/solana';\nimport type { SuiActions } from '@hub3js/sui';\n\nimport { ActionBuilder, NamespaceBuilder } from '@hub3js/core';\nimport { actions as solanaActions } from '@hub3js/solana';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\nimport { builders, hooks } from '@hub3js/sui';\n\nimport { WALLET_ID, WALLET_NAME_IN_WALLET_STANDARD } from '../constants.js';\nimport { solanaPhantom } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] =\n hooks.changeAccountSubscriber({\n name: WALLET_NAME_IN_WALLET_STANDARD,\n });\n\nconst connect = builders\n .connect({\n name: WALLET_NAME_IN_WALLET_STANDARD,\n })\n .before(changeAccountSubscriber)\n .or(changeAccountCleanup)\n .or(standardizeAndThrowError)\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<SuiActions>()\n .after(changeAccountCleanup)\n .build();\n\n/*\n * TODO: We are currently using `solanaCanEagerConnectAction` to establish an eager connection to the Sui instance.\n * This is a temporary workaround due to Phantom's limitation in silently connecting to a Sui account.\n * Once Phantom introduces support for silent Sui connections, this implementation should be updated accordingly.\n */\nconst canEagerConnect = new ActionBuilder<SolanaActions, 'canEagerConnect'>(\n 'canEagerConnect'\n)\n .action(solanaActions.canEagerConnect(solanaPhantom))\n .build();\n\nconst sui = new NamespaceBuilder<SuiActions>('Sui', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .build();\n\nexport { sui };\n"],
|
|
5
|
-
"mappings": "gLAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,IAEA,UAAYC,MAAe,0BAC3B,OAAS,uBAAAC,MAA2B,kCACpC,UAAYC,MAAa,gBACzB,OAAS,eAAAC,MAAmB,cAQ5B,SAASC,EAAmBC,EAAsB,CAChD,IAAMC,EAAe,KAAKD,CAAY,EAChCE,EAASD,EAAa,OACtBE,EAAa,IAAI,WAAWD,CAAM,EAExC,QAAS,EAAI,EAAG,EAAIA,EAAQ,IAC1BC,EAAW,CAAC,EAAIF,EAAa,WAAW,CAAC,EAG3C,OAAOE,CACT,CAvBA,IAUMC,EAeOV,EAzBbW,EAAAC,EAAA,kBAUMF,EAAc,0DAGXG,EAAAR,EAAA,sBAYIL,EAAN,KAAmD,CAzB1D,MAyB0D,CAAAa,EAAA,kBAChD,SACR,YAAYC,EAAoC,CAC9C,KAAK,SAAWA,CAClB,CAEA,MAAM,aAA+B,CACnC,MAAMV,EAAY,mBAAmB,aAAa,CACpD,CAEA,MAAM,cAAcW,EAAyC,CAC3D,GAAM,CAAE,MAAAC,EAAO,KAAAC,CAAK,EAAIF,EAExB,GAAI,CAACE,EACH,MAAM,IAAI,MACR,yDACF,EAGF,GAAI,CAACf,EAAoBc,EAAM,UAAU,EACvC,MAAM,IAAI,MACR,WAAWA,EAAM,UAAU,gDAC7B,EAGM,aAAWf,CAAS,EAE5B,IAAMiB,EAAkB,MAAM,KAAK,SAAS,SAC1Cb,EAAmBY,EAAK,kBAAkB,EAC1C,CACE,aAAcA,EAAK,YACrB,CACF,EAGME,EAAoB,OAAK,WAAW,OAAO,KAAKD,CAAe,CAAC,EACtEC,EAAU,kBAAkB,EAE5B,IAAMC,EAAmBD,EAAU,mBAAmB,EAAE,MAAM,EAGxDE,EAAW,MAAM,MAAMX,EAAa,CACxC,OAAQ,OACR,KAAM,KAAK,UAAU,CACnB,OAAQ,qBACR,OAAQ,CAACU,CAAgB,CAC3B,CAAC,CACH,CAAC,EAED,GAAI,CAACC,EAAS,GAAI,CAEhB,IAAMC,EAAY,MAAMD,EAAS,KAAK,EACtC,MAAM,IAAI,MAAM,mCAAmCC,CAAS,EAAE,CAChE,CAEA,IAAMC,EAAO,MAAMF,EAAS,KAAK,EAEjC,GAAI,CAACE,EAAK,OAER,MAAM,IAAI,MACR,8CAA8CA,EAAK,MAAM,IAAI,KAAKA,EAAK,MAAM,OAAO,EACtF,EAGF,MAAO,CAAE,KAAMA,EAAK,MAAO,CAC7B,CACF,
|
|
4
|
+
"sourcesContent": ["import type { GenericSigner, Transfer } from 'rango-types';\n\nimport * as secp256k1 from '@bitcoinerlab/secp256k1';\nimport { isBitcoinBlockchain } from '@rango-dev/internal-blockchains';\nimport * as bitcoin from 'bitcoinjs-lib';\nimport { SignerError } from 'rango-types';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype TransferExternalProvider = any;\n\nconst BTC_RPC_URL = 'https://go.getblock.io/f37bad28a991436483c0a3679a3acbee';\n\n// TODO: use Uint8Array.fromBase64() static method and use this function as a polyfill after updating TypeScript DOM lib\nfunction base64ToUint8Array(base64String: string) {\n const binaryString = atob(base64String);\n const length = binaryString.length;\n const uint8Array = new Uint8Array(length);\n\n for (let i = 0; i < length; i++) {\n uint8Array[i] = binaryString.charCodeAt(i);\n }\n\n return uint8Array;\n}\n\nexport class BTCSigner implements GenericSigner<Transfer> {\n private provider: TransferExternalProvider;\n constructor(provider: TransferExternalProvider) {\n this.provider = provider;\n }\n\n async signMessage(): Promise<string> {\n throw SignerError.UnimplementedError('signMessage');\n }\n\n async signAndSendTx(tx: Transfer): Promise<{ hash: string }> {\n const { asset, psbt } = tx;\n\n if (!psbt) {\n throw new Error(\n 'No PSBT found to sign. Ensure a valid PSBT is provided.'\n );\n }\n\n if (!isBitcoinBlockchain(asset.blockchain)) {\n throw new Error(\n `Signing ${asset.blockchain} transaction is not implemented by the signer.`\n );\n }\n // Initialize ECC library\n bitcoin.initEccLib(secp256k1);\n\n const signedPSBTBytes = await this.provider.signPSBT(\n base64ToUint8Array(psbt.unsignedPsbtBase64),\n {\n inputsToSign: psbt.inputsToSign,\n }\n );\n\n // Finalize PSBT\n const finalPsbt = bitcoin.Psbt.fromBuffer(Buffer.from(signedPSBTBytes));\n finalPsbt.finalizeAllInputs();\n\n const finalPsbtBaseHex = finalPsbt.extractTransaction().toHex();\n\n // Broadcast PSBT to rpc node\n const response = await fetch(BTC_RPC_URL, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n jsonrpc: '2.0',\n id: 1,\n method: 'sendrawtransaction',\n params: [finalPsbtBaseHex],\n }),\n });\n\n if (!response.ok) {\n // Handle network and fetch errors\n const errorText = await response.text();\n throw new Error(`Error broadcasting transaction: ${errorText}`);\n }\n\n const data = await response.json();\n\n if (!data.result) {\n // Handle Bitcoin specific errors\n throw new Error(\n `Error broadcasting transaction. Error Code ${data.error.code}: ${data.error.message}`\n );\n }\n\n return { hash: data.result };\n }\n}\n", "import { defineVersions } from '@hub3js/core/utils';\n\nimport { buildProvider } from './provider.js';\n\nconst versions = () =>\n defineVersions().version('1.0.0', buildProvider()).build();\n\nexport { versions };\nexport { WALLET_ID } from './constants.js';\n", "import { ProviderBuilder } from '@hub3js/core';\n\nimport { metadata, WALLET_ID } from './constants.js';\nimport { evm } from './namespaces/evm.js';\nimport { solana } from './namespaces/solana.js';\nimport { sui } from './namespaces/sui.js';\nimport { phantom as phantomInstance } from './utils.js';\n\nconst buildProvider = () =>\n new ProviderBuilder(WALLET_ID)\n .init(function (context) {\n const [, setState] = context.state();\n\n if (phantomInstance()) {\n setState('installed', true);\n console.debug('[phantom] instance detected.', context);\n }\n })\n .config('metadata', metadata)\n .add('solana', solana)\n .add('evm', evm)\n .add('sui', sui)\n .build();\n\nexport { buildProvider };\n", "import type { ProviderMetadata } from '@hub3js/core';\n\nimport {\n CAIP_BASE_CHAIN_ID,\n CAIP_ETHEREUM_CHAIN_ID,\n CAIP_POLYGON_CHAIN_ID,\n isEvmNamespace,\n} from '@hub3js/evm';\nimport { isSolanaNamespace } from '@hub3js/solana';\nimport { getChainIdFromCaip2ChainId } from '@hub3js/std/utils';\nimport { isSuiNamespace } from '@hub3js/sui';\n\nimport getSigners from './signer.js';\nimport { getInstanceOrThrow } from './utils.js';\n\nexport const EVM_SUPPORTED_CHAINS = [\n CAIP_ETHEREUM_CHAIN_ID,\n CAIP_POLYGON_CHAIN_ID,\n CAIP_BASE_CHAIN_ID,\n];\n\nexport const WALLET_ID = 'phantom';\nexport const WALLET_NAME_IN_WALLET_STANDARD = 'Phantom';\n\nexport const metadata: ProviderMetadata = {\n name: 'Phantom',\n icon: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/phantom/icon.svg',\n extensions: {\n chrome:\n 'https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa',\n homepage: 'https://phantom.app/',\n },\n properties: [\n {\n name: 'namespaces',\n value: {\n selection: 'multiple',\n data: [\n {\n label: 'EVM',\n value: 'EVM',\n id: 'ETH',\n isChainSupported: (chainId: string) =>\n isEvmNamespace(chainId) &&\n EVM_SUPPORTED_CHAINS.includes(\n getChainIdFromCaip2ChainId(chainId)\n ),\n },\n {\n label: 'Solana',\n value: 'Solana',\n id: 'SOLANA',\n isChainSupported: isSolanaNamespace,\n },\n {\n label: 'Sui',\n value: 'Sui',\n id: 'SUI',\n isChainSupported: isSuiNamespace,\n },\n ],\n },\n },\n {\n name: 'signers',\n value: { getSigners: async () => getSigners(getInstanceOrThrow()) },\n },\n ],\n};\n", "import type { Provider } from './utils.js';\nimport type { SignerFactory } from 'rango-types';\n\nimport {\n EVM_NAMESPACE,\n SOLANA_NAMESPACE,\n UTXO_NAMESPACE,\n} from '@hub3js/namespaces';\nimport { getInstance as getSuiInstance } from '@hub3js/sui';\nimport { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';\n\nimport { WALLET_NAME_IN_WALLET_STANDARD } from './constants.js';\n\nexport default async function getSigners(\n provider: Provider\n): Promise<SignerFactory> {\n const solProvider = provider.get(SOLANA_NAMESPACE);\n const evmProvider = provider.get(EVM_NAMESPACE);\n const bitcoinInstance = provider.get(UTXO_NAMESPACE);\n\n const suiProvider = getSuiInstance(WALLET_NAME_IN_WALLET_STANDARD);\n\n const { DefaultEvmSigner } = await import('@rango-dev/signer-evm');\n const { DefaultSolanaSigner } = await import('@rango-dev/signer-solana');\n const { BTCSigner } = await import('./signers/utxoSigner.js');\n const { DefaultSuiSigner } = await import('@rango-dev/signer-sui');\n const signers = new DefaultSignerFactory();\n if (!!solProvider) {\n signers.registerSigner(TxType.SOLANA, new DefaultSolanaSigner(solProvider));\n }\n if (!!evmProvider) {\n signers.registerSigner(TxType.EVM, new DefaultEvmSigner(evmProvider));\n }\n if (!!bitcoinInstance) {\n signers.registerSigner(TxType.TRANSFER, new BTCSigner(bitcoinInstance));\n }\n if (!!suiProvider) {\n signers.registerSigner(TxType.SUI, new DefaultSuiSigner(suiProvider));\n }\n return signers;\n}\n", "import type { ProviderAPI as UtxoProviderApi } from '@hub3js/bip122';\nimport type { ProviderAPI as EvmProviderApi } from '@hub3js/evm';\nimport type { ProviderAPI as SolanaProviderApi } from '@hub3js/solana';\nimport type { InstanceMap } from '@hub3js/std/types';\nimport type { ProviderAPI as SuiProviderApi } from '@hub3js/sui';\nimport type { SolanaExternalProvider } from '@rango-dev/signer-solana';\n\nimport {\n EVM_NAMESPACE,\n SOLANA_NAMESPACE,\n SUI_NAMESPACE,\n UTXO_NAMESPACE,\n} from '@hub3js/namespaces';\n\nexport type ProviderObject = {\n [EVM_NAMESPACE]: EvmProviderApi;\n [SOLANA_NAMESPACE]: SolanaExternalProvider;\n [UTXO_NAMESPACE]: UtxoProviderApi;\n [SUI_NAMESPACE]: SuiProviderApi;\n};\nexport type Provider = InstanceMap<ProviderObject>;\n\nexport function phantom(): Provider | null {\n const { phantom } = window;\n\n if (!phantom) {\n return null;\n }\n\n const { solana, ethereum, bitcoin, sui } = phantom;\n\n const instances: Provider = new Map();\n\n if (ethereum && ethereum.isPhantom) {\n instances.set(EVM_NAMESPACE, ethereum);\n }\n\n if (solana && solana.isPhantom) {\n instances.set(SOLANA_NAMESPACE, solana);\n }\n\n if (bitcoin && bitcoin.isPhantom) {\n instances.set(UTXO_NAMESPACE, bitcoin);\n }\n if (sui && sui.isPhantom) {\n instances.set(SUI_NAMESPACE, sui);\n }\n\n return instances;\n}\n\nexport function getInstanceOrThrow(): Provider {\n const instances = phantom();\n\n if (!instances) {\n throw new Error('Phantom is not injected. Please check your wallet.');\n }\n\n return instances;\n}\n\nexport function evmPhantom(): EvmProviderApi {\n const instances = phantom();\n\n const evmInstance = instances?.get(EVM_NAMESPACE);\n\n if (!evmInstance) {\n throw new Error(\n 'Phantom not injected or EVM not enabled. Please check your wallet.'\n );\n }\n\n return evmInstance;\n}\n\nexport function solanaPhantom(): SolanaProviderApi {\n const instance = phantom();\n const solanaInstance = instance?.get(SOLANA_NAMESPACE);\n\n if (!solanaInstance) {\n throw new Error(\n 'Phantom not injected or Solana not enabled. Please check your wallet.'\n );\n }\n\n return solanaInstance;\n}\n\nexport function bitcoinPhantom(): SolanaProviderApi {\n const instance = phantom();\n const bitcoinInstance = instance?.get(UTXO_NAMESPACE);\n\n if (!bitcoinInstance) {\n throw new Error(\n 'Phantom not injected or Bitcoin not enabled. Please check your wallet.'\n );\n }\n\n return bitcoinInstance;\n}\nexport function suiPhantom(): SuiProviderApi {\n const instance = phantom();\n const suiInstance = instance?.get(SUI_NAMESPACE);\n\n if (!suiInstance) {\n throw new Error(\n 'Phantom not injected or Sui not enabled. Please check your wallet.'\n );\n }\n\n return suiInstance;\n}\n\nexport type BtcAccount = {\n address: string;\n publicKey: string;\n addressType: 'p2tr' | 'p2wpkh' | 'p2sh' | 'p2pkh';\n purpose: 'payment' | 'ordinals';\n};\n", "import type { EvmActions } from '@hub3js/evm';\n\nimport { NamespaceBuilder } from '@hub3js/core';\nimport { actions, builders, hooks } from '@hub3js/evm';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\n\nimport { WALLET_ID } from '../constants.js';\nimport { evmPhantom } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] =\n hooks.changeAccountSubscriber(evmPhantom);\n\n/*\n * TODO: If user imported a private key for EVM, it hasn't solana.\n * when trying to connect to solana for this user we go through `-32603` which is an internal error.\n * If phantom added an specific error code for this situation, we can consider handling the error here.\n * @see https://docs.phantom.app/solana/errors\n */\nconst connect = builders\n .connect()\n .action(actions.connect(evmPhantom))\n .before(changeAccountSubscriber)\n .or(changeAccountCleanup)\n .or(standardizeAndThrowError)\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<EvmActions>()\n .after(changeAccountCleanup)\n .build();\n\nconst canEagerConnect = builders\n .canEagerConnect()\n .action(actions.canEagerConnect(evmPhantom))\n .build();\n\nconst canSwitchNetwork = builders\n .canSwitchNetwork()\n .action(actions.canSwitchNetwork())\n .build();\n\nconst getChainId = builders\n .getChainId()\n .action(actions.getChainId(evmPhantom))\n .build();\n\nconst evm = new NamespaceBuilder<EvmActions>('EVM', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .action(canSwitchNetwork)\n .action(getChainId)\n .build();\n\nexport { evm };\n", "import type { SolanaActions } from '@hub3js/solana';\n\nimport { ActionBuilder, NamespaceBuilder } from '@hub3js/core';\nimport { actions, builders, hooks } from '@hub3js/solana';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\n\nimport { WALLET_ID } from '../constants.js';\nimport { solanaPhantom } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] =\n hooks.changeAccountSubscriber(solanaPhantom);\n\n/*\n * TODO: If user imported a private key for EVM, it hasn't solana.\n * when trying to connect to solana for this user we go through `-32603` which is an internal error.\n * If phantom added an specific error code for this situation, we can consider handling the error here.\n * @see https://docs.phantom.app/solana/errors\n */\nconst connect = builders\n .connect()\n .action(actions.connect(solanaPhantom))\n .before(changeAccountSubscriber)\n .or(changeAccountCleanup)\n .or(standardizeAndThrowError)\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<SolanaActions>()\n .after(changeAccountCleanup)\n .build();\n\nconst canEagerConnect = new ActionBuilder<SolanaActions, 'canEagerConnect'>(\n 'canEagerConnect'\n)\n .action(actions.canEagerConnect(solanaPhantom))\n .build();\n\nconst solana = new NamespaceBuilder<SolanaActions>('Solana', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .build();\n\nexport { solana };\n", "import type { SolanaActions } from '@hub3js/solana';\nimport type { SuiActions } from '@hub3js/sui';\n\nimport { ActionBuilder, NamespaceBuilder } from '@hub3js/core';\nimport { actions as solanaActions } from '@hub3js/solana';\nimport * as commonBuilders from '@hub3js/std/builders';\nimport { standardizeAndThrowError } from '@hub3js/std/operators';\nimport { builders, hooks } from '@hub3js/sui';\n\nimport { WALLET_ID, WALLET_NAME_IN_WALLET_STANDARD } from '../constants.js';\nimport { solanaPhantom } from '../utils.js';\n\nconst [changeAccountSubscriber, changeAccountCleanup] =\n hooks.changeAccountSubscriber({\n name: WALLET_NAME_IN_WALLET_STANDARD,\n });\n\nconst connect = builders\n .connect({\n name: WALLET_NAME_IN_WALLET_STANDARD,\n })\n .before(changeAccountSubscriber)\n .or(changeAccountCleanup)\n .or(standardizeAndThrowError)\n .build();\n\nconst disconnect = commonBuilders\n .disconnect<SuiActions>()\n .after(changeAccountCleanup)\n .build();\n\n/*\n * TODO: We are currently using `solanaCanEagerConnectAction` to establish an eager connection to the Sui instance.\n * This is a temporary workaround due to Phantom's limitation in silently connecting to a Sui account.\n * Once Phantom introduces support for silent Sui connections, this implementation should be updated accordingly.\n */\nconst canEagerConnect = new ActionBuilder<SolanaActions, 'canEagerConnect'>(\n 'canEagerConnect'\n)\n .action(solanaActions.canEagerConnect(solanaPhantom))\n .build();\n\nconst sui = new NamespaceBuilder<SuiActions>('Sui', WALLET_ID)\n .action(connect)\n .action(disconnect)\n .action(canEagerConnect)\n .build();\n\nexport { sui };\n"],
|
|
5
|
+
"mappings": "gLAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,IAEA,UAAYC,MAAe,0BAC3B,OAAS,uBAAAC,MAA2B,kCACpC,UAAYC,MAAa,gBACzB,OAAS,eAAAC,MAAmB,cAQ5B,SAASC,EAAmBC,EAAsB,CAChD,IAAMC,EAAe,KAAKD,CAAY,EAChCE,EAASD,EAAa,OACtBE,EAAa,IAAI,WAAWD,CAAM,EAExC,QAAS,EAAI,EAAG,EAAIA,EAAQ,IAC1BC,EAAW,CAAC,EAAIF,EAAa,WAAW,CAAC,EAG3C,OAAOE,CACT,CAvBA,IAUMC,EAeOV,E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AASC,EAAc,CAAC,EAAE,MAAM,EAD1C",
|
|
6
6
|
"names": ["utxoSigner_exports", "__export", "BTCSigner", "secp256k1", "isBitcoinBlockchain", "bitcoin", "SignerError", "base64ToUint8Array", "base64String", "binaryString", "length", "uint8Array", "BTC_RPC_URL", "init_utxoSigner", "__esmMin", "__name", "provider", "tx", "asset", "psbt", "signedPSBTBytes", "finalPsbt", "finalPsbtBaseHex", "response", "errorText", "data", "defineVersions", "ProviderBuilder", "CAIP_BASE_CHAIN_ID", "CAIP_ETHEREUM_CHAIN_ID", "CAIP_POLYGON_CHAIN_ID", "isEvmNamespace", "isSolanaNamespace", "getChainIdFromCaip2ChainId", "isSuiNamespace", "EVM_NAMESPACE", "SOLANA_NAMESPACE", "UTXO_NAMESPACE", "getSuiInstance", "DefaultSignerFactory", "TxType", "getSigners", "provider", "solProvider", "SOLANA_NAMESPACE", "evmProvider", "EVM_NAMESPACE", "bitcoinInstance", "UTXO_NAMESPACE", "suiProvider", "getSuiInstance", "WALLET_NAME_IN_WALLET_STANDARD", "DefaultEvmSigner", "DefaultSolanaSigner", "BTCSigner", "DefaultSuiSigner", "signers", "DefaultSignerFactory", "TxType", "__name", "EVM_NAMESPACE", "SOLANA_NAMESPACE", "SUI_NAMESPACE", "UTXO_NAMESPACE", "phantom", "solana", "ethereum", "bitcoin", "sui", "instances", "EVM_NAMESPACE", "SOLANA_NAMESPACE", "UTXO_NAMESPACE", "SUI_NAMESPACE", "__name", "getInstanceOrThrow", "evmPhantom", "evmInstance", "solanaPhantom", "solanaInstance", "EVM_SUPPORTED_CHAINS", "CAIP_ETHEREUM_CHAIN_ID", "CAIP_POLYGON_CHAIN_ID", "CAIP_BASE_CHAIN_ID", "WALLET_ID", "WALLET_NAME_IN_WALLET_STANDARD", "metadata", "chainId", "isEvmNamespace", "getChainIdFromCaip2ChainId", "isSolanaNamespace", "isSuiNamespace", "getSigners", "getInstanceOrThrow", "NamespaceBuilder", "actions", "builders", "hooks", "commonBuilders", "standardizeAndThrowError", "changeAccountSubscriber", "changeAccountCleanup", "hooks", "evmPhantom", "connect", "builders", "actions", "standardizeAndThrowError", "disconnect", "canEagerConnect", "canSwitchNetwork", "getChainId", "evm", "NamespaceBuilder", "WALLET_ID", "ActionBuilder", "NamespaceBuilder", "actions", "builders", "hooks", "commonBuilders", "standardizeAndThrowError", "changeAccountSubscriber", "changeAccountCleanup", "hooks", "solanaPhantom", "connect", "builders", "actions", "standardizeAndThrowError", "disconnect", "canEagerConnect", "ActionBuilder", "solana", "NamespaceBuilder", "WALLET_ID", "ActionBuilder", "NamespaceBuilder", "solanaActions", "commonBuilders", "standardizeAndThrowError", "builders", "hooks", "changeAccountSubscriber", "changeAccountCleanup", "hooks", "WALLET_NAME_IN_WALLET_STANDARD", "connect", "builders", "standardizeAndThrowError", "disconnect", "canEagerConnect", "ActionBuilder", "solanaActions", "solanaPhantom", "sui", "NamespaceBuilder", "WALLET_ID", "buildProvider", "__name", "ProviderBuilder", "WALLET_ID", "context", "setState", "phantom", "metadata", "solana", "evm", "sui", "versions", "__name", "defineVersions", "buildProvider"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utxoSigner.d.ts","sourceRoot":"","sources":["../../src/signers/utxoSigner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQ3D,KAAK,wBAAwB,GAAG,GAAG,CAAC;AAiBpC,qBAAa,SAAU,YAAW,aAAa,CAAC,QAAQ,CAAC;IACvD,OAAO,CAAC,QAAQ,CAA2B;gBAC/B,QAAQ,EAAE,wBAAwB;IAIxC,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAI9B,aAAa,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"utxoSigner.d.ts","sourceRoot":"","sources":["../../src/signers/utxoSigner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQ3D,KAAK,wBAAwB,GAAG,GAAG,CAAC;AAiBpC,qBAAa,SAAU,YAAW,aAAa,CAAC,QAAQ,CAAC;IACvD,OAAO,CAAC,QAAQ,CAA2B;gBAC/B,QAAQ,EAAE,wBAAwB;IAIxC,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAI9B,aAAa,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CA2D7D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/provider-phantom",
|
|
3
|
-
"version": "0.64.
|
|
3
|
+
"version": "0.64.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/mod.ts",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"typings": "dist/mod.d.ts",
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
14
|
-
"src"
|
|
14
|
+
"src",
|
|
15
|
+
"CHANGELOG.md"
|
|
15
16
|
],
|
|
16
17
|
"scripts": {
|
|
17
18
|
"build": "yarn run rangutopia library build",
|
|
@@ -31,10 +32,10 @@
|
|
|
31
32
|
"@hub3js/sui": "^0.4.0",
|
|
32
33
|
"@mysten/sui": "^1.21.2",
|
|
33
34
|
"@mysten/wallet-standard": "^0.13.26",
|
|
34
|
-
"@rango-dev/internal-blockchains": "^0.2.
|
|
35
|
-
"@rango-dev/signer-solana": "^0.
|
|
36
|
-
"@rango-dev/signer-sui": "^0.
|
|
37
|
-
"@rango-dev/wallets-core": "^0.62.
|
|
35
|
+
"@rango-dev/internal-blockchains": "^0.2.1",
|
|
36
|
+
"@rango-dev/signer-solana": "^0.50.0",
|
|
37
|
+
"@rango-dev/signer-sui": "^0.12.0",
|
|
38
|
+
"@rango-dev/wallets-core": "^0.62.1",
|
|
38
39
|
"bitcoinjs-lib": "^6.1.7",
|
|
39
40
|
"caip": "^1.1.1",
|
|
40
41
|
"rango-types": "^0.5.0"
|
|
@@ -66,7 +66,10 @@ export class BTCSigner implements GenericSigner<Transfer> {
|
|
|
66
66
|
// Broadcast PSBT to rpc node
|
|
67
67
|
const response = await fetch(BTC_RPC_URL, {
|
|
68
68
|
method: 'POST',
|
|
69
|
+
headers: { 'Content-Type': 'application/json' },
|
|
69
70
|
body: JSON.stringify({
|
|
71
|
+
jsonrpc: '2.0',
|
|
72
|
+
id: 1,
|
|
70
73
|
method: 'sendrawtransaction',
|
|
71
74
|
params: [finalPsbtBaseHex],
|
|
72
75
|
}),
|