@entros/pulse-sdk 1.4.2 → 1.5.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.mjs CHANGED
@@ -1273,6 +1273,2255 @@ async function generateSolanaProof(current, previous, wasmPath, zkeyPath, thresh
1273
1273
  return serializeProof(proof, publicSignals);
1274
1274
  }
1275
1275
 
1276
+ // src/protocol/idl/entros_anchor.json
1277
+ var entros_anchor_default = {
1278
+ address: "GZYwTp2ozeuRA5Gof9vs4ya961aANcJBdUzB7LN6q4b2",
1279
+ metadata: {
1280
+ name: "entros_anchor",
1281
+ version: "0.1.0",
1282
+ spec: "0.1.0",
1283
+ description: "Non-transferable identity token for Entros Protocol"
1284
+ },
1285
+ docs: [
1286
+ "Mint account space for Token-2022 with NonTransferable extension.",
1287
+ "Base mint = 82 bytes, account type = 1 byte, extension type (2) + length (2) = 4 bytes,",
1288
+ "NonTransferable data = 0 bytes. Plus multisig padding from Token-2022.",
1289
+ "We use a constant derived from the Token-2022 spec."
1290
+ ],
1291
+ instructions: [
1292
+ {
1293
+ name: "authorize_new_wallet",
1294
+ docs: [
1295
+ "Authorize a new wallet by 2 signers. This can be done many times before invoking migrate_identity()"
1296
+ ],
1297
+ discriminator: [
1298
+ 178,
1299
+ 186,
1300
+ 185,
1301
+ 108,
1302
+ 51,
1303
+ 219,
1304
+ 107,
1305
+ 197
1306
+ ],
1307
+ accounts: [
1308
+ {
1309
+ name: "signer",
1310
+ writable: true,
1311
+ signer: true
1312
+ },
1313
+ {
1314
+ name: "identity_state",
1315
+ writable: true,
1316
+ pda: {
1317
+ seeds: [
1318
+ {
1319
+ kind: "const",
1320
+ value: [
1321
+ 105,
1322
+ 100,
1323
+ 101,
1324
+ 110,
1325
+ 116,
1326
+ 105,
1327
+ 116,
1328
+ 121
1329
+ ]
1330
+ },
1331
+ {
1332
+ kind: "account",
1333
+ path: "signer"
1334
+ }
1335
+ ]
1336
+ }
1337
+ },
1338
+ {
1339
+ name: "signer_new",
1340
+ writable: true,
1341
+ signer: true
1342
+ },
1343
+ {
1344
+ name: "token_program"
1345
+ },
1346
+ {
1347
+ name: "mint",
1348
+ writable: true,
1349
+ pda: {
1350
+ seeds: [
1351
+ {
1352
+ kind: "const",
1353
+ value: [
1354
+ 109,
1355
+ 105,
1356
+ 110,
1357
+ 116
1358
+ ]
1359
+ },
1360
+ {
1361
+ kind: "account",
1362
+ path: "signer"
1363
+ }
1364
+ ]
1365
+ }
1366
+ },
1367
+ {
1368
+ name: "token_account",
1369
+ writable: true,
1370
+ pda: {
1371
+ seeds: [
1372
+ {
1373
+ kind: "account",
1374
+ path: "signer"
1375
+ },
1376
+ {
1377
+ kind: "account",
1378
+ path: "token_program"
1379
+ },
1380
+ {
1381
+ kind: "account",
1382
+ path: "mint"
1383
+ }
1384
+ ],
1385
+ program: {
1386
+ kind: "const",
1387
+ value: [
1388
+ 140,
1389
+ 151,
1390
+ 37,
1391
+ 143,
1392
+ 78,
1393
+ 36,
1394
+ 137,
1395
+ 241,
1396
+ 187,
1397
+ 61,
1398
+ 16,
1399
+ 41,
1400
+ 20,
1401
+ 142,
1402
+ 13,
1403
+ 131,
1404
+ 11,
1405
+ 90,
1406
+ 19,
1407
+ 153,
1408
+ 218,
1409
+ 255,
1410
+ 16,
1411
+ 132,
1412
+ 4,
1413
+ 142,
1414
+ 123,
1415
+ 216,
1416
+ 219,
1417
+ 233,
1418
+ 248,
1419
+ 89
1420
+ ]
1421
+ }
1422
+ }
1423
+ }
1424
+ ],
1425
+ args: []
1426
+ },
1427
+ {
1428
+ name: "migrate_identity",
1429
+ docs: [
1430
+ "Migrate from an user's old Anchor IdentityState PDA to a new one",
1431
+ "After this function call, the orphaned 0-balance ATA, pointing at a closed mint, locks ~0.002 SOL of rent. This ATA can be recovered by the old wallet calling closeAccount()"
1432
+ ],
1433
+ discriminator: [
1434
+ 161,
1435
+ 192,
1436
+ 70,
1437
+ 80,
1438
+ 47,
1439
+ 37,
1440
+ 26,
1441
+ 10
1442
+ ],
1443
+ accounts: [
1444
+ {
1445
+ name: "user",
1446
+ writable: true,
1447
+ signer: true
1448
+ },
1449
+ {
1450
+ name: "identity_state",
1451
+ writable: true,
1452
+ pda: {
1453
+ seeds: [
1454
+ {
1455
+ kind: "const",
1456
+ value: [
1457
+ 105,
1458
+ 100,
1459
+ 101,
1460
+ 110,
1461
+ 116,
1462
+ 105,
1463
+ 116,
1464
+ 121
1465
+ ]
1466
+ },
1467
+ {
1468
+ kind: "account",
1469
+ path: "user"
1470
+ }
1471
+ ]
1472
+ }
1473
+ },
1474
+ {
1475
+ name: "mint",
1476
+ docs: [
1477
+ "initialization ordering. PDA seeds ensure uniqueness per user."
1478
+ ],
1479
+ writable: true,
1480
+ pda: {
1481
+ seeds: [
1482
+ {
1483
+ kind: "const",
1484
+ value: [
1485
+ 109,
1486
+ 105,
1487
+ 110,
1488
+ 116
1489
+ ]
1490
+ },
1491
+ {
1492
+ kind: "account",
1493
+ path: "user"
1494
+ }
1495
+ ]
1496
+ }
1497
+ },
1498
+ {
1499
+ name: "mint_authority",
1500
+ pda: {
1501
+ seeds: [
1502
+ {
1503
+ kind: "const",
1504
+ value: [
1505
+ 109,
1506
+ 105,
1507
+ 110,
1508
+ 116,
1509
+ 95,
1510
+ 97,
1511
+ 117,
1512
+ 116,
1513
+ 104,
1514
+ 111,
1515
+ 114,
1516
+ 105,
1517
+ 116,
1518
+ 121
1519
+ ]
1520
+ }
1521
+ ]
1522
+ }
1523
+ },
1524
+ {
1525
+ name: "token_account",
1526
+ writable: true
1527
+ },
1528
+ {
1529
+ name: "associated_token_program",
1530
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
1531
+ },
1532
+ {
1533
+ name: "token_program"
1534
+ },
1535
+ {
1536
+ name: "system_program",
1537
+ address: "11111111111111111111111111111111"
1538
+ },
1539
+ {
1540
+ name: "protocol_config",
1541
+ pda: {
1542
+ seeds: [
1543
+ {
1544
+ kind: "const",
1545
+ value: [
1546
+ 112,
1547
+ 114,
1548
+ 111,
1549
+ 116,
1550
+ 111,
1551
+ 99,
1552
+ 111,
1553
+ 108,
1554
+ 95,
1555
+ 99,
1556
+ 111,
1557
+ 110,
1558
+ 102,
1559
+ 105,
1560
+ 103
1561
+ ]
1562
+ }
1563
+ ],
1564
+ program: {
1565
+ kind: "const",
1566
+ value: [
1567
+ 81,
1568
+ 130,
1569
+ 250,
1570
+ 230,
1571
+ 30,
1572
+ 253,
1573
+ 246,
1574
+ 69,
1575
+ 82,
1576
+ 96,
1577
+ 7,
1578
+ 173,
1579
+ 78,
1580
+ 160,
1581
+ 131,
1582
+ 188,
1583
+ 70,
1584
+ 106,
1585
+ 173,
1586
+ 59,
1587
+ 102,
1588
+ 163,
1589
+ 198,
1590
+ 189,
1591
+ 82,
1592
+ 37,
1593
+ 225,
1594
+ 38,
1595
+ 52,
1596
+ 233,
1597
+ 157,
1598
+ 117
1599
+ ]
1600
+ }
1601
+ }
1602
+ },
1603
+ {
1604
+ name: "treasury",
1605
+ writable: true,
1606
+ pda: {
1607
+ seeds: [
1608
+ {
1609
+ kind: "const",
1610
+ value: [
1611
+ 112,
1612
+ 114,
1613
+ 111,
1614
+ 116,
1615
+ 111,
1616
+ 99,
1617
+ 111,
1618
+ 108,
1619
+ 95,
1620
+ 116,
1621
+ 114,
1622
+ 101,
1623
+ 97,
1624
+ 115,
1625
+ 117,
1626
+ 114,
1627
+ 121
1628
+ ]
1629
+ }
1630
+ ],
1631
+ program: {
1632
+ kind: "const",
1633
+ value: [
1634
+ 81,
1635
+ 130,
1636
+ 250,
1637
+ 230,
1638
+ 30,
1639
+ 253,
1640
+ 246,
1641
+ 69,
1642
+ 82,
1643
+ 96,
1644
+ 7,
1645
+ 173,
1646
+ 78,
1647
+ 160,
1648
+ 131,
1649
+ 188,
1650
+ 70,
1651
+ 106,
1652
+ 173,
1653
+ 59,
1654
+ 102,
1655
+ 163,
1656
+ 198,
1657
+ 189,
1658
+ 82,
1659
+ 37,
1660
+ 225,
1661
+ 38,
1662
+ 52,
1663
+ 233,
1664
+ 157,
1665
+ 117
1666
+ ]
1667
+ }
1668
+ }
1669
+ },
1670
+ {
1671
+ name: "wallet_old",
1672
+ writable: true
1673
+ },
1674
+ {
1675
+ name: "identity_state_old",
1676
+ writable: true,
1677
+ pda: {
1678
+ seeds: [
1679
+ {
1680
+ kind: "const",
1681
+ value: [
1682
+ 105,
1683
+ 100,
1684
+ 101,
1685
+ 110,
1686
+ 116,
1687
+ 105,
1688
+ 116,
1689
+ 121
1690
+ ]
1691
+ },
1692
+ {
1693
+ kind: "account",
1694
+ path: "wallet_old"
1695
+ }
1696
+ ]
1697
+ }
1698
+ },
1699
+ {
1700
+ name: "mint_old",
1701
+ writable: true,
1702
+ pda: {
1703
+ seeds: [
1704
+ {
1705
+ kind: "const",
1706
+ value: [
1707
+ 109,
1708
+ 105,
1709
+ 110,
1710
+ 116
1711
+ ]
1712
+ },
1713
+ {
1714
+ kind: "account",
1715
+ path: "wallet_old"
1716
+ }
1717
+ ]
1718
+ }
1719
+ },
1720
+ {
1721
+ name: "token_account_old",
1722
+ writable: true,
1723
+ pda: {
1724
+ seeds: [
1725
+ {
1726
+ kind: "account",
1727
+ path: "wallet_old"
1728
+ },
1729
+ {
1730
+ kind: "account",
1731
+ path: "token_program"
1732
+ },
1733
+ {
1734
+ kind: "account",
1735
+ path: "mint_old"
1736
+ }
1737
+ ],
1738
+ program: {
1739
+ kind: "const",
1740
+ value: [
1741
+ 140,
1742
+ 151,
1743
+ 37,
1744
+ 143,
1745
+ 78,
1746
+ 36,
1747
+ 137,
1748
+ 241,
1749
+ 187,
1750
+ 61,
1751
+ 16,
1752
+ 41,
1753
+ 20,
1754
+ 142,
1755
+ 13,
1756
+ 131,
1757
+ 11,
1758
+ 90,
1759
+ 19,
1760
+ 153,
1761
+ 218,
1762
+ 255,
1763
+ 16,
1764
+ 132,
1765
+ 4,
1766
+ 142,
1767
+ 123,
1768
+ 216,
1769
+ 219,
1770
+ 233,
1771
+ 248,
1772
+ 89
1773
+ ]
1774
+ }
1775
+ }
1776
+ }
1777
+ ],
1778
+ args: []
1779
+ },
1780
+ {
1781
+ name: "mint_anchor",
1782
+ docs: [
1783
+ "Mint a new Entros Anchor identity for the caller.",
1784
+ "Creates a NonTransferable Token-2022 mint, mints 1 token to the user's ATA,",
1785
+ "and initializes the IdentityState PDA."
1786
+ ],
1787
+ discriminator: [
1788
+ 68,
1789
+ 56,
1790
+ 113,
1791
+ 102,
1792
+ 236,
1793
+ 152,
1794
+ 146,
1795
+ 60
1796
+ ],
1797
+ accounts: [
1798
+ {
1799
+ name: "user",
1800
+ writable: true,
1801
+ signer: true
1802
+ },
1803
+ {
1804
+ name: "identity_state",
1805
+ writable: true,
1806
+ pda: {
1807
+ seeds: [
1808
+ {
1809
+ kind: "const",
1810
+ value: [
1811
+ 105,
1812
+ 100,
1813
+ 101,
1814
+ 110,
1815
+ 116,
1816
+ 105,
1817
+ 116,
1818
+ 121
1819
+ ]
1820
+ },
1821
+ {
1822
+ kind: "account",
1823
+ path: "user"
1824
+ }
1825
+ ]
1826
+ }
1827
+ },
1828
+ {
1829
+ name: "mint",
1830
+ docs: [
1831
+ "initialization ordering. PDA seeds ensure uniqueness per user."
1832
+ ],
1833
+ writable: true,
1834
+ pda: {
1835
+ seeds: [
1836
+ {
1837
+ kind: "const",
1838
+ value: [
1839
+ 109,
1840
+ 105,
1841
+ 110,
1842
+ 116
1843
+ ]
1844
+ },
1845
+ {
1846
+ kind: "account",
1847
+ path: "user"
1848
+ }
1849
+ ]
1850
+ }
1851
+ },
1852
+ {
1853
+ name: "mint_authority",
1854
+ pda: {
1855
+ seeds: [
1856
+ {
1857
+ kind: "const",
1858
+ value: [
1859
+ 109,
1860
+ 105,
1861
+ 110,
1862
+ 116,
1863
+ 95,
1864
+ 97,
1865
+ 117,
1866
+ 116,
1867
+ 104,
1868
+ 111,
1869
+ 114,
1870
+ 105,
1871
+ 116,
1872
+ 121
1873
+ ]
1874
+ }
1875
+ ]
1876
+ }
1877
+ },
1878
+ {
1879
+ name: "token_account",
1880
+ writable: true
1881
+ },
1882
+ {
1883
+ name: "associated_token_program",
1884
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
1885
+ },
1886
+ {
1887
+ name: "token_program"
1888
+ },
1889
+ {
1890
+ name: "system_program",
1891
+ address: "11111111111111111111111111111111"
1892
+ },
1893
+ {
1894
+ name: "protocol_config",
1895
+ pda: {
1896
+ seeds: [
1897
+ {
1898
+ kind: "const",
1899
+ value: [
1900
+ 112,
1901
+ 114,
1902
+ 111,
1903
+ 116,
1904
+ 111,
1905
+ 99,
1906
+ 111,
1907
+ 108,
1908
+ 95,
1909
+ 99,
1910
+ 111,
1911
+ 110,
1912
+ 102,
1913
+ 105,
1914
+ 103
1915
+ ]
1916
+ }
1917
+ ],
1918
+ program: {
1919
+ kind: "const",
1920
+ value: [
1921
+ 81,
1922
+ 130,
1923
+ 250,
1924
+ 230,
1925
+ 30,
1926
+ 253,
1927
+ 246,
1928
+ 69,
1929
+ 82,
1930
+ 96,
1931
+ 7,
1932
+ 173,
1933
+ 78,
1934
+ 160,
1935
+ 131,
1936
+ 188,
1937
+ 70,
1938
+ 106,
1939
+ 173,
1940
+ 59,
1941
+ 102,
1942
+ 163,
1943
+ 198,
1944
+ 189,
1945
+ 82,
1946
+ 37,
1947
+ 225,
1948
+ 38,
1949
+ 52,
1950
+ 233,
1951
+ 157,
1952
+ 117
1953
+ ]
1954
+ }
1955
+ }
1956
+ },
1957
+ {
1958
+ name: "treasury",
1959
+ writable: true,
1960
+ pda: {
1961
+ seeds: [
1962
+ {
1963
+ kind: "const",
1964
+ value: [
1965
+ 112,
1966
+ 114,
1967
+ 111,
1968
+ 116,
1969
+ 111,
1970
+ 99,
1971
+ 111,
1972
+ 108,
1973
+ 95,
1974
+ 116,
1975
+ 114,
1976
+ 101,
1977
+ 97,
1978
+ 115,
1979
+ 117,
1980
+ 114,
1981
+ 121
1982
+ ]
1983
+ }
1984
+ ],
1985
+ program: {
1986
+ kind: "const",
1987
+ value: [
1988
+ 81,
1989
+ 130,
1990
+ 250,
1991
+ 230,
1992
+ 30,
1993
+ 253,
1994
+ 246,
1995
+ 69,
1996
+ 82,
1997
+ 96,
1998
+ 7,
1999
+ 173,
2000
+ 78,
2001
+ 160,
2002
+ 131,
2003
+ 188,
2004
+ 70,
2005
+ 106,
2006
+ 173,
2007
+ 59,
2008
+ 102,
2009
+ 163,
2010
+ 198,
2011
+ 189,
2012
+ 82,
2013
+ 37,
2014
+ 225,
2015
+ 38,
2016
+ 52,
2017
+ 233,
2018
+ 157,
2019
+ 117
2020
+ ]
2021
+ }
2022
+ }
2023
+ },
2024
+ {
2025
+ name: "instructions_sysvar",
2026
+ docs: [
2027
+ "receipt verification (master-list #146 Phase 3) to inspect the",
2028
+ "preceding Ed25519Program::verify instruction in the same tx.",
2029
+ "Address is constrained to the canonical sysvar pubkey, so the",
2030
+ "program is guaranteed to be reading the real sysvar regardless of",
2031
+ "what the client passes."
2032
+ ],
2033
+ address: "Sysvar1nstructions1111111111111111111111111"
2034
+ }
2035
+ ],
2036
+ args: [
2037
+ {
2038
+ name: "initial_commitment",
2039
+ type: {
2040
+ array: [
2041
+ "u8",
2042
+ 32
2043
+ ]
2044
+ }
2045
+ }
2046
+ ]
2047
+ },
2048
+ {
2049
+ name: "reset_identity_state",
2050
+ docs: [
2051
+ "Reset the caller's identity state to a fresh baseline.",
2052
+ "",
2053
+ "Recovery path for users whose client-side fingerprint envelope is",
2054
+ "unrecoverable (cleared site data, new device, corrupted keystore).",
2055
+ 'Without this instruction the only answer is "mint a new wallet,"',
2056
+ "which discards on-chain history and the SAS attestation. Reset",
2057
+ "rotates `current_commitment` in place and zeroes verification",
2058
+ "history so a compromised wallet cannot inherit reputation.",
2059
+ "",
2060
+ "Defenses:",
2061
+ "- Signer constraint on `authority` proves wallet ownership.",
2062
+ "- 7-day cooldown (`RESET_COOLDOWN_SECS`) bounds abuse frequency.",
2063
+ "- Full zero of `verification_count`, `trust_score`, and",
2064
+ "`recent_timestamps` means an attacker who compromises the",
2065
+ "wallet key and passes Tier 1 validation starts from zero.",
2066
+ "- Verification fee charged, matching mint/update economics.",
2067
+ "",
2068
+ "No ZK proof is consumed: there is no prior fingerprint to",
2069
+ "Hamming-compare against, and the Hamming circuit's",
2070
+ "`min_distance \u2265 3` constraint would reject a same-fingerprint",
2071
+ "proof anyway. Live-humanness evidence comes from the Tier 1",
2072
+ "validation pipeline at the SAS attestation step (handled by",
2073
+ "the off-chain executor, not this instruction)."
2074
+ ],
2075
+ discriminator: [
2076
+ 26,
2077
+ 78,
2078
+ 86,
2079
+ 143,
2080
+ 247,
2081
+ 132,
2082
+ 85,
2083
+ 203
2084
+ ],
2085
+ accounts: [
2086
+ {
2087
+ name: "authority",
2088
+ writable: true,
2089
+ signer: true
2090
+ },
2091
+ {
2092
+ name: "identity_state",
2093
+ docs: [
2094
+ "may realloc legacy-layout accounts (207 or 543 bytes) to the current",
2095
+ "551-byte layout before deserialization. PDA validated by seeds;",
2096
+ "ownership verified in instruction body after deserialization."
2097
+ ],
2098
+ writable: true,
2099
+ pda: {
2100
+ seeds: [
2101
+ {
2102
+ kind: "const",
2103
+ value: [
2104
+ 105,
2105
+ 100,
2106
+ 101,
2107
+ 110,
2108
+ 116,
2109
+ 105,
2110
+ 116,
2111
+ 121
2112
+ ]
2113
+ },
2114
+ {
2115
+ kind: "account",
2116
+ path: "authority"
2117
+ }
2118
+ ]
2119
+ }
2120
+ },
2121
+ {
2122
+ name: "protocol_config",
2123
+ docs: [
2124
+ "Supplies the verification fee amount charged on reset."
2125
+ ],
2126
+ pda: {
2127
+ seeds: [
2128
+ {
2129
+ kind: "const",
2130
+ value: [
2131
+ 112,
2132
+ 114,
2133
+ 111,
2134
+ 116,
2135
+ 111,
2136
+ 99,
2137
+ 111,
2138
+ 108,
2139
+ 95,
2140
+ 99,
2141
+ 111,
2142
+ 110,
2143
+ 102,
2144
+ 105,
2145
+ 103
2146
+ ]
2147
+ }
2148
+ ],
2149
+ program: {
2150
+ kind: "const",
2151
+ value: [
2152
+ 81,
2153
+ 130,
2154
+ 250,
2155
+ 230,
2156
+ 30,
2157
+ 253,
2158
+ 246,
2159
+ 69,
2160
+ 82,
2161
+ 96,
2162
+ 7,
2163
+ 173,
2164
+ 78,
2165
+ 160,
2166
+ 131,
2167
+ 188,
2168
+ 70,
2169
+ 106,
2170
+ 173,
2171
+ 59,
2172
+ 102,
2173
+ 163,
2174
+ 198,
2175
+ 189,
2176
+ 82,
2177
+ 37,
2178
+ 225,
2179
+ 38,
2180
+ 52,
2181
+ 233,
2182
+ 157,
2183
+ 117
2184
+ ]
2185
+ }
2186
+ }
2187
+ },
2188
+ {
2189
+ name: "treasury",
2190
+ writable: true,
2191
+ pda: {
2192
+ seeds: [
2193
+ {
2194
+ kind: "const",
2195
+ value: [
2196
+ 112,
2197
+ 114,
2198
+ 111,
2199
+ 116,
2200
+ 111,
2201
+ 99,
2202
+ 111,
2203
+ 108,
2204
+ 95,
2205
+ 116,
2206
+ 114,
2207
+ 101,
2208
+ 97,
2209
+ 115,
2210
+ 117,
2211
+ 114,
2212
+ 121
2213
+ ]
2214
+ }
2215
+ ],
2216
+ program: {
2217
+ kind: "const",
2218
+ value: [
2219
+ 81,
2220
+ 130,
2221
+ 250,
2222
+ 230,
2223
+ 30,
2224
+ 253,
2225
+ 246,
2226
+ 69,
2227
+ 82,
2228
+ 96,
2229
+ 7,
2230
+ 173,
2231
+ 78,
2232
+ 160,
2233
+ 131,
2234
+ 188,
2235
+ 70,
2236
+ 106,
2237
+ 173,
2238
+ 59,
2239
+ 102,
2240
+ 163,
2241
+ 198,
2242
+ 189,
2243
+ 82,
2244
+ 37,
2245
+ 225,
2246
+ 38,
2247
+ 52,
2248
+ 233,
2249
+ 157,
2250
+ 117
2251
+ ]
2252
+ }
2253
+ }
2254
+ },
2255
+ {
2256
+ name: "system_program",
2257
+ address: "11111111111111111111111111111111"
2258
+ }
2259
+ ],
2260
+ args: [
2261
+ {
2262
+ name: "new_commitment",
2263
+ type: {
2264
+ array: [
2265
+ "u8",
2266
+ 32
2267
+ ]
2268
+ }
2269
+ }
2270
+ ]
2271
+ },
2272
+ {
2273
+ name: "update_anchor",
2274
+ docs: [
2275
+ "Update the identity state after a successful proof verification.",
2276
+ "",
2277
+ "Trust score is computed automatically from verification history and protocol config.",
2278
+ "Handles transparent migration from old (10-slot) to new (52-slot) account layouts.",
2279
+ "",
2280
+ "Requires a matching, fresh `VerificationResult` PDA (owned by entros-verifier)",
2281
+ "whose `commitment_new` equals `new_commitment` and whose `commitment_prev`",
2282
+ "equals the identity's current stored commitment. Without this binding the",
2283
+ "instruction would accept any commitment with no biometric proof \u2014 allowing",
2284
+ "trust-score farming via per-call fee payment, which contradicts the",
2285
+ "protocol's economic deterrence model. See AUDIT.md for details.",
2286
+ "",
2287
+ "The `verification_nonce` argument supplies the challenge nonce used to",
2288
+ 'derive the VerificationResult PDA (`seeds = [b"verification", authority, nonce]`).',
2289
+ "Single-use is enforced implicitly: after this call, `current_commitment`",
2290
+ "rotates to `new_commitment`, so the consumed VerificationResult's",
2291
+ "`commitment_prev` no longer matches on any future call."
2292
+ ],
2293
+ discriminator: [
2294
+ 120,
2295
+ 192,
2296
+ 72,
2297
+ 245,
2298
+ 112,
2299
+ 246,
2300
+ 119,
2301
+ 135
2302
+ ],
2303
+ accounts: [
2304
+ {
2305
+ name: "authority",
2306
+ writable: true,
2307
+ signer: true
2308
+ },
2309
+ {
2310
+ name: "identity_state",
2311
+ docs: [
2312
+ "from old (10-slot) to new (52-slot) account layouts. PDA validated by seeds.",
2313
+ "Ownership verified in instruction body after deserialization."
2314
+ ],
2315
+ writable: true,
2316
+ pda: {
2317
+ seeds: [
2318
+ {
2319
+ kind: "const",
2320
+ value: [
2321
+ 105,
2322
+ 100,
2323
+ 101,
2324
+ 110,
2325
+ 116,
2326
+ 105,
2327
+ 116,
2328
+ 121
2329
+ ]
2330
+ },
2331
+ {
2332
+ kind: "account",
2333
+ path: "authority"
2334
+ }
2335
+ ]
2336
+ }
2337
+ },
2338
+ {
2339
+ name: "verification_result",
2340
+ docs: [
2341
+ "PDA seeds validated by Anchor; layout + owner + cross-field constraints",
2342
+ "validated in instruction body. Binds the ZK proof to this specific",
2343
+ "update \u2014 without this account, update_anchor would accept any commitment",
2344
+ "with no proof."
2345
+ ],
2346
+ pda: {
2347
+ seeds: [
2348
+ {
2349
+ kind: "const",
2350
+ value: [
2351
+ 118,
2352
+ 101,
2353
+ 114,
2354
+ 105,
2355
+ 102,
2356
+ 105,
2357
+ 99,
2358
+ 97,
2359
+ 116,
2360
+ 105,
2361
+ 111,
2362
+ 110
2363
+ ]
2364
+ },
2365
+ {
2366
+ kind: "account",
2367
+ path: "authority"
2368
+ },
2369
+ {
2370
+ kind: "arg",
2371
+ path: "verification_nonce"
2372
+ }
2373
+ ],
2374
+ program: {
2375
+ kind: "const",
2376
+ value: [
2377
+ 48,
2378
+ 50,
2379
+ 94,
2380
+ 115,
2381
+ 90,
2382
+ 162,
2383
+ 108,
2384
+ 8,
2385
+ 240,
2386
+ 151,
2387
+ 76,
2388
+ 223,
2389
+ 101,
2390
+ 176,
2391
+ 170,
2392
+ 86,
2393
+ 254,
2394
+ 247,
2395
+ 252,
2396
+ 28,
2397
+ 240,
2398
+ 145,
2399
+ 60,
2400
+ 108,
2401
+ 42,
2402
+ 129,
2403
+ 105,
2404
+ 32,
2405
+ 232,
2406
+ 212,
2407
+ 226,
2408
+ 52
2409
+ ]
2410
+ }
2411
+ }
2412
+ },
2413
+ {
2414
+ name: "protocol_config",
2415
+ docs: [
2416
+ "Validated by seeds + owner via seeds::program."
2417
+ ],
2418
+ pda: {
2419
+ seeds: [
2420
+ {
2421
+ kind: "const",
2422
+ value: [
2423
+ 112,
2424
+ 114,
2425
+ 111,
2426
+ 116,
2427
+ 111,
2428
+ 99,
2429
+ 111,
2430
+ 108,
2431
+ 95,
2432
+ 99,
2433
+ 111,
2434
+ 110,
2435
+ 102,
2436
+ 105,
2437
+ 103
2438
+ ]
2439
+ }
2440
+ ],
2441
+ program: {
2442
+ kind: "const",
2443
+ value: [
2444
+ 81,
2445
+ 130,
2446
+ 250,
2447
+ 230,
2448
+ 30,
2449
+ 253,
2450
+ 246,
2451
+ 69,
2452
+ 82,
2453
+ 96,
2454
+ 7,
2455
+ 173,
2456
+ 78,
2457
+ 160,
2458
+ 131,
2459
+ 188,
2460
+ 70,
2461
+ 106,
2462
+ 173,
2463
+ 59,
2464
+ 102,
2465
+ 163,
2466
+ 198,
2467
+ 189,
2468
+ 82,
2469
+ 37,
2470
+ 225,
2471
+ 38,
2472
+ 52,
2473
+ 233,
2474
+ 157,
2475
+ 117
2476
+ ]
2477
+ }
2478
+ }
2479
+ },
2480
+ {
2481
+ name: "treasury",
2482
+ writable: true,
2483
+ pda: {
2484
+ seeds: [
2485
+ {
2486
+ kind: "const",
2487
+ value: [
2488
+ 112,
2489
+ 114,
2490
+ 111,
2491
+ 116,
2492
+ 111,
2493
+ 99,
2494
+ 111,
2495
+ 108,
2496
+ 95,
2497
+ 116,
2498
+ 114,
2499
+ 101,
2500
+ 97,
2501
+ 115,
2502
+ 117,
2503
+ 114,
2504
+ 121
2505
+ ]
2506
+ }
2507
+ ],
2508
+ program: {
2509
+ kind: "const",
2510
+ value: [
2511
+ 81,
2512
+ 130,
2513
+ 250,
2514
+ 230,
2515
+ 30,
2516
+ 253,
2517
+ 246,
2518
+ 69,
2519
+ 82,
2520
+ 96,
2521
+ 7,
2522
+ 173,
2523
+ 78,
2524
+ 160,
2525
+ 131,
2526
+ 188,
2527
+ 70,
2528
+ 106,
2529
+ 173,
2530
+ 59,
2531
+ 102,
2532
+ 163,
2533
+ 198,
2534
+ 189,
2535
+ 82,
2536
+ 37,
2537
+ 225,
2538
+ 38,
2539
+ 52,
2540
+ 233,
2541
+ 157,
2542
+ 117
2543
+ ]
2544
+ }
2545
+ }
2546
+ },
2547
+ {
2548
+ name: "system_program",
2549
+ address: "11111111111111111111111111111111"
2550
+ }
2551
+ ],
2552
+ args: [
2553
+ {
2554
+ name: "new_commitment",
2555
+ type: {
2556
+ array: [
2557
+ "u8",
2558
+ 32
2559
+ ]
2560
+ }
2561
+ },
2562
+ {
2563
+ name: "verification_nonce",
2564
+ type: {
2565
+ array: [
2566
+ "u8",
2567
+ 32
2568
+ ]
2569
+ }
2570
+ }
2571
+ ]
2572
+ }
2573
+ ],
2574
+ accounts: [
2575
+ {
2576
+ name: "IdentityState",
2577
+ discriminator: [
2578
+ 156,
2579
+ 32,
2580
+ 87,
2581
+ 93,
2582
+ 52,
2583
+ 155,
2584
+ 248,
2585
+ 207
2586
+ ]
2587
+ }
2588
+ ],
2589
+ events: [
2590
+ {
2591
+ name: "AnchorMinted",
2592
+ discriminator: [
2593
+ 11,
2594
+ 188,
2595
+ 6,
2596
+ 169,
2597
+ 20,
2598
+ 50,
2599
+ 128,
2600
+ 172
2601
+ ]
2602
+ },
2603
+ {
2604
+ name: "AnchorReset",
2605
+ discriminator: [
2606
+ 183,
2607
+ 48,
2608
+ 146,
2609
+ 155,
2610
+ 112,
2611
+ 20,
2612
+ 140,
2613
+ 31
2614
+ ]
2615
+ },
2616
+ {
2617
+ name: "AnchorUpdated",
2618
+ discriminator: [
2619
+ 112,
2620
+ 73,
2621
+ 210,
2622
+ 183,
2623
+ 57,
2624
+ 84,
2625
+ 103,
2626
+ 59
2627
+ ]
2628
+ },
2629
+ {
2630
+ name: "MigrateIdentityEvent",
2631
+ discriminator: [
2632
+ 33,
2633
+ 239,
2634
+ 166,
2635
+ 187,
2636
+ 108,
2637
+ 47,
2638
+ 49,
2639
+ 139
2640
+ ]
2641
+ }
2642
+ ],
2643
+ errors: [
2644
+ {
2645
+ code: 6e3,
2646
+ name: "InvalidCommitment",
2647
+ msg: "Invalid commitment: must be 32 non-zero bytes"
2648
+ },
2649
+ {
2650
+ code: 6001,
2651
+ name: "Unauthorized",
2652
+ msg: "Unauthorized: caller is not the identity owner"
2653
+ },
2654
+ {
2655
+ code: 6002,
2656
+ name: "ArithmeticOverflow",
2657
+ msg: "Arithmetic overflow"
2658
+ },
2659
+ {
2660
+ code: 6003,
2661
+ name: "InvalidProtocolConfig",
2662
+ msg: "Invalid protocol config account"
2663
+ },
2664
+ {
2665
+ code: 6004,
2666
+ name: "InvalidIdentityState",
2667
+ msg: "Identity state account failed to deserialize"
2668
+ },
2669
+ {
2670
+ code: 6005,
2671
+ name: "IdentitySerializationFailed",
2672
+ msg: "Identity state account failed to serialize"
2673
+ },
2674
+ {
2675
+ code: 6006,
2676
+ name: "VerificationResultWrongOwner",
2677
+ msg: "VerificationResult account is owned by the wrong program"
2678
+ },
2679
+ {
2680
+ code: 6007,
2681
+ name: "StaleVerificationResult",
2682
+ msg: "VerificationResult account has stale layout (pre-binding-patch)"
2683
+ },
2684
+ {
2685
+ code: 6008,
2686
+ name: "VerifierMismatch",
2687
+ msg: "VerificationResult verifier does not match the signing authority"
2688
+ },
2689
+ {
2690
+ code: 6009,
2691
+ name: "ProofExpired",
2692
+ msg: "Proof is too old to consume (MAX_PROOF_AGE_SECS exceeded)"
2693
+ },
2694
+ {
2695
+ code: 6010,
2696
+ name: "CommitmentMismatch",
2697
+ msg: "Proof commitment_new does not match the submitted new_commitment"
2698
+ },
2699
+ {
2700
+ code: 6011,
2701
+ name: "PrevCommitmentMismatch",
2702
+ msg: "Proof commitment_prev does not match the identity's current_commitment"
2703
+ },
2704
+ {
2705
+ code: 6012,
2706
+ name: "ResetCooldownActive",
2707
+ msg: "Reset cooldown has not elapsed since the last reset"
2708
+ },
2709
+ {
2710
+ code: 6013,
2711
+ name: "UnauthorizedNewWallet",
2712
+ msg: "caller is not authorized by the old identity"
2713
+ },
2714
+ {
2715
+ code: 6014,
2716
+ name: "ProofFromFuture",
2717
+ msg: "VerificationResult.verified_at is in the future relative to the cluster clock"
2718
+ },
2719
+ {
2720
+ code: 6015,
2721
+ name: "MissingValidatorReceipt",
2722
+ msg: "mint_anchor expected a preceding Ed25519Program::verify instruction with a validator-signed receipt; none found"
2723
+ },
2724
+ {
2725
+ code: 6016,
2726
+ name: "ReceiptValidatorMismatch",
2727
+ msg: "Receipt was signed by a key that does not match ProtocolConfig.validator_pubkey"
2728
+ },
2729
+ {
2730
+ code: 6017,
2731
+ name: "ReceiptCommitmentMismatch",
2732
+ msg: "Receipt commitment does not match the mint_anchor commitment argument"
2733
+ },
2734
+ {
2735
+ code: 6018,
2736
+ name: "ReceiptWalletMismatch",
2737
+ msg: "Receipt wallet does not match the mint signer"
2738
+ },
2739
+ {
2740
+ code: 6019,
2741
+ name: "ReceiptExpired",
2742
+ msg: "Receipt has aged past MAX_RECEIPT_AGE_SECS"
2743
+ },
2744
+ {
2745
+ code: 6020,
2746
+ name: "ReceiptFromFuture",
2747
+ msg: "Receipt validated_at is in the future relative to the cluster clock"
2748
+ },
2749
+ {
2750
+ code: 6021,
2751
+ name: "MalformedReceiptMessage",
2752
+ msg: "Receipt message has malformed length or layout"
2753
+ }
2754
+ ],
2755
+ types: [
2756
+ {
2757
+ name: "AnchorMinted",
2758
+ type: {
2759
+ kind: "struct",
2760
+ fields: [
2761
+ {
2762
+ name: "owner",
2763
+ type: "pubkey"
2764
+ },
2765
+ {
2766
+ name: "mint",
2767
+ type: "pubkey"
2768
+ },
2769
+ {
2770
+ name: "commitment",
2771
+ type: {
2772
+ array: [
2773
+ "u8",
2774
+ 32
2775
+ ]
2776
+ }
2777
+ }
2778
+ ]
2779
+ }
2780
+ },
2781
+ {
2782
+ name: "AnchorReset",
2783
+ type: {
2784
+ kind: "struct",
2785
+ fields: [
2786
+ {
2787
+ name: "owner",
2788
+ type: "pubkey"
2789
+ },
2790
+ {
2791
+ name: "mint",
2792
+ type: "pubkey"
2793
+ },
2794
+ {
2795
+ name: "commitment",
2796
+ type: {
2797
+ array: [
2798
+ "u8",
2799
+ 32
2800
+ ]
2801
+ }
2802
+ }
2803
+ ]
2804
+ }
2805
+ },
2806
+ {
2807
+ name: "AnchorUpdated",
2808
+ type: {
2809
+ kind: "struct",
2810
+ fields: [
2811
+ {
2812
+ name: "owner",
2813
+ type: "pubkey"
2814
+ },
2815
+ {
2816
+ name: "verification_count",
2817
+ type: "u32"
2818
+ },
2819
+ {
2820
+ name: "trust_score",
2821
+ type: "u16"
2822
+ },
2823
+ {
2824
+ name: "commitment",
2825
+ type: {
2826
+ array: [
2827
+ "u8",
2828
+ 32
2829
+ ]
2830
+ }
2831
+ }
2832
+ ]
2833
+ }
2834
+ },
2835
+ {
2836
+ name: "IdentityState",
2837
+ type: {
2838
+ kind: "struct",
2839
+ fields: [
2840
+ {
2841
+ name: "owner",
2842
+ docs: [
2843
+ "The user's wallet pubkey"
2844
+ ],
2845
+ type: "pubkey"
2846
+ },
2847
+ {
2848
+ name: "creation_timestamp",
2849
+ docs: [
2850
+ "When the identity was first minted"
2851
+ ],
2852
+ type: "i64"
2853
+ },
2854
+ {
2855
+ name: "last_verification_timestamp",
2856
+ docs: [
2857
+ "Most recent successful verification"
2858
+ ],
2859
+ type: "i64"
2860
+ },
2861
+ {
2862
+ name: "verification_count",
2863
+ docs: [
2864
+ "Total successful verifications"
2865
+ ],
2866
+ type: "u32"
2867
+ },
2868
+ {
2869
+ name: "trust_score",
2870
+ docs: [
2871
+ "Computed reputation metric"
2872
+ ],
2873
+ type: "u16"
2874
+ },
2875
+ {
2876
+ name: "current_commitment",
2877
+ docs: [
2878
+ "Latest Poseidon commitment H_TBH"
2879
+ ],
2880
+ type: {
2881
+ array: [
2882
+ "u8",
2883
+ 32
2884
+ ]
2885
+ }
2886
+ },
2887
+ {
2888
+ name: "mint",
2889
+ docs: [
2890
+ "The NonTransferable mint associated with this identity"
2891
+ ],
2892
+ type: "pubkey"
2893
+ },
2894
+ {
2895
+ name: "bump",
2896
+ docs: [
2897
+ "PDA bump seed"
2898
+ ],
2899
+ type: "u8"
2900
+ },
2901
+ {
2902
+ name: "recent_timestamps",
2903
+ docs: [
2904
+ "Timestamps of last 52 verifications (newest at index 0).",
2905
+ "52 slots covers 1 year of weekly or 4+ years of monthly verifications.",
2906
+ "Older entries contribute negligible score due to exponential recency decay."
2907
+ ],
2908
+ type: {
2909
+ array: [
2910
+ "i64",
2911
+ 52
2912
+ ]
2913
+ }
2914
+ },
2915
+ {
2916
+ name: "last_reset_timestamp",
2917
+ docs: [
2918
+ "Most recent `reset_identity_state` invocation. Zero when the identity",
2919
+ "has never been reset (including freshly minted accounts and accounts",
2920
+ "created before this field existed and then realloc'd in-place)."
2921
+ ],
2922
+ type: "i64"
2923
+ },
2924
+ {
2925
+ name: "new_wallet",
2926
+ docs: [
2927
+ "new wallet for migrate_identity()"
2928
+ ],
2929
+ type: "pubkey"
2930
+ }
2931
+ ]
2932
+ }
2933
+ },
2934
+ {
2935
+ name: "MigrateIdentityEvent",
2936
+ type: {
2937
+ kind: "struct",
2938
+ fields: [
2939
+ {
2940
+ name: "wallet_old",
2941
+ type: "pubkey"
2942
+ },
2943
+ {
2944
+ name: "wallet_new",
2945
+ type: "pubkey"
2946
+ },
2947
+ {
2948
+ name: "identity_old",
2949
+ type: "pubkey"
2950
+ },
2951
+ {
2952
+ name: "identity_new",
2953
+ type: "pubkey"
2954
+ }
2955
+ ]
2956
+ }
2957
+ }
2958
+ ]
2959
+ };
2960
+
2961
+ // src/protocol/idl/entros_verifier.json
2962
+ var entros_verifier_default = {
2963
+ address: "4F97jNoxQzT2qRbkWpW3ztC3Nz2TtKj3rnKG8ExgnrfV",
2964
+ metadata: {
2965
+ name: "entros_verifier",
2966
+ version: "0.1.0",
2967
+ spec: "0.1.0",
2968
+ description: "ZK proof verification program for Entros Protocol"
2969
+ },
2970
+ instructions: [
2971
+ {
2972
+ name: "close_challenge",
2973
+ docs: [
2974
+ "Close a used or expired challenge account to reclaim rent."
2975
+ ],
2976
+ discriminator: [
2977
+ 29,
2978
+ 156,
2979
+ 109,
2980
+ 17,
2981
+ 41,
2982
+ 99,
2983
+ 71,
2984
+ 236
2985
+ ],
2986
+ accounts: [
2987
+ {
2988
+ name: "challenger",
2989
+ writable: true,
2990
+ signer: true
2991
+ },
2992
+ {
2993
+ name: "challenge",
2994
+ writable: true
2995
+ }
2996
+ ],
2997
+ args: []
2998
+ },
2999
+ {
3000
+ name: "close_verification_result",
3001
+ docs: [
3002
+ "Close a verification result account to reclaim rent."
3003
+ ],
3004
+ discriminator: [
3005
+ 202,
3006
+ 203,
3007
+ 62,
3008
+ 127,
3009
+ 7,
3010
+ 157,
3011
+ 143,
3012
+ 12
3013
+ ],
3014
+ accounts: [
3015
+ {
3016
+ name: "verifier",
3017
+ writable: true,
3018
+ signer: true
3019
+ },
3020
+ {
3021
+ name: "verification_result",
3022
+ writable: true
3023
+ }
3024
+ ],
3025
+ args: []
3026
+ },
3027
+ {
3028
+ name: "create_challenge",
3029
+ docs: [
3030
+ "Create a verification challenge with a client-generated nonce."
3031
+ ],
3032
+ discriminator: [
3033
+ 170,
3034
+ 244,
3035
+ 47,
3036
+ 1,
3037
+ 1,
3038
+ 15,
3039
+ 173,
3040
+ 239
3041
+ ],
3042
+ accounts: [
3043
+ {
3044
+ name: "challenger",
3045
+ writable: true,
3046
+ signer: true
3047
+ },
3048
+ {
3049
+ name: "challenge",
3050
+ writable: true,
3051
+ pda: {
3052
+ seeds: [
3053
+ {
3054
+ kind: "const",
3055
+ value: [
3056
+ 99,
3057
+ 104,
3058
+ 97,
3059
+ 108,
3060
+ 108,
3061
+ 101,
3062
+ 110,
3063
+ 103,
3064
+ 101
3065
+ ]
3066
+ },
3067
+ {
3068
+ kind: "account",
3069
+ path: "challenger"
3070
+ },
3071
+ {
3072
+ kind: "arg",
3073
+ path: "nonce"
3074
+ }
3075
+ ]
3076
+ }
3077
+ },
3078
+ {
3079
+ name: "system_program",
3080
+ address: "11111111111111111111111111111111"
3081
+ }
3082
+ ],
3083
+ args: [
3084
+ {
3085
+ name: "nonce",
3086
+ type: {
3087
+ array: [
3088
+ "u8",
3089
+ 32
3090
+ ]
3091
+ }
3092
+ }
3093
+ ]
3094
+ },
3095
+ {
3096
+ name: "verify_proof",
3097
+ docs: [
3098
+ "Verify a proof against a challenge.",
3099
+ "Validates the challenge is unused and not expired, runs mock verification,",
3100
+ "and stores the result."
3101
+ ],
3102
+ discriminator: [
3103
+ 217,
3104
+ 211,
3105
+ 191,
3106
+ 110,
3107
+ 144,
3108
+ 13,
3109
+ 186,
3110
+ 98
3111
+ ],
3112
+ accounts: [
3113
+ {
3114
+ name: "verifier",
3115
+ writable: true,
3116
+ signer: true
3117
+ },
3118
+ {
3119
+ name: "challenge",
3120
+ writable: true,
3121
+ pda: {
3122
+ seeds: [
3123
+ {
3124
+ kind: "const",
3125
+ value: [
3126
+ 99,
3127
+ 104,
3128
+ 97,
3129
+ 108,
3130
+ 108,
3131
+ 101,
3132
+ 110,
3133
+ 103,
3134
+ 101
3135
+ ]
3136
+ },
3137
+ {
3138
+ kind: "account",
3139
+ path: "verifier"
3140
+ },
3141
+ {
3142
+ kind: "arg",
3143
+ path: "nonce"
3144
+ }
3145
+ ]
3146
+ }
3147
+ },
3148
+ {
3149
+ name: "verification_result",
3150
+ writable: true,
3151
+ pda: {
3152
+ seeds: [
3153
+ {
3154
+ kind: "const",
3155
+ value: [
3156
+ 118,
3157
+ 101,
3158
+ 114,
3159
+ 105,
3160
+ 102,
3161
+ 105,
3162
+ 99,
3163
+ 97,
3164
+ 116,
3165
+ 105,
3166
+ 111,
3167
+ 110
3168
+ ]
3169
+ },
3170
+ {
3171
+ kind: "account",
3172
+ path: "verifier"
3173
+ },
3174
+ {
3175
+ kind: "arg",
3176
+ path: "nonce"
3177
+ }
3178
+ ]
3179
+ }
3180
+ },
3181
+ {
3182
+ name: "system_program",
3183
+ address: "11111111111111111111111111111111"
3184
+ }
3185
+ ],
3186
+ args: [
3187
+ {
3188
+ name: "proof_bytes",
3189
+ type: "bytes"
3190
+ },
3191
+ {
3192
+ name: "public_inputs",
3193
+ type: {
3194
+ vec: {
3195
+ array: [
3196
+ "u8",
3197
+ 32
3198
+ ]
3199
+ }
3200
+ }
3201
+ },
3202
+ {
3203
+ name: "nonce",
3204
+ type: {
3205
+ array: [
3206
+ "u8",
3207
+ 32
3208
+ ]
3209
+ }
3210
+ }
3211
+ ]
3212
+ }
3213
+ ],
3214
+ accounts: [
3215
+ {
3216
+ name: "Challenge",
3217
+ discriminator: [
3218
+ 119,
3219
+ 250,
3220
+ 161,
3221
+ 121,
3222
+ 119,
3223
+ 81,
3224
+ 22,
3225
+ 208
3226
+ ]
3227
+ },
3228
+ {
3229
+ name: "VerificationResult",
3230
+ discriminator: [
3231
+ 104,
3232
+ 111,
3233
+ 80,
3234
+ 172,
3235
+ 219,
3236
+ 191,
3237
+ 162,
3238
+ 38
3239
+ ]
3240
+ }
3241
+ ],
3242
+ events: [
3243
+ {
3244
+ name: "ChallengeCreated",
3245
+ discriminator: [
3246
+ 166,
3247
+ 178,
3248
+ 174,
3249
+ 178,
3250
+ 11,
3251
+ 172,
3252
+ 98,
3253
+ 243
3254
+ ]
3255
+ },
3256
+ {
3257
+ name: "VerificationComplete",
3258
+ discriminator: [
3259
+ 22,
3260
+ 74,
3261
+ 77,
3262
+ 232,
3263
+ 220,
3264
+ 46,
3265
+ 59,
3266
+ 120
3267
+ ]
3268
+ }
3269
+ ],
3270
+ errors: [
3271
+ {
3272
+ code: 6e3,
3273
+ name: "InvalidProofFormat",
3274
+ msg: "Invalid proof format"
3275
+ },
3276
+ {
3277
+ code: 6001,
3278
+ name: "ProofVerificationFailed",
3279
+ msg: "Proof verification failed"
3280
+ },
3281
+ {
3282
+ code: 6002,
3283
+ name: "ChallengeExpired",
3284
+ msg: "Challenge has expired"
3285
+ },
3286
+ {
3287
+ code: 6003,
3288
+ name: "ChallengeAlreadyUsed",
3289
+ msg: "Challenge already used"
3290
+ },
3291
+ {
3292
+ code: 6004,
3293
+ name: "InvalidPublicInputs",
3294
+ msg: "Invalid public inputs"
3295
+ },
3296
+ {
3297
+ code: 6005,
3298
+ name: "ChallengeNotUsed",
3299
+ msg: "Challenge must be used before closing"
3300
+ },
3301
+ {
3302
+ code: 6006,
3303
+ name: "InvalidNonce",
3304
+ msg: "Invalid nonce: must not be all zeros"
3305
+ },
3306
+ {
3307
+ code: 6007,
3308
+ name: "ArithmeticOverflow",
3309
+ msg: "Arithmetic overflow"
3310
+ }
3311
+ ],
3312
+ types: [
3313
+ {
3314
+ name: "Challenge",
3315
+ type: {
3316
+ kind: "struct",
3317
+ fields: [
3318
+ {
3319
+ name: "challenger",
3320
+ docs: [
3321
+ "The user who requested the challenge"
3322
+ ],
3323
+ type: "pubkey"
3324
+ },
3325
+ {
3326
+ name: "nonce",
3327
+ docs: [
3328
+ "Random nonce for anti-replay"
3329
+ ],
3330
+ type: {
3331
+ array: [
3332
+ "u8",
3333
+ 32
3334
+ ]
3335
+ }
3336
+ },
3337
+ {
3338
+ name: "created_at",
3339
+ docs: [
3340
+ "Unix timestamp when challenge was created"
3341
+ ],
3342
+ type: "i64"
3343
+ },
3344
+ {
3345
+ name: "expires_at",
3346
+ docs: [
3347
+ "Unix timestamp when challenge expires"
3348
+ ],
3349
+ type: "i64"
3350
+ },
3351
+ {
3352
+ name: "used",
3353
+ docs: [
3354
+ "Whether this challenge has been consumed"
3355
+ ],
3356
+ type: "bool"
3357
+ },
3358
+ {
3359
+ name: "bump",
3360
+ docs: [
3361
+ "PDA bump seed"
3362
+ ],
3363
+ type: "u8"
3364
+ }
3365
+ ]
3366
+ }
3367
+ },
3368
+ {
3369
+ name: "ChallengeCreated",
3370
+ type: {
3371
+ kind: "struct",
3372
+ fields: [
3373
+ {
3374
+ name: "challenger",
3375
+ type: "pubkey"
3376
+ },
3377
+ {
3378
+ name: "nonce",
3379
+ type: {
3380
+ array: [
3381
+ "u8",
3382
+ 32
3383
+ ]
3384
+ }
3385
+ },
3386
+ {
3387
+ name: "expires_at",
3388
+ type: "i64"
3389
+ }
3390
+ ]
3391
+ }
3392
+ },
3393
+ {
3394
+ name: "VerificationComplete",
3395
+ type: {
3396
+ kind: "struct",
3397
+ fields: [
3398
+ {
3399
+ name: "verifier",
3400
+ type: "pubkey"
3401
+ },
3402
+ {
3403
+ name: "is_valid",
3404
+ type: "bool"
3405
+ },
3406
+ {
3407
+ name: "nonce",
3408
+ type: {
3409
+ array: [
3410
+ "u8",
3411
+ 32
3412
+ ]
3413
+ }
3414
+ }
3415
+ ]
3416
+ }
3417
+ },
3418
+ {
3419
+ name: "VerificationResult",
3420
+ type: {
3421
+ kind: "struct",
3422
+ fields: [
3423
+ {
3424
+ name: "verifier",
3425
+ docs: [
3426
+ "Who submitted the proof"
3427
+ ],
3428
+ type: "pubkey"
3429
+ },
3430
+ {
3431
+ name: "proof_hash",
3432
+ docs: [
3433
+ "Hash of the proof bytes for audit trail"
3434
+ ],
3435
+ type: {
3436
+ array: [
3437
+ "u8",
3438
+ 32
3439
+ ]
3440
+ }
3441
+ },
3442
+ {
3443
+ name: "verified_at",
3444
+ docs: [
3445
+ "Unix timestamp of verification"
3446
+ ],
3447
+ type: "i64"
3448
+ },
3449
+ {
3450
+ name: "is_valid",
3451
+ docs: [
3452
+ "Whether the proof was valid.",
3453
+ "Always true for persisted records \u2014 invalid proofs revert the transaction",
3454
+ "and never create a VerificationResult. Retained for account layout stability."
3455
+ ],
3456
+ type: "bool"
3457
+ },
3458
+ {
3459
+ name: "challenge_nonce",
3460
+ docs: [
3461
+ "The challenge nonce that was consumed"
3462
+ ],
3463
+ type: {
3464
+ array: [
3465
+ "u8",
3466
+ 32
3467
+ ]
3468
+ }
3469
+ },
3470
+ {
3471
+ name: "bump",
3472
+ docs: [
3473
+ "PDA bump seed"
3474
+ ],
3475
+ type: "u8"
3476
+ },
3477
+ {
3478
+ name: "commitment_new",
3479
+ docs: [
3480
+ "New fingerprint commitment from public_inputs[0]. Read cross-program",
3481
+ "by entros-anchor::update_anchor to bind the proof to the identity update."
3482
+ ],
3483
+ type: {
3484
+ array: [
3485
+ "u8",
3486
+ 32
3487
+ ]
3488
+ }
3489
+ },
3490
+ {
3491
+ name: "commitment_prev",
3492
+ docs: [
3493
+ "Previous fingerprint commitment from public_inputs[1]. Read cross-program",
3494
+ "by entros-anchor::update_anchor to bind to the identity's stored commitment."
3495
+ ],
3496
+ type: {
3497
+ array: [
3498
+ "u8",
3499
+ 32
3500
+ ]
3501
+ }
3502
+ },
3503
+ {
3504
+ name: "threshold",
3505
+ docs: [
3506
+ "Hamming threshold from public_inputs[2]. Bounded at proof time to prevent",
3507
+ "attacker-chosen circuit parameters."
3508
+ ],
3509
+ type: "u16"
3510
+ },
3511
+ {
3512
+ name: "min_distance",
3513
+ docs: [
3514
+ "Hamming min_distance from public_inputs[3]. Bounded at proof time to",
3515
+ "prevent replay (Hamming=0) attacks via attacker-chosen min_distance=0."
3516
+ ],
3517
+ type: "u16"
3518
+ }
3519
+ ]
3520
+ }
3521
+ }
3522
+ ]
3523
+ };
3524
+
1276
3525
  // src/submit/receipt.ts
1277
3526
  var PUBKEY_BYTES = 32;
1278
3527
  var SIGNATURE_BYTES = 64;
@@ -1313,6 +3562,17 @@ async function buildEd25519ReceiptIx(receipt) {
1313
3562
  }
1314
3563
 
1315
3564
  // src/submit/wallet.ts
3565
+ async function confirmAndCheck(connection, signature) {
3566
+ if (!signature) {
3567
+ throw new Error("confirmAndCheck called without a transaction signature");
3568
+ }
3569
+ const confirmation = await connection.confirmTransaction(signature, "confirmed");
3570
+ if (confirmation?.value?.err != null) {
3571
+ throw new Error(
3572
+ `Transaction failed on chain: ${JSON.stringify(confirmation.value.err)} (sig=${signature})`
3573
+ );
3574
+ }
3575
+ }
1316
3576
  async function requestSasAttestation(wallet, walletAddress, relayerUrl, relayerApiKey, serverNonce) {
1317
3577
  if (!serverNonce) {
1318
3578
  sdkLog("[Entros SDK] Skipping SAS attestation: no server-issued nonce");
@@ -1455,24 +3715,14 @@ async function submitViaWallet(proof, commitment, options) {
1455
3715
  [new TextEncoder().encode("protocol_treasury")],
1456
3716
  registryProgramId
1457
3717
  );
1458
- const [verifierIdl, anchorIdl] = await Promise.all([
1459
- anchor.Program.fetchIdl(verifierProgramId, provider),
1460
- anchor.Program.fetchIdl(anchorProgramId, provider)
1461
- ]);
1462
- if (!verifierIdl) {
1463
- return {
1464
- success: false,
1465
- error: `Failed to fetch entros-verifier IDL from Solana (program ${PROGRAM_IDS.entrosVerifier}). Check your RPC endpoint is reachable and on the correct cluster.`
1466
- };
1467
- }
1468
- if (!anchorIdl) {
1469
- return {
1470
- success: false,
1471
- error: `Failed to fetch entros-anchor IDL from Solana (program ${PROGRAM_IDS.entrosAnchor}). Check your RPC endpoint is reachable and on the correct cluster.`
1472
- };
1473
- }
1474
- const verifierProgram = new anchor.Program(verifierIdl, provider);
1475
- const anchorProgram = new anchor.Program(anchorIdl, provider);
3718
+ const verifierProgram = new anchor.Program(
3719
+ entros_verifier_default,
3720
+ provider
3721
+ );
3722
+ const anchorProgram = new anchor.Program(
3723
+ entros_anchor_default,
3724
+ provider
3725
+ );
1476
3726
  const { Buffer: SolBuffer } = await import("buffer");
1477
3727
  const createChallengeIx = await verifierProgram.methods.createChallenge(nonce).accounts({
1478
3728
  challenger: provider.wallet.publicKey,
@@ -1507,16 +3757,12 @@ async function submitViaWallet(proof, commitment, options) {
1507
3757
  txSig = await options.wallet.sendTransaction(tx, options.connection, {
1508
3758
  skipPreflight: true
1509
3759
  });
1510
- await options.connection.confirmTransaction(txSig, "confirmed");
3760
+ await confirmAndCheck(options.connection, txSig);
1511
3761
  } else {
1512
- const anchorIdl = await anchor.Program.fetchIdl(anchorProgramId, provider);
1513
- if (!anchorIdl) {
1514
- return {
1515
- success: false,
1516
- error: `Failed to fetch entros-anchor IDL from Solana (program ${PROGRAM_IDS.entrosAnchor}). Check your RPC endpoint is reachable and on the correct cluster.`
1517
- };
1518
- }
1519
- const anchorProgram = new anchor.Program(anchorIdl, provider);
3762
+ const anchorProgram = new anchor.Program(
3763
+ entros_anchor_default,
3764
+ provider
3765
+ );
1520
3766
  const [identityPda] = PublicKey.findProgramAddressSync(
1521
3767
  [new TextEncoder().encode("identity"), provider.wallet.publicKey.toBuffer()],
1522
3768
  anchorProgramId
@@ -1589,7 +3835,7 @@ async function submitViaWallet(proof, commitment, options) {
1589
3835
  txSig = await options.wallet.sendTransaction(tx, options.connection, {
1590
3836
  skipPreflight: true
1591
3837
  });
1592
- await options.connection.confirmTransaction(txSig, "confirmed");
3838
+ await confirmAndCheck(options.connection, txSig);
1593
3839
  }
1594
3840
  const attestationTx = options.relayerUrl ? await requestSasAttestation(
1595
3841
  options.wallet,
@@ -1626,14 +3872,10 @@ async function submitResetViaWallet(commitment, options) {
1626
3872
  [new TextEncoder().encode("protocol_treasury")],
1627
3873
  registryProgramId
1628
3874
  );
1629
- const anchorIdl = await anchor.Program.fetchIdl(anchorProgramId, provider);
1630
- if (!anchorIdl) {
1631
- return {
1632
- success: false,
1633
- error: `Failed to fetch entros-anchor IDL from Solana (program ${PROGRAM_IDS.entrosAnchor}). Check your RPC endpoint is reachable and on the correct cluster.`
1634
- };
1635
- }
1636
- const anchorProgram = new anchor.Program(anchorIdl, provider);
3875
+ const anchorProgram = new anchor.Program(
3876
+ entros_anchor_default,
3877
+ provider
3878
+ );
1637
3879
  const resetIx = await anchorProgram.methods.resetIdentityState(Array.from(commitment)).accounts({
1638
3880
  authority: provider.wallet.publicKey,
1639
3881
  identityState: identityPda,
@@ -1651,7 +3893,7 @@ async function submitResetViaWallet(commitment, options) {
1651
3893
  options.connection,
1652
3894
  { skipPreflight: true }
1653
3895
  );
1654
- await options.connection.confirmTransaction(txSig, "confirmed");
3896
+ await confirmAndCheck(options.connection, txSig);
1655
3897
  const attestationTx = options.relayerUrl ? await requestSasAttestation(
1656
3898
  options.wallet,
1657
3899
  provider.wallet.publicKey.toBase58(),
@@ -1861,11 +4103,7 @@ async function fetchIdentityState(walletPubkey, connection) {
1861
4103
  );
1862
4104
  const accountInfo = await connection.getAccountInfo(identityPda);
1863
4105
  if (!accountInfo) return null;
1864
- const idl = await anchor.Program.fetchIdl(programId, {
1865
- connection
1866
- });
1867
- if (!idl) return null;
1868
- const coder = new anchor.BorshAccountsCoder(idl);
4106
+ const coder = new anchor.BorshAccountsCoder(entros_anchor_default);
1869
4107
  const decoded = coder.decode("identityState", accountInfo.data);
1870
4108
  return {
1871
4109
  owner: decoded.owner.toBase58(),