@capxul/mcp 2.0.0 → 2.0.1
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/main.mjs +731 -77
- package/package.json +3 -3
package/dist/main.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { createHash, randomBytes } from "node:crypto";
|
|
|
7
7
|
import { createServer } from "node:http";
|
|
8
8
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
9
9
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
10
|
-
import { concat, concatHex, createPublicClient, createWalletClient, custom, decodeAbiParameters, decodeFunctionData, decodeFunctionResult, encodeAbiParameters, encodeFunctionData, encodePacked, formatUnits, getAddress, getContractAddress, hashMessage, hashTypedData, hexToBigInt, http, isAddress, isHex, keccak256, pad, padHex, parseUnits, recoverAddress, size, slice, stringToHex, toBytes, toEventSelector, toFunctionSelector, toHex, zeroAddress } from "viem";
|
|
10
|
+
import { concat, concatHex, createPublicClient, createWalletClient, custom, decodeAbiParameters, decodeFunctionData, decodeFunctionResult, encodeAbiParameters, encodeFunctionData, encodePacked, formatUnits, getAddress, getContractAddress, hashMessage, hashTypedData, hexToBigInt, http, isAddress, isHex, keccak256, pad, padHex, parseUnits, recoverAddress, size, slice, stringToHex, toBytes, toEventSelector, toFunctionSelector, toFunctionSignature, toHex, zeroAddress } from "viem";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { Cause, Context, Data, Deferred, Effect, Exit, Fiber, Layer, Queue, Ref, Result, Schema, SchemaGetter, SchemaIssue, SchemaParser, Scope, Struct, Tracer } from "effect";
|
|
13
13
|
import { privateKeyToAccount, toAccount } from "viem/accounts";
|
|
@@ -240,7 +240,7 @@ function normalizeEmail(email) {
|
|
|
240
240
|
}
|
|
241
241
|
//#endregion
|
|
242
242
|
//#region package.json
|
|
243
|
-
var version$2 = "2.0.
|
|
243
|
+
var version$2 = "2.0.1";
|
|
244
244
|
//#endregion
|
|
245
245
|
//#region ../../packages/errors/src/errors.ts
|
|
246
246
|
const CAPXUL_ERROR_CODES = [
|
|
@@ -1271,6 +1271,12 @@ const EXEC_TRANSACTION_WITH_ROLE = "zodiac.roles.execTransactionWithRole";
|
|
|
1271
1271
|
const ASSIGN_ROLES = "zodiac.roles.assignRoles";
|
|
1272
1272
|
const SCOPE_TARGET = "zodiac.roles.scopeTarget";
|
|
1273
1273
|
const OWNER_ROLE_LABEL = "Owner";
|
|
1274
|
+
const FOUNDER_BUDGET_ROLE_LABEL = "Founder Budget";
|
|
1275
|
+
const FOUNDER_BUDGET_LIMIT = {
|
|
1276
|
+
currency: "USD",
|
|
1277
|
+
value: "1000000000000",
|
|
1278
|
+
decimals: 6
|
|
1279
|
+
};
|
|
1274
1280
|
function usd(value) {
|
|
1275
1281
|
return {
|
|
1276
1282
|
currency: "USD",
|
|
@@ -1310,6 +1316,13 @@ function soloOrgRoleTemplate() {
|
|
|
1310
1316
|
label: "Owner",
|
|
1311
1317
|
canManageMembers: true,
|
|
1312
1318
|
canManageRoles: true
|
|
1319
|
+
}, {
|
|
1320
|
+
label: FOUNDER_BUDGET_ROLE_LABEL,
|
|
1321
|
+
spend: {
|
|
1322
|
+
perTx: FOUNDER_BUDGET_LIMIT,
|
|
1323
|
+
perDay: FOUNDER_BUDGET_LIMIT,
|
|
1324
|
+
toRecipients: "anyone"
|
|
1325
|
+
}
|
|
1313
1326
|
}];
|
|
1314
1327
|
}
|
|
1315
1328
|
function startupOrgRoleTemplate() {
|
|
@@ -1376,6 +1389,632 @@ function compileOrgRoleDefinitions(definitions) {
|
|
|
1376
1389
|
}
|
|
1377
1390
|
};
|
|
1378
1391
|
}
|
|
1392
|
+
//#endregion
|
|
1393
|
+
//#region ../../packages/config/src/capxul-payments-v2.ts
|
|
1394
|
+
/** The exact compiled CapxulPaymentsV2 ABI. */
|
|
1395
|
+
const CAPXUL_PAYMENTS_V2_ABI = [
|
|
1396
|
+
{
|
|
1397
|
+
type: "function",
|
|
1398
|
+
name: "cancel",
|
|
1399
|
+
inputs: [{
|
|
1400
|
+
name: "commitmentId",
|
|
1401
|
+
type: "uint256",
|
|
1402
|
+
internalType: "uint256"
|
|
1403
|
+
}, {
|
|
1404
|
+
name: "documentHash",
|
|
1405
|
+
type: "bytes32",
|
|
1406
|
+
internalType: "bytes32"
|
|
1407
|
+
}],
|
|
1408
|
+
outputs: [],
|
|
1409
|
+
stateMutability: "nonpayable"
|
|
1410
|
+
},
|
|
1411
|
+
{
|
|
1412
|
+
type: "function",
|
|
1413
|
+
name: "claim",
|
|
1414
|
+
inputs: [{
|
|
1415
|
+
name: "commitmentId",
|
|
1416
|
+
type: "uint256",
|
|
1417
|
+
internalType: "uint256"
|
|
1418
|
+
}],
|
|
1419
|
+
outputs: [],
|
|
1420
|
+
stateMutability: "nonpayable"
|
|
1421
|
+
},
|
|
1422
|
+
{
|
|
1423
|
+
type: "function",
|
|
1424
|
+
name: "claimableAmount",
|
|
1425
|
+
inputs: [{
|
|
1426
|
+
name: "commitmentId",
|
|
1427
|
+
type: "uint256",
|
|
1428
|
+
internalType: "uint256"
|
|
1429
|
+
}],
|
|
1430
|
+
outputs: [{
|
|
1431
|
+
name: "",
|
|
1432
|
+
type: "uint256",
|
|
1433
|
+
internalType: "uint256"
|
|
1434
|
+
}],
|
|
1435
|
+
stateMutability: "view"
|
|
1436
|
+
},
|
|
1437
|
+
{
|
|
1438
|
+
type: "function",
|
|
1439
|
+
name: "commitments",
|
|
1440
|
+
inputs: [{
|
|
1441
|
+
name: "",
|
|
1442
|
+
type: "uint256",
|
|
1443
|
+
internalType: "uint256"
|
|
1444
|
+
}],
|
|
1445
|
+
outputs: [
|
|
1446
|
+
{
|
|
1447
|
+
name: "settlementId",
|
|
1448
|
+
type: "bytes32",
|
|
1449
|
+
internalType: "bytes32"
|
|
1450
|
+
},
|
|
1451
|
+
{
|
|
1452
|
+
name: "creator",
|
|
1453
|
+
type: "address",
|
|
1454
|
+
internalType: "address"
|
|
1455
|
+
},
|
|
1456
|
+
{
|
|
1457
|
+
name: "recipient",
|
|
1458
|
+
type: "address",
|
|
1459
|
+
internalType: "address"
|
|
1460
|
+
},
|
|
1461
|
+
{
|
|
1462
|
+
name: "token",
|
|
1463
|
+
type: "address",
|
|
1464
|
+
internalType: "address"
|
|
1465
|
+
},
|
|
1466
|
+
{
|
|
1467
|
+
name: "totalAmount",
|
|
1468
|
+
type: "uint256",
|
|
1469
|
+
internalType: "uint256"
|
|
1470
|
+
},
|
|
1471
|
+
{
|
|
1472
|
+
name: "claimed",
|
|
1473
|
+
type: "uint256",
|
|
1474
|
+
internalType: "uint256"
|
|
1475
|
+
},
|
|
1476
|
+
{
|
|
1477
|
+
name: "startTime",
|
|
1478
|
+
type: "uint48",
|
|
1479
|
+
internalType: "uint48"
|
|
1480
|
+
},
|
|
1481
|
+
{
|
|
1482
|
+
name: "cliffTime",
|
|
1483
|
+
type: "uint48",
|
|
1484
|
+
internalType: "uint48"
|
|
1485
|
+
},
|
|
1486
|
+
{
|
|
1487
|
+
name: "endTime",
|
|
1488
|
+
type: "uint48",
|
|
1489
|
+
internalType: "uint48"
|
|
1490
|
+
},
|
|
1491
|
+
{
|
|
1492
|
+
name: "kind",
|
|
1493
|
+
type: "uint16",
|
|
1494
|
+
internalType: "uint16"
|
|
1495
|
+
},
|
|
1496
|
+
{
|
|
1497
|
+
name: "documentHash",
|
|
1498
|
+
type: "bytes32",
|
|
1499
|
+
internalType: "bytes32"
|
|
1500
|
+
},
|
|
1501
|
+
{
|
|
1502
|
+
name: "cancelled",
|
|
1503
|
+
type: "bool",
|
|
1504
|
+
internalType: "bool"
|
|
1505
|
+
}
|
|
1506
|
+
],
|
|
1507
|
+
stateMutability: "view"
|
|
1508
|
+
},
|
|
1509
|
+
{
|
|
1510
|
+
type: "function",
|
|
1511
|
+
name: "createCommitment",
|
|
1512
|
+
inputs: [{
|
|
1513
|
+
name: "input",
|
|
1514
|
+
type: "tuple",
|
|
1515
|
+
internalType: "struct CapxulPaymentsV2.CommitmentInput",
|
|
1516
|
+
components: [
|
|
1517
|
+
{
|
|
1518
|
+
name: "settlementId",
|
|
1519
|
+
type: "bytes32",
|
|
1520
|
+
internalType: "bytes32"
|
|
1521
|
+
},
|
|
1522
|
+
{
|
|
1523
|
+
name: "recipient",
|
|
1524
|
+
type: "address",
|
|
1525
|
+
internalType: "address"
|
|
1526
|
+
},
|
|
1527
|
+
{
|
|
1528
|
+
name: "token",
|
|
1529
|
+
type: "address",
|
|
1530
|
+
internalType: "address"
|
|
1531
|
+
},
|
|
1532
|
+
{
|
|
1533
|
+
name: "totalAmount",
|
|
1534
|
+
type: "uint256",
|
|
1535
|
+
internalType: "uint256"
|
|
1536
|
+
},
|
|
1537
|
+
{
|
|
1538
|
+
name: "startTime",
|
|
1539
|
+
type: "uint48",
|
|
1540
|
+
internalType: "uint48"
|
|
1541
|
+
},
|
|
1542
|
+
{
|
|
1543
|
+
name: "cliffTime",
|
|
1544
|
+
type: "uint48",
|
|
1545
|
+
internalType: "uint48"
|
|
1546
|
+
},
|
|
1547
|
+
{
|
|
1548
|
+
name: "endTime",
|
|
1549
|
+
type: "uint48",
|
|
1550
|
+
internalType: "uint48"
|
|
1551
|
+
},
|
|
1552
|
+
{
|
|
1553
|
+
name: "kind",
|
|
1554
|
+
type: "uint16",
|
|
1555
|
+
internalType: "uint16"
|
|
1556
|
+
},
|
|
1557
|
+
{
|
|
1558
|
+
name: "documentHash",
|
|
1559
|
+
type: "bytes32",
|
|
1560
|
+
internalType: "bytes32"
|
|
1561
|
+
}
|
|
1562
|
+
]
|
|
1563
|
+
}],
|
|
1564
|
+
outputs: [{
|
|
1565
|
+
name: "commitmentId",
|
|
1566
|
+
type: "uint256",
|
|
1567
|
+
internalType: "uint256"
|
|
1568
|
+
}],
|
|
1569
|
+
stateMutability: "nonpayable"
|
|
1570
|
+
},
|
|
1571
|
+
{
|
|
1572
|
+
type: "function",
|
|
1573
|
+
name: "nextCommitmentId",
|
|
1574
|
+
inputs: [],
|
|
1575
|
+
outputs: [{
|
|
1576
|
+
name: "",
|
|
1577
|
+
type: "uint256",
|
|
1578
|
+
internalType: "uint256"
|
|
1579
|
+
}],
|
|
1580
|
+
stateMutability: "view"
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
type: "function",
|
|
1584
|
+
name: "redirect",
|
|
1585
|
+
inputs: [
|
|
1586
|
+
{
|
|
1587
|
+
name: "commitmentId",
|
|
1588
|
+
type: "uint256",
|
|
1589
|
+
internalType: "uint256"
|
|
1590
|
+
},
|
|
1591
|
+
{
|
|
1592
|
+
name: "recipient",
|
|
1593
|
+
type: "address",
|
|
1594
|
+
internalType: "address"
|
|
1595
|
+
},
|
|
1596
|
+
{
|
|
1597
|
+
name: "documentHash",
|
|
1598
|
+
type: "bytes32",
|
|
1599
|
+
internalType: "bytes32"
|
|
1600
|
+
}
|
|
1601
|
+
],
|
|
1602
|
+
outputs: [],
|
|
1603
|
+
stateMutability: "nonpayable"
|
|
1604
|
+
},
|
|
1605
|
+
{
|
|
1606
|
+
type: "function",
|
|
1607
|
+
name: "send",
|
|
1608
|
+
inputs: [{
|
|
1609
|
+
name: "item",
|
|
1610
|
+
type: "tuple",
|
|
1611
|
+
internalType: "struct CapxulPaymentsV2.PaymentItem",
|
|
1612
|
+
components: [
|
|
1613
|
+
{
|
|
1614
|
+
name: "settlementId",
|
|
1615
|
+
type: "bytes32",
|
|
1616
|
+
internalType: "bytes32"
|
|
1617
|
+
},
|
|
1618
|
+
{
|
|
1619
|
+
name: "recipient",
|
|
1620
|
+
type: "address",
|
|
1621
|
+
internalType: "address"
|
|
1622
|
+
},
|
|
1623
|
+
{
|
|
1624
|
+
name: "token",
|
|
1625
|
+
type: "address",
|
|
1626
|
+
internalType: "address"
|
|
1627
|
+
},
|
|
1628
|
+
{
|
|
1629
|
+
name: "amount",
|
|
1630
|
+
type: "uint256",
|
|
1631
|
+
internalType: "uint256"
|
|
1632
|
+
},
|
|
1633
|
+
{
|
|
1634
|
+
name: "kind",
|
|
1635
|
+
type: "uint16",
|
|
1636
|
+
internalType: "uint16"
|
|
1637
|
+
},
|
|
1638
|
+
{
|
|
1639
|
+
name: "documentHash",
|
|
1640
|
+
type: "bytes32",
|
|
1641
|
+
internalType: "bytes32"
|
|
1642
|
+
}
|
|
1643
|
+
]
|
|
1644
|
+
}],
|
|
1645
|
+
outputs: [],
|
|
1646
|
+
stateMutability: "nonpayable"
|
|
1647
|
+
},
|
|
1648
|
+
{
|
|
1649
|
+
type: "function",
|
|
1650
|
+
name: "sendBatch",
|
|
1651
|
+
inputs: [{
|
|
1652
|
+
name: "items",
|
|
1653
|
+
type: "tuple[]",
|
|
1654
|
+
internalType: "struct CapxulPaymentsV2.PaymentItem[]",
|
|
1655
|
+
components: [
|
|
1656
|
+
{
|
|
1657
|
+
name: "settlementId",
|
|
1658
|
+
type: "bytes32",
|
|
1659
|
+
internalType: "bytes32"
|
|
1660
|
+
},
|
|
1661
|
+
{
|
|
1662
|
+
name: "recipient",
|
|
1663
|
+
type: "address",
|
|
1664
|
+
internalType: "address"
|
|
1665
|
+
},
|
|
1666
|
+
{
|
|
1667
|
+
name: "token",
|
|
1668
|
+
type: "address",
|
|
1669
|
+
internalType: "address"
|
|
1670
|
+
},
|
|
1671
|
+
{
|
|
1672
|
+
name: "amount",
|
|
1673
|
+
type: "uint256",
|
|
1674
|
+
internalType: "uint256"
|
|
1675
|
+
},
|
|
1676
|
+
{
|
|
1677
|
+
name: "kind",
|
|
1678
|
+
type: "uint16",
|
|
1679
|
+
internalType: "uint16"
|
|
1680
|
+
},
|
|
1681
|
+
{
|
|
1682
|
+
name: "documentHash",
|
|
1683
|
+
type: "bytes32",
|
|
1684
|
+
internalType: "bytes32"
|
|
1685
|
+
}
|
|
1686
|
+
]
|
|
1687
|
+
}],
|
|
1688
|
+
outputs: [],
|
|
1689
|
+
stateMutability: "nonpayable"
|
|
1690
|
+
},
|
|
1691
|
+
{
|
|
1692
|
+
type: "function",
|
|
1693
|
+
name: "vestedAmount",
|
|
1694
|
+
inputs: [{
|
|
1695
|
+
name: "commitmentId",
|
|
1696
|
+
type: "uint256",
|
|
1697
|
+
internalType: "uint256"
|
|
1698
|
+
}],
|
|
1699
|
+
outputs: [{
|
|
1700
|
+
name: "",
|
|
1701
|
+
type: "uint256",
|
|
1702
|
+
internalType: "uint256"
|
|
1703
|
+
}],
|
|
1704
|
+
stateMutability: "view"
|
|
1705
|
+
},
|
|
1706
|
+
{
|
|
1707
|
+
type: "event",
|
|
1708
|
+
name: "CommitmentCancelled",
|
|
1709
|
+
inputs: [
|
|
1710
|
+
{
|
|
1711
|
+
name: "commitmentId",
|
|
1712
|
+
type: "uint256",
|
|
1713
|
+
indexed: true,
|
|
1714
|
+
internalType: "uint256"
|
|
1715
|
+
},
|
|
1716
|
+
{
|
|
1717
|
+
name: "settlementId",
|
|
1718
|
+
type: "bytes32",
|
|
1719
|
+
indexed: true,
|
|
1720
|
+
internalType: "bytes32"
|
|
1721
|
+
},
|
|
1722
|
+
{
|
|
1723
|
+
name: "creator",
|
|
1724
|
+
type: "address",
|
|
1725
|
+
indexed: true,
|
|
1726
|
+
internalType: "address"
|
|
1727
|
+
},
|
|
1728
|
+
{
|
|
1729
|
+
name: "vestedUnclaimed",
|
|
1730
|
+
type: "uint256",
|
|
1731
|
+
indexed: false,
|
|
1732
|
+
internalType: "uint256"
|
|
1733
|
+
},
|
|
1734
|
+
{
|
|
1735
|
+
name: "unvestedReturned",
|
|
1736
|
+
type: "uint256",
|
|
1737
|
+
indexed: false,
|
|
1738
|
+
internalType: "uint256"
|
|
1739
|
+
},
|
|
1740
|
+
{
|
|
1741
|
+
name: "documentHash",
|
|
1742
|
+
type: "bytes32",
|
|
1743
|
+
indexed: false,
|
|
1744
|
+
internalType: "bytes32"
|
|
1745
|
+
}
|
|
1746
|
+
],
|
|
1747
|
+
anonymous: false
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
type: "event",
|
|
1751
|
+
name: "CommitmentCreated",
|
|
1752
|
+
inputs: [
|
|
1753
|
+
{
|
|
1754
|
+
name: "commitmentId",
|
|
1755
|
+
type: "uint256",
|
|
1756
|
+
indexed: true,
|
|
1757
|
+
internalType: "uint256"
|
|
1758
|
+
},
|
|
1759
|
+
{
|
|
1760
|
+
name: "settlementId",
|
|
1761
|
+
type: "bytes32",
|
|
1762
|
+
indexed: true,
|
|
1763
|
+
internalType: "bytes32"
|
|
1764
|
+
},
|
|
1765
|
+
{
|
|
1766
|
+
name: "creator",
|
|
1767
|
+
type: "address",
|
|
1768
|
+
indexed: true,
|
|
1769
|
+
internalType: "address"
|
|
1770
|
+
},
|
|
1771
|
+
{
|
|
1772
|
+
name: "recipient",
|
|
1773
|
+
type: "address",
|
|
1774
|
+
indexed: false,
|
|
1775
|
+
internalType: "address"
|
|
1776
|
+
},
|
|
1777
|
+
{
|
|
1778
|
+
name: "token",
|
|
1779
|
+
type: "address",
|
|
1780
|
+
indexed: false,
|
|
1781
|
+
internalType: "address"
|
|
1782
|
+
},
|
|
1783
|
+
{
|
|
1784
|
+
name: "totalAmount",
|
|
1785
|
+
type: "uint256",
|
|
1786
|
+
indexed: false,
|
|
1787
|
+
internalType: "uint256"
|
|
1788
|
+
},
|
|
1789
|
+
{
|
|
1790
|
+
name: "startTime",
|
|
1791
|
+
type: "uint48",
|
|
1792
|
+
indexed: false,
|
|
1793
|
+
internalType: "uint48"
|
|
1794
|
+
},
|
|
1795
|
+
{
|
|
1796
|
+
name: "cliffTime",
|
|
1797
|
+
type: "uint48",
|
|
1798
|
+
indexed: false,
|
|
1799
|
+
internalType: "uint48"
|
|
1800
|
+
},
|
|
1801
|
+
{
|
|
1802
|
+
name: "endTime",
|
|
1803
|
+
type: "uint48",
|
|
1804
|
+
indexed: false,
|
|
1805
|
+
internalType: "uint48"
|
|
1806
|
+
},
|
|
1807
|
+
{
|
|
1808
|
+
name: "kind",
|
|
1809
|
+
type: "uint16",
|
|
1810
|
+
indexed: false,
|
|
1811
|
+
internalType: "uint16"
|
|
1812
|
+
},
|
|
1813
|
+
{
|
|
1814
|
+
name: "documentHash",
|
|
1815
|
+
type: "bytes32",
|
|
1816
|
+
indexed: false,
|
|
1817
|
+
internalType: "bytes32"
|
|
1818
|
+
}
|
|
1819
|
+
],
|
|
1820
|
+
anonymous: false
|
|
1821
|
+
},
|
|
1822
|
+
{
|
|
1823
|
+
type: "event",
|
|
1824
|
+
name: "CommitmentRedirected",
|
|
1825
|
+
inputs: [
|
|
1826
|
+
{
|
|
1827
|
+
name: "commitmentId",
|
|
1828
|
+
type: "uint256",
|
|
1829
|
+
indexed: true,
|
|
1830
|
+
internalType: "uint256"
|
|
1831
|
+
},
|
|
1832
|
+
{
|
|
1833
|
+
name: "settlementId",
|
|
1834
|
+
type: "bytes32",
|
|
1835
|
+
indexed: true,
|
|
1836
|
+
internalType: "bytes32"
|
|
1837
|
+
},
|
|
1838
|
+
{
|
|
1839
|
+
name: "oldRecipient",
|
|
1840
|
+
type: "address",
|
|
1841
|
+
indexed: true,
|
|
1842
|
+
internalType: "address"
|
|
1843
|
+
},
|
|
1844
|
+
{
|
|
1845
|
+
name: "newRecipient",
|
|
1846
|
+
type: "address",
|
|
1847
|
+
indexed: false,
|
|
1848
|
+
internalType: "address"
|
|
1849
|
+
},
|
|
1850
|
+
{
|
|
1851
|
+
name: "documentHash",
|
|
1852
|
+
type: "bytes32",
|
|
1853
|
+
indexed: false,
|
|
1854
|
+
internalType: "bytes32"
|
|
1855
|
+
}
|
|
1856
|
+
],
|
|
1857
|
+
anonymous: false
|
|
1858
|
+
},
|
|
1859
|
+
{
|
|
1860
|
+
type: "event",
|
|
1861
|
+
name: "FundsClaimed",
|
|
1862
|
+
inputs: [
|
|
1863
|
+
{
|
|
1864
|
+
name: "commitmentId",
|
|
1865
|
+
type: "uint256",
|
|
1866
|
+
indexed: true,
|
|
1867
|
+
internalType: "uint256"
|
|
1868
|
+
},
|
|
1869
|
+
{
|
|
1870
|
+
name: "settlementId",
|
|
1871
|
+
type: "bytes32",
|
|
1872
|
+
indexed: true,
|
|
1873
|
+
internalType: "bytes32"
|
|
1874
|
+
},
|
|
1875
|
+
{
|
|
1876
|
+
name: "recipient",
|
|
1877
|
+
type: "address",
|
|
1878
|
+
indexed: true,
|
|
1879
|
+
internalType: "address"
|
|
1880
|
+
},
|
|
1881
|
+
{
|
|
1882
|
+
name: "amount",
|
|
1883
|
+
type: "uint256",
|
|
1884
|
+
indexed: false,
|
|
1885
|
+
internalType: "uint256"
|
|
1886
|
+
},
|
|
1887
|
+
{
|
|
1888
|
+
name: "documentHash",
|
|
1889
|
+
type: "bytes32",
|
|
1890
|
+
indexed: false,
|
|
1891
|
+
internalType: "bytes32"
|
|
1892
|
+
}
|
|
1893
|
+
],
|
|
1894
|
+
anonymous: false
|
|
1895
|
+
},
|
|
1896
|
+
{
|
|
1897
|
+
type: "event",
|
|
1898
|
+
name: "PaymentSent",
|
|
1899
|
+
inputs: [
|
|
1900
|
+
{
|
|
1901
|
+
name: "settlementId",
|
|
1902
|
+
type: "bytes32",
|
|
1903
|
+
indexed: true,
|
|
1904
|
+
internalType: "bytes32"
|
|
1905
|
+
},
|
|
1906
|
+
{
|
|
1907
|
+
name: "sender",
|
|
1908
|
+
type: "address",
|
|
1909
|
+
indexed: true,
|
|
1910
|
+
internalType: "address"
|
|
1911
|
+
},
|
|
1912
|
+
{
|
|
1913
|
+
name: "recipient",
|
|
1914
|
+
type: "address",
|
|
1915
|
+
indexed: true,
|
|
1916
|
+
internalType: "address"
|
|
1917
|
+
},
|
|
1918
|
+
{
|
|
1919
|
+
name: "token",
|
|
1920
|
+
type: "address",
|
|
1921
|
+
indexed: false,
|
|
1922
|
+
internalType: "address"
|
|
1923
|
+
},
|
|
1924
|
+
{
|
|
1925
|
+
name: "amount",
|
|
1926
|
+
type: "uint256",
|
|
1927
|
+
indexed: false,
|
|
1928
|
+
internalType: "uint256"
|
|
1929
|
+
},
|
|
1930
|
+
{
|
|
1931
|
+
name: "kind",
|
|
1932
|
+
type: "uint16",
|
|
1933
|
+
indexed: false,
|
|
1934
|
+
internalType: "uint16"
|
|
1935
|
+
},
|
|
1936
|
+
{
|
|
1937
|
+
name: "documentHash",
|
|
1938
|
+
type: "bytes32",
|
|
1939
|
+
indexed: false,
|
|
1940
|
+
internalType: "bytes32"
|
|
1941
|
+
}
|
|
1942
|
+
],
|
|
1943
|
+
anonymous: false
|
|
1944
|
+
},
|
|
1945
|
+
{
|
|
1946
|
+
type: "error",
|
|
1947
|
+
name: "AlreadyCancelled",
|
|
1948
|
+
inputs: []
|
|
1949
|
+
},
|
|
1950
|
+
{
|
|
1951
|
+
type: "error",
|
|
1952
|
+
name: "AlreadyClaimed",
|
|
1953
|
+
inputs: []
|
|
1954
|
+
},
|
|
1955
|
+
{
|
|
1956
|
+
type: "error",
|
|
1957
|
+
name: "DocumentHashMismatch",
|
|
1958
|
+
inputs: [{
|
|
1959
|
+
name: "expected",
|
|
1960
|
+
type: "bytes32",
|
|
1961
|
+
internalType: "bytes32"
|
|
1962
|
+
}, {
|
|
1963
|
+
name: "supplied",
|
|
1964
|
+
type: "bytes32",
|
|
1965
|
+
internalType: "bytes32"
|
|
1966
|
+
}]
|
|
1967
|
+
},
|
|
1968
|
+
{
|
|
1969
|
+
type: "error",
|
|
1970
|
+
name: "InvalidTimeParams",
|
|
1971
|
+
inputs: []
|
|
1972
|
+
},
|
|
1973
|
+
{
|
|
1974
|
+
type: "error",
|
|
1975
|
+
name: "NotCreator",
|
|
1976
|
+
inputs: []
|
|
1977
|
+
},
|
|
1978
|
+
{
|
|
1979
|
+
type: "error",
|
|
1980
|
+
name: "NotRecipient",
|
|
1981
|
+
inputs: []
|
|
1982
|
+
},
|
|
1983
|
+
{
|
|
1984
|
+
type: "error",
|
|
1985
|
+
name: "NothingToClaim",
|
|
1986
|
+
inputs: []
|
|
1987
|
+
},
|
|
1988
|
+
{
|
|
1989
|
+
type: "error",
|
|
1990
|
+
name: "SettlementIdConsumed",
|
|
1991
|
+
inputs: [{
|
|
1992
|
+
name: "settlementId",
|
|
1993
|
+
type: "bytes32",
|
|
1994
|
+
internalType: "bytes32"
|
|
1995
|
+
}]
|
|
1996
|
+
},
|
|
1997
|
+
{
|
|
1998
|
+
type: "error",
|
|
1999
|
+
name: "ZeroAddress",
|
|
2000
|
+
inputs: []
|
|
2001
|
+
},
|
|
2002
|
+
{
|
|
2003
|
+
type: "error",
|
|
2004
|
+
name: "ZeroAmount",
|
|
2005
|
+
inputs: []
|
|
2006
|
+
},
|
|
2007
|
+
{
|
|
2008
|
+
type: "error",
|
|
2009
|
+
name: "ZeroDocumentHash",
|
|
2010
|
+
inputs: []
|
|
2011
|
+
},
|
|
2012
|
+
{
|
|
2013
|
+
type: "error",
|
|
2014
|
+
name: "ZeroSettlementId",
|
|
2015
|
+
inputs: []
|
|
2016
|
+
}
|
|
2017
|
+
];
|
|
1379
2018
|
padHex(stringToHex("FM_DAILY"), {
|
|
1380
2019
|
size: 32,
|
|
1381
2020
|
dir: "right"
|
|
@@ -1387,6 +2026,16 @@ padHex(concat([MULTI_SEND_CALL_ONLY, "0x8d80ff0a"]), {
|
|
|
1387
2026
|
dir: "right",
|
|
1388
2027
|
size: 32
|
|
1389
2028
|
});
|
|
2029
|
+
function paymentsV2Signature(name) {
|
|
2030
|
+
const item = CAPXUL_PAYMENTS_V2_ABI.find((candidate) => candidate.type === "function" && candidate.name === name);
|
|
2031
|
+
if (item === void 0) throw new Error(`CapxulPaymentsV2 ABI has no ${name} function`);
|
|
2032
|
+
return toFunctionSignature(item);
|
|
2033
|
+
}
|
|
2034
|
+
paymentsV2Signature("send");
|
|
2035
|
+
paymentsV2Signature("sendBatch");
|
|
2036
|
+
paymentsV2Signature("createCommitment");
|
|
2037
|
+
paymentsV2Signature("cancel");
|
|
2038
|
+
paymentsV2Signature("redirect");
|
|
1390
2039
|
new Map([
|
|
1391
2040
|
["assignRoles(address,bytes32[],bool[])", "AssignRoles(address,bytes32[],bool[])"],
|
|
1392
2041
|
["allowTarget(bytes32,address,uint8)", "AllowTarget(bytes32,address,uint8)"],
|
|
@@ -6721,6 +7370,25 @@ const actorScopeContract = {
|
|
|
6721
7370
|
inboxDecline: makeFunctionReference(CAPXUL_FUNCTIONS["financialOps/requestsInbox"].decline)
|
|
6722
7371
|
};
|
|
6723
7372
|
//#endregion
|
|
7373
|
+
//#region ../../packages/sdk/src/domain/money/from-wei.ts
|
|
7374
|
+
/**
|
|
7375
|
+
* Lift an on-chain integer (e.g. USDX 6-decimal) into consumer `Money`.
|
|
7376
|
+
* Canon `account-balance-model.md` §10 — internal at the SDK boundary only.
|
|
7377
|
+
*/
|
|
7378
|
+
function fromWei(rawBalance, decimals, currency) {
|
|
7379
|
+
if (!Number.isInteger(decimals) || decimals < 0) throw new Error(`fromWei: decimals must be a non-negative integer, got ${String(decimals)}`);
|
|
7380
|
+
const normalized = rawBalance.trim();
|
|
7381
|
+
if (!/^\d+$/.test(normalized)) {
|
|
7382
|
+
const truncated = normalized.length > 80 ? `${normalized.slice(0, 80)}…` : normalized;
|
|
7383
|
+
throw new Error(`fromWei: rawBalance must be a base-10 integer string, got ${truncated}`);
|
|
7384
|
+
}
|
|
7385
|
+
return {
|
|
7386
|
+
currency: toCurrencyCode(currency),
|
|
7387
|
+
value: formatUnits(BigInt(normalized), decimals),
|
|
7388
|
+
decimals
|
|
7389
|
+
};
|
|
7390
|
+
}
|
|
7391
|
+
//#endregion
|
|
6724
7392
|
//#region ../../packages/sdk/src/surface/contacts.ts
|
|
6725
7393
|
function makeActorRelationshipMethods(deps) {
|
|
6726
7394
|
const domain = deps.actor.kind === "account" ? "account" : "org";
|
|
@@ -6799,11 +7467,16 @@ function makeActorRelationshipMethods(deps) {
|
|
|
6799
7467
|
},
|
|
6800
7468
|
inbox: {
|
|
6801
7469
|
list: (options) => mapOk$1(awaitableConvex(options?.signal, "inbox.list", () => convexCall.query(fns.inboxList, { actor })), (items) => items.map(mapInboxItem)),
|
|
6802
|
-
approve: (input, options) =>
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
7470
|
+
approve: async (input, options) => {
|
|
7471
|
+
const result = await awaitableConvex(options?.signal, "inbox.approve", () => convexCall.mutation(fns.inboxApprove, {
|
|
7472
|
+
actor,
|
|
7473
|
+
paymentRequestId: input.requestId,
|
|
7474
|
+
...input.timing === void 0 ? {} : { timing: input.timing },
|
|
7475
|
+
...input.permissionId === void 0 ? {} : { permissionId: input.permissionId }
|
|
7476
|
+
}));
|
|
7477
|
+
if (!result.ok) return result;
|
|
7478
|
+
return mapApprovedInboxPayment(result.value, input);
|
|
7479
|
+
},
|
|
6807
7480
|
decline: (requestId, options) => mapOk$1(awaitableConvex(options?.signal, "inbox.decline", () => convexCall.mutation(fns.inboxDecline, {
|
|
6808
7481
|
actor,
|
|
6809
7482
|
paymentRequestId: requestId
|
|
@@ -6918,50 +7591,45 @@ function mapInboxItem(item) {
|
|
|
6918
7591
|
status: mapInboxStatus(item.status)
|
|
6919
7592
|
};
|
|
6920
7593
|
}
|
|
6921
|
-
function mapApprovedInboxPayment(
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
};
|
|
6927
|
-
const status = item.settledPaymentStatus ?? (item.status === "paid" ? "settled" : "pending");
|
|
6928
|
-
const timing = item.settledPaymentTiming ?? { kind: "instant" };
|
|
6929
|
-
return {
|
|
6930
|
-
id: item.settledPaymentId ?? `payment_${item.id}`,
|
|
6931
|
-
status,
|
|
6932
|
-
amount: item.amount,
|
|
6933
|
-
paymentType: "invoice",
|
|
6934
|
-
recipient: paymentRecipientFromRef(item.issuer),
|
|
6935
|
-
documents: [],
|
|
6936
|
-
timing,
|
|
6937
|
-
released: status === "settled" ? item.amount : zero,
|
|
6938
|
-
availableToClaim: zero,
|
|
6939
|
-
createdAt: item.createdAt ?? 0,
|
|
6940
|
-
updatedAt: item.updatedAt ?? item.createdAt ?? 0
|
|
7594
|
+
function mapApprovedInboxPayment(command, input) {
|
|
7595
|
+
const item = command.items[0];
|
|
7596
|
+
if (item === void 0 || item.operation !== "send" && item.operation !== "create_commitment") return {
|
|
7597
|
+
ok: false,
|
|
7598
|
+
error: Errors.providerError("convex", "inbox.approve", "reply has no payment birth item")
|
|
6941
7599
|
};
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
label: ref.handle
|
|
6948
|
-
};
|
|
6949
|
-
case "email": return {
|
|
6950
|
-
kind: "email",
|
|
6951
|
-
label: ref.email
|
|
6952
|
-
};
|
|
6953
|
-
case "orgHandle": return {
|
|
6954
|
-
kind: "org",
|
|
6955
|
-
label: ref.orgHandle
|
|
7600
|
+
try {
|
|
7601
|
+
const amount = fromWei(item.operation === "send" ? item.rawAmount : item.totalAmount, 6, "USD");
|
|
7602
|
+
const zero = {
|
|
7603
|
+
...amount,
|
|
7604
|
+
value: "0"
|
|
6956
7605
|
};
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
7606
|
+
const timing = input.timing ?? { kind: "instant" };
|
|
7607
|
+
return {
|
|
7608
|
+
ok: true,
|
|
7609
|
+
value: {
|
|
7610
|
+
id: item.paymentId,
|
|
7611
|
+
status: timing.kind === "instant" ? "pending" : timing.kind === "scheduled" ? "scheduled" : "streaming",
|
|
7612
|
+
amount,
|
|
7613
|
+
paymentType: "invoice",
|
|
7614
|
+
recipient: {
|
|
7615
|
+
kind: "external_address",
|
|
7616
|
+
label: item.recipientSafe
|
|
7617
|
+
},
|
|
7618
|
+
documents: [{
|
|
7619
|
+
documentHash: item.documentHash,
|
|
7620
|
+
kind: "invoice"
|
|
7621
|
+
}],
|
|
7622
|
+
timing,
|
|
7623
|
+
released: zero,
|
|
7624
|
+
availableToClaim: zero,
|
|
7625
|
+
createdAt: 0,
|
|
7626
|
+
updatedAt: 0
|
|
7627
|
+
}
|
|
6960
7628
|
};
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
7629
|
+
} catch (cause) {
|
|
7630
|
+
return {
|
|
7631
|
+
ok: false,
|
|
7632
|
+
error: Errors.providerError("convex", "inbox.approve", cause)
|
|
6965
7633
|
};
|
|
6966
7634
|
}
|
|
6967
7635
|
}
|
|
@@ -6989,13 +7657,6 @@ function mapInboxStatus(status) {
|
|
|
6989
7657
|
default: return "open";
|
|
6990
7658
|
}
|
|
6991
7659
|
}
|
|
6992
|
-
function normalizePaymentTiming$1(payment) {
|
|
6993
|
-
const { release: _release, ...rest } = payment;
|
|
6994
|
-
return {
|
|
6995
|
-
...rest,
|
|
6996
|
-
timing: payment.timing ?? payment.release ?? { kind: "instant" }
|
|
6997
|
-
};
|
|
6998
|
-
}
|
|
6999
7660
|
function normalizeRefForBackend$1(ref, field) {
|
|
7000
7661
|
try {
|
|
7001
7662
|
if (typeof ref === "string") throw Errors.invalidInput(field, "recipient must be a typed Ref variant");
|
|
@@ -7504,7 +8165,7 @@ async function recoverRawDigestSigner(input) {
|
|
|
7504
8165
|
}
|
|
7505
8166
|
//#endregion
|
|
7506
8167
|
//#region ../../packages/sdk/package.json
|
|
7507
|
-
var version = "2.0.
|
|
8168
|
+
var version = "2.0.1";
|
|
7508
8169
|
//#endregion
|
|
7509
8170
|
//#region ../../packages/observability/src/engineering.ts
|
|
7510
8171
|
const SAFE_TRACED_HEADER_NAMES = [
|
|
@@ -11723,25 +12384,6 @@ function accountReadErrorFromCapxul(operation, error, cause = error) {
|
|
|
11723
12384
|
}
|
|
11724
12385
|
var AccountReadPortTag = class extends Context.Service()("@capxul/sdk/ports/AccountReadPort") {};
|
|
11725
12386
|
//#endregion
|
|
11726
|
-
//#region ../../packages/sdk/src/domain/money/from-wei.ts
|
|
11727
|
-
/**
|
|
11728
|
-
* Lift an on-chain integer (e.g. USDX 6-decimal) into consumer `Money`.
|
|
11729
|
-
* Canon `account-balance-model.md` §10 — internal at the SDK boundary only.
|
|
11730
|
-
*/
|
|
11731
|
-
function fromWei(rawBalance, decimals, currency) {
|
|
11732
|
-
if (!Number.isInteger(decimals) || decimals < 0) throw new Error(`fromWei: decimals must be a non-negative integer, got ${String(decimals)}`);
|
|
11733
|
-
const normalized = rawBalance.trim();
|
|
11734
|
-
if (!/^\d+$/.test(normalized)) {
|
|
11735
|
-
const truncated = normalized.length > 80 ? `${normalized.slice(0, 80)}…` : normalized;
|
|
11736
|
-
throw new Error(`fromWei: rawBalance must be a base-10 integer string, got ${truncated}`);
|
|
11737
|
-
}
|
|
11738
|
-
return {
|
|
11739
|
-
currency: toCurrencyCode(currency),
|
|
11740
|
-
value: formatUnits(BigInt(normalized), decimals),
|
|
11741
|
-
decimals
|
|
11742
|
-
};
|
|
11743
|
-
}
|
|
11744
|
-
//#endregion
|
|
11745
12387
|
//#region ../../packages/sdk/src/adapters/account-read/ConvexAccountAdapter.ts
|
|
11746
12388
|
const DEFAULT_FUNCTIONS$3 = {
|
|
11747
12389
|
readBalance: makeFunctionReference(CAPXUL_FUNCTIONS["account/actions"].readBalance),
|
|
@@ -41787,6 +42429,14 @@ const EVIDENCE_RPC_METHODS = new Set([
|
|
|
41787
42429
|
"eth_getLogs",
|
|
41788
42430
|
"eth_getTransactionReceipt"
|
|
41789
42431
|
]);
|
|
42432
|
+
const BUNDLER_RPC_METHODS = new Set([
|
|
42433
|
+
"eth_sendUserOperation",
|
|
42434
|
+
"eth_estimateUserOperationGas",
|
|
42435
|
+
"eth_getUserOperationReceipt",
|
|
42436
|
+
"eth_getUserOperationByHash",
|
|
42437
|
+
"pm_getPaymasterStubData",
|
|
42438
|
+
"pm_getPaymasterData"
|
|
42439
|
+
]);
|
|
41790
42440
|
function rethrowProvider(method) {
|
|
41791
42441
|
return (e) => {
|
|
41792
42442
|
throw Errors.providerError("alchemy", method, e);
|
|
@@ -41845,7 +42495,9 @@ var DefinitiveAlchemyJsonRpcRejection = class extends Error {
|
|
|
41845
42495
|
}
|
|
41846
42496
|
};
|
|
41847
42497
|
async function alchemyRpc(chainId, method, params, timeoutMs, externalSignal) {
|
|
41848
|
-
const
|
|
42498
|
+
const bundlerUrl = chainId === 84532 && BUNDLER_RPC_METHODS.has(method) ? optionalEnv("BASE_SEPOLIA_BUNDLER_RPC_URL") : void 0;
|
|
42499
|
+
const evidenceUrl = chainId === 84532 && EVIDENCE_RPC_METHODS.has(method) ? optionalEnv("BASE_SEPOLIA_EVIDENCE_RPC_URL") : void 0;
|
|
42500
|
+
const url = bundlerUrl?.replace(/\/+$/u, "") ?? evidenceUrl?.replace(/\/+$/u, "") ?? alchemyUrl(chainId);
|
|
41849
42501
|
const timeoutSignal = timeoutMs === void 0 ? void 0 : AbortSignal.timeout(timeoutMs);
|
|
41850
42502
|
const signal = externalSignal === void 0 ? timeoutSignal : timeoutSignal === void 0 ? externalSignal : AbortSignal.any([externalSignal, timeoutSignal]);
|
|
41851
42503
|
const res = await fetch(url, {
|
|
@@ -41906,14 +42558,16 @@ function parseReceiptLogs(raw) {
|
|
|
41906
42558
|
async function fetchUserOperationReceipt(args) {
|
|
41907
42559
|
const raw = await alchemyRpc(args.chainId, "eth_getUserOperationReceipt", [args.userOpHash]);
|
|
41908
42560
|
if (raw === null) return null;
|
|
41909
|
-
if (typeof raw !== "object" || typeof raw.userOpHash !== "string" || typeof raw.sender !== "string" || typeof raw.success !== "boolean" || typeof raw.receipt !== "object" || typeof raw.receipt.blockNumber !== "string" || typeof raw.receipt.transactionHash !== "string") throw Errors.providerError("alchemy", "eth_getUserOperationReceipt", `unexpected shape: ${JSON.stringify(raw)}`);
|
|
42561
|
+
if (typeof raw !== "object" || typeof raw.userOpHash !== "string" || typeof raw.sender !== "string" || typeof raw.success !== "boolean" || typeof raw.receipt !== "object" || typeof raw.receipt.blockNumber !== "string" || typeof raw.receipt.blockHash !== "string" || typeof raw.receipt.transactionHash !== "string" || typeof raw.receipt.transactionIndex !== "string") throw Errors.providerError("alchemy", "eth_getUserOperationReceipt", `unexpected shape: ${JSON.stringify(raw)}`);
|
|
41910
42562
|
return {
|
|
41911
42563
|
userOpHash: providerBytes32(raw.userOpHash, "eth_getUserOperationReceipt", "userOpHash"),
|
|
41912
42564
|
sender: providerAddress(raw.sender, "eth_getUserOperationReceipt", "sender"),
|
|
41913
42565
|
success: raw.success,
|
|
41914
42566
|
receipt: {
|
|
41915
42567
|
blockNumber: hexToSafeInteger(raw.receipt.blockNumber, "eth_getUserOperationReceipt"),
|
|
42568
|
+
blockHash: providerBytes32(raw.receipt.blockHash, "eth_getUserOperationReceipt", "blockHash"),
|
|
41916
42569
|
transactionHash: providerBytes32(raw.receipt.transactionHash, "eth_getUserOperationReceipt", "transactionHash"),
|
|
42570
|
+
transactionIndex: hexToSafeInteger(raw.receipt.transactionIndex, "eth_getUserOperationReceipt"),
|
|
41917
42571
|
logs: parseReceiptLogs(raw.logs)
|
|
41918
42572
|
}
|
|
41919
42573
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capxul/mcp",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Capxul MCP server for auth, Account readiness, identity, Organizations, relationships, requests, destinations, and testnet funding over Streamable HTTP.",
|
|
6
6
|
"keywords": [
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
48
48
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.23",
|
|
49
49
|
"vite-plus": "0.1.23",
|
|
50
|
-
"@capxul/backend": "0.1.
|
|
50
|
+
"@capxul/backend": "0.1.7",
|
|
51
51
|
"@capxul/config": "0.1.1",
|
|
52
|
-
"@capxul/sdk": "2.0.
|
|
52
|
+
"@capxul/sdk": "2.0.1",
|
|
53
53
|
"@capxul/types": "0.1.0",
|
|
54
54
|
"@capxul/typescript-config": "0.0.0",
|
|
55
55
|
"@capxul/wire": "0.1.0"
|