@sats-connect/core 0.4.0-954ad8d → 0.4.0-97f6fb5
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 +585 -538
- package/dist/index.d.ts +585 -538
- package/dist/index.js +651 -255
- package/dist/index.mjs +609 -245
- package/package.json +2 -2
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,364 +731,437 @@ 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:
|
|
521
|
-
allowedSignHash:
|
|
811
|
+
signInputs: v13.record(v13.string(), v13.array(v13.number())),
|
|
812
|
+
allowedSignHash: v13.optional(v13.number()),
|
|
522
813
|
/**
|
|
523
814
|
* Whether to broadcast the transaction after signing.
|
|
524
815
|
**/
|
|
525
|
-
broadcast:
|
|
816
|
+
broadcast: v13.optional(v13.boolean())
|
|
526
817
|
});
|
|
527
|
-
var signPsbtResultSchema =
|
|
818
|
+
var signPsbtResultSchema = v13.object({
|
|
528
819
|
/**
|
|
529
820
|
* The base64 encoded PSBT after signing.
|
|
530
821
|
*/
|
|
531
|
-
psbt:
|
|
822
|
+
psbt: v13.string(),
|
|
532
823
|
/**
|
|
533
824
|
* The transaction id as a hex-encoded string.
|
|
534
825
|
* This is only returned if the transaction was broadcast.
|
|
535
826
|
**/
|
|
536
|
-
txid:
|
|
827
|
+
txid: v13.optional(v13.string())
|
|
537
828
|
});
|
|
538
|
-
var signPsbtRequestMessageSchema =
|
|
829
|
+
var signPsbtRequestMessageSchema = v13.object({
|
|
539
830
|
...rpcRequestMessageSchema.entries,
|
|
540
|
-
...
|
|
541
|
-
method:
|
|
831
|
+
...v13.object({
|
|
832
|
+
method: v13.literal(signPsbtMethodName),
|
|
542
833
|
params: signPsbtParamsSchema,
|
|
543
|
-
id:
|
|
834
|
+
id: v13.string()
|
|
544
835
|
}).entries
|
|
545
836
|
});
|
|
546
837
|
var getAccountsMethodName = "getAccounts";
|
|
547
|
-
var getAccountsParamsSchema =
|
|
838
|
+
var getAccountsParamsSchema = v13.object({
|
|
548
839
|
/**
|
|
549
840
|
* The purposes for which to generate addresses. See
|
|
550
841
|
* {@linkcode AddressPurpose} for available purposes.
|
|
551
842
|
*/
|
|
552
|
-
purposes:
|
|
843
|
+
purposes: v13.array(v13.enum(AddressPurpose)),
|
|
553
844
|
/**
|
|
554
845
|
* A message to be displayed to the user in the request prompt.
|
|
555
846
|
*/
|
|
556
|
-
message:
|
|
847
|
+
message: v13.optional(v13.string())
|
|
557
848
|
});
|
|
558
|
-
var getAccountsResultSchema =
|
|
559
|
-
|
|
849
|
+
var getAccountsResultSchema = v13.array(
|
|
850
|
+
v13.object({
|
|
560
851
|
...addressSchema.entries,
|
|
561
|
-
...
|
|
852
|
+
...v13.object({
|
|
562
853
|
walletType: walletTypeSchema
|
|
563
854
|
}).entries
|
|
564
855
|
})
|
|
565
856
|
);
|
|
566
|
-
var getAccountsRequestMessageSchema =
|
|
857
|
+
var getAccountsRequestMessageSchema = v13.object({
|
|
567
858
|
...rpcRequestMessageSchema.entries,
|
|
568
|
-
...
|
|
569
|
-
method:
|
|
859
|
+
...v13.object({
|
|
860
|
+
method: v13.literal(getAccountsMethodName),
|
|
570
861
|
params: getAccountsParamsSchema,
|
|
571
|
-
id:
|
|
862
|
+
id: v13.string()
|
|
572
863
|
}).entries
|
|
573
864
|
});
|
|
574
865
|
var getBalanceMethodName = "getBalance";
|
|
575
|
-
var getBalanceParamsSchema =
|
|
576
|
-
var getBalanceResultSchema =
|
|
866
|
+
var getBalanceParamsSchema = v13.nullish(v13.null());
|
|
867
|
+
var getBalanceResultSchema = v13.object({
|
|
577
868
|
/**
|
|
578
869
|
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
579
870
|
* messages not supporting bigint
|
|
580
871
|
* (https://issues.chromium.org/issues/40116184).
|
|
581
872
|
*/
|
|
582
|
-
confirmed:
|
|
873
|
+
confirmed: v13.string(),
|
|
583
874
|
/**
|
|
584
875
|
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
585
876
|
* messages not supporting bigint
|
|
586
877
|
* (https://issues.chromium.org/issues/40116184).
|
|
587
878
|
*/
|
|
588
|
-
unconfirmed:
|
|
879
|
+
unconfirmed: v13.string(),
|
|
589
880
|
/**
|
|
590
881
|
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
591
882
|
* sats. Using a string due to chrome messages not supporting bigint
|
|
592
883
|
* (https://issues.chromium.org/issues/40116184).
|
|
593
884
|
*/
|
|
594
|
-
total:
|
|
885
|
+
total: v13.string()
|
|
595
886
|
});
|
|
596
|
-
var getBalanceRequestMessageSchema =
|
|
887
|
+
var getBalanceRequestMessageSchema = v13.object({
|
|
597
888
|
...rpcRequestMessageSchema.entries,
|
|
598
|
-
...
|
|
599
|
-
method:
|
|
600
|
-
id:
|
|
889
|
+
...v13.object({
|
|
890
|
+
method: v13.literal(getBalanceMethodName),
|
|
891
|
+
id: v13.string()
|
|
601
892
|
}).entries
|
|
602
893
|
});
|
|
603
894
|
|
|
604
895
|
// src/request/types/walletMethods.ts
|
|
605
|
-
var
|
|
896
|
+
var v14 = __toESM(require("valibot"));
|
|
606
897
|
var import_xverse_core = require("@secretkeylabs/xverse-core");
|
|
607
|
-
var permissionTemplate =
|
|
608
|
-
|
|
609
|
-
...
|
|
610
|
-
actions: v7.partial(import_xverse_core.permissions.resources.account.accountActionsSchema)
|
|
898
|
+
var permissionTemplate = v14.variant("type", [
|
|
899
|
+
v14.object({
|
|
900
|
+
...v14.omit(import_xverse_core.permissions.resources.account.accountPermissionSchema, ["clientId"]).entries
|
|
611
901
|
}),
|
|
612
|
-
|
|
613
|
-
...
|
|
614
|
-
actions: v7.partial(import_xverse_core.permissions.resources.wallet.walletActionsSchema)
|
|
902
|
+
v14.object({
|
|
903
|
+
...v14.omit(import_xverse_core.permissions.resources.wallet.walletPermissionSchema, ["clientId"]).entries
|
|
615
904
|
})
|
|
616
905
|
]);
|
|
617
906
|
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
618
|
-
var requestPermissionsParamsSchema =
|
|
619
|
-
var requestPermissionsResultSchema =
|
|
620
|
-
var requestPermissionsRequestMessageSchema =
|
|
907
|
+
var requestPermissionsParamsSchema = v14.nullish(v14.array(permissionTemplate));
|
|
908
|
+
var requestPermissionsResultSchema = v14.literal(true);
|
|
909
|
+
var requestPermissionsRequestMessageSchema = v14.object({
|
|
621
910
|
...rpcRequestMessageSchema.entries,
|
|
622
|
-
...
|
|
623
|
-
method:
|
|
911
|
+
...v14.object({
|
|
912
|
+
method: v14.literal(requestPermissionsMethodName),
|
|
624
913
|
params: requestPermissionsParamsSchema,
|
|
625
|
-
id:
|
|
914
|
+
id: v14.string()
|
|
626
915
|
}).entries
|
|
627
916
|
});
|
|
628
917
|
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
629
|
-
var renouncePermissionsParamsSchema =
|
|
630
|
-
var renouncePermissionsResultSchema =
|
|
631
|
-
var renouncePermissionsRequestMessageSchema =
|
|
918
|
+
var renouncePermissionsParamsSchema = v14.nullish(v14.null());
|
|
919
|
+
var renouncePermissionsResultSchema = v14.nullish(v14.null());
|
|
920
|
+
var renouncePermissionsRequestMessageSchema = v14.object({
|
|
632
921
|
...rpcRequestMessageSchema.entries,
|
|
633
|
-
...
|
|
634
|
-
method:
|
|
922
|
+
...v14.object({
|
|
923
|
+
method: v14.literal(renouncePermissionsMethodName),
|
|
635
924
|
params: renouncePermissionsParamsSchema,
|
|
636
|
-
id:
|
|
925
|
+
id: v14.string()
|
|
637
926
|
}).entries
|
|
638
927
|
});
|
|
639
928
|
var disconnectMethodName = "wallet_disconnect";
|
|
640
|
-
var disconnectParamsSchema =
|
|
641
|
-
var disconnectResultSchema =
|
|
642
|
-
var disconnectRequestMessageSchema =
|
|
929
|
+
var disconnectParamsSchema = v14.nullish(v14.null());
|
|
930
|
+
var disconnectResultSchema = v14.nullish(v14.null());
|
|
931
|
+
var disconnectRequestMessageSchema = v14.object({
|
|
643
932
|
...rpcRequestMessageSchema.entries,
|
|
644
|
-
...
|
|
645
|
-
method:
|
|
933
|
+
...v14.object({
|
|
934
|
+
method: v14.literal(disconnectMethodName),
|
|
646
935
|
params: disconnectParamsSchema,
|
|
647
|
-
id:
|
|
936
|
+
id: v14.string()
|
|
648
937
|
}).entries
|
|
649
938
|
});
|
|
650
939
|
var getWalletTypeMethodName = "wallet_getWalletType";
|
|
651
|
-
var getWalletTypeParamsSchema =
|
|
940
|
+
var getWalletTypeParamsSchema = v14.nullish(v14.null());
|
|
652
941
|
var getWalletTypeResultSchema = walletTypeSchema;
|
|
653
|
-
var getWalletTypeRequestMessageSchema =
|
|
942
|
+
var getWalletTypeRequestMessageSchema = v14.object({
|
|
654
943
|
...rpcRequestMessageSchema.entries,
|
|
655
|
-
...
|
|
656
|
-
method:
|
|
944
|
+
...v14.object({
|
|
945
|
+
method: v14.literal(getWalletTypeMethodName),
|
|
657
946
|
params: getWalletTypeParamsSchema,
|
|
658
|
-
id:
|
|
947
|
+
id: v14.string()
|
|
659
948
|
}).entries
|
|
660
949
|
});
|
|
661
950
|
var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
|
|
662
|
-
var getCurrentPermissionsParamsSchema =
|
|
663
|
-
var getCurrentPermissionsResultSchema =
|
|
664
|
-
var getCurrentPermissionsRequestMessageSchema =
|
|
951
|
+
var getCurrentPermissionsParamsSchema = v14.nullish(v14.null());
|
|
952
|
+
var getCurrentPermissionsResultSchema = v14.array(import_xverse_core.permissions.store.permission);
|
|
953
|
+
var getCurrentPermissionsRequestMessageSchema = v14.object({
|
|
665
954
|
...rpcRequestMessageSchema.entries,
|
|
666
|
-
...
|
|
667
|
-
method:
|
|
955
|
+
...v14.object({
|
|
956
|
+
method: v14.literal(getCurrentPermissionsMethodName),
|
|
668
957
|
params: getCurrentPermissionsParamsSchema,
|
|
669
|
-
id:
|
|
958
|
+
id: v14.string()
|
|
670
959
|
}).entries
|
|
671
960
|
});
|
|
672
961
|
var getAccountMethodName = "wallet_getAccount";
|
|
673
|
-
var getAccountParamsSchema =
|
|
674
|
-
var getAccountResultSchema =
|
|
962
|
+
var getAccountParamsSchema = v14.nullish(v14.null());
|
|
963
|
+
var getAccountResultSchema = v14.object({
|
|
675
964
|
id: import_xverse_core.permissions.utils.account.accountIdSchema,
|
|
676
|
-
addresses:
|
|
965
|
+
addresses: v14.array(addressSchema),
|
|
677
966
|
walletType: walletTypeSchema
|
|
678
967
|
});
|
|
679
|
-
var getAccountRequestMessageSchema =
|
|
968
|
+
var getAccountRequestMessageSchema = v14.object({
|
|
680
969
|
...rpcRequestMessageSchema.entries,
|
|
681
|
-
...
|
|
682
|
-
method:
|
|
970
|
+
...v14.object({
|
|
971
|
+
method: v14.literal(getAccountMethodName),
|
|
683
972
|
params: getAccountParamsSchema,
|
|
684
|
-
id:
|
|
973
|
+
id: v14.string()
|
|
685
974
|
}).entries
|
|
686
975
|
});
|
|
687
976
|
var connectMethodName = "wallet_connect";
|
|
688
|
-
var connectParamsSchema =
|
|
689
|
-
|
|
690
|
-
permissions:
|
|
977
|
+
var connectParamsSchema = v14.nullish(
|
|
978
|
+
v14.object({
|
|
979
|
+
permissions: v14.optional(v14.array(permissionTemplate))
|
|
691
980
|
})
|
|
692
981
|
);
|
|
693
982
|
var connectResultSchema = getAccountResultSchema;
|
|
694
|
-
var connectRequestMessageSchema =
|
|
983
|
+
var connectRequestMessageSchema = v14.object({
|
|
695
984
|
...rpcRequestMessageSchema.entries,
|
|
696
|
-
...
|
|
697
|
-
method:
|
|
985
|
+
...v14.object({
|
|
986
|
+
method: v14.literal(connectMethodName),
|
|
698
987
|
params: connectParamsSchema,
|
|
699
|
-
id:
|
|
988
|
+
id: v14.string()
|
|
700
989
|
}).entries
|
|
701
990
|
});
|
|
702
991
|
|
|
703
|
-
// src/request/types/runesMethods.ts
|
|
704
|
-
var
|
|
705
|
-
var
|
|
706
|
-
var
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
992
|
+
// src/request/types/runesMethods/etch.ts
|
|
993
|
+
var v15 = __toESM(require("valibot"));
|
|
994
|
+
var runesEtchMethodName = "runes_etch";
|
|
995
|
+
var etchTermsSchema = v15.object({
|
|
996
|
+
amount: v15.string(),
|
|
997
|
+
cap: v15.string(),
|
|
998
|
+
heightStart: v15.optional(v15.string()),
|
|
999
|
+
heightEnd: v15.optional(v15.string()),
|
|
1000
|
+
offsetStart: v15.optional(v15.string()),
|
|
1001
|
+
offsetEnd: v15.optional(v15.string())
|
|
1002
|
+
});
|
|
1003
|
+
var inscriptionDetailsSchema = v15.object({
|
|
1004
|
+
contentType: v15.string(),
|
|
1005
|
+
contentBase64: v15.string()
|
|
1006
|
+
});
|
|
1007
|
+
var runesEtchParamsSchema = v15.object({
|
|
1008
|
+
runeName: v15.string(),
|
|
1009
|
+
divisibility: v15.optional(v15.number()),
|
|
1010
|
+
symbol: v15.optional(v15.string()),
|
|
1011
|
+
premine: v15.optional(v15.string()),
|
|
1012
|
+
isMintable: v15.boolean(),
|
|
1013
|
+
delegateInscriptionId: v15.optional(v15.string()),
|
|
1014
|
+
destinationAddress: v15.string(),
|
|
1015
|
+
refundAddress: v15.string(),
|
|
1016
|
+
feeRate: v15.number(),
|
|
1017
|
+
appServiceFee: v15.optional(v15.number()),
|
|
1018
|
+
appServiceFeeAddress: v15.optional(v15.string()),
|
|
1019
|
+
terms: v15.optional(etchTermsSchema),
|
|
1020
|
+
inscriptionDetails: v15.optional(inscriptionDetailsSchema),
|
|
1021
|
+
network: v15.optional(v15.enum(BitcoinNetworkType))
|
|
1022
|
+
});
|
|
1023
|
+
var runesEtchResultSchema = v15.object({
|
|
1024
|
+
orderId: v15.string(),
|
|
1025
|
+
fundTransactionId: v15.string(),
|
|
1026
|
+
fundingAddress: v15.string()
|
|
1027
|
+
});
|
|
1028
|
+
var runesEtchRequestMessageSchema = v15.object({
|
|
1029
|
+
...rpcRequestMessageSchema.entries,
|
|
1030
|
+
...v15.object({
|
|
1031
|
+
method: v15.literal(runesEtchMethodName),
|
|
1032
|
+
params: runesEtchParamsSchema,
|
|
1033
|
+
id: v15.string()
|
|
1034
|
+
}).entries
|
|
1035
|
+
});
|
|
1036
|
+
|
|
1037
|
+
// src/request/types/runesMethods/getBalance.ts
|
|
1038
|
+
var v16 = __toESM(require("valibot"));
|
|
1039
|
+
var runesGetBalanceMethodName = "runes_getBalance";
|
|
1040
|
+
var runesGetBalanceParamsSchema = v16.nullish(v16.null());
|
|
1041
|
+
var runesGetBalanceResultSchema = v16.object({
|
|
1042
|
+
balances: v16.array(
|
|
1043
|
+
v16.object({
|
|
1044
|
+
runeName: v16.string(),
|
|
1045
|
+
amount: v16.string(),
|
|
1046
|
+
divisibility: v16.number(),
|
|
1047
|
+
symbol: v16.string(),
|
|
1048
|
+
inscriptionId: v16.nullish(v16.string())
|
|
715
1049
|
})
|
|
716
1050
|
)
|
|
717
1051
|
});
|
|
718
|
-
var
|
|
1052
|
+
var runesGetBalanceRequestMessageSchema = v16.object({
|
|
719
1053
|
...rpcRequestMessageSchema.entries,
|
|
720
|
-
...
|
|
721
|
-
method:
|
|
722
|
-
params:
|
|
723
|
-
id:
|
|
1054
|
+
...v16.object({
|
|
1055
|
+
method: v16.literal(runesGetBalanceMethodName),
|
|
1056
|
+
params: runesGetBalanceParamsSchema,
|
|
1057
|
+
id: v16.string()
|
|
1058
|
+
}).entries
|
|
1059
|
+
});
|
|
1060
|
+
|
|
1061
|
+
// src/request/types/runesMethods/mint.ts
|
|
1062
|
+
var v17 = __toESM(require("valibot"));
|
|
1063
|
+
var runesMintMethodName = "runes_mint";
|
|
1064
|
+
var runesMintParamsSchema = v17.object({
|
|
1065
|
+
appServiceFee: v17.optional(v17.number()),
|
|
1066
|
+
appServiceFeeAddress: v17.optional(v17.string()),
|
|
1067
|
+
destinationAddress: v17.string(),
|
|
1068
|
+
feeRate: v17.number(),
|
|
1069
|
+
refundAddress: v17.string(),
|
|
1070
|
+
repeats: v17.number(),
|
|
1071
|
+
runeName: v17.string(),
|
|
1072
|
+
network: v17.optional(v17.enum(BitcoinNetworkType))
|
|
1073
|
+
});
|
|
1074
|
+
var runesMintResultSchema = v17.object({
|
|
1075
|
+
orderId: v17.string(),
|
|
1076
|
+
fundTransactionId: v17.string(),
|
|
1077
|
+
fundingAddress: v17.string()
|
|
1078
|
+
});
|
|
1079
|
+
var runesMintRequestMessageSchema = v17.object({
|
|
1080
|
+
...rpcRequestMessageSchema.entries,
|
|
1081
|
+
...v17.object({
|
|
1082
|
+
method: v17.literal(runesMintMethodName),
|
|
1083
|
+
params: runesMintParamsSchema,
|
|
1084
|
+
id: v17.string()
|
|
724
1085
|
}).entries
|
|
725
1086
|
});
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
1087
|
+
|
|
1088
|
+
// src/request/types/runesMethods/transfer.ts
|
|
1089
|
+
var v18 = __toESM(require("valibot"));
|
|
1090
|
+
var runesTransferMethodName = "runes_transfer";
|
|
1091
|
+
var runesTransferParamsSchema = v18.object({
|
|
1092
|
+
recipients: v18.array(
|
|
1093
|
+
v18.object({
|
|
1094
|
+
runeName: v18.string(),
|
|
1095
|
+
amount: v18.string(),
|
|
1096
|
+
address: v18.string()
|
|
733
1097
|
})
|
|
734
1098
|
)
|
|
735
1099
|
});
|
|
736
|
-
var
|
|
1100
|
+
var runesTransferResultSchema = v18.object({
|
|
1101
|
+
txid: v18.string()
|
|
1102
|
+
});
|
|
1103
|
+
var runesTransferRequestMessageSchema = v18.object({
|
|
737
1104
|
...rpcRequestMessageSchema.entries,
|
|
738
|
-
...
|
|
739
|
-
method:
|
|
740
|
-
params:
|
|
741
|
-
id:
|
|
1105
|
+
...v18.object({
|
|
1106
|
+
method: v18.literal(runesTransferMethodName),
|
|
1107
|
+
params: runesTransferParamsSchema,
|
|
1108
|
+
id: v18.string()
|
|
742
1109
|
}).entries
|
|
743
1110
|
});
|
|
744
|
-
var TransferRunesResultSchema = v8.object({
|
|
745
|
-
txid: v8.string()
|
|
746
|
-
});
|
|
747
1111
|
|
|
748
1112
|
// src/request/types/ordinalsMethods.ts
|
|
749
|
-
var
|
|
1113
|
+
var v19 = __toESM(require("valibot"));
|
|
750
1114
|
var getInscriptionsMethodName = "ord_getInscriptions";
|
|
751
|
-
var getInscriptionsParamsSchema =
|
|
752
|
-
offset:
|
|
753
|
-
limit:
|
|
754
|
-
});
|
|
755
|
-
var getInscriptionsResultSchema =
|
|
756
|
-
total:
|
|
757
|
-
limit:
|
|
758
|
-
offset:
|
|
759
|
-
inscriptions:
|
|
760
|
-
|
|
761
|
-
inscriptionId:
|
|
762
|
-
inscriptionNumber:
|
|
763
|
-
address:
|
|
764
|
-
collectionName:
|
|
765
|
-
postage:
|
|
766
|
-
contentLength:
|
|
767
|
-
contentType:
|
|
768
|
-
timestamp:
|
|
769
|
-
offset:
|
|
770
|
-
genesisTransaction:
|
|
771
|
-
output:
|
|
1115
|
+
var getInscriptionsParamsSchema = v19.object({
|
|
1116
|
+
offset: v19.number(),
|
|
1117
|
+
limit: v19.number()
|
|
1118
|
+
});
|
|
1119
|
+
var getInscriptionsResultSchema = v19.object({
|
|
1120
|
+
total: v19.number(),
|
|
1121
|
+
limit: v19.number(),
|
|
1122
|
+
offset: v19.number(),
|
|
1123
|
+
inscriptions: v19.array(
|
|
1124
|
+
v19.object({
|
|
1125
|
+
inscriptionId: v19.string(),
|
|
1126
|
+
inscriptionNumber: v19.string(),
|
|
1127
|
+
address: v19.string(),
|
|
1128
|
+
collectionName: v19.optional(v19.string()),
|
|
1129
|
+
postage: v19.string(),
|
|
1130
|
+
contentLength: v19.string(),
|
|
1131
|
+
contentType: v19.string(),
|
|
1132
|
+
timestamp: v19.number(),
|
|
1133
|
+
offset: v19.number(),
|
|
1134
|
+
genesisTransaction: v19.string(),
|
|
1135
|
+
output: v19.string()
|
|
772
1136
|
})
|
|
773
1137
|
)
|
|
774
1138
|
});
|
|
775
|
-
var
|
|
1139
|
+
var getInscriptionsRequestMessageSchema = v19.object({
|
|
776
1140
|
...rpcRequestMessageSchema.entries,
|
|
777
|
-
...
|
|
778
|
-
method:
|
|
1141
|
+
...v19.object({
|
|
1142
|
+
method: v19.literal(getInscriptionsMethodName),
|
|
779
1143
|
params: getInscriptionsParamsSchema,
|
|
780
|
-
id:
|
|
1144
|
+
id: v19.string()
|
|
781
1145
|
}).entries
|
|
782
1146
|
});
|
|
783
1147
|
var sendInscriptionsMethodName = "ord_sendInscriptions";
|
|
784
|
-
var sendInscriptionsParamsSchema =
|
|
785
|
-
transfers:
|
|
786
|
-
|
|
787
|
-
address:
|
|
788
|
-
inscriptionId:
|
|
1148
|
+
var sendInscriptionsParamsSchema = v19.object({
|
|
1149
|
+
transfers: v19.array(
|
|
1150
|
+
v19.object({
|
|
1151
|
+
address: v19.string(),
|
|
1152
|
+
inscriptionId: v19.string()
|
|
789
1153
|
})
|
|
790
1154
|
)
|
|
791
1155
|
});
|
|
792
|
-
var sendInscriptionsResultSchema =
|
|
793
|
-
txid:
|
|
1156
|
+
var sendInscriptionsResultSchema = v19.object({
|
|
1157
|
+
txid: v19.string()
|
|
794
1158
|
});
|
|
795
|
-
var
|
|
1159
|
+
var sendInscriptionsRequestMessageSchema = v19.object({
|
|
796
1160
|
...rpcRequestMessageSchema.entries,
|
|
797
|
-
...
|
|
798
|
-
method:
|
|
1161
|
+
...v19.object({
|
|
1162
|
+
method: v19.literal(sendInscriptionsMethodName),
|
|
799
1163
|
params: sendInscriptionsParamsSchema,
|
|
800
|
-
id:
|
|
1164
|
+
id: v19.string()
|
|
801
1165
|
}).entries
|
|
802
1166
|
});
|
|
803
1167
|
|
|
@@ -814,13 +1178,13 @@ var request = async (method, params, providerId) => {
|
|
|
814
1178
|
throw new Error("A wallet method is required");
|
|
815
1179
|
}
|
|
816
1180
|
const response = await provider.request(method, params);
|
|
817
|
-
if (
|
|
1181
|
+
if (v20.is(rpcErrorResponseMessageSchema, response)) {
|
|
818
1182
|
return {
|
|
819
1183
|
status: "error",
|
|
820
1184
|
error: response.error
|
|
821
1185
|
};
|
|
822
1186
|
}
|
|
823
|
-
if (
|
|
1187
|
+
if (v20.is(rpcSuccessResponseMessageSchema, response)) {
|
|
824
1188
|
return {
|
|
825
1189
|
status: "success",
|
|
826
1190
|
result: response.result
|
|
@@ -1772,7 +2136,6 @@ var signMultipleTransactions = async (options) => {
|
|
|
1772
2136
|
RpcErrorCode,
|
|
1773
2137
|
RpcIdSchema,
|
|
1774
2138
|
SatsConnectAdapter,
|
|
1775
|
-
TransferRunesResultSchema,
|
|
1776
2139
|
accountChangeEventName,
|
|
1777
2140
|
accountChangeSchema,
|
|
1778
2141
|
addListener,
|
|
@@ -1819,15 +2182,11 @@ var signMultipleTransactions = async (options) => {
|
|
|
1819
2182
|
getInfoResultSchema,
|
|
1820
2183
|
getInscriptionsMethodName,
|
|
1821
2184
|
getInscriptionsParamsSchema,
|
|
2185
|
+
getInscriptionsRequestMessageSchema,
|
|
1822
2186
|
getInscriptionsResultSchema,
|
|
1823
|
-
getInscriptionsSchema,
|
|
1824
2187
|
getProviderById,
|
|
1825
2188
|
getProviderOrThrow,
|
|
1826
2189
|
getProviders,
|
|
1827
|
-
getRunesBalanceMethodName,
|
|
1828
|
-
getRunesBalanceParamsSchema,
|
|
1829
|
-
getRunesBalanceRequestMessageSchema,
|
|
1830
|
-
getRunesBalanceResultSchema,
|
|
1831
2190
|
getSupportedWallets,
|
|
1832
2191
|
getWalletTypeMethodName,
|
|
1833
2192
|
getWalletTypeParamsSchema,
|
|
@@ -1851,11 +2210,27 @@ var signMultipleTransactions = async (options) => {
|
|
|
1851
2210
|
rpcRequestMessageSchema,
|
|
1852
2211
|
rpcResponseMessageSchema,
|
|
1853
2212
|
rpcSuccessResponseMessageSchema,
|
|
2213
|
+
runesEtchMethodName,
|
|
2214
|
+
runesEtchParamsSchema,
|
|
2215
|
+
runesEtchRequestMessageSchema,
|
|
2216
|
+
runesEtchResultSchema,
|
|
2217
|
+
runesGetBalanceMethodName,
|
|
2218
|
+
runesGetBalanceParamsSchema,
|
|
2219
|
+
runesGetBalanceRequestMessageSchema,
|
|
2220
|
+
runesGetBalanceResultSchema,
|
|
2221
|
+
runesMintMethodName,
|
|
2222
|
+
runesMintParamsSchema,
|
|
2223
|
+
runesMintRequestMessageSchema,
|
|
2224
|
+
runesMintResultSchema,
|
|
2225
|
+
runesTransferMethodName,
|
|
2226
|
+
runesTransferParamsSchema,
|
|
2227
|
+
runesTransferRequestMessageSchema,
|
|
2228
|
+
runesTransferResultSchema,
|
|
1854
2229
|
sendBtcTransaction,
|
|
1855
2230
|
sendInscriptionsMethodName,
|
|
1856
2231
|
sendInscriptionsParamsSchema,
|
|
2232
|
+
sendInscriptionsRequestMessageSchema,
|
|
1857
2233
|
sendInscriptionsResultSchema,
|
|
1858
|
-
sendInscriptionsSchema,
|
|
1859
2234
|
sendTransferMethodName,
|
|
1860
2235
|
sendTransferParamsSchema,
|
|
1861
2236
|
sendTransferRequestMessageSchema,
|
|
@@ -1872,17 +2247,38 @@ var signMultipleTransactions = async (options) => {
|
|
|
1872
2247
|
signPsbtRequestMessageSchema,
|
|
1873
2248
|
signPsbtResultSchema,
|
|
1874
2249
|
signTransaction,
|
|
2250
|
+
stxCallContractMethodName,
|
|
2251
|
+
stxCallContractParamsSchema,
|
|
2252
|
+
stxCallContractRequestMessageSchema,
|
|
2253
|
+
stxCallContractResultSchema,
|
|
2254
|
+
stxDeployContractMethodName,
|
|
2255
|
+
stxDeployContractParamsSchema,
|
|
2256
|
+
stxDeployContractRequestMessageSchema,
|
|
2257
|
+
stxDeployContractResultSchema,
|
|
2258
|
+
stxGetAccountsMethodName,
|
|
2259
|
+
stxGetAccountsParamsSchema,
|
|
2260
|
+
stxGetAccountsRequestMessageSchema,
|
|
2261
|
+
stxGetAccountsResultSchema,
|
|
1875
2262
|
stxGetAddressesMethodName,
|
|
1876
2263
|
stxGetAddressesParamsSchema,
|
|
1877
2264
|
stxGetAddressesRequestMessageSchema,
|
|
1878
2265
|
stxGetAddressesResultSchema,
|
|
2266
|
+
stxSignMessageMethodName,
|
|
2267
|
+
stxSignMessageParamsSchema,
|
|
2268
|
+
stxSignMessageRequestMessageSchema,
|
|
2269
|
+
stxSignMessageResultSchema,
|
|
2270
|
+
stxSignStructuredMessageMethodName,
|
|
2271
|
+
stxSignStructuredMessageParamsSchema,
|
|
2272
|
+
stxSignStructuredMessageRequestMessageSchema,
|
|
2273
|
+
stxSignStructuredMessageResultSchema,
|
|
1879
2274
|
stxSignTransactionMethodName,
|
|
1880
2275
|
stxSignTransactionParamsSchema,
|
|
1881
2276
|
stxSignTransactionRequestMessageSchema,
|
|
1882
2277
|
stxSignTransactionResultSchema,
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
2278
|
+
stxTransferStxMethodName,
|
|
2279
|
+
stxTransferStxParamsSchema,
|
|
2280
|
+
stxTransferStxRequestMessageSchema,
|
|
2281
|
+
stxTransferStxResultSchema,
|
|
1886
2282
|
walletEventSchema,
|
|
1887
2283
|
walletTypeSchema,
|
|
1888
2284
|
walletTypes
|