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