@sats-connect/core 0.4.0-ff58e17 → 0.4.1-06b81c7

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.js CHANGED
@@ -36,12 +36,14 @@ __export(src_exports, {
36
36
  BitcoinNetworkType: () => BitcoinNetworkType,
37
37
  DefaultAdaptersInfo: () => DefaultAdaptersInfo,
38
38
  MessageSigningProtocols: () => MessageSigningProtocols,
39
+ PermissionRequestParams: () => PermissionRequestParams,
39
40
  RpcErrorCode: () => RpcErrorCode,
40
41
  RpcIdSchema: () => RpcIdSchema,
41
42
  SatsConnectAdapter: () => SatsConnectAdapter,
42
- TransferRunesResultSchema: () => TransferRunesResultSchema,
43
+ accountActionsSchema: () => accountActionsSchema,
43
44
  accountChangeEventName: () => accountChangeEventName,
44
45
  accountChangeSchema: () => accountChangeSchema,
46
+ accountPermissionSchema: () => accountPermissionSchema,
45
47
  addListener: () => addListener,
46
48
  addressSchema: () => addressSchema,
47
49
  connectMethodName: () => connectMethodName,
@@ -86,15 +88,11 @@ __export(src_exports, {
86
88
  getInfoResultSchema: () => getInfoResultSchema,
87
89
  getInscriptionsMethodName: () => getInscriptionsMethodName,
88
90
  getInscriptionsParamsSchema: () => getInscriptionsParamsSchema,
91
+ getInscriptionsRequestMessageSchema: () => getInscriptionsRequestMessageSchema,
89
92
  getInscriptionsResultSchema: () => getInscriptionsResultSchema,
90
- getInscriptionsSchema: () => getInscriptionsSchema,
91
93
  getProviderById: () => getProviderById,
92
94
  getProviderOrThrow: () => getProviderOrThrow,
93
95
  getProviders: () => getProviders,
94
- getRunesBalanceMethodName: () => getRunesBalanceMethodName,
95
- getRunesBalanceParamsSchema: () => getRunesBalanceParamsSchema,
96
- getRunesBalanceRequestMessageSchema: () => getRunesBalanceRequestMessageSchema,
97
- getRunesBalanceResultSchema: () => getRunesBalanceResultSchema,
98
96
  getSupportedWallets: () => getSupportedWallets,
99
97
  getWalletTypeMethodName: () => getWalletTypeMethodName,
100
98
  getWalletTypeParamsSchema: () => getWalletTypeParamsSchema,
@@ -103,7 +101,7 @@ __export(src_exports, {
103
101
  isProviderInstalled: () => isProviderInstalled,
104
102
  networkChangeEventName: () => networkChangeEventName,
105
103
  networkChangeSchema: () => networkChangeSchema,
106
- permissionTemplate: () => permissionTemplate,
104
+ permission: () => permission,
107
105
  removeDefaultProvider: () => removeDefaultProvider,
108
106
  renouncePermissionsMethodName: () => renouncePermissionsMethodName,
109
107
  renouncePermissionsParamsSchema: () => renouncePermissionsParamsSchema,
@@ -118,11 +116,27 @@ __export(src_exports, {
118
116
  rpcRequestMessageSchema: () => rpcRequestMessageSchema,
119
117
  rpcResponseMessageSchema: () => rpcResponseMessageSchema,
120
118
  rpcSuccessResponseMessageSchema: () => rpcSuccessResponseMessageSchema,
119
+ runesEtchMethodName: () => runesEtchMethodName,
120
+ runesEtchParamsSchema: () => runesEtchParamsSchema,
121
+ runesEtchRequestMessageSchema: () => runesEtchRequestMessageSchema,
122
+ runesEtchResultSchema: () => runesEtchResultSchema,
123
+ runesGetBalanceMethodName: () => runesGetBalanceMethodName,
124
+ runesGetBalanceParamsSchema: () => runesGetBalanceParamsSchema,
125
+ runesGetBalanceRequestMessageSchema: () => runesGetBalanceRequestMessageSchema,
126
+ runesGetBalanceResultSchema: () => runesGetBalanceResultSchema,
127
+ runesMintMethodName: () => runesMintMethodName,
128
+ runesMintParamsSchema: () => runesMintParamsSchema,
129
+ runesMintRequestMessageSchema: () => runesMintRequestMessageSchema,
130
+ runesMintResultSchema: () => runesMintResultSchema,
131
+ runesTransferMethodName: () => runesTransferMethodName,
132
+ runesTransferParamsSchema: () => runesTransferParamsSchema,
133
+ runesTransferRequestMessageSchema: () => runesTransferRequestMessageSchema,
134
+ runesTransferResultSchema: () => runesTransferResultSchema,
121
135
  sendBtcTransaction: () => sendBtcTransaction,
122
136
  sendInscriptionsMethodName: () => sendInscriptionsMethodName,
123
137
  sendInscriptionsParamsSchema: () => sendInscriptionsParamsSchema,
138
+ sendInscriptionsRequestMessageSchema: () => sendInscriptionsRequestMessageSchema,
124
139
  sendInscriptionsResultSchema: () => sendInscriptionsResultSchema,
125
- sendInscriptionsSchema: () => sendInscriptionsSchema,
126
140
  sendTransferMethodName: () => sendTransferMethodName,
127
141
  sendTransferParamsSchema: () => sendTransferParamsSchema,
128
142
  sendTransferRequestMessageSchema: () => sendTransferRequestMessageSchema,
@@ -143,18 +157,41 @@ __export(src_exports, {
143
157
  stxCallContractParamsSchema: () => stxCallContractParamsSchema,
144
158
  stxCallContractRequestMessageSchema: () => stxCallContractRequestMessageSchema,
145
159
  stxCallContractResultSchema: () => stxCallContractResultSchema,
160
+ stxDeployContractMethodName: () => stxDeployContractMethodName,
161
+ stxDeployContractParamsSchema: () => stxDeployContractParamsSchema,
162
+ stxDeployContractRequestMessageSchema: () => stxDeployContractRequestMessageSchema,
163
+ stxDeployContractResultSchema: () => stxDeployContractResultSchema,
164
+ stxGetAccountsMethodName: () => stxGetAccountsMethodName,
165
+ stxGetAccountsParamsSchema: () => stxGetAccountsParamsSchema,
166
+ stxGetAccountsRequestMessageSchema: () => stxGetAccountsRequestMessageSchema,
167
+ stxGetAccountsResultSchema: () => stxGetAccountsResultSchema,
146
168
  stxGetAddressesMethodName: () => stxGetAddressesMethodName,
147
169
  stxGetAddressesParamsSchema: () => stxGetAddressesParamsSchema,
148
170
  stxGetAddressesRequestMessageSchema: () => stxGetAddressesRequestMessageSchema,
149
171
  stxGetAddressesResultSchema: () => stxGetAddressesResultSchema,
172
+ stxSignMessageMethodName: () => stxSignMessageMethodName,
173
+ stxSignMessageParamsSchema: () => stxSignMessageParamsSchema,
174
+ stxSignMessageRequestMessageSchema: () => stxSignMessageRequestMessageSchema,
175
+ stxSignMessageResultSchema: () => stxSignMessageResultSchema,
176
+ stxSignStructuredMessageMethodName: () => stxSignStructuredMessageMethodName,
177
+ stxSignStructuredMessageParamsSchema: () => stxSignStructuredMessageParamsSchema,
178
+ stxSignStructuredMessageRequestMessageSchema: () => stxSignStructuredMessageRequestMessageSchema,
179
+ stxSignStructuredMessageResultSchema: () => stxSignStructuredMessageResultSchema,
150
180
  stxSignTransactionMethodName: () => stxSignTransactionMethodName,
151
181
  stxSignTransactionParamsSchema: () => stxSignTransactionParamsSchema,
152
182
  stxSignTransactionRequestMessageSchema: () => stxSignTransactionRequestMessageSchema,
153
183
  stxSignTransactionResultSchema: () => stxSignTransactionResultSchema,
154
- transferRunesMethodName: () => transferRunesMethodName,
155
- transferRunesParamsSchema: () => transferRunesParamsSchema,
156
- transferRunesRequestSchema: () => transferRunesRequestSchema,
184
+ stxSignTransactionsMethodName: () => stxSignTransactionsMethodName,
185
+ stxSignTransactionsParamsSchema: () => stxSignTransactionsParamsSchema,
186
+ stxSignTransactionsRequestMessageSchema: () => stxSignTransactionsRequestMessageSchema,
187
+ stxSignTransactionsResultSchema: () => stxSignTransactionsResultSchema,
188
+ stxTransferStxMethodName: () => stxTransferStxMethodName,
189
+ stxTransferStxParamsSchema: () => stxTransferStxParamsSchema,
190
+ stxTransferStxRequestMessageSchema: () => stxTransferStxRequestMessageSchema,
191
+ stxTransferStxResultSchema: () => stxTransferStxResultSchema,
192
+ walletActionsSchema: () => walletActionsSchema,
157
193
  walletEventSchema: () => walletEventSchema,
194
+ walletPermissionSchema: () => walletPermissionSchema,
158
195
  walletTypeSchema: () => walletTypeSchema,
159
196
  walletTypes: () => walletTypes
160
197
  });
@@ -189,8 +226,7 @@ async function getProviderOrThrow(getProvider) {
189
226
  return provider;
190
227
  }
191
228
  function getProviders() {
192
- if (!window.btc_providers)
193
- window.btc_providers = [];
229
+ if (!window.btc_providers) window.btc_providers = [];
194
230
  return window.btc_providers;
195
231
  }
196
232
  function getProviderById(providerId) {
@@ -209,10 +245,7 @@ function removeDefaultProvider() {
209
245
  localStorage.removeItem("sats-connect_defaultProvider");
210
246
  }
211
247
  function getSupportedWallets() {
212
- const ambientProviders = getProviders();
213
- const { xverse, ...defaultProviders } = DefaultAdaptersInfo;
214
- const allProviders = [...ambientProviders, ...Object.values(defaultProviders)];
215
- const wallets = allProviders.map((provider) => {
248
+ const wallets = Object.values(DefaultAdaptersInfo).map((provider) => {
216
249
  {
217
250
  return {
218
251
  ...provider,
@@ -225,11 +258,11 @@ function getSupportedWallets() {
225
258
 
226
259
  // src/types.ts
227
260
  var v2 = __toESM(require("valibot"));
228
- var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType3) => {
229
- BitcoinNetworkType3["Mainnet"] = "Mainnet";
230
- BitcoinNetworkType3["Testnet"] = "Testnet";
231
- BitcoinNetworkType3["Signet"] = "Signet";
232
- return BitcoinNetworkType3;
261
+ var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
262
+ BitcoinNetworkType2["Mainnet"] = "Mainnet";
263
+ BitcoinNetworkType2["Testnet"] = "Testnet";
264
+ BitcoinNetworkType2["Signet"] = "Signet";
265
+ return BitcoinNetworkType2;
233
266
  })(BitcoinNetworkType || {});
234
267
  var RpcIdSchema = v2.optional(v2.union([v2.string(), v2.number(), v2.null()]));
235
268
  var rpcRequestMessageSchema = v2.object({
@@ -246,7 +279,7 @@ var rpcRequestMessageSchema = v2.object({
246
279
  v2.null()
247
280
  ])
248
281
  ),
249
- id: RpcIdSchema
282
+ id: v2.unwrap(RpcIdSchema)
250
283
  });
251
284
  var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode2) => {
252
285
  RpcErrorCode2[RpcErrorCode2["PARSE_ERROR"] = -32700] = "PARSE_ERROR";
@@ -275,16 +308,127 @@ var rpcResponseMessageSchema = v2.union([
275
308
  ]);
276
309
 
277
310
  // src/request/index.ts
278
- var v10 = __toESM(require("valibot"));
311
+ var v21 = __toESM(require("valibot"));
312
+
313
+ // src/request/types/stxMethods/callContract.ts
314
+ var v3 = __toESM(require("valibot"));
315
+ var stxCallContractMethodName = "stx_callContract";
316
+ var stxCallContractParamsSchema = v3.object({
317
+ /**
318
+ * The contract principal.
319
+ *
320
+ * E.g. `"SPKE...GD5C.my-contract"`
321
+ */
322
+ contract: v3.string(),
323
+ /**
324
+ * The name of the function to call.
325
+ *
326
+ * Note: spec changes ongoing,
327
+ * https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
328
+ */
329
+ functionName: v3.string(),
330
+ /**
331
+ * The function's arguments. The arguments are expected to be hex-encoded
332
+ * strings of Clarity values.
333
+ *
334
+ * To convert Clarity values to their hex representation, the `cvToString`
335
+ * helper from the `@stacks/transactions` package may be helpful.
336
+ *
337
+ * ```js
338
+ * import { cvToString } from '@stacks/transactions';
339
+ *
340
+ * const functionArgs = [someClarityValue1, someClarityValue2];
341
+ * const hexArgs = functionArgs.map(cvToString);
342
+ * ```
343
+ */
344
+ arguments: v3.optional(v3.array(v3.string()))
345
+ });
346
+ var stxCallContractResultSchema = v3.object({
347
+ /**
348
+ * The ID of the transaction.
349
+ */
350
+ txid: v3.string(),
351
+ /**
352
+ * A Stacks transaction as a hex-encoded string.
353
+ */
354
+ transaction: v3.string()
355
+ });
356
+ var stxCallContractRequestMessageSchema = v3.object({
357
+ ...rpcRequestMessageSchema.entries,
358
+ ...v3.object({
359
+ method: v3.literal(stxCallContractMethodName),
360
+ params: stxCallContractParamsSchema,
361
+ id: v3.string()
362
+ }).entries
363
+ });
279
364
 
280
- // src/request/types/stxMethods.ts
365
+ // src/request/types/stxMethods/deployContract.ts
281
366
  var v4 = __toESM(require("valibot"));
367
+ var stxDeployContractMethodName = "stx_deployContract";
368
+ var stxDeployContractParamsSchema = v4.object({
369
+ /**
370
+ * Name of the contract.
371
+ */
372
+ name: v4.string(),
373
+ /**
374
+ * The source code of the Clarity contract.
375
+ */
376
+ clarityCode: v4.string(),
377
+ /**
378
+ * The version of the Clarity contract.
379
+ */
380
+ clarityVersion: v4.optional(v4.string())
381
+ });
382
+ var stxDeployContractResultSchema = v4.object({
383
+ /**
384
+ * The ID of the transaction.
385
+ */
386
+ txid: v4.string(),
387
+ /**
388
+ * A Stacks transaction as a hex-encoded string.
389
+ */
390
+ transaction: v4.string()
391
+ });
392
+ var stxDeployContractRequestMessageSchema = v4.object({
393
+ ...rpcRequestMessageSchema.entries,
394
+ ...v4.object({
395
+ method: v4.literal(stxDeployContractMethodName),
396
+ params: stxDeployContractParamsSchema,
397
+ id: v4.string()
398
+ }).entries
399
+ });
400
+
401
+ // src/request/types/stxMethods/getAccounts.ts
402
+ var v5 = __toESM(require("valibot"));
403
+ var stxGetAccountsMethodName = "stx_getAccounts";
404
+ var stxGetAccountsParamsSchema = v5.nullish(v5.null());
405
+ var stxGetAccountsResultSchema = v5.object({
406
+ /**
407
+ * The addresses generated for the given purposes.
408
+ */
409
+ addresses: v5.array(
410
+ v5.object({
411
+ address: v5.string(),
412
+ publicKey: v5.string(),
413
+ gaiaHubUrl: v5.string(),
414
+ gaiaAppKey: v5.string()
415
+ })
416
+ )
417
+ });
418
+ var stxGetAccountsRequestMessageSchema = v5.object({
419
+ ...rpcRequestMessageSchema.entries,
420
+ ...v5.object({
421
+ method: v5.literal(stxGetAccountsMethodName),
422
+ params: stxGetAccountsParamsSchema,
423
+ id: v5.string()
424
+ }).entries
425
+ });
282
426
 
283
427
  // src/addresses/index.ts
284
428
  var import_jsontokens = require("jsontokens");
285
429
 
286
430
  // src/addresses/types.ts
287
- var v3 = __toESM(require("valibot"));
431
+ var v6 = __toESM(require("valibot"));
288
432
  var AddressPurpose = /* @__PURE__ */ ((AddressPurpose2) => {
289
433
  AddressPurpose2["Ordinals"] = "ordinals";
290
434
  AddressPurpose2["Payment"] = "payment";
@@ -300,11 +444,11 @@ var AddressType = /* @__PURE__ */ ((AddressType3) => {
300
444
  AddressType3["stacks"] = "stacks";
301
445
  return AddressType3;
302
446
  })(AddressType || {});
303
- var addressSchema = v3.object({
304
- address: v3.string(),
305
- publicKey: v3.string(),
306
- purpose: v3.enum(AddressPurpose),
307
- addressType: v3.enum(AddressType)
447
+ var addressSchema = v6.object({
448
+ address: v6.string(),
449
+ publicKey: v6.string(),
450
+ purpose: v6.enum(AddressPurpose),
451
+ addressType: v6.enum(AddressType)
308
452
  });
309
453
 
310
454
  // src/addresses/index.ts
@@ -324,167 +468,301 @@ var getAddress = async (options) => {
324
468
  }
325
469
  };
326
470
 
327
- // src/request/types/stxMethods.ts
328
- var stxCallContractMethodName = "stx_callContract";
329
- var stxCallContractParamsSchema = v4.object({
471
+ // src/request/types/stxMethods/getAddresses.ts
472
+ var v7 = __toESM(require("valibot"));
473
+ var stxGetAddressesMethodName = "stx_getAddresses";
474
+ var stxGetAddressesParamsSchema = v7.nullish(
475
+ v7.object({
476
+ /**
477
+ * A message to be displayed to the user in the request prompt.
478
+ */
479
+ message: v7.optional(v7.string())
480
+ })
481
+ );
482
+ var stxGetAddressesResultSchema = v7.object({
330
483
  /**
331
- * The contract principal.
332
- *
333
- * E.g. `"SPKE...GD5C.my-contract"`
484
+ * The addresses generated for the given purposes.
485
+ */
486
+ addresses: v7.array(addressSchema)
487
+ });
488
+ var stxGetAddressesRequestMessageSchema = v7.object({
489
+ ...rpcRequestMessageSchema.entries,
490
+ ...v7.object({
491
+ method: v7.literal(stxGetAddressesMethodName),
492
+ params: stxGetAddressesParamsSchema,
493
+ id: v7.string()
494
+ }).entries
495
+ });
496
+
497
+ // src/request/types/stxMethods/signMessage.ts
498
+ var v8 = __toESM(require("valibot"));
499
+ var stxSignMessageMethodName = "stx_signMessage";
500
+ var stxSignMessageParamsSchema = v8.object({
501
+ /**
502
+ * The message to sign.
334
503
  */
335
- contract: v4.string(),
504
+ message: v8.string(),
336
505
  /**
337
- * The name of the function to call.
338
- *
339
- * Note: spec changes ongoing,
340
- * https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
506
+ * The public key to sign the message with.
341
507
  */
342
- functionName: v4.string(),
508
+ publicKey: v8.string(),
343
509
  /**
344
- * The function's arguments. The arguments are expected to be hex-encoded
345
- * strings of Clarity values.
346
- *
347
- * To convert Clarity values to their hex representation, the `cvToString`
348
- * helper from the `@stacks/transactions` package may be helpful.
349
- *
350
- * ```js
351
- * import { cvToString } from '@stacks/transactions';
352
- *
353
- * const functionArgs = [someClarityValue1, someClarityValue2];
354
- * const hexArgs = functionArgs.map(cvToString);
355
- * ```
510
+ * The format version of the parameter.
356
511
  */
357
- arguments: v4.optional(v4.array(v4.string()))
512
+ parameterFormatVersion: v8.optional(v8.number())
358
513
  });
359
- var stxCallContractResultSchema = v4.object({
514
+ var stxSignMessageResultSchema = v8.object({
360
515
  /**
361
- * The ID of the transaction.
516
+ * The signature of the message.
362
517
  */
363
- txid: v4.string(),
518
+ signature: v8.string(),
364
519
  /**
365
- * A Stacks transaction as a hex-encoded string.
520
+ * The public key used to sign the message.
366
521
  */
367
- transaction: v4.string()
522
+ publicKey: v8.string()
368
523
  });
369
- var stxCallContractRequestMessageSchema = v4.object({
524
+ var stxSignMessageRequestMessageSchema = v8.object({
370
525
  ...rpcRequestMessageSchema.entries,
371
- ...v4.object({
372
- method: v4.literal(stxCallContractMethodName),
373
- params: stxCallContractParamsSchema,
374
- id: v4.string()
526
+ ...v8.object({
527
+ method: v8.literal(stxSignMessageMethodName),
528
+ params: stxSignMessageParamsSchema,
529
+ id: v8.string()
375
530
  }).entries
376
531
  });
377
- var stxGetAddressesMethodName = "stx_getAddresses";
378
- var stxGetAddressesParamsSchema = v4.nullish(
379
- v4.object({
380
- /**
381
- * A message to be displayed to the user in the request prompt.
382
- */
383
- message: v4.optional(v4.string())
384
- })
385
- );
386
- var stxGetAddressesResultSchema = v4.object({
532
+
533
+ // src/request/types/stxMethods/signStructuredMessage.ts
534
+ var v9 = __toESM(require("valibot"));
535
+ var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
536
+ var stxSignStructuredMessageParamsSchema = v9.object({
387
537
  /**
388
- * The addresses generated for the given purposes.
538
+ * The domain to be signed.
539
+ */
540
+ domain: v9.string(),
541
+ /**
542
+ * Message payload to be signed.
543
+ */
544
+ message: v9.string(),
545
+ /**
546
+ * The format version of the parameter.
389
547
  */
390
- addresses: v4.array(addressSchema)
548
+ parameterFormatVersion: v9.optional(v9.number()),
549
+ /**
550
+ * The public key to sign the message with.
551
+ */
552
+ publicKey: v9.optional(v9.string())
553
+ });
554
+ var stxSignStructuredMessageResultSchema = v9.object({
555
+ /**
556
+ * Signature of the message.
557
+ */
558
+ signature: v9.string(),
559
+ /**
560
+ * Public key as hex-encoded string.
561
+ */
562
+ publicKey: v9.string()
391
563
  });
392
- var stxGetAddressesRequestMessageSchema = v4.object({
564
+ var stxSignStructuredMessageRequestMessageSchema = v9.object({
393
565
  ...rpcRequestMessageSchema.entries,
394
- ...v4.object({
395
- method: v4.literal(stxGetAddressesMethodName),
396
- params: stxGetAddressesParamsSchema,
397
- id: v4.string()
566
+ ...v9.object({
567
+ method: v9.literal(stxSignStructuredMessageMethodName),
568
+ params: stxSignStructuredMessageParamsSchema,
569
+ id: v9.string()
398
570
  }).entries
399
571
  });
572
+
573
+ // src/request/types/stxMethods/signTransaction.ts
574
+ var v10 = __toESM(require("valibot"));
400
575
  var stxSignTransactionMethodName = "stx_signTransaction";
401
- var stxSignTransactionParamsSchema = v4.object({
576
+ var stxSignTransactionParamsSchema = v10.object({
402
577
  /**
403
578
  * The transaction to sign as a hex-encoded string.
404
579
  */
405
- transaction: v4.string(),
580
+ transaction: v10.string(),
406
581
  /**
407
582
  * The public key to sign the transaction with. The wallet may use any key
408
583
  * when not provided.
409
584
  */
410
- pubkey: v4.optional(v4.string()),
585
+ pubkey: v10.optional(v10.string()),
411
586
  /**
412
587
  * Whether to broadcast the transaction after signing. Defaults to `true`.
413
588
  */
414
- broadcast: v4.optional(v4.boolean())
589
+ broadcast: v10.optional(v10.boolean())
415
590
  });
416
- var stxSignTransactionResultSchema = v4.object({
591
+ var stxSignTransactionResultSchema = v10.object({
417
592
  /**
418
593
  * The signed transaction as a hex-encoded string.
419
594
  */
420
- transaction: v4.string()
595
+ transaction: v10.string()
421
596
  });
422
- var stxSignTransactionRequestMessageSchema = v4.object({
597
+ var stxSignTransactionRequestMessageSchema = v10.object({
423
598
  ...rpcRequestMessageSchema.entries,
424
- ...v4.object({
425
- method: v4.literal(stxSignTransactionMethodName),
599
+ ...v10.object({
600
+ method: v10.literal(stxSignTransactionMethodName),
426
601
  params: stxSignTransactionParamsSchema,
427
- id: v4.string()
602
+ id: v10.string()
603
+ }).entries
604
+ });
605
+
606
+ // src/request/types/stxMethods/signTransactions.ts
607
+ var v11 = __toESM(require("valibot"));
608
+ var stxSignTransactionsMethodName = "stx_signTransactions";
609
+ var stxSignTransactionsParamsSchema = v11.object({
610
+ /**
611
+ * The transactions to sign as hex-encoded strings.
612
+ */
613
+ transactions: v11.array(
614
+ v11.object({
615
+ transactionHex: v11.string(),
616
+ /**
617
+ * Whether the transaction should be broadcast after signing. Defaults to `false`.
618
+ */
619
+ broadcast: v11.optional(v11.boolean())
620
+ })
621
+ )
622
+ });
623
+ var stxSignTransactionsResultSchema = v11.object({
624
+ /**
625
+ * The signed transactions as hex-encoded strings. In the same order as the sign request.
626
+ */
627
+ transactions: v11.array(v11.string())
628
+ });
629
+ var stxSignTransactionsRequestMessageSchema = v11.object({
630
+ ...rpcRequestMessageSchema.entries,
631
+ ...v11.object({
632
+ method: v11.literal(stxSignTransactionsMethodName),
633
+ params: stxSignTransactionsParamsSchema,
634
+ id: v11.string()
635
+ }).entries
636
+ });
637
+
638
+ // src/request/types/stxMethods/transferStx.ts
639
+ var v12 = __toESM(require("valibot"));
640
+ var stxTransferStxMethodName = "stx_transferStx";
641
+ var stxTransferStxParamsSchema = v12.object({
642
+ /**
643
+ * Amount of STX tokens to transfer in microstacks as a string. Anything
644
+ * parseable by `BigInt` is acceptable.
645
+ *
646
+ * Example,
647
+ *
648
+ * ```js
649
+ * const amount1 = 1234;
650
+ * const amount2 = 1234n;
651
+ * const amount3 = '1234';
652
+ * ```
653
+ */
654
+ amount: v12.union([v12.number(), v12.string()]),
655
+ /**
656
+ * The recipeint's principal.
657
+ */
658
+ recipient: v12.string(),
659
+ /**
660
+ * A string representing the memo.
661
+ */
662
+ memo: v12.optional(v12.string()),
663
+ /**
664
+ * Version of parameter format.
665
+ */
666
+ version: v12.optional(v12.string()),
667
+ /**
668
+ * The mode of the post conditions.
669
+ */
670
+ postConditionMode: v12.optional(v12.number()),
671
+ /**
672
+ * A hex-encoded string representing the post conditions.
673
+ *
674
+ * A post condition may be converted to it's hex representation using the `serializePostCondition` helper from the `@stacks/transactions` package,
675
+ *
676
+ * ```js
677
+ * import { serializePostCondition } from '@stacks/transactions';
678
+ *
679
+ * const postCondition = somePostCondition;
680
+ * const hexPostCondition = serializePostCondition(postCondition).toString('hex');
681
+ * ```
682
+ */
683
+ postConditions: v12.optional(v12.array(v12.string())),
684
+ /**
685
+ * The public key to sign the transaction with. The wallet may use any key
686
+ * when not provided.
687
+ */
688
+ pubkey: v12.optional(v12.string())
689
+ });
690
+ var stxTransferStxResultSchema = v12.object({
691
+ /**
692
+ * The ID of the transaction.
693
+ */
694
+ txid: v12.string(),
695
+ /**
696
+ * A Stacks transaction as a hex-encoded string.
697
+ */
698
+ transaction: v12.string()
699
+ });
700
+ var stxTransferStxRequestMessageSchema = v12.object({
701
+ ...rpcRequestMessageSchema.entries,
702
+ ...v12.object({
703
+ method: v12.literal(stxTransferStxMethodName),
704
+ params: stxTransferStxParamsSchema,
705
+ id: v12.string()
428
706
  }).entries
429
707
  });
430
708
 
431
709
  // src/request/types/btcMethods.ts
432
- var v6 = __toESM(require("valibot"));
710
+ var v14 = __toESM(require("valibot"));
433
711
 
434
712
  // src/request/types/common.ts
435
- var v5 = __toESM(require("valibot"));
713
+ var v13 = __toESM(require("valibot"));
436
714
  var walletTypes = ["software", "ledger"];
437
- var walletTypeSchema = v5.picklist(walletTypes);
715
+ var walletTypeSchema = v13.picklist(walletTypes);
438
716
 
439
717
  // src/request/types/btcMethods.ts
440
718
  var getInfoMethodName = "getInfo";
441
- var getInfoParamsSchema = v6.nullish(v6.null());
442
- var getInfoResultSchema = v6.object({
719
+ var getInfoParamsSchema = v14.nullish(v14.null());
720
+ var getInfoResultSchema = v14.object({
443
721
  /**
444
722
  * Version of the wallet.
445
723
  */
446
- version: v6.string(),
724
+ version: v14.string(),
447
725
  /**
448
726
  * [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
449
727
  */
450
- methods: v6.optional(v6.array(v6.string())),
728
+ methods: v14.optional(v14.array(v14.string())),
451
729
  /**
452
730
  * List of WBIP standards supported by the wallet. Not currently used.
453
731
  */
454
- supports: v6.array(v6.string())
732
+ supports: v14.array(v14.string())
455
733
  });
456
- var getInfoRequestMessageSchema = v6.object({
734
+ var getInfoRequestMessageSchema = v14.object({
457
735
  ...rpcRequestMessageSchema.entries,
458
- ...v6.object({
459
- method: v6.literal(getInfoMethodName),
736
+ ...v14.object({
737
+ method: v14.literal(getInfoMethodName),
460
738
  params: getInfoParamsSchema,
461
- id: v6.string()
739
+ id: v14.string()
462
740
  }).entries
463
741
  });
464
742
  var getAddressesMethodName = "getAddresses";
465
- var getAddressesParamsSchema = v6.object({
743
+ var getAddressesParamsSchema = v14.object({
466
744
  /**
467
745
  * The purposes for which to generate addresses. See
468
746
  * {@linkcode AddressPurpose} for available purposes.
469
747
  */
470
- purposes: v6.array(v6.enum(AddressPurpose)),
748
+ purposes: v14.array(v14.enum(AddressPurpose)),
471
749
  /**
472
750
  * A message to be displayed to the user in the request prompt.
473
751
  */
474
- message: v6.optional(v6.string())
752
+ message: v14.optional(v14.string())
475
753
  });
476
- var getAddressesResultSchema = v6.object({
754
+ var getAddressesResultSchema = v14.object({
477
755
  /**
478
756
  * The addresses generated for the given purposes.
479
757
  */
480
- addresses: v6.array(addressSchema)
758
+ addresses: v14.array(addressSchema)
481
759
  });
482
- var getAddressesRequestMessageSchema = v6.object({
760
+ var getAddressesRequestMessageSchema = v14.object({
483
761
  ...rpcRequestMessageSchema.entries,
484
- ...v6.object({
485
- method: v6.literal(getAddressesMethodName),
762
+ ...v14.object({
763
+ method: v14.literal(getAddressesMethodName),
486
764
  params: getAddressesParamsSchema,
487
- id: v6.string()
765
+ id: v14.string()
488
766
  }).entries
489
767
  });
490
768
  var signMessageMethodName = "signMessage";
@@ -493,364 +771,456 @@ var MessageSigningProtocols = /* @__PURE__ */ ((MessageSigningProtocols2) => {
493
771
  MessageSigningProtocols2["BIP322"] = "BIP322";
494
772
  return MessageSigningProtocols2;
495
773
  })(MessageSigningProtocols || {});
496
- var signMessageParamsSchema = v6.object({
774
+ var signMessageParamsSchema = v14.object({
497
775
  /**
498
776
  * The address used for signing.
499
777
  **/
500
- address: v6.string(),
778
+ address: v14.string(),
501
779
  /**
502
780
  * The message to sign.
503
781
  **/
504
- message: v6.string(),
782
+ message: v14.string(),
505
783
  /**
506
784
  * The protocol to use for signing the message.
507
785
  */
508
- protocol: v6.optional(v6.enum(MessageSigningProtocols))
786
+ protocol: v14.optional(v14.enum(MessageSigningProtocols))
509
787
  });
510
- var signMessageResultSchema = v6.object({
788
+ var signMessageResultSchema = v14.object({
511
789
  /**
512
790
  * The signature of the message.
513
791
  */
514
- signature: v6.string(),
792
+ signature: v14.string(),
515
793
  /**
516
794
  * hash of the message.
517
795
  */
518
- messageHash: v6.string(),
796
+ messageHash: v14.string(),
519
797
  /**
520
798
  * The address used for signing.
521
799
  */
522
- address: v6.string(),
800
+ address: v14.string(),
523
801
  /**
524
802
  * The protocol to use for signing the message.
525
803
  */
526
- protocol: v6.enum(MessageSigningProtocols)
804
+ protocol: v14.enum(MessageSigningProtocols)
527
805
  });
528
- var signMessageRequestMessageSchema = v6.object({
806
+ var signMessageRequestMessageSchema = v14.object({
529
807
  ...rpcRequestMessageSchema.entries,
530
- ...v6.object({
531
- method: v6.literal(signMessageMethodName),
808
+ ...v14.object({
809
+ method: v14.literal(signMessageMethodName),
532
810
  params: signMessageParamsSchema,
533
- id: v6.string()
811
+ id: v14.string()
534
812
  }).entries
535
813
  });
536
814
  var sendTransferMethodName = "sendTransfer";
537
- var sendTransferParamsSchema = v6.object({
815
+ var sendTransferParamsSchema = v14.object({
538
816
  /**
539
817
  * Array of recipients to send to.
540
818
  * The amount to send to each recipient is in satoshis.
541
819
  */
542
- recipients: v6.array(
543
- v6.object({
544
- address: v6.string(),
545
- amount: v6.number()
820
+ recipients: v14.array(
821
+ v14.object({
822
+ address: v14.string(),
823
+ amount: v14.number()
546
824
  })
547
825
  )
548
826
  });
549
- var sendTransferResultSchema = v6.object({
827
+ var sendTransferResultSchema = v14.object({
550
828
  /**
551
829
  * The transaction id as a hex-encoded string.
552
830
  */
553
- txid: v6.string()
831
+ txid: v14.string()
554
832
  });
555
- var sendTransferRequestMessageSchema = v6.object({
833
+ var sendTransferRequestMessageSchema = v14.object({
556
834
  ...rpcRequestMessageSchema.entries,
557
- ...v6.object({
558
- method: v6.literal(sendTransferMethodName),
835
+ ...v14.object({
836
+ method: v14.literal(sendTransferMethodName),
559
837
  params: sendTransferParamsSchema,
560
- id: v6.string()
838
+ id: v14.string()
561
839
  }).entries
562
840
  });
563
841
  var signPsbtMethodName = "signPsbt";
564
- var signPsbtParamsSchema = v6.object({
842
+ var signPsbtParamsSchema = v14.object({
565
843
  /**
566
844
  * The base64 encoded PSBT to sign.
567
845
  */
568
- psbt: v6.string(),
846
+ psbt: v14.string(),
569
847
  /**
570
848
  * The inputs to sign.
571
849
  * The key is the address and the value is an array of indexes of the inputs to sign.
572
850
  */
573
- signInputs: v6.record(v6.string(), v6.array(v6.number())),
574
- allowedSignHash: v6.optional(v6.number()),
851
+ signInputs: v14.record(v14.string(), v14.array(v14.number())),
575
852
  /**
576
853
  * Whether to broadcast the transaction after signing.
577
854
  **/
578
- broadcast: v6.optional(v6.boolean())
855
+ broadcast: v14.optional(v14.boolean())
579
856
  });
580
- var signPsbtResultSchema = v6.object({
857
+ var signPsbtResultSchema = v14.object({
581
858
  /**
582
859
  * The base64 encoded PSBT after signing.
583
860
  */
584
- psbt: v6.string(),
861
+ psbt: v14.string(),
585
862
  /**
586
863
  * The transaction id as a hex-encoded string.
587
864
  * This is only returned if the transaction was broadcast.
588
865
  **/
589
- txid: v6.optional(v6.string())
866
+ txid: v14.optional(v14.string())
590
867
  });
591
- var signPsbtRequestMessageSchema = v6.object({
868
+ var signPsbtRequestMessageSchema = v14.object({
592
869
  ...rpcRequestMessageSchema.entries,
593
- ...v6.object({
594
- method: v6.literal(signPsbtMethodName),
870
+ ...v14.object({
871
+ method: v14.literal(signPsbtMethodName),
595
872
  params: signPsbtParamsSchema,
596
- id: v6.string()
873
+ id: v14.string()
597
874
  }).entries
598
875
  });
599
876
  var getAccountsMethodName = "getAccounts";
600
- var getAccountsParamsSchema = v6.object({
877
+ var getAccountsParamsSchema = v14.object({
601
878
  /**
602
879
  * The purposes for which to generate addresses. See
603
880
  * {@linkcode AddressPurpose} for available purposes.
604
881
  */
605
- purposes: v6.array(v6.enum(AddressPurpose)),
882
+ purposes: v14.array(v14.enum(AddressPurpose)),
606
883
  /**
607
884
  * A message to be displayed to the user in the request prompt.
608
885
  */
609
- message: v6.optional(v6.string())
886
+ message: v14.optional(v14.string())
610
887
  });
611
- var getAccountsResultSchema = v6.array(
612
- v6.object({
888
+ var getAccountsResultSchema = v14.array(
889
+ v14.object({
613
890
  ...addressSchema.entries,
614
- ...v6.object({
891
+ ...v14.object({
615
892
  walletType: walletTypeSchema
616
893
  }).entries
617
894
  })
618
895
  );
619
- var getAccountsRequestMessageSchema = v6.object({
896
+ var getAccountsRequestMessageSchema = v14.object({
620
897
  ...rpcRequestMessageSchema.entries,
621
- ...v6.object({
622
- method: v6.literal(getAccountsMethodName),
898
+ ...v14.object({
899
+ method: v14.literal(getAccountsMethodName),
623
900
  params: getAccountsParamsSchema,
624
- id: v6.string()
901
+ id: v14.string()
625
902
  }).entries
626
903
  });
627
904
  var getBalanceMethodName = "getBalance";
628
- var getBalanceParamsSchema = v6.nullish(v6.null());
629
- var getBalanceResultSchema = v6.object({
905
+ var getBalanceParamsSchema = v14.nullish(v14.null());
906
+ var getBalanceResultSchema = v14.object({
630
907
  /**
631
908
  * The confirmed balance of the wallet in sats. Using a string due to chrome
632
909
  * messages not supporting bigint
633
910
  * (https://issues.chromium.org/issues/40116184).
634
911
  */
635
- confirmed: v6.string(),
912
+ confirmed: v14.string(),
636
913
  /**
637
914
  * The unconfirmed balance of the wallet in sats. Using a string due to chrome
638
915
  * messages not supporting bigint
639
916
  * (https://issues.chromium.org/issues/40116184).
640
917
  */
641
- unconfirmed: v6.string(),
918
+ unconfirmed: v14.string(),
642
919
  /**
643
920
  * The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
644
921
  * sats. Using a string due to chrome messages not supporting bigint
645
922
  * (https://issues.chromium.org/issues/40116184).
646
923
  */
647
- total: v6.string()
924
+ total: v14.string()
648
925
  });
649
- var getBalanceRequestMessageSchema = v6.object({
926
+ var getBalanceRequestMessageSchema = v14.object({
650
927
  ...rpcRequestMessageSchema.entries,
651
- ...v6.object({
652
- method: v6.literal(getBalanceMethodName),
653
- id: v6.string()
928
+ ...v14.object({
929
+ method: v14.literal(getBalanceMethodName),
930
+ id: v14.string()
654
931
  }).entries
655
932
  });
656
933
 
657
934
  // src/request/types/walletMethods.ts
658
- var v7 = __toESM(require("valibot"));
659
- var import_xverse_core = require("@secretkeylabs/xverse-core");
660
- var permissionTemplate = v7.variant("type", [
661
- v7.object({
662
- ...v7.omit(import_xverse_core.permissions.resources.account.accountPermissionSchema, ["clientId", "actions"]).entries,
663
- actions: v7.partial(import_xverse_core.permissions.resources.account.accountActionsSchema)
935
+ var v15 = __toESM(require("valibot"));
936
+ var accountActionsSchema = v15.object({
937
+ read: v15.optional(v15.boolean())
938
+ });
939
+ var walletActionsSchema = v15.object({});
940
+ var accountPermissionSchema = v15.object({
941
+ type: v15.literal("account"),
942
+ resourceId: v15.string(),
943
+ clientId: v15.string(),
944
+ actions: accountActionsSchema
945
+ });
946
+ var walletPermissionSchema = v15.object({
947
+ type: v15.literal("wallet"),
948
+ resourceId: v15.string(),
949
+ clientId: v15.string(),
950
+ actions: walletActionsSchema
951
+ });
952
+ var PermissionRequestParams = v15.variant("type", [
953
+ v15.object({
954
+ ...v15.omit(accountPermissionSchema, ["clientId"]).entries
664
955
  }),
665
- v7.object({
666
- ...v7.omit(import_xverse_core.permissions.resources.wallet.walletPermissionSchema, ["clientId"]).entries,
667
- actions: v7.partial(import_xverse_core.permissions.resources.wallet.walletActionsSchema)
956
+ v15.object({
957
+ ...v15.omit(walletPermissionSchema, ["clientId"]).entries
668
958
  })
669
959
  ]);
960
+ var permission = v15.variant("type", [accountPermissionSchema, walletPermissionSchema]);
670
961
  var requestPermissionsMethodName = "wallet_requestPermissions";
671
- var requestPermissionsParamsSchema = v7.nullish(v7.array(permissionTemplate));
672
- var requestPermissionsResultSchema = v7.literal(true);
673
- var requestPermissionsRequestMessageSchema = v7.object({
962
+ var requestPermissionsParamsSchema = v15.nullish(v15.array(PermissionRequestParams));
963
+ var requestPermissionsResultSchema = v15.literal(true);
964
+ var requestPermissionsRequestMessageSchema = v15.object({
674
965
  ...rpcRequestMessageSchema.entries,
675
- ...v7.object({
676
- method: v7.literal(requestPermissionsMethodName),
966
+ ...v15.object({
967
+ method: v15.literal(requestPermissionsMethodName),
677
968
  params: requestPermissionsParamsSchema,
678
- id: v7.string()
969
+ id: v15.string()
679
970
  }).entries
680
971
  });
681
972
  var renouncePermissionsMethodName = "wallet_renouncePermissions";
682
- var renouncePermissionsParamsSchema = v7.nullish(v7.null());
683
- var renouncePermissionsResultSchema = v7.nullish(v7.null());
684
- var renouncePermissionsRequestMessageSchema = v7.object({
973
+ var renouncePermissionsParamsSchema = v15.nullish(v15.null());
974
+ var renouncePermissionsResultSchema = v15.nullish(v15.null());
975
+ var renouncePermissionsRequestMessageSchema = v15.object({
685
976
  ...rpcRequestMessageSchema.entries,
686
- ...v7.object({
687
- method: v7.literal(renouncePermissionsMethodName),
977
+ ...v15.object({
978
+ method: v15.literal(renouncePermissionsMethodName),
688
979
  params: renouncePermissionsParamsSchema,
689
- id: v7.string()
980
+ id: v15.string()
690
981
  }).entries
691
982
  });
692
983
  var disconnectMethodName = "wallet_disconnect";
693
- var disconnectParamsSchema = v7.nullish(v7.null());
694
- var disconnectResultSchema = v7.nullish(v7.null());
695
- var disconnectRequestMessageSchema = v7.object({
984
+ var disconnectParamsSchema = v15.nullish(v15.null());
985
+ var disconnectResultSchema = v15.nullish(v15.null());
986
+ var disconnectRequestMessageSchema = v15.object({
696
987
  ...rpcRequestMessageSchema.entries,
697
- ...v7.object({
698
- method: v7.literal(disconnectMethodName),
988
+ ...v15.object({
989
+ method: v15.literal(disconnectMethodName),
699
990
  params: disconnectParamsSchema,
700
- id: v7.string()
991
+ id: v15.string()
701
992
  }).entries
702
993
  });
703
994
  var getWalletTypeMethodName = "wallet_getWalletType";
704
- var getWalletTypeParamsSchema = v7.nullish(v7.null());
995
+ var getWalletTypeParamsSchema = v15.nullish(v15.null());
705
996
  var getWalletTypeResultSchema = walletTypeSchema;
706
- var getWalletTypeRequestMessageSchema = v7.object({
997
+ var getWalletTypeRequestMessageSchema = v15.object({
707
998
  ...rpcRequestMessageSchema.entries,
708
- ...v7.object({
709
- method: v7.literal(getWalletTypeMethodName),
999
+ ...v15.object({
1000
+ method: v15.literal(getWalletTypeMethodName),
710
1001
  params: getWalletTypeParamsSchema,
711
- id: v7.string()
1002
+ id: v15.string()
712
1003
  }).entries
713
1004
  });
714
1005
  var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
715
- var getCurrentPermissionsParamsSchema = v7.nullish(v7.null());
716
- var getCurrentPermissionsResultSchema = v7.array(import_xverse_core.permissions.store.permission);
717
- var getCurrentPermissionsRequestMessageSchema = v7.object({
1006
+ var getCurrentPermissionsParamsSchema = v15.nullish(v15.null());
1007
+ var getCurrentPermissionsResultSchema = v15.array(permission);
1008
+ var getCurrentPermissionsRequestMessageSchema = v15.object({
718
1009
  ...rpcRequestMessageSchema.entries,
719
- ...v7.object({
720
- method: v7.literal(getCurrentPermissionsMethodName),
1010
+ ...v15.object({
1011
+ method: v15.literal(getCurrentPermissionsMethodName),
721
1012
  params: getCurrentPermissionsParamsSchema,
722
- id: v7.string()
1013
+ id: v15.string()
723
1014
  }).entries
724
1015
  });
725
1016
  var getAccountMethodName = "wallet_getAccount";
726
- var getAccountParamsSchema = v7.nullish(v7.null());
727
- var getAccountResultSchema = v7.object({
728
- id: import_xverse_core.permissions.utils.account.accountIdSchema,
729
- addresses: v7.array(addressSchema),
1017
+ var getAccountParamsSchema = v15.nullish(v15.null());
1018
+ var getAccountResultSchema = v15.object({
1019
+ id: v15.string(),
1020
+ addresses: v15.array(addressSchema),
730
1021
  walletType: walletTypeSchema
731
1022
  });
732
- var getAccountRequestMessageSchema = v7.object({
1023
+ var getAccountRequestMessageSchema = v15.object({
733
1024
  ...rpcRequestMessageSchema.entries,
734
- ...v7.object({
735
- method: v7.literal(getAccountMethodName),
1025
+ ...v15.object({
1026
+ method: v15.literal(getAccountMethodName),
736
1027
  params: getAccountParamsSchema,
737
- id: v7.string()
1028
+ id: v15.string()
738
1029
  }).entries
739
1030
  });
740
1031
  var connectMethodName = "wallet_connect";
741
- var connectParamsSchema = v7.nullish(
742
- v7.object({
743
- permissions: v7.optional(v7.array(permissionTemplate))
1032
+ var connectParamsSchema = v15.nullish(
1033
+ v15.object({
1034
+ permissions: v15.optional(v15.array(PermissionRequestParams)),
1035
+ addresses: v15.optional(v15.array(v15.enum(AddressPurpose))),
1036
+ message: v15.optional(
1037
+ v15.pipe(v15.string(), v15.maxLength(80, "The message must not exceed 80 characters."))
1038
+ )
744
1039
  })
745
1040
  );
746
1041
  var connectResultSchema = getAccountResultSchema;
747
- var connectRequestMessageSchema = v7.object({
1042
+ var connectRequestMessageSchema = v15.object({
748
1043
  ...rpcRequestMessageSchema.entries,
749
- ...v7.object({
750
- method: v7.literal(connectMethodName),
1044
+ ...v15.object({
1045
+ method: v15.literal(connectMethodName),
751
1046
  params: connectParamsSchema,
752
- id: v7.string()
1047
+ id: v15.string()
753
1048
  }).entries
754
1049
  });
755
1050
 
756
- // src/request/types/runesMethods.ts
757
- var v8 = __toESM(require("valibot"));
758
- var getRunesBalanceMethodName = "runes_getBalance";
759
- var getRunesBalanceParamsSchema = v8.nullish(v8.null());
760
- var getRunesBalanceResultSchema = v8.object({
761
- balances: v8.array(
762
- v8.object({
763
- runeName: v8.string(),
764
- amount: v8.string(),
765
- divisibility: v8.number(),
766
- symbol: v8.string(),
767
- inscriptionId: v8.nullish(v8.string())
1051
+ // src/request/types/runesMethods/etch.ts
1052
+ var v16 = __toESM(require("valibot"));
1053
+ var runesEtchMethodName = "runes_etch";
1054
+ var etchTermsSchema = v16.object({
1055
+ amount: v16.string(),
1056
+ cap: v16.string(),
1057
+ heightStart: v16.optional(v16.string()),
1058
+ heightEnd: v16.optional(v16.string()),
1059
+ offsetStart: v16.optional(v16.string()),
1060
+ offsetEnd: v16.optional(v16.string())
1061
+ });
1062
+ var inscriptionDetailsSchema = v16.object({
1063
+ contentType: v16.string(),
1064
+ contentBase64: v16.string()
1065
+ });
1066
+ var runesEtchParamsSchema = v16.object({
1067
+ runeName: v16.string(),
1068
+ divisibility: v16.optional(v16.number()),
1069
+ symbol: v16.optional(v16.string()),
1070
+ premine: v16.optional(v16.string()),
1071
+ isMintable: v16.boolean(),
1072
+ delegateInscriptionId: v16.optional(v16.string()),
1073
+ destinationAddress: v16.string(),
1074
+ refundAddress: v16.string(),
1075
+ feeRate: v16.number(),
1076
+ appServiceFee: v16.optional(v16.number()),
1077
+ appServiceFeeAddress: v16.optional(v16.string()),
1078
+ terms: v16.optional(etchTermsSchema),
1079
+ inscriptionDetails: v16.optional(inscriptionDetailsSchema),
1080
+ network: v16.optional(v16.enum(BitcoinNetworkType))
1081
+ });
1082
+ var runesEtchResultSchema = v16.object({
1083
+ orderId: v16.string(),
1084
+ fundTransactionId: v16.string(),
1085
+ fundingAddress: v16.string()
1086
+ });
1087
+ var runesEtchRequestMessageSchema = v16.object({
1088
+ ...rpcRequestMessageSchema.entries,
1089
+ ...v16.object({
1090
+ method: v16.literal(runesEtchMethodName),
1091
+ params: runesEtchParamsSchema,
1092
+ id: v16.string()
1093
+ }).entries
1094
+ });
1095
+
1096
+ // src/request/types/runesMethods/getBalance.ts
1097
+ var v17 = __toESM(require("valibot"));
1098
+ var runesGetBalanceMethodName = "runes_getBalance";
1099
+ var runesGetBalanceParamsSchema = v17.nullish(v17.null());
1100
+ var runesGetBalanceResultSchema = v17.object({
1101
+ balances: v17.array(
1102
+ v17.object({
1103
+ runeName: v17.string(),
1104
+ amount: v17.string(),
1105
+ divisibility: v17.number(),
1106
+ symbol: v17.string(),
1107
+ inscriptionId: v17.nullish(v17.string())
768
1108
  })
769
1109
  )
770
1110
  });
771
- var getRunesBalanceRequestMessageSchema = v8.object({
1111
+ var runesGetBalanceRequestMessageSchema = v17.object({
772
1112
  ...rpcRequestMessageSchema.entries,
773
- ...v8.object({
774
- method: v8.literal(getRunesBalanceMethodName),
775
- params: getRunesBalanceParamsSchema,
776
- id: v8.string()
1113
+ ...v17.object({
1114
+ method: v17.literal(runesGetBalanceMethodName),
1115
+ params: runesGetBalanceParamsSchema,
1116
+ id: v17.string()
1117
+ }).entries
1118
+ });
1119
+
1120
+ // src/request/types/runesMethods/mint.ts
1121
+ var v18 = __toESM(require("valibot"));
1122
+ var runesMintMethodName = "runes_mint";
1123
+ var runesMintParamsSchema = v18.object({
1124
+ appServiceFee: v18.optional(v18.number()),
1125
+ appServiceFeeAddress: v18.optional(v18.string()),
1126
+ destinationAddress: v18.string(),
1127
+ feeRate: v18.number(),
1128
+ refundAddress: v18.string(),
1129
+ repeats: v18.number(),
1130
+ runeName: v18.string(),
1131
+ network: v18.optional(v18.enum(BitcoinNetworkType))
1132
+ });
1133
+ var runesMintResultSchema = v18.object({
1134
+ orderId: v18.string(),
1135
+ fundTransactionId: v18.string(),
1136
+ fundingAddress: v18.string()
1137
+ });
1138
+ var runesMintRequestMessageSchema = v18.object({
1139
+ ...rpcRequestMessageSchema.entries,
1140
+ ...v18.object({
1141
+ method: v18.literal(runesMintMethodName),
1142
+ params: runesMintParamsSchema,
1143
+ id: v18.string()
777
1144
  }).entries
778
1145
  });
779
- var transferRunesMethodName = "runes_transfer";
780
- var transferRunesParamsSchema = v8.object({
781
- recipients: v8.array(
782
- v8.object({
783
- runeName: v8.string(),
784
- amount: v8.string(),
785
- address: v8.string()
1146
+
1147
+ // src/request/types/runesMethods/transfer.ts
1148
+ var v19 = __toESM(require("valibot"));
1149
+ var runesTransferMethodName = "runes_transfer";
1150
+ var runesTransferParamsSchema = v19.object({
1151
+ recipients: v19.array(
1152
+ v19.object({
1153
+ runeName: v19.string(),
1154
+ amount: v19.string(),
1155
+ address: v19.string()
786
1156
  })
787
1157
  )
788
1158
  });
789
- var transferRunesRequestSchema = v8.object({
1159
+ var runesTransferResultSchema = v19.object({
1160
+ txid: v19.string()
1161
+ });
1162
+ var runesTransferRequestMessageSchema = v19.object({
790
1163
  ...rpcRequestMessageSchema.entries,
791
- ...v8.object({
792
- method: v8.literal(transferRunesMethodName),
793
- params: transferRunesParamsSchema,
794
- id: v8.string()
1164
+ ...v19.object({
1165
+ method: v19.literal(runesTransferMethodName),
1166
+ params: runesTransferParamsSchema,
1167
+ id: v19.string()
795
1168
  }).entries
796
1169
  });
797
- var TransferRunesResultSchema = v8.object({
798
- txid: v8.string()
799
- });
800
1170
 
801
1171
  // src/request/types/ordinalsMethods.ts
802
- var v9 = __toESM(require("valibot"));
1172
+ var v20 = __toESM(require("valibot"));
803
1173
  var getInscriptionsMethodName = "ord_getInscriptions";
804
- var getInscriptionsParamsSchema = v9.object({
805
- offset: v9.number(),
806
- limit: v9.number()
807
- });
808
- var getInscriptionsResultSchema = v9.object({
809
- total: v9.number(),
810
- limit: v9.number(),
811
- offset: v9.number(),
812
- inscriptions: v9.array(
813
- v9.object({
814
- inscriptionId: v9.string(),
815
- inscriptionNumber: v9.string(),
816
- address: v9.string(),
817
- collectionName: v9.optional(v9.string()),
818
- postage: v9.string(),
819
- contentLength: v9.string(),
820
- contentType: v9.string(),
821
- timestamp: v9.number(),
822
- offset: v9.number(),
823
- genesisTransaction: v9.string(),
824
- output: v9.string()
1174
+ var getInscriptionsParamsSchema = v20.object({
1175
+ offset: v20.number(),
1176
+ limit: v20.number()
1177
+ });
1178
+ var getInscriptionsResultSchema = v20.object({
1179
+ total: v20.number(),
1180
+ limit: v20.number(),
1181
+ offset: v20.number(),
1182
+ inscriptions: v20.array(
1183
+ v20.object({
1184
+ inscriptionId: v20.string(),
1185
+ inscriptionNumber: v20.string(),
1186
+ address: v20.string(),
1187
+ collectionName: v20.optional(v20.string()),
1188
+ postage: v20.string(),
1189
+ contentLength: v20.string(),
1190
+ contentType: v20.string(),
1191
+ timestamp: v20.number(),
1192
+ offset: v20.number(),
1193
+ genesisTransaction: v20.string(),
1194
+ output: v20.string()
825
1195
  })
826
1196
  )
827
1197
  });
828
- var getInscriptionsSchema = v9.object({
1198
+ var getInscriptionsRequestMessageSchema = v20.object({
829
1199
  ...rpcRequestMessageSchema.entries,
830
- ...v9.object({
831
- method: v9.literal(getInscriptionsMethodName),
1200
+ ...v20.object({
1201
+ method: v20.literal(getInscriptionsMethodName),
832
1202
  params: getInscriptionsParamsSchema,
833
- id: v9.string()
1203
+ id: v20.string()
834
1204
  }).entries
835
1205
  });
836
1206
  var sendInscriptionsMethodName = "ord_sendInscriptions";
837
- var sendInscriptionsParamsSchema = v9.object({
838
- transfers: v9.array(
839
- v9.object({
840
- address: v9.string(),
841
- inscriptionId: v9.string()
1207
+ var sendInscriptionsParamsSchema = v20.object({
1208
+ transfers: v20.array(
1209
+ v20.object({
1210
+ address: v20.string(),
1211
+ inscriptionId: v20.string()
842
1212
  })
843
1213
  )
844
1214
  });
845
- var sendInscriptionsResultSchema = v9.object({
846
- txid: v9.string()
1215
+ var sendInscriptionsResultSchema = v20.object({
1216
+ txid: v20.string()
847
1217
  });
848
- var sendInscriptionsSchema = v9.object({
1218
+ var sendInscriptionsRequestMessageSchema = v20.object({
849
1219
  ...rpcRequestMessageSchema.entries,
850
- ...v9.object({
851
- method: v9.literal(sendInscriptionsMethodName),
1220
+ ...v20.object({
1221
+ method: v20.literal(sendInscriptionsMethodName),
852
1222
  params: sendInscriptionsParamsSchema,
853
- id: v9.string()
1223
+ id: v20.string()
854
1224
  }).entries
855
1225
  });
856
1226
 
@@ -867,13 +1237,13 @@ var request = async (method, params, providerId) => {
867
1237
  throw new Error("A wallet method is required");
868
1238
  }
869
1239
  const response = await provider.request(method, params);
870
- if (v10.is(rpcErrorResponseMessageSchema, response)) {
1240
+ if (v21.is(rpcErrorResponseMessageSchema, response)) {
871
1241
  return {
872
1242
  status: "error",
873
1243
  error: response.error
874
1244
  };
875
1245
  }
876
- if (v10.is(rpcSuccessResponseMessageSchema, response)) {
1246
+ if (v21.is(rpcSuccessResponseMessageSchema, response)) {
877
1247
  return {
878
1248
  status: "success",
879
1249
  result: response.result
@@ -1470,15 +1840,14 @@ var UnisatAdapter = class extends SatsConnectAdapter {
1470
1840
  autoFinalized: broadcast,
1471
1841
  toSignInputs: convertSignInputsToInputType(signInputs)
1472
1842
  });
1843
+ const signedPsbtBase64 = import_buffer.Buffer.from(signedPsbt, "hex").toString("base64");
1844
+ let txid;
1473
1845
  if (broadcast) {
1474
- const txid = await window.unisat.pushPsbt(psbtHex);
1475
- return {
1476
- psbt: signedPsbt,
1477
- txid
1478
- };
1846
+ txid = await window.unisat.pushPsbt(signedPsbt);
1479
1847
  }
1480
1848
  return {
1481
- psbt: psbtHex
1849
+ psbt: signedPsbtBase64,
1850
+ txid
1482
1851
  };
1483
1852
  }
1484
1853
  requestInternal = async (method, params) => {
@@ -1629,8 +1998,7 @@ var extractOrValidateCapabilities = (provider, reportedCapabilities) => {
1629
1998
  addListener: validateCapability("addListener")
1630
1999
  };
1631
2000
  return Object.entries(capabilityMap).reduce((acc, [capability, value]) => {
1632
- if (value)
1633
- return [...acc, capability];
2001
+ if (value) return [...acc, capability];
1634
2002
  return acc;
1635
2003
  }, []);
1636
2004
  };
@@ -1822,12 +2190,14 @@ var signMultipleTransactions = async (options) => {
1822
2190
  BitcoinNetworkType,
1823
2191
  DefaultAdaptersInfo,
1824
2192
  MessageSigningProtocols,
2193
+ PermissionRequestParams,
1825
2194
  RpcErrorCode,
1826
2195
  RpcIdSchema,
1827
2196
  SatsConnectAdapter,
1828
- TransferRunesResultSchema,
2197
+ accountActionsSchema,
1829
2198
  accountChangeEventName,
1830
2199
  accountChangeSchema,
2200
+ accountPermissionSchema,
1831
2201
  addListener,
1832
2202
  addressSchema,
1833
2203
  connectMethodName,
@@ -1872,15 +2242,11 @@ var signMultipleTransactions = async (options) => {
1872
2242
  getInfoResultSchema,
1873
2243
  getInscriptionsMethodName,
1874
2244
  getInscriptionsParamsSchema,
2245
+ getInscriptionsRequestMessageSchema,
1875
2246
  getInscriptionsResultSchema,
1876
- getInscriptionsSchema,
1877
2247
  getProviderById,
1878
2248
  getProviderOrThrow,
1879
2249
  getProviders,
1880
- getRunesBalanceMethodName,
1881
- getRunesBalanceParamsSchema,
1882
- getRunesBalanceRequestMessageSchema,
1883
- getRunesBalanceResultSchema,
1884
2250
  getSupportedWallets,
1885
2251
  getWalletTypeMethodName,
1886
2252
  getWalletTypeParamsSchema,
@@ -1889,7 +2255,7 @@ var signMultipleTransactions = async (options) => {
1889
2255
  isProviderInstalled,
1890
2256
  networkChangeEventName,
1891
2257
  networkChangeSchema,
1892
- permissionTemplate,
2258
+ permission,
1893
2259
  removeDefaultProvider,
1894
2260
  renouncePermissionsMethodName,
1895
2261
  renouncePermissionsParamsSchema,
@@ -1904,11 +2270,27 @@ var signMultipleTransactions = async (options) => {
1904
2270
  rpcRequestMessageSchema,
1905
2271
  rpcResponseMessageSchema,
1906
2272
  rpcSuccessResponseMessageSchema,
2273
+ runesEtchMethodName,
2274
+ runesEtchParamsSchema,
2275
+ runesEtchRequestMessageSchema,
2276
+ runesEtchResultSchema,
2277
+ runesGetBalanceMethodName,
2278
+ runesGetBalanceParamsSchema,
2279
+ runesGetBalanceRequestMessageSchema,
2280
+ runesGetBalanceResultSchema,
2281
+ runesMintMethodName,
2282
+ runesMintParamsSchema,
2283
+ runesMintRequestMessageSchema,
2284
+ runesMintResultSchema,
2285
+ runesTransferMethodName,
2286
+ runesTransferParamsSchema,
2287
+ runesTransferRequestMessageSchema,
2288
+ runesTransferResultSchema,
1907
2289
  sendBtcTransaction,
1908
2290
  sendInscriptionsMethodName,
1909
2291
  sendInscriptionsParamsSchema,
2292
+ sendInscriptionsRequestMessageSchema,
1910
2293
  sendInscriptionsResultSchema,
1911
- sendInscriptionsSchema,
1912
2294
  sendTransferMethodName,
1913
2295
  sendTransferParamsSchema,
1914
2296
  sendTransferRequestMessageSchema,
@@ -1929,18 +2311,41 @@ var signMultipleTransactions = async (options) => {
1929
2311
  stxCallContractParamsSchema,
1930
2312
  stxCallContractRequestMessageSchema,
1931
2313
  stxCallContractResultSchema,
2314
+ stxDeployContractMethodName,
2315
+ stxDeployContractParamsSchema,
2316
+ stxDeployContractRequestMessageSchema,
2317
+ stxDeployContractResultSchema,
2318
+ stxGetAccountsMethodName,
2319
+ stxGetAccountsParamsSchema,
2320
+ stxGetAccountsRequestMessageSchema,
2321
+ stxGetAccountsResultSchema,
1932
2322
  stxGetAddressesMethodName,
1933
2323
  stxGetAddressesParamsSchema,
1934
2324
  stxGetAddressesRequestMessageSchema,
1935
2325
  stxGetAddressesResultSchema,
2326
+ stxSignMessageMethodName,
2327
+ stxSignMessageParamsSchema,
2328
+ stxSignMessageRequestMessageSchema,
2329
+ stxSignMessageResultSchema,
2330
+ stxSignStructuredMessageMethodName,
2331
+ stxSignStructuredMessageParamsSchema,
2332
+ stxSignStructuredMessageRequestMessageSchema,
2333
+ stxSignStructuredMessageResultSchema,
1936
2334
  stxSignTransactionMethodName,
1937
2335
  stxSignTransactionParamsSchema,
1938
2336
  stxSignTransactionRequestMessageSchema,
1939
2337
  stxSignTransactionResultSchema,
1940
- transferRunesMethodName,
1941
- transferRunesParamsSchema,
1942
- transferRunesRequestSchema,
2338
+ stxSignTransactionsMethodName,
2339
+ stxSignTransactionsParamsSchema,
2340
+ stxSignTransactionsRequestMessageSchema,
2341
+ stxSignTransactionsResultSchema,
2342
+ stxTransferStxMethodName,
2343
+ stxTransferStxParamsSchema,
2344
+ stxTransferStxRequestMessageSchema,
2345
+ stxTransferStxResultSchema,
2346
+ walletActionsSchema,
1943
2347
  walletEventSchema,
2348
+ walletPermissionSchema,
1944
2349
  walletTypeSchema,
1945
2350
  walletTypes
1946
2351
  });