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