@sats-connect/core 0.6.4-d23e81d → 0.6.4-de28fa5
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 +2 -6
- package/dist/index.d.ts +2 -6
- package/dist/index.js +72 -72
- package/dist/index.mjs +72 -72
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -399,9 +399,7 @@ declare const getAddressesResultSchema: v.ObjectSchema<{
|
|
|
399
399
|
readonly addresses: v.ArraySchema<v.ObjectSchema<{
|
|
400
400
|
readonly address: v.StringSchema<undefined>;
|
|
401
401
|
readonly publicKey: v.StringSchema<undefined>;
|
|
402
|
-
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
|
|
403
|
-
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
404
|
-
*/
|
|
402
|
+
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
|
|
405
403
|
readonly addressType: v.EnumSchema<typeof AddressType, undefined>;
|
|
406
404
|
readonly walletType: v.PicklistSchema<readonly ["software", "ledger", "keystone"], undefined>;
|
|
407
405
|
}, undefined>, undefined>;
|
|
@@ -597,9 +595,7 @@ declare const getAccountsResultSchema: v.ArraySchema<v.ObjectSchema<{
|
|
|
597
595
|
readonly walletType: v.PicklistSchema<readonly ["software", "ledger", "keystone"], undefined>;
|
|
598
596
|
readonly address: v.StringSchema<undefined>;
|
|
599
597
|
readonly publicKey: v.StringSchema<undefined>;
|
|
600
|
-
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
|
|
601
|
-
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
602
|
-
*/
|
|
598
|
+
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
|
|
603
599
|
readonly addressType: v.EnumSchema<typeof AddressType, undefined>;
|
|
604
600
|
}, undefined>, undefined>;
|
|
605
601
|
type GetAccountsResult = v.InferOutput<typeof getAccountsResultSchema>;
|
package/dist/index.d.ts
CHANGED
|
@@ -399,9 +399,7 @@ declare const getAddressesResultSchema: v.ObjectSchema<{
|
|
|
399
399
|
readonly addresses: v.ArraySchema<v.ObjectSchema<{
|
|
400
400
|
readonly address: v.StringSchema<undefined>;
|
|
401
401
|
readonly publicKey: v.StringSchema<undefined>;
|
|
402
|
-
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
|
|
403
|
-
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
404
|
-
*/
|
|
402
|
+
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
|
|
405
403
|
readonly addressType: v.EnumSchema<typeof AddressType, undefined>;
|
|
406
404
|
readonly walletType: v.PicklistSchema<readonly ["software", "ledger", "keystone"], undefined>;
|
|
407
405
|
}, undefined>, undefined>;
|
|
@@ -597,9 +595,7 @@ declare const getAccountsResultSchema: v.ArraySchema<v.ObjectSchema<{
|
|
|
597
595
|
readonly walletType: v.PicklistSchema<readonly ["software", "ledger", "keystone"], undefined>;
|
|
598
596
|
readonly address: v.StringSchema<undefined>;
|
|
599
597
|
readonly publicKey: v.StringSchema<undefined>;
|
|
600
|
-
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
|
|
601
|
-
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
602
|
-
*/
|
|
598
|
+
readonly purpose: v.EnumSchema<typeof AddressPurpose, undefined>;
|
|
603
599
|
readonly addressType: v.EnumSchema<typeof AddressType, undefined>;
|
|
604
600
|
}, undefined>, undefined>;
|
|
605
601
|
type GetAccountsResult = v.InferOutput<typeof getAccountsResultSchema>;
|
package/dist/index.js
CHANGED
|
@@ -209,14 +209,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
209
209
|
var import_jsontokens = require("jsontokens");
|
|
210
210
|
|
|
211
211
|
// src/addresses/types.ts
|
|
212
|
-
var v2 = __toESM(require("valibot"));
|
|
213
|
-
|
|
214
|
-
// src/request/types/common.ts
|
|
215
212
|
var v = __toESM(require("valibot"));
|
|
216
|
-
var walletTypes = ["software", "ledger", "keystone"];
|
|
217
|
-
var walletTypeSchema = v.picklist(walletTypes);
|
|
218
|
-
|
|
219
|
-
// src/addresses/types.ts
|
|
220
213
|
var AddressPurpose = /* @__PURE__ */ ((AddressPurpose2) => {
|
|
221
214
|
AddressPurpose2["Ordinals"] = "ordinals";
|
|
222
215
|
AddressPurpose2["Payment"] = "payment";
|
|
@@ -232,11 +225,11 @@ var AddressType = /* @__PURE__ */ ((AddressType3) => {
|
|
|
232
225
|
AddressType3["stacks"] = "stacks";
|
|
233
226
|
return AddressType3;
|
|
234
227
|
})(AddressType || {});
|
|
235
|
-
var addressSchema =
|
|
236
|
-
address:
|
|
237
|
-
publicKey:
|
|
238
|
-
purpose:
|
|
239
|
-
addressType:
|
|
228
|
+
var addressSchema = v.object({
|
|
229
|
+
address: v.string(),
|
|
230
|
+
publicKey: v.string(),
|
|
231
|
+
purpose: v.enum(AddressPurpose),
|
|
232
|
+
addressType: v.enum(AddressType),
|
|
240
233
|
walletType: walletTypeSchema
|
|
241
234
|
});
|
|
242
235
|
|
|
@@ -258,7 +251,7 @@ var getAddress = async (options) => {
|
|
|
258
251
|
};
|
|
259
252
|
|
|
260
253
|
// src/types.ts
|
|
261
|
-
var
|
|
254
|
+
var v2 = __toESM(require("valibot"));
|
|
262
255
|
var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
|
|
263
256
|
BitcoinNetworkType2["Mainnet"] = "Mainnet";
|
|
264
257
|
BitcoinNetworkType2["Testnet"] = "Testnet";
|
|
@@ -267,22 +260,22 @@ var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
|
|
|
267
260
|
BitcoinNetworkType2["Regtest"] = "Regtest";
|
|
268
261
|
return BitcoinNetworkType2;
|
|
269
262
|
})(BitcoinNetworkType || {});
|
|
270
|
-
var RpcIdSchema =
|
|
271
|
-
var rpcRequestMessageSchema =
|
|
272
|
-
jsonrpc:
|
|
273
|
-
method:
|
|
274
|
-
params:
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
263
|
+
var RpcIdSchema = v2.optional(v2.union([v2.string(), v2.number(), v2.null()]));
|
|
264
|
+
var rpcRequestMessageSchema = v2.object({
|
|
265
|
+
jsonrpc: v2.literal("2.0"),
|
|
266
|
+
method: v2.string(),
|
|
267
|
+
params: v2.optional(
|
|
268
|
+
v2.union([
|
|
269
|
+
v2.array(v2.unknown()),
|
|
270
|
+
v2.looseObject({}),
|
|
278
271
|
// Note: This is to support current incorrect usage of RPC 2.0. Params need
|
|
279
272
|
// to be either an array or an object when provided. Changing this now would
|
|
280
273
|
// be a breaking change, so accepting null values for now. Tracking in
|
|
281
274
|
// https://linear.app/xverseapp/issue/ENG-4538.
|
|
282
|
-
|
|
275
|
+
v2.null()
|
|
283
276
|
])
|
|
284
277
|
),
|
|
285
|
-
id:
|
|
278
|
+
id: v2.unwrap(RpcIdSchema)
|
|
286
279
|
});
|
|
287
280
|
var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode2) => {
|
|
288
281
|
RpcErrorCode2[RpcErrorCode2["PARSE_ERROR"] = -32700] = "PARSE_ERROR";
|
|
@@ -295,43 +288,43 @@ var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode2) => {
|
|
|
295
288
|
RpcErrorCode2[RpcErrorCode2["ACCESS_DENIED"] = -32002] = "ACCESS_DENIED";
|
|
296
289
|
return RpcErrorCode2;
|
|
297
290
|
})(RpcErrorCode || {});
|
|
298
|
-
var rpcSuccessResponseMessageSchema =
|
|
299
|
-
jsonrpc:
|
|
300
|
-
result:
|
|
291
|
+
var rpcSuccessResponseMessageSchema = v2.object({
|
|
292
|
+
jsonrpc: v2.literal("2.0"),
|
|
293
|
+
result: v2.nonOptional(v2.unknown()),
|
|
301
294
|
id: RpcIdSchema
|
|
302
295
|
});
|
|
303
|
-
var rpcErrorResponseMessageSchema =
|
|
304
|
-
jsonrpc:
|
|
305
|
-
error:
|
|
296
|
+
var rpcErrorResponseMessageSchema = v2.object({
|
|
297
|
+
jsonrpc: v2.literal("2.0"),
|
|
298
|
+
error: v2.nonOptional(v2.unknown()),
|
|
306
299
|
id: RpcIdSchema
|
|
307
300
|
});
|
|
308
|
-
var rpcResponseMessageSchema =
|
|
301
|
+
var rpcResponseMessageSchema = v2.union([
|
|
309
302
|
rpcSuccessResponseMessageSchema,
|
|
310
303
|
rpcErrorResponseMessageSchema
|
|
311
304
|
]);
|
|
312
305
|
|
|
313
306
|
// src/provider/types.ts
|
|
314
|
-
var
|
|
307
|
+
var v3 = __toESM(require("valibot"));
|
|
315
308
|
var accountChangeEventName = "accountChange";
|
|
316
|
-
var accountChangeSchema =
|
|
317
|
-
type:
|
|
318
|
-
addresses:
|
|
309
|
+
var accountChangeSchema = v3.object({
|
|
310
|
+
type: v3.literal(accountChangeEventName),
|
|
311
|
+
addresses: v3.optional(v3.array(addressSchema))
|
|
319
312
|
});
|
|
320
313
|
var networkChangeEventName = "networkChange";
|
|
321
|
-
var networkChangeSchema =
|
|
322
|
-
type:
|
|
323
|
-
bitcoin:
|
|
324
|
-
name:
|
|
314
|
+
var networkChangeSchema = v3.object({
|
|
315
|
+
type: v3.literal(networkChangeEventName),
|
|
316
|
+
bitcoin: v3.object({
|
|
317
|
+
name: v3.enum(BitcoinNetworkType)
|
|
325
318
|
}),
|
|
326
|
-
stacks:
|
|
327
|
-
name:
|
|
319
|
+
stacks: v3.object({
|
|
320
|
+
name: v3.string()
|
|
328
321
|
})
|
|
329
322
|
});
|
|
330
323
|
var disconnectEventName = "disconnect";
|
|
331
|
-
var disconnectSchema =
|
|
332
|
-
type:
|
|
324
|
+
var disconnectSchema = v3.object({
|
|
325
|
+
type: v3.literal(disconnectEventName)
|
|
333
326
|
});
|
|
334
|
-
var walletEventSchema =
|
|
327
|
+
var walletEventSchema = v3.variant("type", [
|
|
335
328
|
accountChangeSchema,
|
|
336
329
|
networkChangeSchema,
|
|
337
330
|
disconnectSchema
|
|
@@ -380,26 +373,26 @@ function getSupportedWallets() {
|
|
|
380
373
|
var v21 = __toESM(require("valibot"));
|
|
381
374
|
|
|
382
375
|
// src/request/types/stxMethods/callContract.ts
|
|
383
|
-
var
|
|
376
|
+
var v4 = __toESM(require("valibot"));
|
|
384
377
|
var stxCallContractMethodName = "stx_callContract";
|
|
385
|
-
var stxCallContractParamsSchema =
|
|
378
|
+
var stxCallContractParamsSchema = v4.object({
|
|
386
379
|
/**
|
|
387
380
|
* The contract principal.
|
|
388
381
|
*
|
|
389
382
|
* E.g. `"SPKE...GD5C.my-contract"`
|
|
390
383
|
*/
|
|
391
|
-
contract:
|
|
384
|
+
contract: v4.string(),
|
|
392
385
|
/**
|
|
393
386
|
* The name of the function to call.
|
|
394
387
|
*
|
|
395
388
|
* Note: spec changes ongoing,
|
|
396
389
|
* https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
|
|
397
390
|
*/
|
|
398
|
-
functionName:
|
|
391
|
+
functionName: v4.string(),
|
|
399
392
|
/**
|
|
400
393
|
* @deprecated in favor of `functionArgs` for @stacks/connect compatibility
|
|
401
394
|
*/
|
|
402
|
-
arguments:
|
|
395
|
+
arguments: v4.optional(v4.array(v4.string())),
|
|
403
396
|
/**
|
|
404
397
|
* The function's arguments. The arguments are expected to be hex-encoded
|
|
405
398
|
* strings of Clarity values.
|
|
@@ -414,76 +407,76 @@ var stxCallContractParamsSchema = v5.object({
|
|
|
414
407
|
* const hexArgs = functionArgs.map(cvToHex);
|
|
415
408
|
* ```
|
|
416
409
|
*/
|
|
417
|
-
functionArgs:
|
|
410
|
+
functionArgs: v4.optional(v4.array(v4.string())),
|
|
418
411
|
/**
|
|
419
412
|
* The post conditions to apply to the contract call.
|
|
420
413
|
*/
|
|
421
|
-
postConditions:
|
|
414
|
+
postConditions: v4.optional(v4.array(v4.string())),
|
|
422
415
|
/**
|
|
423
416
|
* The mode to apply to the post conditions.
|
|
424
417
|
*/
|
|
425
|
-
postConditionMode:
|
|
418
|
+
postConditionMode: v4.optional(v4.union([v4.literal("allow"), v4.literal("deny")]))
|
|
426
419
|
});
|
|
427
|
-
var stxCallContractResultSchema =
|
|
420
|
+
var stxCallContractResultSchema = v4.object({
|
|
428
421
|
/**
|
|
429
422
|
* The ID of the transaction.
|
|
430
423
|
*/
|
|
431
|
-
txid:
|
|
424
|
+
txid: v4.string(),
|
|
432
425
|
/**
|
|
433
426
|
* A Stacks transaction as a hex-encoded string.
|
|
434
427
|
*/
|
|
435
|
-
transaction:
|
|
428
|
+
transaction: v4.string()
|
|
436
429
|
});
|
|
437
|
-
var stxCallContractRequestMessageSchema =
|
|
430
|
+
var stxCallContractRequestMessageSchema = v4.object({
|
|
438
431
|
...rpcRequestMessageSchema.entries,
|
|
439
|
-
...
|
|
440
|
-
method:
|
|
432
|
+
...v4.object({
|
|
433
|
+
method: v4.literal(stxCallContractMethodName),
|
|
441
434
|
params: stxCallContractParamsSchema,
|
|
442
|
-
id:
|
|
435
|
+
id: v4.string()
|
|
443
436
|
}).entries
|
|
444
437
|
});
|
|
445
438
|
|
|
446
439
|
// src/request/types/stxMethods/deployContract.ts
|
|
447
|
-
var
|
|
440
|
+
var v5 = __toESM(require("valibot"));
|
|
448
441
|
var stxDeployContractMethodName = "stx_deployContract";
|
|
449
|
-
var stxDeployContractParamsSchema =
|
|
442
|
+
var stxDeployContractParamsSchema = v5.object({
|
|
450
443
|
/**
|
|
451
444
|
* Name of the contract.
|
|
452
445
|
*/
|
|
453
|
-
name:
|
|
446
|
+
name: v5.string(),
|
|
454
447
|
/**
|
|
455
448
|
* The source code of the Clarity contract.
|
|
456
449
|
*/
|
|
457
|
-
clarityCode:
|
|
450
|
+
clarityCode: v5.string(),
|
|
458
451
|
/**
|
|
459
452
|
* The version of the Clarity contract.
|
|
460
453
|
*/
|
|
461
|
-
clarityVersion:
|
|
454
|
+
clarityVersion: v5.optional(v5.string()),
|
|
462
455
|
/**
|
|
463
456
|
* The post conditions to apply to the contract call.
|
|
464
457
|
*/
|
|
465
|
-
postConditions:
|
|
458
|
+
postConditions: v5.optional(v5.array(v5.string())),
|
|
466
459
|
/**
|
|
467
460
|
* The mode to apply to the post conditions.
|
|
468
461
|
*/
|
|
469
|
-
postConditionMode:
|
|
462
|
+
postConditionMode: v5.optional(v5.union([v5.literal("allow"), v5.literal("deny")]))
|
|
470
463
|
});
|
|
471
|
-
var stxDeployContractResultSchema =
|
|
464
|
+
var stxDeployContractResultSchema = v5.object({
|
|
472
465
|
/**
|
|
473
466
|
* The ID of the transaction.
|
|
474
467
|
*/
|
|
475
|
-
txid:
|
|
468
|
+
txid: v5.string(),
|
|
476
469
|
/**
|
|
477
470
|
* A Stacks transaction as a hex-encoded string.
|
|
478
471
|
*/
|
|
479
|
-
transaction:
|
|
472
|
+
transaction: v5.string()
|
|
480
473
|
});
|
|
481
|
-
var stxDeployContractRequestMessageSchema =
|
|
474
|
+
var stxDeployContractRequestMessageSchema = v5.object({
|
|
482
475
|
...rpcRequestMessageSchema.entries,
|
|
483
|
-
...
|
|
484
|
-
method:
|
|
476
|
+
...v5.object({
|
|
477
|
+
method: v5.literal(stxDeployContractMethodName),
|
|
485
478
|
params: stxDeployContractParamsSchema,
|
|
486
|
-
id:
|
|
479
|
+
id: v5.string()
|
|
487
480
|
}).entries
|
|
488
481
|
});
|
|
489
482
|
|
|
@@ -492,6 +485,13 @@ var v8 = __toESM(require("valibot"));
|
|
|
492
485
|
|
|
493
486
|
// src/request/types/walletMethods.ts
|
|
494
487
|
var v7 = __toESM(require("valibot"));
|
|
488
|
+
|
|
489
|
+
// src/request/types/common.ts
|
|
490
|
+
var v6 = __toESM(require("valibot"));
|
|
491
|
+
var walletTypes = ["software", "ledger", "keystone"];
|
|
492
|
+
var walletTypeSchema = v6.picklist(walletTypes);
|
|
493
|
+
|
|
494
|
+
// src/request/types/walletMethods.ts
|
|
495
495
|
var accountActionsSchema = v7.object({
|
|
496
496
|
read: v7.optional(v7.boolean())
|
|
497
497
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -2,14 +2,7 @@
|
|
|
2
2
|
import { createUnsecuredToken } from "jsontokens";
|
|
3
3
|
|
|
4
4
|
// src/addresses/types.ts
|
|
5
|
-
import * as v2 from "valibot";
|
|
6
|
-
|
|
7
|
-
// src/request/types/common.ts
|
|
8
5
|
import * as v from "valibot";
|
|
9
|
-
var walletTypes = ["software", "ledger", "keystone"];
|
|
10
|
-
var walletTypeSchema = v.picklist(walletTypes);
|
|
11
|
-
|
|
12
|
-
// src/addresses/types.ts
|
|
13
6
|
var AddressPurpose = /* @__PURE__ */ ((AddressPurpose2) => {
|
|
14
7
|
AddressPurpose2["Ordinals"] = "ordinals";
|
|
15
8
|
AddressPurpose2["Payment"] = "payment";
|
|
@@ -25,11 +18,11 @@ var AddressType = /* @__PURE__ */ ((AddressType3) => {
|
|
|
25
18
|
AddressType3["stacks"] = "stacks";
|
|
26
19
|
return AddressType3;
|
|
27
20
|
})(AddressType || {});
|
|
28
|
-
var addressSchema =
|
|
29
|
-
address:
|
|
30
|
-
publicKey:
|
|
31
|
-
purpose:
|
|
32
|
-
addressType:
|
|
21
|
+
var addressSchema = v.object({
|
|
22
|
+
address: v.string(),
|
|
23
|
+
publicKey: v.string(),
|
|
24
|
+
purpose: v.enum(AddressPurpose),
|
|
25
|
+
addressType: v.enum(AddressType),
|
|
33
26
|
walletType: walletTypeSchema
|
|
34
27
|
});
|
|
35
28
|
|
|
@@ -51,7 +44,7 @@ var getAddress = async (options) => {
|
|
|
51
44
|
};
|
|
52
45
|
|
|
53
46
|
// src/types.ts
|
|
54
|
-
import * as
|
|
47
|
+
import * as v2 from "valibot";
|
|
55
48
|
var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
|
|
56
49
|
BitcoinNetworkType2["Mainnet"] = "Mainnet";
|
|
57
50
|
BitcoinNetworkType2["Testnet"] = "Testnet";
|
|
@@ -60,22 +53,22 @@ var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
|
|
|
60
53
|
BitcoinNetworkType2["Regtest"] = "Regtest";
|
|
61
54
|
return BitcoinNetworkType2;
|
|
62
55
|
})(BitcoinNetworkType || {});
|
|
63
|
-
var RpcIdSchema =
|
|
64
|
-
var rpcRequestMessageSchema =
|
|
65
|
-
jsonrpc:
|
|
66
|
-
method:
|
|
67
|
-
params:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
var RpcIdSchema = v2.optional(v2.union([v2.string(), v2.number(), v2.null()]));
|
|
57
|
+
var rpcRequestMessageSchema = v2.object({
|
|
58
|
+
jsonrpc: v2.literal("2.0"),
|
|
59
|
+
method: v2.string(),
|
|
60
|
+
params: v2.optional(
|
|
61
|
+
v2.union([
|
|
62
|
+
v2.array(v2.unknown()),
|
|
63
|
+
v2.looseObject({}),
|
|
71
64
|
// Note: This is to support current incorrect usage of RPC 2.0. Params need
|
|
72
65
|
// to be either an array or an object when provided. Changing this now would
|
|
73
66
|
// be a breaking change, so accepting null values for now. Tracking in
|
|
74
67
|
// https://linear.app/xverseapp/issue/ENG-4538.
|
|
75
|
-
|
|
68
|
+
v2.null()
|
|
76
69
|
])
|
|
77
70
|
),
|
|
78
|
-
id:
|
|
71
|
+
id: v2.unwrap(RpcIdSchema)
|
|
79
72
|
});
|
|
80
73
|
var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode2) => {
|
|
81
74
|
RpcErrorCode2[RpcErrorCode2["PARSE_ERROR"] = -32700] = "PARSE_ERROR";
|
|
@@ -88,43 +81,43 @@ var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode2) => {
|
|
|
88
81
|
RpcErrorCode2[RpcErrorCode2["ACCESS_DENIED"] = -32002] = "ACCESS_DENIED";
|
|
89
82
|
return RpcErrorCode2;
|
|
90
83
|
})(RpcErrorCode || {});
|
|
91
|
-
var rpcSuccessResponseMessageSchema =
|
|
92
|
-
jsonrpc:
|
|
93
|
-
result:
|
|
84
|
+
var rpcSuccessResponseMessageSchema = v2.object({
|
|
85
|
+
jsonrpc: v2.literal("2.0"),
|
|
86
|
+
result: v2.nonOptional(v2.unknown()),
|
|
94
87
|
id: RpcIdSchema
|
|
95
88
|
});
|
|
96
|
-
var rpcErrorResponseMessageSchema =
|
|
97
|
-
jsonrpc:
|
|
98
|
-
error:
|
|
89
|
+
var rpcErrorResponseMessageSchema = v2.object({
|
|
90
|
+
jsonrpc: v2.literal("2.0"),
|
|
91
|
+
error: v2.nonOptional(v2.unknown()),
|
|
99
92
|
id: RpcIdSchema
|
|
100
93
|
});
|
|
101
|
-
var rpcResponseMessageSchema =
|
|
94
|
+
var rpcResponseMessageSchema = v2.union([
|
|
102
95
|
rpcSuccessResponseMessageSchema,
|
|
103
96
|
rpcErrorResponseMessageSchema
|
|
104
97
|
]);
|
|
105
98
|
|
|
106
99
|
// src/provider/types.ts
|
|
107
|
-
import * as
|
|
100
|
+
import * as v3 from "valibot";
|
|
108
101
|
var accountChangeEventName = "accountChange";
|
|
109
|
-
var accountChangeSchema =
|
|
110
|
-
type:
|
|
111
|
-
addresses:
|
|
102
|
+
var accountChangeSchema = v3.object({
|
|
103
|
+
type: v3.literal(accountChangeEventName),
|
|
104
|
+
addresses: v3.optional(v3.array(addressSchema))
|
|
112
105
|
});
|
|
113
106
|
var networkChangeEventName = "networkChange";
|
|
114
|
-
var networkChangeSchema =
|
|
115
|
-
type:
|
|
116
|
-
bitcoin:
|
|
117
|
-
name:
|
|
107
|
+
var networkChangeSchema = v3.object({
|
|
108
|
+
type: v3.literal(networkChangeEventName),
|
|
109
|
+
bitcoin: v3.object({
|
|
110
|
+
name: v3.enum(BitcoinNetworkType)
|
|
118
111
|
}),
|
|
119
|
-
stacks:
|
|
120
|
-
name:
|
|
112
|
+
stacks: v3.object({
|
|
113
|
+
name: v3.string()
|
|
121
114
|
})
|
|
122
115
|
});
|
|
123
116
|
var disconnectEventName = "disconnect";
|
|
124
|
-
var disconnectSchema =
|
|
125
|
-
type:
|
|
117
|
+
var disconnectSchema = v3.object({
|
|
118
|
+
type: v3.literal(disconnectEventName)
|
|
126
119
|
});
|
|
127
|
-
var walletEventSchema =
|
|
120
|
+
var walletEventSchema = v3.variant("type", [
|
|
128
121
|
accountChangeSchema,
|
|
129
122
|
networkChangeSchema,
|
|
130
123
|
disconnectSchema
|
|
@@ -173,26 +166,26 @@ function getSupportedWallets() {
|
|
|
173
166
|
import * as v21 from "valibot";
|
|
174
167
|
|
|
175
168
|
// src/request/types/stxMethods/callContract.ts
|
|
176
|
-
import * as
|
|
169
|
+
import * as v4 from "valibot";
|
|
177
170
|
var stxCallContractMethodName = "stx_callContract";
|
|
178
|
-
var stxCallContractParamsSchema =
|
|
171
|
+
var stxCallContractParamsSchema = v4.object({
|
|
179
172
|
/**
|
|
180
173
|
* The contract principal.
|
|
181
174
|
*
|
|
182
175
|
* E.g. `"SPKE...GD5C.my-contract"`
|
|
183
176
|
*/
|
|
184
|
-
contract:
|
|
177
|
+
contract: v4.string(),
|
|
185
178
|
/**
|
|
186
179
|
* The name of the function to call.
|
|
187
180
|
*
|
|
188
181
|
* Note: spec changes ongoing,
|
|
189
182
|
* https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
|
|
190
183
|
*/
|
|
191
|
-
functionName:
|
|
184
|
+
functionName: v4.string(),
|
|
192
185
|
/**
|
|
193
186
|
* @deprecated in favor of `functionArgs` for @stacks/connect compatibility
|
|
194
187
|
*/
|
|
195
|
-
arguments:
|
|
188
|
+
arguments: v4.optional(v4.array(v4.string())),
|
|
196
189
|
/**
|
|
197
190
|
* The function's arguments. The arguments are expected to be hex-encoded
|
|
198
191
|
* strings of Clarity values.
|
|
@@ -207,76 +200,76 @@ var stxCallContractParamsSchema = v5.object({
|
|
|
207
200
|
* const hexArgs = functionArgs.map(cvToHex);
|
|
208
201
|
* ```
|
|
209
202
|
*/
|
|
210
|
-
functionArgs:
|
|
203
|
+
functionArgs: v4.optional(v4.array(v4.string())),
|
|
211
204
|
/**
|
|
212
205
|
* The post conditions to apply to the contract call.
|
|
213
206
|
*/
|
|
214
|
-
postConditions:
|
|
207
|
+
postConditions: v4.optional(v4.array(v4.string())),
|
|
215
208
|
/**
|
|
216
209
|
* The mode to apply to the post conditions.
|
|
217
210
|
*/
|
|
218
|
-
postConditionMode:
|
|
211
|
+
postConditionMode: v4.optional(v4.union([v4.literal("allow"), v4.literal("deny")]))
|
|
219
212
|
});
|
|
220
|
-
var stxCallContractResultSchema =
|
|
213
|
+
var stxCallContractResultSchema = v4.object({
|
|
221
214
|
/**
|
|
222
215
|
* The ID of the transaction.
|
|
223
216
|
*/
|
|
224
|
-
txid:
|
|
217
|
+
txid: v4.string(),
|
|
225
218
|
/**
|
|
226
219
|
* A Stacks transaction as a hex-encoded string.
|
|
227
220
|
*/
|
|
228
|
-
transaction:
|
|
221
|
+
transaction: v4.string()
|
|
229
222
|
});
|
|
230
|
-
var stxCallContractRequestMessageSchema =
|
|
223
|
+
var stxCallContractRequestMessageSchema = v4.object({
|
|
231
224
|
...rpcRequestMessageSchema.entries,
|
|
232
|
-
...
|
|
233
|
-
method:
|
|
225
|
+
...v4.object({
|
|
226
|
+
method: v4.literal(stxCallContractMethodName),
|
|
234
227
|
params: stxCallContractParamsSchema,
|
|
235
|
-
id:
|
|
228
|
+
id: v4.string()
|
|
236
229
|
}).entries
|
|
237
230
|
});
|
|
238
231
|
|
|
239
232
|
// src/request/types/stxMethods/deployContract.ts
|
|
240
|
-
import * as
|
|
233
|
+
import * as v5 from "valibot";
|
|
241
234
|
var stxDeployContractMethodName = "stx_deployContract";
|
|
242
|
-
var stxDeployContractParamsSchema =
|
|
235
|
+
var stxDeployContractParamsSchema = v5.object({
|
|
243
236
|
/**
|
|
244
237
|
* Name of the contract.
|
|
245
238
|
*/
|
|
246
|
-
name:
|
|
239
|
+
name: v5.string(),
|
|
247
240
|
/**
|
|
248
241
|
* The source code of the Clarity contract.
|
|
249
242
|
*/
|
|
250
|
-
clarityCode:
|
|
243
|
+
clarityCode: v5.string(),
|
|
251
244
|
/**
|
|
252
245
|
* The version of the Clarity contract.
|
|
253
246
|
*/
|
|
254
|
-
clarityVersion:
|
|
247
|
+
clarityVersion: v5.optional(v5.string()),
|
|
255
248
|
/**
|
|
256
249
|
* The post conditions to apply to the contract call.
|
|
257
250
|
*/
|
|
258
|
-
postConditions:
|
|
251
|
+
postConditions: v5.optional(v5.array(v5.string())),
|
|
259
252
|
/**
|
|
260
253
|
* The mode to apply to the post conditions.
|
|
261
254
|
*/
|
|
262
|
-
postConditionMode:
|
|
255
|
+
postConditionMode: v5.optional(v5.union([v5.literal("allow"), v5.literal("deny")]))
|
|
263
256
|
});
|
|
264
|
-
var stxDeployContractResultSchema =
|
|
257
|
+
var stxDeployContractResultSchema = v5.object({
|
|
265
258
|
/**
|
|
266
259
|
* The ID of the transaction.
|
|
267
260
|
*/
|
|
268
|
-
txid:
|
|
261
|
+
txid: v5.string(),
|
|
269
262
|
/**
|
|
270
263
|
* A Stacks transaction as a hex-encoded string.
|
|
271
264
|
*/
|
|
272
|
-
transaction:
|
|
265
|
+
transaction: v5.string()
|
|
273
266
|
});
|
|
274
|
-
var stxDeployContractRequestMessageSchema =
|
|
267
|
+
var stxDeployContractRequestMessageSchema = v5.object({
|
|
275
268
|
...rpcRequestMessageSchema.entries,
|
|
276
|
-
...
|
|
277
|
-
method:
|
|
269
|
+
...v5.object({
|
|
270
|
+
method: v5.literal(stxDeployContractMethodName),
|
|
278
271
|
params: stxDeployContractParamsSchema,
|
|
279
|
-
id:
|
|
272
|
+
id: v5.string()
|
|
280
273
|
}).entries
|
|
281
274
|
});
|
|
282
275
|
|
|
@@ -285,6 +278,13 @@ import * as v8 from "valibot";
|
|
|
285
278
|
|
|
286
279
|
// src/request/types/walletMethods.ts
|
|
287
280
|
import * as v7 from "valibot";
|
|
281
|
+
|
|
282
|
+
// src/request/types/common.ts
|
|
283
|
+
import * as v6 from "valibot";
|
|
284
|
+
var walletTypes = ["software", "ledger", "keystone"];
|
|
285
|
+
var walletTypeSchema = v6.picklist(walletTypes);
|
|
286
|
+
|
|
287
|
+
// src/request/types/walletMethods.ts
|
|
288
288
|
var accountActionsSchema = v7.object({
|
|
289
289
|
read: v7.optional(v7.boolean())
|
|
290
290
|
});
|