@sats-connect/core 0.9.0 → 0.10.0
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 +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +176 -140
- package/dist/index.mjs +172 -140
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -201,6 +201,10 @@ __export(index_exports, {
|
|
|
201
201
|
sparkGetBalanceParamsSchema: () => sparkGetBalanceParamsSchema,
|
|
202
202
|
sparkGetBalanceRequestMessageSchema: () => sparkGetBalanceRequestMessageSchema,
|
|
203
203
|
sparkGetBalanceResultSchema: () => sparkGetBalanceResultSchema,
|
|
204
|
+
sparkSignMessageMethodName: () => sparkSignMessageMethodName,
|
|
205
|
+
sparkSignMessageParamsSchema: () => sparkSignMessageParamsSchema,
|
|
206
|
+
sparkSignMessageRequestMessageSchema: () => sparkSignMessageRequestMessageSchema,
|
|
207
|
+
sparkSignMessageResultSchema: () => sparkSignMessageResultSchema,
|
|
204
208
|
sparkTransferMethodName: () => sparkTransferMethodName,
|
|
205
209
|
sparkTransferParamsSchema: () => sparkTransferParamsSchema,
|
|
206
210
|
sparkTransferRequestMessageSchema: () => sparkTransferRequestMessageSchema,
|
|
@@ -254,7 +258,7 @@ __export(index_exports, {
|
|
|
254
258
|
module.exports = __toCommonJS(index_exports);
|
|
255
259
|
|
|
256
260
|
// src/request/index.ts
|
|
257
|
-
var
|
|
261
|
+
var v37 = __toESM(require("valibot"));
|
|
258
262
|
|
|
259
263
|
// src/provider/types.ts
|
|
260
264
|
var v4 = __toESM(require("valibot"));
|
|
@@ -1368,87 +1372,115 @@ var sparkGetBalanceRequestMessageSchema = v24.object({
|
|
|
1368
1372
|
}).entries
|
|
1369
1373
|
});
|
|
1370
1374
|
|
|
1371
|
-
// src/request/types/sparkMethods/
|
|
1375
|
+
// src/request/types/sparkMethods/signMessage.ts
|
|
1372
1376
|
var v25 = __toESM(require("valibot"));
|
|
1377
|
+
var sparkSignMessageMethodName = "spark_signMessage";
|
|
1378
|
+
var sparkSignMessageParamsSchema = v25.object({
|
|
1379
|
+
/**
|
|
1380
|
+
* The message to sign. The message should only consist of valid UTF-8 characters.
|
|
1381
|
+
*/
|
|
1382
|
+
message: v25.string()
|
|
1383
|
+
});
|
|
1384
|
+
var sparkSignMessageResultSchema = v25.object({
|
|
1385
|
+
/**
|
|
1386
|
+
* The signature, encoded in base64, of the message hash.
|
|
1387
|
+
*
|
|
1388
|
+
* Note: When signing, the message is decoded into a byte array,
|
|
1389
|
+
* and the resulting byte array is hashed with SHA256 before signing
|
|
1390
|
+
* with the private key.
|
|
1391
|
+
*/
|
|
1392
|
+
signature: v25.string()
|
|
1393
|
+
});
|
|
1394
|
+
var sparkSignMessageRequestMessageSchema = v25.object({
|
|
1395
|
+
...rpcRequestMessageSchema.entries,
|
|
1396
|
+
...v25.object({
|
|
1397
|
+
method: v25.literal(sparkSignMessageMethodName),
|
|
1398
|
+
params: sparkSignMessageParamsSchema,
|
|
1399
|
+
id: v25.string()
|
|
1400
|
+
}).entries
|
|
1401
|
+
});
|
|
1402
|
+
|
|
1403
|
+
// src/request/types/sparkMethods/transfer.ts
|
|
1404
|
+
var v26 = __toESM(require("valibot"));
|
|
1373
1405
|
var sparkTransferMethodName = "spark_transfer";
|
|
1374
|
-
var sparkTransferParamsSchema =
|
|
1406
|
+
var sparkTransferParamsSchema = v26.object({
|
|
1375
1407
|
/**
|
|
1376
1408
|
* Amount of SATS to transfer as a string or number.
|
|
1377
1409
|
*/
|
|
1378
|
-
amountSats:
|
|
1410
|
+
amountSats: v26.union([v26.number(), v26.string()]),
|
|
1379
1411
|
/**
|
|
1380
1412
|
* The recipient's spark address.
|
|
1381
1413
|
*/
|
|
1382
|
-
receiverSparkAddress:
|
|
1414
|
+
receiverSparkAddress: v26.string()
|
|
1383
1415
|
});
|
|
1384
|
-
var sparkTransferResultSchema =
|
|
1416
|
+
var sparkTransferResultSchema = v26.object({
|
|
1385
1417
|
/**
|
|
1386
1418
|
* The ID of the transaction.
|
|
1387
1419
|
*/
|
|
1388
|
-
id:
|
|
1420
|
+
id: v26.string()
|
|
1389
1421
|
});
|
|
1390
|
-
var sparkTransferRequestMessageSchema =
|
|
1422
|
+
var sparkTransferRequestMessageSchema = v26.object({
|
|
1391
1423
|
...rpcRequestMessageSchema.entries,
|
|
1392
|
-
...
|
|
1393
|
-
method:
|
|
1424
|
+
...v26.object({
|
|
1425
|
+
method: v26.literal(sparkTransferMethodName),
|
|
1394
1426
|
params: sparkTransferParamsSchema,
|
|
1395
|
-
id:
|
|
1427
|
+
id: v26.string()
|
|
1396
1428
|
}).entries
|
|
1397
1429
|
});
|
|
1398
1430
|
|
|
1399
1431
|
// src/request/types/sparkMethods/transferToken.ts
|
|
1400
|
-
var
|
|
1432
|
+
var v27 = __toESM(require("valibot"));
|
|
1401
1433
|
var sparkTransferTokenMethodName = "spark_transferToken";
|
|
1402
|
-
var sparkTransferTokenParamsSchema =
|
|
1434
|
+
var sparkTransferTokenParamsSchema = v27.object({
|
|
1403
1435
|
/**
|
|
1404
1436
|
* Amount of units of the token to transfer as a string or number.
|
|
1405
1437
|
*/
|
|
1406
|
-
tokenAmount:
|
|
1438
|
+
tokenAmount: v27.union([v27.number(), v27.string()]),
|
|
1407
1439
|
/**
|
|
1408
1440
|
* The Bech32m token identifier.
|
|
1409
1441
|
*/
|
|
1410
|
-
tokenIdentifier:
|
|
1442
|
+
tokenIdentifier: v27.string(),
|
|
1411
1443
|
/**
|
|
1412
1444
|
* The recipient's spark address.
|
|
1413
1445
|
*/
|
|
1414
|
-
receiverSparkAddress:
|
|
1446
|
+
receiverSparkAddress: v27.string()
|
|
1415
1447
|
});
|
|
1416
|
-
var sparkTransferTokenResultSchema =
|
|
1448
|
+
var sparkTransferTokenResultSchema = v27.object({
|
|
1417
1449
|
/**
|
|
1418
1450
|
* The ID of the transaction.
|
|
1419
1451
|
*/
|
|
1420
|
-
id:
|
|
1452
|
+
id: v27.string()
|
|
1421
1453
|
});
|
|
1422
|
-
var sparkTransferTokenRequestMessageSchema =
|
|
1454
|
+
var sparkTransferTokenRequestMessageSchema = v27.object({
|
|
1423
1455
|
...rpcRequestMessageSchema.entries,
|
|
1424
|
-
...
|
|
1425
|
-
method:
|
|
1456
|
+
...v27.object({
|
|
1457
|
+
method: v27.literal(sparkTransferTokenMethodName),
|
|
1426
1458
|
params: sparkTransferTokenParamsSchema,
|
|
1427
|
-
id:
|
|
1459
|
+
id: v27.string()
|
|
1428
1460
|
}).entries
|
|
1429
1461
|
});
|
|
1430
1462
|
|
|
1431
1463
|
// src/request/types/stxMethods/callContract.ts
|
|
1432
|
-
var
|
|
1464
|
+
var v28 = __toESM(require("valibot"));
|
|
1433
1465
|
var stxCallContractMethodName = "stx_callContract";
|
|
1434
|
-
var stxCallContractParamsSchema =
|
|
1466
|
+
var stxCallContractParamsSchema = v28.object({
|
|
1435
1467
|
/**
|
|
1436
1468
|
* The contract principal.
|
|
1437
1469
|
*
|
|
1438
1470
|
* E.g. `"SPKE...GD5C.my-contract"`
|
|
1439
1471
|
*/
|
|
1440
|
-
contract:
|
|
1472
|
+
contract: v28.string(),
|
|
1441
1473
|
/**
|
|
1442
1474
|
* The name of the function to call.
|
|
1443
1475
|
*
|
|
1444
1476
|
* Note: spec changes ongoing,
|
|
1445
1477
|
* https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
|
|
1446
1478
|
*/
|
|
1447
|
-
functionName:
|
|
1479
|
+
functionName: v28.string(),
|
|
1448
1480
|
/**
|
|
1449
1481
|
* @deprecated in favor of `functionArgs` for @stacks/connect compatibility
|
|
1450
1482
|
*/
|
|
1451
|
-
arguments:
|
|
1483
|
+
arguments: v28.optional(v28.array(v28.string())),
|
|
1452
1484
|
/**
|
|
1453
1485
|
* The function's arguments. The arguments are expected to be hex-encoded
|
|
1454
1486
|
* strings of Clarity values.
|
|
@@ -1463,274 +1495,274 @@ var stxCallContractParamsSchema = v27.object({
|
|
|
1463
1495
|
* const hexArgs = functionArgs.map(cvToHex);
|
|
1464
1496
|
* ```
|
|
1465
1497
|
*/
|
|
1466
|
-
functionArgs:
|
|
1498
|
+
functionArgs: v28.optional(v28.array(v28.string())),
|
|
1467
1499
|
/**
|
|
1468
1500
|
* The post conditions to apply to the contract call.
|
|
1469
1501
|
*/
|
|
1470
|
-
postConditions:
|
|
1502
|
+
postConditions: v28.optional(v28.array(v28.string())),
|
|
1471
1503
|
/**
|
|
1472
1504
|
* The mode to apply to the post conditions.
|
|
1473
1505
|
*/
|
|
1474
|
-
postConditionMode:
|
|
1506
|
+
postConditionMode: v28.optional(v28.union([v28.literal("allow"), v28.literal("deny")]))
|
|
1475
1507
|
});
|
|
1476
|
-
var stxCallContractResultSchema =
|
|
1508
|
+
var stxCallContractResultSchema = v28.object({
|
|
1477
1509
|
/**
|
|
1478
1510
|
* The ID of the transaction.
|
|
1479
1511
|
*/
|
|
1480
|
-
txid:
|
|
1512
|
+
txid: v28.string(),
|
|
1481
1513
|
/**
|
|
1482
1514
|
* A Stacks transaction as a hex-encoded string.
|
|
1483
1515
|
*/
|
|
1484
|
-
transaction:
|
|
1516
|
+
transaction: v28.string()
|
|
1485
1517
|
});
|
|
1486
|
-
var stxCallContractRequestMessageSchema =
|
|
1518
|
+
var stxCallContractRequestMessageSchema = v28.object({
|
|
1487
1519
|
...rpcRequestMessageSchema.entries,
|
|
1488
|
-
...
|
|
1489
|
-
method:
|
|
1520
|
+
...v28.object({
|
|
1521
|
+
method: v28.literal(stxCallContractMethodName),
|
|
1490
1522
|
params: stxCallContractParamsSchema,
|
|
1491
|
-
id:
|
|
1523
|
+
id: v28.string()
|
|
1492
1524
|
}).entries
|
|
1493
1525
|
});
|
|
1494
1526
|
|
|
1495
1527
|
// src/request/types/stxMethods/deployContract.ts
|
|
1496
|
-
var
|
|
1528
|
+
var v29 = __toESM(require("valibot"));
|
|
1497
1529
|
var stxDeployContractMethodName = "stx_deployContract";
|
|
1498
|
-
var stxDeployContractParamsSchema =
|
|
1530
|
+
var stxDeployContractParamsSchema = v29.object({
|
|
1499
1531
|
/**
|
|
1500
1532
|
* Name of the contract.
|
|
1501
1533
|
*/
|
|
1502
|
-
name:
|
|
1534
|
+
name: v29.string(),
|
|
1503
1535
|
/**
|
|
1504
1536
|
* The source code of the Clarity contract.
|
|
1505
1537
|
*/
|
|
1506
|
-
clarityCode:
|
|
1538
|
+
clarityCode: v29.string(),
|
|
1507
1539
|
/**
|
|
1508
1540
|
* The version of the Clarity contract.
|
|
1509
1541
|
*/
|
|
1510
|
-
clarityVersion:
|
|
1542
|
+
clarityVersion: v29.optional(v29.number()),
|
|
1511
1543
|
/**
|
|
1512
1544
|
* The post conditions to apply to the contract call.
|
|
1513
1545
|
*/
|
|
1514
|
-
postConditions:
|
|
1546
|
+
postConditions: v29.optional(v29.array(v29.string())),
|
|
1515
1547
|
/**
|
|
1516
1548
|
* The mode to apply to the post conditions.
|
|
1517
1549
|
*/
|
|
1518
|
-
postConditionMode:
|
|
1550
|
+
postConditionMode: v29.optional(v29.union([v29.literal("allow"), v29.literal("deny")]))
|
|
1519
1551
|
});
|
|
1520
|
-
var stxDeployContractResultSchema =
|
|
1552
|
+
var stxDeployContractResultSchema = v29.object({
|
|
1521
1553
|
/**
|
|
1522
1554
|
* The ID of the transaction.
|
|
1523
1555
|
*/
|
|
1524
|
-
txid:
|
|
1556
|
+
txid: v29.string(),
|
|
1525
1557
|
/**
|
|
1526
1558
|
* A Stacks transaction as a hex-encoded string.
|
|
1527
1559
|
*/
|
|
1528
|
-
transaction:
|
|
1560
|
+
transaction: v29.string()
|
|
1529
1561
|
});
|
|
1530
|
-
var stxDeployContractRequestMessageSchema =
|
|
1562
|
+
var stxDeployContractRequestMessageSchema = v29.object({
|
|
1531
1563
|
...rpcRequestMessageSchema.entries,
|
|
1532
|
-
...
|
|
1533
|
-
method:
|
|
1564
|
+
...v29.object({
|
|
1565
|
+
method: v29.literal(stxDeployContractMethodName),
|
|
1534
1566
|
params: stxDeployContractParamsSchema,
|
|
1535
|
-
id:
|
|
1567
|
+
id: v29.string()
|
|
1536
1568
|
}).entries
|
|
1537
1569
|
});
|
|
1538
1570
|
|
|
1539
1571
|
// src/request/types/stxMethods/getAccounts.ts
|
|
1540
|
-
var
|
|
1572
|
+
var v30 = __toESM(require("valibot"));
|
|
1541
1573
|
var stxGetAccountsMethodName = "stx_getAccounts";
|
|
1542
|
-
var stxGetAccountsParamsSchema =
|
|
1543
|
-
var stxGetAccountsResultSchema =
|
|
1574
|
+
var stxGetAccountsParamsSchema = v30.nullish(v30.null());
|
|
1575
|
+
var stxGetAccountsResultSchema = v30.object({
|
|
1544
1576
|
/**
|
|
1545
1577
|
* The addresses generated for the given purposes.
|
|
1546
1578
|
*/
|
|
1547
|
-
addresses:
|
|
1548
|
-
|
|
1549
|
-
address:
|
|
1550
|
-
publicKey:
|
|
1551
|
-
gaiaHubUrl:
|
|
1552
|
-
gaiaAppKey:
|
|
1579
|
+
addresses: v30.array(
|
|
1580
|
+
v30.object({
|
|
1581
|
+
address: v30.string(),
|
|
1582
|
+
publicKey: v30.string(),
|
|
1583
|
+
gaiaHubUrl: v30.string(),
|
|
1584
|
+
gaiaAppKey: v30.string()
|
|
1553
1585
|
})
|
|
1554
1586
|
),
|
|
1555
1587
|
network: getNetworkResultSchema
|
|
1556
1588
|
});
|
|
1557
|
-
var stxGetAccountsRequestMessageSchema =
|
|
1589
|
+
var stxGetAccountsRequestMessageSchema = v30.object({
|
|
1558
1590
|
...rpcRequestMessageSchema.entries,
|
|
1559
|
-
...
|
|
1560
|
-
method:
|
|
1591
|
+
...v30.object({
|
|
1592
|
+
method: v30.literal(stxGetAccountsMethodName),
|
|
1561
1593
|
params: stxGetAccountsParamsSchema,
|
|
1562
|
-
id:
|
|
1594
|
+
id: v30.string()
|
|
1563
1595
|
}).entries
|
|
1564
1596
|
});
|
|
1565
1597
|
|
|
1566
1598
|
// src/request/types/stxMethods/getAddresses.ts
|
|
1567
|
-
var
|
|
1599
|
+
var v31 = __toESM(require("valibot"));
|
|
1568
1600
|
var stxGetAddressesMethodName = "stx_getAddresses";
|
|
1569
|
-
var stxGetAddressesParamsSchema =
|
|
1570
|
-
|
|
1601
|
+
var stxGetAddressesParamsSchema = v31.nullish(
|
|
1602
|
+
v31.object({
|
|
1571
1603
|
/**
|
|
1572
1604
|
* A message to be displayed to the user in the request prompt.
|
|
1573
1605
|
*/
|
|
1574
|
-
message:
|
|
1606
|
+
message: v31.optional(v31.string())
|
|
1575
1607
|
})
|
|
1576
1608
|
);
|
|
1577
|
-
var stxGetAddressesResultSchema =
|
|
1609
|
+
var stxGetAddressesResultSchema = v31.object({
|
|
1578
1610
|
/**
|
|
1579
1611
|
* The addresses generated for the given purposes.
|
|
1580
1612
|
*/
|
|
1581
|
-
addresses:
|
|
1613
|
+
addresses: v31.array(addressSchema),
|
|
1582
1614
|
network: getNetworkResultSchema
|
|
1583
1615
|
});
|
|
1584
|
-
var stxGetAddressesRequestMessageSchema =
|
|
1616
|
+
var stxGetAddressesRequestMessageSchema = v31.object({
|
|
1585
1617
|
...rpcRequestMessageSchema.entries,
|
|
1586
|
-
...
|
|
1587
|
-
method:
|
|
1618
|
+
...v31.object({
|
|
1619
|
+
method: v31.literal(stxGetAddressesMethodName),
|
|
1588
1620
|
params: stxGetAddressesParamsSchema,
|
|
1589
|
-
id:
|
|
1621
|
+
id: v31.string()
|
|
1590
1622
|
}).entries
|
|
1591
1623
|
});
|
|
1592
1624
|
|
|
1593
1625
|
// src/request/types/stxMethods/signMessage.ts
|
|
1594
|
-
var
|
|
1626
|
+
var v32 = __toESM(require("valibot"));
|
|
1595
1627
|
var stxSignMessageMethodName = "stx_signMessage";
|
|
1596
|
-
var stxSignMessageParamsSchema =
|
|
1628
|
+
var stxSignMessageParamsSchema = v32.object({
|
|
1597
1629
|
/**
|
|
1598
1630
|
* The message to sign.
|
|
1599
1631
|
*/
|
|
1600
|
-
message:
|
|
1632
|
+
message: v32.string()
|
|
1601
1633
|
});
|
|
1602
|
-
var stxSignMessageResultSchema =
|
|
1634
|
+
var stxSignMessageResultSchema = v32.object({
|
|
1603
1635
|
/**
|
|
1604
1636
|
* The signature of the message.
|
|
1605
1637
|
*/
|
|
1606
|
-
signature:
|
|
1638
|
+
signature: v32.string(),
|
|
1607
1639
|
/**
|
|
1608
1640
|
* The public key used to sign the message.
|
|
1609
1641
|
*/
|
|
1610
|
-
publicKey:
|
|
1642
|
+
publicKey: v32.string()
|
|
1611
1643
|
});
|
|
1612
|
-
var stxSignMessageRequestMessageSchema =
|
|
1644
|
+
var stxSignMessageRequestMessageSchema = v32.object({
|
|
1613
1645
|
...rpcRequestMessageSchema.entries,
|
|
1614
|
-
...
|
|
1615
|
-
method:
|
|
1646
|
+
...v32.object({
|
|
1647
|
+
method: v32.literal(stxSignMessageMethodName),
|
|
1616
1648
|
params: stxSignMessageParamsSchema,
|
|
1617
|
-
id:
|
|
1649
|
+
id: v32.string()
|
|
1618
1650
|
}).entries
|
|
1619
1651
|
});
|
|
1620
1652
|
|
|
1621
1653
|
// src/request/types/stxMethods/signStructuredMessage.ts
|
|
1622
|
-
var
|
|
1654
|
+
var v33 = __toESM(require("valibot"));
|
|
1623
1655
|
var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
|
|
1624
|
-
var stxSignStructuredMessageParamsSchema =
|
|
1656
|
+
var stxSignStructuredMessageParamsSchema = v33.object({
|
|
1625
1657
|
/**
|
|
1626
1658
|
* The domain to be signed.
|
|
1627
1659
|
*/
|
|
1628
|
-
domain:
|
|
1660
|
+
domain: v33.string(),
|
|
1629
1661
|
/**
|
|
1630
1662
|
* Message payload to be signed.
|
|
1631
1663
|
*/
|
|
1632
|
-
message:
|
|
1664
|
+
message: v33.string(),
|
|
1633
1665
|
/**
|
|
1634
1666
|
* The public key to sign the message with.
|
|
1635
1667
|
*/
|
|
1636
|
-
publicKey:
|
|
1668
|
+
publicKey: v33.optional(v33.string())
|
|
1637
1669
|
});
|
|
1638
|
-
var stxSignStructuredMessageResultSchema =
|
|
1670
|
+
var stxSignStructuredMessageResultSchema = v33.object({
|
|
1639
1671
|
/**
|
|
1640
1672
|
* Signature of the message.
|
|
1641
1673
|
*/
|
|
1642
|
-
signature:
|
|
1674
|
+
signature: v33.string(),
|
|
1643
1675
|
/**
|
|
1644
1676
|
* Public key as hex-encoded string.
|
|
1645
1677
|
*/
|
|
1646
|
-
publicKey:
|
|
1678
|
+
publicKey: v33.string()
|
|
1647
1679
|
});
|
|
1648
|
-
var stxSignStructuredMessageRequestMessageSchema =
|
|
1680
|
+
var stxSignStructuredMessageRequestMessageSchema = v33.object({
|
|
1649
1681
|
...rpcRequestMessageSchema.entries,
|
|
1650
|
-
...
|
|
1651
|
-
method:
|
|
1682
|
+
...v33.object({
|
|
1683
|
+
method: v33.literal(stxSignStructuredMessageMethodName),
|
|
1652
1684
|
params: stxSignStructuredMessageParamsSchema,
|
|
1653
|
-
id:
|
|
1685
|
+
id: v33.string()
|
|
1654
1686
|
}).entries
|
|
1655
1687
|
});
|
|
1656
1688
|
|
|
1657
1689
|
// src/request/types/stxMethods/signTransaction.ts
|
|
1658
|
-
var
|
|
1690
|
+
var v34 = __toESM(require("valibot"));
|
|
1659
1691
|
var stxSignTransactionMethodName = "stx_signTransaction";
|
|
1660
|
-
var stxSignTransactionParamsSchema =
|
|
1692
|
+
var stxSignTransactionParamsSchema = v34.object({
|
|
1661
1693
|
/**
|
|
1662
1694
|
* The transaction to sign as a hex-encoded string.
|
|
1663
1695
|
*/
|
|
1664
|
-
transaction:
|
|
1696
|
+
transaction: v34.string(),
|
|
1665
1697
|
/**
|
|
1666
1698
|
* The public key to sign the transaction with. The wallet may use any key
|
|
1667
1699
|
* when not provided.
|
|
1668
1700
|
*/
|
|
1669
|
-
pubkey:
|
|
1701
|
+
pubkey: v34.optional(v34.string()),
|
|
1670
1702
|
/**
|
|
1671
1703
|
* Whether to broadcast the transaction after signing. Defaults to `true`.
|
|
1672
1704
|
*/
|
|
1673
|
-
broadcast:
|
|
1705
|
+
broadcast: v34.optional(v34.boolean())
|
|
1674
1706
|
});
|
|
1675
|
-
var stxSignTransactionResultSchema =
|
|
1707
|
+
var stxSignTransactionResultSchema = v34.object({
|
|
1676
1708
|
/**
|
|
1677
1709
|
* The signed transaction as a hex-encoded string.
|
|
1678
1710
|
*/
|
|
1679
|
-
transaction:
|
|
1711
|
+
transaction: v34.string()
|
|
1680
1712
|
});
|
|
1681
|
-
var stxSignTransactionRequestMessageSchema =
|
|
1713
|
+
var stxSignTransactionRequestMessageSchema = v34.object({
|
|
1682
1714
|
...rpcRequestMessageSchema.entries,
|
|
1683
|
-
...
|
|
1684
|
-
method:
|
|
1715
|
+
...v34.object({
|
|
1716
|
+
method: v34.literal(stxSignTransactionMethodName),
|
|
1685
1717
|
params: stxSignTransactionParamsSchema,
|
|
1686
|
-
id:
|
|
1718
|
+
id: v34.string()
|
|
1687
1719
|
}).entries
|
|
1688
1720
|
});
|
|
1689
1721
|
|
|
1690
1722
|
// src/request/types/stxMethods/signTransactions.ts
|
|
1691
|
-
var
|
|
1723
|
+
var v35 = __toESM(require("valibot"));
|
|
1692
1724
|
var stxSignTransactionsMethodName = "stx_signTransactions";
|
|
1693
|
-
var stxSignTransactionsParamsSchema =
|
|
1725
|
+
var stxSignTransactionsParamsSchema = v35.object({
|
|
1694
1726
|
/**
|
|
1695
1727
|
* The transactions to sign as hex-encoded strings.
|
|
1696
1728
|
*/
|
|
1697
|
-
transactions:
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1729
|
+
transactions: v35.pipe(
|
|
1730
|
+
v35.array(
|
|
1731
|
+
v35.pipe(
|
|
1732
|
+
v35.string(),
|
|
1733
|
+
v35.check((hex) => {
|
|
1702
1734
|
return true;
|
|
1703
1735
|
}, "Invalid hex-encoded Stacks transaction.")
|
|
1704
1736
|
)
|
|
1705
1737
|
),
|
|
1706
|
-
|
|
1738
|
+
v35.minLength(1)
|
|
1707
1739
|
),
|
|
1708
1740
|
/**
|
|
1709
1741
|
* Whether the signed transactions should be broadcast after signing. Defaults
|
|
1710
1742
|
* to `true`.
|
|
1711
1743
|
*/
|
|
1712
|
-
broadcast:
|
|
1744
|
+
broadcast: v35.optional(v35.boolean())
|
|
1713
1745
|
});
|
|
1714
|
-
var stxSignTransactionsResultSchema =
|
|
1746
|
+
var stxSignTransactionsResultSchema = v35.object({
|
|
1715
1747
|
/**
|
|
1716
1748
|
* The signed transactions as hex-encoded strings, in the same order as in the
|
|
1717
1749
|
* sign request.
|
|
1718
1750
|
*/
|
|
1719
|
-
transactions:
|
|
1751
|
+
transactions: v35.array(v35.string())
|
|
1720
1752
|
});
|
|
1721
|
-
var stxSignTransactionsRequestMessageSchema =
|
|
1753
|
+
var stxSignTransactionsRequestMessageSchema = v35.object({
|
|
1722
1754
|
...rpcRequestMessageSchema.entries,
|
|
1723
|
-
...
|
|
1724
|
-
method:
|
|
1755
|
+
...v35.object({
|
|
1756
|
+
method: v35.literal(stxSignTransactionsMethodName),
|
|
1725
1757
|
params: stxSignTransactionsParamsSchema,
|
|
1726
|
-
id:
|
|
1758
|
+
id: v35.string()
|
|
1727
1759
|
}).entries
|
|
1728
1760
|
});
|
|
1729
1761
|
|
|
1730
1762
|
// src/request/types/stxMethods/transferStx.ts
|
|
1731
|
-
var
|
|
1763
|
+
var v36 = __toESM(require("valibot"));
|
|
1732
1764
|
var stxTransferStxMethodName = "stx_transferStx";
|
|
1733
|
-
var stxTransferStxParamsSchema =
|
|
1765
|
+
var stxTransferStxParamsSchema = v36.object({
|
|
1734
1766
|
/**
|
|
1735
1767
|
* Amount of STX tokens to transfer in microstacks as a string. Anything
|
|
1736
1768
|
* parseable by `BigInt` is acceptable.
|
|
@@ -1743,23 +1775,23 @@ var stxTransferStxParamsSchema = v35.object({
|
|
|
1743
1775
|
* const amount3 = '1234';
|
|
1744
1776
|
* ```
|
|
1745
1777
|
*/
|
|
1746
|
-
amount:
|
|
1778
|
+
amount: v36.union([v36.number(), v36.string()]),
|
|
1747
1779
|
/**
|
|
1748
1780
|
* The recipient's principal.
|
|
1749
1781
|
*/
|
|
1750
|
-
recipient:
|
|
1782
|
+
recipient: v36.string(),
|
|
1751
1783
|
/**
|
|
1752
1784
|
* A string representing the memo.
|
|
1753
1785
|
*/
|
|
1754
|
-
memo:
|
|
1786
|
+
memo: v36.optional(v36.string()),
|
|
1755
1787
|
/**
|
|
1756
1788
|
* Version of parameter format.
|
|
1757
1789
|
*/
|
|
1758
|
-
version:
|
|
1790
|
+
version: v36.optional(v36.string()),
|
|
1759
1791
|
/**
|
|
1760
1792
|
* The mode of the post conditions.
|
|
1761
1793
|
*/
|
|
1762
|
-
postConditionMode:
|
|
1794
|
+
postConditionMode: v36.optional(v36.number()),
|
|
1763
1795
|
/**
|
|
1764
1796
|
* A hex-encoded string representing the post conditions.
|
|
1765
1797
|
*
|
|
@@ -1772,29 +1804,29 @@ var stxTransferStxParamsSchema = v35.object({
|
|
|
1772
1804
|
* const hexPostCondition = serializePostCondition(postCondition).toString('hex');
|
|
1773
1805
|
* ```
|
|
1774
1806
|
*/
|
|
1775
|
-
postConditions:
|
|
1807
|
+
postConditions: v36.optional(v36.array(v36.string())),
|
|
1776
1808
|
/**
|
|
1777
1809
|
* The public key to sign the transaction with. The wallet may use any key
|
|
1778
1810
|
* when not provided.
|
|
1779
1811
|
*/
|
|
1780
|
-
pubkey:
|
|
1812
|
+
pubkey: v36.optional(v36.string())
|
|
1781
1813
|
});
|
|
1782
|
-
var stxTransferStxResultSchema =
|
|
1814
|
+
var stxTransferStxResultSchema = v36.object({
|
|
1783
1815
|
/**
|
|
1784
1816
|
* The ID of the transaction.
|
|
1785
1817
|
*/
|
|
1786
|
-
txid:
|
|
1818
|
+
txid: v36.string(),
|
|
1787
1819
|
/**
|
|
1788
1820
|
* A Stacks transaction as a hex-encoded string.
|
|
1789
1821
|
*/
|
|
1790
|
-
transaction:
|
|
1822
|
+
transaction: v36.string()
|
|
1791
1823
|
});
|
|
1792
|
-
var stxTransferStxRequestMessageSchema =
|
|
1824
|
+
var stxTransferStxRequestMessageSchema = v36.object({
|
|
1793
1825
|
...rpcRequestMessageSchema.entries,
|
|
1794
|
-
...
|
|
1795
|
-
method:
|
|
1826
|
+
...v36.object({
|
|
1827
|
+
method: v36.literal(stxTransferStxMethodName),
|
|
1796
1828
|
params: stxTransferStxParamsSchema,
|
|
1797
|
-
id:
|
|
1829
|
+
id: v36.string()
|
|
1798
1830
|
}).entries
|
|
1799
1831
|
});
|
|
1800
1832
|
|
|
@@ -1802,13 +1834,13 @@ var stxTransferStxRequestMessageSchema = v35.object({
|
|
|
1802
1834
|
var cache = {};
|
|
1803
1835
|
var requestInternal = async (provider, method, params) => {
|
|
1804
1836
|
const response = await provider.request(method, params);
|
|
1805
|
-
if (
|
|
1837
|
+
if (v37.is(rpcErrorResponseMessageSchema, response)) {
|
|
1806
1838
|
return {
|
|
1807
1839
|
status: "error",
|
|
1808
1840
|
error: response.error
|
|
1809
1841
|
};
|
|
1810
1842
|
}
|
|
1811
|
-
if (
|
|
1843
|
+
if (v37.is(rpcSuccessResponseMessageSchema, response)) {
|
|
1812
1844
|
return {
|
|
1813
1845
|
status: "success",
|
|
1814
1846
|
result: response.result
|
|
@@ -3025,6 +3057,10 @@ var signMultipleTransactions = async (options) => {
|
|
|
3025
3057
|
sparkGetBalanceParamsSchema,
|
|
3026
3058
|
sparkGetBalanceRequestMessageSchema,
|
|
3027
3059
|
sparkGetBalanceResultSchema,
|
|
3060
|
+
sparkSignMessageMethodName,
|
|
3061
|
+
sparkSignMessageParamsSchema,
|
|
3062
|
+
sparkSignMessageRequestMessageSchema,
|
|
3063
|
+
sparkSignMessageResultSchema,
|
|
3028
3064
|
sparkTransferMethodName,
|
|
3029
3065
|
sparkTransferParamsSchema,
|
|
3030
3066
|
sparkTransferRequestMessageSchema,
|