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