@sats-connect/core 0.4.0-d60f0ef → 0.4.0-dbf2876
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 +621 -547
- package/dist/index.d.ts +621 -547
- package/dist/index.js +683 -243
- package/dist/index.mjs +637 -233
- 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,
|
|
@@ -134,18 +145,43 @@ __export(src_exports, {
|
|
|
134
145
|
signMessageRequestMessageSchema: () => signMessageRequestMessageSchema,
|
|
135
146
|
signMessageResultSchema: () => signMessageResultSchema,
|
|
136
147
|
signMultipleTransactions: () => signMultipleTransactions,
|
|
148
|
+
signPsbtMethodName: () => signPsbtMethodName,
|
|
149
|
+
signPsbtParamsSchema: () => signPsbtParamsSchema,
|
|
150
|
+
signPsbtRequestMessageSchema: () => signPsbtRequestMessageSchema,
|
|
151
|
+
signPsbtResultSchema: () => signPsbtResultSchema,
|
|
137
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,
|
|
138
165
|
stxGetAddressesMethodName: () => stxGetAddressesMethodName,
|
|
139
166
|
stxGetAddressesParamsSchema: () => stxGetAddressesParamsSchema,
|
|
140
167
|
stxGetAddressesRequestMessageSchema: () => stxGetAddressesRequestMessageSchema,
|
|
141
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,
|
|
142
177
|
stxSignTransactionMethodName: () => stxSignTransactionMethodName,
|
|
143
178
|
stxSignTransactionParamsSchema: () => stxSignTransactionParamsSchema,
|
|
144
179
|
stxSignTransactionRequestMessageSchema: () => stxSignTransactionRequestMessageSchema,
|
|
145
180
|
stxSignTransactionResultSchema: () => stxSignTransactionResultSchema,
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
181
|
+
stxTransferStxMethodName: () => stxTransferStxMethodName,
|
|
182
|
+
stxTransferStxParamsSchema: () => stxTransferStxParamsSchema,
|
|
183
|
+
stxTransferStxRequestMessageSchema: () => stxTransferStxRequestMessageSchema,
|
|
184
|
+
stxTransferStxResultSchema: () => stxTransferStxResultSchema,
|
|
149
185
|
walletEventSchema: () => walletEventSchema,
|
|
150
186
|
walletTypeSchema: () => walletTypeSchema,
|
|
151
187
|
walletTypes: () => walletTypes
|
|
@@ -201,10 +237,7 @@ function removeDefaultProvider() {
|
|
|
201
237
|
localStorage.removeItem("sats-connect_defaultProvider");
|
|
202
238
|
}
|
|
203
239
|
function getSupportedWallets() {
|
|
204
|
-
const
|
|
205
|
-
const { xverse, ...defaultProviders } = DefaultAdaptersInfo;
|
|
206
|
-
const allProviders = [...ambientProviders, ...Object.values(defaultProviders)];
|
|
207
|
-
const wallets = allProviders.map((provider) => {
|
|
240
|
+
const wallets = Object.values(DefaultAdaptersInfo).map((provider) => {
|
|
208
241
|
{
|
|
209
242
|
return {
|
|
210
243
|
...provider,
|
|
@@ -217,11 +250,11 @@ function getSupportedWallets() {
|
|
|
217
250
|
|
|
218
251
|
// src/types.ts
|
|
219
252
|
var v2 = __toESM(require("valibot"));
|
|
220
|
-
var BitcoinNetworkType = /* @__PURE__ */ ((
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
return
|
|
253
|
+
var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
|
|
254
|
+
BitcoinNetworkType2["Mainnet"] = "Mainnet";
|
|
255
|
+
BitcoinNetworkType2["Testnet"] = "Testnet";
|
|
256
|
+
BitcoinNetworkType2["Signet"] = "Signet";
|
|
257
|
+
return BitcoinNetworkType2;
|
|
225
258
|
})(BitcoinNetworkType || {});
|
|
226
259
|
var RpcIdSchema = v2.optional(v2.union([v2.string(), v2.number(), v2.null()]));
|
|
227
260
|
var rpcRequestMessageSchema = v2.object({
|
|
@@ -267,16 +300,127 @@ var rpcResponseMessageSchema = v2.union([
|
|
|
267
300
|
]);
|
|
268
301
|
|
|
269
302
|
// src/request/index.ts
|
|
270
|
-
var
|
|
303
|
+
var v20 = __toESM(require("valibot"));
|
|
271
304
|
|
|
272
|
-
// 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
|
|
273
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
|
+
});
|
|
274
418
|
|
|
275
419
|
// src/addresses/index.ts
|
|
276
420
|
var import_jsontokens = require("jsontokens");
|
|
277
421
|
|
|
278
422
|
// src/addresses/types.ts
|
|
279
|
-
var
|
|
423
|
+
var v6 = __toESM(require("valibot"));
|
|
280
424
|
var AddressPurpose = /* @__PURE__ */ ((AddressPurpose2) => {
|
|
281
425
|
AddressPurpose2["Ordinals"] = "ordinals";
|
|
282
426
|
AddressPurpose2["Payment"] = "payment";
|
|
@@ -292,11 +436,11 @@ var AddressType = /* @__PURE__ */ ((AddressType3) => {
|
|
|
292
436
|
AddressType3["stacks"] = "stacks";
|
|
293
437
|
return AddressType3;
|
|
294
438
|
})(AddressType || {});
|
|
295
|
-
var addressSchema =
|
|
296
|
-
address:
|
|
297
|
-
publicKey:
|
|
298
|
-
purpose:
|
|
299
|
-
addressType:
|
|
439
|
+
var addressSchema = v6.object({
|
|
440
|
+
address: v6.string(),
|
|
441
|
+
publicKey: v6.string(),
|
|
442
|
+
purpose: v6.enum(AddressPurpose),
|
|
443
|
+
addressType: v6.enum(AddressType)
|
|
300
444
|
});
|
|
301
445
|
|
|
302
446
|
// src/addresses/index.ts
|
|
@@ -316,118 +460,269 @@ var getAddress = async (options) => {
|
|
|
316
460
|
}
|
|
317
461
|
};
|
|
318
462
|
|
|
319
|
-
// src/request/types/stxMethods.ts
|
|
463
|
+
// src/request/types/stxMethods/getAddresses.ts
|
|
464
|
+
var v7 = __toESM(require("valibot"));
|
|
320
465
|
var stxGetAddressesMethodName = "stx_getAddresses";
|
|
321
|
-
var stxGetAddressesParamsSchema =
|
|
322
|
-
|
|
466
|
+
var stxGetAddressesParamsSchema = v7.nullish(
|
|
467
|
+
v7.object({
|
|
323
468
|
/**
|
|
324
469
|
* A message to be displayed to the user in the request prompt.
|
|
325
470
|
*/
|
|
326
|
-
message:
|
|
471
|
+
message: v7.optional(v7.string())
|
|
327
472
|
})
|
|
328
473
|
);
|
|
329
|
-
var stxGetAddressesResultSchema =
|
|
474
|
+
var stxGetAddressesResultSchema = v7.object({
|
|
330
475
|
/**
|
|
331
476
|
* The addresses generated for the given purposes.
|
|
332
477
|
*/
|
|
333
|
-
addresses:
|
|
478
|
+
addresses: v7.array(addressSchema)
|
|
334
479
|
});
|
|
335
|
-
var stxGetAddressesRequestMessageSchema =
|
|
480
|
+
var stxGetAddressesRequestMessageSchema = v7.object({
|
|
336
481
|
...rpcRequestMessageSchema.entries,
|
|
337
|
-
...
|
|
338
|
-
method:
|
|
482
|
+
...v7.object({
|
|
483
|
+
method: v7.literal(stxGetAddressesMethodName),
|
|
339
484
|
params: stxGetAddressesParamsSchema,
|
|
340
|
-
id:
|
|
485
|
+
id: v7.string()
|
|
486
|
+
}).entries
|
|
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()
|
|
341
562
|
}).entries
|
|
342
563
|
});
|
|
564
|
+
|
|
565
|
+
// src/request/types/stxMethods/signTransaction.ts
|
|
566
|
+
var v10 = __toESM(require("valibot"));
|
|
343
567
|
var stxSignTransactionMethodName = "stx_signTransaction";
|
|
344
|
-
var stxSignTransactionParamsSchema =
|
|
568
|
+
var stxSignTransactionParamsSchema = v10.object({
|
|
345
569
|
/**
|
|
346
570
|
* The transaction to sign as a hex-encoded string.
|
|
347
571
|
*/
|
|
348
|
-
transaction:
|
|
572
|
+
transaction: v10.string(),
|
|
349
573
|
/**
|
|
350
574
|
* The public key to sign the transaction with. The wallet may use any key
|
|
351
575
|
* when not provided.
|
|
352
576
|
*/
|
|
353
|
-
pubkey:
|
|
577
|
+
pubkey: v10.optional(v10.string()),
|
|
354
578
|
/**
|
|
355
579
|
* Whether to broadcast the transaction after signing. Defaults to `true`.
|
|
356
580
|
*/
|
|
357
|
-
broadcast:
|
|
581
|
+
broadcast: v10.optional(v10.boolean())
|
|
358
582
|
});
|
|
359
|
-
var stxSignTransactionResultSchema =
|
|
583
|
+
var stxSignTransactionResultSchema = v10.object({
|
|
360
584
|
/**
|
|
361
585
|
* The signed transaction as a hex-encoded string.
|
|
362
586
|
*/
|
|
363
|
-
transaction:
|
|
587
|
+
transaction: v10.string()
|
|
364
588
|
});
|
|
365
|
-
var stxSignTransactionRequestMessageSchema =
|
|
589
|
+
var stxSignTransactionRequestMessageSchema = v10.object({
|
|
366
590
|
...rpcRequestMessageSchema.entries,
|
|
367
|
-
...
|
|
368
|
-
method:
|
|
591
|
+
...v10.object({
|
|
592
|
+
method: v10.literal(stxSignTransactionMethodName),
|
|
369
593
|
params: stxSignTransactionParamsSchema,
|
|
370
|
-
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()
|
|
371
666
|
}).entries
|
|
372
667
|
});
|
|
373
668
|
|
|
374
669
|
// src/request/types/btcMethods.ts
|
|
375
|
-
var
|
|
670
|
+
var v13 = __toESM(require("valibot"));
|
|
376
671
|
|
|
377
672
|
// src/request/types/common.ts
|
|
378
|
-
var
|
|
673
|
+
var v12 = __toESM(require("valibot"));
|
|
379
674
|
var walletTypes = ["software", "ledger"];
|
|
380
|
-
var walletTypeSchema =
|
|
675
|
+
var walletTypeSchema = v12.picklist(walletTypes);
|
|
381
676
|
|
|
382
677
|
// src/request/types/btcMethods.ts
|
|
383
678
|
var getInfoMethodName = "getInfo";
|
|
384
|
-
var getInfoParamsSchema =
|
|
385
|
-
var getInfoResultSchema =
|
|
679
|
+
var getInfoParamsSchema = v13.nullish(v13.null());
|
|
680
|
+
var getInfoResultSchema = v13.object({
|
|
386
681
|
/**
|
|
387
682
|
* Version of the wallet.
|
|
388
683
|
*/
|
|
389
|
-
version:
|
|
684
|
+
version: v13.string(),
|
|
390
685
|
/**
|
|
391
686
|
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
392
687
|
*/
|
|
393
|
-
methods:
|
|
688
|
+
methods: v13.optional(v13.array(v13.string())),
|
|
394
689
|
/**
|
|
395
690
|
* List of WBIP standards supported by the wallet. Not currently used.
|
|
396
691
|
*/
|
|
397
|
-
supports:
|
|
692
|
+
supports: v13.array(v13.string())
|
|
398
693
|
});
|
|
399
|
-
var getInfoRequestMessageSchema =
|
|
694
|
+
var getInfoRequestMessageSchema = v13.object({
|
|
400
695
|
...rpcRequestMessageSchema.entries,
|
|
401
|
-
...
|
|
402
|
-
method:
|
|
696
|
+
...v13.object({
|
|
697
|
+
method: v13.literal(getInfoMethodName),
|
|
403
698
|
params: getInfoParamsSchema,
|
|
404
|
-
id:
|
|
699
|
+
id: v13.string()
|
|
405
700
|
}).entries
|
|
406
701
|
});
|
|
407
702
|
var getAddressesMethodName = "getAddresses";
|
|
408
|
-
var getAddressesParamsSchema =
|
|
703
|
+
var getAddressesParamsSchema = v13.object({
|
|
409
704
|
/**
|
|
410
705
|
* The purposes for which to generate addresses. See
|
|
411
706
|
* {@linkcode AddressPurpose} for available purposes.
|
|
412
707
|
*/
|
|
413
|
-
purposes:
|
|
708
|
+
purposes: v13.array(v13.enum(AddressPurpose)),
|
|
414
709
|
/**
|
|
415
710
|
* A message to be displayed to the user in the request prompt.
|
|
416
711
|
*/
|
|
417
|
-
message:
|
|
712
|
+
message: v13.optional(v13.string())
|
|
418
713
|
});
|
|
419
|
-
var getAddressesResultSchema =
|
|
714
|
+
var getAddressesResultSchema = v13.object({
|
|
420
715
|
/**
|
|
421
716
|
* The addresses generated for the given purposes.
|
|
422
717
|
*/
|
|
423
|
-
addresses:
|
|
718
|
+
addresses: v13.array(addressSchema)
|
|
424
719
|
});
|
|
425
|
-
var getAddressesRequestMessageSchema =
|
|
720
|
+
var getAddressesRequestMessageSchema = v13.object({
|
|
426
721
|
...rpcRequestMessageSchema.entries,
|
|
427
|
-
...
|
|
428
|
-
method:
|
|
722
|
+
...v13.object({
|
|
723
|
+
method: v13.literal(getAddressesMethodName),
|
|
429
724
|
params: getAddressesParamsSchema,
|
|
430
|
-
id:
|
|
725
|
+
id: v13.string()
|
|
431
726
|
}).entries
|
|
432
727
|
});
|
|
433
728
|
var signMessageMethodName = "signMessage";
|
|
@@ -436,328 +731,437 @@ var MessageSigningProtocols = /* @__PURE__ */ ((MessageSigningProtocols2) => {
|
|
|
436
731
|
MessageSigningProtocols2["BIP322"] = "BIP322";
|
|
437
732
|
return MessageSigningProtocols2;
|
|
438
733
|
})(MessageSigningProtocols || {});
|
|
439
|
-
var signMessageParamsSchema =
|
|
734
|
+
var signMessageParamsSchema = v13.object({
|
|
440
735
|
/**
|
|
441
736
|
* The address used for signing.
|
|
442
737
|
**/
|
|
443
|
-
address:
|
|
738
|
+
address: v13.string(),
|
|
444
739
|
/**
|
|
445
740
|
* The message to sign.
|
|
446
741
|
**/
|
|
447
|
-
message:
|
|
742
|
+
message: v13.string(),
|
|
448
743
|
/**
|
|
449
744
|
* The protocol to use for signing the message.
|
|
450
745
|
*/
|
|
451
|
-
protocol:
|
|
746
|
+
protocol: v13.optional(v13.enum(MessageSigningProtocols))
|
|
452
747
|
});
|
|
453
|
-
var signMessageResultSchema =
|
|
748
|
+
var signMessageResultSchema = v13.object({
|
|
454
749
|
/**
|
|
455
750
|
* The signature of the message.
|
|
456
751
|
*/
|
|
457
|
-
signature:
|
|
752
|
+
signature: v13.string(),
|
|
458
753
|
/**
|
|
459
754
|
* hash of the message.
|
|
460
755
|
*/
|
|
461
|
-
messageHash:
|
|
756
|
+
messageHash: v13.string(),
|
|
462
757
|
/**
|
|
463
758
|
* The address used for signing.
|
|
464
759
|
*/
|
|
465
|
-
address:
|
|
760
|
+
address: v13.string(),
|
|
466
761
|
/**
|
|
467
762
|
* The protocol to use for signing the message.
|
|
468
763
|
*/
|
|
469
|
-
protocol:
|
|
764
|
+
protocol: v13.enum(MessageSigningProtocols)
|
|
470
765
|
});
|
|
471
|
-
var signMessageRequestMessageSchema =
|
|
766
|
+
var signMessageRequestMessageSchema = v13.object({
|
|
472
767
|
...rpcRequestMessageSchema.entries,
|
|
473
|
-
...
|
|
474
|
-
method:
|
|
768
|
+
...v13.object({
|
|
769
|
+
method: v13.literal(signMessageMethodName),
|
|
475
770
|
params: signMessageParamsSchema,
|
|
476
|
-
id:
|
|
771
|
+
id: v13.string()
|
|
477
772
|
}).entries
|
|
478
773
|
});
|
|
479
774
|
var sendTransferMethodName = "sendTransfer";
|
|
480
|
-
var sendTransferParamsSchema =
|
|
775
|
+
var sendTransferParamsSchema = v13.object({
|
|
481
776
|
/**
|
|
482
777
|
* Array of recipients to send to.
|
|
483
778
|
* The amount to send to each recipient is in satoshis.
|
|
484
779
|
*/
|
|
485
|
-
recipients:
|
|
486
|
-
|
|
487
|
-
address:
|
|
488
|
-
amount:
|
|
780
|
+
recipients: v13.array(
|
|
781
|
+
v13.object({
|
|
782
|
+
address: v13.string(),
|
|
783
|
+
amount: v13.number()
|
|
489
784
|
})
|
|
490
785
|
)
|
|
491
786
|
});
|
|
492
|
-
var sendTransferResultSchema =
|
|
787
|
+
var sendTransferResultSchema = v13.object({
|
|
493
788
|
/**
|
|
494
789
|
* The transaction id as a hex-encoded string.
|
|
495
790
|
*/
|
|
496
|
-
txid:
|
|
791
|
+
txid: v13.string()
|
|
497
792
|
});
|
|
498
|
-
var sendTransferRequestMessageSchema =
|
|
793
|
+
var sendTransferRequestMessageSchema = v13.object({
|
|
499
794
|
...rpcRequestMessageSchema.entries,
|
|
500
|
-
...
|
|
501
|
-
method:
|
|
795
|
+
...v13.object({
|
|
796
|
+
method: v13.literal(sendTransferMethodName),
|
|
502
797
|
params: sendTransferParamsSchema,
|
|
503
|
-
id:
|
|
798
|
+
id: v13.string()
|
|
799
|
+
}).entries
|
|
800
|
+
});
|
|
801
|
+
var signPsbtMethodName = "signPsbt";
|
|
802
|
+
var signPsbtParamsSchema = v13.object({
|
|
803
|
+
/**
|
|
804
|
+
* The base64 encoded PSBT to sign.
|
|
805
|
+
*/
|
|
806
|
+
psbt: v13.string(),
|
|
807
|
+
/**
|
|
808
|
+
* The inputs to sign.
|
|
809
|
+
* The key is the address and the value is an array of indexes of the inputs to sign.
|
|
810
|
+
*/
|
|
811
|
+
signInputs: v13.record(v13.string(), v13.array(v13.number())),
|
|
812
|
+
allowedSignHash: v13.optional(v13.number()),
|
|
813
|
+
/**
|
|
814
|
+
* Whether to broadcast the transaction after signing.
|
|
815
|
+
**/
|
|
816
|
+
broadcast: v13.optional(v13.boolean())
|
|
817
|
+
});
|
|
818
|
+
var signPsbtResultSchema = v13.object({
|
|
819
|
+
/**
|
|
820
|
+
* The base64 encoded PSBT after signing.
|
|
821
|
+
*/
|
|
822
|
+
psbt: v13.string(),
|
|
823
|
+
/**
|
|
824
|
+
* The transaction id as a hex-encoded string.
|
|
825
|
+
* This is only returned if the transaction was broadcast.
|
|
826
|
+
**/
|
|
827
|
+
txid: v13.optional(v13.string())
|
|
828
|
+
});
|
|
829
|
+
var signPsbtRequestMessageSchema = v13.object({
|
|
830
|
+
...rpcRequestMessageSchema.entries,
|
|
831
|
+
...v13.object({
|
|
832
|
+
method: v13.literal(signPsbtMethodName),
|
|
833
|
+
params: signPsbtParamsSchema,
|
|
834
|
+
id: v13.string()
|
|
504
835
|
}).entries
|
|
505
836
|
});
|
|
506
837
|
var getAccountsMethodName = "getAccounts";
|
|
507
|
-
var getAccountsParamsSchema =
|
|
838
|
+
var getAccountsParamsSchema = v13.object({
|
|
508
839
|
/**
|
|
509
840
|
* The purposes for which to generate addresses. See
|
|
510
841
|
* {@linkcode AddressPurpose} for available purposes.
|
|
511
842
|
*/
|
|
512
|
-
purposes:
|
|
843
|
+
purposes: v13.array(v13.enum(AddressPurpose)),
|
|
513
844
|
/**
|
|
514
845
|
* A message to be displayed to the user in the request prompt.
|
|
515
846
|
*/
|
|
516
|
-
message:
|
|
847
|
+
message: v13.optional(v13.string())
|
|
517
848
|
});
|
|
518
|
-
var getAccountsResultSchema =
|
|
519
|
-
|
|
849
|
+
var getAccountsResultSchema = v13.array(
|
|
850
|
+
v13.object({
|
|
520
851
|
...addressSchema.entries,
|
|
521
|
-
...
|
|
852
|
+
...v13.object({
|
|
522
853
|
walletType: walletTypeSchema
|
|
523
854
|
}).entries
|
|
524
855
|
})
|
|
525
856
|
);
|
|
526
|
-
var getAccountsRequestMessageSchema =
|
|
857
|
+
var getAccountsRequestMessageSchema = v13.object({
|
|
527
858
|
...rpcRequestMessageSchema.entries,
|
|
528
|
-
...
|
|
529
|
-
method:
|
|
859
|
+
...v13.object({
|
|
860
|
+
method: v13.literal(getAccountsMethodName),
|
|
530
861
|
params: getAccountsParamsSchema,
|
|
531
|
-
id:
|
|
862
|
+
id: v13.string()
|
|
532
863
|
}).entries
|
|
533
864
|
});
|
|
534
865
|
var getBalanceMethodName = "getBalance";
|
|
535
|
-
var getBalanceParamsSchema =
|
|
536
|
-
var getBalanceResultSchema =
|
|
866
|
+
var getBalanceParamsSchema = v13.nullish(v13.null());
|
|
867
|
+
var getBalanceResultSchema = v13.object({
|
|
537
868
|
/**
|
|
538
869
|
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
539
870
|
* messages not supporting bigint
|
|
540
871
|
* (https://issues.chromium.org/issues/40116184).
|
|
541
872
|
*/
|
|
542
|
-
confirmed:
|
|
873
|
+
confirmed: v13.string(),
|
|
543
874
|
/**
|
|
544
875
|
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
545
876
|
* messages not supporting bigint
|
|
546
877
|
* (https://issues.chromium.org/issues/40116184).
|
|
547
878
|
*/
|
|
548
|
-
unconfirmed:
|
|
879
|
+
unconfirmed: v13.string(),
|
|
549
880
|
/**
|
|
550
881
|
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
551
882
|
* sats. Using a string due to chrome messages not supporting bigint
|
|
552
883
|
* (https://issues.chromium.org/issues/40116184).
|
|
553
884
|
*/
|
|
554
|
-
total:
|
|
885
|
+
total: v13.string()
|
|
555
886
|
});
|
|
556
|
-
var getBalanceRequestMessageSchema =
|
|
887
|
+
var getBalanceRequestMessageSchema = v13.object({
|
|
557
888
|
...rpcRequestMessageSchema.entries,
|
|
558
|
-
...
|
|
559
|
-
method:
|
|
560
|
-
id:
|
|
889
|
+
...v13.object({
|
|
890
|
+
method: v13.literal(getBalanceMethodName),
|
|
891
|
+
id: v13.string()
|
|
561
892
|
}).entries
|
|
562
893
|
});
|
|
563
894
|
|
|
564
895
|
// src/request/types/walletMethods.ts
|
|
565
|
-
var
|
|
896
|
+
var v14 = __toESM(require("valibot"));
|
|
566
897
|
var import_xverse_core = require("@secretkeylabs/xverse-core");
|
|
567
|
-
var permissionTemplate =
|
|
568
|
-
|
|
569
|
-
...
|
|
570
|
-
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
|
|
571
901
|
}),
|
|
572
|
-
|
|
573
|
-
...
|
|
574
|
-
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
|
|
575
904
|
})
|
|
576
905
|
]);
|
|
577
906
|
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
578
|
-
var requestPermissionsParamsSchema =
|
|
579
|
-
var requestPermissionsResultSchema =
|
|
580
|
-
var requestPermissionsRequestMessageSchema =
|
|
907
|
+
var requestPermissionsParamsSchema = v14.nullish(v14.array(permissionTemplate));
|
|
908
|
+
var requestPermissionsResultSchema = v14.literal(true);
|
|
909
|
+
var requestPermissionsRequestMessageSchema = v14.object({
|
|
581
910
|
...rpcRequestMessageSchema.entries,
|
|
582
|
-
...
|
|
583
|
-
method:
|
|
911
|
+
...v14.object({
|
|
912
|
+
method: v14.literal(requestPermissionsMethodName),
|
|
584
913
|
params: requestPermissionsParamsSchema,
|
|
585
|
-
id:
|
|
914
|
+
id: v14.string()
|
|
586
915
|
}).entries
|
|
587
916
|
});
|
|
588
917
|
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
589
|
-
var renouncePermissionsParamsSchema =
|
|
590
|
-
var renouncePermissionsResultSchema =
|
|
591
|
-
var renouncePermissionsRequestMessageSchema =
|
|
918
|
+
var renouncePermissionsParamsSchema = v14.nullish(v14.null());
|
|
919
|
+
var renouncePermissionsResultSchema = v14.nullish(v14.null());
|
|
920
|
+
var renouncePermissionsRequestMessageSchema = v14.object({
|
|
592
921
|
...rpcRequestMessageSchema.entries,
|
|
593
|
-
...
|
|
594
|
-
method:
|
|
922
|
+
...v14.object({
|
|
923
|
+
method: v14.literal(renouncePermissionsMethodName),
|
|
595
924
|
params: renouncePermissionsParamsSchema,
|
|
596
|
-
id:
|
|
925
|
+
id: v14.string()
|
|
597
926
|
}).entries
|
|
598
927
|
});
|
|
599
928
|
var disconnectMethodName = "wallet_disconnect";
|
|
600
|
-
var disconnectParamsSchema =
|
|
601
|
-
var disconnectResultSchema =
|
|
602
|
-
var disconnectRequestMessageSchema =
|
|
929
|
+
var disconnectParamsSchema = v14.nullish(v14.null());
|
|
930
|
+
var disconnectResultSchema = v14.nullish(v14.null());
|
|
931
|
+
var disconnectRequestMessageSchema = v14.object({
|
|
603
932
|
...rpcRequestMessageSchema.entries,
|
|
604
|
-
...
|
|
605
|
-
method:
|
|
933
|
+
...v14.object({
|
|
934
|
+
method: v14.literal(disconnectMethodName),
|
|
606
935
|
params: disconnectParamsSchema,
|
|
607
|
-
id:
|
|
936
|
+
id: v14.string()
|
|
608
937
|
}).entries
|
|
609
938
|
});
|
|
610
939
|
var getWalletTypeMethodName = "wallet_getWalletType";
|
|
611
|
-
var getWalletTypeParamsSchema =
|
|
940
|
+
var getWalletTypeParamsSchema = v14.nullish(v14.null());
|
|
612
941
|
var getWalletTypeResultSchema = walletTypeSchema;
|
|
613
|
-
var getWalletTypeRequestMessageSchema =
|
|
942
|
+
var getWalletTypeRequestMessageSchema = v14.object({
|
|
614
943
|
...rpcRequestMessageSchema.entries,
|
|
615
|
-
...
|
|
616
|
-
method:
|
|
944
|
+
...v14.object({
|
|
945
|
+
method: v14.literal(getWalletTypeMethodName),
|
|
617
946
|
params: getWalletTypeParamsSchema,
|
|
618
|
-
id:
|
|
947
|
+
id: v14.string()
|
|
619
948
|
}).entries
|
|
620
949
|
});
|
|
621
950
|
var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
|
|
622
|
-
var getCurrentPermissionsParamsSchema =
|
|
623
|
-
var getCurrentPermissionsResultSchema =
|
|
624
|
-
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({
|
|
625
954
|
...rpcRequestMessageSchema.entries,
|
|
626
|
-
...
|
|
627
|
-
method:
|
|
955
|
+
...v14.object({
|
|
956
|
+
method: v14.literal(getCurrentPermissionsMethodName),
|
|
628
957
|
params: getCurrentPermissionsParamsSchema,
|
|
629
|
-
id:
|
|
958
|
+
id: v14.string()
|
|
630
959
|
}).entries
|
|
631
960
|
});
|
|
632
961
|
var getAccountMethodName = "wallet_getAccount";
|
|
633
|
-
var getAccountParamsSchema =
|
|
634
|
-
var getAccountResultSchema =
|
|
962
|
+
var getAccountParamsSchema = v14.nullish(v14.null());
|
|
963
|
+
var getAccountResultSchema = v14.object({
|
|
635
964
|
id: import_xverse_core.permissions.utils.account.accountIdSchema,
|
|
636
|
-
addresses:
|
|
965
|
+
addresses: v14.array(addressSchema),
|
|
637
966
|
walletType: walletTypeSchema
|
|
638
967
|
});
|
|
639
|
-
var getAccountRequestMessageSchema =
|
|
968
|
+
var getAccountRequestMessageSchema = v14.object({
|
|
640
969
|
...rpcRequestMessageSchema.entries,
|
|
641
|
-
...
|
|
642
|
-
method:
|
|
970
|
+
...v14.object({
|
|
971
|
+
method: v14.literal(getAccountMethodName),
|
|
643
972
|
params: getAccountParamsSchema,
|
|
644
|
-
id:
|
|
973
|
+
id: v14.string()
|
|
645
974
|
}).entries
|
|
646
975
|
});
|
|
647
976
|
var connectMethodName = "wallet_connect";
|
|
648
|
-
var connectParamsSchema =
|
|
649
|
-
|
|
650
|
-
permissions:
|
|
977
|
+
var connectParamsSchema = v14.nullish(
|
|
978
|
+
v14.object({
|
|
979
|
+
permissions: v14.optional(v14.array(permissionTemplate))
|
|
651
980
|
})
|
|
652
981
|
);
|
|
653
982
|
var connectResultSchema = getAccountResultSchema;
|
|
654
|
-
var connectRequestMessageSchema =
|
|
983
|
+
var connectRequestMessageSchema = v14.object({
|
|
655
984
|
...rpcRequestMessageSchema.entries,
|
|
656
|
-
...
|
|
657
|
-
method:
|
|
985
|
+
...v14.object({
|
|
986
|
+
method: v14.literal(connectMethodName),
|
|
658
987
|
params: connectParamsSchema,
|
|
659
|
-
id:
|
|
988
|
+
id: v14.string()
|
|
660
989
|
}).entries
|
|
661
990
|
});
|
|
662
991
|
|
|
663
|
-
// src/request/types/runesMethods.ts
|
|
664
|
-
var
|
|
665
|
-
var
|
|
666
|
-
var
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
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())
|
|
675
1049
|
})
|
|
676
1050
|
)
|
|
677
1051
|
});
|
|
678
|
-
var
|
|
1052
|
+
var runesGetBalanceRequestMessageSchema = v16.object({
|
|
679
1053
|
...rpcRequestMessageSchema.entries,
|
|
680
|
-
...
|
|
681
|
-
method:
|
|
682
|
-
params:
|
|
683
|
-
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()
|
|
684
1085
|
}).entries
|
|
685
1086
|
});
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
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()
|
|
693
1097
|
})
|
|
694
1098
|
)
|
|
695
1099
|
});
|
|
696
|
-
var
|
|
1100
|
+
var runesTransferResultSchema = v18.object({
|
|
1101
|
+
txid: v18.string()
|
|
1102
|
+
});
|
|
1103
|
+
var runesTransferRequestMessageSchema = v18.object({
|
|
697
1104
|
...rpcRequestMessageSchema.entries,
|
|
698
|
-
...
|
|
699
|
-
method:
|
|
700
|
-
params:
|
|
701
|
-
id:
|
|
1105
|
+
...v18.object({
|
|
1106
|
+
method: v18.literal(runesTransferMethodName),
|
|
1107
|
+
params: runesTransferParamsSchema,
|
|
1108
|
+
id: v18.string()
|
|
702
1109
|
}).entries
|
|
703
1110
|
});
|
|
704
|
-
var TransferRunesResultSchema = v8.object({
|
|
705
|
-
txid: v8.string()
|
|
706
|
-
});
|
|
707
1111
|
|
|
708
1112
|
// src/request/types/ordinalsMethods.ts
|
|
709
|
-
var
|
|
1113
|
+
var v19 = __toESM(require("valibot"));
|
|
710
1114
|
var getInscriptionsMethodName = "ord_getInscriptions";
|
|
711
|
-
var getInscriptionsParamsSchema =
|
|
712
|
-
offset:
|
|
713
|
-
limit:
|
|
714
|
-
});
|
|
715
|
-
var getInscriptionsResultSchema =
|
|
716
|
-
total:
|
|
717
|
-
limit:
|
|
718
|
-
offset:
|
|
719
|
-
inscriptions:
|
|
720
|
-
|
|
721
|
-
inscriptionId:
|
|
722
|
-
inscriptionNumber:
|
|
723
|
-
address:
|
|
724
|
-
collectionName:
|
|
725
|
-
postage:
|
|
726
|
-
contentLength:
|
|
727
|
-
contentType:
|
|
728
|
-
timestamp:
|
|
729
|
-
offset:
|
|
730
|
-
genesisTransaction:
|
|
731
|
-
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()
|
|
732
1136
|
})
|
|
733
1137
|
)
|
|
734
1138
|
});
|
|
735
|
-
var
|
|
1139
|
+
var getInscriptionsRequestMessageSchema = v19.object({
|
|
736
1140
|
...rpcRequestMessageSchema.entries,
|
|
737
|
-
...
|
|
738
|
-
method:
|
|
1141
|
+
...v19.object({
|
|
1142
|
+
method: v19.literal(getInscriptionsMethodName),
|
|
739
1143
|
params: getInscriptionsParamsSchema,
|
|
740
|
-
id:
|
|
1144
|
+
id: v19.string()
|
|
741
1145
|
}).entries
|
|
742
1146
|
});
|
|
743
1147
|
var sendInscriptionsMethodName = "ord_sendInscriptions";
|
|
744
|
-
var sendInscriptionsParamsSchema =
|
|
745
|
-
transfers:
|
|
746
|
-
|
|
747
|
-
address:
|
|
748
|
-
inscriptionId:
|
|
1148
|
+
var sendInscriptionsParamsSchema = v19.object({
|
|
1149
|
+
transfers: v19.array(
|
|
1150
|
+
v19.object({
|
|
1151
|
+
address: v19.string(),
|
|
1152
|
+
inscriptionId: v19.string()
|
|
749
1153
|
})
|
|
750
1154
|
)
|
|
751
1155
|
});
|
|
752
|
-
var sendInscriptionsResultSchema =
|
|
753
|
-
txid:
|
|
1156
|
+
var sendInscriptionsResultSchema = v19.object({
|
|
1157
|
+
txid: v19.string()
|
|
754
1158
|
});
|
|
755
|
-
var
|
|
1159
|
+
var sendInscriptionsRequestMessageSchema = v19.object({
|
|
756
1160
|
...rpcRequestMessageSchema.entries,
|
|
757
|
-
...
|
|
758
|
-
method:
|
|
1161
|
+
...v19.object({
|
|
1162
|
+
method: v19.literal(sendInscriptionsMethodName),
|
|
759
1163
|
params: sendInscriptionsParamsSchema,
|
|
760
|
-
id:
|
|
1164
|
+
id: v19.string()
|
|
761
1165
|
}).entries
|
|
762
1166
|
});
|
|
763
1167
|
|
|
@@ -774,13 +1178,13 @@ var request = async (method, params, providerId) => {
|
|
|
774
1178
|
throw new Error("A wallet method is required");
|
|
775
1179
|
}
|
|
776
1180
|
const response = await provider.request(method, params);
|
|
777
|
-
if (
|
|
1181
|
+
if (v20.is(rpcErrorResponseMessageSchema, response)) {
|
|
778
1182
|
return {
|
|
779
1183
|
status: "error",
|
|
780
1184
|
error: response.error
|
|
781
1185
|
};
|
|
782
1186
|
}
|
|
783
|
-
if (
|
|
1187
|
+
if (v20.is(rpcSuccessResponseMessageSchema, response)) {
|
|
784
1188
|
return {
|
|
785
1189
|
status: "success",
|
|
786
1190
|
result: response.result
|
|
@@ -1732,7 +2136,6 @@ var signMultipleTransactions = async (options) => {
|
|
|
1732
2136
|
RpcErrorCode,
|
|
1733
2137
|
RpcIdSchema,
|
|
1734
2138
|
SatsConnectAdapter,
|
|
1735
|
-
TransferRunesResultSchema,
|
|
1736
2139
|
accountChangeEventName,
|
|
1737
2140
|
accountChangeSchema,
|
|
1738
2141
|
addListener,
|
|
@@ -1779,15 +2182,11 @@ var signMultipleTransactions = async (options) => {
|
|
|
1779
2182
|
getInfoResultSchema,
|
|
1780
2183
|
getInscriptionsMethodName,
|
|
1781
2184
|
getInscriptionsParamsSchema,
|
|
2185
|
+
getInscriptionsRequestMessageSchema,
|
|
1782
2186
|
getInscriptionsResultSchema,
|
|
1783
|
-
getInscriptionsSchema,
|
|
1784
2187
|
getProviderById,
|
|
1785
2188
|
getProviderOrThrow,
|
|
1786
2189
|
getProviders,
|
|
1787
|
-
getRunesBalanceMethodName,
|
|
1788
|
-
getRunesBalanceParamsSchema,
|
|
1789
|
-
getRunesBalanceRequestMessageSchema,
|
|
1790
|
-
getRunesBalanceResultSchema,
|
|
1791
2190
|
getSupportedWallets,
|
|
1792
2191
|
getWalletTypeMethodName,
|
|
1793
2192
|
getWalletTypeParamsSchema,
|
|
@@ -1811,11 +2210,27 @@ var signMultipleTransactions = async (options) => {
|
|
|
1811
2210
|
rpcRequestMessageSchema,
|
|
1812
2211
|
rpcResponseMessageSchema,
|
|
1813
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,
|
|
1814
2229
|
sendBtcTransaction,
|
|
1815
2230
|
sendInscriptionsMethodName,
|
|
1816
2231
|
sendInscriptionsParamsSchema,
|
|
2232
|
+
sendInscriptionsRequestMessageSchema,
|
|
1817
2233
|
sendInscriptionsResultSchema,
|
|
1818
|
-
sendInscriptionsSchema,
|
|
1819
2234
|
sendTransferMethodName,
|
|
1820
2235
|
sendTransferParamsSchema,
|
|
1821
2236
|
sendTransferRequestMessageSchema,
|
|
@@ -1827,18 +2242,43 @@ var signMultipleTransactions = async (options) => {
|
|
|
1827
2242
|
signMessageRequestMessageSchema,
|
|
1828
2243
|
signMessageResultSchema,
|
|
1829
2244
|
signMultipleTransactions,
|
|
2245
|
+
signPsbtMethodName,
|
|
2246
|
+
signPsbtParamsSchema,
|
|
2247
|
+
signPsbtRequestMessageSchema,
|
|
2248
|
+
signPsbtResultSchema,
|
|
1830
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,
|
|
1831
2262
|
stxGetAddressesMethodName,
|
|
1832
2263
|
stxGetAddressesParamsSchema,
|
|
1833
2264
|
stxGetAddressesRequestMessageSchema,
|
|
1834
2265
|
stxGetAddressesResultSchema,
|
|
2266
|
+
stxSignMessageMethodName,
|
|
2267
|
+
stxSignMessageParamsSchema,
|
|
2268
|
+
stxSignMessageRequestMessageSchema,
|
|
2269
|
+
stxSignMessageResultSchema,
|
|
2270
|
+
stxSignStructuredMessageMethodName,
|
|
2271
|
+
stxSignStructuredMessageParamsSchema,
|
|
2272
|
+
stxSignStructuredMessageRequestMessageSchema,
|
|
2273
|
+
stxSignStructuredMessageResultSchema,
|
|
1835
2274
|
stxSignTransactionMethodName,
|
|
1836
2275
|
stxSignTransactionParamsSchema,
|
|
1837
2276
|
stxSignTransactionRequestMessageSchema,
|
|
1838
2277
|
stxSignTransactionResultSchema,
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
2278
|
+
stxTransferStxMethodName,
|
|
2279
|
+
stxTransferStxParamsSchema,
|
|
2280
|
+
stxTransferStxRequestMessageSchema,
|
|
2281
|
+
stxTransferStxResultSchema,
|
|
1842
2282
|
walletEventSchema,
|
|
1843
2283
|
walletTypeSchema,
|
|
1844
2284
|
walletTypes
|