@sats-connect/core 0.4.0-e8e6a66 → 0.4.0-f42fc9a
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 +525 -216
- package/dist/index.d.ts +525 -216
- package/dist/index.js +653 -254
- package/dist/index.mjs +611 -244
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39,7 +39,6 @@ __export(src_exports, {
|
|
|
39
39
|
RpcErrorCode: () => RpcErrorCode,
|
|
40
40
|
RpcIdSchema: () => RpcIdSchema,
|
|
41
41
|
SatsConnectAdapter: () => SatsConnectAdapter,
|
|
42
|
-
TransferRunesResultSchema: () => TransferRunesResultSchema,
|
|
43
42
|
accountChangeEventName: () => accountChangeEventName,
|
|
44
43
|
accountChangeSchema: () => accountChangeSchema,
|
|
45
44
|
addListener: () => addListener,
|
|
@@ -86,15 +85,11 @@ __export(src_exports, {
|
|
|
86
85
|
getInfoResultSchema: () => getInfoResultSchema,
|
|
87
86
|
getInscriptionsMethodName: () => getInscriptionsMethodName,
|
|
88
87
|
getInscriptionsParamsSchema: () => getInscriptionsParamsSchema,
|
|
88
|
+
getInscriptionsRequestMessageSchema: () => getInscriptionsRequestMessageSchema,
|
|
89
89
|
getInscriptionsResultSchema: () => getInscriptionsResultSchema,
|
|
90
|
-
getInscriptionsSchema: () => getInscriptionsSchema,
|
|
91
90
|
getProviderById: () => getProviderById,
|
|
92
91
|
getProviderOrThrow: () => getProviderOrThrow,
|
|
93
92
|
getProviders: () => getProviders,
|
|
94
|
-
getRunesBalanceMethodName: () => getRunesBalanceMethodName,
|
|
95
|
-
getRunesBalanceParamsSchema: () => getRunesBalanceParamsSchema,
|
|
96
|
-
getRunesBalanceRequestMessageSchema: () => getRunesBalanceRequestMessageSchema,
|
|
97
|
-
getRunesBalanceResultSchema: () => getRunesBalanceResultSchema,
|
|
98
93
|
getSupportedWallets: () => getSupportedWallets,
|
|
99
94
|
getWalletTypeMethodName: () => getWalletTypeMethodName,
|
|
100
95
|
getWalletTypeParamsSchema: () => getWalletTypeParamsSchema,
|
|
@@ -118,11 +113,27 @@ __export(src_exports, {
|
|
|
118
113
|
rpcRequestMessageSchema: () => rpcRequestMessageSchema,
|
|
119
114
|
rpcResponseMessageSchema: () => rpcResponseMessageSchema,
|
|
120
115
|
rpcSuccessResponseMessageSchema: () => rpcSuccessResponseMessageSchema,
|
|
116
|
+
runesEtchMethodName: () => runesEtchMethodName,
|
|
117
|
+
runesEtchParamsSchema: () => runesEtchParamsSchema,
|
|
118
|
+
runesEtchRequestMessageSchema: () => runesEtchRequestMessageSchema,
|
|
119
|
+
runesEtchResultSchema: () => runesEtchResultSchema,
|
|
120
|
+
runesGetBalanceMethodName: () => runesGetBalanceMethodName,
|
|
121
|
+
runesGetBalanceParamsSchema: () => runesGetBalanceParamsSchema,
|
|
122
|
+
runesGetBalanceRequestMessageSchema: () => runesGetBalanceRequestMessageSchema,
|
|
123
|
+
runesGetBalanceResultSchema: () => runesGetBalanceResultSchema,
|
|
124
|
+
runesMintMethodName: () => runesMintMethodName,
|
|
125
|
+
runesMintParamsSchema: () => runesMintParamsSchema,
|
|
126
|
+
runesMintRequestMessageSchema: () => runesMintRequestMessageSchema,
|
|
127
|
+
runesMintResultSchema: () => runesMintResultSchema,
|
|
128
|
+
runesTransferMethodName: () => runesTransferMethodName,
|
|
129
|
+
runesTransferParamsSchema: () => runesTransferParamsSchema,
|
|
130
|
+
runesTransferRequestMessageSchema: () => runesTransferRequestMessageSchema,
|
|
131
|
+
runesTransferResultSchema: () => runesTransferResultSchema,
|
|
121
132
|
sendBtcTransaction: () => sendBtcTransaction,
|
|
122
133
|
sendInscriptionsMethodName: () => sendInscriptionsMethodName,
|
|
123
134
|
sendInscriptionsParamsSchema: () => sendInscriptionsParamsSchema,
|
|
135
|
+
sendInscriptionsRequestMessageSchema: () => sendInscriptionsRequestMessageSchema,
|
|
124
136
|
sendInscriptionsResultSchema: () => sendInscriptionsResultSchema,
|
|
125
|
-
sendInscriptionsSchema: () => sendInscriptionsSchema,
|
|
126
137
|
sendTransferMethodName: () => sendTransferMethodName,
|
|
127
138
|
sendTransferParamsSchema: () => sendTransferParamsSchema,
|
|
128
139
|
sendTransferRequestMessageSchema: () => sendTransferRequestMessageSchema,
|
|
@@ -139,17 +150,38 @@ __export(src_exports, {
|
|
|
139
150
|
signPsbtRequestMessageSchema: () => signPsbtRequestMessageSchema,
|
|
140
151
|
signPsbtResultSchema: () => signPsbtResultSchema,
|
|
141
152
|
signTransaction: () => signTransaction,
|
|
153
|
+
stxCallContractMethodName: () => stxCallContractMethodName,
|
|
154
|
+
stxCallContractParamsSchema: () => stxCallContractParamsSchema,
|
|
155
|
+
stxCallContractRequestMessageSchema: () => stxCallContractRequestMessageSchema,
|
|
156
|
+
stxCallContractResultSchema: () => stxCallContractResultSchema,
|
|
157
|
+
stxDeployContractMethodName: () => stxDeployContractMethodName,
|
|
158
|
+
stxDeployContractParamsSchema: () => stxDeployContractParamsSchema,
|
|
159
|
+
stxDeployContractRequestMessageSchema: () => stxDeployContractRequestMessageSchema,
|
|
160
|
+
stxDeployContractResultSchema: () => stxDeployContractResultSchema,
|
|
161
|
+
stxGetAccountsMethodName: () => stxGetAccountsMethodName,
|
|
162
|
+
stxGetAccountsParamsSchema: () => stxGetAccountsParamsSchema,
|
|
163
|
+
stxGetAccountsRequestMessageSchema: () => stxGetAccountsRequestMessageSchema,
|
|
164
|
+
stxGetAccountsResultSchema: () => stxGetAccountsResultSchema,
|
|
142
165
|
stxGetAddressesMethodName: () => stxGetAddressesMethodName,
|
|
143
166
|
stxGetAddressesParamsSchema: () => stxGetAddressesParamsSchema,
|
|
144
167
|
stxGetAddressesRequestMessageSchema: () => stxGetAddressesRequestMessageSchema,
|
|
145
168
|
stxGetAddressesResultSchema: () => stxGetAddressesResultSchema,
|
|
169
|
+
stxSignMessageMethodName: () => stxSignMessageMethodName,
|
|
170
|
+
stxSignMessageParamsSchema: () => stxSignMessageParamsSchema,
|
|
171
|
+
stxSignMessageRequestMessageSchema: () => stxSignMessageRequestMessageSchema,
|
|
172
|
+
stxSignMessageResultSchema: () => stxSignMessageResultSchema,
|
|
173
|
+
stxSignStructuredMessageMethodName: () => stxSignStructuredMessageMethodName,
|
|
174
|
+
stxSignStructuredMessageParamsSchema: () => stxSignStructuredMessageParamsSchema,
|
|
175
|
+
stxSignStructuredMessageRequestMessageSchema: () => stxSignStructuredMessageRequestMessageSchema,
|
|
176
|
+
stxSignStructuredMessageResultSchema: () => stxSignStructuredMessageResultSchema,
|
|
146
177
|
stxSignTransactionMethodName: () => stxSignTransactionMethodName,
|
|
147
178
|
stxSignTransactionParamsSchema: () => stxSignTransactionParamsSchema,
|
|
148
179
|
stxSignTransactionRequestMessageSchema: () => stxSignTransactionRequestMessageSchema,
|
|
149
180
|
stxSignTransactionResultSchema: () => stxSignTransactionResultSchema,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
181
|
+
stxTransferStxMethodName: () => stxTransferStxMethodName,
|
|
182
|
+
stxTransferStxParamsSchema: () => stxTransferStxParamsSchema,
|
|
183
|
+
stxTransferStxRequestMessageSchema: () => stxTransferStxRequestMessageSchema,
|
|
184
|
+
stxTransferStxResultSchema: () => stxTransferStxResultSchema,
|
|
153
185
|
walletEventSchema: () => walletEventSchema,
|
|
154
186
|
walletTypeSchema: () => walletTypeSchema,
|
|
155
187
|
walletTypes: () => walletTypes
|
|
@@ -205,10 +237,7 @@ function removeDefaultProvider() {
|
|
|
205
237
|
localStorage.removeItem("sats-connect_defaultProvider");
|
|
206
238
|
}
|
|
207
239
|
function getSupportedWallets() {
|
|
208
|
-
const
|
|
209
|
-
const { xverse, ...defaultProviders } = DefaultAdaptersInfo;
|
|
210
|
-
const allProviders = [...ambientProviders, ...Object.values(defaultProviders)];
|
|
211
|
-
const wallets = allProviders.map((provider) => {
|
|
240
|
+
const wallets = Object.values(DefaultAdaptersInfo).map((provider) => {
|
|
212
241
|
{
|
|
213
242
|
return {
|
|
214
243
|
...provider,
|
|
@@ -221,11 +250,11 @@ function getSupportedWallets() {
|
|
|
221
250
|
|
|
222
251
|
// src/types.ts
|
|
223
252
|
var v2 = __toESM(require("valibot"));
|
|
224
|
-
var BitcoinNetworkType = /* @__PURE__ */ ((
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return
|
|
253
|
+
var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
|
|
254
|
+
BitcoinNetworkType2["Mainnet"] = "Mainnet";
|
|
255
|
+
BitcoinNetworkType2["Testnet"] = "Testnet";
|
|
256
|
+
BitcoinNetworkType2["Signet"] = "Signet";
|
|
257
|
+
return BitcoinNetworkType2;
|
|
229
258
|
})(BitcoinNetworkType || {});
|
|
230
259
|
var RpcIdSchema = v2.optional(v2.union([v2.string(), v2.number(), v2.null()]));
|
|
231
260
|
var rpcRequestMessageSchema = v2.object({
|
|
@@ -271,16 +300,127 @@ var rpcResponseMessageSchema = v2.union([
|
|
|
271
300
|
]);
|
|
272
301
|
|
|
273
302
|
// src/request/index.ts
|
|
274
|
-
var
|
|
303
|
+
var v20 = __toESM(require("valibot"));
|
|
275
304
|
|
|
276
|
-
// src/request/types/stxMethods.ts
|
|
305
|
+
// src/request/types/stxMethods/callContract.ts
|
|
306
|
+
var v3 = __toESM(require("valibot"));
|
|
307
|
+
var stxCallContractMethodName = "stx_callContract";
|
|
308
|
+
var stxCallContractParamsSchema = v3.object({
|
|
309
|
+
/**
|
|
310
|
+
* The contract principal.
|
|
311
|
+
*
|
|
312
|
+
* E.g. `"SPKE...GD5C.my-contract"`
|
|
313
|
+
*/
|
|
314
|
+
contract: v3.string(),
|
|
315
|
+
/**
|
|
316
|
+
* The name of the function to call.
|
|
317
|
+
*
|
|
318
|
+
* Note: spec changes ongoing,
|
|
319
|
+
* https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
|
|
320
|
+
*/
|
|
321
|
+
functionName: v3.string(),
|
|
322
|
+
/**
|
|
323
|
+
* The function's arguments. The arguments are expected to be hex-encoded
|
|
324
|
+
* strings of Clarity values.
|
|
325
|
+
*
|
|
326
|
+
* To convert Clarity values to their hex representation, the `cvToString`
|
|
327
|
+
* helper from the `@stacks/transactions` package may be helpful.
|
|
328
|
+
*
|
|
329
|
+
* ```js
|
|
330
|
+
* import { cvToString } from '@stacks/transactions';
|
|
331
|
+
*
|
|
332
|
+
* const functionArgs = [someClarityValue1, someClarityValue2];
|
|
333
|
+
* const hexArgs = functionArgs.map(cvToString);
|
|
334
|
+
* ```
|
|
335
|
+
*/
|
|
336
|
+
arguments: v3.optional(v3.array(v3.string()))
|
|
337
|
+
});
|
|
338
|
+
var stxCallContractResultSchema = v3.object({
|
|
339
|
+
/**
|
|
340
|
+
* The ID of the transaction.
|
|
341
|
+
*/
|
|
342
|
+
txid: v3.string(),
|
|
343
|
+
/**
|
|
344
|
+
* A Stacks transaction as a hex-encoded string.
|
|
345
|
+
*/
|
|
346
|
+
transaction: v3.string()
|
|
347
|
+
});
|
|
348
|
+
var stxCallContractRequestMessageSchema = v3.object({
|
|
349
|
+
...rpcRequestMessageSchema.entries,
|
|
350
|
+
...v3.object({
|
|
351
|
+
method: v3.literal(stxCallContractMethodName),
|
|
352
|
+
params: stxCallContractParamsSchema,
|
|
353
|
+
id: v3.string()
|
|
354
|
+
}).entries
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
// src/request/types/stxMethods/deployContract.ts
|
|
277
358
|
var v4 = __toESM(require("valibot"));
|
|
359
|
+
var stxDeployContractMethodName = "stx_deployContract";
|
|
360
|
+
var stxDeployContractParamsSchema = v4.object({
|
|
361
|
+
/**
|
|
362
|
+
* Name of the contract.
|
|
363
|
+
*/
|
|
364
|
+
name: v4.string(),
|
|
365
|
+
/**
|
|
366
|
+
* The source code of the Clarity contract.
|
|
367
|
+
*/
|
|
368
|
+
clarityCode: v4.string(),
|
|
369
|
+
/**
|
|
370
|
+
* The version of the Clarity contract.
|
|
371
|
+
*/
|
|
372
|
+
clarityVersion: v4.optional(v4.string())
|
|
373
|
+
});
|
|
374
|
+
var stxDeployContractResultSchema = v4.object({
|
|
375
|
+
/**
|
|
376
|
+
* The ID of the transaction.
|
|
377
|
+
*/
|
|
378
|
+
txid: v4.string(),
|
|
379
|
+
/**
|
|
380
|
+
* A Stacks transaction as a hex-encoded string.
|
|
381
|
+
*/
|
|
382
|
+
transaction: v4.string()
|
|
383
|
+
});
|
|
384
|
+
var stxDeployContractRequestMessageSchema = v4.object({
|
|
385
|
+
...rpcRequestMessageSchema.entries,
|
|
386
|
+
...v4.object({
|
|
387
|
+
method: v4.literal(stxDeployContractMethodName),
|
|
388
|
+
params: stxDeployContractParamsSchema,
|
|
389
|
+
id: v4.string()
|
|
390
|
+
}).entries
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
// src/request/types/stxMethods/getAccounts.ts
|
|
394
|
+
var v5 = __toESM(require("valibot"));
|
|
395
|
+
var stxGetAccountsMethodName = "stx_getAccounts";
|
|
396
|
+
var stxGetAccountsParamsSchema = v5.nullish(v5.null());
|
|
397
|
+
var stxGetAccountsResultSchema = v5.object({
|
|
398
|
+
/**
|
|
399
|
+
* The addresses generated for the given purposes.
|
|
400
|
+
*/
|
|
401
|
+
addresses: v5.array(
|
|
402
|
+
v5.object({
|
|
403
|
+
address: v5.string(),
|
|
404
|
+
publicKey: v5.string(),
|
|
405
|
+
gaiaHubUrl: v5.string(),
|
|
406
|
+
gaiaAppKey: v5.string()
|
|
407
|
+
})
|
|
408
|
+
)
|
|
409
|
+
});
|
|
410
|
+
var stxGetAccountsRequestMessageSchema = v5.object({
|
|
411
|
+
...rpcRequestMessageSchema.entries,
|
|
412
|
+
...v5.object({
|
|
413
|
+
method: v5.literal(stxGetAccountsMethodName),
|
|
414
|
+
params: stxGetAccountsParamsSchema,
|
|
415
|
+
id: v5.string()
|
|
416
|
+
}).entries
|
|
417
|
+
});
|
|
278
418
|
|
|
279
419
|
// src/addresses/index.ts
|
|
280
420
|
var import_jsontokens = require("jsontokens");
|
|
281
421
|
|
|
282
422
|
// src/addresses/types.ts
|
|
283
|
-
var
|
|
423
|
+
var v6 = __toESM(require("valibot"));
|
|
284
424
|
var AddressPurpose = /* @__PURE__ */ ((AddressPurpose2) => {
|
|
285
425
|
AddressPurpose2["Ordinals"] = "ordinals";
|
|
286
426
|
AddressPurpose2["Payment"] = "payment";
|
|
@@ -296,11 +436,11 @@ var AddressType = /* @__PURE__ */ ((AddressType3) => {
|
|
|
296
436
|
AddressType3["stacks"] = "stacks";
|
|
297
437
|
return AddressType3;
|
|
298
438
|
})(AddressType || {});
|
|
299
|
-
var addressSchema =
|
|
300
|
-
address:
|
|
301
|
-
publicKey:
|
|
302
|
-
purpose:
|
|
303
|
-
addressType:
|
|
439
|
+
var addressSchema = v6.object({
|
|
440
|
+
address: v6.string(),
|
|
441
|
+
publicKey: v6.string(),
|
|
442
|
+
purpose: v6.enum(AddressPurpose),
|
|
443
|
+
addressType: v6.enum(AddressType)
|
|
304
444
|
});
|
|
305
445
|
|
|
306
446
|
// src/addresses/index.ts
|
|
@@ -320,118 +460,269 @@ var getAddress = async (options) => {
|
|
|
320
460
|
}
|
|
321
461
|
};
|
|
322
462
|
|
|
323
|
-
// src/request/types/stxMethods.ts
|
|
463
|
+
// src/request/types/stxMethods/getAddresses.ts
|
|
464
|
+
var v7 = __toESM(require("valibot"));
|
|
324
465
|
var stxGetAddressesMethodName = "stx_getAddresses";
|
|
325
|
-
var stxGetAddressesParamsSchema =
|
|
326
|
-
|
|
466
|
+
var stxGetAddressesParamsSchema = v7.nullish(
|
|
467
|
+
v7.object({
|
|
327
468
|
/**
|
|
328
469
|
* A message to be displayed to the user in the request prompt.
|
|
329
470
|
*/
|
|
330
|
-
message:
|
|
471
|
+
message: v7.optional(v7.string())
|
|
331
472
|
})
|
|
332
473
|
);
|
|
333
|
-
var stxGetAddressesResultSchema =
|
|
474
|
+
var stxGetAddressesResultSchema = v7.object({
|
|
334
475
|
/**
|
|
335
476
|
* The addresses generated for the given purposes.
|
|
336
477
|
*/
|
|
337
|
-
addresses:
|
|
478
|
+
addresses: v7.array(addressSchema)
|
|
338
479
|
});
|
|
339
|
-
var stxGetAddressesRequestMessageSchema =
|
|
480
|
+
var stxGetAddressesRequestMessageSchema = v7.object({
|
|
340
481
|
...rpcRequestMessageSchema.entries,
|
|
341
|
-
...
|
|
342
|
-
method:
|
|
482
|
+
...v7.object({
|
|
483
|
+
method: v7.literal(stxGetAddressesMethodName),
|
|
343
484
|
params: stxGetAddressesParamsSchema,
|
|
344
|
-
id:
|
|
485
|
+
id: v7.string()
|
|
345
486
|
}).entries
|
|
346
487
|
});
|
|
488
|
+
|
|
489
|
+
// src/request/types/stxMethods/signMessage.ts
|
|
490
|
+
var v8 = __toESM(require("valibot"));
|
|
491
|
+
var stxSignMessageMethodName = "stx_signMessage";
|
|
492
|
+
var stxSignMessageParamsSchema = v8.object({
|
|
493
|
+
/**
|
|
494
|
+
* The message to sign.
|
|
495
|
+
*/
|
|
496
|
+
message: v8.string(),
|
|
497
|
+
/**
|
|
498
|
+
* The public key to sign the message with.
|
|
499
|
+
*/
|
|
500
|
+
publicKey: v8.string(),
|
|
501
|
+
/**
|
|
502
|
+
* The format version of the parameter.
|
|
503
|
+
*/
|
|
504
|
+
parameterFormatVersion: v8.optional(v8.number())
|
|
505
|
+
});
|
|
506
|
+
var stxSignMessageResultSchema = v8.object({
|
|
507
|
+
/**
|
|
508
|
+
* The signature of the message.
|
|
509
|
+
*/
|
|
510
|
+
signature: v8.string(),
|
|
511
|
+
/**
|
|
512
|
+
* The public key used to sign the message.
|
|
513
|
+
*/
|
|
514
|
+
publicKey: v8.string()
|
|
515
|
+
});
|
|
516
|
+
var stxSignMessageRequestMessageSchema = v8.object({
|
|
517
|
+
...rpcRequestMessageSchema.entries,
|
|
518
|
+
...v8.object({
|
|
519
|
+
method: v8.literal(stxSignMessageMethodName),
|
|
520
|
+
params: stxSignMessageParamsSchema,
|
|
521
|
+
id: v8.string()
|
|
522
|
+
}).entries
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
// src/request/types/stxMethods/signStructuredMessage.ts
|
|
526
|
+
var v9 = __toESM(require("valibot"));
|
|
527
|
+
var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
|
|
528
|
+
var stxSignStructuredMessageParamsSchema = v9.object({
|
|
529
|
+
/**
|
|
530
|
+
* The domain to be signed.
|
|
531
|
+
*/
|
|
532
|
+
domain: v9.string(),
|
|
533
|
+
/**
|
|
534
|
+
* Message payload to be signed.
|
|
535
|
+
*/
|
|
536
|
+
message: v9.string(),
|
|
537
|
+
/**
|
|
538
|
+
* The format version of the parameter.
|
|
539
|
+
*/
|
|
540
|
+
parameterFormatVersion: v9.optional(v9.number()),
|
|
541
|
+
/**
|
|
542
|
+
* The public key to sign the message with.
|
|
543
|
+
*/
|
|
544
|
+
publicKey: v9.optional(v9.string())
|
|
545
|
+
});
|
|
546
|
+
var stxSignStructuredMessageResultSchema = v9.object({
|
|
547
|
+
/**
|
|
548
|
+
* Signature of the message.
|
|
549
|
+
*/
|
|
550
|
+
signature: v9.string(),
|
|
551
|
+
/**
|
|
552
|
+
* Public key as hex-encoded string.
|
|
553
|
+
*/
|
|
554
|
+
publicKey: v9.string()
|
|
555
|
+
});
|
|
556
|
+
var stxSignStructuredMessageRequestMessageSchema = v9.object({
|
|
557
|
+
...rpcRequestMessageSchema.entries,
|
|
558
|
+
...v9.object({
|
|
559
|
+
method: v9.literal(stxSignStructuredMessageMethodName),
|
|
560
|
+
params: stxSignStructuredMessageParamsSchema,
|
|
561
|
+
id: v9.string()
|
|
562
|
+
}).entries
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
// src/request/types/stxMethods/signTransaction.ts
|
|
566
|
+
var v10 = __toESM(require("valibot"));
|
|
347
567
|
var stxSignTransactionMethodName = "stx_signTransaction";
|
|
348
|
-
var stxSignTransactionParamsSchema =
|
|
568
|
+
var stxSignTransactionParamsSchema = v10.object({
|
|
349
569
|
/**
|
|
350
570
|
* The transaction to sign as a hex-encoded string.
|
|
351
571
|
*/
|
|
352
|
-
transaction:
|
|
572
|
+
transaction: v10.string(),
|
|
353
573
|
/**
|
|
354
574
|
* The public key to sign the transaction with. The wallet may use any key
|
|
355
575
|
* when not provided.
|
|
356
576
|
*/
|
|
357
|
-
pubkey:
|
|
577
|
+
pubkey: v10.optional(v10.string()),
|
|
358
578
|
/**
|
|
359
579
|
* Whether to broadcast the transaction after signing. Defaults to `true`.
|
|
360
580
|
*/
|
|
361
|
-
broadcast:
|
|
581
|
+
broadcast: v10.optional(v10.boolean())
|
|
362
582
|
});
|
|
363
|
-
var stxSignTransactionResultSchema =
|
|
583
|
+
var stxSignTransactionResultSchema = v10.object({
|
|
364
584
|
/**
|
|
365
585
|
* The signed transaction as a hex-encoded string.
|
|
366
586
|
*/
|
|
367
|
-
transaction:
|
|
587
|
+
transaction: v10.string()
|
|
368
588
|
});
|
|
369
|
-
var stxSignTransactionRequestMessageSchema =
|
|
589
|
+
var stxSignTransactionRequestMessageSchema = v10.object({
|
|
370
590
|
...rpcRequestMessageSchema.entries,
|
|
371
|
-
...
|
|
372
|
-
method:
|
|
591
|
+
...v10.object({
|
|
592
|
+
method: v10.literal(stxSignTransactionMethodName),
|
|
373
593
|
params: stxSignTransactionParamsSchema,
|
|
374
|
-
id:
|
|
594
|
+
id: v10.string()
|
|
595
|
+
}).entries
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
// src/request/types/stxMethods/transferStx.ts
|
|
599
|
+
var v11 = __toESM(require("valibot"));
|
|
600
|
+
var stxTransferStxMethodName = "stx_transferStx";
|
|
601
|
+
var stxTransferStxParamsSchema = v11.object({
|
|
602
|
+
/**
|
|
603
|
+
* Amount of STX tokens to transfer in microstacks as a string. Anything
|
|
604
|
+
* parseable by `BigInt` is acceptable.
|
|
605
|
+
*
|
|
606
|
+
* Example,
|
|
607
|
+
*
|
|
608
|
+
* ```js
|
|
609
|
+
* const amount1 = 1234;
|
|
610
|
+
* const amount2 = 1234n;
|
|
611
|
+
* const amount3 = '1234';
|
|
612
|
+
* ```
|
|
613
|
+
*/
|
|
614
|
+
amount: v11.union([v11.number(), v11.string()]),
|
|
615
|
+
/**
|
|
616
|
+
* The recipeint's principal.
|
|
617
|
+
*/
|
|
618
|
+
recipient: v11.string(),
|
|
619
|
+
/**
|
|
620
|
+
* A string representing the memo.
|
|
621
|
+
*/
|
|
622
|
+
memo: v11.optional(v11.string()),
|
|
623
|
+
/**
|
|
624
|
+
* Version of parameter format.
|
|
625
|
+
*/
|
|
626
|
+
version: v11.optional(v11.string()),
|
|
627
|
+
/**
|
|
628
|
+
* The mode of the post conditions.
|
|
629
|
+
*/
|
|
630
|
+
postConditionMode: v11.optional(v11.number()),
|
|
631
|
+
/**
|
|
632
|
+
* A hex-encoded string representing the post conditions.
|
|
633
|
+
*
|
|
634
|
+
* A post condition may be converted to it's hex representation using the `serializePostCondition` helper from the `@stacks/transactions` package,
|
|
635
|
+
*
|
|
636
|
+
* ```js
|
|
637
|
+
* import { serializePostCondition } from '@stacks/transactions';
|
|
638
|
+
*
|
|
639
|
+
* const postCondition = somePostCondition;
|
|
640
|
+
* const hexPostCondition = serializePostCondition(postCondition).toString('hex');
|
|
641
|
+
* ```
|
|
642
|
+
*/
|
|
643
|
+
postConditions: v11.optional(v11.array(v11.string())),
|
|
644
|
+
/**
|
|
645
|
+
* The public key to sign the transaction with. The wallet may use any key
|
|
646
|
+
* when not provided.
|
|
647
|
+
*/
|
|
648
|
+
pubkey: v11.optional(v11.string())
|
|
649
|
+
});
|
|
650
|
+
var stxTransferStxResultSchema = v11.object({
|
|
651
|
+
/**
|
|
652
|
+
* The ID of the transaction.
|
|
653
|
+
*/
|
|
654
|
+
txid: v11.string(),
|
|
655
|
+
/**
|
|
656
|
+
* A Stacks transaction as a hex-encoded string.
|
|
657
|
+
*/
|
|
658
|
+
transaction: v11.string()
|
|
659
|
+
});
|
|
660
|
+
var stxTransferStxRequestMessageSchema = v11.object({
|
|
661
|
+
...rpcRequestMessageSchema.entries,
|
|
662
|
+
...v11.object({
|
|
663
|
+
method: v11.literal(stxTransferStxMethodName),
|
|
664
|
+
params: stxTransferStxParamsSchema,
|
|
665
|
+
id: v11.string()
|
|
375
666
|
}).entries
|
|
376
667
|
});
|
|
377
668
|
|
|
378
669
|
// src/request/types/btcMethods.ts
|
|
379
|
-
var
|
|
670
|
+
var v13 = __toESM(require("valibot"));
|
|
380
671
|
|
|
381
672
|
// src/request/types/common.ts
|
|
382
|
-
var
|
|
673
|
+
var v12 = __toESM(require("valibot"));
|
|
383
674
|
var walletTypes = ["software", "ledger"];
|
|
384
|
-
var walletTypeSchema =
|
|
675
|
+
var walletTypeSchema = v12.picklist(walletTypes);
|
|
385
676
|
|
|
386
677
|
// src/request/types/btcMethods.ts
|
|
387
678
|
var getInfoMethodName = "getInfo";
|
|
388
|
-
var getInfoParamsSchema =
|
|
389
|
-
var getInfoResultSchema =
|
|
679
|
+
var getInfoParamsSchema = v13.nullish(v13.null());
|
|
680
|
+
var getInfoResultSchema = v13.object({
|
|
390
681
|
/**
|
|
391
682
|
* Version of the wallet.
|
|
392
683
|
*/
|
|
393
|
-
version:
|
|
684
|
+
version: v13.string(),
|
|
394
685
|
/**
|
|
395
686
|
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
396
687
|
*/
|
|
397
|
-
methods:
|
|
688
|
+
methods: v13.optional(v13.array(v13.string())),
|
|
398
689
|
/**
|
|
399
690
|
* List of WBIP standards supported by the wallet. Not currently used.
|
|
400
691
|
*/
|
|
401
|
-
supports:
|
|
692
|
+
supports: v13.array(v13.string())
|
|
402
693
|
});
|
|
403
|
-
var getInfoRequestMessageSchema =
|
|
694
|
+
var getInfoRequestMessageSchema = v13.object({
|
|
404
695
|
...rpcRequestMessageSchema.entries,
|
|
405
|
-
...
|
|
406
|
-
method:
|
|
696
|
+
...v13.object({
|
|
697
|
+
method: v13.literal(getInfoMethodName),
|
|
407
698
|
params: getInfoParamsSchema,
|
|
408
|
-
id:
|
|
699
|
+
id: v13.string()
|
|
409
700
|
}).entries
|
|
410
701
|
});
|
|
411
702
|
var getAddressesMethodName = "getAddresses";
|
|
412
|
-
var getAddressesParamsSchema =
|
|
703
|
+
var getAddressesParamsSchema = v13.object({
|
|
413
704
|
/**
|
|
414
705
|
* The purposes for which to generate addresses. See
|
|
415
706
|
* {@linkcode AddressPurpose} for available purposes.
|
|
416
707
|
*/
|
|
417
|
-
purposes:
|
|
708
|
+
purposes: v13.array(v13.enum(AddressPurpose)),
|
|
418
709
|
/**
|
|
419
710
|
* A message to be displayed to the user in the request prompt.
|
|
420
711
|
*/
|
|
421
|
-
message:
|
|
712
|
+
message: v13.optional(v13.string())
|
|
422
713
|
});
|
|
423
|
-
var getAddressesResultSchema =
|
|
714
|
+
var getAddressesResultSchema = v13.object({
|
|
424
715
|
/**
|
|
425
716
|
* The addresses generated for the given purposes.
|
|
426
717
|
*/
|
|
427
|
-
addresses:
|
|
718
|
+
addresses: v13.array(addressSchema)
|
|
428
719
|
});
|
|
429
|
-
var getAddressesRequestMessageSchema =
|
|
720
|
+
var getAddressesRequestMessageSchema = v13.object({
|
|
430
721
|
...rpcRequestMessageSchema.entries,
|
|
431
|
-
...
|
|
432
|
-
method:
|
|
722
|
+
...v13.object({
|
|
723
|
+
method: v13.literal(getAddressesMethodName),
|
|
433
724
|
params: getAddressesParamsSchema,
|
|
434
|
-
id:
|
|
725
|
+
id: v13.string()
|
|
435
726
|
}).entries
|
|
436
727
|
});
|
|
437
728
|
var signMessageMethodName = "signMessage";
|
|
@@ -440,363 +731,439 @@ var MessageSigningProtocols = /* @__PURE__ */ ((MessageSigningProtocols2) => {
|
|
|
440
731
|
MessageSigningProtocols2["BIP322"] = "BIP322";
|
|
441
732
|
return MessageSigningProtocols2;
|
|
442
733
|
})(MessageSigningProtocols || {});
|
|
443
|
-
var signMessageParamsSchema =
|
|
734
|
+
var signMessageParamsSchema = v13.object({
|
|
444
735
|
/**
|
|
445
736
|
* The address used for signing.
|
|
446
737
|
**/
|
|
447
|
-
address:
|
|
738
|
+
address: v13.string(),
|
|
448
739
|
/**
|
|
449
740
|
* The message to sign.
|
|
450
741
|
**/
|
|
451
|
-
message:
|
|
742
|
+
message: v13.string(),
|
|
452
743
|
/**
|
|
453
744
|
* The protocol to use for signing the message.
|
|
454
745
|
*/
|
|
455
|
-
protocol:
|
|
746
|
+
protocol: v13.optional(v13.enum(MessageSigningProtocols))
|
|
456
747
|
});
|
|
457
|
-
var signMessageResultSchema =
|
|
748
|
+
var signMessageResultSchema = v13.object({
|
|
458
749
|
/**
|
|
459
750
|
* The signature of the message.
|
|
460
751
|
*/
|
|
461
|
-
signature:
|
|
752
|
+
signature: v13.string(),
|
|
462
753
|
/**
|
|
463
754
|
* hash of the message.
|
|
464
755
|
*/
|
|
465
|
-
messageHash:
|
|
756
|
+
messageHash: v13.string(),
|
|
466
757
|
/**
|
|
467
758
|
* The address used for signing.
|
|
468
759
|
*/
|
|
469
|
-
address:
|
|
760
|
+
address: v13.string(),
|
|
470
761
|
/**
|
|
471
762
|
* The protocol to use for signing the message.
|
|
472
763
|
*/
|
|
473
|
-
protocol:
|
|
764
|
+
protocol: v13.enum(MessageSigningProtocols)
|
|
474
765
|
});
|
|
475
|
-
var signMessageRequestMessageSchema =
|
|
766
|
+
var signMessageRequestMessageSchema = v13.object({
|
|
476
767
|
...rpcRequestMessageSchema.entries,
|
|
477
|
-
...
|
|
478
|
-
method:
|
|
768
|
+
...v13.object({
|
|
769
|
+
method: v13.literal(signMessageMethodName),
|
|
479
770
|
params: signMessageParamsSchema,
|
|
480
|
-
id:
|
|
771
|
+
id: v13.string()
|
|
481
772
|
}).entries
|
|
482
773
|
});
|
|
483
774
|
var sendTransferMethodName = "sendTransfer";
|
|
484
|
-
var sendTransferParamsSchema =
|
|
775
|
+
var sendTransferParamsSchema = v13.object({
|
|
485
776
|
/**
|
|
486
777
|
* Array of recipients to send to.
|
|
487
778
|
* The amount to send to each recipient is in satoshis.
|
|
488
779
|
*/
|
|
489
|
-
recipients:
|
|
490
|
-
|
|
491
|
-
address:
|
|
492
|
-
amount:
|
|
780
|
+
recipients: v13.array(
|
|
781
|
+
v13.object({
|
|
782
|
+
address: v13.string(),
|
|
783
|
+
amount: v13.number()
|
|
493
784
|
})
|
|
494
785
|
)
|
|
495
786
|
});
|
|
496
|
-
var sendTransferResultSchema =
|
|
787
|
+
var sendTransferResultSchema = v13.object({
|
|
497
788
|
/**
|
|
498
789
|
* The transaction id as a hex-encoded string.
|
|
499
790
|
*/
|
|
500
|
-
txid:
|
|
791
|
+
txid: v13.string()
|
|
501
792
|
});
|
|
502
|
-
var sendTransferRequestMessageSchema =
|
|
793
|
+
var sendTransferRequestMessageSchema = v13.object({
|
|
503
794
|
...rpcRequestMessageSchema.entries,
|
|
504
|
-
...
|
|
505
|
-
method:
|
|
795
|
+
...v13.object({
|
|
796
|
+
method: v13.literal(sendTransferMethodName),
|
|
506
797
|
params: sendTransferParamsSchema,
|
|
507
|
-
id:
|
|
798
|
+
id: v13.string()
|
|
508
799
|
}).entries
|
|
509
800
|
});
|
|
510
801
|
var signPsbtMethodName = "signPsbt";
|
|
511
|
-
var signPsbtParamsSchema =
|
|
802
|
+
var signPsbtParamsSchema = v13.object({
|
|
512
803
|
/**
|
|
513
804
|
* The base64 encoded PSBT to sign.
|
|
514
805
|
*/
|
|
515
|
-
psbt:
|
|
806
|
+
psbt: v13.string(),
|
|
516
807
|
/**
|
|
517
808
|
* The inputs to sign.
|
|
518
809
|
* The key is the address and the value is an array of indexes of the inputs to sign.
|
|
519
810
|
*/
|
|
520
|
-
signInputs:
|
|
811
|
+
signInputs: v13.record(v13.string(), v13.array(v13.number())),
|
|
812
|
+
allowedSignHash: v13.optional(v13.number()),
|
|
521
813
|
/**
|
|
522
814
|
* Whether to broadcast the transaction after signing.
|
|
523
815
|
**/
|
|
524
|
-
broadcast:
|
|
816
|
+
broadcast: v13.optional(v13.boolean())
|
|
525
817
|
});
|
|
526
|
-
var signPsbtResultSchema =
|
|
818
|
+
var signPsbtResultSchema = v13.object({
|
|
527
819
|
/**
|
|
528
820
|
* The base64 encoded PSBT after signing.
|
|
529
821
|
*/
|
|
530
|
-
psbt:
|
|
822
|
+
psbt: v13.string(),
|
|
531
823
|
/**
|
|
532
824
|
* The transaction id as a hex-encoded string.
|
|
533
825
|
* This is only returned if the transaction was broadcast.
|
|
534
826
|
**/
|
|
535
|
-
txid:
|
|
827
|
+
txid: v13.optional(v13.string())
|
|
536
828
|
});
|
|
537
|
-
var signPsbtRequestMessageSchema =
|
|
829
|
+
var signPsbtRequestMessageSchema = v13.object({
|
|
538
830
|
...rpcRequestMessageSchema.entries,
|
|
539
|
-
...
|
|
540
|
-
method:
|
|
831
|
+
...v13.object({
|
|
832
|
+
method: v13.literal(signPsbtMethodName),
|
|
541
833
|
params: signPsbtParamsSchema,
|
|
542
|
-
id:
|
|
834
|
+
id: v13.string()
|
|
543
835
|
}).entries
|
|
544
836
|
});
|
|
545
837
|
var getAccountsMethodName = "getAccounts";
|
|
546
|
-
var getAccountsParamsSchema =
|
|
838
|
+
var getAccountsParamsSchema = v13.object({
|
|
547
839
|
/**
|
|
548
840
|
* The purposes for which to generate addresses. See
|
|
549
841
|
* {@linkcode AddressPurpose} for available purposes.
|
|
550
842
|
*/
|
|
551
|
-
purposes:
|
|
843
|
+
purposes: v13.array(v13.enum(AddressPurpose)),
|
|
552
844
|
/**
|
|
553
845
|
* A message to be displayed to the user in the request prompt.
|
|
554
846
|
*/
|
|
555
|
-
message:
|
|
847
|
+
message: v13.optional(v13.string())
|
|
556
848
|
});
|
|
557
|
-
var getAccountsResultSchema =
|
|
558
|
-
|
|
849
|
+
var getAccountsResultSchema = v13.array(
|
|
850
|
+
v13.object({
|
|
559
851
|
...addressSchema.entries,
|
|
560
|
-
...
|
|
852
|
+
...v13.object({
|
|
561
853
|
walletType: walletTypeSchema
|
|
562
854
|
}).entries
|
|
563
855
|
})
|
|
564
856
|
);
|
|
565
|
-
var getAccountsRequestMessageSchema =
|
|
857
|
+
var getAccountsRequestMessageSchema = v13.object({
|
|
566
858
|
...rpcRequestMessageSchema.entries,
|
|
567
|
-
...
|
|
568
|
-
method:
|
|
859
|
+
...v13.object({
|
|
860
|
+
method: v13.literal(getAccountsMethodName),
|
|
569
861
|
params: getAccountsParamsSchema,
|
|
570
|
-
id:
|
|
862
|
+
id: v13.string()
|
|
571
863
|
}).entries
|
|
572
864
|
});
|
|
573
865
|
var getBalanceMethodName = "getBalance";
|
|
574
|
-
var getBalanceParamsSchema =
|
|
575
|
-
var getBalanceResultSchema =
|
|
866
|
+
var getBalanceParamsSchema = v13.nullish(v13.null());
|
|
867
|
+
var getBalanceResultSchema = v13.object({
|
|
576
868
|
/**
|
|
577
869
|
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
578
870
|
* messages not supporting bigint
|
|
579
871
|
* (https://issues.chromium.org/issues/40116184).
|
|
580
872
|
*/
|
|
581
|
-
confirmed:
|
|
873
|
+
confirmed: v13.string(),
|
|
582
874
|
/**
|
|
583
875
|
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
584
876
|
* messages not supporting bigint
|
|
585
877
|
* (https://issues.chromium.org/issues/40116184).
|
|
586
878
|
*/
|
|
587
|
-
unconfirmed:
|
|
879
|
+
unconfirmed: v13.string(),
|
|
588
880
|
/**
|
|
589
881
|
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
590
882
|
* sats. Using a string due to chrome messages not supporting bigint
|
|
591
883
|
* (https://issues.chromium.org/issues/40116184).
|
|
592
884
|
*/
|
|
593
|
-
total:
|
|
885
|
+
total: v13.string()
|
|
594
886
|
});
|
|
595
|
-
var getBalanceRequestMessageSchema =
|
|
887
|
+
var getBalanceRequestMessageSchema = v13.object({
|
|
596
888
|
...rpcRequestMessageSchema.entries,
|
|
597
|
-
...
|
|
598
|
-
method:
|
|
599
|
-
id:
|
|
889
|
+
...v13.object({
|
|
890
|
+
method: v13.literal(getBalanceMethodName),
|
|
891
|
+
id: v13.string()
|
|
600
892
|
}).entries
|
|
601
893
|
});
|
|
602
894
|
|
|
603
895
|
// src/request/types/walletMethods.ts
|
|
604
|
-
var
|
|
896
|
+
var v14 = __toESM(require("valibot"));
|
|
605
897
|
var import_xverse_core = require("@secretkeylabs/xverse-core");
|
|
606
|
-
var permissionTemplate =
|
|
607
|
-
|
|
608
|
-
...
|
|
609
|
-
actions:
|
|
898
|
+
var permissionTemplate = v14.variant("type", [
|
|
899
|
+
v14.object({
|
|
900
|
+
...v14.omit(import_xverse_core.permissions.resources.account.accountPermissionSchema, ["clientId", "actions"]).entries,
|
|
901
|
+
actions: v14.partial(import_xverse_core.permissions.resources.account.accountActionsSchema)
|
|
610
902
|
}),
|
|
611
|
-
|
|
612
|
-
...
|
|
613
|
-
actions:
|
|
903
|
+
v14.object({
|
|
904
|
+
...v14.omit(import_xverse_core.permissions.resources.wallet.walletPermissionSchema, ["clientId"]).entries,
|
|
905
|
+
actions: v14.partial(import_xverse_core.permissions.resources.wallet.walletActionsSchema)
|
|
614
906
|
})
|
|
615
907
|
]);
|
|
616
908
|
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
617
|
-
var requestPermissionsParamsSchema =
|
|
618
|
-
var requestPermissionsResultSchema =
|
|
619
|
-
var requestPermissionsRequestMessageSchema =
|
|
909
|
+
var requestPermissionsParamsSchema = v14.nullish(v14.array(permissionTemplate));
|
|
910
|
+
var requestPermissionsResultSchema = v14.literal(true);
|
|
911
|
+
var requestPermissionsRequestMessageSchema = v14.object({
|
|
620
912
|
...rpcRequestMessageSchema.entries,
|
|
621
|
-
...
|
|
622
|
-
method:
|
|
913
|
+
...v14.object({
|
|
914
|
+
method: v14.literal(requestPermissionsMethodName),
|
|
623
915
|
params: requestPermissionsParamsSchema,
|
|
624
|
-
id:
|
|
916
|
+
id: v14.string()
|
|
625
917
|
}).entries
|
|
626
918
|
});
|
|
627
919
|
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
628
|
-
var renouncePermissionsParamsSchema =
|
|
629
|
-
var renouncePermissionsResultSchema =
|
|
630
|
-
var renouncePermissionsRequestMessageSchema =
|
|
920
|
+
var renouncePermissionsParamsSchema = v14.nullish(v14.null());
|
|
921
|
+
var renouncePermissionsResultSchema = v14.nullish(v14.null());
|
|
922
|
+
var renouncePermissionsRequestMessageSchema = v14.object({
|
|
631
923
|
...rpcRequestMessageSchema.entries,
|
|
632
|
-
...
|
|
633
|
-
method:
|
|
924
|
+
...v14.object({
|
|
925
|
+
method: v14.literal(renouncePermissionsMethodName),
|
|
634
926
|
params: renouncePermissionsParamsSchema,
|
|
635
|
-
id:
|
|
927
|
+
id: v14.string()
|
|
636
928
|
}).entries
|
|
637
929
|
});
|
|
638
930
|
var disconnectMethodName = "wallet_disconnect";
|
|
639
|
-
var disconnectParamsSchema =
|
|
640
|
-
var disconnectResultSchema =
|
|
641
|
-
var disconnectRequestMessageSchema =
|
|
931
|
+
var disconnectParamsSchema = v14.nullish(v14.null());
|
|
932
|
+
var disconnectResultSchema = v14.nullish(v14.null());
|
|
933
|
+
var disconnectRequestMessageSchema = v14.object({
|
|
642
934
|
...rpcRequestMessageSchema.entries,
|
|
643
|
-
...
|
|
644
|
-
method:
|
|
935
|
+
...v14.object({
|
|
936
|
+
method: v14.literal(disconnectMethodName),
|
|
645
937
|
params: disconnectParamsSchema,
|
|
646
|
-
id:
|
|
938
|
+
id: v14.string()
|
|
647
939
|
}).entries
|
|
648
940
|
});
|
|
649
941
|
var getWalletTypeMethodName = "wallet_getWalletType";
|
|
650
|
-
var getWalletTypeParamsSchema =
|
|
942
|
+
var getWalletTypeParamsSchema = v14.nullish(v14.null());
|
|
651
943
|
var getWalletTypeResultSchema = walletTypeSchema;
|
|
652
|
-
var getWalletTypeRequestMessageSchema =
|
|
944
|
+
var getWalletTypeRequestMessageSchema = v14.object({
|
|
653
945
|
...rpcRequestMessageSchema.entries,
|
|
654
|
-
...
|
|
655
|
-
method:
|
|
946
|
+
...v14.object({
|
|
947
|
+
method: v14.literal(getWalletTypeMethodName),
|
|
656
948
|
params: getWalletTypeParamsSchema,
|
|
657
|
-
id:
|
|
949
|
+
id: v14.string()
|
|
658
950
|
}).entries
|
|
659
951
|
});
|
|
660
952
|
var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
|
|
661
|
-
var getCurrentPermissionsParamsSchema =
|
|
662
|
-
var getCurrentPermissionsResultSchema =
|
|
663
|
-
var getCurrentPermissionsRequestMessageSchema =
|
|
953
|
+
var getCurrentPermissionsParamsSchema = v14.nullish(v14.null());
|
|
954
|
+
var getCurrentPermissionsResultSchema = v14.array(import_xverse_core.permissions.store.permission);
|
|
955
|
+
var getCurrentPermissionsRequestMessageSchema = v14.object({
|
|
664
956
|
...rpcRequestMessageSchema.entries,
|
|
665
|
-
...
|
|
666
|
-
method:
|
|
957
|
+
...v14.object({
|
|
958
|
+
method: v14.literal(getCurrentPermissionsMethodName),
|
|
667
959
|
params: getCurrentPermissionsParamsSchema,
|
|
668
|
-
id:
|
|
960
|
+
id: v14.string()
|
|
669
961
|
}).entries
|
|
670
962
|
});
|
|
671
963
|
var getAccountMethodName = "wallet_getAccount";
|
|
672
|
-
var getAccountParamsSchema =
|
|
673
|
-
var getAccountResultSchema =
|
|
964
|
+
var getAccountParamsSchema = v14.nullish(v14.null());
|
|
965
|
+
var getAccountResultSchema = v14.object({
|
|
674
966
|
id: import_xverse_core.permissions.utils.account.accountIdSchema,
|
|
675
|
-
addresses:
|
|
967
|
+
addresses: v14.array(addressSchema),
|
|
676
968
|
walletType: walletTypeSchema
|
|
677
969
|
});
|
|
678
|
-
var getAccountRequestMessageSchema =
|
|
970
|
+
var getAccountRequestMessageSchema = v14.object({
|
|
679
971
|
...rpcRequestMessageSchema.entries,
|
|
680
|
-
...
|
|
681
|
-
method:
|
|
972
|
+
...v14.object({
|
|
973
|
+
method: v14.literal(getAccountMethodName),
|
|
682
974
|
params: getAccountParamsSchema,
|
|
683
|
-
id:
|
|
975
|
+
id: v14.string()
|
|
684
976
|
}).entries
|
|
685
977
|
});
|
|
686
978
|
var connectMethodName = "wallet_connect";
|
|
687
|
-
var connectParamsSchema =
|
|
688
|
-
|
|
689
|
-
permissions:
|
|
979
|
+
var connectParamsSchema = v14.nullish(
|
|
980
|
+
v14.object({
|
|
981
|
+
permissions: v14.optional(v14.array(permissionTemplate))
|
|
690
982
|
})
|
|
691
983
|
);
|
|
692
984
|
var connectResultSchema = getAccountResultSchema;
|
|
693
|
-
var connectRequestMessageSchema =
|
|
985
|
+
var connectRequestMessageSchema = v14.object({
|
|
694
986
|
...rpcRequestMessageSchema.entries,
|
|
695
|
-
...
|
|
696
|
-
method:
|
|
987
|
+
...v14.object({
|
|
988
|
+
method: v14.literal(connectMethodName),
|
|
697
989
|
params: connectParamsSchema,
|
|
698
|
-
id:
|
|
990
|
+
id: v14.string()
|
|
699
991
|
}).entries
|
|
700
992
|
});
|
|
701
993
|
|
|
702
|
-
// src/request/types/runesMethods.ts
|
|
703
|
-
var
|
|
704
|
-
var
|
|
705
|
-
var
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
994
|
+
// src/request/types/runesMethods/etch.ts
|
|
995
|
+
var v15 = __toESM(require("valibot"));
|
|
996
|
+
var runesEtchMethodName = "runes_etch";
|
|
997
|
+
var etchTermsSchema = v15.object({
|
|
998
|
+
amount: v15.string(),
|
|
999
|
+
cap: v15.string(),
|
|
1000
|
+
heightStart: v15.optional(v15.string()),
|
|
1001
|
+
heightEnd: v15.optional(v15.string()),
|
|
1002
|
+
offsetStart: v15.optional(v15.string()),
|
|
1003
|
+
offsetEnd: v15.optional(v15.string())
|
|
1004
|
+
});
|
|
1005
|
+
var inscriptionDetailsSchema = v15.object({
|
|
1006
|
+
contentType: v15.string(),
|
|
1007
|
+
contentBase64: v15.string()
|
|
1008
|
+
});
|
|
1009
|
+
var runesEtchParamsSchema = v15.object({
|
|
1010
|
+
runeName: v15.string(),
|
|
1011
|
+
divisibility: v15.optional(v15.number()),
|
|
1012
|
+
symbol: v15.optional(v15.string()),
|
|
1013
|
+
premine: v15.optional(v15.string()),
|
|
1014
|
+
isMintable: v15.boolean(),
|
|
1015
|
+
delegateInscriptionId: v15.optional(v15.string()),
|
|
1016
|
+
destinationAddress: v15.string(),
|
|
1017
|
+
refundAddress: v15.string(),
|
|
1018
|
+
feeRate: v15.number(),
|
|
1019
|
+
appServiceFee: v15.optional(v15.number()),
|
|
1020
|
+
appServiceFeeAddress: v15.optional(v15.string()),
|
|
1021
|
+
terms: v15.optional(etchTermsSchema),
|
|
1022
|
+
inscriptionDetails: v15.optional(inscriptionDetailsSchema),
|
|
1023
|
+
network: v15.optional(v15.enum(BitcoinNetworkType))
|
|
1024
|
+
});
|
|
1025
|
+
var runesEtchResultSchema = v15.object({
|
|
1026
|
+
orderId: v15.string(),
|
|
1027
|
+
fundTransactionId: v15.string(),
|
|
1028
|
+
fundingAddress: v15.string()
|
|
1029
|
+
});
|
|
1030
|
+
var runesEtchRequestMessageSchema = v15.object({
|
|
1031
|
+
...rpcRequestMessageSchema.entries,
|
|
1032
|
+
...v15.object({
|
|
1033
|
+
method: v15.literal(runesEtchMethodName),
|
|
1034
|
+
params: runesEtchParamsSchema,
|
|
1035
|
+
id: v15.string()
|
|
1036
|
+
}).entries
|
|
1037
|
+
});
|
|
1038
|
+
|
|
1039
|
+
// src/request/types/runesMethods/getBalance.ts
|
|
1040
|
+
var v16 = __toESM(require("valibot"));
|
|
1041
|
+
var runesGetBalanceMethodName = "runes_getBalance";
|
|
1042
|
+
var runesGetBalanceParamsSchema = v16.nullish(v16.null());
|
|
1043
|
+
var runesGetBalanceResultSchema = v16.object({
|
|
1044
|
+
balances: v16.array(
|
|
1045
|
+
v16.object({
|
|
1046
|
+
runeName: v16.string(),
|
|
1047
|
+
amount: v16.string(),
|
|
1048
|
+
divisibility: v16.number(),
|
|
1049
|
+
symbol: v16.string(),
|
|
1050
|
+
inscriptionId: v16.nullish(v16.string())
|
|
714
1051
|
})
|
|
715
1052
|
)
|
|
716
1053
|
});
|
|
717
|
-
var
|
|
1054
|
+
var runesGetBalanceRequestMessageSchema = v16.object({
|
|
718
1055
|
...rpcRequestMessageSchema.entries,
|
|
719
|
-
...
|
|
720
|
-
method:
|
|
721
|
-
params:
|
|
722
|
-
id:
|
|
1056
|
+
...v16.object({
|
|
1057
|
+
method: v16.literal(runesGetBalanceMethodName),
|
|
1058
|
+
params: runesGetBalanceParamsSchema,
|
|
1059
|
+
id: v16.string()
|
|
1060
|
+
}).entries
|
|
1061
|
+
});
|
|
1062
|
+
|
|
1063
|
+
// src/request/types/runesMethods/mint.ts
|
|
1064
|
+
var v17 = __toESM(require("valibot"));
|
|
1065
|
+
var runesMintMethodName = "runes_mint";
|
|
1066
|
+
var runesMintParamsSchema = v17.object({
|
|
1067
|
+
appServiceFee: v17.optional(v17.number()),
|
|
1068
|
+
appServiceFeeAddress: v17.optional(v17.string()),
|
|
1069
|
+
destinationAddress: v17.string(),
|
|
1070
|
+
feeRate: v17.number(),
|
|
1071
|
+
refundAddress: v17.string(),
|
|
1072
|
+
repeats: v17.number(),
|
|
1073
|
+
runeName: v17.string(),
|
|
1074
|
+
network: v17.optional(v17.enum(BitcoinNetworkType))
|
|
1075
|
+
});
|
|
1076
|
+
var runesMintResultSchema = v17.object({
|
|
1077
|
+
orderId: v17.string(),
|
|
1078
|
+
fundTransactionId: v17.string(),
|
|
1079
|
+
fundingAddress: v17.string()
|
|
1080
|
+
});
|
|
1081
|
+
var runesMintRequestMessageSchema = v17.object({
|
|
1082
|
+
...rpcRequestMessageSchema.entries,
|
|
1083
|
+
...v17.object({
|
|
1084
|
+
method: v17.literal(runesMintMethodName),
|
|
1085
|
+
params: runesMintParamsSchema,
|
|
1086
|
+
id: v17.string()
|
|
723
1087
|
}).entries
|
|
724
1088
|
});
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
1089
|
+
|
|
1090
|
+
// src/request/types/runesMethods/transfer.ts
|
|
1091
|
+
var v18 = __toESM(require("valibot"));
|
|
1092
|
+
var runesTransferMethodName = "runes_transfer";
|
|
1093
|
+
var runesTransferParamsSchema = v18.object({
|
|
1094
|
+
recipients: v18.array(
|
|
1095
|
+
v18.object({
|
|
1096
|
+
runeName: v18.string(),
|
|
1097
|
+
amount: v18.string(),
|
|
1098
|
+
address: v18.string()
|
|
732
1099
|
})
|
|
733
1100
|
)
|
|
734
1101
|
});
|
|
735
|
-
var
|
|
1102
|
+
var runesTransferResultSchema = v18.object({
|
|
1103
|
+
txid: v18.string()
|
|
1104
|
+
});
|
|
1105
|
+
var runesTransferRequestMessageSchema = v18.object({
|
|
736
1106
|
...rpcRequestMessageSchema.entries,
|
|
737
|
-
...
|
|
738
|
-
method:
|
|
739
|
-
params:
|
|
740
|
-
id:
|
|
1107
|
+
...v18.object({
|
|
1108
|
+
method: v18.literal(runesTransferMethodName),
|
|
1109
|
+
params: runesTransferParamsSchema,
|
|
1110
|
+
id: v18.string()
|
|
741
1111
|
}).entries
|
|
742
1112
|
});
|
|
743
|
-
var TransferRunesResultSchema = v8.object({
|
|
744
|
-
txid: v8.string()
|
|
745
|
-
});
|
|
746
1113
|
|
|
747
1114
|
// src/request/types/ordinalsMethods.ts
|
|
748
|
-
var
|
|
1115
|
+
var v19 = __toESM(require("valibot"));
|
|
749
1116
|
var getInscriptionsMethodName = "ord_getInscriptions";
|
|
750
|
-
var getInscriptionsParamsSchema =
|
|
751
|
-
offset:
|
|
752
|
-
limit:
|
|
753
|
-
});
|
|
754
|
-
var getInscriptionsResultSchema =
|
|
755
|
-
total:
|
|
756
|
-
limit:
|
|
757
|
-
offset:
|
|
758
|
-
inscriptions:
|
|
759
|
-
|
|
760
|
-
inscriptionId:
|
|
761
|
-
inscriptionNumber:
|
|
762
|
-
address:
|
|
763
|
-
collectionName:
|
|
764
|
-
postage:
|
|
765
|
-
contentLength:
|
|
766
|
-
contentType:
|
|
767
|
-
timestamp:
|
|
768
|
-
offset:
|
|
769
|
-
genesisTransaction:
|
|
770
|
-
output:
|
|
1117
|
+
var getInscriptionsParamsSchema = v19.object({
|
|
1118
|
+
offset: v19.number(),
|
|
1119
|
+
limit: v19.number()
|
|
1120
|
+
});
|
|
1121
|
+
var getInscriptionsResultSchema = v19.object({
|
|
1122
|
+
total: v19.number(),
|
|
1123
|
+
limit: v19.number(),
|
|
1124
|
+
offset: v19.number(),
|
|
1125
|
+
inscriptions: v19.array(
|
|
1126
|
+
v19.object({
|
|
1127
|
+
inscriptionId: v19.string(),
|
|
1128
|
+
inscriptionNumber: v19.string(),
|
|
1129
|
+
address: v19.string(),
|
|
1130
|
+
collectionName: v19.optional(v19.string()),
|
|
1131
|
+
postage: v19.string(),
|
|
1132
|
+
contentLength: v19.string(),
|
|
1133
|
+
contentType: v19.string(),
|
|
1134
|
+
timestamp: v19.number(),
|
|
1135
|
+
offset: v19.number(),
|
|
1136
|
+
genesisTransaction: v19.string(),
|
|
1137
|
+
output: v19.string()
|
|
771
1138
|
})
|
|
772
1139
|
)
|
|
773
1140
|
});
|
|
774
|
-
var
|
|
1141
|
+
var getInscriptionsRequestMessageSchema = v19.object({
|
|
775
1142
|
...rpcRequestMessageSchema.entries,
|
|
776
|
-
...
|
|
777
|
-
method:
|
|
1143
|
+
...v19.object({
|
|
1144
|
+
method: v19.literal(getInscriptionsMethodName),
|
|
778
1145
|
params: getInscriptionsParamsSchema,
|
|
779
|
-
id:
|
|
1146
|
+
id: v19.string()
|
|
780
1147
|
}).entries
|
|
781
1148
|
});
|
|
782
1149
|
var sendInscriptionsMethodName = "ord_sendInscriptions";
|
|
783
|
-
var sendInscriptionsParamsSchema =
|
|
784
|
-
transfers:
|
|
785
|
-
|
|
786
|
-
address:
|
|
787
|
-
inscriptionId:
|
|
1150
|
+
var sendInscriptionsParamsSchema = v19.object({
|
|
1151
|
+
transfers: v19.array(
|
|
1152
|
+
v19.object({
|
|
1153
|
+
address: v19.string(),
|
|
1154
|
+
inscriptionId: v19.string()
|
|
788
1155
|
})
|
|
789
1156
|
)
|
|
790
1157
|
});
|
|
791
|
-
var sendInscriptionsResultSchema =
|
|
792
|
-
txid:
|
|
1158
|
+
var sendInscriptionsResultSchema = v19.object({
|
|
1159
|
+
txid: v19.string()
|
|
793
1160
|
});
|
|
794
|
-
var
|
|
1161
|
+
var sendInscriptionsRequestMessageSchema = v19.object({
|
|
795
1162
|
...rpcRequestMessageSchema.entries,
|
|
796
|
-
...
|
|
797
|
-
method:
|
|
1163
|
+
...v19.object({
|
|
1164
|
+
method: v19.literal(sendInscriptionsMethodName),
|
|
798
1165
|
params: sendInscriptionsParamsSchema,
|
|
799
|
-
id:
|
|
1166
|
+
id: v19.string()
|
|
800
1167
|
}).entries
|
|
801
1168
|
});
|
|
802
1169
|
|
|
@@ -813,13 +1180,13 @@ var request = async (method, params, providerId) => {
|
|
|
813
1180
|
throw new Error("A wallet method is required");
|
|
814
1181
|
}
|
|
815
1182
|
const response = await provider.request(method, params);
|
|
816
|
-
if (
|
|
1183
|
+
if (v20.is(rpcErrorResponseMessageSchema, response)) {
|
|
817
1184
|
return {
|
|
818
1185
|
status: "error",
|
|
819
1186
|
error: response.error
|
|
820
1187
|
};
|
|
821
1188
|
}
|
|
822
|
-
if (
|
|
1189
|
+
if (v20.is(rpcSuccessResponseMessageSchema, response)) {
|
|
823
1190
|
return {
|
|
824
1191
|
status: "success",
|
|
825
1192
|
result: response.result
|
|
@@ -1771,7 +2138,6 @@ var signMultipleTransactions = async (options) => {
|
|
|
1771
2138
|
RpcErrorCode,
|
|
1772
2139
|
RpcIdSchema,
|
|
1773
2140
|
SatsConnectAdapter,
|
|
1774
|
-
TransferRunesResultSchema,
|
|
1775
2141
|
accountChangeEventName,
|
|
1776
2142
|
accountChangeSchema,
|
|
1777
2143
|
addListener,
|
|
@@ -1818,15 +2184,11 @@ var signMultipleTransactions = async (options) => {
|
|
|
1818
2184
|
getInfoResultSchema,
|
|
1819
2185
|
getInscriptionsMethodName,
|
|
1820
2186
|
getInscriptionsParamsSchema,
|
|
2187
|
+
getInscriptionsRequestMessageSchema,
|
|
1821
2188
|
getInscriptionsResultSchema,
|
|
1822
|
-
getInscriptionsSchema,
|
|
1823
2189
|
getProviderById,
|
|
1824
2190
|
getProviderOrThrow,
|
|
1825
2191
|
getProviders,
|
|
1826
|
-
getRunesBalanceMethodName,
|
|
1827
|
-
getRunesBalanceParamsSchema,
|
|
1828
|
-
getRunesBalanceRequestMessageSchema,
|
|
1829
|
-
getRunesBalanceResultSchema,
|
|
1830
2192
|
getSupportedWallets,
|
|
1831
2193
|
getWalletTypeMethodName,
|
|
1832
2194
|
getWalletTypeParamsSchema,
|
|
@@ -1850,11 +2212,27 @@ var signMultipleTransactions = async (options) => {
|
|
|
1850
2212
|
rpcRequestMessageSchema,
|
|
1851
2213
|
rpcResponseMessageSchema,
|
|
1852
2214
|
rpcSuccessResponseMessageSchema,
|
|
2215
|
+
runesEtchMethodName,
|
|
2216
|
+
runesEtchParamsSchema,
|
|
2217
|
+
runesEtchRequestMessageSchema,
|
|
2218
|
+
runesEtchResultSchema,
|
|
2219
|
+
runesGetBalanceMethodName,
|
|
2220
|
+
runesGetBalanceParamsSchema,
|
|
2221
|
+
runesGetBalanceRequestMessageSchema,
|
|
2222
|
+
runesGetBalanceResultSchema,
|
|
2223
|
+
runesMintMethodName,
|
|
2224
|
+
runesMintParamsSchema,
|
|
2225
|
+
runesMintRequestMessageSchema,
|
|
2226
|
+
runesMintResultSchema,
|
|
2227
|
+
runesTransferMethodName,
|
|
2228
|
+
runesTransferParamsSchema,
|
|
2229
|
+
runesTransferRequestMessageSchema,
|
|
2230
|
+
runesTransferResultSchema,
|
|
1853
2231
|
sendBtcTransaction,
|
|
1854
2232
|
sendInscriptionsMethodName,
|
|
1855
2233
|
sendInscriptionsParamsSchema,
|
|
2234
|
+
sendInscriptionsRequestMessageSchema,
|
|
1856
2235
|
sendInscriptionsResultSchema,
|
|
1857
|
-
sendInscriptionsSchema,
|
|
1858
2236
|
sendTransferMethodName,
|
|
1859
2237
|
sendTransferParamsSchema,
|
|
1860
2238
|
sendTransferRequestMessageSchema,
|
|
@@ -1871,17 +2249,38 @@ var signMultipleTransactions = async (options) => {
|
|
|
1871
2249
|
signPsbtRequestMessageSchema,
|
|
1872
2250
|
signPsbtResultSchema,
|
|
1873
2251
|
signTransaction,
|
|
2252
|
+
stxCallContractMethodName,
|
|
2253
|
+
stxCallContractParamsSchema,
|
|
2254
|
+
stxCallContractRequestMessageSchema,
|
|
2255
|
+
stxCallContractResultSchema,
|
|
2256
|
+
stxDeployContractMethodName,
|
|
2257
|
+
stxDeployContractParamsSchema,
|
|
2258
|
+
stxDeployContractRequestMessageSchema,
|
|
2259
|
+
stxDeployContractResultSchema,
|
|
2260
|
+
stxGetAccountsMethodName,
|
|
2261
|
+
stxGetAccountsParamsSchema,
|
|
2262
|
+
stxGetAccountsRequestMessageSchema,
|
|
2263
|
+
stxGetAccountsResultSchema,
|
|
1874
2264
|
stxGetAddressesMethodName,
|
|
1875
2265
|
stxGetAddressesParamsSchema,
|
|
1876
2266
|
stxGetAddressesRequestMessageSchema,
|
|
1877
2267
|
stxGetAddressesResultSchema,
|
|
2268
|
+
stxSignMessageMethodName,
|
|
2269
|
+
stxSignMessageParamsSchema,
|
|
2270
|
+
stxSignMessageRequestMessageSchema,
|
|
2271
|
+
stxSignMessageResultSchema,
|
|
2272
|
+
stxSignStructuredMessageMethodName,
|
|
2273
|
+
stxSignStructuredMessageParamsSchema,
|
|
2274
|
+
stxSignStructuredMessageRequestMessageSchema,
|
|
2275
|
+
stxSignStructuredMessageResultSchema,
|
|
1878
2276
|
stxSignTransactionMethodName,
|
|
1879
2277
|
stxSignTransactionParamsSchema,
|
|
1880
2278
|
stxSignTransactionRequestMessageSchema,
|
|
1881
2279
|
stxSignTransactionResultSchema,
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
2280
|
+
stxTransferStxMethodName,
|
|
2281
|
+
stxTransferStxParamsSchema,
|
|
2282
|
+
stxTransferStxRequestMessageSchema,
|
|
2283
|
+
stxTransferStxResultSchema,
|
|
1885
2284
|
walletEventSchema,
|
|
1886
2285
|
walletTypeSchema,
|
|
1887
2286
|
walletTypes
|