@sats-connect/core 0.4.0-ff58e17 → 0.4.1-78faa9d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +547 -554
- package/dist/index.d.ts +547 -554
- package/dist/index.js +677 -312
- package/dist/index.mjs +633 -301
- package/package.json +2 -3
package/dist/index.mjs
CHANGED
|
@@ -27,8 +27,7 @@ async function getProviderOrThrow(getProvider) {
|
|
|
27
27
|
return provider;
|
|
28
28
|
}
|
|
29
29
|
function getProviders() {
|
|
30
|
-
if (!window.btc_providers)
|
|
31
|
-
window.btc_providers = [];
|
|
30
|
+
if (!window.btc_providers) window.btc_providers = [];
|
|
32
31
|
return window.btc_providers;
|
|
33
32
|
}
|
|
34
33
|
function getProviderById(providerId) {
|
|
@@ -47,10 +46,7 @@ function removeDefaultProvider() {
|
|
|
47
46
|
localStorage.removeItem("sats-connect_defaultProvider");
|
|
48
47
|
}
|
|
49
48
|
function getSupportedWallets() {
|
|
50
|
-
const
|
|
51
|
-
const { xverse, ...defaultProviders } = DefaultAdaptersInfo;
|
|
52
|
-
const allProviders = [...ambientProviders, ...Object.values(defaultProviders)];
|
|
53
|
-
const wallets = allProviders.map((provider) => {
|
|
49
|
+
const wallets = Object.values(DefaultAdaptersInfo).map((provider) => {
|
|
54
50
|
{
|
|
55
51
|
return {
|
|
56
52
|
...provider,
|
|
@@ -63,11 +59,11 @@ function getSupportedWallets() {
|
|
|
63
59
|
|
|
64
60
|
// src/types.ts
|
|
65
61
|
import * as v2 from "valibot";
|
|
66
|
-
var BitcoinNetworkType = /* @__PURE__ */ ((
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return
|
|
62
|
+
var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
|
|
63
|
+
BitcoinNetworkType2["Mainnet"] = "Mainnet";
|
|
64
|
+
BitcoinNetworkType2["Testnet"] = "Testnet";
|
|
65
|
+
BitcoinNetworkType2["Signet"] = "Signet";
|
|
66
|
+
return BitcoinNetworkType2;
|
|
71
67
|
})(BitcoinNetworkType || {});
|
|
72
68
|
var RpcIdSchema = v2.optional(v2.union([v2.string(), v2.number(), v2.null()]));
|
|
73
69
|
var rpcRequestMessageSchema = v2.object({
|
|
@@ -84,7 +80,7 @@ var rpcRequestMessageSchema = v2.object({
|
|
|
84
80
|
v2.null()
|
|
85
81
|
])
|
|
86
82
|
),
|
|
87
|
-
id: RpcIdSchema
|
|
83
|
+
id: v2.unwrap(RpcIdSchema)
|
|
88
84
|
});
|
|
89
85
|
var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode2) => {
|
|
90
86
|
RpcErrorCode2[RpcErrorCode2["PARSE_ERROR"] = -32700] = "PARSE_ERROR";
|
|
@@ -113,16 +109,127 @@ var rpcResponseMessageSchema = v2.union([
|
|
|
113
109
|
]);
|
|
114
110
|
|
|
115
111
|
// src/request/index.ts
|
|
116
|
-
import * as
|
|
112
|
+
import * as v20 from "valibot";
|
|
117
113
|
|
|
118
|
-
// src/request/types/stxMethods.ts
|
|
114
|
+
// src/request/types/stxMethods/callContract.ts
|
|
115
|
+
import * as v3 from "valibot";
|
|
116
|
+
var stxCallContractMethodName = "stx_callContract";
|
|
117
|
+
var stxCallContractParamsSchema = v3.object({
|
|
118
|
+
/**
|
|
119
|
+
* The contract principal.
|
|
120
|
+
*
|
|
121
|
+
* E.g. `"SPKE...GD5C.my-contract"`
|
|
122
|
+
*/
|
|
123
|
+
contract: v3.string(),
|
|
124
|
+
/**
|
|
125
|
+
* The name of the function to call.
|
|
126
|
+
*
|
|
127
|
+
* Note: spec changes ongoing,
|
|
128
|
+
* https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
|
|
129
|
+
*/
|
|
130
|
+
functionName: v3.string(),
|
|
131
|
+
/**
|
|
132
|
+
* The function's arguments. The arguments are expected to be hex-encoded
|
|
133
|
+
* strings of Clarity values.
|
|
134
|
+
*
|
|
135
|
+
* To convert Clarity values to their hex representation, the `cvToString`
|
|
136
|
+
* helper from the `@stacks/transactions` package may be helpful.
|
|
137
|
+
*
|
|
138
|
+
* ```js
|
|
139
|
+
* import { cvToString } from '@stacks/transactions';
|
|
140
|
+
*
|
|
141
|
+
* const functionArgs = [someClarityValue1, someClarityValue2];
|
|
142
|
+
* const hexArgs = functionArgs.map(cvToString);
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
arguments: v3.optional(v3.array(v3.string()))
|
|
146
|
+
});
|
|
147
|
+
var stxCallContractResultSchema = v3.object({
|
|
148
|
+
/**
|
|
149
|
+
* The ID of the transaction.
|
|
150
|
+
*/
|
|
151
|
+
txid: v3.string(),
|
|
152
|
+
/**
|
|
153
|
+
* A Stacks transaction as a hex-encoded string.
|
|
154
|
+
*/
|
|
155
|
+
transaction: v3.string()
|
|
156
|
+
});
|
|
157
|
+
var stxCallContractRequestMessageSchema = v3.object({
|
|
158
|
+
...rpcRequestMessageSchema.entries,
|
|
159
|
+
...v3.object({
|
|
160
|
+
method: v3.literal(stxCallContractMethodName),
|
|
161
|
+
params: stxCallContractParamsSchema,
|
|
162
|
+
id: v3.string()
|
|
163
|
+
}).entries
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// src/request/types/stxMethods/deployContract.ts
|
|
119
167
|
import * as v4 from "valibot";
|
|
168
|
+
var stxDeployContractMethodName = "stx_deployContract";
|
|
169
|
+
var stxDeployContractParamsSchema = v4.object({
|
|
170
|
+
/**
|
|
171
|
+
* Name of the contract.
|
|
172
|
+
*/
|
|
173
|
+
name: v4.string(),
|
|
174
|
+
/**
|
|
175
|
+
* The source code of the Clarity contract.
|
|
176
|
+
*/
|
|
177
|
+
clarityCode: v4.string(),
|
|
178
|
+
/**
|
|
179
|
+
* The version of the Clarity contract.
|
|
180
|
+
*/
|
|
181
|
+
clarityVersion: v4.optional(v4.string())
|
|
182
|
+
});
|
|
183
|
+
var stxDeployContractResultSchema = v4.object({
|
|
184
|
+
/**
|
|
185
|
+
* The ID of the transaction.
|
|
186
|
+
*/
|
|
187
|
+
txid: v4.string(),
|
|
188
|
+
/**
|
|
189
|
+
* A Stacks transaction as a hex-encoded string.
|
|
190
|
+
*/
|
|
191
|
+
transaction: v4.string()
|
|
192
|
+
});
|
|
193
|
+
var stxDeployContractRequestMessageSchema = v4.object({
|
|
194
|
+
...rpcRequestMessageSchema.entries,
|
|
195
|
+
...v4.object({
|
|
196
|
+
method: v4.literal(stxDeployContractMethodName),
|
|
197
|
+
params: stxDeployContractParamsSchema,
|
|
198
|
+
id: v4.string()
|
|
199
|
+
}).entries
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// src/request/types/stxMethods/getAccounts.ts
|
|
203
|
+
import * as v5 from "valibot";
|
|
204
|
+
var stxGetAccountsMethodName = "stx_getAccounts";
|
|
205
|
+
var stxGetAccountsParamsSchema = v5.nullish(v5.null());
|
|
206
|
+
var stxGetAccountsResultSchema = v5.object({
|
|
207
|
+
/**
|
|
208
|
+
* The addresses generated for the given purposes.
|
|
209
|
+
*/
|
|
210
|
+
addresses: v5.array(
|
|
211
|
+
v5.object({
|
|
212
|
+
address: v5.string(),
|
|
213
|
+
publicKey: v5.string(),
|
|
214
|
+
gaiaHubUrl: v5.string(),
|
|
215
|
+
gaiaAppKey: v5.string()
|
|
216
|
+
})
|
|
217
|
+
)
|
|
218
|
+
});
|
|
219
|
+
var stxGetAccountsRequestMessageSchema = v5.object({
|
|
220
|
+
...rpcRequestMessageSchema.entries,
|
|
221
|
+
...v5.object({
|
|
222
|
+
method: v5.literal(stxGetAccountsMethodName),
|
|
223
|
+
params: stxGetAccountsParamsSchema,
|
|
224
|
+
id: v5.string()
|
|
225
|
+
}).entries
|
|
226
|
+
});
|
|
120
227
|
|
|
121
228
|
// src/addresses/index.ts
|
|
122
229
|
import { createUnsecuredToken } from "jsontokens";
|
|
123
230
|
|
|
124
231
|
// src/addresses/types.ts
|
|
125
|
-
import * as
|
|
232
|
+
import * as v6 from "valibot";
|
|
126
233
|
var AddressPurpose = /* @__PURE__ */ ((AddressPurpose2) => {
|
|
127
234
|
AddressPurpose2["Ordinals"] = "ordinals";
|
|
128
235
|
AddressPurpose2["Payment"] = "payment";
|
|
@@ -138,11 +245,11 @@ var AddressType = /* @__PURE__ */ ((AddressType3) => {
|
|
|
138
245
|
AddressType3["stacks"] = "stacks";
|
|
139
246
|
return AddressType3;
|
|
140
247
|
})(AddressType || {});
|
|
141
|
-
var addressSchema =
|
|
142
|
-
address:
|
|
143
|
-
publicKey:
|
|
144
|
-
purpose:
|
|
145
|
-
addressType:
|
|
248
|
+
var addressSchema = v6.object({
|
|
249
|
+
address: v6.string(),
|
|
250
|
+
publicKey: v6.string(),
|
|
251
|
+
purpose: v6.enum(AddressPurpose),
|
|
252
|
+
addressType: v6.enum(AddressType)
|
|
146
253
|
});
|
|
147
254
|
|
|
148
255
|
// src/addresses/index.ts
|
|
@@ -162,167 +269,269 @@ var getAddress = async (options) => {
|
|
|
162
269
|
}
|
|
163
270
|
};
|
|
164
271
|
|
|
165
|
-
// src/request/types/stxMethods.ts
|
|
166
|
-
|
|
167
|
-
var
|
|
272
|
+
// src/request/types/stxMethods/getAddresses.ts
|
|
273
|
+
import * as v7 from "valibot";
|
|
274
|
+
var stxGetAddressesMethodName = "stx_getAddresses";
|
|
275
|
+
var stxGetAddressesParamsSchema = v7.nullish(
|
|
276
|
+
v7.object({
|
|
277
|
+
/**
|
|
278
|
+
* A message to be displayed to the user in the request prompt.
|
|
279
|
+
*/
|
|
280
|
+
message: v7.optional(v7.string())
|
|
281
|
+
})
|
|
282
|
+
);
|
|
283
|
+
var stxGetAddressesResultSchema = v7.object({
|
|
168
284
|
/**
|
|
169
|
-
* The
|
|
170
|
-
*
|
|
171
|
-
* E.g. `"SPKE...GD5C.my-contract"`
|
|
285
|
+
* The addresses generated for the given purposes.
|
|
172
286
|
*/
|
|
173
|
-
|
|
287
|
+
addresses: v7.array(addressSchema)
|
|
288
|
+
});
|
|
289
|
+
var stxGetAddressesRequestMessageSchema = v7.object({
|
|
290
|
+
...rpcRequestMessageSchema.entries,
|
|
291
|
+
...v7.object({
|
|
292
|
+
method: v7.literal(stxGetAddressesMethodName),
|
|
293
|
+
params: stxGetAddressesParamsSchema,
|
|
294
|
+
id: v7.string()
|
|
295
|
+
}).entries
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
// src/request/types/stxMethods/signMessage.ts
|
|
299
|
+
import * as v8 from "valibot";
|
|
300
|
+
var stxSignMessageMethodName = "stx_signMessage";
|
|
301
|
+
var stxSignMessageParamsSchema = v8.object({
|
|
174
302
|
/**
|
|
175
|
-
* The
|
|
176
|
-
*
|
|
177
|
-
* Note: spec changes ongoing,
|
|
178
|
-
* https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
|
|
303
|
+
* The message to sign.
|
|
179
304
|
*/
|
|
180
|
-
|
|
305
|
+
message: v8.string(),
|
|
181
306
|
/**
|
|
182
|
-
* The
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
* ```js
|
|
189
|
-
* import { cvToString } from '@stacks/transactions';
|
|
190
|
-
*
|
|
191
|
-
* const functionArgs = [someClarityValue1, someClarityValue2];
|
|
192
|
-
* const hexArgs = functionArgs.map(cvToString);
|
|
193
|
-
* ```
|
|
307
|
+
* The public key to sign the message with.
|
|
308
|
+
*/
|
|
309
|
+
publicKey: v8.string(),
|
|
310
|
+
/**
|
|
311
|
+
* The format version of the parameter.
|
|
194
312
|
*/
|
|
195
|
-
|
|
313
|
+
parameterFormatVersion: v8.optional(v8.number())
|
|
196
314
|
});
|
|
197
|
-
var
|
|
315
|
+
var stxSignMessageResultSchema = v8.object({
|
|
198
316
|
/**
|
|
199
|
-
* The
|
|
317
|
+
* The signature of the message.
|
|
200
318
|
*/
|
|
201
|
-
|
|
319
|
+
signature: v8.string(),
|
|
202
320
|
/**
|
|
203
|
-
*
|
|
321
|
+
* The public key used to sign the message.
|
|
204
322
|
*/
|
|
205
|
-
|
|
323
|
+
publicKey: v8.string()
|
|
206
324
|
});
|
|
207
|
-
var
|
|
325
|
+
var stxSignMessageRequestMessageSchema = v8.object({
|
|
208
326
|
...rpcRequestMessageSchema.entries,
|
|
209
|
-
...
|
|
210
|
-
method:
|
|
211
|
-
params:
|
|
212
|
-
id:
|
|
327
|
+
...v8.object({
|
|
328
|
+
method: v8.literal(stxSignMessageMethodName),
|
|
329
|
+
params: stxSignMessageParamsSchema,
|
|
330
|
+
id: v8.string()
|
|
213
331
|
}).entries
|
|
214
332
|
});
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
*/
|
|
221
|
-
message: v4.optional(v4.string())
|
|
222
|
-
})
|
|
223
|
-
);
|
|
224
|
-
var stxGetAddressesResultSchema = v4.object({
|
|
333
|
+
|
|
334
|
+
// src/request/types/stxMethods/signStructuredMessage.ts
|
|
335
|
+
import * as v9 from "valibot";
|
|
336
|
+
var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
|
|
337
|
+
var stxSignStructuredMessageParamsSchema = v9.object({
|
|
225
338
|
/**
|
|
226
|
-
* The
|
|
339
|
+
* The domain to be signed.
|
|
340
|
+
*/
|
|
341
|
+
domain: v9.string(),
|
|
342
|
+
/**
|
|
343
|
+
* Message payload to be signed.
|
|
344
|
+
*/
|
|
345
|
+
message: v9.string(),
|
|
346
|
+
/**
|
|
347
|
+
* The format version of the parameter.
|
|
348
|
+
*/
|
|
349
|
+
parameterFormatVersion: v9.optional(v9.number()),
|
|
350
|
+
/**
|
|
351
|
+
* The public key to sign the message with.
|
|
352
|
+
*/
|
|
353
|
+
publicKey: v9.optional(v9.string())
|
|
354
|
+
});
|
|
355
|
+
var stxSignStructuredMessageResultSchema = v9.object({
|
|
356
|
+
/**
|
|
357
|
+
* Signature of the message.
|
|
227
358
|
*/
|
|
228
|
-
|
|
359
|
+
signature: v9.string(),
|
|
360
|
+
/**
|
|
361
|
+
* Public key as hex-encoded string.
|
|
362
|
+
*/
|
|
363
|
+
publicKey: v9.string()
|
|
229
364
|
});
|
|
230
|
-
var
|
|
365
|
+
var stxSignStructuredMessageRequestMessageSchema = v9.object({
|
|
231
366
|
...rpcRequestMessageSchema.entries,
|
|
232
|
-
...
|
|
233
|
-
method:
|
|
234
|
-
params:
|
|
235
|
-
id:
|
|
367
|
+
...v9.object({
|
|
368
|
+
method: v9.literal(stxSignStructuredMessageMethodName),
|
|
369
|
+
params: stxSignStructuredMessageParamsSchema,
|
|
370
|
+
id: v9.string()
|
|
236
371
|
}).entries
|
|
237
372
|
});
|
|
373
|
+
|
|
374
|
+
// src/request/types/stxMethods/signTransaction.ts
|
|
375
|
+
import * as v10 from "valibot";
|
|
238
376
|
var stxSignTransactionMethodName = "stx_signTransaction";
|
|
239
|
-
var stxSignTransactionParamsSchema =
|
|
377
|
+
var stxSignTransactionParamsSchema = v10.object({
|
|
240
378
|
/**
|
|
241
379
|
* The transaction to sign as a hex-encoded string.
|
|
242
380
|
*/
|
|
243
|
-
transaction:
|
|
381
|
+
transaction: v10.string(),
|
|
244
382
|
/**
|
|
245
383
|
* The public key to sign the transaction with. The wallet may use any key
|
|
246
384
|
* when not provided.
|
|
247
385
|
*/
|
|
248
|
-
pubkey:
|
|
386
|
+
pubkey: v10.optional(v10.string()),
|
|
249
387
|
/**
|
|
250
388
|
* Whether to broadcast the transaction after signing. Defaults to `true`.
|
|
251
389
|
*/
|
|
252
|
-
broadcast:
|
|
390
|
+
broadcast: v10.optional(v10.boolean())
|
|
253
391
|
});
|
|
254
|
-
var stxSignTransactionResultSchema =
|
|
392
|
+
var stxSignTransactionResultSchema = v10.object({
|
|
255
393
|
/**
|
|
256
394
|
* The signed transaction as a hex-encoded string.
|
|
257
395
|
*/
|
|
258
|
-
transaction:
|
|
396
|
+
transaction: v10.string()
|
|
259
397
|
});
|
|
260
|
-
var stxSignTransactionRequestMessageSchema =
|
|
398
|
+
var stxSignTransactionRequestMessageSchema = v10.object({
|
|
261
399
|
...rpcRequestMessageSchema.entries,
|
|
262
|
-
...
|
|
263
|
-
method:
|
|
400
|
+
...v10.object({
|
|
401
|
+
method: v10.literal(stxSignTransactionMethodName),
|
|
264
402
|
params: stxSignTransactionParamsSchema,
|
|
265
|
-
id:
|
|
403
|
+
id: v10.string()
|
|
404
|
+
}).entries
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
// src/request/types/stxMethods/transferStx.ts
|
|
408
|
+
import * as v11 from "valibot";
|
|
409
|
+
var stxTransferStxMethodName = "stx_transferStx";
|
|
410
|
+
var stxTransferStxParamsSchema = v11.object({
|
|
411
|
+
/**
|
|
412
|
+
* Amount of STX tokens to transfer in microstacks as a string. Anything
|
|
413
|
+
* parseable by `BigInt` is acceptable.
|
|
414
|
+
*
|
|
415
|
+
* Example,
|
|
416
|
+
*
|
|
417
|
+
* ```js
|
|
418
|
+
* const amount1 = 1234;
|
|
419
|
+
* const amount2 = 1234n;
|
|
420
|
+
* const amount3 = '1234';
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
amount: v11.union([v11.number(), v11.string()]),
|
|
424
|
+
/**
|
|
425
|
+
* The recipeint's principal.
|
|
426
|
+
*/
|
|
427
|
+
recipient: v11.string(),
|
|
428
|
+
/**
|
|
429
|
+
* A string representing the memo.
|
|
430
|
+
*/
|
|
431
|
+
memo: v11.optional(v11.string()),
|
|
432
|
+
/**
|
|
433
|
+
* Version of parameter format.
|
|
434
|
+
*/
|
|
435
|
+
version: v11.optional(v11.string()),
|
|
436
|
+
/**
|
|
437
|
+
* The mode of the post conditions.
|
|
438
|
+
*/
|
|
439
|
+
postConditionMode: v11.optional(v11.number()),
|
|
440
|
+
/**
|
|
441
|
+
* A hex-encoded string representing the post conditions.
|
|
442
|
+
*
|
|
443
|
+
* A post condition may be converted to it's hex representation using the `serializePostCondition` helper from the `@stacks/transactions` package,
|
|
444
|
+
*
|
|
445
|
+
* ```js
|
|
446
|
+
* import { serializePostCondition } from '@stacks/transactions';
|
|
447
|
+
*
|
|
448
|
+
* const postCondition = somePostCondition;
|
|
449
|
+
* const hexPostCondition = serializePostCondition(postCondition).toString('hex');
|
|
450
|
+
* ```
|
|
451
|
+
*/
|
|
452
|
+
postConditions: v11.optional(v11.array(v11.string())),
|
|
453
|
+
/**
|
|
454
|
+
* The public key to sign the transaction with. The wallet may use any key
|
|
455
|
+
* when not provided.
|
|
456
|
+
*/
|
|
457
|
+
pubkey: v11.optional(v11.string())
|
|
458
|
+
});
|
|
459
|
+
var stxTransferStxResultSchema = v11.object({
|
|
460
|
+
/**
|
|
461
|
+
* The ID of the transaction.
|
|
462
|
+
*/
|
|
463
|
+
txid: v11.string(),
|
|
464
|
+
/**
|
|
465
|
+
* A Stacks transaction as a hex-encoded string.
|
|
466
|
+
*/
|
|
467
|
+
transaction: v11.string()
|
|
468
|
+
});
|
|
469
|
+
var stxTransferStxRequestMessageSchema = v11.object({
|
|
470
|
+
...rpcRequestMessageSchema.entries,
|
|
471
|
+
...v11.object({
|
|
472
|
+
method: v11.literal(stxTransferStxMethodName),
|
|
473
|
+
params: stxTransferStxParamsSchema,
|
|
474
|
+
id: v11.string()
|
|
266
475
|
}).entries
|
|
267
476
|
});
|
|
268
477
|
|
|
269
478
|
// src/request/types/btcMethods.ts
|
|
270
|
-
import * as
|
|
479
|
+
import * as v13 from "valibot";
|
|
271
480
|
|
|
272
481
|
// src/request/types/common.ts
|
|
273
|
-
import * as
|
|
482
|
+
import * as v12 from "valibot";
|
|
274
483
|
var walletTypes = ["software", "ledger"];
|
|
275
|
-
var walletTypeSchema =
|
|
484
|
+
var walletTypeSchema = v12.picklist(walletTypes);
|
|
276
485
|
|
|
277
486
|
// src/request/types/btcMethods.ts
|
|
278
487
|
var getInfoMethodName = "getInfo";
|
|
279
|
-
var getInfoParamsSchema =
|
|
280
|
-
var getInfoResultSchema =
|
|
488
|
+
var getInfoParamsSchema = v13.nullish(v13.null());
|
|
489
|
+
var getInfoResultSchema = v13.object({
|
|
281
490
|
/**
|
|
282
491
|
* Version of the wallet.
|
|
283
492
|
*/
|
|
284
|
-
version:
|
|
493
|
+
version: v13.string(),
|
|
285
494
|
/**
|
|
286
495
|
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
287
496
|
*/
|
|
288
|
-
methods:
|
|
497
|
+
methods: v13.optional(v13.array(v13.string())),
|
|
289
498
|
/**
|
|
290
499
|
* List of WBIP standards supported by the wallet. Not currently used.
|
|
291
500
|
*/
|
|
292
|
-
supports:
|
|
501
|
+
supports: v13.array(v13.string())
|
|
293
502
|
});
|
|
294
|
-
var getInfoRequestMessageSchema =
|
|
503
|
+
var getInfoRequestMessageSchema = v13.object({
|
|
295
504
|
...rpcRequestMessageSchema.entries,
|
|
296
|
-
...
|
|
297
|
-
method:
|
|
505
|
+
...v13.object({
|
|
506
|
+
method: v13.literal(getInfoMethodName),
|
|
298
507
|
params: getInfoParamsSchema,
|
|
299
|
-
id:
|
|
508
|
+
id: v13.string()
|
|
300
509
|
}).entries
|
|
301
510
|
});
|
|
302
511
|
var getAddressesMethodName = "getAddresses";
|
|
303
|
-
var getAddressesParamsSchema =
|
|
512
|
+
var getAddressesParamsSchema = v13.object({
|
|
304
513
|
/**
|
|
305
514
|
* The purposes for which to generate addresses. See
|
|
306
515
|
* {@linkcode AddressPurpose} for available purposes.
|
|
307
516
|
*/
|
|
308
|
-
purposes:
|
|
517
|
+
purposes: v13.array(v13.enum(AddressPurpose)),
|
|
309
518
|
/**
|
|
310
519
|
* A message to be displayed to the user in the request prompt.
|
|
311
520
|
*/
|
|
312
|
-
message:
|
|
521
|
+
message: v13.optional(v13.string())
|
|
313
522
|
});
|
|
314
|
-
var getAddressesResultSchema =
|
|
523
|
+
var getAddressesResultSchema = v13.object({
|
|
315
524
|
/**
|
|
316
525
|
* The addresses generated for the given purposes.
|
|
317
526
|
*/
|
|
318
|
-
addresses:
|
|
527
|
+
addresses: v13.array(addressSchema)
|
|
319
528
|
});
|
|
320
|
-
var getAddressesRequestMessageSchema =
|
|
529
|
+
var getAddressesRequestMessageSchema = v13.object({
|
|
321
530
|
...rpcRequestMessageSchema.entries,
|
|
322
|
-
...
|
|
323
|
-
method:
|
|
531
|
+
...v13.object({
|
|
532
|
+
method: v13.literal(getAddressesMethodName),
|
|
324
533
|
params: getAddressesParamsSchema,
|
|
325
|
-
id:
|
|
534
|
+
id: v13.string()
|
|
326
535
|
}).entries
|
|
327
536
|
});
|
|
328
537
|
var signMessageMethodName = "signMessage";
|
|
@@ -331,364 +540,456 @@ var MessageSigningProtocols = /* @__PURE__ */ ((MessageSigningProtocols2) => {
|
|
|
331
540
|
MessageSigningProtocols2["BIP322"] = "BIP322";
|
|
332
541
|
return MessageSigningProtocols2;
|
|
333
542
|
})(MessageSigningProtocols || {});
|
|
334
|
-
var signMessageParamsSchema =
|
|
543
|
+
var signMessageParamsSchema = v13.object({
|
|
335
544
|
/**
|
|
336
545
|
* The address used for signing.
|
|
337
546
|
**/
|
|
338
|
-
address:
|
|
547
|
+
address: v13.string(),
|
|
339
548
|
/**
|
|
340
549
|
* The message to sign.
|
|
341
550
|
**/
|
|
342
|
-
message:
|
|
551
|
+
message: v13.string(),
|
|
343
552
|
/**
|
|
344
553
|
* The protocol to use for signing the message.
|
|
345
554
|
*/
|
|
346
|
-
protocol:
|
|
555
|
+
protocol: v13.optional(v13.enum(MessageSigningProtocols))
|
|
347
556
|
});
|
|
348
|
-
var signMessageResultSchema =
|
|
557
|
+
var signMessageResultSchema = v13.object({
|
|
349
558
|
/**
|
|
350
559
|
* The signature of the message.
|
|
351
560
|
*/
|
|
352
|
-
signature:
|
|
561
|
+
signature: v13.string(),
|
|
353
562
|
/**
|
|
354
563
|
* hash of the message.
|
|
355
564
|
*/
|
|
356
|
-
messageHash:
|
|
565
|
+
messageHash: v13.string(),
|
|
357
566
|
/**
|
|
358
567
|
* The address used for signing.
|
|
359
568
|
*/
|
|
360
|
-
address:
|
|
569
|
+
address: v13.string(),
|
|
361
570
|
/**
|
|
362
571
|
* The protocol to use for signing the message.
|
|
363
572
|
*/
|
|
364
|
-
protocol:
|
|
573
|
+
protocol: v13.enum(MessageSigningProtocols)
|
|
365
574
|
});
|
|
366
|
-
var signMessageRequestMessageSchema =
|
|
575
|
+
var signMessageRequestMessageSchema = v13.object({
|
|
367
576
|
...rpcRequestMessageSchema.entries,
|
|
368
|
-
...
|
|
369
|
-
method:
|
|
577
|
+
...v13.object({
|
|
578
|
+
method: v13.literal(signMessageMethodName),
|
|
370
579
|
params: signMessageParamsSchema,
|
|
371
|
-
id:
|
|
580
|
+
id: v13.string()
|
|
372
581
|
}).entries
|
|
373
582
|
});
|
|
374
583
|
var sendTransferMethodName = "sendTransfer";
|
|
375
|
-
var sendTransferParamsSchema =
|
|
584
|
+
var sendTransferParamsSchema = v13.object({
|
|
376
585
|
/**
|
|
377
586
|
* Array of recipients to send to.
|
|
378
587
|
* The amount to send to each recipient is in satoshis.
|
|
379
588
|
*/
|
|
380
|
-
recipients:
|
|
381
|
-
|
|
382
|
-
address:
|
|
383
|
-
amount:
|
|
589
|
+
recipients: v13.array(
|
|
590
|
+
v13.object({
|
|
591
|
+
address: v13.string(),
|
|
592
|
+
amount: v13.number()
|
|
384
593
|
})
|
|
385
594
|
)
|
|
386
595
|
});
|
|
387
|
-
var sendTransferResultSchema =
|
|
596
|
+
var sendTransferResultSchema = v13.object({
|
|
388
597
|
/**
|
|
389
598
|
* The transaction id as a hex-encoded string.
|
|
390
599
|
*/
|
|
391
|
-
txid:
|
|
600
|
+
txid: v13.string()
|
|
392
601
|
});
|
|
393
|
-
var sendTransferRequestMessageSchema =
|
|
602
|
+
var sendTransferRequestMessageSchema = v13.object({
|
|
394
603
|
...rpcRequestMessageSchema.entries,
|
|
395
|
-
...
|
|
396
|
-
method:
|
|
604
|
+
...v13.object({
|
|
605
|
+
method: v13.literal(sendTransferMethodName),
|
|
397
606
|
params: sendTransferParamsSchema,
|
|
398
|
-
id:
|
|
607
|
+
id: v13.string()
|
|
399
608
|
}).entries
|
|
400
609
|
});
|
|
401
610
|
var signPsbtMethodName = "signPsbt";
|
|
402
|
-
var signPsbtParamsSchema =
|
|
611
|
+
var signPsbtParamsSchema = v13.object({
|
|
403
612
|
/**
|
|
404
613
|
* The base64 encoded PSBT to sign.
|
|
405
614
|
*/
|
|
406
|
-
psbt:
|
|
615
|
+
psbt: v13.string(),
|
|
407
616
|
/**
|
|
408
617
|
* The inputs to sign.
|
|
409
618
|
* The key is the address and the value is an array of indexes of the inputs to sign.
|
|
410
619
|
*/
|
|
411
|
-
signInputs:
|
|
412
|
-
allowedSignHash: v6.optional(v6.number()),
|
|
620
|
+
signInputs: v13.record(v13.string(), v13.array(v13.number())),
|
|
413
621
|
/**
|
|
414
622
|
* Whether to broadcast the transaction after signing.
|
|
415
623
|
**/
|
|
416
|
-
broadcast:
|
|
624
|
+
broadcast: v13.optional(v13.boolean())
|
|
417
625
|
});
|
|
418
|
-
var signPsbtResultSchema =
|
|
626
|
+
var signPsbtResultSchema = v13.object({
|
|
419
627
|
/**
|
|
420
628
|
* The base64 encoded PSBT after signing.
|
|
421
629
|
*/
|
|
422
|
-
psbt:
|
|
630
|
+
psbt: v13.string(),
|
|
423
631
|
/**
|
|
424
632
|
* The transaction id as a hex-encoded string.
|
|
425
633
|
* This is only returned if the transaction was broadcast.
|
|
426
634
|
**/
|
|
427
|
-
txid:
|
|
635
|
+
txid: v13.optional(v13.string())
|
|
428
636
|
});
|
|
429
|
-
var signPsbtRequestMessageSchema =
|
|
637
|
+
var signPsbtRequestMessageSchema = v13.object({
|
|
430
638
|
...rpcRequestMessageSchema.entries,
|
|
431
|
-
...
|
|
432
|
-
method:
|
|
639
|
+
...v13.object({
|
|
640
|
+
method: v13.literal(signPsbtMethodName),
|
|
433
641
|
params: signPsbtParamsSchema,
|
|
434
|
-
id:
|
|
642
|
+
id: v13.string()
|
|
435
643
|
}).entries
|
|
436
644
|
});
|
|
437
645
|
var getAccountsMethodName = "getAccounts";
|
|
438
|
-
var getAccountsParamsSchema =
|
|
646
|
+
var getAccountsParamsSchema = v13.object({
|
|
439
647
|
/**
|
|
440
648
|
* The purposes for which to generate addresses. See
|
|
441
649
|
* {@linkcode AddressPurpose} for available purposes.
|
|
442
650
|
*/
|
|
443
|
-
purposes:
|
|
651
|
+
purposes: v13.array(v13.enum(AddressPurpose)),
|
|
444
652
|
/**
|
|
445
653
|
* A message to be displayed to the user in the request prompt.
|
|
446
654
|
*/
|
|
447
|
-
message:
|
|
655
|
+
message: v13.optional(v13.string())
|
|
448
656
|
});
|
|
449
|
-
var getAccountsResultSchema =
|
|
450
|
-
|
|
657
|
+
var getAccountsResultSchema = v13.array(
|
|
658
|
+
v13.object({
|
|
451
659
|
...addressSchema.entries,
|
|
452
|
-
...
|
|
660
|
+
...v13.object({
|
|
453
661
|
walletType: walletTypeSchema
|
|
454
662
|
}).entries
|
|
455
663
|
})
|
|
456
664
|
);
|
|
457
|
-
var getAccountsRequestMessageSchema =
|
|
665
|
+
var getAccountsRequestMessageSchema = v13.object({
|
|
458
666
|
...rpcRequestMessageSchema.entries,
|
|
459
|
-
...
|
|
460
|
-
method:
|
|
667
|
+
...v13.object({
|
|
668
|
+
method: v13.literal(getAccountsMethodName),
|
|
461
669
|
params: getAccountsParamsSchema,
|
|
462
|
-
id:
|
|
670
|
+
id: v13.string()
|
|
463
671
|
}).entries
|
|
464
672
|
});
|
|
465
673
|
var getBalanceMethodName = "getBalance";
|
|
466
|
-
var getBalanceParamsSchema =
|
|
467
|
-
var getBalanceResultSchema =
|
|
674
|
+
var getBalanceParamsSchema = v13.nullish(v13.null());
|
|
675
|
+
var getBalanceResultSchema = v13.object({
|
|
468
676
|
/**
|
|
469
677
|
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
470
678
|
* messages not supporting bigint
|
|
471
679
|
* (https://issues.chromium.org/issues/40116184).
|
|
472
680
|
*/
|
|
473
|
-
confirmed:
|
|
681
|
+
confirmed: v13.string(),
|
|
474
682
|
/**
|
|
475
683
|
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
476
684
|
* messages not supporting bigint
|
|
477
685
|
* (https://issues.chromium.org/issues/40116184).
|
|
478
686
|
*/
|
|
479
|
-
unconfirmed:
|
|
687
|
+
unconfirmed: v13.string(),
|
|
480
688
|
/**
|
|
481
689
|
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
482
690
|
* sats. Using a string due to chrome messages not supporting bigint
|
|
483
691
|
* (https://issues.chromium.org/issues/40116184).
|
|
484
692
|
*/
|
|
485
|
-
total:
|
|
693
|
+
total: v13.string()
|
|
486
694
|
});
|
|
487
|
-
var getBalanceRequestMessageSchema =
|
|
695
|
+
var getBalanceRequestMessageSchema = v13.object({
|
|
488
696
|
...rpcRequestMessageSchema.entries,
|
|
489
|
-
...
|
|
490
|
-
method:
|
|
491
|
-
id:
|
|
697
|
+
...v13.object({
|
|
698
|
+
method: v13.literal(getBalanceMethodName),
|
|
699
|
+
id: v13.string()
|
|
492
700
|
}).entries
|
|
493
701
|
});
|
|
494
702
|
|
|
495
703
|
// src/request/types/walletMethods.ts
|
|
496
|
-
import * as
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
704
|
+
import * as v14 from "valibot";
|
|
705
|
+
var accountActionsSchema = v14.object({
|
|
706
|
+
read: v14.optional(v14.boolean())
|
|
707
|
+
});
|
|
708
|
+
var walletActionsSchema = v14.object({});
|
|
709
|
+
var accountPermissionSchema = v14.object({
|
|
710
|
+
type: v14.literal("account"),
|
|
711
|
+
resourceId: v14.string(),
|
|
712
|
+
clientId: v14.string(),
|
|
713
|
+
actions: accountActionsSchema
|
|
714
|
+
});
|
|
715
|
+
var walletPermissionSchema = v14.object({
|
|
716
|
+
type: v14.literal("wallet"),
|
|
717
|
+
resourceId: v14.string(),
|
|
718
|
+
clientId: v14.string(),
|
|
719
|
+
actions: walletActionsSchema
|
|
720
|
+
});
|
|
721
|
+
var PermissionRequestParams = v14.variant("type", [
|
|
722
|
+
v14.object({
|
|
723
|
+
...v14.omit(accountPermissionSchema, ["clientId"]).entries
|
|
502
724
|
}),
|
|
503
|
-
|
|
504
|
-
...
|
|
505
|
-
actions: v7.partial(permissions.resources.wallet.walletActionsSchema)
|
|
725
|
+
v14.object({
|
|
726
|
+
...v14.omit(walletPermissionSchema, ["clientId"]).entries
|
|
506
727
|
})
|
|
507
728
|
]);
|
|
729
|
+
var permission = v14.variant("type", [accountPermissionSchema, walletPermissionSchema]);
|
|
508
730
|
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
509
|
-
var requestPermissionsParamsSchema =
|
|
510
|
-
var requestPermissionsResultSchema =
|
|
511
|
-
var requestPermissionsRequestMessageSchema =
|
|
731
|
+
var requestPermissionsParamsSchema = v14.nullish(v14.array(PermissionRequestParams));
|
|
732
|
+
var requestPermissionsResultSchema = v14.literal(true);
|
|
733
|
+
var requestPermissionsRequestMessageSchema = v14.object({
|
|
512
734
|
...rpcRequestMessageSchema.entries,
|
|
513
|
-
...
|
|
514
|
-
method:
|
|
735
|
+
...v14.object({
|
|
736
|
+
method: v14.literal(requestPermissionsMethodName),
|
|
515
737
|
params: requestPermissionsParamsSchema,
|
|
516
|
-
id:
|
|
738
|
+
id: v14.string()
|
|
517
739
|
}).entries
|
|
518
740
|
});
|
|
519
741
|
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
520
|
-
var renouncePermissionsParamsSchema =
|
|
521
|
-
var renouncePermissionsResultSchema =
|
|
522
|
-
var renouncePermissionsRequestMessageSchema =
|
|
742
|
+
var renouncePermissionsParamsSchema = v14.nullish(v14.null());
|
|
743
|
+
var renouncePermissionsResultSchema = v14.nullish(v14.null());
|
|
744
|
+
var renouncePermissionsRequestMessageSchema = v14.object({
|
|
523
745
|
...rpcRequestMessageSchema.entries,
|
|
524
|
-
...
|
|
525
|
-
method:
|
|
746
|
+
...v14.object({
|
|
747
|
+
method: v14.literal(renouncePermissionsMethodName),
|
|
526
748
|
params: renouncePermissionsParamsSchema,
|
|
527
|
-
id:
|
|
749
|
+
id: v14.string()
|
|
528
750
|
}).entries
|
|
529
751
|
});
|
|
530
752
|
var disconnectMethodName = "wallet_disconnect";
|
|
531
|
-
var disconnectParamsSchema =
|
|
532
|
-
var disconnectResultSchema =
|
|
533
|
-
var disconnectRequestMessageSchema =
|
|
753
|
+
var disconnectParamsSchema = v14.nullish(v14.null());
|
|
754
|
+
var disconnectResultSchema = v14.nullish(v14.null());
|
|
755
|
+
var disconnectRequestMessageSchema = v14.object({
|
|
534
756
|
...rpcRequestMessageSchema.entries,
|
|
535
|
-
...
|
|
536
|
-
method:
|
|
757
|
+
...v14.object({
|
|
758
|
+
method: v14.literal(disconnectMethodName),
|
|
537
759
|
params: disconnectParamsSchema,
|
|
538
|
-
id:
|
|
760
|
+
id: v14.string()
|
|
539
761
|
}).entries
|
|
540
762
|
});
|
|
541
763
|
var getWalletTypeMethodName = "wallet_getWalletType";
|
|
542
|
-
var getWalletTypeParamsSchema =
|
|
764
|
+
var getWalletTypeParamsSchema = v14.nullish(v14.null());
|
|
543
765
|
var getWalletTypeResultSchema = walletTypeSchema;
|
|
544
|
-
var getWalletTypeRequestMessageSchema =
|
|
766
|
+
var getWalletTypeRequestMessageSchema = v14.object({
|
|
545
767
|
...rpcRequestMessageSchema.entries,
|
|
546
|
-
...
|
|
547
|
-
method:
|
|
768
|
+
...v14.object({
|
|
769
|
+
method: v14.literal(getWalletTypeMethodName),
|
|
548
770
|
params: getWalletTypeParamsSchema,
|
|
549
|
-
id:
|
|
771
|
+
id: v14.string()
|
|
550
772
|
}).entries
|
|
551
773
|
});
|
|
552
774
|
var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
|
|
553
|
-
var getCurrentPermissionsParamsSchema =
|
|
554
|
-
var getCurrentPermissionsResultSchema =
|
|
555
|
-
var getCurrentPermissionsRequestMessageSchema =
|
|
775
|
+
var getCurrentPermissionsParamsSchema = v14.nullish(v14.null());
|
|
776
|
+
var getCurrentPermissionsResultSchema = v14.array(permission);
|
|
777
|
+
var getCurrentPermissionsRequestMessageSchema = v14.object({
|
|
556
778
|
...rpcRequestMessageSchema.entries,
|
|
557
|
-
...
|
|
558
|
-
method:
|
|
779
|
+
...v14.object({
|
|
780
|
+
method: v14.literal(getCurrentPermissionsMethodName),
|
|
559
781
|
params: getCurrentPermissionsParamsSchema,
|
|
560
|
-
id:
|
|
782
|
+
id: v14.string()
|
|
561
783
|
}).entries
|
|
562
784
|
});
|
|
563
785
|
var getAccountMethodName = "wallet_getAccount";
|
|
564
|
-
var getAccountParamsSchema =
|
|
565
|
-
var getAccountResultSchema =
|
|
566
|
-
id:
|
|
567
|
-
addresses:
|
|
786
|
+
var getAccountParamsSchema = v14.nullish(v14.null());
|
|
787
|
+
var getAccountResultSchema = v14.object({
|
|
788
|
+
id: v14.string(),
|
|
789
|
+
addresses: v14.array(addressSchema),
|
|
568
790
|
walletType: walletTypeSchema
|
|
569
791
|
});
|
|
570
|
-
var getAccountRequestMessageSchema =
|
|
792
|
+
var getAccountRequestMessageSchema = v14.object({
|
|
571
793
|
...rpcRequestMessageSchema.entries,
|
|
572
|
-
...
|
|
573
|
-
method:
|
|
794
|
+
...v14.object({
|
|
795
|
+
method: v14.literal(getAccountMethodName),
|
|
574
796
|
params: getAccountParamsSchema,
|
|
575
|
-
id:
|
|
797
|
+
id: v14.string()
|
|
576
798
|
}).entries
|
|
577
799
|
});
|
|
578
800
|
var connectMethodName = "wallet_connect";
|
|
579
|
-
var connectParamsSchema =
|
|
580
|
-
|
|
581
|
-
permissions:
|
|
801
|
+
var connectParamsSchema = v14.nullish(
|
|
802
|
+
v14.object({
|
|
803
|
+
permissions: v14.optional(v14.array(PermissionRequestParams)),
|
|
804
|
+
addresses: v14.optional(v14.array(v14.enum(AddressPurpose))),
|
|
805
|
+
message: v14.optional(
|
|
806
|
+
v14.pipe(v14.string(), v14.maxLength(80, "The message must not exceed 80 characters."))
|
|
807
|
+
)
|
|
582
808
|
})
|
|
583
809
|
);
|
|
584
810
|
var connectResultSchema = getAccountResultSchema;
|
|
585
|
-
var connectRequestMessageSchema =
|
|
811
|
+
var connectRequestMessageSchema = v14.object({
|
|
586
812
|
...rpcRequestMessageSchema.entries,
|
|
587
|
-
...
|
|
588
|
-
method:
|
|
813
|
+
...v14.object({
|
|
814
|
+
method: v14.literal(connectMethodName),
|
|
589
815
|
params: connectParamsSchema,
|
|
590
|
-
id:
|
|
816
|
+
id: v14.string()
|
|
591
817
|
}).entries
|
|
592
818
|
});
|
|
593
819
|
|
|
594
|
-
// src/request/types/runesMethods.ts
|
|
595
|
-
import * as
|
|
596
|
-
var
|
|
597
|
-
var
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
820
|
+
// src/request/types/runesMethods/etch.ts
|
|
821
|
+
import * as v15 from "valibot";
|
|
822
|
+
var runesEtchMethodName = "runes_etch";
|
|
823
|
+
var etchTermsSchema = v15.object({
|
|
824
|
+
amount: v15.string(),
|
|
825
|
+
cap: v15.string(),
|
|
826
|
+
heightStart: v15.optional(v15.string()),
|
|
827
|
+
heightEnd: v15.optional(v15.string()),
|
|
828
|
+
offsetStart: v15.optional(v15.string()),
|
|
829
|
+
offsetEnd: v15.optional(v15.string())
|
|
830
|
+
});
|
|
831
|
+
var inscriptionDetailsSchema = v15.object({
|
|
832
|
+
contentType: v15.string(),
|
|
833
|
+
contentBase64: v15.string()
|
|
834
|
+
});
|
|
835
|
+
var runesEtchParamsSchema = v15.object({
|
|
836
|
+
runeName: v15.string(),
|
|
837
|
+
divisibility: v15.optional(v15.number()),
|
|
838
|
+
symbol: v15.optional(v15.string()),
|
|
839
|
+
premine: v15.optional(v15.string()),
|
|
840
|
+
isMintable: v15.boolean(),
|
|
841
|
+
delegateInscriptionId: v15.optional(v15.string()),
|
|
842
|
+
destinationAddress: v15.string(),
|
|
843
|
+
refundAddress: v15.string(),
|
|
844
|
+
feeRate: v15.number(),
|
|
845
|
+
appServiceFee: v15.optional(v15.number()),
|
|
846
|
+
appServiceFeeAddress: v15.optional(v15.string()),
|
|
847
|
+
terms: v15.optional(etchTermsSchema),
|
|
848
|
+
inscriptionDetails: v15.optional(inscriptionDetailsSchema),
|
|
849
|
+
network: v15.optional(v15.enum(BitcoinNetworkType))
|
|
850
|
+
});
|
|
851
|
+
var runesEtchResultSchema = v15.object({
|
|
852
|
+
orderId: v15.string(),
|
|
853
|
+
fundTransactionId: v15.string(),
|
|
854
|
+
fundingAddress: v15.string()
|
|
855
|
+
});
|
|
856
|
+
var runesEtchRequestMessageSchema = v15.object({
|
|
857
|
+
...rpcRequestMessageSchema.entries,
|
|
858
|
+
...v15.object({
|
|
859
|
+
method: v15.literal(runesEtchMethodName),
|
|
860
|
+
params: runesEtchParamsSchema,
|
|
861
|
+
id: v15.string()
|
|
862
|
+
}).entries
|
|
863
|
+
});
|
|
864
|
+
|
|
865
|
+
// src/request/types/runesMethods/getBalance.ts
|
|
866
|
+
import * as v16 from "valibot";
|
|
867
|
+
var runesGetBalanceMethodName = "runes_getBalance";
|
|
868
|
+
var runesGetBalanceParamsSchema = v16.nullish(v16.null());
|
|
869
|
+
var runesGetBalanceResultSchema = v16.object({
|
|
870
|
+
balances: v16.array(
|
|
871
|
+
v16.object({
|
|
872
|
+
runeName: v16.string(),
|
|
873
|
+
amount: v16.string(),
|
|
874
|
+
divisibility: v16.number(),
|
|
875
|
+
symbol: v16.string(),
|
|
876
|
+
inscriptionId: v16.nullish(v16.string())
|
|
606
877
|
})
|
|
607
878
|
)
|
|
608
879
|
});
|
|
609
|
-
var
|
|
880
|
+
var runesGetBalanceRequestMessageSchema = v16.object({
|
|
610
881
|
...rpcRequestMessageSchema.entries,
|
|
611
|
-
...
|
|
612
|
-
method:
|
|
613
|
-
params:
|
|
614
|
-
id:
|
|
882
|
+
...v16.object({
|
|
883
|
+
method: v16.literal(runesGetBalanceMethodName),
|
|
884
|
+
params: runesGetBalanceParamsSchema,
|
|
885
|
+
id: v16.string()
|
|
615
886
|
}).entries
|
|
616
887
|
});
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
888
|
+
|
|
889
|
+
// src/request/types/runesMethods/mint.ts
|
|
890
|
+
import * as v17 from "valibot";
|
|
891
|
+
var runesMintMethodName = "runes_mint";
|
|
892
|
+
var runesMintParamsSchema = v17.object({
|
|
893
|
+
appServiceFee: v17.optional(v17.number()),
|
|
894
|
+
appServiceFeeAddress: v17.optional(v17.string()),
|
|
895
|
+
destinationAddress: v17.string(),
|
|
896
|
+
feeRate: v17.number(),
|
|
897
|
+
refundAddress: v17.string(),
|
|
898
|
+
repeats: v17.number(),
|
|
899
|
+
runeName: v17.string(),
|
|
900
|
+
network: v17.optional(v17.enum(BitcoinNetworkType))
|
|
901
|
+
});
|
|
902
|
+
var runesMintResultSchema = v17.object({
|
|
903
|
+
orderId: v17.string(),
|
|
904
|
+
fundTransactionId: v17.string(),
|
|
905
|
+
fundingAddress: v17.string()
|
|
906
|
+
});
|
|
907
|
+
var runesMintRequestMessageSchema = v17.object({
|
|
908
|
+
...rpcRequestMessageSchema.entries,
|
|
909
|
+
...v17.object({
|
|
910
|
+
method: v17.literal(runesMintMethodName),
|
|
911
|
+
params: runesMintParamsSchema,
|
|
912
|
+
id: v17.string()
|
|
913
|
+
}).entries
|
|
914
|
+
});
|
|
915
|
+
|
|
916
|
+
// src/request/types/runesMethods/transfer.ts
|
|
917
|
+
import * as v18 from "valibot";
|
|
918
|
+
var runesTransferMethodName = "runes_transfer";
|
|
919
|
+
var runesTransferParamsSchema = v18.object({
|
|
920
|
+
recipients: v18.array(
|
|
921
|
+
v18.object({
|
|
922
|
+
runeName: v18.string(),
|
|
923
|
+
amount: v18.string(),
|
|
924
|
+
address: v18.string()
|
|
624
925
|
})
|
|
625
926
|
)
|
|
626
927
|
});
|
|
627
|
-
var
|
|
928
|
+
var runesTransferResultSchema = v18.object({
|
|
929
|
+
txid: v18.string()
|
|
930
|
+
});
|
|
931
|
+
var runesTransferRequestMessageSchema = v18.object({
|
|
628
932
|
...rpcRequestMessageSchema.entries,
|
|
629
|
-
...
|
|
630
|
-
method:
|
|
631
|
-
params:
|
|
632
|
-
id:
|
|
933
|
+
...v18.object({
|
|
934
|
+
method: v18.literal(runesTransferMethodName),
|
|
935
|
+
params: runesTransferParamsSchema,
|
|
936
|
+
id: v18.string()
|
|
633
937
|
}).entries
|
|
634
938
|
});
|
|
635
|
-
var TransferRunesResultSchema = v8.object({
|
|
636
|
-
txid: v8.string()
|
|
637
|
-
});
|
|
638
939
|
|
|
639
940
|
// src/request/types/ordinalsMethods.ts
|
|
640
|
-
import * as
|
|
941
|
+
import * as v19 from "valibot";
|
|
641
942
|
var getInscriptionsMethodName = "ord_getInscriptions";
|
|
642
|
-
var getInscriptionsParamsSchema =
|
|
643
|
-
offset:
|
|
644
|
-
limit:
|
|
645
|
-
});
|
|
646
|
-
var getInscriptionsResultSchema =
|
|
647
|
-
total:
|
|
648
|
-
limit:
|
|
649
|
-
offset:
|
|
650
|
-
inscriptions:
|
|
651
|
-
|
|
652
|
-
inscriptionId:
|
|
653
|
-
inscriptionNumber:
|
|
654
|
-
address:
|
|
655
|
-
collectionName:
|
|
656
|
-
postage:
|
|
657
|
-
contentLength:
|
|
658
|
-
contentType:
|
|
659
|
-
timestamp:
|
|
660
|
-
offset:
|
|
661
|
-
genesisTransaction:
|
|
662
|
-
output:
|
|
943
|
+
var getInscriptionsParamsSchema = v19.object({
|
|
944
|
+
offset: v19.number(),
|
|
945
|
+
limit: v19.number()
|
|
946
|
+
});
|
|
947
|
+
var getInscriptionsResultSchema = v19.object({
|
|
948
|
+
total: v19.number(),
|
|
949
|
+
limit: v19.number(),
|
|
950
|
+
offset: v19.number(),
|
|
951
|
+
inscriptions: v19.array(
|
|
952
|
+
v19.object({
|
|
953
|
+
inscriptionId: v19.string(),
|
|
954
|
+
inscriptionNumber: v19.string(),
|
|
955
|
+
address: v19.string(),
|
|
956
|
+
collectionName: v19.optional(v19.string()),
|
|
957
|
+
postage: v19.string(),
|
|
958
|
+
contentLength: v19.string(),
|
|
959
|
+
contentType: v19.string(),
|
|
960
|
+
timestamp: v19.number(),
|
|
961
|
+
offset: v19.number(),
|
|
962
|
+
genesisTransaction: v19.string(),
|
|
963
|
+
output: v19.string()
|
|
663
964
|
})
|
|
664
965
|
)
|
|
665
966
|
});
|
|
666
|
-
var
|
|
967
|
+
var getInscriptionsRequestMessageSchema = v19.object({
|
|
667
968
|
...rpcRequestMessageSchema.entries,
|
|
668
|
-
...
|
|
669
|
-
method:
|
|
969
|
+
...v19.object({
|
|
970
|
+
method: v19.literal(getInscriptionsMethodName),
|
|
670
971
|
params: getInscriptionsParamsSchema,
|
|
671
|
-
id:
|
|
972
|
+
id: v19.string()
|
|
672
973
|
}).entries
|
|
673
974
|
});
|
|
674
975
|
var sendInscriptionsMethodName = "ord_sendInscriptions";
|
|
675
|
-
var sendInscriptionsParamsSchema =
|
|
676
|
-
transfers:
|
|
677
|
-
|
|
678
|
-
address:
|
|
679
|
-
inscriptionId:
|
|
976
|
+
var sendInscriptionsParamsSchema = v19.object({
|
|
977
|
+
transfers: v19.array(
|
|
978
|
+
v19.object({
|
|
979
|
+
address: v19.string(),
|
|
980
|
+
inscriptionId: v19.string()
|
|
680
981
|
})
|
|
681
982
|
)
|
|
682
983
|
});
|
|
683
|
-
var sendInscriptionsResultSchema =
|
|
684
|
-
txid:
|
|
984
|
+
var sendInscriptionsResultSchema = v19.object({
|
|
985
|
+
txid: v19.string()
|
|
685
986
|
});
|
|
686
|
-
var
|
|
987
|
+
var sendInscriptionsRequestMessageSchema = v19.object({
|
|
687
988
|
...rpcRequestMessageSchema.entries,
|
|
688
|
-
...
|
|
689
|
-
method:
|
|
989
|
+
...v19.object({
|
|
990
|
+
method: v19.literal(sendInscriptionsMethodName),
|
|
690
991
|
params: sendInscriptionsParamsSchema,
|
|
691
|
-
id:
|
|
992
|
+
id: v19.string()
|
|
692
993
|
}).entries
|
|
693
994
|
});
|
|
694
995
|
|
|
@@ -705,13 +1006,13 @@ var request = async (method, params, providerId) => {
|
|
|
705
1006
|
throw new Error("A wallet method is required");
|
|
706
1007
|
}
|
|
707
1008
|
const response = await provider.request(method, params);
|
|
708
|
-
if (
|
|
1009
|
+
if (v20.is(rpcErrorResponseMessageSchema, response)) {
|
|
709
1010
|
return {
|
|
710
1011
|
status: "error",
|
|
711
1012
|
error: response.error
|
|
712
1013
|
};
|
|
713
1014
|
}
|
|
714
|
-
if (
|
|
1015
|
+
if (v20.is(rpcSuccessResponseMessageSchema, response)) {
|
|
715
1016
|
return {
|
|
716
1017
|
status: "success",
|
|
717
1018
|
result: response.result
|
|
@@ -1308,15 +1609,14 @@ var UnisatAdapter = class extends SatsConnectAdapter {
|
|
|
1308
1609
|
autoFinalized: broadcast,
|
|
1309
1610
|
toSignInputs: convertSignInputsToInputType(signInputs)
|
|
1310
1611
|
});
|
|
1612
|
+
const signedPsbtBase64 = Buffer.from(signedPsbt, "hex").toString("base64");
|
|
1613
|
+
let txid;
|
|
1311
1614
|
if (broadcast) {
|
|
1312
|
-
|
|
1313
|
-
return {
|
|
1314
|
-
psbt: signedPsbt,
|
|
1315
|
-
txid
|
|
1316
|
-
};
|
|
1615
|
+
txid = await window.unisat.pushPsbt(signedPsbt);
|
|
1317
1616
|
}
|
|
1318
1617
|
return {
|
|
1319
|
-
psbt:
|
|
1618
|
+
psbt: signedPsbtBase64,
|
|
1619
|
+
txid
|
|
1320
1620
|
};
|
|
1321
1621
|
}
|
|
1322
1622
|
requestInternal = async (method, params) => {
|
|
@@ -1467,8 +1767,7 @@ var extractOrValidateCapabilities = (provider, reportedCapabilities) => {
|
|
|
1467
1767
|
addListener: validateCapability("addListener")
|
|
1468
1768
|
};
|
|
1469
1769
|
return Object.entries(capabilityMap).reduce((acc, [capability, value]) => {
|
|
1470
|
-
if (value)
|
|
1471
|
-
return [...acc, capability];
|
|
1770
|
+
if (value) return [...acc, capability];
|
|
1472
1771
|
return acc;
|
|
1473
1772
|
}, []);
|
|
1474
1773
|
};
|
|
@@ -1659,12 +1958,14 @@ export {
|
|
|
1659
1958
|
BitcoinNetworkType,
|
|
1660
1959
|
DefaultAdaptersInfo,
|
|
1661
1960
|
MessageSigningProtocols,
|
|
1961
|
+
PermissionRequestParams,
|
|
1662
1962
|
RpcErrorCode,
|
|
1663
1963
|
RpcIdSchema,
|
|
1664
1964
|
SatsConnectAdapter,
|
|
1665
|
-
|
|
1965
|
+
accountActionsSchema,
|
|
1666
1966
|
accountChangeEventName,
|
|
1667
1967
|
accountChangeSchema,
|
|
1968
|
+
accountPermissionSchema,
|
|
1668
1969
|
addListener,
|
|
1669
1970
|
addressSchema,
|
|
1670
1971
|
connectMethodName,
|
|
@@ -1709,15 +2010,11 @@ export {
|
|
|
1709
2010
|
getInfoResultSchema,
|
|
1710
2011
|
getInscriptionsMethodName,
|
|
1711
2012
|
getInscriptionsParamsSchema,
|
|
2013
|
+
getInscriptionsRequestMessageSchema,
|
|
1712
2014
|
getInscriptionsResultSchema,
|
|
1713
|
-
getInscriptionsSchema,
|
|
1714
2015
|
getProviderById,
|
|
1715
2016
|
getProviderOrThrow,
|
|
1716
2017
|
getProviders,
|
|
1717
|
-
getRunesBalanceMethodName,
|
|
1718
|
-
getRunesBalanceParamsSchema,
|
|
1719
|
-
getRunesBalanceRequestMessageSchema,
|
|
1720
|
-
getRunesBalanceResultSchema,
|
|
1721
2018
|
getSupportedWallets,
|
|
1722
2019
|
getWalletTypeMethodName,
|
|
1723
2020
|
getWalletTypeParamsSchema,
|
|
@@ -1726,7 +2023,7 @@ export {
|
|
|
1726
2023
|
isProviderInstalled,
|
|
1727
2024
|
networkChangeEventName,
|
|
1728
2025
|
networkChangeSchema,
|
|
1729
|
-
|
|
2026
|
+
permission,
|
|
1730
2027
|
removeDefaultProvider,
|
|
1731
2028
|
renouncePermissionsMethodName,
|
|
1732
2029
|
renouncePermissionsParamsSchema,
|
|
@@ -1741,11 +2038,27 @@ export {
|
|
|
1741
2038
|
rpcRequestMessageSchema,
|
|
1742
2039
|
rpcResponseMessageSchema,
|
|
1743
2040
|
rpcSuccessResponseMessageSchema,
|
|
2041
|
+
runesEtchMethodName,
|
|
2042
|
+
runesEtchParamsSchema,
|
|
2043
|
+
runesEtchRequestMessageSchema,
|
|
2044
|
+
runesEtchResultSchema,
|
|
2045
|
+
runesGetBalanceMethodName,
|
|
2046
|
+
runesGetBalanceParamsSchema,
|
|
2047
|
+
runesGetBalanceRequestMessageSchema,
|
|
2048
|
+
runesGetBalanceResultSchema,
|
|
2049
|
+
runesMintMethodName,
|
|
2050
|
+
runesMintParamsSchema,
|
|
2051
|
+
runesMintRequestMessageSchema,
|
|
2052
|
+
runesMintResultSchema,
|
|
2053
|
+
runesTransferMethodName,
|
|
2054
|
+
runesTransferParamsSchema,
|
|
2055
|
+
runesTransferRequestMessageSchema,
|
|
2056
|
+
runesTransferResultSchema,
|
|
1744
2057
|
sendBtcTransaction,
|
|
1745
2058
|
sendInscriptionsMethodName,
|
|
1746
2059
|
sendInscriptionsParamsSchema,
|
|
2060
|
+
sendInscriptionsRequestMessageSchema,
|
|
1747
2061
|
sendInscriptionsResultSchema,
|
|
1748
|
-
sendInscriptionsSchema,
|
|
1749
2062
|
sendTransferMethodName,
|
|
1750
2063
|
sendTransferParamsSchema,
|
|
1751
2064
|
sendTransferRequestMessageSchema,
|
|
@@ -1766,18 +2079,37 @@ export {
|
|
|
1766
2079
|
stxCallContractParamsSchema,
|
|
1767
2080
|
stxCallContractRequestMessageSchema,
|
|
1768
2081
|
stxCallContractResultSchema,
|
|
2082
|
+
stxDeployContractMethodName,
|
|
2083
|
+
stxDeployContractParamsSchema,
|
|
2084
|
+
stxDeployContractRequestMessageSchema,
|
|
2085
|
+
stxDeployContractResultSchema,
|
|
2086
|
+
stxGetAccountsMethodName,
|
|
2087
|
+
stxGetAccountsParamsSchema,
|
|
2088
|
+
stxGetAccountsRequestMessageSchema,
|
|
2089
|
+
stxGetAccountsResultSchema,
|
|
1769
2090
|
stxGetAddressesMethodName,
|
|
1770
2091
|
stxGetAddressesParamsSchema,
|
|
1771
2092
|
stxGetAddressesRequestMessageSchema,
|
|
1772
2093
|
stxGetAddressesResultSchema,
|
|
2094
|
+
stxSignMessageMethodName,
|
|
2095
|
+
stxSignMessageParamsSchema,
|
|
2096
|
+
stxSignMessageRequestMessageSchema,
|
|
2097
|
+
stxSignMessageResultSchema,
|
|
2098
|
+
stxSignStructuredMessageMethodName,
|
|
2099
|
+
stxSignStructuredMessageParamsSchema,
|
|
2100
|
+
stxSignStructuredMessageRequestMessageSchema,
|
|
2101
|
+
stxSignStructuredMessageResultSchema,
|
|
1773
2102
|
stxSignTransactionMethodName,
|
|
1774
2103
|
stxSignTransactionParamsSchema,
|
|
1775
2104
|
stxSignTransactionRequestMessageSchema,
|
|
1776
2105
|
stxSignTransactionResultSchema,
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
2106
|
+
stxTransferStxMethodName,
|
|
2107
|
+
stxTransferStxParamsSchema,
|
|
2108
|
+
stxTransferStxRequestMessageSchema,
|
|
2109
|
+
stxTransferStxResultSchema,
|
|
2110
|
+
walletActionsSchema,
|
|
1780
2111
|
walletEventSchema,
|
|
2112
|
+
walletPermissionSchema,
|
|
1781
2113
|
walletTypeSchema,
|
|
1782
2114
|
walletTypes
|
|
1783
2115
|
};
|