@liquid-af/sdk 0.5.8 → 0.6.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.
@@ -1045,6 +1045,988 @@
1045
1045
  }
1046
1046
  ]
1047
1047
  },
1048
+ {
1049
+ "name": "buy_exact",
1050
+ "docs": [
1051
+ "Buys base tokens by providing an exact amount of quote tokens (exact input).",
1052
+ "",
1053
+ "# Arguments",
1054
+ "* `amount_in` - Exact quote tokens to spend.",
1055
+ "* `minimum_amount_out` - Minimum base tokens to receive (slippage protection)."
1056
+ ],
1057
+ "discriminator": [
1058
+ 2,
1059
+ 162,
1060
+ 8,
1061
+ 52,
1062
+ 139,
1063
+ 46,
1064
+ 160,
1065
+ 13
1066
+ ],
1067
+ "accounts": [
1068
+ {
1069
+ "name": "payer",
1070
+ "writable": true,
1071
+ "signer": true
1072
+ },
1073
+ {
1074
+ "name": "pool",
1075
+ "docs": [
1076
+ "The program account of the pool in which the swap will be performed."
1077
+ ],
1078
+ "writable": true,
1079
+ "pda": {
1080
+ "seeds": [
1081
+ {
1082
+ "kind": "const",
1083
+ "value": [
1084
+ 112,
1085
+ 111,
1086
+ 111,
1087
+ 108
1088
+ ]
1089
+ },
1090
+ {
1091
+ "kind": "account",
1092
+ "path": "base_mint"
1093
+ },
1094
+ {
1095
+ "kind": "account",
1096
+ "path": "quote_mint"
1097
+ }
1098
+ ]
1099
+ }
1100
+ },
1101
+ {
1102
+ "name": "base_token_account",
1103
+ "docs": [
1104
+ "The user token account for input token."
1105
+ ],
1106
+ "writable": true
1107
+ },
1108
+ {
1109
+ "name": "quote_token_account",
1110
+ "docs": [
1111
+ "The user token account for output token."
1112
+ ],
1113
+ "writable": true
1114
+ },
1115
+ {
1116
+ "name": "base_vault",
1117
+ "docs": [
1118
+ "The vault token account for input token."
1119
+ ],
1120
+ "writable": true,
1121
+ "pda": {
1122
+ "seeds": [
1123
+ {
1124
+ "kind": "const",
1125
+ "value": [
1126
+ 112,
1127
+ 111,
1128
+ 111,
1129
+ 108,
1130
+ 95,
1131
+ 118,
1132
+ 97,
1133
+ 117,
1134
+ 108,
1135
+ 116
1136
+ ]
1137
+ },
1138
+ {
1139
+ "kind": "account",
1140
+ "path": "pool"
1141
+ },
1142
+ {
1143
+ "kind": "account",
1144
+ "path": "base_mint"
1145
+ }
1146
+ ]
1147
+ }
1148
+ },
1149
+ {
1150
+ "name": "quote_vault",
1151
+ "docs": [
1152
+ "The vault token account for output token."
1153
+ ],
1154
+ "writable": true,
1155
+ "pda": {
1156
+ "seeds": [
1157
+ {
1158
+ "kind": "const",
1159
+ "value": [
1160
+ 112,
1161
+ 111,
1162
+ 111,
1163
+ 108,
1164
+ 95,
1165
+ 118,
1166
+ 97,
1167
+ 117,
1168
+ 108,
1169
+ 116
1170
+ ]
1171
+ },
1172
+ {
1173
+ "kind": "account",
1174
+ "path": "pool"
1175
+ },
1176
+ {
1177
+ "kind": "account",
1178
+ "path": "quote_mint"
1179
+ }
1180
+ ]
1181
+ }
1182
+ },
1183
+ {
1184
+ "name": "observation_state",
1185
+ "docs": [
1186
+ "The program account for the most recent oracle observation."
1187
+ ],
1188
+ "writable": true,
1189
+ "pda": {
1190
+ "seeds": [
1191
+ {
1192
+ "kind": "const",
1193
+ "value": [
1194
+ 111,
1195
+ 98,
1196
+ 115,
1197
+ 101,
1198
+ 114,
1199
+ 118,
1200
+ 97,
1201
+ 116,
1202
+ 105,
1203
+ 111,
1204
+ 110
1205
+ ]
1206
+ },
1207
+ {
1208
+ "kind": "account",
1209
+ "path": "pool"
1210
+ }
1211
+ ]
1212
+ }
1213
+ },
1214
+ {
1215
+ "name": "fee_recipient",
1216
+ "docs": [
1217
+ "The protocol fee recipient. Must be one of the allowed recipients in Config.",
1218
+ "",
1219
+ "NOTE: Validation happens in handler by checking against global_config.fee_recipients.",
1220
+ "Fee recipients are admin-controlled pubkeys stored in AmmConfig, so an attacker",
1221
+ "cannot pass an arbitrary account - it must match one of the configured recipients."
1222
+ ],
1223
+ "writable": true
1224
+ },
1225
+ {
1226
+ "name": "protocol_fee_vault",
1227
+ "docs": [
1228
+ "The protocol fee vault."
1229
+ ],
1230
+ "writable": true,
1231
+ "pda": {
1232
+ "seeds": [
1233
+ {
1234
+ "kind": "const",
1235
+ "value": [
1236
+ 103,
1237
+ 108,
1238
+ 111,
1239
+ 98,
1240
+ 97,
1241
+ 108,
1242
+ 95,
1243
+ 102,
1244
+ 101,
1245
+ 101
1246
+ ]
1247
+ },
1248
+ {
1249
+ "kind": "account",
1250
+ "path": "fee_recipient"
1251
+ },
1252
+ {
1253
+ "kind": "account",
1254
+ "path": "quote_mint"
1255
+ }
1256
+ ]
1257
+ }
1258
+ },
1259
+ {
1260
+ "name": "fee_vault",
1261
+ "docs": [
1262
+ "Fee vault PDA from liquid-fees (authority for fee_vault_token_account)."
1263
+ ],
1264
+ "pda": {
1265
+ "seeds": [
1266
+ {
1267
+ "kind": "const",
1268
+ "value": [
1269
+ 102,
1270
+ 101,
1271
+ 101,
1272
+ 95,
1273
+ 118,
1274
+ 97,
1275
+ 117,
1276
+ 108,
1277
+ 116
1278
+ ]
1279
+ },
1280
+ {
1281
+ "kind": "account",
1282
+ "path": "fee_config"
1283
+ }
1284
+ ],
1285
+ "program": {
1286
+ "kind": "const",
1287
+ "value": [
1288
+ 217,
1289
+ 168,
1290
+ 237,
1291
+ 183,
1292
+ 0,
1293
+ 44,
1294
+ 187,
1295
+ 171,
1296
+ 53,
1297
+ 87,
1298
+ 202,
1299
+ 162,
1300
+ 64,
1301
+ 131,
1302
+ 189,
1303
+ 106,
1304
+ 187,
1305
+ 249,
1306
+ 130,
1307
+ 171,
1308
+ 56,
1309
+ 202,
1310
+ 127,
1311
+ 190,
1312
+ 143,
1313
+ 121,
1314
+ 30,
1315
+ 195,
1316
+ 25,
1317
+ 86,
1318
+ 241,
1319
+ 242
1320
+ ]
1321
+ }
1322
+ }
1323
+ },
1324
+ {
1325
+ "name": "fee_vault_token_account",
1326
+ "docs": [
1327
+ "Fee vault token account for Recipients mode — accumulates quote tokens."
1328
+ ],
1329
+ "writable": true,
1330
+ "pda": {
1331
+ "seeds": [
1332
+ {
1333
+ "kind": "account",
1334
+ "path": "fee_vault"
1335
+ },
1336
+ {
1337
+ "kind": "account",
1338
+ "path": "quote_token_program"
1339
+ },
1340
+ {
1341
+ "kind": "account",
1342
+ "path": "quote_mint"
1343
+ }
1344
+ ],
1345
+ "program": {
1346
+ "kind": "const",
1347
+ "value": [
1348
+ 140,
1349
+ 151,
1350
+ 37,
1351
+ 143,
1352
+ 78,
1353
+ 36,
1354
+ 137,
1355
+ 241,
1356
+ 187,
1357
+ 61,
1358
+ 16,
1359
+ 41,
1360
+ 20,
1361
+ 142,
1362
+ 13,
1363
+ 131,
1364
+ 11,
1365
+ 90,
1366
+ 19,
1367
+ 153,
1368
+ 218,
1369
+ 255,
1370
+ 16,
1371
+ 132,
1372
+ 4,
1373
+ 142,
1374
+ 123,
1375
+ 216,
1376
+ 219,
1377
+ 233,
1378
+ 248,
1379
+ 89
1380
+ ]
1381
+ }
1382
+ }
1383
+ },
1384
+ {
1385
+ "name": "buyback_vault",
1386
+ "docs": [
1387
+ "Buyback vault (for Revoked mode) — accumulates quote tokens for buy-and-burn.",
1388
+ "Initialized during pool creation."
1389
+ ],
1390
+ "writable": true,
1391
+ "pda": {
1392
+ "seeds": [
1393
+ {
1394
+ "kind": "const",
1395
+ "value": [
1396
+ 98,
1397
+ 117,
1398
+ 121,
1399
+ 98,
1400
+ 97,
1401
+ 99,
1402
+ 107,
1403
+ 95,
1404
+ 118,
1405
+ 97,
1406
+ 117,
1407
+ 108,
1408
+ 116
1409
+ ]
1410
+ },
1411
+ {
1412
+ "kind": "account",
1413
+ "path": "pool"
1414
+ },
1415
+ {
1416
+ "kind": "account",
1417
+ "path": "quote_mint"
1418
+ }
1419
+ ]
1420
+ }
1421
+ },
1422
+ {
1423
+ "name": "authority",
1424
+ "docs": [
1425
+ "Pool vault and LP mint authority."
1426
+ ],
1427
+ "pda": {
1428
+ "seeds": [
1429
+ {
1430
+ "kind": "const",
1431
+ "value": [
1432
+ 118,
1433
+ 97,
1434
+ 117,
1435
+ 108,
1436
+ 116,
1437
+ 95,
1438
+ 97,
1439
+ 110,
1440
+ 100,
1441
+ 95,
1442
+ 108,
1443
+ 112,
1444
+ 95,
1445
+ 109,
1446
+ 105,
1447
+ 110,
1448
+ 116,
1449
+ 95,
1450
+ 97,
1451
+ 117,
1452
+ 116,
1453
+ 104,
1454
+ 95,
1455
+ 115,
1456
+ 101,
1457
+ 101,
1458
+ 100
1459
+ ]
1460
+ }
1461
+ ]
1462
+ }
1463
+ },
1464
+ {
1465
+ "name": "global_config",
1466
+ "docs": [
1467
+ "Global configuration for the protocol."
1468
+ ],
1469
+ "pda": {
1470
+ "seeds": [
1471
+ {
1472
+ "kind": "const",
1473
+ "value": [
1474
+ 103,
1475
+ 108,
1476
+ 111,
1477
+ 98,
1478
+ 97,
1479
+ 108,
1480
+ 95,
1481
+ 99,
1482
+ 111,
1483
+ 110,
1484
+ 102,
1485
+ 105,
1486
+ 103
1487
+ ]
1488
+ }
1489
+ ]
1490
+ }
1491
+ },
1492
+ {
1493
+ "name": "creator",
1494
+ "docs": [
1495
+ "Pool creator (needed for fee vault derivation).",
1496
+ "",
1497
+ "NOTE: Validation relies on `has_one = creator` constraint on pool state.",
1498
+ "The creator is whoever signed the original pool creation transaction,",
1499
+ "stored immutably in PoolState. No separate ownership check is needed",
1500
+ "as the pool state is the source of truth for creator identity."
1501
+ ],
1502
+ "relations": [
1503
+ "pool"
1504
+ ]
1505
+ },
1506
+ {
1507
+ "name": "base_mint",
1508
+ "docs": [
1509
+ "The mint of input token."
1510
+ ]
1511
+ },
1512
+ {
1513
+ "name": "quote_mint",
1514
+ "docs": [
1515
+ "The mint of output token."
1516
+ ]
1517
+ },
1518
+ {
1519
+ "name": "fee_config",
1520
+ "docs": [
1521
+ "The fee configuration for this token (from liquid-fees program).",
1522
+ "base_mint is typically the token that was launched on the bonding curve."
1523
+ ],
1524
+ "pda": {
1525
+ "seeds": [
1526
+ {
1527
+ "kind": "const",
1528
+ "value": [
1529
+ 102,
1530
+ 101,
1531
+ 101,
1532
+ 95,
1533
+ 99,
1534
+ 111,
1535
+ 110,
1536
+ 102,
1537
+ 105,
1538
+ 103
1539
+ ]
1540
+ },
1541
+ {
1542
+ "kind": "account",
1543
+ "path": "base_mint"
1544
+ }
1545
+ ],
1546
+ "program": {
1547
+ "kind": "const",
1548
+ "value": [
1549
+ 217,
1550
+ 168,
1551
+ 237,
1552
+ 183,
1553
+ 0,
1554
+ 44,
1555
+ 187,
1556
+ 171,
1557
+ 53,
1558
+ 87,
1559
+ 202,
1560
+ 162,
1561
+ 64,
1562
+ 131,
1563
+ 189,
1564
+ 106,
1565
+ 187,
1566
+ 249,
1567
+ 130,
1568
+ 171,
1569
+ 56,
1570
+ 202,
1571
+ 127,
1572
+ 190,
1573
+ 143,
1574
+ 121,
1575
+ 30,
1576
+ 195,
1577
+ 25,
1578
+ 86,
1579
+ 241,
1580
+ 242
1581
+ ]
1582
+ }
1583
+ }
1584
+ },
1585
+ {
1586
+ "name": "liquid_state",
1587
+ "accounts": [
1588
+ {
1589
+ "name": "user_properties",
1590
+ "docs": [
1591
+ "User properties from liquid-state."
1592
+ ],
1593
+ "writable": true,
1594
+ "pda": {
1595
+ "seeds": [
1596
+ {
1597
+ "kind": "const",
1598
+ "value": [
1599
+ 117,
1600
+ 115,
1601
+ 101,
1602
+ 114,
1603
+ 95,
1604
+ 112,
1605
+ 114,
1606
+ 111,
1607
+ 112,
1608
+ 101,
1609
+ 114,
1610
+ 116,
1611
+ 105,
1612
+ 101,
1613
+ 115
1614
+ ]
1615
+ },
1616
+ {
1617
+ "kind": "account",
1618
+ "path": "user"
1619
+ }
1620
+ ],
1621
+ "program": {
1622
+ "kind": "const",
1623
+ "value": [
1624
+ 6,
1625
+ 161,
1626
+ 216,
1627
+ 199,
1628
+ 206,
1629
+ 40,
1630
+ 40,
1631
+ 163,
1632
+ 177,
1633
+ 19,
1634
+ 1,
1635
+ 21,
1636
+ 164,
1637
+ 67,
1638
+ 81,
1639
+ 132,
1640
+ 164,
1641
+ 22,
1642
+ 81,
1643
+ 177,
1644
+ 201,
1645
+ 45,
1646
+ 170,
1647
+ 138,
1648
+ 70,
1649
+ 214,
1650
+ 218,
1651
+ 76,
1652
+ 85,
1653
+ 222,
1654
+ 216,
1655
+ 214
1656
+ ]
1657
+ }
1658
+ }
1659
+ },
1660
+ {
1661
+ "name": "global_amm_volume",
1662
+ "docs": [
1663
+ "Global AMM volume accumulator from liquid-state."
1664
+ ],
1665
+ "writable": true,
1666
+ "pda": {
1667
+ "seeds": [
1668
+ {
1669
+ "kind": "const",
1670
+ "value": [
1671
+ 103,
1672
+ 108,
1673
+ 111,
1674
+ 98,
1675
+ 97,
1676
+ 108,
1677
+ 95,
1678
+ 97,
1679
+ 109,
1680
+ 109,
1681
+ 95,
1682
+ 118,
1683
+ 111,
1684
+ 108,
1685
+ 117,
1686
+ 109,
1687
+ 101
1688
+ ]
1689
+ }
1690
+ ],
1691
+ "program": {
1692
+ "kind": "const",
1693
+ "value": [
1694
+ 6,
1695
+ 161,
1696
+ 216,
1697
+ 199,
1698
+ 206,
1699
+ 40,
1700
+ 40,
1701
+ 163,
1702
+ 177,
1703
+ 19,
1704
+ 1,
1705
+ 21,
1706
+ 164,
1707
+ 67,
1708
+ 81,
1709
+ 132,
1710
+ 164,
1711
+ 22,
1712
+ 81,
1713
+ 177,
1714
+ 201,
1715
+ 45,
1716
+ 170,
1717
+ 138,
1718
+ 70,
1719
+ 214,
1720
+ 218,
1721
+ 76,
1722
+ 85,
1723
+ 222,
1724
+ 216,
1725
+ 214
1726
+ ]
1727
+ }
1728
+ }
1729
+ },
1730
+ {
1731
+ "name": "token_volume",
1732
+ "docs": [
1733
+ "Token volume accumulator from liquid-state (for base_mint)."
1734
+ ],
1735
+ "writable": true,
1736
+ "pda": {
1737
+ "seeds": [
1738
+ {
1739
+ "kind": "const",
1740
+ "value": [
1741
+ 116,
1742
+ 111,
1743
+ 107,
1744
+ 101,
1745
+ 110,
1746
+ 95,
1747
+ 118,
1748
+ 111,
1749
+ 108,
1750
+ 117,
1751
+ 109,
1752
+ 101
1753
+ ]
1754
+ },
1755
+ {
1756
+ "kind": "account",
1757
+ "path": "token_mint"
1758
+ }
1759
+ ],
1760
+ "program": {
1761
+ "kind": "const",
1762
+ "value": [
1763
+ 6,
1764
+ 161,
1765
+ 216,
1766
+ 199,
1767
+ 206,
1768
+ 40,
1769
+ 40,
1770
+ 163,
1771
+ 177,
1772
+ 19,
1773
+ 1,
1774
+ 21,
1775
+ 164,
1776
+ 67,
1777
+ 81,
1778
+ 132,
1779
+ 164,
1780
+ 22,
1781
+ 81,
1782
+ 177,
1783
+ 201,
1784
+ 45,
1785
+ 170,
1786
+ 138,
1787
+ 70,
1788
+ 214,
1789
+ 218,
1790
+ 76,
1791
+ 85,
1792
+ 222,
1793
+ 216,
1794
+ 214
1795
+ ]
1796
+ }
1797
+ }
1798
+ },
1799
+ {
1800
+ "name": "user",
1801
+ "docs": [
1802
+ "The user performing the trade."
1803
+ ]
1804
+ },
1805
+ {
1806
+ "name": "token_mint",
1807
+ "docs": [
1808
+ "The token mint, used for token_volume PDA derivation."
1809
+ ]
1810
+ },
1811
+ {
1812
+ "name": "cashback_config",
1813
+ "docs": [
1814
+ "Cashback configuration from liquid-state."
1815
+ ],
1816
+ "pda": {
1817
+ "seeds": [
1818
+ {
1819
+ "kind": "const",
1820
+ "value": [
1821
+ 99,
1822
+ 97,
1823
+ 115,
1824
+ 104,
1825
+ 98,
1826
+ 97,
1827
+ 99,
1828
+ 107,
1829
+ 95,
1830
+ 99,
1831
+ 111,
1832
+ 110,
1833
+ 102,
1834
+ 105,
1835
+ 103
1836
+ ]
1837
+ }
1838
+ ],
1839
+ "program": {
1840
+ "kind": "const",
1841
+ "value": [
1842
+ 6,
1843
+ 161,
1844
+ 216,
1845
+ 199,
1846
+ 206,
1847
+ 40,
1848
+ 40,
1849
+ 163,
1850
+ 177,
1851
+ 19,
1852
+ 1,
1853
+ 21,
1854
+ 164,
1855
+ 67,
1856
+ 81,
1857
+ 132,
1858
+ 164,
1859
+ 22,
1860
+ 81,
1861
+ 177,
1862
+ 201,
1863
+ 45,
1864
+ 170,
1865
+ 138,
1866
+ 70,
1867
+ 214,
1868
+ 218,
1869
+ 76,
1870
+ 85,
1871
+ 222,
1872
+ 216,
1873
+ 214
1874
+ ]
1875
+ }
1876
+ }
1877
+ },
1878
+ {
1879
+ "name": "liquid_state_program",
1880
+ "docs": [
1881
+ "liquid-state program for unified state management."
1882
+ ],
1883
+ "address": "State3HtEfi7cXdsTpAtRoBvrij8zSFCiGTAVWmYH2d"
1884
+ },
1885
+ {
1886
+ "name": "state_events_cpi_authority",
1887
+ "docs": [
1888
+ "CPI authority PDA owned by liquid-state for emitting events via liquid-events."
1889
+ ],
1890
+ "pda": {
1891
+ "seeds": [
1892
+ {
1893
+ "kind": "const",
1894
+ "value": [
1895
+ 99,
1896
+ 112,
1897
+ 105,
1898
+ 95,
1899
+ 97,
1900
+ 117,
1901
+ 116,
1902
+ 104,
1903
+ 111,
1904
+ 114,
1905
+ 105,
1906
+ 116,
1907
+ 121
1908
+ ]
1909
+ }
1910
+ ],
1911
+ "program": {
1912
+ "kind": "const",
1913
+ "value": [
1914
+ 6,
1915
+ 161,
1916
+ 216,
1917
+ 199,
1918
+ 206,
1919
+ 40,
1920
+ 40,
1921
+ 163,
1922
+ 177,
1923
+ 19,
1924
+ 1,
1925
+ 21,
1926
+ 164,
1927
+ 67,
1928
+ 81,
1929
+ 132,
1930
+ 164,
1931
+ 22,
1932
+ 81,
1933
+ 177,
1934
+ 201,
1935
+ 45,
1936
+ 170,
1937
+ 138,
1938
+ 70,
1939
+ 214,
1940
+ 218,
1941
+ 76,
1942
+ 85,
1943
+ 222,
1944
+ 216,
1945
+ 214
1946
+ ]
1947
+ }
1948
+ }
1949
+ }
1950
+ ]
1951
+ },
1952
+ {
1953
+ "name": "base_token_program",
1954
+ "docs": [
1955
+ "SPL program for input token transfers."
1956
+ ]
1957
+ },
1958
+ {
1959
+ "name": "quote_token_program",
1960
+ "docs": [
1961
+ "SPL program for output token transfers."
1962
+ ]
1963
+ },
1964
+ {
1965
+ "name": "system_program",
1966
+ "address": "11111111111111111111111111111111"
1967
+ },
1968
+ {
1969
+ "name": "token_program",
1970
+ "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
1971
+ },
1972
+ {
1973
+ "name": "associated_token_program",
1974
+ "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
1975
+ },
1976
+ {
1977
+ "name": "cpi_authority",
1978
+ "docs": [
1979
+ "CPI authority PDA — proves this program's identity in cross-program calls."
1980
+ ],
1981
+ "pda": {
1982
+ "seeds": [
1983
+ {
1984
+ "kind": "const",
1985
+ "value": [
1986
+ 99,
1987
+ 112,
1988
+ 105,
1989
+ 95,
1990
+ 97,
1991
+ 117,
1992
+ 116,
1993
+ 104,
1994
+ 111,
1995
+ 114,
1996
+ 105,
1997
+ 116,
1998
+ 121
1999
+ ]
2000
+ }
2001
+ ]
2002
+ }
2003
+ },
2004
+ {
2005
+ "name": "liquid_events_program",
2006
+ "docs": [
2007
+ "Liquid events program for CPI event emission."
2008
+ ],
2009
+ "address": "EventsQeXA43nLKR69DhHwNsJ6aM512AweMCgG3wG8zG"
2010
+ },
2011
+ {
2012
+ "name": "oracle_price_feed",
2013
+ "docs": [
2014
+ "Pyth SOL/USD price feed (required for tiered fees)."
2015
+ ],
2016
+ "optional": true
2017
+ }
2018
+ ],
2019
+ "args": [
2020
+ {
2021
+ "name": "amount_in",
2022
+ "type": "u64"
2023
+ },
2024
+ {
2025
+ "name": "minimum_amount_out",
2026
+ "type": "u64"
2027
+ }
2028
+ ]
2029
+ },
1048
2030
  {
1049
2031
  "name": "cancel_admin_transfer",
1050
2032
  "docs": [