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