@sats-connect/core 0.5.7 → 0.5.8-b293e57
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 +109 -59
- package/dist/index.d.ts +109 -59
- package/dist/index.js +412 -387
- package/dist/index.mjs +408 -387
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -46,6 +46,10 @@ __export(src_exports, {
|
|
|
46
46
|
accountPermissionSchema: () => accountPermissionSchema,
|
|
47
47
|
addListener: () => addListener,
|
|
48
48
|
addressSchema: () => addressSchema,
|
|
49
|
+
changeNetworkMethodName: () => changeNetworkMethodName,
|
|
50
|
+
changeNetworkParamsSchema: () => changeNetworkParamsSchema,
|
|
51
|
+
changeNetworkRequestMessageSchema: () => changeNetworkRequestMessageSchema,
|
|
52
|
+
changeNetworkResultSchema: () => changeNetworkResultSchema,
|
|
49
53
|
connectMethodName: () => connectMethodName,
|
|
50
54
|
connectParamsSchema: () => connectParamsSchema,
|
|
51
55
|
connectRequestMessageSchema: () => connectRequestMessageSchema,
|
|
@@ -201,28 +205,80 @@ __export(src_exports, {
|
|
|
201
205
|
});
|
|
202
206
|
module.exports = __toCommonJS(src_exports);
|
|
203
207
|
|
|
204
|
-
// src/
|
|
208
|
+
// src/types.ts
|
|
205
209
|
var v = __toESM(require("valibot"));
|
|
210
|
+
var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
|
|
211
|
+
BitcoinNetworkType2["Mainnet"] = "Mainnet";
|
|
212
|
+
BitcoinNetworkType2["Testnet"] = "Testnet";
|
|
213
|
+
BitcoinNetworkType2["Testnet4"] = "Testnet4";
|
|
214
|
+
BitcoinNetworkType2["Signet"] = "Signet";
|
|
215
|
+
BitcoinNetworkType2["Regtest"] = "Regtest";
|
|
216
|
+
return BitcoinNetworkType2;
|
|
217
|
+
})(BitcoinNetworkType || {});
|
|
218
|
+
var RpcIdSchema = v.optional(v.union([v.string(), v.number(), v.null()]));
|
|
219
|
+
var rpcRequestMessageSchema = v.object({
|
|
220
|
+
jsonrpc: v.literal("2.0"),
|
|
221
|
+
method: v.string(),
|
|
222
|
+
params: v.optional(
|
|
223
|
+
v.union([
|
|
224
|
+
v.array(v.unknown()),
|
|
225
|
+
v.looseObject({}),
|
|
226
|
+
// Note: This is to support current incorrect usage of RPC 2.0. Params need
|
|
227
|
+
// to be either an array or an object when provided. Changing this now would
|
|
228
|
+
// be a breaking change, so accepting null values for now. Tracking in
|
|
229
|
+
// https://linear.app/xverseapp/issue/ENG-4538.
|
|
230
|
+
v.null()
|
|
231
|
+
])
|
|
232
|
+
),
|
|
233
|
+
id: v.unwrap(RpcIdSchema)
|
|
234
|
+
});
|
|
235
|
+
var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode2) => {
|
|
236
|
+
RpcErrorCode2[RpcErrorCode2["PARSE_ERROR"] = -32700] = "PARSE_ERROR";
|
|
237
|
+
RpcErrorCode2[RpcErrorCode2["INVALID_REQUEST"] = -32600] = "INVALID_REQUEST";
|
|
238
|
+
RpcErrorCode2[RpcErrorCode2["METHOD_NOT_FOUND"] = -32601] = "METHOD_NOT_FOUND";
|
|
239
|
+
RpcErrorCode2[RpcErrorCode2["INVALID_PARAMS"] = -32602] = "INVALID_PARAMS";
|
|
240
|
+
RpcErrorCode2[RpcErrorCode2["INTERNAL_ERROR"] = -32603] = "INTERNAL_ERROR";
|
|
241
|
+
RpcErrorCode2[RpcErrorCode2["USER_REJECTION"] = -32e3] = "USER_REJECTION";
|
|
242
|
+
RpcErrorCode2[RpcErrorCode2["METHOD_NOT_SUPPORTED"] = -32001] = "METHOD_NOT_SUPPORTED";
|
|
243
|
+
RpcErrorCode2[RpcErrorCode2["ACCESS_DENIED"] = -32002] = "ACCESS_DENIED";
|
|
244
|
+
return RpcErrorCode2;
|
|
245
|
+
})(RpcErrorCode || {});
|
|
246
|
+
var rpcSuccessResponseMessageSchema = v.object({
|
|
247
|
+
jsonrpc: v.literal("2.0"),
|
|
248
|
+
result: v.nonOptional(v.unknown()),
|
|
249
|
+
id: RpcIdSchema
|
|
250
|
+
});
|
|
251
|
+
var rpcErrorResponseMessageSchema = v.object({
|
|
252
|
+
jsonrpc: v.literal("2.0"),
|
|
253
|
+
error: v.nonOptional(v.unknown()),
|
|
254
|
+
id: RpcIdSchema
|
|
255
|
+
});
|
|
256
|
+
var rpcResponseMessageSchema = v.union([
|
|
257
|
+
rpcSuccessResponseMessageSchema,
|
|
258
|
+
rpcErrorResponseMessageSchema
|
|
259
|
+
]);
|
|
260
|
+
|
|
261
|
+
// src/provider/types.ts
|
|
262
|
+
var v2 = __toESM(require("valibot"));
|
|
206
263
|
var accountChangeEventName = "accountChange";
|
|
207
|
-
var accountChangeSchema =
|
|
208
|
-
type:
|
|
264
|
+
var accountChangeSchema = v2.object({
|
|
265
|
+
type: v2.literal(accountChangeEventName)
|
|
209
266
|
});
|
|
210
267
|
var networkChangeEventName = "networkChange";
|
|
211
|
-
var
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
name: v.picklist(networkType)
|
|
268
|
+
var networkChangeSchema = v2.object({
|
|
269
|
+
type: v2.literal(networkChangeEventName),
|
|
270
|
+
bitcoin: v2.object({
|
|
271
|
+
name: v2.enum(BitcoinNetworkType)
|
|
216
272
|
}),
|
|
217
|
-
stacks:
|
|
218
|
-
name:
|
|
273
|
+
stacks: v2.object({
|
|
274
|
+
name: v2.string()
|
|
219
275
|
})
|
|
220
276
|
});
|
|
221
277
|
var disconnectEventName = "disconnect";
|
|
222
|
-
var disconnectSchema =
|
|
223
|
-
type:
|
|
278
|
+
var disconnectSchema = v2.object({
|
|
279
|
+
type: v2.literal(disconnectEventName)
|
|
224
280
|
});
|
|
225
|
-
var walletEventSchema =
|
|
281
|
+
var walletEventSchema = v2.variant("type", [
|
|
226
282
|
accountChangeSchema,
|
|
227
283
|
networkChangeSchema,
|
|
228
284
|
disconnectSchema
|
|
@@ -267,59 +323,6 @@ function getSupportedWallets() {
|
|
|
267
323
|
return wallets;
|
|
268
324
|
}
|
|
269
325
|
|
|
270
|
-
// src/types.ts
|
|
271
|
-
var v2 = __toESM(require("valibot"));
|
|
272
|
-
var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
|
|
273
|
-
BitcoinNetworkType2["Mainnet"] = "Mainnet";
|
|
274
|
-
BitcoinNetworkType2["Testnet"] = "Testnet";
|
|
275
|
-
BitcoinNetworkType2["Testnet4"] = "Testnet4";
|
|
276
|
-
BitcoinNetworkType2["Signet"] = "Signet";
|
|
277
|
-
BitcoinNetworkType2["Regtest"] = "Regtest";
|
|
278
|
-
return BitcoinNetworkType2;
|
|
279
|
-
})(BitcoinNetworkType || {});
|
|
280
|
-
var RpcIdSchema = v2.optional(v2.union([v2.string(), v2.number(), v2.null()]));
|
|
281
|
-
var rpcRequestMessageSchema = v2.object({
|
|
282
|
-
jsonrpc: v2.literal("2.0"),
|
|
283
|
-
method: v2.string(),
|
|
284
|
-
params: v2.optional(
|
|
285
|
-
v2.union([
|
|
286
|
-
v2.array(v2.unknown()),
|
|
287
|
-
v2.looseObject({}),
|
|
288
|
-
// Note: This is to support current incorrect usage of RPC 2.0. Params need
|
|
289
|
-
// to be either an array or an object when provided. Changing this now would
|
|
290
|
-
// be a breaking change, so accepting null values for now. Tracking in
|
|
291
|
-
// https://linear.app/xverseapp/issue/ENG-4538.
|
|
292
|
-
v2.null()
|
|
293
|
-
])
|
|
294
|
-
),
|
|
295
|
-
id: v2.unwrap(RpcIdSchema)
|
|
296
|
-
});
|
|
297
|
-
var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode2) => {
|
|
298
|
-
RpcErrorCode2[RpcErrorCode2["PARSE_ERROR"] = -32700] = "PARSE_ERROR";
|
|
299
|
-
RpcErrorCode2[RpcErrorCode2["INVALID_REQUEST"] = -32600] = "INVALID_REQUEST";
|
|
300
|
-
RpcErrorCode2[RpcErrorCode2["METHOD_NOT_FOUND"] = -32601] = "METHOD_NOT_FOUND";
|
|
301
|
-
RpcErrorCode2[RpcErrorCode2["INVALID_PARAMS"] = -32602] = "INVALID_PARAMS";
|
|
302
|
-
RpcErrorCode2[RpcErrorCode2["INTERNAL_ERROR"] = -32603] = "INTERNAL_ERROR";
|
|
303
|
-
RpcErrorCode2[RpcErrorCode2["USER_REJECTION"] = -32e3] = "USER_REJECTION";
|
|
304
|
-
RpcErrorCode2[RpcErrorCode2["METHOD_NOT_SUPPORTED"] = -32001] = "METHOD_NOT_SUPPORTED";
|
|
305
|
-
RpcErrorCode2[RpcErrorCode2["ACCESS_DENIED"] = -32002] = "ACCESS_DENIED";
|
|
306
|
-
return RpcErrorCode2;
|
|
307
|
-
})(RpcErrorCode || {});
|
|
308
|
-
var rpcSuccessResponseMessageSchema = v2.object({
|
|
309
|
-
jsonrpc: v2.literal("2.0"),
|
|
310
|
-
result: v2.nonOptional(v2.unknown()),
|
|
311
|
-
id: RpcIdSchema
|
|
312
|
-
});
|
|
313
|
-
var rpcErrorResponseMessageSchema = v2.object({
|
|
314
|
-
jsonrpc: v2.literal("2.0"),
|
|
315
|
-
error: v2.nonOptional(v2.unknown()),
|
|
316
|
-
id: RpcIdSchema
|
|
317
|
-
});
|
|
318
|
-
var rpcResponseMessageSchema = v2.union([
|
|
319
|
-
rpcSuccessResponseMessageSchema,
|
|
320
|
-
rpcErrorResponseMessageSchema
|
|
321
|
-
]);
|
|
322
|
-
|
|
323
326
|
// src/request/index.ts
|
|
324
327
|
var v21 = __toESM(require("valibot"));
|
|
325
328
|
|
|
@@ -412,30 +415,15 @@ var stxDeployContractRequestMessageSchema = v4.object({
|
|
|
412
415
|
});
|
|
413
416
|
|
|
414
417
|
// src/request/types/stxMethods/getAccounts.ts
|
|
418
|
+
var v8 = __toESM(require("valibot"));
|
|
419
|
+
|
|
420
|
+
// src/request/types/walletMethods.ts
|
|
421
|
+
var v7 = __toESM(require("valibot"));
|
|
422
|
+
|
|
423
|
+
// src/request/types/common.ts
|
|
415
424
|
var v5 = __toESM(require("valibot"));
|
|
416
|
-
var
|
|
417
|
-
var
|
|
418
|
-
var stxGetAccountsResultSchema = v5.object({
|
|
419
|
-
/**
|
|
420
|
-
* The addresses generated for the given purposes.
|
|
421
|
-
*/
|
|
422
|
-
addresses: v5.array(
|
|
423
|
-
v5.object({
|
|
424
|
-
address: v5.string(),
|
|
425
|
-
publicKey: v5.string(),
|
|
426
|
-
gaiaHubUrl: v5.string(),
|
|
427
|
-
gaiaAppKey: v5.string()
|
|
428
|
-
})
|
|
429
|
-
)
|
|
430
|
-
});
|
|
431
|
-
var stxGetAccountsRequestMessageSchema = v5.object({
|
|
432
|
-
...rpcRequestMessageSchema.entries,
|
|
433
|
-
...v5.object({
|
|
434
|
-
method: v5.literal(stxGetAccountsMethodName),
|
|
435
|
-
params: stxGetAccountsParamsSchema,
|
|
436
|
-
id: v5.string()
|
|
437
|
-
}).entries
|
|
438
|
-
});
|
|
425
|
+
var walletTypes = ["software", "ledger", "keystone"];
|
|
426
|
+
var walletTypeSchema = v5.picklist(walletTypes);
|
|
439
427
|
|
|
440
428
|
// src/addresses/index.ts
|
|
441
429
|
var import_jsontokens = require("jsontokens");
|
|
@@ -482,185 +470,367 @@ var getAddress = async (options) => {
|
|
|
482
470
|
}
|
|
483
471
|
};
|
|
484
472
|
|
|
473
|
+
// src/request/types/walletMethods.ts
|
|
474
|
+
var accountActionsSchema = v7.object({
|
|
475
|
+
read: v7.optional(v7.boolean())
|
|
476
|
+
});
|
|
477
|
+
var walletActionsSchema = v7.object({
|
|
478
|
+
readNetwork: v7.optional(v7.boolean())
|
|
479
|
+
});
|
|
480
|
+
var accountPermissionSchema = v7.object({
|
|
481
|
+
type: v7.literal("account"),
|
|
482
|
+
resourceId: v7.string(),
|
|
483
|
+
clientId: v7.string(),
|
|
484
|
+
actions: accountActionsSchema
|
|
485
|
+
});
|
|
486
|
+
var walletPermissionSchema = v7.object({
|
|
487
|
+
type: v7.literal("wallet"),
|
|
488
|
+
resourceId: v7.string(),
|
|
489
|
+
clientId: v7.string(),
|
|
490
|
+
actions: walletActionsSchema
|
|
491
|
+
});
|
|
492
|
+
var PermissionRequestParams = v7.variant("type", [
|
|
493
|
+
v7.object({
|
|
494
|
+
...v7.omit(accountPermissionSchema, ["clientId"]).entries
|
|
495
|
+
}),
|
|
496
|
+
v7.object({
|
|
497
|
+
...v7.omit(walletPermissionSchema, ["clientId"]).entries
|
|
498
|
+
})
|
|
499
|
+
]);
|
|
500
|
+
var permission = v7.variant("type", [accountPermissionSchema, walletPermissionSchema]);
|
|
501
|
+
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
502
|
+
var requestPermissionsParamsSchema = v7.nullish(v7.array(PermissionRequestParams));
|
|
503
|
+
var requestPermissionsResultSchema = v7.literal(true);
|
|
504
|
+
var requestPermissionsRequestMessageSchema = v7.object({
|
|
505
|
+
...rpcRequestMessageSchema.entries,
|
|
506
|
+
...v7.object({
|
|
507
|
+
method: v7.literal(requestPermissionsMethodName),
|
|
508
|
+
params: requestPermissionsParamsSchema,
|
|
509
|
+
id: v7.string()
|
|
510
|
+
}).entries
|
|
511
|
+
});
|
|
512
|
+
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
513
|
+
var renouncePermissionsParamsSchema = v7.nullish(v7.null());
|
|
514
|
+
var renouncePermissionsResultSchema = v7.nullish(v7.null());
|
|
515
|
+
var renouncePermissionsRequestMessageSchema = v7.object({
|
|
516
|
+
...rpcRequestMessageSchema.entries,
|
|
517
|
+
...v7.object({
|
|
518
|
+
method: v7.literal(renouncePermissionsMethodName),
|
|
519
|
+
params: renouncePermissionsParamsSchema,
|
|
520
|
+
id: v7.string()
|
|
521
|
+
}).entries
|
|
522
|
+
});
|
|
523
|
+
var disconnectMethodName = "wallet_disconnect";
|
|
524
|
+
var disconnectParamsSchema = v7.nullish(v7.null());
|
|
525
|
+
var disconnectResultSchema = v7.nullish(v7.null());
|
|
526
|
+
var disconnectRequestMessageSchema = v7.object({
|
|
527
|
+
...rpcRequestMessageSchema.entries,
|
|
528
|
+
...v7.object({
|
|
529
|
+
method: v7.literal(disconnectMethodName),
|
|
530
|
+
params: disconnectParamsSchema,
|
|
531
|
+
id: v7.string()
|
|
532
|
+
}).entries
|
|
533
|
+
});
|
|
534
|
+
var getWalletTypeMethodName = "wallet_getWalletType";
|
|
535
|
+
var getWalletTypeParamsSchema = v7.nullish(v7.null());
|
|
536
|
+
var getWalletTypeResultSchema = walletTypeSchema;
|
|
537
|
+
var getWalletTypeRequestMessageSchema = v7.object({
|
|
538
|
+
...rpcRequestMessageSchema.entries,
|
|
539
|
+
...v7.object({
|
|
540
|
+
method: v7.literal(getWalletTypeMethodName),
|
|
541
|
+
params: getWalletTypeParamsSchema,
|
|
542
|
+
id: v7.string()
|
|
543
|
+
}).entries
|
|
544
|
+
});
|
|
545
|
+
var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
|
|
546
|
+
var getCurrentPermissionsParamsSchema = v7.nullish(v7.null());
|
|
547
|
+
var getCurrentPermissionsResultSchema = v7.array(permission);
|
|
548
|
+
var getCurrentPermissionsRequestMessageSchema = v7.object({
|
|
549
|
+
...rpcRequestMessageSchema.entries,
|
|
550
|
+
...v7.object({
|
|
551
|
+
method: v7.literal(getCurrentPermissionsMethodName),
|
|
552
|
+
params: getCurrentPermissionsParamsSchema,
|
|
553
|
+
id: v7.string()
|
|
554
|
+
}).entries
|
|
555
|
+
});
|
|
556
|
+
var getNetworkMethodName = "wallet_getNetwork";
|
|
557
|
+
var getNetworkParamsSchema = v7.nullish(v7.null());
|
|
558
|
+
var getNetworkResultSchema = v7.object({
|
|
559
|
+
bitcoin: v7.object({
|
|
560
|
+
name: v7.enum(BitcoinNetworkType)
|
|
561
|
+
}),
|
|
562
|
+
stacks: v7.object({
|
|
563
|
+
name: v7.string()
|
|
564
|
+
})
|
|
565
|
+
});
|
|
566
|
+
var getNetworkRequestMessageSchema = v7.object({
|
|
567
|
+
...rpcRequestMessageSchema.entries,
|
|
568
|
+
...v7.object({
|
|
569
|
+
method: v7.literal(getNetworkMethodName),
|
|
570
|
+
params: getNetworkParamsSchema,
|
|
571
|
+
id: v7.string()
|
|
572
|
+
}).entries
|
|
573
|
+
});
|
|
574
|
+
var changeNetworkMethodName = "wallet_changeNetwork";
|
|
575
|
+
var changeNetworkParamsSchema = v7.object({
|
|
576
|
+
name: v7.enum(BitcoinNetworkType)
|
|
577
|
+
});
|
|
578
|
+
var changeNetworkResultSchema = v7.nullish(v7.null());
|
|
579
|
+
var changeNetworkRequestMessageSchema = v7.object({
|
|
580
|
+
...rpcRequestMessageSchema.entries,
|
|
581
|
+
...v7.object({
|
|
582
|
+
method: v7.literal(changeNetworkMethodName),
|
|
583
|
+
params: changeNetworkParamsSchema,
|
|
584
|
+
id: v7.string()
|
|
585
|
+
}).entries
|
|
586
|
+
});
|
|
587
|
+
var getAccountMethodName = "wallet_getAccount";
|
|
588
|
+
var getAccountParamsSchema = v7.nullish(v7.null());
|
|
589
|
+
var getAccountResultSchema = v7.object({
|
|
590
|
+
id: v7.string(),
|
|
591
|
+
addresses: v7.array(addressSchema),
|
|
592
|
+
walletType: walletTypeSchema,
|
|
593
|
+
network: getNetworkResultSchema
|
|
594
|
+
});
|
|
595
|
+
var getAccountRequestMessageSchema = v7.object({
|
|
596
|
+
...rpcRequestMessageSchema.entries,
|
|
597
|
+
...v7.object({
|
|
598
|
+
method: v7.literal(getAccountMethodName),
|
|
599
|
+
params: getAccountParamsSchema,
|
|
600
|
+
id: v7.string()
|
|
601
|
+
}).entries
|
|
602
|
+
});
|
|
603
|
+
var connectMethodName = "wallet_connect";
|
|
604
|
+
var connectParamsSchema = v7.nullish(
|
|
605
|
+
v7.object({
|
|
606
|
+
permissions: v7.optional(v7.array(PermissionRequestParams)),
|
|
607
|
+
addresses: v7.optional(v7.array(v7.enum(AddressPurpose))),
|
|
608
|
+
message: v7.optional(
|
|
609
|
+
v7.pipe(v7.string(), v7.maxLength(80, "The message must not exceed 80 characters."))
|
|
610
|
+
)
|
|
611
|
+
})
|
|
612
|
+
);
|
|
613
|
+
var connectResultSchema = v7.object({
|
|
614
|
+
id: v7.string(),
|
|
615
|
+
addresses: v7.array(addressSchema),
|
|
616
|
+
walletType: walletTypeSchema,
|
|
617
|
+
network: getNetworkResultSchema
|
|
618
|
+
});
|
|
619
|
+
var connectRequestMessageSchema = v7.object({
|
|
620
|
+
...rpcRequestMessageSchema.entries,
|
|
621
|
+
...v7.object({
|
|
622
|
+
method: v7.literal(connectMethodName),
|
|
623
|
+
params: connectParamsSchema,
|
|
624
|
+
id: v7.string()
|
|
625
|
+
}).entries
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
// src/request/types/stxMethods/getAccounts.ts
|
|
629
|
+
var stxGetAccountsMethodName = "stx_getAccounts";
|
|
630
|
+
var stxGetAccountsParamsSchema = v8.nullish(v8.null());
|
|
631
|
+
var stxGetAccountsResultSchema = v8.object({
|
|
632
|
+
/**
|
|
633
|
+
* The addresses generated for the given purposes.
|
|
634
|
+
*/
|
|
635
|
+
addresses: v8.array(
|
|
636
|
+
v8.object({
|
|
637
|
+
address: v8.string(),
|
|
638
|
+
publicKey: v8.string(),
|
|
639
|
+
gaiaHubUrl: v8.string(),
|
|
640
|
+
gaiaAppKey: v8.string()
|
|
641
|
+
})
|
|
642
|
+
),
|
|
643
|
+
network: getNetworkResultSchema
|
|
644
|
+
});
|
|
645
|
+
var stxGetAccountsRequestMessageSchema = v8.object({
|
|
646
|
+
...rpcRequestMessageSchema.entries,
|
|
647
|
+
...v8.object({
|
|
648
|
+
method: v8.literal(stxGetAccountsMethodName),
|
|
649
|
+
params: stxGetAccountsParamsSchema,
|
|
650
|
+
id: v8.string()
|
|
651
|
+
}).entries
|
|
652
|
+
});
|
|
653
|
+
|
|
485
654
|
// src/request/types/stxMethods/getAddresses.ts
|
|
486
|
-
var
|
|
655
|
+
var v9 = __toESM(require("valibot"));
|
|
487
656
|
var stxGetAddressesMethodName = "stx_getAddresses";
|
|
488
|
-
var stxGetAddressesParamsSchema =
|
|
489
|
-
|
|
657
|
+
var stxGetAddressesParamsSchema = v9.nullish(
|
|
658
|
+
v9.object({
|
|
490
659
|
/**
|
|
491
660
|
* A message to be displayed to the user in the request prompt.
|
|
492
661
|
*/
|
|
493
|
-
message:
|
|
662
|
+
message: v9.optional(v9.string())
|
|
494
663
|
})
|
|
495
664
|
);
|
|
496
|
-
var stxGetAddressesResultSchema =
|
|
665
|
+
var stxGetAddressesResultSchema = v9.object({
|
|
497
666
|
/**
|
|
498
667
|
* The addresses generated for the given purposes.
|
|
499
668
|
*/
|
|
500
|
-
addresses:
|
|
669
|
+
addresses: v9.array(addressSchema),
|
|
670
|
+
network: getNetworkResultSchema
|
|
501
671
|
});
|
|
502
|
-
var stxGetAddressesRequestMessageSchema =
|
|
672
|
+
var stxGetAddressesRequestMessageSchema = v9.object({
|
|
503
673
|
...rpcRequestMessageSchema.entries,
|
|
504
|
-
...
|
|
505
|
-
method:
|
|
674
|
+
...v9.object({
|
|
675
|
+
method: v9.literal(stxGetAddressesMethodName),
|
|
506
676
|
params: stxGetAddressesParamsSchema,
|
|
507
|
-
id:
|
|
677
|
+
id: v9.string()
|
|
508
678
|
}).entries
|
|
509
679
|
});
|
|
510
680
|
|
|
511
681
|
// src/request/types/stxMethods/signMessage.ts
|
|
512
|
-
var
|
|
682
|
+
var v10 = __toESM(require("valibot"));
|
|
513
683
|
var stxSignMessageMethodName = "stx_signMessage";
|
|
514
|
-
var stxSignMessageParamsSchema =
|
|
684
|
+
var stxSignMessageParamsSchema = v10.object({
|
|
515
685
|
/**
|
|
516
686
|
* The message to sign.
|
|
517
687
|
*/
|
|
518
|
-
message:
|
|
688
|
+
message: v10.string(),
|
|
519
689
|
/**
|
|
520
690
|
* The public key to sign the message with.
|
|
521
691
|
*/
|
|
522
|
-
publicKey:
|
|
692
|
+
publicKey: v10.string(),
|
|
523
693
|
/**
|
|
524
694
|
* The format version of the parameter.
|
|
525
695
|
*/
|
|
526
|
-
parameterFormatVersion:
|
|
696
|
+
parameterFormatVersion: v10.optional(v10.number())
|
|
527
697
|
});
|
|
528
|
-
var stxSignMessageResultSchema =
|
|
698
|
+
var stxSignMessageResultSchema = v10.object({
|
|
529
699
|
/**
|
|
530
700
|
* The signature of the message.
|
|
531
701
|
*/
|
|
532
|
-
signature:
|
|
702
|
+
signature: v10.string(),
|
|
533
703
|
/**
|
|
534
704
|
* The public key used to sign the message.
|
|
535
705
|
*/
|
|
536
|
-
publicKey:
|
|
706
|
+
publicKey: v10.string()
|
|
537
707
|
});
|
|
538
|
-
var stxSignMessageRequestMessageSchema =
|
|
708
|
+
var stxSignMessageRequestMessageSchema = v10.object({
|
|
539
709
|
...rpcRequestMessageSchema.entries,
|
|
540
|
-
...
|
|
541
|
-
method:
|
|
710
|
+
...v10.object({
|
|
711
|
+
method: v10.literal(stxSignMessageMethodName),
|
|
542
712
|
params: stxSignMessageParamsSchema,
|
|
543
|
-
id:
|
|
713
|
+
id: v10.string()
|
|
544
714
|
}).entries
|
|
545
715
|
});
|
|
546
716
|
|
|
547
717
|
// src/request/types/stxMethods/signStructuredMessage.ts
|
|
548
|
-
var
|
|
718
|
+
var v11 = __toESM(require("valibot"));
|
|
549
719
|
var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
|
|
550
|
-
var stxSignStructuredMessageParamsSchema =
|
|
720
|
+
var stxSignStructuredMessageParamsSchema = v11.object({
|
|
551
721
|
/**
|
|
552
722
|
* The domain to be signed.
|
|
553
723
|
*/
|
|
554
|
-
domain:
|
|
724
|
+
domain: v11.string(),
|
|
555
725
|
/**
|
|
556
726
|
* Message payload to be signed.
|
|
557
727
|
*/
|
|
558
|
-
message:
|
|
728
|
+
message: v11.string(),
|
|
559
729
|
/**
|
|
560
730
|
* The format version of the parameter.
|
|
561
731
|
*/
|
|
562
|
-
parameterFormatVersion:
|
|
732
|
+
parameterFormatVersion: v11.optional(v11.number()),
|
|
563
733
|
/**
|
|
564
734
|
* The public key to sign the message with.
|
|
565
735
|
*/
|
|
566
|
-
publicKey:
|
|
736
|
+
publicKey: v11.optional(v11.string())
|
|
567
737
|
});
|
|
568
|
-
var stxSignStructuredMessageResultSchema =
|
|
738
|
+
var stxSignStructuredMessageResultSchema = v11.object({
|
|
569
739
|
/**
|
|
570
740
|
* Signature of the message.
|
|
571
741
|
*/
|
|
572
|
-
signature:
|
|
742
|
+
signature: v11.string(),
|
|
573
743
|
/**
|
|
574
744
|
* Public key as hex-encoded string.
|
|
575
745
|
*/
|
|
576
|
-
publicKey:
|
|
746
|
+
publicKey: v11.string()
|
|
577
747
|
});
|
|
578
|
-
var stxSignStructuredMessageRequestMessageSchema =
|
|
748
|
+
var stxSignStructuredMessageRequestMessageSchema = v11.object({
|
|
579
749
|
...rpcRequestMessageSchema.entries,
|
|
580
|
-
...
|
|
581
|
-
method:
|
|
750
|
+
...v11.object({
|
|
751
|
+
method: v11.literal(stxSignStructuredMessageMethodName),
|
|
582
752
|
params: stxSignStructuredMessageParamsSchema,
|
|
583
|
-
id:
|
|
753
|
+
id: v11.string()
|
|
584
754
|
}).entries
|
|
585
755
|
});
|
|
586
756
|
|
|
587
757
|
// src/request/types/stxMethods/signTransaction.ts
|
|
588
|
-
var
|
|
758
|
+
var v12 = __toESM(require("valibot"));
|
|
589
759
|
var stxSignTransactionMethodName = "stx_signTransaction";
|
|
590
|
-
var stxSignTransactionParamsSchema =
|
|
760
|
+
var stxSignTransactionParamsSchema = v12.object({
|
|
591
761
|
/**
|
|
592
762
|
* The transaction to sign as a hex-encoded string.
|
|
593
763
|
*/
|
|
594
|
-
transaction:
|
|
764
|
+
transaction: v12.string(),
|
|
595
765
|
/**
|
|
596
766
|
* The public key to sign the transaction with. The wallet may use any key
|
|
597
767
|
* when not provided.
|
|
598
768
|
*/
|
|
599
|
-
pubkey:
|
|
769
|
+
pubkey: v12.optional(v12.string()),
|
|
600
770
|
/**
|
|
601
771
|
* Whether to broadcast the transaction after signing. Defaults to `true`.
|
|
602
772
|
*/
|
|
603
|
-
broadcast:
|
|
773
|
+
broadcast: v12.optional(v12.boolean())
|
|
604
774
|
});
|
|
605
|
-
var stxSignTransactionResultSchema =
|
|
775
|
+
var stxSignTransactionResultSchema = v12.object({
|
|
606
776
|
/**
|
|
607
777
|
* The signed transaction as a hex-encoded string.
|
|
608
778
|
*/
|
|
609
|
-
transaction:
|
|
779
|
+
transaction: v12.string()
|
|
610
780
|
});
|
|
611
|
-
var stxSignTransactionRequestMessageSchema =
|
|
781
|
+
var stxSignTransactionRequestMessageSchema = v12.object({
|
|
612
782
|
...rpcRequestMessageSchema.entries,
|
|
613
|
-
...
|
|
614
|
-
method:
|
|
783
|
+
...v12.object({
|
|
784
|
+
method: v12.literal(stxSignTransactionMethodName),
|
|
615
785
|
params: stxSignTransactionParamsSchema,
|
|
616
|
-
id:
|
|
786
|
+
id: v12.string()
|
|
617
787
|
}).entries
|
|
618
788
|
});
|
|
619
789
|
|
|
620
790
|
// src/request/types/stxMethods/signTransactions.ts
|
|
621
|
-
var
|
|
791
|
+
var v13 = __toESM(require("valibot"));
|
|
622
792
|
var stxSignTransactionsMethodName = "stx_signTransactions";
|
|
623
|
-
var stxSignTransactionsParamsSchema =
|
|
793
|
+
var stxSignTransactionsParamsSchema = v13.object({
|
|
624
794
|
/**
|
|
625
795
|
* The transactions to sign as hex-encoded strings.
|
|
626
796
|
*/
|
|
627
|
-
transactions:
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
797
|
+
transactions: v13.pipe(
|
|
798
|
+
v13.array(
|
|
799
|
+
v13.pipe(
|
|
800
|
+
v13.string(),
|
|
801
|
+
v13.check((hex) => {
|
|
632
802
|
return true;
|
|
633
803
|
}, "Invalid hex-encoded Stacks transaction.")
|
|
634
804
|
)
|
|
635
805
|
),
|
|
636
|
-
|
|
806
|
+
v13.minLength(1)
|
|
637
807
|
),
|
|
638
808
|
/**
|
|
639
809
|
* Whether the signed transactions should be broadcast after signing. Defaults
|
|
640
810
|
* to `true`.
|
|
641
811
|
*/
|
|
642
|
-
broadcast:
|
|
812
|
+
broadcast: v13.optional(v13.boolean())
|
|
643
813
|
});
|
|
644
|
-
var stxSignTransactionsResultSchema =
|
|
814
|
+
var stxSignTransactionsResultSchema = v13.object({
|
|
645
815
|
/**
|
|
646
816
|
* The signed transactions as hex-encoded strings, in the same order as in the
|
|
647
817
|
* sign request.
|
|
648
818
|
*/
|
|
649
|
-
transactions:
|
|
819
|
+
transactions: v13.array(v13.string())
|
|
650
820
|
});
|
|
651
|
-
var stxSignTransactionsRequestMessageSchema =
|
|
821
|
+
var stxSignTransactionsRequestMessageSchema = v13.object({
|
|
652
822
|
...rpcRequestMessageSchema.entries,
|
|
653
|
-
...
|
|
654
|
-
method:
|
|
823
|
+
...v13.object({
|
|
824
|
+
method: v13.literal(stxSignTransactionsMethodName),
|
|
655
825
|
params: stxSignTransactionsParamsSchema,
|
|
656
|
-
id:
|
|
826
|
+
id: v13.string()
|
|
657
827
|
}).entries
|
|
658
828
|
});
|
|
659
829
|
|
|
660
830
|
// src/request/types/stxMethods/transferStx.ts
|
|
661
|
-
var
|
|
831
|
+
var v14 = __toESM(require("valibot"));
|
|
662
832
|
var stxTransferStxMethodName = "stx_transferStx";
|
|
663
|
-
var stxTransferStxParamsSchema =
|
|
833
|
+
var stxTransferStxParamsSchema = v14.object({
|
|
664
834
|
/**
|
|
665
835
|
* Amount of STX tokens to transfer in microstacks as a string. Anything
|
|
666
836
|
* parseable by `BigInt` is acceptable.
|
|
@@ -673,23 +843,23 @@ var stxTransferStxParamsSchema = v12.object({
|
|
|
673
843
|
* const amount3 = '1234';
|
|
674
844
|
* ```
|
|
675
845
|
*/
|
|
676
|
-
amount:
|
|
846
|
+
amount: v14.union([v14.number(), v14.string()]),
|
|
677
847
|
/**
|
|
678
848
|
* The recipeint's principal.
|
|
679
849
|
*/
|
|
680
|
-
recipient:
|
|
850
|
+
recipient: v14.string(),
|
|
681
851
|
/**
|
|
682
852
|
* A string representing the memo.
|
|
683
853
|
*/
|
|
684
|
-
memo:
|
|
854
|
+
memo: v14.optional(v14.string()),
|
|
685
855
|
/**
|
|
686
856
|
* Version of parameter format.
|
|
687
857
|
*/
|
|
688
|
-
version:
|
|
858
|
+
version: v14.optional(v14.string()),
|
|
689
859
|
/**
|
|
690
860
|
* The mode of the post conditions.
|
|
691
861
|
*/
|
|
692
|
-
postConditionMode:
|
|
862
|
+
postConditionMode: v14.optional(v14.number()),
|
|
693
863
|
/**
|
|
694
864
|
* A hex-encoded string representing the post conditions.
|
|
695
865
|
*
|
|
@@ -702,89 +872,83 @@ var stxTransferStxParamsSchema = v12.object({
|
|
|
702
872
|
* const hexPostCondition = serializePostCondition(postCondition).toString('hex');
|
|
703
873
|
* ```
|
|
704
874
|
*/
|
|
705
|
-
postConditions:
|
|
875
|
+
postConditions: v14.optional(v14.array(v14.string())),
|
|
706
876
|
/**
|
|
707
877
|
* The public key to sign the transaction with. The wallet may use any key
|
|
708
878
|
* when not provided.
|
|
709
879
|
*/
|
|
710
|
-
pubkey:
|
|
880
|
+
pubkey: v14.optional(v14.string())
|
|
711
881
|
});
|
|
712
|
-
var stxTransferStxResultSchema =
|
|
882
|
+
var stxTransferStxResultSchema = v14.object({
|
|
713
883
|
/**
|
|
714
884
|
* The ID of the transaction.
|
|
715
885
|
*/
|
|
716
|
-
txid:
|
|
886
|
+
txid: v14.string(),
|
|
717
887
|
/**
|
|
718
888
|
* A Stacks transaction as a hex-encoded string.
|
|
719
889
|
*/
|
|
720
|
-
transaction:
|
|
890
|
+
transaction: v14.string()
|
|
721
891
|
});
|
|
722
|
-
var stxTransferStxRequestMessageSchema =
|
|
892
|
+
var stxTransferStxRequestMessageSchema = v14.object({
|
|
723
893
|
...rpcRequestMessageSchema.entries,
|
|
724
|
-
...
|
|
725
|
-
method:
|
|
894
|
+
...v14.object({
|
|
895
|
+
method: v14.literal(stxTransferStxMethodName),
|
|
726
896
|
params: stxTransferStxParamsSchema,
|
|
727
|
-
id:
|
|
897
|
+
id: v14.string()
|
|
728
898
|
}).entries
|
|
729
899
|
});
|
|
730
900
|
|
|
731
901
|
// src/request/types/btcMethods.ts
|
|
732
|
-
var
|
|
733
|
-
|
|
734
|
-
// src/request/types/common.ts
|
|
735
|
-
var v13 = __toESM(require("valibot"));
|
|
736
|
-
var walletTypes = ["software", "ledger", "keystone"];
|
|
737
|
-
var walletTypeSchema = v13.picklist(walletTypes);
|
|
738
|
-
|
|
739
|
-
// src/request/types/btcMethods.ts
|
|
902
|
+
var v15 = __toESM(require("valibot"));
|
|
740
903
|
var getInfoMethodName = "getInfo";
|
|
741
|
-
var getInfoParamsSchema =
|
|
742
|
-
var getInfoResultSchema =
|
|
904
|
+
var getInfoParamsSchema = v15.nullish(v15.null());
|
|
905
|
+
var getInfoResultSchema = v15.object({
|
|
743
906
|
/**
|
|
744
907
|
* Version of the wallet.
|
|
745
908
|
*/
|
|
746
|
-
version:
|
|
909
|
+
version: v15.string(),
|
|
747
910
|
/**
|
|
748
911
|
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
749
912
|
*/
|
|
750
|
-
methods:
|
|
913
|
+
methods: v15.optional(v15.array(v15.string())),
|
|
751
914
|
/**
|
|
752
915
|
* List of WBIP standards supported by the wallet. Not currently used.
|
|
753
916
|
*/
|
|
754
|
-
supports:
|
|
917
|
+
supports: v15.array(v15.string())
|
|
755
918
|
});
|
|
756
|
-
var getInfoRequestMessageSchema =
|
|
919
|
+
var getInfoRequestMessageSchema = v15.object({
|
|
757
920
|
...rpcRequestMessageSchema.entries,
|
|
758
|
-
...
|
|
759
|
-
method:
|
|
921
|
+
...v15.object({
|
|
922
|
+
method: v15.literal(getInfoMethodName),
|
|
760
923
|
params: getInfoParamsSchema,
|
|
761
|
-
id:
|
|
924
|
+
id: v15.string()
|
|
762
925
|
}).entries
|
|
763
926
|
});
|
|
764
927
|
var getAddressesMethodName = "getAddresses";
|
|
765
|
-
var getAddressesParamsSchema =
|
|
928
|
+
var getAddressesParamsSchema = v15.object({
|
|
766
929
|
/**
|
|
767
930
|
* The purposes for which to generate addresses. See
|
|
768
931
|
* {@linkcode AddressPurpose} for available purposes.
|
|
769
932
|
*/
|
|
770
|
-
purposes:
|
|
933
|
+
purposes: v15.array(v15.enum(AddressPurpose)),
|
|
771
934
|
/**
|
|
772
935
|
* A message to be displayed to the user in the request prompt.
|
|
773
936
|
*/
|
|
774
|
-
message:
|
|
937
|
+
message: v15.optional(v15.string())
|
|
775
938
|
});
|
|
776
|
-
var getAddressesResultSchema =
|
|
939
|
+
var getAddressesResultSchema = v15.object({
|
|
777
940
|
/**
|
|
778
941
|
* The addresses generated for the given purposes.
|
|
779
942
|
*/
|
|
780
|
-
addresses:
|
|
943
|
+
addresses: v15.array(addressSchema),
|
|
944
|
+
network: getNetworkResultSchema
|
|
781
945
|
});
|
|
782
|
-
var getAddressesRequestMessageSchema =
|
|
946
|
+
var getAddressesRequestMessageSchema = v15.object({
|
|
783
947
|
...rpcRequestMessageSchema.entries,
|
|
784
|
-
...
|
|
785
|
-
method:
|
|
948
|
+
...v15.object({
|
|
949
|
+
method: v15.literal(getAddressesMethodName),
|
|
786
950
|
params: getAddressesParamsSchema,
|
|
787
|
-
id:
|
|
951
|
+
id: v15.string()
|
|
788
952
|
}).entries
|
|
789
953
|
});
|
|
790
954
|
var signMessageMethodName = "signMessage";
|
|
@@ -793,305 +957,162 @@ var MessageSigningProtocols = /* @__PURE__ */ ((MessageSigningProtocols2) => {
|
|
|
793
957
|
MessageSigningProtocols2["BIP322"] = "BIP322";
|
|
794
958
|
return MessageSigningProtocols2;
|
|
795
959
|
})(MessageSigningProtocols || {});
|
|
796
|
-
var signMessageParamsSchema =
|
|
960
|
+
var signMessageParamsSchema = v15.object({
|
|
797
961
|
/**
|
|
798
962
|
* The address used for signing.
|
|
799
963
|
**/
|
|
800
|
-
address:
|
|
964
|
+
address: v15.string(),
|
|
801
965
|
/**
|
|
802
966
|
* The message to sign.
|
|
803
967
|
**/
|
|
804
|
-
message:
|
|
968
|
+
message: v15.string(),
|
|
805
969
|
/**
|
|
806
970
|
* The protocol to use for signing the message.
|
|
807
971
|
*/
|
|
808
|
-
protocol:
|
|
972
|
+
protocol: v15.optional(v15.enum(MessageSigningProtocols))
|
|
809
973
|
});
|
|
810
|
-
var signMessageResultSchema =
|
|
974
|
+
var signMessageResultSchema = v15.object({
|
|
811
975
|
/**
|
|
812
976
|
* The signature of the message.
|
|
813
977
|
*/
|
|
814
|
-
signature:
|
|
978
|
+
signature: v15.string(),
|
|
815
979
|
/**
|
|
816
980
|
* hash of the message.
|
|
817
981
|
*/
|
|
818
|
-
messageHash:
|
|
982
|
+
messageHash: v15.string(),
|
|
819
983
|
/**
|
|
820
984
|
* The address used for signing.
|
|
821
985
|
*/
|
|
822
|
-
address:
|
|
986
|
+
address: v15.string(),
|
|
823
987
|
/**
|
|
824
988
|
* The protocol to use for signing the message.
|
|
825
989
|
*/
|
|
826
|
-
protocol:
|
|
990
|
+
protocol: v15.enum(MessageSigningProtocols)
|
|
827
991
|
});
|
|
828
|
-
var signMessageRequestMessageSchema =
|
|
992
|
+
var signMessageRequestMessageSchema = v15.object({
|
|
829
993
|
...rpcRequestMessageSchema.entries,
|
|
830
|
-
...
|
|
831
|
-
method:
|
|
994
|
+
...v15.object({
|
|
995
|
+
method: v15.literal(signMessageMethodName),
|
|
832
996
|
params: signMessageParamsSchema,
|
|
833
|
-
id:
|
|
997
|
+
id: v15.string()
|
|
834
998
|
}).entries
|
|
835
999
|
});
|
|
836
1000
|
var sendTransferMethodName = "sendTransfer";
|
|
837
|
-
var sendTransferParamsSchema =
|
|
1001
|
+
var sendTransferParamsSchema = v15.object({
|
|
838
1002
|
/**
|
|
839
1003
|
* Array of recipients to send to.
|
|
840
1004
|
* The amount to send to each recipient is in satoshis.
|
|
841
1005
|
*/
|
|
842
|
-
recipients:
|
|
843
|
-
|
|
844
|
-
address:
|
|
845
|
-
amount:
|
|
1006
|
+
recipients: v15.array(
|
|
1007
|
+
v15.object({
|
|
1008
|
+
address: v15.string(),
|
|
1009
|
+
amount: v15.number()
|
|
846
1010
|
})
|
|
847
1011
|
)
|
|
848
1012
|
});
|
|
849
|
-
var sendTransferResultSchema =
|
|
1013
|
+
var sendTransferResultSchema = v15.object({
|
|
850
1014
|
/**
|
|
851
1015
|
* The transaction id as a hex-encoded string.
|
|
852
1016
|
*/
|
|
853
|
-
txid:
|
|
1017
|
+
txid: v15.string()
|
|
854
1018
|
});
|
|
855
|
-
var sendTransferRequestMessageSchema =
|
|
1019
|
+
var sendTransferRequestMessageSchema = v15.object({
|
|
856
1020
|
...rpcRequestMessageSchema.entries,
|
|
857
|
-
...
|
|
858
|
-
method:
|
|
1021
|
+
...v15.object({
|
|
1022
|
+
method: v15.literal(sendTransferMethodName),
|
|
859
1023
|
params: sendTransferParamsSchema,
|
|
860
|
-
id:
|
|
1024
|
+
id: v15.string()
|
|
861
1025
|
}).entries
|
|
862
1026
|
});
|
|
863
1027
|
var signPsbtMethodName = "signPsbt";
|
|
864
|
-
var signPsbtParamsSchema =
|
|
1028
|
+
var signPsbtParamsSchema = v15.object({
|
|
865
1029
|
/**
|
|
866
1030
|
* The base64 encoded PSBT to sign.
|
|
867
1031
|
*/
|
|
868
|
-
psbt:
|
|
1032
|
+
psbt: v15.string(),
|
|
869
1033
|
/**
|
|
870
1034
|
* The inputs to sign.
|
|
871
1035
|
* The key is the address and the value is an array of indexes of the inputs to sign.
|
|
872
1036
|
*/
|
|
873
|
-
signInputs:
|
|
1037
|
+
signInputs: v15.record(v15.string(), v15.array(v15.number())),
|
|
874
1038
|
/**
|
|
875
1039
|
* Whether to broadcast the transaction after signing.
|
|
876
1040
|
**/
|
|
877
|
-
broadcast:
|
|
1041
|
+
broadcast: v15.optional(v15.boolean())
|
|
878
1042
|
});
|
|
879
|
-
var signPsbtResultSchema =
|
|
1043
|
+
var signPsbtResultSchema = v15.object({
|
|
880
1044
|
/**
|
|
881
1045
|
* The base64 encoded PSBT after signing.
|
|
882
1046
|
*/
|
|
883
|
-
psbt:
|
|
1047
|
+
psbt: v15.string(),
|
|
884
1048
|
/**
|
|
885
1049
|
* The transaction id as a hex-encoded string.
|
|
886
1050
|
* This is only returned if the transaction was broadcast.
|
|
887
1051
|
**/
|
|
888
|
-
txid:
|
|
1052
|
+
txid: v15.optional(v15.string())
|
|
889
1053
|
});
|
|
890
|
-
var signPsbtRequestMessageSchema =
|
|
1054
|
+
var signPsbtRequestMessageSchema = v15.object({
|
|
891
1055
|
...rpcRequestMessageSchema.entries,
|
|
892
|
-
...
|
|
893
|
-
method:
|
|
1056
|
+
...v15.object({
|
|
1057
|
+
method: v15.literal(signPsbtMethodName),
|
|
894
1058
|
params: signPsbtParamsSchema,
|
|
895
|
-
id:
|
|
1059
|
+
id: v15.string()
|
|
896
1060
|
}).entries
|
|
897
1061
|
});
|
|
898
1062
|
var getAccountsMethodName = "getAccounts";
|
|
899
|
-
var getAccountsParamsSchema =
|
|
1063
|
+
var getAccountsParamsSchema = v15.object({
|
|
900
1064
|
/**
|
|
901
1065
|
* The purposes for which to generate addresses. See
|
|
902
1066
|
* {@linkcode AddressPurpose} for available purposes.
|
|
903
1067
|
*/
|
|
904
|
-
purposes:
|
|
1068
|
+
purposes: v15.array(v15.enum(AddressPurpose)),
|
|
905
1069
|
/**
|
|
906
1070
|
* A message to be displayed to the user in the request prompt.
|
|
907
1071
|
*/
|
|
908
|
-
message:
|
|
1072
|
+
message: v15.optional(v15.string())
|
|
909
1073
|
});
|
|
910
|
-
var getAccountsResultSchema =
|
|
911
|
-
|
|
1074
|
+
var getAccountsResultSchema = v15.array(
|
|
1075
|
+
v15.object({
|
|
912
1076
|
...addressSchema.entries,
|
|
913
|
-
...
|
|
1077
|
+
...v15.object({
|
|
914
1078
|
walletType: walletTypeSchema
|
|
915
1079
|
}).entries
|
|
916
1080
|
})
|
|
917
1081
|
);
|
|
918
|
-
var getAccountsRequestMessageSchema =
|
|
1082
|
+
var getAccountsRequestMessageSchema = v15.object({
|
|
919
1083
|
...rpcRequestMessageSchema.entries,
|
|
920
|
-
...
|
|
921
|
-
method:
|
|
1084
|
+
...v15.object({
|
|
1085
|
+
method: v15.literal(getAccountsMethodName),
|
|
922
1086
|
params: getAccountsParamsSchema,
|
|
923
|
-
id:
|
|
1087
|
+
id: v15.string()
|
|
924
1088
|
}).entries
|
|
925
1089
|
});
|
|
926
1090
|
var getBalanceMethodName = "getBalance";
|
|
927
|
-
var getBalanceParamsSchema =
|
|
928
|
-
var getBalanceResultSchema =
|
|
1091
|
+
var getBalanceParamsSchema = v15.nullish(v15.null());
|
|
1092
|
+
var getBalanceResultSchema = v15.object({
|
|
929
1093
|
/**
|
|
930
1094
|
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
931
1095
|
* messages not supporting bigint
|
|
932
1096
|
* (https://issues.chromium.org/issues/40116184).
|
|
933
1097
|
*/
|
|
934
|
-
confirmed:
|
|
1098
|
+
confirmed: v15.string(),
|
|
935
1099
|
/**
|
|
936
1100
|
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
937
1101
|
* messages not supporting bigint
|
|
938
1102
|
* (https://issues.chromium.org/issues/40116184).
|
|
939
1103
|
*/
|
|
940
|
-
unconfirmed:
|
|
1104
|
+
unconfirmed: v15.string(),
|
|
941
1105
|
/**
|
|
942
1106
|
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
943
1107
|
* sats. Using a string due to chrome messages not supporting bigint
|
|
944
1108
|
* (https://issues.chromium.org/issues/40116184).
|
|
945
1109
|
*/
|
|
946
|
-
total:
|
|
947
|
-
});
|
|
948
|
-
var getBalanceRequestMessageSchema = v14.object({
|
|
949
|
-
...rpcRequestMessageSchema.entries,
|
|
950
|
-
...v14.object({
|
|
951
|
-
method: v14.literal(getBalanceMethodName),
|
|
952
|
-
id: v14.string()
|
|
953
|
-
}).entries
|
|
954
|
-
});
|
|
955
|
-
|
|
956
|
-
// src/request/types/walletMethods.ts
|
|
957
|
-
var v15 = __toESM(require("valibot"));
|
|
958
|
-
var accountActionsSchema = v15.object({
|
|
959
|
-
read: v15.optional(v15.boolean())
|
|
960
|
-
});
|
|
961
|
-
var walletActionsSchema = v15.object({
|
|
962
|
-
readNetwork: v15.optional(v15.boolean())
|
|
963
|
-
});
|
|
964
|
-
var accountPermissionSchema = v15.object({
|
|
965
|
-
type: v15.literal("account"),
|
|
966
|
-
resourceId: v15.string(),
|
|
967
|
-
clientId: v15.string(),
|
|
968
|
-
actions: accountActionsSchema
|
|
969
|
-
});
|
|
970
|
-
var walletPermissionSchema = v15.object({
|
|
971
|
-
type: v15.literal("wallet"),
|
|
972
|
-
resourceId: v15.string(),
|
|
973
|
-
clientId: v15.string(),
|
|
974
|
-
actions: walletActionsSchema
|
|
975
|
-
});
|
|
976
|
-
var PermissionRequestParams = v15.variant("type", [
|
|
977
|
-
v15.object({
|
|
978
|
-
...v15.omit(accountPermissionSchema, ["clientId"]).entries
|
|
979
|
-
}),
|
|
980
|
-
v15.object({
|
|
981
|
-
...v15.omit(walletPermissionSchema, ["clientId"]).entries
|
|
982
|
-
})
|
|
983
|
-
]);
|
|
984
|
-
var permission = v15.variant("type", [accountPermissionSchema, walletPermissionSchema]);
|
|
985
|
-
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
986
|
-
var requestPermissionsParamsSchema = v15.nullish(v15.array(PermissionRequestParams));
|
|
987
|
-
var requestPermissionsResultSchema = v15.literal(true);
|
|
988
|
-
var requestPermissionsRequestMessageSchema = v15.object({
|
|
989
|
-
...rpcRequestMessageSchema.entries,
|
|
990
|
-
...v15.object({
|
|
991
|
-
method: v15.literal(requestPermissionsMethodName),
|
|
992
|
-
params: requestPermissionsParamsSchema,
|
|
993
|
-
id: v15.string()
|
|
994
|
-
}).entries
|
|
995
|
-
});
|
|
996
|
-
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
997
|
-
var renouncePermissionsParamsSchema = v15.nullish(v15.null());
|
|
998
|
-
var renouncePermissionsResultSchema = v15.nullish(v15.null());
|
|
999
|
-
var renouncePermissionsRequestMessageSchema = v15.object({
|
|
1000
|
-
...rpcRequestMessageSchema.entries,
|
|
1001
|
-
...v15.object({
|
|
1002
|
-
method: v15.literal(renouncePermissionsMethodName),
|
|
1003
|
-
params: renouncePermissionsParamsSchema,
|
|
1004
|
-
id: v15.string()
|
|
1005
|
-
}).entries
|
|
1006
|
-
});
|
|
1007
|
-
var disconnectMethodName = "wallet_disconnect";
|
|
1008
|
-
var disconnectParamsSchema = v15.nullish(v15.null());
|
|
1009
|
-
var disconnectResultSchema = v15.nullish(v15.null());
|
|
1010
|
-
var disconnectRequestMessageSchema = v15.object({
|
|
1011
|
-
...rpcRequestMessageSchema.entries,
|
|
1012
|
-
...v15.object({
|
|
1013
|
-
method: v15.literal(disconnectMethodName),
|
|
1014
|
-
params: disconnectParamsSchema,
|
|
1015
|
-
id: v15.string()
|
|
1016
|
-
}).entries
|
|
1017
|
-
});
|
|
1018
|
-
var getWalletTypeMethodName = "wallet_getWalletType";
|
|
1019
|
-
var getWalletTypeParamsSchema = v15.nullish(v15.null());
|
|
1020
|
-
var getWalletTypeResultSchema = walletTypeSchema;
|
|
1021
|
-
var getWalletTypeRequestMessageSchema = v15.object({
|
|
1022
|
-
...rpcRequestMessageSchema.entries,
|
|
1023
|
-
...v15.object({
|
|
1024
|
-
method: v15.literal(getWalletTypeMethodName),
|
|
1025
|
-
params: getWalletTypeParamsSchema,
|
|
1026
|
-
id: v15.string()
|
|
1027
|
-
}).entries
|
|
1028
|
-
});
|
|
1029
|
-
var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
|
|
1030
|
-
var getCurrentPermissionsParamsSchema = v15.nullish(v15.null());
|
|
1031
|
-
var getCurrentPermissionsResultSchema = v15.array(permission);
|
|
1032
|
-
var getCurrentPermissionsRequestMessageSchema = v15.object({
|
|
1033
|
-
...rpcRequestMessageSchema.entries,
|
|
1034
|
-
...v15.object({
|
|
1035
|
-
method: v15.literal(getCurrentPermissionsMethodName),
|
|
1036
|
-
params: getCurrentPermissionsParamsSchema,
|
|
1037
|
-
id: v15.string()
|
|
1038
|
-
}).entries
|
|
1039
|
-
});
|
|
1040
|
-
var getAccountMethodName = "wallet_getAccount";
|
|
1041
|
-
var getAccountParamsSchema = v15.nullish(v15.null());
|
|
1042
|
-
var getAccountResultSchema = v15.object({
|
|
1043
|
-
id: v15.string(),
|
|
1044
|
-
addresses: v15.array(addressSchema),
|
|
1045
|
-
walletType: walletTypeSchema
|
|
1046
|
-
});
|
|
1047
|
-
var getAccountRequestMessageSchema = v15.object({
|
|
1048
|
-
...rpcRequestMessageSchema.entries,
|
|
1049
|
-
...v15.object({
|
|
1050
|
-
method: v15.literal(getAccountMethodName),
|
|
1051
|
-
params: getAccountParamsSchema,
|
|
1052
|
-
id: v15.string()
|
|
1053
|
-
}).entries
|
|
1054
|
-
});
|
|
1055
|
-
var getNetworkMethodName = "wallet_getNetwork";
|
|
1056
|
-
var getNetworkParamsSchema = v15.nullish(v15.null());
|
|
1057
|
-
var networkType2 = ["Mainnet", "Testnet", "Testnet4", "Signet", "Regtest"];
|
|
1058
|
-
var getNetworkResultSchema = v15.object({
|
|
1059
|
-
bitcoin: v15.object({
|
|
1060
|
-
name: v15.picklist(networkType2)
|
|
1061
|
-
}),
|
|
1062
|
-
stacks: v15.object({
|
|
1063
|
-
name: v15.string()
|
|
1064
|
-
})
|
|
1065
|
-
});
|
|
1066
|
-
var getNetworkRequestMessageSchema = v15.object({
|
|
1067
|
-
...rpcRequestMessageSchema.entries,
|
|
1068
|
-
...v15.object({
|
|
1069
|
-
method: v15.literal(getNetworkMethodName),
|
|
1070
|
-
params: getNetworkParamsSchema,
|
|
1071
|
-
id: v15.string()
|
|
1072
|
-
}).entries
|
|
1110
|
+
total: v15.string()
|
|
1073
1111
|
});
|
|
1074
|
-
var
|
|
1075
|
-
var connectParamsSchema = v15.nullish(
|
|
1076
|
-
v15.object({
|
|
1077
|
-
permissions: v15.optional(v15.array(PermissionRequestParams)),
|
|
1078
|
-
addresses: v15.optional(v15.array(v15.enum(AddressPurpose))),
|
|
1079
|
-
message: v15.optional(
|
|
1080
|
-
v15.pipe(v15.string(), v15.maxLength(80, "The message must not exceed 80 characters."))
|
|
1081
|
-
)
|
|
1082
|
-
})
|
|
1083
|
-
);
|
|
1084
|
-
var connectResultSchema = v15.object({
|
|
1085
|
-
id: v15.string(),
|
|
1086
|
-
addresses: v15.array(addressSchema),
|
|
1087
|
-
walletType: walletTypeSchema,
|
|
1088
|
-
network: getNetworkResultSchema
|
|
1089
|
-
});
|
|
1090
|
-
var connectRequestMessageSchema = v15.object({
|
|
1112
|
+
var getBalanceRequestMessageSchema = v15.object({
|
|
1091
1113
|
...rpcRequestMessageSchema.entries,
|
|
1092
1114
|
...v15.object({
|
|
1093
|
-
method: v15.literal(
|
|
1094
|
-
params: connectParamsSchema,
|
|
1115
|
+
method: v15.literal(getBalanceMethodName),
|
|
1095
1116
|
id: v15.string()
|
|
1096
1117
|
}).entries
|
|
1097
1118
|
});
|
|
@@ -2296,6 +2317,10 @@ var signMultipleTransactions = async (options) => {
|
|
|
2296
2317
|
accountPermissionSchema,
|
|
2297
2318
|
addListener,
|
|
2298
2319
|
addressSchema,
|
|
2320
|
+
changeNetworkMethodName,
|
|
2321
|
+
changeNetworkParamsSchema,
|
|
2322
|
+
changeNetworkRequestMessageSchema,
|
|
2323
|
+
changeNetworkResultSchema,
|
|
2299
2324
|
connectMethodName,
|
|
2300
2325
|
connectParamsSchema,
|
|
2301
2326
|
connectRequestMessageSchema,
|