@sats-connect/core 0.5.7-919d21a → 0.5.7-dfae3ce
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 +83 -41
- package/dist/index.d.ts +83 -41
- package/dist/index.js +414 -388
- package/dist/index.mjs +410 -388
- 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,369 @@ 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.nullish(
|
|
576
|
+
v7.object({
|
|
577
|
+
name: v7.enum(BitcoinNetworkType)
|
|
578
|
+
})
|
|
579
|
+
);
|
|
580
|
+
var changeNetworkResultSchema = v7.nullish(v7.null());
|
|
581
|
+
var changeNetworkRequestMessageSchema = v7.object({
|
|
582
|
+
...rpcRequestMessageSchema.entries,
|
|
583
|
+
...v7.object({
|
|
584
|
+
method: v7.literal(changeNetworkMethodName),
|
|
585
|
+
params: changeNetworkParamsSchema,
|
|
586
|
+
id: v7.string()
|
|
587
|
+
}).entries
|
|
588
|
+
});
|
|
589
|
+
var getAccountMethodName = "wallet_getAccount";
|
|
590
|
+
var getAccountParamsSchema = v7.nullish(v7.null());
|
|
591
|
+
var getAccountResultSchema = v7.object({
|
|
592
|
+
id: v7.string(),
|
|
593
|
+
addresses: v7.array(addressSchema),
|
|
594
|
+
walletType: walletTypeSchema,
|
|
595
|
+
network: getNetworkResultSchema
|
|
596
|
+
});
|
|
597
|
+
var getAccountRequestMessageSchema = v7.object({
|
|
598
|
+
...rpcRequestMessageSchema.entries,
|
|
599
|
+
...v7.object({
|
|
600
|
+
method: v7.literal(getAccountMethodName),
|
|
601
|
+
params: getAccountParamsSchema,
|
|
602
|
+
id: v7.string()
|
|
603
|
+
}).entries
|
|
604
|
+
});
|
|
605
|
+
var connectMethodName = "wallet_connect";
|
|
606
|
+
var connectParamsSchema = v7.nullish(
|
|
607
|
+
v7.object({
|
|
608
|
+
permissions: v7.optional(v7.array(PermissionRequestParams)),
|
|
609
|
+
addresses: v7.optional(v7.array(v7.enum(AddressPurpose))),
|
|
610
|
+
message: v7.optional(
|
|
611
|
+
v7.pipe(v7.string(), v7.maxLength(80, "The message must not exceed 80 characters."))
|
|
612
|
+
)
|
|
613
|
+
})
|
|
614
|
+
);
|
|
615
|
+
var connectResultSchema = v7.object({
|
|
616
|
+
id: v7.string(),
|
|
617
|
+
addresses: v7.array(addressSchema),
|
|
618
|
+
walletType: walletTypeSchema,
|
|
619
|
+
network: getNetworkResultSchema
|
|
620
|
+
});
|
|
621
|
+
var connectRequestMessageSchema = v7.object({
|
|
622
|
+
...rpcRequestMessageSchema.entries,
|
|
623
|
+
...v7.object({
|
|
624
|
+
method: v7.literal(connectMethodName),
|
|
625
|
+
params: connectParamsSchema,
|
|
626
|
+
id: v7.string()
|
|
627
|
+
}).entries
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
// src/request/types/stxMethods/getAccounts.ts
|
|
631
|
+
var stxGetAccountsMethodName = "stx_getAccounts";
|
|
632
|
+
var stxGetAccountsParamsSchema = v8.nullish(v8.null());
|
|
633
|
+
var stxGetAccountsResultSchema = v8.object({
|
|
634
|
+
/**
|
|
635
|
+
* The addresses generated for the given purposes.
|
|
636
|
+
*/
|
|
637
|
+
addresses: v8.array(
|
|
638
|
+
v8.object({
|
|
639
|
+
address: v8.string(),
|
|
640
|
+
publicKey: v8.string(),
|
|
641
|
+
gaiaHubUrl: v8.string(),
|
|
642
|
+
gaiaAppKey: v8.string()
|
|
643
|
+
})
|
|
644
|
+
),
|
|
645
|
+
network: getNetworkResultSchema
|
|
646
|
+
});
|
|
647
|
+
var stxGetAccountsRequestMessageSchema = v8.object({
|
|
648
|
+
...rpcRequestMessageSchema.entries,
|
|
649
|
+
...v8.object({
|
|
650
|
+
method: v8.literal(stxGetAccountsMethodName),
|
|
651
|
+
params: stxGetAccountsParamsSchema,
|
|
652
|
+
id: v8.string()
|
|
653
|
+
}).entries
|
|
654
|
+
});
|
|
655
|
+
|
|
485
656
|
// src/request/types/stxMethods/getAddresses.ts
|
|
486
|
-
var
|
|
657
|
+
var v9 = __toESM(require("valibot"));
|
|
487
658
|
var stxGetAddressesMethodName = "stx_getAddresses";
|
|
488
|
-
var stxGetAddressesParamsSchema =
|
|
489
|
-
|
|
659
|
+
var stxGetAddressesParamsSchema = v9.nullish(
|
|
660
|
+
v9.object({
|
|
490
661
|
/**
|
|
491
662
|
* A message to be displayed to the user in the request prompt.
|
|
492
663
|
*/
|
|
493
|
-
message:
|
|
664
|
+
message: v9.optional(v9.string())
|
|
494
665
|
})
|
|
495
666
|
);
|
|
496
|
-
var stxGetAddressesResultSchema =
|
|
667
|
+
var stxGetAddressesResultSchema = v9.object({
|
|
497
668
|
/**
|
|
498
669
|
* The addresses generated for the given purposes.
|
|
499
670
|
*/
|
|
500
|
-
addresses:
|
|
671
|
+
addresses: v9.array(addressSchema),
|
|
672
|
+
network: getNetworkResultSchema
|
|
501
673
|
});
|
|
502
|
-
var stxGetAddressesRequestMessageSchema =
|
|
674
|
+
var stxGetAddressesRequestMessageSchema = v9.object({
|
|
503
675
|
...rpcRequestMessageSchema.entries,
|
|
504
|
-
...
|
|
505
|
-
method:
|
|
676
|
+
...v9.object({
|
|
677
|
+
method: v9.literal(stxGetAddressesMethodName),
|
|
506
678
|
params: stxGetAddressesParamsSchema,
|
|
507
|
-
id:
|
|
679
|
+
id: v9.string()
|
|
508
680
|
}).entries
|
|
509
681
|
});
|
|
510
682
|
|
|
511
683
|
// src/request/types/stxMethods/signMessage.ts
|
|
512
|
-
var
|
|
684
|
+
var v10 = __toESM(require("valibot"));
|
|
513
685
|
var stxSignMessageMethodName = "stx_signMessage";
|
|
514
|
-
var stxSignMessageParamsSchema =
|
|
686
|
+
var stxSignMessageParamsSchema = v10.object({
|
|
515
687
|
/**
|
|
516
688
|
* The message to sign.
|
|
517
689
|
*/
|
|
518
|
-
message:
|
|
690
|
+
message: v10.string(),
|
|
519
691
|
/**
|
|
520
692
|
* The public key to sign the message with.
|
|
521
693
|
*/
|
|
522
|
-
publicKey:
|
|
694
|
+
publicKey: v10.string(),
|
|
523
695
|
/**
|
|
524
696
|
* The format version of the parameter.
|
|
525
697
|
*/
|
|
526
|
-
parameterFormatVersion:
|
|
698
|
+
parameterFormatVersion: v10.optional(v10.number())
|
|
527
699
|
});
|
|
528
|
-
var stxSignMessageResultSchema =
|
|
700
|
+
var stxSignMessageResultSchema = v10.object({
|
|
529
701
|
/**
|
|
530
702
|
* The signature of the message.
|
|
531
703
|
*/
|
|
532
|
-
signature:
|
|
704
|
+
signature: v10.string(),
|
|
533
705
|
/**
|
|
534
706
|
* The public key used to sign the message.
|
|
535
707
|
*/
|
|
536
|
-
publicKey:
|
|
708
|
+
publicKey: v10.string()
|
|
537
709
|
});
|
|
538
|
-
var stxSignMessageRequestMessageSchema =
|
|
710
|
+
var stxSignMessageRequestMessageSchema = v10.object({
|
|
539
711
|
...rpcRequestMessageSchema.entries,
|
|
540
|
-
...
|
|
541
|
-
method:
|
|
712
|
+
...v10.object({
|
|
713
|
+
method: v10.literal(stxSignMessageMethodName),
|
|
542
714
|
params: stxSignMessageParamsSchema,
|
|
543
|
-
id:
|
|
715
|
+
id: v10.string()
|
|
544
716
|
}).entries
|
|
545
717
|
});
|
|
546
718
|
|
|
547
719
|
// src/request/types/stxMethods/signStructuredMessage.ts
|
|
548
|
-
var
|
|
720
|
+
var v11 = __toESM(require("valibot"));
|
|
549
721
|
var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
|
|
550
|
-
var stxSignStructuredMessageParamsSchema =
|
|
722
|
+
var stxSignStructuredMessageParamsSchema = v11.object({
|
|
551
723
|
/**
|
|
552
724
|
* The domain to be signed.
|
|
553
725
|
*/
|
|
554
|
-
domain:
|
|
726
|
+
domain: v11.string(),
|
|
555
727
|
/**
|
|
556
728
|
* Message payload to be signed.
|
|
557
729
|
*/
|
|
558
|
-
message:
|
|
730
|
+
message: v11.string(),
|
|
559
731
|
/**
|
|
560
732
|
* The format version of the parameter.
|
|
561
733
|
*/
|
|
562
|
-
parameterFormatVersion:
|
|
734
|
+
parameterFormatVersion: v11.optional(v11.number()),
|
|
563
735
|
/**
|
|
564
736
|
* The public key to sign the message with.
|
|
565
737
|
*/
|
|
566
|
-
publicKey:
|
|
738
|
+
publicKey: v11.optional(v11.string())
|
|
567
739
|
});
|
|
568
|
-
var stxSignStructuredMessageResultSchema =
|
|
740
|
+
var stxSignStructuredMessageResultSchema = v11.object({
|
|
569
741
|
/**
|
|
570
742
|
* Signature of the message.
|
|
571
743
|
*/
|
|
572
|
-
signature:
|
|
744
|
+
signature: v11.string(),
|
|
573
745
|
/**
|
|
574
746
|
* Public key as hex-encoded string.
|
|
575
747
|
*/
|
|
576
|
-
publicKey:
|
|
748
|
+
publicKey: v11.string()
|
|
577
749
|
});
|
|
578
|
-
var stxSignStructuredMessageRequestMessageSchema =
|
|
750
|
+
var stxSignStructuredMessageRequestMessageSchema = v11.object({
|
|
579
751
|
...rpcRequestMessageSchema.entries,
|
|
580
|
-
...
|
|
581
|
-
method:
|
|
752
|
+
...v11.object({
|
|
753
|
+
method: v11.literal(stxSignStructuredMessageMethodName),
|
|
582
754
|
params: stxSignStructuredMessageParamsSchema,
|
|
583
|
-
id:
|
|
755
|
+
id: v11.string()
|
|
584
756
|
}).entries
|
|
585
757
|
});
|
|
586
758
|
|
|
587
759
|
// src/request/types/stxMethods/signTransaction.ts
|
|
588
|
-
var
|
|
760
|
+
var v12 = __toESM(require("valibot"));
|
|
589
761
|
var stxSignTransactionMethodName = "stx_signTransaction";
|
|
590
|
-
var stxSignTransactionParamsSchema =
|
|
762
|
+
var stxSignTransactionParamsSchema = v12.object({
|
|
591
763
|
/**
|
|
592
764
|
* The transaction to sign as a hex-encoded string.
|
|
593
765
|
*/
|
|
594
|
-
transaction:
|
|
766
|
+
transaction: v12.string(),
|
|
595
767
|
/**
|
|
596
768
|
* The public key to sign the transaction with. The wallet may use any key
|
|
597
769
|
* when not provided.
|
|
598
770
|
*/
|
|
599
|
-
pubkey:
|
|
771
|
+
pubkey: v12.optional(v12.string()),
|
|
600
772
|
/**
|
|
601
773
|
* Whether to broadcast the transaction after signing. Defaults to `true`.
|
|
602
774
|
*/
|
|
603
|
-
broadcast:
|
|
775
|
+
broadcast: v12.optional(v12.boolean())
|
|
604
776
|
});
|
|
605
|
-
var stxSignTransactionResultSchema =
|
|
777
|
+
var stxSignTransactionResultSchema = v12.object({
|
|
606
778
|
/**
|
|
607
779
|
* The signed transaction as a hex-encoded string.
|
|
608
780
|
*/
|
|
609
|
-
transaction:
|
|
781
|
+
transaction: v12.string()
|
|
610
782
|
});
|
|
611
|
-
var stxSignTransactionRequestMessageSchema =
|
|
783
|
+
var stxSignTransactionRequestMessageSchema = v12.object({
|
|
612
784
|
...rpcRequestMessageSchema.entries,
|
|
613
|
-
...
|
|
614
|
-
method:
|
|
785
|
+
...v12.object({
|
|
786
|
+
method: v12.literal(stxSignTransactionMethodName),
|
|
615
787
|
params: stxSignTransactionParamsSchema,
|
|
616
|
-
id:
|
|
788
|
+
id: v12.string()
|
|
617
789
|
}).entries
|
|
618
790
|
});
|
|
619
791
|
|
|
620
792
|
// src/request/types/stxMethods/signTransactions.ts
|
|
621
|
-
var
|
|
793
|
+
var v13 = __toESM(require("valibot"));
|
|
622
794
|
var stxSignTransactionsMethodName = "stx_signTransactions";
|
|
623
|
-
var stxSignTransactionsParamsSchema =
|
|
795
|
+
var stxSignTransactionsParamsSchema = v13.object({
|
|
624
796
|
/**
|
|
625
797
|
* The transactions to sign as hex-encoded strings.
|
|
626
798
|
*/
|
|
627
|
-
transactions:
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
799
|
+
transactions: v13.pipe(
|
|
800
|
+
v13.array(
|
|
801
|
+
v13.pipe(
|
|
802
|
+
v13.string(),
|
|
803
|
+
v13.check((hex) => {
|
|
632
804
|
return true;
|
|
633
805
|
}, "Invalid hex-encoded Stacks transaction.")
|
|
634
806
|
)
|
|
635
807
|
),
|
|
636
|
-
|
|
808
|
+
v13.minLength(1)
|
|
637
809
|
),
|
|
638
810
|
/**
|
|
639
811
|
* Whether the signed transactions should be broadcast after signing. Defaults
|
|
640
812
|
* to `true`.
|
|
641
813
|
*/
|
|
642
|
-
broadcast:
|
|
814
|
+
broadcast: v13.optional(v13.boolean())
|
|
643
815
|
});
|
|
644
|
-
var stxSignTransactionsResultSchema =
|
|
816
|
+
var stxSignTransactionsResultSchema = v13.object({
|
|
645
817
|
/**
|
|
646
818
|
* The signed transactions as hex-encoded strings, in the same order as in the
|
|
647
819
|
* sign request.
|
|
648
820
|
*/
|
|
649
|
-
transactions:
|
|
821
|
+
transactions: v13.array(v13.string())
|
|
650
822
|
});
|
|
651
|
-
var stxSignTransactionsRequestMessageSchema =
|
|
823
|
+
var stxSignTransactionsRequestMessageSchema = v13.object({
|
|
652
824
|
...rpcRequestMessageSchema.entries,
|
|
653
|
-
...
|
|
654
|
-
method:
|
|
825
|
+
...v13.object({
|
|
826
|
+
method: v13.literal(stxSignTransactionsMethodName),
|
|
655
827
|
params: stxSignTransactionsParamsSchema,
|
|
656
|
-
id:
|
|
828
|
+
id: v13.string()
|
|
657
829
|
}).entries
|
|
658
830
|
});
|
|
659
831
|
|
|
660
832
|
// src/request/types/stxMethods/transferStx.ts
|
|
661
|
-
var
|
|
833
|
+
var v14 = __toESM(require("valibot"));
|
|
662
834
|
var stxTransferStxMethodName = "stx_transferStx";
|
|
663
|
-
var stxTransferStxParamsSchema =
|
|
835
|
+
var stxTransferStxParamsSchema = v14.object({
|
|
664
836
|
/**
|
|
665
837
|
* Amount of STX tokens to transfer in microstacks as a string. Anything
|
|
666
838
|
* parseable by `BigInt` is acceptable.
|
|
@@ -673,23 +845,23 @@ var stxTransferStxParamsSchema = v12.object({
|
|
|
673
845
|
* const amount3 = '1234';
|
|
674
846
|
* ```
|
|
675
847
|
*/
|
|
676
|
-
amount:
|
|
848
|
+
amount: v14.union([v14.number(), v14.string()]),
|
|
677
849
|
/**
|
|
678
850
|
* The recipeint's principal.
|
|
679
851
|
*/
|
|
680
|
-
recipient:
|
|
852
|
+
recipient: v14.string(),
|
|
681
853
|
/**
|
|
682
854
|
* A string representing the memo.
|
|
683
855
|
*/
|
|
684
|
-
memo:
|
|
856
|
+
memo: v14.optional(v14.string()),
|
|
685
857
|
/**
|
|
686
858
|
* Version of parameter format.
|
|
687
859
|
*/
|
|
688
|
-
version:
|
|
860
|
+
version: v14.optional(v14.string()),
|
|
689
861
|
/**
|
|
690
862
|
* The mode of the post conditions.
|
|
691
863
|
*/
|
|
692
|
-
postConditionMode:
|
|
864
|
+
postConditionMode: v14.optional(v14.number()),
|
|
693
865
|
/**
|
|
694
866
|
* A hex-encoded string representing the post conditions.
|
|
695
867
|
*
|
|
@@ -702,89 +874,83 @@ var stxTransferStxParamsSchema = v12.object({
|
|
|
702
874
|
* const hexPostCondition = serializePostCondition(postCondition).toString('hex');
|
|
703
875
|
* ```
|
|
704
876
|
*/
|
|
705
|
-
postConditions:
|
|
877
|
+
postConditions: v14.optional(v14.array(v14.string())),
|
|
706
878
|
/**
|
|
707
879
|
* The public key to sign the transaction with. The wallet may use any key
|
|
708
880
|
* when not provided.
|
|
709
881
|
*/
|
|
710
|
-
pubkey:
|
|
882
|
+
pubkey: v14.optional(v14.string())
|
|
711
883
|
});
|
|
712
|
-
var stxTransferStxResultSchema =
|
|
884
|
+
var stxTransferStxResultSchema = v14.object({
|
|
713
885
|
/**
|
|
714
886
|
* The ID of the transaction.
|
|
715
887
|
*/
|
|
716
|
-
txid:
|
|
888
|
+
txid: v14.string(),
|
|
717
889
|
/**
|
|
718
890
|
* A Stacks transaction as a hex-encoded string.
|
|
719
891
|
*/
|
|
720
|
-
transaction:
|
|
892
|
+
transaction: v14.string()
|
|
721
893
|
});
|
|
722
|
-
var stxTransferStxRequestMessageSchema =
|
|
894
|
+
var stxTransferStxRequestMessageSchema = v14.object({
|
|
723
895
|
...rpcRequestMessageSchema.entries,
|
|
724
|
-
...
|
|
725
|
-
method:
|
|
896
|
+
...v14.object({
|
|
897
|
+
method: v14.literal(stxTransferStxMethodName),
|
|
726
898
|
params: stxTransferStxParamsSchema,
|
|
727
|
-
id:
|
|
899
|
+
id: v14.string()
|
|
728
900
|
}).entries
|
|
729
901
|
});
|
|
730
902
|
|
|
731
903
|
// 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
|
|
904
|
+
var v15 = __toESM(require("valibot"));
|
|
740
905
|
var getInfoMethodName = "getInfo";
|
|
741
|
-
var getInfoParamsSchema =
|
|
742
|
-
var getInfoResultSchema =
|
|
906
|
+
var getInfoParamsSchema = v15.nullish(v15.null());
|
|
907
|
+
var getInfoResultSchema = v15.object({
|
|
743
908
|
/**
|
|
744
909
|
* Version of the wallet.
|
|
745
910
|
*/
|
|
746
|
-
version:
|
|
911
|
+
version: v15.string(),
|
|
747
912
|
/**
|
|
748
913
|
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
749
914
|
*/
|
|
750
|
-
methods:
|
|
915
|
+
methods: v15.optional(v15.array(v15.string())),
|
|
751
916
|
/**
|
|
752
917
|
* List of WBIP standards supported by the wallet. Not currently used.
|
|
753
918
|
*/
|
|
754
|
-
supports:
|
|
919
|
+
supports: v15.array(v15.string())
|
|
755
920
|
});
|
|
756
|
-
var getInfoRequestMessageSchema =
|
|
921
|
+
var getInfoRequestMessageSchema = v15.object({
|
|
757
922
|
...rpcRequestMessageSchema.entries,
|
|
758
|
-
...
|
|
759
|
-
method:
|
|
923
|
+
...v15.object({
|
|
924
|
+
method: v15.literal(getInfoMethodName),
|
|
760
925
|
params: getInfoParamsSchema,
|
|
761
|
-
id:
|
|
926
|
+
id: v15.string()
|
|
762
927
|
}).entries
|
|
763
928
|
});
|
|
764
929
|
var getAddressesMethodName = "getAddresses";
|
|
765
|
-
var getAddressesParamsSchema =
|
|
930
|
+
var getAddressesParamsSchema = v15.object({
|
|
766
931
|
/**
|
|
767
932
|
* The purposes for which to generate addresses. See
|
|
768
933
|
* {@linkcode AddressPurpose} for available purposes.
|
|
769
934
|
*/
|
|
770
|
-
purposes:
|
|
935
|
+
purposes: v15.array(v15.enum(AddressPurpose)),
|
|
771
936
|
/**
|
|
772
937
|
* A message to be displayed to the user in the request prompt.
|
|
773
938
|
*/
|
|
774
|
-
message:
|
|
939
|
+
message: v15.optional(v15.string())
|
|
775
940
|
});
|
|
776
|
-
var getAddressesResultSchema =
|
|
941
|
+
var getAddressesResultSchema = v15.object({
|
|
777
942
|
/**
|
|
778
943
|
* The addresses generated for the given purposes.
|
|
779
944
|
*/
|
|
780
|
-
addresses:
|
|
945
|
+
addresses: v15.array(addressSchema),
|
|
946
|
+
network: getNetworkResultSchema
|
|
781
947
|
});
|
|
782
|
-
var getAddressesRequestMessageSchema =
|
|
948
|
+
var getAddressesRequestMessageSchema = v15.object({
|
|
783
949
|
...rpcRequestMessageSchema.entries,
|
|
784
|
-
...
|
|
785
|
-
method:
|
|
950
|
+
...v15.object({
|
|
951
|
+
method: v15.literal(getAddressesMethodName),
|
|
786
952
|
params: getAddressesParamsSchema,
|
|
787
|
-
id:
|
|
953
|
+
id: v15.string()
|
|
788
954
|
}).entries
|
|
789
955
|
});
|
|
790
956
|
var signMessageMethodName = "signMessage";
|
|
@@ -793,306 +959,162 @@ var MessageSigningProtocols = /* @__PURE__ */ ((MessageSigningProtocols2) => {
|
|
|
793
959
|
MessageSigningProtocols2["BIP322"] = "BIP322";
|
|
794
960
|
return MessageSigningProtocols2;
|
|
795
961
|
})(MessageSigningProtocols || {});
|
|
796
|
-
var signMessageParamsSchema =
|
|
962
|
+
var signMessageParamsSchema = v15.object({
|
|
797
963
|
/**
|
|
798
964
|
* The address used for signing.
|
|
799
965
|
**/
|
|
800
|
-
address:
|
|
966
|
+
address: v15.string(),
|
|
801
967
|
/**
|
|
802
968
|
* The message to sign.
|
|
803
969
|
**/
|
|
804
|
-
message:
|
|
970
|
+
message: v15.string(),
|
|
805
971
|
/**
|
|
806
972
|
* The protocol to use for signing the message.
|
|
807
973
|
*/
|
|
808
|
-
protocol:
|
|
974
|
+
protocol: v15.optional(v15.enum(MessageSigningProtocols))
|
|
809
975
|
});
|
|
810
|
-
var signMessageResultSchema =
|
|
976
|
+
var signMessageResultSchema = v15.object({
|
|
811
977
|
/**
|
|
812
978
|
* The signature of the message.
|
|
813
979
|
*/
|
|
814
|
-
signature:
|
|
980
|
+
signature: v15.string(),
|
|
815
981
|
/**
|
|
816
982
|
* hash of the message.
|
|
817
983
|
*/
|
|
818
|
-
messageHash:
|
|
984
|
+
messageHash: v15.string(),
|
|
819
985
|
/**
|
|
820
986
|
* The address used for signing.
|
|
821
987
|
*/
|
|
822
|
-
address:
|
|
988
|
+
address: v15.string(),
|
|
823
989
|
/**
|
|
824
990
|
* The protocol to use for signing the message.
|
|
825
991
|
*/
|
|
826
|
-
protocol:
|
|
992
|
+
protocol: v15.enum(MessageSigningProtocols)
|
|
827
993
|
});
|
|
828
|
-
var signMessageRequestMessageSchema =
|
|
994
|
+
var signMessageRequestMessageSchema = v15.object({
|
|
829
995
|
...rpcRequestMessageSchema.entries,
|
|
830
|
-
...
|
|
831
|
-
method:
|
|
996
|
+
...v15.object({
|
|
997
|
+
method: v15.literal(signMessageMethodName),
|
|
832
998
|
params: signMessageParamsSchema,
|
|
833
|
-
id:
|
|
999
|
+
id: v15.string()
|
|
834
1000
|
}).entries
|
|
835
1001
|
});
|
|
836
1002
|
var sendTransferMethodName = "sendTransfer";
|
|
837
|
-
var sendTransferParamsSchema =
|
|
1003
|
+
var sendTransferParamsSchema = v15.object({
|
|
838
1004
|
/**
|
|
839
1005
|
* Array of recipients to send to.
|
|
840
1006
|
* The amount to send to each recipient is in satoshis.
|
|
841
1007
|
*/
|
|
842
|
-
recipients:
|
|
843
|
-
|
|
844
|
-
address:
|
|
845
|
-
amount:
|
|
1008
|
+
recipients: v15.array(
|
|
1009
|
+
v15.object({
|
|
1010
|
+
address: v15.string(),
|
|
1011
|
+
amount: v15.number()
|
|
846
1012
|
})
|
|
847
1013
|
)
|
|
848
1014
|
});
|
|
849
|
-
var sendTransferResultSchema =
|
|
1015
|
+
var sendTransferResultSchema = v15.object({
|
|
850
1016
|
/**
|
|
851
1017
|
* The transaction id as a hex-encoded string.
|
|
852
1018
|
*/
|
|
853
|
-
txid:
|
|
1019
|
+
txid: v15.string()
|
|
854
1020
|
});
|
|
855
|
-
var sendTransferRequestMessageSchema =
|
|
1021
|
+
var sendTransferRequestMessageSchema = v15.object({
|
|
856
1022
|
...rpcRequestMessageSchema.entries,
|
|
857
|
-
...
|
|
858
|
-
method:
|
|
1023
|
+
...v15.object({
|
|
1024
|
+
method: v15.literal(sendTransferMethodName),
|
|
859
1025
|
params: sendTransferParamsSchema,
|
|
860
|
-
id:
|
|
1026
|
+
id: v15.string()
|
|
861
1027
|
}).entries
|
|
862
1028
|
});
|
|
863
1029
|
var signPsbtMethodName = "signPsbt";
|
|
864
|
-
var signPsbtParamsSchema =
|
|
1030
|
+
var signPsbtParamsSchema = v15.object({
|
|
865
1031
|
/**
|
|
866
1032
|
* The base64 encoded PSBT to sign.
|
|
867
1033
|
*/
|
|
868
|
-
psbt:
|
|
1034
|
+
psbt: v15.string(),
|
|
869
1035
|
/**
|
|
870
1036
|
* The inputs to sign.
|
|
871
1037
|
* The key is the address and the value is an array of indexes of the inputs to sign.
|
|
872
1038
|
*/
|
|
873
|
-
signInputs:
|
|
1039
|
+
signInputs: v15.record(v15.string(), v15.array(v15.number())),
|
|
874
1040
|
/**
|
|
875
1041
|
* Whether to broadcast the transaction after signing.
|
|
876
1042
|
**/
|
|
877
|
-
broadcast:
|
|
1043
|
+
broadcast: v15.optional(v15.boolean())
|
|
878
1044
|
});
|
|
879
|
-
var signPsbtResultSchema =
|
|
1045
|
+
var signPsbtResultSchema = v15.object({
|
|
880
1046
|
/**
|
|
881
1047
|
* The base64 encoded PSBT after signing.
|
|
882
1048
|
*/
|
|
883
|
-
psbt:
|
|
1049
|
+
psbt: v15.string(),
|
|
884
1050
|
/**
|
|
885
1051
|
* The transaction id as a hex-encoded string.
|
|
886
1052
|
* This is only returned if the transaction was broadcast.
|
|
887
1053
|
**/
|
|
888
|
-
txid:
|
|
1054
|
+
txid: v15.optional(v15.string())
|
|
889
1055
|
});
|
|
890
|
-
var signPsbtRequestMessageSchema =
|
|
1056
|
+
var signPsbtRequestMessageSchema = v15.object({
|
|
891
1057
|
...rpcRequestMessageSchema.entries,
|
|
892
|
-
...
|
|
893
|
-
method:
|
|
1058
|
+
...v15.object({
|
|
1059
|
+
method: v15.literal(signPsbtMethodName),
|
|
894
1060
|
params: signPsbtParamsSchema,
|
|
895
|
-
id:
|
|
1061
|
+
id: v15.string()
|
|
896
1062
|
}).entries
|
|
897
1063
|
});
|
|
898
1064
|
var getAccountsMethodName = "getAccounts";
|
|
899
|
-
var getAccountsParamsSchema =
|
|
1065
|
+
var getAccountsParamsSchema = v15.object({
|
|
900
1066
|
/**
|
|
901
1067
|
* The purposes for which to generate addresses. See
|
|
902
1068
|
* {@linkcode AddressPurpose} for available purposes.
|
|
903
1069
|
*/
|
|
904
|
-
purposes:
|
|
1070
|
+
purposes: v15.array(v15.enum(AddressPurpose)),
|
|
905
1071
|
/**
|
|
906
1072
|
* A message to be displayed to the user in the request prompt.
|
|
907
1073
|
*/
|
|
908
|
-
message:
|
|
1074
|
+
message: v15.optional(v15.string())
|
|
909
1075
|
});
|
|
910
|
-
var getAccountsResultSchema =
|
|
911
|
-
|
|
1076
|
+
var getAccountsResultSchema = v15.array(
|
|
1077
|
+
v15.object({
|
|
912
1078
|
...addressSchema.entries,
|
|
913
|
-
...
|
|
1079
|
+
...v15.object({
|
|
914
1080
|
walletType: walletTypeSchema
|
|
915
1081
|
}).entries
|
|
916
1082
|
})
|
|
917
1083
|
);
|
|
918
|
-
var getAccountsRequestMessageSchema =
|
|
1084
|
+
var getAccountsRequestMessageSchema = v15.object({
|
|
919
1085
|
...rpcRequestMessageSchema.entries,
|
|
920
|
-
...
|
|
921
|
-
method:
|
|
1086
|
+
...v15.object({
|
|
1087
|
+
method: v15.literal(getAccountsMethodName),
|
|
922
1088
|
params: getAccountsParamsSchema,
|
|
923
|
-
id:
|
|
1089
|
+
id: v15.string()
|
|
924
1090
|
}).entries
|
|
925
1091
|
});
|
|
926
1092
|
var getBalanceMethodName = "getBalance";
|
|
927
|
-
var getBalanceParamsSchema =
|
|
928
|
-
var getBalanceResultSchema =
|
|
1093
|
+
var getBalanceParamsSchema = v15.nullish(v15.null());
|
|
1094
|
+
var getBalanceResultSchema = v15.object({
|
|
929
1095
|
/**
|
|
930
1096
|
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
931
1097
|
* messages not supporting bigint
|
|
932
1098
|
* (https://issues.chromium.org/issues/40116184).
|
|
933
1099
|
*/
|
|
934
|
-
confirmed:
|
|
1100
|
+
confirmed: v15.string(),
|
|
935
1101
|
/**
|
|
936
1102
|
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
937
1103
|
* messages not supporting bigint
|
|
938
1104
|
* (https://issues.chromium.org/issues/40116184).
|
|
939
1105
|
*/
|
|
940
|
-
unconfirmed:
|
|
1106
|
+
unconfirmed: v15.string(),
|
|
941
1107
|
/**
|
|
942
1108
|
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
943
1109
|
* sats. Using a string due to chrome messages not supporting bigint
|
|
944
1110
|
* (https://issues.chromium.org/issues/40116184).
|
|
945
1111
|
*/
|
|
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())
|
|
1112
|
+
total: v15.string()
|
|
960
1113
|
});
|
|
961
|
-
var
|
|
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({
|
|
1114
|
+
var getBalanceRequestMessageSchema = v15.object({
|
|
1022
1115
|
...rpcRequestMessageSchema.entries,
|
|
1023
1116
|
...v15.object({
|
|
1024
|
-
method: v15.literal(
|
|
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 getNetworkMethodName = "wallet_getNetwork";
|
|
1041
|
-
var getNetworkParamsSchema = v15.nullish(v15.null());
|
|
1042
|
-
var networkType2 = ["Mainnet", "Testnet", "Testnet4", "Signet", "Regtest"];
|
|
1043
|
-
var getNetworkResultSchema = v15.object({
|
|
1044
|
-
bitcoin: v15.object({
|
|
1045
|
-
name: v15.picklist(networkType2)
|
|
1046
|
-
}),
|
|
1047
|
-
stacks: v15.object({
|
|
1048
|
-
name: v15.string()
|
|
1049
|
-
})
|
|
1050
|
-
});
|
|
1051
|
-
var getNetworkRequestMessageSchema = v15.object({
|
|
1052
|
-
...rpcRequestMessageSchema.entries,
|
|
1053
|
-
...v15.object({
|
|
1054
|
-
method: v15.literal(getNetworkMethodName),
|
|
1055
|
-
params: getNetworkParamsSchema,
|
|
1056
|
-
id: v15.string()
|
|
1057
|
-
}).entries
|
|
1058
|
-
});
|
|
1059
|
-
var getAccountMethodName = "wallet_getAccount";
|
|
1060
|
-
var getAccountParamsSchema = v15.nullish(v15.null());
|
|
1061
|
-
var getAccountResultSchema = v15.object({
|
|
1062
|
-
id: v15.string(),
|
|
1063
|
-
addresses: v15.array(addressSchema),
|
|
1064
|
-
walletType: walletTypeSchema,
|
|
1065
|
-
network: getNetworkResultSchema
|
|
1066
|
-
});
|
|
1067
|
-
var getAccountRequestMessageSchema = v15.object({
|
|
1068
|
-
...rpcRequestMessageSchema.entries,
|
|
1069
|
-
...v15.object({
|
|
1070
|
-
method: v15.literal(getAccountMethodName),
|
|
1071
|
-
params: getAccountParamsSchema,
|
|
1072
|
-
id: v15.string()
|
|
1073
|
-
}).entries
|
|
1074
|
-
});
|
|
1075
|
-
var connectMethodName = "wallet_connect";
|
|
1076
|
-
var connectParamsSchema = v15.nullish(
|
|
1077
|
-
v15.object({
|
|
1078
|
-
permissions: v15.optional(v15.array(PermissionRequestParams)),
|
|
1079
|
-
addresses: v15.optional(v15.array(v15.enum(AddressPurpose))),
|
|
1080
|
-
message: v15.optional(
|
|
1081
|
-
v15.pipe(v15.string(), v15.maxLength(80, "The message must not exceed 80 characters."))
|
|
1082
|
-
)
|
|
1083
|
-
})
|
|
1084
|
-
);
|
|
1085
|
-
var connectResultSchema = v15.object({
|
|
1086
|
-
id: v15.string(),
|
|
1087
|
-
addresses: v15.array(addressSchema),
|
|
1088
|
-
walletType: walletTypeSchema,
|
|
1089
|
-
network: getNetworkResultSchema
|
|
1090
|
-
});
|
|
1091
|
-
var connectRequestMessageSchema = v15.object({
|
|
1092
|
-
...rpcRequestMessageSchema.entries,
|
|
1093
|
-
...v15.object({
|
|
1094
|
-
method: v15.literal(connectMethodName),
|
|
1095
|
-
params: connectParamsSchema,
|
|
1117
|
+
method: v15.literal(getBalanceMethodName),
|
|
1096
1118
|
id: v15.string()
|
|
1097
1119
|
}).entries
|
|
1098
1120
|
});
|
|
@@ -2297,6 +2319,10 @@ var signMultipleTransactions = async (options) => {
|
|
|
2297
2319
|
accountPermissionSchema,
|
|
2298
2320
|
addListener,
|
|
2299
2321
|
addressSchema,
|
|
2322
|
+
changeNetworkMethodName,
|
|
2323
|
+
changeNetworkParamsSchema,
|
|
2324
|
+
changeNetworkRequestMessageSchema,
|
|
2325
|
+
changeNetworkResultSchema,
|
|
2300
2326
|
connectMethodName,
|
|
2301
2327
|
connectParamsSchema,
|
|
2302
2328
|
connectRequestMessageSchema,
|