@streamflow/distributor 11.4.0 → 12.1.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.
@@ -156,7 +156,7 @@ var merkle_distributor_default = {
156
156
  address: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N",
157
157
  metadata: {
158
158
  name: "merkle_distributor",
159
- version: "2.0.0",
159
+ version: "1.9.0",
160
160
  spec: "0.1.0",
161
161
  description: "A Solana program for distributing tokens according to a Merkle root.",
162
162
  repository: "https://github.com/streamflow-finance/distributor"
@@ -726,6 +726,67 @@ var merkle_distributor_default = {
726
726
  82,
727
727
  27
728
728
  ],
729
+ accounts: [
730
+ {
731
+ name: "distributor",
732
+ docs: [
733
+ "The [MerkleDistributor]."
734
+ ],
735
+ writable: true
736
+ },
737
+ {
738
+ name: "from",
739
+ docs: [
740
+ "Distributor ATA containing the tokens to distribute."
741
+ ],
742
+ writable: true
743
+ },
744
+ {
745
+ name: "to",
746
+ docs: [
747
+ "The Clawback token account."
748
+ ],
749
+ writable: true
750
+ },
751
+ {
752
+ name: "authority",
753
+ docs: [
754
+ "Signer that authorizes the clawback execution."
755
+ ],
756
+ writable: true,
757
+ signer: true
758
+ },
759
+ {
760
+ name: "mint"
761
+ },
762
+ {
763
+ name: "system_program",
764
+ docs: [
765
+ "The [System] program."
766
+ ],
767
+ address: "11111111111111111111111111111111"
768
+ },
769
+ {
770
+ name: "token_program",
771
+ docs: [
772
+ "SPL [Token] program."
773
+ ]
774
+ }
775
+ ],
776
+ args: []
777
+ },
778
+ {
779
+ name: "clawback_v2",
780
+ discriminator: [
781
+ 21,
782
+ 210,
783
+ 60,
784
+ 179,
785
+ 193,
786
+ 134,
787
+ 82,
788
+ 155
789
+ ],
729
790
  accounts: [
730
791
  {
731
792
  name: "distributor",
@@ -751,7 +812,14 @@ var merkle_distributor_default = {
751
812
  {
752
813
  name: "admin",
753
814
  docs: [
754
- "Only Admin can trigger the clawback of funds"
815
+ "even when the caller is `CANCEL_AUTHORITY`."
816
+ ],
817
+ writable: true
818
+ },
819
+ {
820
+ name: "authority",
821
+ docs: [
822
+ "Signer that authorizes the clawback execution."
755
823
  ],
756
824
  writable: true,
757
825
  signer: true
@@ -759,6 +827,32 @@ var merkle_distributor_default = {
759
827
  {
760
828
  name: "mint"
761
829
  },
830
+ {
831
+ name: "auto_claim_state",
832
+ writable: true,
833
+ pda: {
834
+ seeds: [
835
+ {
836
+ kind: "const",
837
+ value: [
838
+ 65,
839
+ 117,
840
+ 116,
841
+ 111,
842
+ 67,
843
+ 108,
844
+ 97,
845
+ 105,
846
+ 109
847
+ ]
848
+ },
849
+ {
850
+ kind: "account",
851
+ path: "distributor"
852
+ }
853
+ ]
854
+ }
855
+ },
762
856
  {
763
857
  name: "system_program",
764
858
  docs: [
@@ -1194,96 +1288,71 @@ var merkle_distributor_default = {
1194
1288
  ]
1195
1289
  },
1196
1290
  {
1197
- name: "new_distributor",
1198
- docs: [
1199
- "READ THE FOLLOWING:",
1200
- "",
1201
- "This instruction is susceptible to frontrunning that could result in loss of funds if not handled properly.",
1202
- "",
1203
- "An attack could look like:",
1204
- "- A legitimate user opens a new distributor.",
1205
- "- Someone observes the call to this instruction.",
1206
- "- They replace the clawback_receiver, admin, or time parameters with their own.",
1207
- "",
1208
- "One situation that could happen here is the attacker replaces the admin and clawback_receiver with their own",
1209
- "and sets the clawback_start_ts with the minimal time allowed. After clawback_start_ts has elapsed,",
1210
- "the attacker can steal all funds from the distributor to their own clawback_receiver account.",
1211
- "",
1212
- "HOW TO AVOID:",
1213
- "- When you call into this instruction, ensure your transaction succeeds.",
1214
- "- To be extra safe, after your transaction succeeds, read back the state of the created MerkleDistributor account and",
1215
- "assert the parameters are what you expect, most importantly the clawback_receiver and admin.",
1216
- "- If your transaction fails, double check the value on-chain matches what you expect."
1217
- ],
1291
+ name: "new_claim_by_worker",
1218
1292
  discriminator: [
1219
- 32,
1220
- 139,
1221
- 112,
1222
- 171,
1223
- 0,
1224
- 2,
1225
- 225,
1226
- 155
1293
+ 181,
1294
+ 133,
1295
+ 223,
1296
+ 117,
1297
+ 188,
1298
+ 131,
1299
+ 243,
1300
+ 158
1227
1301
  ],
1228
1302
  accounts: [
1229
1303
  {
1230
1304
  name: "distributor",
1231
1305
  docs: [
1232
- "[MerkleDistributor]."
1306
+ "The [MerkleDistributor]."
1307
+ ],
1308
+ writable: true,
1309
+ relations: [
1310
+ "auto_claim_state"
1311
+ ]
1312
+ },
1313
+ {
1314
+ name: "auto_claim_state",
1315
+ docs: [
1316
+ "Auto-claim SOL reserve for the distributor."
1233
1317
  ],
1318
+ writable: true
1319
+ },
1320
+ {
1321
+ name: "claim_status",
1234
1322
  writable: true,
1235
1323
  pda: {
1236
1324
  seeds: [
1237
1325
  {
1238
1326
  kind: "const",
1239
1327
  value: [
1240
- 77,
1241
- 101,
1242
- 114,
1243
- 107,
1328
+ 67,
1244
1329
  108,
1245
- 101,
1246
- 68,
1330
+ 97,
1247
1331
  105,
1248
- 115,
1332
+ 109,
1333
+ 83,
1249
1334
  116,
1250
- 114,
1251
- 105,
1252
- 98,
1253
- 117,
1335
+ 97,
1254
1336
  116,
1255
- 111,
1256
- 114
1337
+ 117,
1338
+ 115
1257
1339
  ]
1258
1340
  },
1259
1341
  {
1260
1342
  kind: "account",
1261
- path: "mint"
1343
+ path: "claimant"
1262
1344
  },
1263
1345
  {
1264
- kind: "arg",
1265
- path: "version"
1346
+ kind: "account",
1347
+ path: "distributor"
1266
1348
  }
1267
1349
  ]
1268
1350
  }
1269
1351
  },
1270
1352
  {
1271
- name: "clawback_receiver",
1272
- docs: [
1273
- "Clawback receiver token account"
1274
- ],
1275
- writable: true
1276
- },
1277
- {
1278
- name: "mint",
1279
- docs: [
1280
- "The mint to distribute."
1281
- ]
1282
- },
1283
- {
1284
- name: "token_vault",
1353
+ name: "from",
1285
1354
  docs: [
1286
- "Token vault"
1355
+ "Distributor ATA containing the tokens to distribute."
1287
1356
  ],
1288
1357
  writable: true,
1289
1358
  pda: {
@@ -1298,7 +1367,8 @@ var merkle_distributor_default = {
1298
1367
  },
1299
1368
  {
1300
1369
  kind: "account",
1301
- path: "mint"
1370
+ path: "distributor.mint",
1371
+ account: "MerkleDistributor"
1302
1372
  }
1303
1373
  ],
1304
1374
  program: {
@@ -1340,21 +1410,33 @@ var merkle_distributor_default = {
1340
1410
  }
1341
1411
  }
1342
1412
  },
1413
+ {
1414
+ name: "to",
1415
+ writable: true
1416
+ },
1417
+ {
1418
+ name: "claimant"
1419
+ },
1343
1420
  {
1344
1421
  name: "admin",
1422
+ writable: true
1423
+ },
1424
+ {
1425
+ name: "worker",
1345
1426
  docs: [
1346
- "Admin wallet, responsible for creating the distributor and paying for the transaction.",
1347
- "Also has the authority to set the clawback receiver and change itself."
1427
+ "Worker account, anyone can execute the instruction since distribution is validated by the protocol"
1348
1428
  ],
1349
1429
  writable: true,
1350
1430
  signer: true
1351
1431
  },
1352
1432
  {
1353
- name: "system_program",
1433
+ name: "mint",
1354
1434
  docs: [
1355
- "The [System] program."
1435
+ "The mint to claim."
1356
1436
  ],
1357
- address: "11111111111111111111111111111111"
1437
+ relations: [
1438
+ "distributor"
1439
+ ]
1358
1440
  },
1359
1441
  {
1360
1442
  name: "associated_token_program",
@@ -1366,53 +1448,618 @@ var merkle_distributor_default = {
1366
1448
  {
1367
1449
  name: "token_program",
1368
1450
  docs: [
1369
- "The [Token] program."
1451
+ "SPL [Token] program."
1370
1452
  ]
1371
1453
  },
1372
1454
  {
1373
- name: "partner_oracle_config",
1455
+ name: "system_program",
1456
+ docs: [
1457
+ "The [System] program."
1458
+ ],
1459
+ address: "11111111111111111111111111111111"
1460
+ },
1461
+ {
1462
+ name: "event_authority",
1374
1463
  pda: {
1375
1464
  seeds: [
1376
1465
  {
1377
1466
  kind: "const",
1378
1467
  value: [
1379
- 97,
1380
- 105,
1381
- 114,
1382
- 100,
1383
- 114,
1384
- 111,
1385
- 112,
1386
1468
  95,
1387
- 99,
1388
- 111,
1469
+ 95,
1470
+ 101,
1471
+ 118,
1472
+ 101,
1389
1473
  110,
1390
- 102,
1474
+ 116,
1475
+ 95,
1476
+ 97,
1477
+ 117,
1478
+ 116,
1479
+ 104,
1480
+ 111,
1481
+ 114,
1391
1482
  105,
1392
- 103
1483
+ 116,
1484
+ 121
1393
1485
  ]
1394
1486
  }
1395
- ],
1396
- program: {
1397
- kind: "const",
1398
- value: [
1399
- 12,
1400
- 48,
1401
- 148,
1402
- 48,
1403
- 221,
1404
- 89,
1405
- 2,
1406
- 209,
1407
- 180,
1408
- 126,
1409
- 151,
1410
- 216,
1411
- 166,
1412
- 3,
1413
- 112,
1414
- 50,
1415
- 177,
1487
+ ]
1488
+ }
1489
+ },
1490
+ {
1491
+ name: "program"
1492
+ }
1493
+ ],
1494
+ args: [
1495
+ {
1496
+ name: "amount_unlocked",
1497
+ type: "u64"
1498
+ },
1499
+ {
1500
+ name: "amount_locked",
1501
+ type: "u64"
1502
+ },
1503
+ {
1504
+ name: "proof",
1505
+ type: {
1506
+ vec: {
1507
+ array: [
1508
+ "u8",
1509
+ 32
1510
+ ]
1511
+ }
1512
+ }
1513
+ }
1514
+ ]
1515
+ },
1516
+ {
1517
+ name: "new_distributor",
1518
+ docs: [
1519
+ "READ THE FOLLOWING:",
1520
+ "",
1521
+ "This instruction is susceptible to frontrunning that could result in loss of funds if not handled properly.",
1522
+ "",
1523
+ "An attack could look like:",
1524
+ "- A legitimate user opens a new distributor.",
1525
+ "- Someone observes the call to this instruction.",
1526
+ "- They replace the clawback_receiver, admin, or time parameters with their own.",
1527
+ "",
1528
+ "One situation that could happen here is the attacker replaces the admin and clawback_receiver with their own",
1529
+ "and sets the clawback_start_ts with the minimal time allowed. After clawback_start_ts has elapsed,",
1530
+ "the attacker can steal all funds from the distributor to their own clawback_receiver account.",
1531
+ "",
1532
+ "HOW TO AVOID:",
1533
+ "- When you call into this instruction, ensure your transaction succeeds.",
1534
+ "- To be extra safe, after your transaction succeeds, read back the state of the created MerkleDistributor account and",
1535
+ "assert the parameters are what you expect, most importantly the clawback_receiver and admin.",
1536
+ "- If your transaction fails, double check the value on-chain matches what you expect."
1537
+ ],
1538
+ discriminator: [
1539
+ 32,
1540
+ 139,
1541
+ 112,
1542
+ 171,
1543
+ 0,
1544
+ 2,
1545
+ 225,
1546
+ 155
1547
+ ],
1548
+ accounts: [
1549
+ {
1550
+ name: "distributor",
1551
+ docs: [
1552
+ "[MerkleDistributor]."
1553
+ ],
1554
+ writable: true,
1555
+ pda: {
1556
+ seeds: [
1557
+ {
1558
+ kind: "const",
1559
+ value: [
1560
+ 77,
1561
+ 101,
1562
+ 114,
1563
+ 107,
1564
+ 108,
1565
+ 101,
1566
+ 68,
1567
+ 105,
1568
+ 115,
1569
+ 116,
1570
+ 114,
1571
+ 105,
1572
+ 98,
1573
+ 117,
1574
+ 116,
1575
+ 111,
1576
+ 114
1577
+ ]
1578
+ },
1579
+ {
1580
+ kind: "account",
1581
+ path: "mint"
1582
+ },
1583
+ {
1584
+ kind: "arg",
1585
+ path: "version"
1586
+ }
1587
+ ]
1588
+ }
1589
+ },
1590
+ {
1591
+ name: "clawback_receiver",
1592
+ docs: [
1593
+ "Clawback receiver token account"
1594
+ ],
1595
+ writable: true
1596
+ },
1597
+ {
1598
+ name: "mint",
1599
+ docs: [
1600
+ "The mint to distribute."
1601
+ ]
1602
+ },
1603
+ {
1604
+ name: "token_vault",
1605
+ docs: [
1606
+ "Token vault"
1607
+ ],
1608
+ writable: true,
1609
+ pda: {
1610
+ seeds: [
1611
+ {
1612
+ kind: "account",
1613
+ path: "distributor"
1614
+ },
1615
+ {
1616
+ kind: "account",
1617
+ path: "token_program"
1618
+ },
1619
+ {
1620
+ kind: "account",
1621
+ path: "mint"
1622
+ }
1623
+ ],
1624
+ program: {
1625
+ kind: "const",
1626
+ value: [
1627
+ 140,
1628
+ 151,
1629
+ 37,
1630
+ 143,
1631
+ 78,
1632
+ 36,
1633
+ 137,
1634
+ 241,
1635
+ 187,
1636
+ 61,
1637
+ 16,
1638
+ 41,
1639
+ 20,
1640
+ 142,
1641
+ 13,
1642
+ 131,
1643
+ 11,
1644
+ 90,
1645
+ 19,
1646
+ 153,
1647
+ 218,
1648
+ 255,
1649
+ 16,
1650
+ 132,
1651
+ 4,
1652
+ 142,
1653
+ 123,
1654
+ 216,
1655
+ 219,
1656
+ 233,
1657
+ 248,
1658
+ 89
1659
+ ]
1660
+ }
1661
+ }
1662
+ },
1663
+ {
1664
+ name: "admin",
1665
+ docs: [
1666
+ "Admin wallet, responsible for creating the distributor and paying for the transaction.",
1667
+ "Also has the authority to set the clawback receiver and change itself."
1668
+ ],
1669
+ writable: true,
1670
+ signer: true
1671
+ },
1672
+ {
1673
+ name: "system_program",
1674
+ docs: [
1675
+ "The [System] program."
1676
+ ],
1677
+ address: "11111111111111111111111111111111"
1678
+ },
1679
+ {
1680
+ name: "associated_token_program",
1681
+ docs: [
1682
+ "The [Associated Token] program."
1683
+ ],
1684
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
1685
+ },
1686
+ {
1687
+ name: "token_program",
1688
+ docs: [
1689
+ "The [Token] program."
1690
+ ]
1691
+ },
1692
+ {
1693
+ name: "partner_oracle_config",
1694
+ pda: {
1695
+ seeds: [
1696
+ {
1697
+ kind: "const",
1698
+ value: [
1699
+ 97,
1700
+ 105,
1701
+ 114,
1702
+ 100,
1703
+ 114,
1704
+ 111,
1705
+ 112,
1706
+ 95,
1707
+ 99,
1708
+ 111,
1709
+ 110,
1710
+ 102,
1711
+ 105,
1712
+ 103
1713
+ ]
1714
+ }
1715
+ ],
1716
+ program: {
1717
+ kind: "const",
1718
+ value: [
1719
+ 12,
1720
+ 48,
1721
+ 148,
1722
+ 48,
1723
+ 221,
1724
+ 89,
1725
+ 2,
1726
+ 209,
1727
+ 180,
1728
+ 126,
1729
+ 151,
1730
+ 216,
1731
+ 166,
1732
+ 3,
1733
+ 112,
1734
+ 50,
1735
+ 177,
1736
+ 192,
1737
+ 141,
1738
+ 218,
1739
+ 37,
1740
+ 78,
1741
+ 51,
1742
+ 109,
1743
+ 243,
1744
+ 106,
1745
+ 174,
1746
+ 122,
1747
+ 93,
1748
+ 121,
1749
+ 191,
1750
+ 119
1751
+ ]
1752
+ }
1753
+ }
1754
+ },
1755
+ {
1756
+ name: "partner_oracle",
1757
+ docs: [
1758
+ "Partner Oracle program that stores fees"
1759
+ ],
1760
+ address: "pardpVtPjC8nLj1Dwncew62mUzfChdCX1EaoZe8oCAa"
1761
+ }
1762
+ ],
1763
+ args: [
1764
+ {
1765
+ name: "version",
1766
+ type: "u64"
1767
+ },
1768
+ {
1769
+ name: "root",
1770
+ type: {
1771
+ array: [
1772
+ "u8",
1773
+ 32
1774
+ ]
1775
+ }
1776
+ },
1777
+ {
1778
+ name: "max_total_claim",
1779
+ type: "u64"
1780
+ },
1781
+ {
1782
+ name: "max_num_nodes",
1783
+ type: "u64"
1784
+ },
1785
+ {
1786
+ name: "unlock_period",
1787
+ type: "u64"
1788
+ },
1789
+ {
1790
+ name: "start_vesting_ts",
1791
+ type: "u64"
1792
+ },
1793
+ {
1794
+ name: "end_vesting_ts",
1795
+ type: "u64"
1796
+ },
1797
+ {
1798
+ name: "clawback_start_ts",
1799
+ type: "u64"
1800
+ },
1801
+ {
1802
+ name: "claims_closable_by_admin",
1803
+ type: "bool"
1804
+ },
1805
+ {
1806
+ name: "can_update_duration",
1807
+ type: {
1808
+ option: "bool"
1809
+ }
1810
+ },
1811
+ {
1812
+ name: "total_amount_unlocked",
1813
+ type: {
1814
+ option: "u64"
1815
+ }
1816
+ },
1817
+ {
1818
+ name: "total_amount_locked",
1819
+ type: {
1820
+ option: "u64"
1821
+ }
1822
+ },
1823
+ {
1824
+ name: "claims_closable_by_claimant",
1825
+ type: {
1826
+ option: "bool"
1827
+ }
1828
+ },
1829
+ {
1830
+ name: "claims_limit",
1831
+ type: {
1832
+ option: "u16"
1833
+ }
1834
+ }
1835
+ ]
1836
+ },
1837
+ {
1838
+ name: "new_distributor_v2",
1839
+ discriminator: [
1840
+ 45,
1841
+ 79,
1842
+ 3,
1843
+ 238,
1844
+ 185,
1845
+ 37,
1846
+ 253,
1847
+ 179
1848
+ ],
1849
+ accounts: [
1850
+ {
1851
+ name: "distributor",
1852
+ docs: [
1853
+ "[MerkleDistributor]."
1854
+ ],
1855
+ writable: true,
1856
+ pda: {
1857
+ seeds: [
1858
+ {
1859
+ kind: "const",
1860
+ value: [
1861
+ 77,
1862
+ 101,
1863
+ 114,
1864
+ 107,
1865
+ 108,
1866
+ 101,
1867
+ 68,
1868
+ 105,
1869
+ 115,
1870
+ 116,
1871
+ 114,
1872
+ 105,
1873
+ 98,
1874
+ 117,
1875
+ 116,
1876
+ 111,
1877
+ 114
1878
+ ]
1879
+ },
1880
+ {
1881
+ kind: "account",
1882
+ path: "mint"
1883
+ },
1884
+ {
1885
+ kind: "arg",
1886
+ path: "version"
1887
+ }
1888
+ ]
1889
+ }
1890
+ },
1891
+ {
1892
+ name: "clawback_receiver",
1893
+ docs: [
1894
+ "Clawback receiver token account"
1895
+ ],
1896
+ writable: true
1897
+ },
1898
+ {
1899
+ name: "mint",
1900
+ docs: [
1901
+ "The mint to distribute."
1902
+ ]
1903
+ },
1904
+ {
1905
+ name: "token_vault",
1906
+ docs: [
1907
+ "Token vault"
1908
+ ],
1909
+ writable: true,
1910
+ pda: {
1911
+ seeds: [
1912
+ {
1913
+ kind: "account",
1914
+ path: "distributor"
1915
+ },
1916
+ {
1917
+ kind: "account",
1918
+ path: "token_program"
1919
+ },
1920
+ {
1921
+ kind: "account",
1922
+ path: "mint"
1923
+ }
1924
+ ],
1925
+ program: {
1926
+ kind: "const",
1927
+ value: [
1928
+ 140,
1929
+ 151,
1930
+ 37,
1931
+ 143,
1932
+ 78,
1933
+ 36,
1934
+ 137,
1935
+ 241,
1936
+ 187,
1937
+ 61,
1938
+ 16,
1939
+ 41,
1940
+ 20,
1941
+ 142,
1942
+ 13,
1943
+ 131,
1944
+ 11,
1945
+ 90,
1946
+ 19,
1947
+ 153,
1948
+ 218,
1949
+ 255,
1950
+ 16,
1951
+ 132,
1952
+ 4,
1953
+ 142,
1954
+ 123,
1955
+ 216,
1956
+ 219,
1957
+ 233,
1958
+ 248,
1959
+ 89
1960
+ ]
1961
+ }
1962
+ }
1963
+ },
1964
+ {
1965
+ name: "admin",
1966
+ docs: [
1967
+ "Admin wallet, responsible for creating the distributor and paying for the transaction.",
1968
+ "Also has the authority to set the clawback receiver and change itself."
1969
+ ],
1970
+ writable: true,
1971
+ signer: true
1972
+ },
1973
+ {
1974
+ name: "auto_claim_state",
1975
+ writable: true,
1976
+ pda: {
1977
+ seeds: [
1978
+ {
1979
+ kind: "const",
1980
+ value: [
1981
+ 65,
1982
+ 117,
1983
+ 116,
1984
+ 111,
1985
+ 67,
1986
+ 108,
1987
+ 97,
1988
+ 105,
1989
+ 109
1990
+ ]
1991
+ },
1992
+ {
1993
+ kind: "account",
1994
+ path: "distributor"
1995
+ }
1996
+ ]
1997
+ }
1998
+ },
1999
+ {
2000
+ name: "system_program",
2001
+ docs: [
2002
+ "The [System] program."
2003
+ ],
2004
+ address: "11111111111111111111111111111111"
2005
+ },
2006
+ {
2007
+ name: "associated_token_program",
2008
+ docs: [
2009
+ "The [Associated Token] program."
2010
+ ],
2011
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
2012
+ },
2013
+ {
2014
+ name: "token_program",
2015
+ docs: [
2016
+ "The [Token] program."
2017
+ ]
2018
+ },
2019
+ {
2020
+ name: "partner_oracle_config",
2021
+ pda: {
2022
+ seeds: [
2023
+ {
2024
+ kind: "const",
2025
+ value: [
2026
+ 97,
2027
+ 105,
2028
+ 114,
2029
+ 100,
2030
+ 114,
2031
+ 111,
2032
+ 112,
2033
+ 95,
2034
+ 99,
2035
+ 111,
2036
+ 110,
2037
+ 102,
2038
+ 105,
2039
+ 103
2040
+ ]
2041
+ }
2042
+ ],
2043
+ program: {
2044
+ kind: "const",
2045
+ value: [
2046
+ 12,
2047
+ 48,
2048
+ 148,
2049
+ 48,
2050
+ 221,
2051
+ 89,
2052
+ 2,
2053
+ 209,
2054
+ 180,
2055
+ 126,
2056
+ 151,
2057
+ 216,
2058
+ 166,
2059
+ 3,
2060
+ 112,
2061
+ 50,
2062
+ 177,
1416
2063
  192,
1417
2064
  141,
1418
2065
  218,
@@ -1458,6 +2105,14 @@ var merkle_distributor_default = {
1458
2105
  name: "max_total_claim",
1459
2106
  type: "u64"
1460
2107
  },
2108
+ {
2109
+ name: "total_amount_unlocked",
2110
+ type: "u64"
2111
+ },
2112
+ {
2113
+ name: "total_amount_locked",
2114
+ type: "u64"
2115
+ },
1461
2116
  {
1462
2117
  name: "max_num_nodes",
1463
2118
  type: "u64"
@@ -1482,35 +2137,92 @@ var merkle_distributor_default = {
1482
2137
  name: "claims_closable_by_admin",
1483
2138
  type: "bool"
1484
2139
  },
2140
+ {
2141
+ name: "claims_closable_by_claimant",
2142
+ type: "bool"
2143
+ },
1485
2144
  {
1486
2145
  name: "can_update_duration",
1487
- type: {
1488
- option: "bool"
1489
- }
2146
+ type: "bool"
1490
2147
  },
1491
2148
  {
1492
- name: "total_amount_unlocked",
1493
- type: {
1494
- option: "u64"
1495
- }
2149
+ name: "claims_limit",
2150
+ type: "u16"
1496
2151
  },
1497
2152
  {
1498
- name: "total_amount_locked",
1499
- type: {
1500
- option: "u64"
1501
- }
2153
+ name: "auto_claim",
2154
+ type: "bool"
2155
+ }
2156
+ ]
2157
+ },
2158
+ {
2159
+ name: "realloc_distributor",
2160
+ discriminator: [
2161
+ 167,
2162
+ 165,
2163
+ 22,
2164
+ 244,
2165
+ 248,
2166
+ 99,
2167
+ 33,
2168
+ 42
2169
+ ],
2170
+ accounts: [
2171
+ {
2172
+ name: "payer",
2173
+ writable: true,
2174
+ signer: true
1502
2175
  },
1503
2176
  {
1504
- name: "claims_closable_by_claimant",
1505
- type: {
1506
- option: "bool"
1507
- }
2177
+ name: "mint"
1508
2178
  },
1509
2179
  {
1510
- name: "claims_limit",
1511
- type: {
1512
- option: "u16"
2180
+ name: "distributor",
2181
+ writable: true,
2182
+ pda: {
2183
+ seeds: [
2184
+ {
2185
+ kind: "const",
2186
+ value: [
2187
+ 77,
2188
+ 101,
2189
+ 114,
2190
+ 107,
2191
+ 108,
2192
+ 101,
2193
+ 68,
2194
+ 105,
2195
+ 115,
2196
+ 116,
2197
+ 114,
2198
+ 105,
2199
+ 98,
2200
+ 117,
2201
+ 116,
2202
+ 111,
2203
+ 114
2204
+ ]
2205
+ },
2206
+ {
2207
+ kind: "account",
2208
+ path: "mint"
2209
+ },
2210
+ {
2211
+ kind: "arg",
2212
+ path: "version"
2213
+ }
2214
+ ]
1513
2215
  }
2216
+ },
2217
+ {
2218
+ name: "system_program",
2219
+ address: "11111111111111111111111111111111"
2220
+ }
2221
+ ],
2222
+ args: [
2223
+ {
2224
+ name: "version",
2225
+ type: "u64"
1514
2226
  }
1515
2227
  ]
1516
2228
  },
@@ -1592,6 +2304,36 @@ var merkle_distributor_default = {
1592
2304
  ],
1593
2305
  args: []
1594
2306
  },
2307
+ {
2308
+ name: "request_clawback",
2309
+ discriminator: [
2310
+ 57,
2311
+ 57,
2312
+ 31,
2313
+ 191,
2314
+ 239,
2315
+ 66,
2316
+ 54,
2317
+ 8
2318
+ ],
2319
+ accounts: [
2320
+ {
2321
+ name: "distributor",
2322
+ docs: [
2323
+ "The [MerkleDistributor]."
2324
+ ],
2325
+ writable: true
2326
+ },
2327
+ {
2328
+ name: "authority",
2329
+ docs: [
2330
+ "Fee partner signer that may initiate the delayed clawback flow."
2331
+ ],
2332
+ signer: true
2333
+ }
2334
+ ],
2335
+ args: []
2336
+ },
1595
2337
  {
1596
2338
  name: "set_admin",
1597
2339
  discriminator: [
@@ -1737,20 +2479,63 @@ var merkle_distributor_default = {
1737
2479
  docs: [
1738
2480
  "The [System] program."
1739
2481
  ],
1740
- address: "11111111111111111111111111111111"
2482
+ address: "11111111111111111111111111111111"
2483
+ }
2484
+ ],
2485
+ args: [
2486
+ {
2487
+ name: "end_ts",
2488
+ type: {
2489
+ option: "u64"
2490
+ }
2491
+ }
2492
+ ]
2493
+ },
2494
+ {
2495
+ name: "withdraw_clawback_request",
2496
+ discriminator: [
2497
+ 149,
2498
+ 159,
2499
+ 253,
2500
+ 249,
2501
+ 226,
2502
+ 250,
2503
+ 21,
2504
+ 8
2505
+ ],
2506
+ accounts: [
2507
+ {
2508
+ name: "distributor",
2509
+ docs: [
2510
+ "The [MerkleDistributor]."
2511
+ ],
2512
+ writable: true
2513
+ },
2514
+ {
2515
+ name: "authority",
2516
+ docs: [
2517
+ "Fee partner signer that may initiate the delayed clawback flow."
2518
+ ],
2519
+ signer: true
1741
2520
  }
1742
2521
  ],
1743
- args: [
1744
- {
1745
- name: "end_ts",
1746
- type: {
1747
- option: "u64"
1748
- }
1749
- }
1750
- ]
2522
+ args: []
1751
2523
  }
1752
2524
  ],
1753
2525
  accounts: [
2526
+ {
2527
+ name: "AutoClaimState",
2528
+ discriminator: [
2529
+ 216,
2530
+ 43,
2531
+ 239,
2532
+ 75,
2533
+ 58,
2534
+ 129,
2535
+ 132,
2536
+ 12
2537
+ ]
2538
+ },
1754
2539
  {
1755
2540
  name: "ClaimStatus",
1756
2541
  discriminator: [
@@ -1967,9 +2752,142 @@ var merkle_distributor_default = {
1967
2752
  code: 6026,
1968
2753
  name: "NoFeesToClaim",
1969
2754
  msg: "No fees to claim"
2755
+ },
2756
+ {
2757
+ code: 6027,
2758
+ name: "AutoClaimNotPossible",
2759
+ msg: "Auto-claim is available only for instant airdrops"
2760
+ },
2761
+ {
2762
+ code: 6028,
2763
+ name: "AutoClaimEnabled",
2764
+ msg: "Auto-claim is enabled for this airdrop, manual claims are not possible, clawback v2 is required"
2765
+ },
2766
+ {
2767
+ code: 6029,
2768
+ name: "AutoClaimNotEnabled",
2769
+ msg: "Auto-claim is not enabled for this airdrop"
2770
+ },
2771
+ {
2772
+ code: 6030,
2773
+ name: "InvalidAutoClaimTokenAccount",
2774
+ msg: "Invalid auto-claim recipient token account"
2775
+ },
2776
+ {
2777
+ code: 6031,
2778
+ name: "ClawbackRequestAlreadyRequested",
2779
+ msg: "Clawback has already been requested"
2780
+ },
2781
+ {
2782
+ code: 6032,
2783
+ name: "ClawbackRequestNotRequested",
2784
+ msg: "Clawback has not been requested"
2785
+ },
2786
+ {
2787
+ code: 6033,
2788
+ name: "ClawbackRequestDelayPending",
2789
+ msg: "Clawback request delay has not passed yet"
1970
2790
  }
1971
2791
  ],
1972
2792
  types: [
2793
+ {
2794
+ name: "AutoClaimState",
2795
+ docs: [
2796
+ "Tracks reserved and spent SOL for worker auto-claims."
2797
+ ],
2798
+ type: {
2799
+ kind: "struct",
2800
+ fields: [
2801
+ {
2802
+ name: "bump",
2803
+ docs: [
2804
+ "Bump seed."
2805
+ ],
2806
+ type: "u8"
2807
+ },
2808
+ {
2809
+ name: "distributor",
2810
+ docs: [
2811
+ "Distributor account this state belongs to."
2812
+ ],
2813
+ type: "pubkey"
2814
+ },
2815
+ {
2816
+ name: "tx_fee_lamports",
2817
+ docs: [
2818
+ "Fixed reimbursement for transaction processing."
2819
+ ],
2820
+ type: "u64"
2821
+ },
2822
+ {
2823
+ name: "ata_rent_lamports",
2824
+ docs: [
2825
+ "Fixed reimbursement for ATA creation when it is needed."
2826
+ ],
2827
+ type: "u64"
2828
+ },
2829
+ {
2830
+ name: "claim_status_rent_lamports",
2831
+ docs: [
2832
+ "Fixed reimbursement tom cover ClaimStatus account creation."
2833
+ ],
2834
+ type: "u64"
2835
+ },
2836
+ {
2837
+ name: "total_funded",
2838
+ docs: [
2839
+ "Total SOL funded for reimbursements."
2840
+ ],
2841
+ type: "u64"
2842
+ },
2843
+ {
2844
+ name: "total_spent",
2845
+ docs: [
2846
+ "Total SOL reimbursed so far."
2847
+ ],
2848
+ type: "u64"
2849
+ },
2850
+ {
2851
+ name: "claims_processed",
2852
+ docs: [
2853
+ "Number of claims processed by the worker."
2854
+ ],
2855
+ type: "u64"
2856
+ },
2857
+ {
2858
+ name: "ata_creations",
2859
+ docs: [
2860
+ "Number of ATAs funded by the worker path."
2861
+ ],
2862
+ type: "u64"
2863
+ },
2864
+ {
2865
+ name: "buffer1",
2866
+ docs: [
2867
+ "Buffer for additional fields"
2868
+ ],
2869
+ type: {
2870
+ array: [
2871
+ "u8",
2872
+ 32
2873
+ ]
2874
+ }
2875
+ },
2876
+ {
2877
+ name: "buffer2",
2878
+ docs: [
2879
+ "Buffer for additional fields"
2880
+ ],
2881
+ type: {
2882
+ array: [
2883
+ "u8",
2884
+ 32
2885
+ ]
2886
+ }
2887
+ }
2888
+ ]
2889
+ }
2890
+ },
1973
2891
  {
1974
2892
  name: "ClaimClosedEvent",
1975
2893
  docs: [
@@ -2391,14 +3309,56 @@ var merkle_distributor_default = {
2391
3309
  type: "u8"
2392
3310
  },
2393
3311
  {
2394
- name: "buffer",
3312
+ name: "auto_claim",
2395
3313
  docs: [
2396
- "Buffer for additional fields"
3314
+ "Whether Distributor supports auto-claim"
3315
+ ],
3316
+ type: "bool"
3317
+ },
3318
+ {
3319
+ name: "align_buffer_1",
3320
+ docs: [
3321
+ "Extra buffer to keep alignment, may be reused"
3322
+ ],
3323
+ type: {
3324
+ array: [
3325
+ "u8",
3326
+ 4
3327
+ ]
3328
+ }
3329
+ },
3330
+ {
3331
+ name: "fee_partner",
3332
+ docs: [
3333
+ "Partner wallet whose fee schedule was applied, if different from the creator"
3334
+ ],
3335
+ type: "pubkey"
3336
+ },
3337
+ {
3338
+ name: "clawback_request_ts",
3339
+ docs: [
3340
+ "Timestamp when clawback was requested by the fee partner"
3341
+ ],
3342
+ type: "u64"
3343
+ },
3344
+ {
3345
+ name: "buffer_1",
3346
+ docs: [
3347
+ "Buffers for additional fields"
2397
3348
  ],
2398
3349
  type: {
2399
3350
  array: [
2400
3351
  "u8",
2401
- 13
3352
+ 32
3353
+ ]
3354
+ }
3355
+ },
3356
+ {
3357
+ name: "buffer_2",
3358
+ type: {
3359
+ array: [
3360
+ "u8",
3361
+ 32
2402
3362
  ]
2403
3363
  }
2404
3364
  }
@@ -2452,7 +3412,7 @@ var aligned_distributor_default = {
2452
3412
  address: "aMERKpFAWoChCi5oZwPvgsSCoGpZKBiU7fi76bdZjt2",
2453
3413
  metadata: {
2454
3414
  name: "aligned_distributor",
2455
- version: "2.0.0",
3415
+ version: "1.9.0",
2456
3416
  spec: "0.1.0",
2457
3417
  description: "Proxy for merkle distributor that updates Vesting duration according to token market performance."
2458
3418
  },
@@ -2604,9 +3564,9 @@ var aligned_distributor_default = {
2604
3564
  {
2605
3565
  name: "admin",
2606
3566
  docs: [
2607
- "Only Admin can trigger the clawback of funds"
3567
+ "Admin or anybody in case distributor has been clawed back (usually by clawback authority).",
3568
+ "Since receiver is set by the admin, it's generally safe to call clawback by anyone here if the merkle distributor has been clawed back"
2608
3569
  ],
2609
- writable: true,
2610
3570
  signer: true
2611
3571
  },
2612
3572
  {
@@ -3481,6 +4441,16 @@ var aligned_distributor_default = {
3481
4441
  code: 6014,
3482
4442
  name: "NoFeesToClaim",
3483
4443
  msg: "No fees to claim"
4444
+ },
4445
+ {
4446
+ code: 6015,
4447
+ name: "DurationNotUpdated",
4448
+ msg: "Update won't lead to any changes in unlock schedule"
4449
+ },
4450
+ {
4451
+ code: 6016,
4452
+ name: "ClawbackAlreadyClaimed",
4453
+ msg: "Clawback already claimed"
3484
4454
  }
3485
4455
  ],
3486
4456
  types: [
@@ -3969,14 +4939,56 @@ var aligned_distributor_default = {
3969
4939
  type: "u8"
3970
4940
  },
3971
4941
  {
3972
- name: "buffer",
4942
+ name: "auto_claim",
3973
4943
  docs: [
3974
- "Buffer for additional fields"
4944
+ "Whether Distributor supports auto-claim"
4945
+ ],
4946
+ type: "bool"
4947
+ },
4948
+ {
4949
+ name: "align_buffer_1",
4950
+ docs: [
4951
+ "Extra buffer to keep alignment, may be reused"
4952
+ ],
4953
+ type: {
4954
+ array: [
4955
+ "u8",
4956
+ 4
4957
+ ]
4958
+ }
4959
+ },
4960
+ {
4961
+ name: "fee_partner",
4962
+ docs: [
4963
+ "Partner wallet whose fee schedule was applied, if different from the creator"
4964
+ ],
4965
+ type: "pubkey"
4966
+ },
4967
+ {
4968
+ name: "clawback_request_ts",
4969
+ docs: [
4970
+ "Timestamp when clawback was requested by the fee partner"
4971
+ ],
4972
+ type: "u64"
4973
+ },
4974
+ {
4975
+ name: "buffer_1",
4976
+ docs: [
4977
+ "Buffers for additional fields"
3975
4978
  ],
3976
4979
  type: {
3977
4980
  array: [
3978
4981
  "u8",
3979
- 13
4982
+ 32
4983
+ ]
4984
+ }
4985
+ },
4986
+ {
4987
+ name: "buffer_2",
4988
+ type: {
4989
+ array: [
4990
+ "u8",
4991
+ 32
3980
4992
  ]
3981
4993
  }
3982
4994
  }
@@ -4705,7 +5717,7 @@ var BaseDistributorClient = class {
4705
5717
  distributor: distributorPublicKey,
4706
5718
  from: distributor.tokenVault,
4707
5719
  to: distributor.clawbackReceiver,
4708
- admin: extParams.invoker.publicKey,
5720
+ authority: extParams.invoker.publicKey,
4709
5721
  mint: distributor.mint,
4710
5722
  tokenProgram: tokenProgramId
4711
5723
  };
@@ -4735,6 +5747,84 @@ var BaseDistributorClient = class {
4735
5747
  );
4736
5748
  return { ixs, txId: signature };
4737
5749
  }
5750
+ /**
5751
+ * Requests delayed clawback by the configured fee partner authority.
5752
+ * Once the request is recorded on-chain, clawback can be executed after the
5753
+ * configured delay elapses.
5754
+ */
5755
+ async requestClawback(data, extParams) {
5756
+ const executionParams = this.unwrapExecutionParams(extParams);
5757
+ const invoker = executionParams.invoker.publicKey;
5758
+ common.invariant(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
5759
+ const ixs = await common.createAndEstimateTransaction(
5760
+ (params) => this.prepareRequestClawbackInstructions(data, params),
5761
+ executionParams
5762
+ );
5763
+ const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, invoker);
5764
+ const signature = await wrappedSignAndExecuteTransaction(
5765
+ this.connection,
5766
+ executionParams.invoker,
5767
+ tx,
5768
+ {
5769
+ hash,
5770
+ context,
5771
+ commitment: this.getCommitment()
5772
+ },
5773
+ { sendThrottler: this.sendThrottler, skipSimulation: executionParams.skipSimulation }
5774
+ );
5775
+ return { ixs, txId: signature };
5776
+ }
5777
+ async prepareRequestClawbackInstructions(data, extParams) {
5778
+ if (!extParams.invoker.publicKey) {
5779
+ throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
5780
+ }
5781
+ const ixs = common.prepareBaseInstructions(this.connection, extParams);
5782
+ ixs.push(
5783
+ await this.merkleDistributorProgram.methods.requestClawback().accounts({
5784
+ distributor: new web3_js.PublicKey(data.id),
5785
+ authority: extParams.invoker.publicKey
5786
+ }).instruction()
5787
+ );
5788
+ return ixs;
5789
+ }
5790
+ /**
5791
+ * Withdraws a previously submitted clawback request, cancelling the delayed clawback flow.
5792
+ */
5793
+ async withdrawClawbackRequest(data, extParams) {
5794
+ const executionParams = this.unwrapExecutionParams(extParams);
5795
+ const invoker = executionParams.invoker.publicKey;
5796
+ common.invariant(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
5797
+ const ixs = await common.createAndEstimateTransaction(
5798
+ (params) => this.prepareWithdrawClawbackRequestInstructions(data, params),
5799
+ executionParams
5800
+ );
5801
+ const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, invoker);
5802
+ const signature = await wrappedSignAndExecuteTransaction(
5803
+ this.connection,
5804
+ executionParams.invoker,
5805
+ tx,
5806
+ {
5807
+ hash,
5808
+ context,
5809
+ commitment: this.getCommitment()
5810
+ },
5811
+ { sendThrottler: this.sendThrottler, skipSimulation: executionParams.skipSimulation }
5812
+ );
5813
+ return { ixs, txId: signature };
5814
+ }
5815
+ async prepareWithdrawClawbackRequestInstructions(data, extParams) {
5816
+ if (!extParams.invoker.publicKey) {
5817
+ throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
5818
+ }
5819
+ const ixs = common.prepareBaseInstructions(this.connection, extParams);
5820
+ ixs.push(
5821
+ await this.merkleDistributorProgram.methods.withdrawClawbackRequest().accounts({
5822
+ distributor: new web3_js.PublicKey(data.id),
5823
+ authority: extParams.invoker.publicKey
5824
+ }).instruction()
5825
+ );
5826
+ return ixs;
5827
+ }
4738
5828
  async getClaim(claimStatus) {
4739
5829
  return this.connection.getAccountInfo(common.pk(claimStatus)).then((account) => this.decodeClaimStatus(account));
4740
5830
  }
@@ -4859,7 +5949,7 @@ function decode(program, accountName, accInfo, programKey) {
4859
5949
  var SolanaDistributorClient = class extends BaseDistributorClient {
4860
5950
  async getNewDistributorInstruction(data, accounts) {
4861
5951
  this.validateDistributorArgs(data);
4862
- return this.merkleDistributorProgram.methods.newDistributor(
5952
+ let builder = this.merkleDistributorProgram.methods.newDistributor(
4863
5953
  new BN__default.default(data.version),
4864
5954
  data.root,
4865
5955
  new BN__default.default(data.maxTotalClaim),
@@ -4877,7 +5967,13 @@ var SolanaDistributorClient = class extends BaseDistributorClient {
4877
5967
  // total_amount_locked
4878
5968
  data.claimsClosableByClaimant ?? null,
4879
5969
  data.claimsLimit ?? null
4880
- ).accounts(accounts).accountsPartial({ partnerOracle: this.partnerOracleProgramId, partnerOracleConfig: this.feeConfigPublicKey }).instruction();
5970
+ ).accounts(accounts).accountsPartial({ partnerOracle: this.partnerOracleProgramId, partnerOracleConfig: this.feeConfigPublicKey });
5971
+ if (data.partnerLink) {
5972
+ builder = builder.remainingAccounts([
5973
+ { pubkey: new web3_js.PublicKey(data.partnerLink.address), isSigner: data.partnerLink.isSigner, isWritable: false }
5974
+ ]);
5975
+ }
5976
+ return builder.instruction();
4881
5977
  }
4882
5978
  async getClawbackInstruction(accounts) {
4883
5979
  return this.merkleDistributorProgram.methods.clawback().accounts(accounts).instruction();
@@ -4935,7 +6031,7 @@ var SolanaAlignedDistributorClient = class extends BaseDistributorClient {
4935
6031
  this.validateDistributorArgs(data);
4936
6032
  const alignedArgs = this.getNewAlignedDistributorArgs(data);
4937
6033
  const oracle = data.oracleAddress ? new web3_js.PublicKey(data.oracleAddress) : getTestOraclePda(this.alignedProxyProgram.programId, common.pk(mint), common.pk(admin));
4938
- return this.alignedProxyProgram.methods.newDistributor({
6034
+ let builder = this.alignedProxyProgram.methods.newDistributor({
4939
6035
  claimsClosable: data.claimsClosableByAdmin,
4940
6036
  version: new BN__default.default(data.version),
4941
6037
  root: data.root,
@@ -4954,10 +6050,16 @@ var SolanaAlignedDistributorClient = class extends BaseDistributorClient {
4954
6050
  mint,
4955
6051
  tokenProgram,
4956
6052
  priceOracle: oracle
4957
- }).accountsPartial({ partnerOracle: this.partnerOracleProgramId, partnerOracleConfig: this.feeConfigPublicKey }).instruction();
6053
+ }).accountsPartial({ partnerOracle: this.partnerOracleProgramId, partnerOracleConfig: this.feeConfigPublicKey });
6054
+ if (data.partnerLink) {
6055
+ builder = builder.remainingAccounts([
6056
+ { pubkey: new web3_js.PublicKey(data.partnerLink.address), isSigner: data.partnerLink.isSigner, isWritable: false }
6057
+ ]);
6058
+ }
6059
+ return builder.instruction();
4958
6060
  }
4959
6061
  async getClawbackInstruction(accounts) {
4960
- const { distributor, from, to, mint, tokenProgram, admin } = accounts;
6062
+ const { distributor, from, to, mint, tokenProgram, authority } = accounts;
4961
6063
  const alignedDistributorKey = getAlignedDistributorPda(
4962
6064
  this.alignedProxyProgram.programId,
4963
6065
  common.pk(accounts.distributor)
@@ -4965,7 +6067,7 @@ var SolanaAlignedDistributorClient = class extends BaseDistributorClient {
4965
6067
  const alignedProxy = await this.alignedProxyProgram.account.alignedDistributor.fetch(alignedDistributorKey);
4966
6068
  common.invariant(alignedProxy, "Aligned Distributor proxy account not found");
4967
6069
  return this.alignedProxyProgram.methods.clawback().accounts({
4968
- admin,
6070
+ admin: authority,
4969
6071
  distributor,
4970
6072
  from,
4971
6073
  to,