@streamflow/distributor 11.4.0 → 12.0.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.
@@ -127,7 +127,7 @@ var merkle_distributor_default = {
127
127
  address: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N",
128
128
  metadata: {
129
129
  name: "merkle_distributor",
130
- version: "2.0.0",
130
+ version: "1.9.0",
131
131
  spec: "0.1.0",
132
132
  description: "A Solana program for distributing tokens according to a Merkle root.",
133
133
  repository: "https://github.com/streamflow-finance/distributor"
@@ -697,6 +697,67 @@ var merkle_distributor_default = {
697
697
  82,
698
698
  27
699
699
  ],
700
+ accounts: [
701
+ {
702
+ name: "distributor",
703
+ docs: [
704
+ "The [MerkleDistributor]."
705
+ ],
706
+ writable: true
707
+ },
708
+ {
709
+ name: "from",
710
+ docs: [
711
+ "Distributor ATA containing the tokens to distribute."
712
+ ],
713
+ writable: true
714
+ },
715
+ {
716
+ name: "to",
717
+ docs: [
718
+ "The Clawback token account."
719
+ ],
720
+ writable: true
721
+ },
722
+ {
723
+ name: "authority",
724
+ docs: [
725
+ "Signer that authorizes the clawback execution."
726
+ ],
727
+ writable: true,
728
+ signer: true
729
+ },
730
+ {
731
+ name: "mint"
732
+ },
733
+ {
734
+ name: "system_program",
735
+ docs: [
736
+ "The [System] program."
737
+ ],
738
+ address: "11111111111111111111111111111111"
739
+ },
740
+ {
741
+ name: "token_program",
742
+ docs: [
743
+ "SPL [Token] program."
744
+ ]
745
+ }
746
+ ],
747
+ args: []
748
+ },
749
+ {
750
+ name: "clawback_v2",
751
+ discriminator: [
752
+ 21,
753
+ 210,
754
+ 60,
755
+ 179,
756
+ 193,
757
+ 134,
758
+ 82,
759
+ 155
760
+ ],
700
761
  accounts: [
701
762
  {
702
763
  name: "distributor",
@@ -722,7 +783,14 @@ var merkle_distributor_default = {
722
783
  {
723
784
  name: "admin",
724
785
  docs: [
725
- "Only Admin can trigger the clawback of funds"
786
+ "even when the caller is `CANCEL_AUTHORITY`."
787
+ ],
788
+ writable: true
789
+ },
790
+ {
791
+ name: "authority",
792
+ docs: [
793
+ "Signer that authorizes the clawback execution."
726
794
  ],
727
795
  writable: true,
728
796
  signer: true
@@ -730,6 +798,32 @@ var merkle_distributor_default = {
730
798
  {
731
799
  name: "mint"
732
800
  },
801
+ {
802
+ name: "auto_claim_state",
803
+ writable: true,
804
+ pda: {
805
+ seeds: [
806
+ {
807
+ kind: "const",
808
+ value: [
809
+ 65,
810
+ 117,
811
+ 116,
812
+ 111,
813
+ 67,
814
+ 108,
815
+ 97,
816
+ 105,
817
+ 109
818
+ ]
819
+ },
820
+ {
821
+ kind: "account",
822
+ path: "distributor"
823
+ }
824
+ ]
825
+ }
826
+ },
733
827
  {
734
828
  name: "system_program",
735
829
  docs: [
@@ -1165,96 +1259,71 @@ var merkle_distributor_default = {
1165
1259
  ]
1166
1260
  },
1167
1261
  {
1168
- name: "new_distributor",
1169
- docs: [
1170
- "READ THE FOLLOWING:",
1171
- "",
1172
- "This instruction is susceptible to frontrunning that could result in loss of funds if not handled properly.",
1173
- "",
1174
- "An attack could look like:",
1175
- "- A legitimate user opens a new distributor.",
1176
- "- Someone observes the call to this instruction.",
1177
- "- They replace the clawback_receiver, admin, or time parameters with their own.",
1178
- "",
1179
- "One situation that could happen here is the attacker replaces the admin and clawback_receiver with their own",
1180
- "and sets the clawback_start_ts with the minimal time allowed. After clawback_start_ts has elapsed,",
1181
- "the attacker can steal all funds from the distributor to their own clawback_receiver account.",
1182
- "",
1183
- "HOW TO AVOID:",
1184
- "- When you call into this instruction, ensure your transaction succeeds.",
1185
- "- To be extra safe, after your transaction succeeds, read back the state of the created MerkleDistributor account and",
1186
- "assert the parameters are what you expect, most importantly the clawback_receiver and admin.",
1187
- "- If your transaction fails, double check the value on-chain matches what you expect."
1188
- ],
1262
+ name: "new_claim_by_worker",
1189
1263
  discriminator: [
1190
- 32,
1191
- 139,
1192
- 112,
1193
- 171,
1194
- 0,
1195
- 2,
1196
- 225,
1197
- 155
1264
+ 181,
1265
+ 133,
1266
+ 223,
1267
+ 117,
1268
+ 188,
1269
+ 131,
1270
+ 243,
1271
+ 158
1198
1272
  ],
1199
1273
  accounts: [
1200
1274
  {
1201
1275
  name: "distributor",
1202
1276
  docs: [
1203
- "[MerkleDistributor]."
1277
+ "The [MerkleDistributor]."
1278
+ ],
1279
+ writable: true,
1280
+ relations: [
1281
+ "auto_claim_state"
1282
+ ]
1283
+ },
1284
+ {
1285
+ name: "auto_claim_state",
1286
+ docs: [
1287
+ "Auto-claim SOL reserve for the distributor."
1204
1288
  ],
1289
+ writable: true
1290
+ },
1291
+ {
1292
+ name: "claim_status",
1205
1293
  writable: true,
1206
1294
  pda: {
1207
1295
  seeds: [
1208
1296
  {
1209
1297
  kind: "const",
1210
1298
  value: [
1211
- 77,
1212
- 101,
1213
- 114,
1214
- 107,
1299
+ 67,
1215
1300
  108,
1216
- 101,
1217
- 68,
1301
+ 97,
1218
1302
  105,
1219
- 115,
1303
+ 109,
1304
+ 83,
1220
1305
  116,
1221
- 114,
1222
- 105,
1223
- 98,
1224
- 117,
1306
+ 97,
1225
1307
  116,
1226
- 111,
1227
- 114
1308
+ 117,
1309
+ 115
1228
1310
  ]
1229
1311
  },
1230
1312
  {
1231
1313
  kind: "account",
1232
- path: "mint"
1314
+ path: "claimant"
1233
1315
  },
1234
1316
  {
1235
- kind: "arg",
1236
- path: "version"
1317
+ kind: "account",
1318
+ path: "distributor"
1237
1319
  }
1238
1320
  ]
1239
1321
  }
1240
1322
  },
1241
1323
  {
1242
- name: "clawback_receiver",
1243
- docs: [
1244
- "Clawback receiver token account"
1245
- ],
1246
- writable: true
1247
- },
1248
- {
1249
- name: "mint",
1250
- docs: [
1251
- "The mint to distribute."
1252
- ]
1253
- },
1254
- {
1255
- name: "token_vault",
1324
+ name: "from",
1256
1325
  docs: [
1257
- "Token vault"
1326
+ "Distributor ATA containing the tokens to distribute."
1258
1327
  ],
1259
1328
  writable: true,
1260
1329
  pda: {
@@ -1269,7 +1338,8 @@ var merkle_distributor_default = {
1269
1338
  },
1270
1339
  {
1271
1340
  kind: "account",
1272
- path: "mint"
1341
+ path: "distributor.mint",
1342
+ account: "MerkleDistributor"
1273
1343
  }
1274
1344
  ],
1275
1345
  program: {
@@ -1311,21 +1381,33 @@ var merkle_distributor_default = {
1311
1381
  }
1312
1382
  }
1313
1383
  },
1384
+ {
1385
+ name: "to",
1386
+ writable: true
1387
+ },
1388
+ {
1389
+ name: "claimant"
1390
+ },
1314
1391
  {
1315
1392
  name: "admin",
1393
+ writable: true
1394
+ },
1395
+ {
1396
+ name: "worker",
1316
1397
  docs: [
1317
- "Admin wallet, responsible for creating the distributor and paying for the transaction.",
1318
- "Also has the authority to set the clawback receiver and change itself."
1398
+ "Worker account, anyone can execute the instruction since distribution is validated by the protocol"
1319
1399
  ],
1320
1400
  writable: true,
1321
1401
  signer: true
1322
1402
  },
1323
1403
  {
1324
- name: "system_program",
1404
+ name: "mint",
1325
1405
  docs: [
1326
- "The [System] program."
1406
+ "The mint to claim."
1327
1407
  ],
1328
- address: "11111111111111111111111111111111"
1408
+ relations: [
1409
+ "distributor"
1410
+ ]
1329
1411
  },
1330
1412
  {
1331
1413
  name: "associated_token_program",
@@ -1337,53 +1419,618 @@ var merkle_distributor_default = {
1337
1419
  {
1338
1420
  name: "token_program",
1339
1421
  docs: [
1340
- "The [Token] program."
1422
+ "SPL [Token] program."
1341
1423
  ]
1342
1424
  },
1343
1425
  {
1344
- name: "partner_oracle_config",
1426
+ name: "system_program",
1427
+ docs: [
1428
+ "The [System] program."
1429
+ ],
1430
+ address: "11111111111111111111111111111111"
1431
+ },
1432
+ {
1433
+ name: "event_authority",
1345
1434
  pda: {
1346
1435
  seeds: [
1347
1436
  {
1348
1437
  kind: "const",
1349
1438
  value: [
1350
- 97,
1351
- 105,
1352
- 114,
1353
- 100,
1354
- 114,
1355
- 111,
1356
- 112,
1357
1439
  95,
1358
- 99,
1359
- 111,
1440
+ 95,
1441
+ 101,
1442
+ 118,
1443
+ 101,
1360
1444
  110,
1361
- 102,
1445
+ 116,
1446
+ 95,
1447
+ 97,
1448
+ 117,
1449
+ 116,
1450
+ 104,
1451
+ 111,
1452
+ 114,
1362
1453
  105,
1363
- 103
1454
+ 116,
1455
+ 121
1364
1456
  ]
1365
1457
  }
1366
- ],
1367
- program: {
1368
- kind: "const",
1369
- value: [
1370
- 12,
1371
- 48,
1372
- 148,
1373
- 48,
1374
- 221,
1375
- 89,
1376
- 2,
1377
- 209,
1378
- 180,
1379
- 126,
1380
- 151,
1381
- 216,
1382
- 166,
1383
- 3,
1384
- 112,
1385
- 50,
1386
- 177,
1458
+ ]
1459
+ }
1460
+ },
1461
+ {
1462
+ name: "program"
1463
+ }
1464
+ ],
1465
+ args: [
1466
+ {
1467
+ name: "amount_unlocked",
1468
+ type: "u64"
1469
+ },
1470
+ {
1471
+ name: "amount_locked",
1472
+ type: "u64"
1473
+ },
1474
+ {
1475
+ name: "proof",
1476
+ type: {
1477
+ vec: {
1478
+ array: [
1479
+ "u8",
1480
+ 32
1481
+ ]
1482
+ }
1483
+ }
1484
+ }
1485
+ ]
1486
+ },
1487
+ {
1488
+ name: "new_distributor",
1489
+ docs: [
1490
+ "READ THE FOLLOWING:",
1491
+ "",
1492
+ "This instruction is susceptible to frontrunning that could result in loss of funds if not handled properly.",
1493
+ "",
1494
+ "An attack could look like:",
1495
+ "- A legitimate user opens a new distributor.",
1496
+ "- Someone observes the call to this instruction.",
1497
+ "- They replace the clawback_receiver, admin, or time parameters with their own.",
1498
+ "",
1499
+ "One situation that could happen here is the attacker replaces the admin and clawback_receiver with their own",
1500
+ "and sets the clawback_start_ts with the minimal time allowed. After clawback_start_ts has elapsed,",
1501
+ "the attacker can steal all funds from the distributor to their own clawback_receiver account.",
1502
+ "",
1503
+ "HOW TO AVOID:",
1504
+ "- When you call into this instruction, ensure your transaction succeeds.",
1505
+ "- To be extra safe, after your transaction succeeds, read back the state of the created MerkleDistributor account and",
1506
+ "assert the parameters are what you expect, most importantly the clawback_receiver and admin.",
1507
+ "- If your transaction fails, double check the value on-chain matches what you expect."
1508
+ ],
1509
+ discriminator: [
1510
+ 32,
1511
+ 139,
1512
+ 112,
1513
+ 171,
1514
+ 0,
1515
+ 2,
1516
+ 225,
1517
+ 155
1518
+ ],
1519
+ accounts: [
1520
+ {
1521
+ name: "distributor",
1522
+ docs: [
1523
+ "[MerkleDistributor]."
1524
+ ],
1525
+ writable: true,
1526
+ pda: {
1527
+ seeds: [
1528
+ {
1529
+ kind: "const",
1530
+ value: [
1531
+ 77,
1532
+ 101,
1533
+ 114,
1534
+ 107,
1535
+ 108,
1536
+ 101,
1537
+ 68,
1538
+ 105,
1539
+ 115,
1540
+ 116,
1541
+ 114,
1542
+ 105,
1543
+ 98,
1544
+ 117,
1545
+ 116,
1546
+ 111,
1547
+ 114
1548
+ ]
1549
+ },
1550
+ {
1551
+ kind: "account",
1552
+ path: "mint"
1553
+ },
1554
+ {
1555
+ kind: "arg",
1556
+ path: "version"
1557
+ }
1558
+ ]
1559
+ }
1560
+ },
1561
+ {
1562
+ name: "clawback_receiver",
1563
+ docs: [
1564
+ "Clawback receiver token account"
1565
+ ],
1566
+ writable: true
1567
+ },
1568
+ {
1569
+ name: "mint",
1570
+ docs: [
1571
+ "The mint to distribute."
1572
+ ]
1573
+ },
1574
+ {
1575
+ name: "token_vault",
1576
+ docs: [
1577
+ "Token vault"
1578
+ ],
1579
+ writable: true,
1580
+ pda: {
1581
+ seeds: [
1582
+ {
1583
+ kind: "account",
1584
+ path: "distributor"
1585
+ },
1586
+ {
1587
+ kind: "account",
1588
+ path: "token_program"
1589
+ },
1590
+ {
1591
+ kind: "account",
1592
+ path: "mint"
1593
+ }
1594
+ ],
1595
+ program: {
1596
+ kind: "const",
1597
+ value: [
1598
+ 140,
1599
+ 151,
1600
+ 37,
1601
+ 143,
1602
+ 78,
1603
+ 36,
1604
+ 137,
1605
+ 241,
1606
+ 187,
1607
+ 61,
1608
+ 16,
1609
+ 41,
1610
+ 20,
1611
+ 142,
1612
+ 13,
1613
+ 131,
1614
+ 11,
1615
+ 90,
1616
+ 19,
1617
+ 153,
1618
+ 218,
1619
+ 255,
1620
+ 16,
1621
+ 132,
1622
+ 4,
1623
+ 142,
1624
+ 123,
1625
+ 216,
1626
+ 219,
1627
+ 233,
1628
+ 248,
1629
+ 89
1630
+ ]
1631
+ }
1632
+ }
1633
+ },
1634
+ {
1635
+ name: "admin",
1636
+ docs: [
1637
+ "Admin wallet, responsible for creating the distributor and paying for the transaction.",
1638
+ "Also has the authority to set the clawback receiver and change itself."
1639
+ ],
1640
+ writable: true,
1641
+ signer: true
1642
+ },
1643
+ {
1644
+ name: "system_program",
1645
+ docs: [
1646
+ "The [System] program."
1647
+ ],
1648
+ address: "11111111111111111111111111111111"
1649
+ },
1650
+ {
1651
+ name: "associated_token_program",
1652
+ docs: [
1653
+ "The [Associated Token] program."
1654
+ ],
1655
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
1656
+ },
1657
+ {
1658
+ name: "token_program",
1659
+ docs: [
1660
+ "The [Token] program."
1661
+ ]
1662
+ },
1663
+ {
1664
+ name: "partner_oracle_config",
1665
+ pda: {
1666
+ seeds: [
1667
+ {
1668
+ kind: "const",
1669
+ value: [
1670
+ 97,
1671
+ 105,
1672
+ 114,
1673
+ 100,
1674
+ 114,
1675
+ 111,
1676
+ 112,
1677
+ 95,
1678
+ 99,
1679
+ 111,
1680
+ 110,
1681
+ 102,
1682
+ 105,
1683
+ 103
1684
+ ]
1685
+ }
1686
+ ],
1687
+ program: {
1688
+ kind: "const",
1689
+ value: [
1690
+ 12,
1691
+ 48,
1692
+ 148,
1693
+ 48,
1694
+ 221,
1695
+ 89,
1696
+ 2,
1697
+ 209,
1698
+ 180,
1699
+ 126,
1700
+ 151,
1701
+ 216,
1702
+ 166,
1703
+ 3,
1704
+ 112,
1705
+ 50,
1706
+ 177,
1707
+ 192,
1708
+ 141,
1709
+ 218,
1710
+ 37,
1711
+ 78,
1712
+ 51,
1713
+ 109,
1714
+ 243,
1715
+ 106,
1716
+ 174,
1717
+ 122,
1718
+ 93,
1719
+ 121,
1720
+ 191,
1721
+ 119
1722
+ ]
1723
+ }
1724
+ }
1725
+ },
1726
+ {
1727
+ name: "partner_oracle",
1728
+ docs: [
1729
+ "Partner Oracle program that stores fees"
1730
+ ],
1731
+ address: "pardpVtPjC8nLj1Dwncew62mUzfChdCX1EaoZe8oCAa"
1732
+ }
1733
+ ],
1734
+ args: [
1735
+ {
1736
+ name: "version",
1737
+ type: "u64"
1738
+ },
1739
+ {
1740
+ name: "root",
1741
+ type: {
1742
+ array: [
1743
+ "u8",
1744
+ 32
1745
+ ]
1746
+ }
1747
+ },
1748
+ {
1749
+ name: "max_total_claim",
1750
+ type: "u64"
1751
+ },
1752
+ {
1753
+ name: "max_num_nodes",
1754
+ type: "u64"
1755
+ },
1756
+ {
1757
+ name: "unlock_period",
1758
+ type: "u64"
1759
+ },
1760
+ {
1761
+ name: "start_vesting_ts",
1762
+ type: "u64"
1763
+ },
1764
+ {
1765
+ name: "end_vesting_ts",
1766
+ type: "u64"
1767
+ },
1768
+ {
1769
+ name: "clawback_start_ts",
1770
+ type: "u64"
1771
+ },
1772
+ {
1773
+ name: "claims_closable_by_admin",
1774
+ type: "bool"
1775
+ },
1776
+ {
1777
+ name: "can_update_duration",
1778
+ type: {
1779
+ option: "bool"
1780
+ }
1781
+ },
1782
+ {
1783
+ name: "total_amount_unlocked",
1784
+ type: {
1785
+ option: "u64"
1786
+ }
1787
+ },
1788
+ {
1789
+ name: "total_amount_locked",
1790
+ type: {
1791
+ option: "u64"
1792
+ }
1793
+ },
1794
+ {
1795
+ name: "claims_closable_by_claimant",
1796
+ type: {
1797
+ option: "bool"
1798
+ }
1799
+ },
1800
+ {
1801
+ name: "claims_limit",
1802
+ type: {
1803
+ option: "u16"
1804
+ }
1805
+ }
1806
+ ]
1807
+ },
1808
+ {
1809
+ name: "new_distributor_v2",
1810
+ discriminator: [
1811
+ 45,
1812
+ 79,
1813
+ 3,
1814
+ 238,
1815
+ 185,
1816
+ 37,
1817
+ 253,
1818
+ 179
1819
+ ],
1820
+ accounts: [
1821
+ {
1822
+ name: "distributor",
1823
+ docs: [
1824
+ "[MerkleDistributor]."
1825
+ ],
1826
+ writable: true,
1827
+ pda: {
1828
+ seeds: [
1829
+ {
1830
+ kind: "const",
1831
+ value: [
1832
+ 77,
1833
+ 101,
1834
+ 114,
1835
+ 107,
1836
+ 108,
1837
+ 101,
1838
+ 68,
1839
+ 105,
1840
+ 115,
1841
+ 116,
1842
+ 114,
1843
+ 105,
1844
+ 98,
1845
+ 117,
1846
+ 116,
1847
+ 111,
1848
+ 114
1849
+ ]
1850
+ },
1851
+ {
1852
+ kind: "account",
1853
+ path: "mint"
1854
+ },
1855
+ {
1856
+ kind: "arg",
1857
+ path: "version"
1858
+ }
1859
+ ]
1860
+ }
1861
+ },
1862
+ {
1863
+ name: "clawback_receiver",
1864
+ docs: [
1865
+ "Clawback receiver token account"
1866
+ ],
1867
+ writable: true
1868
+ },
1869
+ {
1870
+ name: "mint",
1871
+ docs: [
1872
+ "The mint to distribute."
1873
+ ]
1874
+ },
1875
+ {
1876
+ name: "token_vault",
1877
+ docs: [
1878
+ "Token vault"
1879
+ ],
1880
+ writable: true,
1881
+ pda: {
1882
+ seeds: [
1883
+ {
1884
+ kind: "account",
1885
+ path: "distributor"
1886
+ },
1887
+ {
1888
+ kind: "account",
1889
+ path: "token_program"
1890
+ },
1891
+ {
1892
+ kind: "account",
1893
+ path: "mint"
1894
+ }
1895
+ ],
1896
+ program: {
1897
+ kind: "const",
1898
+ value: [
1899
+ 140,
1900
+ 151,
1901
+ 37,
1902
+ 143,
1903
+ 78,
1904
+ 36,
1905
+ 137,
1906
+ 241,
1907
+ 187,
1908
+ 61,
1909
+ 16,
1910
+ 41,
1911
+ 20,
1912
+ 142,
1913
+ 13,
1914
+ 131,
1915
+ 11,
1916
+ 90,
1917
+ 19,
1918
+ 153,
1919
+ 218,
1920
+ 255,
1921
+ 16,
1922
+ 132,
1923
+ 4,
1924
+ 142,
1925
+ 123,
1926
+ 216,
1927
+ 219,
1928
+ 233,
1929
+ 248,
1930
+ 89
1931
+ ]
1932
+ }
1933
+ }
1934
+ },
1935
+ {
1936
+ name: "admin",
1937
+ docs: [
1938
+ "Admin wallet, responsible for creating the distributor and paying for the transaction.",
1939
+ "Also has the authority to set the clawback receiver and change itself."
1940
+ ],
1941
+ writable: true,
1942
+ signer: true
1943
+ },
1944
+ {
1945
+ name: "auto_claim_state",
1946
+ writable: true,
1947
+ pda: {
1948
+ seeds: [
1949
+ {
1950
+ kind: "const",
1951
+ value: [
1952
+ 65,
1953
+ 117,
1954
+ 116,
1955
+ 111,
1956
+ 67,
1957
+ 108,
1958
+ 97,
1959
+ 105,
1960
+ 109
1961
+ ]
1962
+ },
1963
+ {
1964
+ kind: "account",
1965
+ path: "distributor"
1966
+ }
1967
+ ]
1968
+ }
1969
+ },
1970
+ {
1971
+ name: "system_program",
1972
+ docs: [
1973
+ "The [System] program."
1974
+ ],
1975
+ address: "11111111111111111111111111111111"
1976
+ },
1977
+ {
1978
+ name: "associated_token_program",
1979
+ docs: [
1980
+ "The [Associated Token] program."
1981
+ ],
1982
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
1983
+ },
1984
+ {
1985
+ name: "token_program",
1986
+ docs: [
1987
+ "The [Token] program."
1988
+ ]
1989
+ },
1990
+ {
1991
+ name: "partner_oracle_config",
1992
+ pda: {
1993
+ seeds: [
1994
+ {
1995
+ kind: "const",
1996
+ value: [
1997
+ 97,
1998
+ 105,
1999
+ 114,
2000
+ 100,
2001
+ 114,
2002
+ 111,
2003
+ 112,
2004
+ 95,
2005
+ 99,
2006
+ 111,
2007
+ 110,
2008
+ 102,
2009
+ 105,
2010
+ 103
2011
+ ]
2012
+ }
2013
+ ],
2014
+ program: {
2015
+ kind: "const",
2016
+ value: [
2017
+ 12,
2018
+ 48,
2019
+ 148,
2020
+ 48,
2021
+ 221,
2022
+ 89,
2023
+ 2,
2024
+ 209,
2025
+ 180,
2026
+ 126,
2027
+ 151,
2028
+ 216,
2029
+ 166,
2030
+ 3,
2031
+ 112,
2032
+ 50,
2033
+ 177,
1387
2034
  192,
1388
2035
  141,
1389
2036
  218,
@@ -1429,6 +2076,14 @@ var merkle_distributor_default = {
1429
2076
  name: "max_total_claim",
1430
2077
  type: "u64"
1431
2078
  },
2079
+ {
2080
+ name: "total_amount_unlocked",
2081
+ type: "u64"
2082
+ },
2083
+ {
2084
+ name: "total_amount_locked",
2085
+ type: "u64"
2086
+ },
1432
2087
  {
1433
2088
  name: "max_num_nodes",
1434
2089
  type: "u64"
@@ -1453,35 +2108,92 @@ var merkle_distributor_default = {
1453
2108
  name: "claims_closable_by_admin",
1454
2109
  type: "bool"
1455
2110
  },
2111
+ {
2112
+ name: "claims_closable_by_claimant",
2113
+ type: "bool"
2114
+ },
1456
2115
  {
1457
2116
  name: "can_update_duration",
1458
- type: {
1459
- option: "bool"
1460
- }
2117
+ type: "bool"
1461
2118
  },
1462
2119
  {
1463
- name: "total_amount_unlocked",
1464
- type: {
1465
- option: "u64"
1466
- }
2120
+ name: "claims_limit",
2121
+ type: "u16"
1467
2122
  },
1468
2123
  {
1469
- name: "total_amount_locked",
1470
- type: {
1471
- option: "u64"
1472
- }
2124
+ name: "auto_claim",
2125
+ type: "bool"
2126
+ }
2127
+ ]
2128
+ },
2129
+ {
2130
+ name: "realloc_distributor",
2131
+ discriminator: [
2132
+ 167,
2133
+ 165,
2134
+ 22,
2135
+ 244,
2136
+ 248,
2137
+ 99,
2138
+ 33,
2139
+ 42
2140
+ ],
2141
+ accounts: [
2142
+ {
2143
+ name: "payer",
2144
+ writable: true,
2145
+ signer: true
1473
2146
  },
1474
2147
  {
1475
- name: "claims_closable_by_claimant",
1476
- type: {
1477
- option: "bool"
1478
- }
2148
+ name: "mint"
1479
2149
  },
1480
2150
  {
1481
- name: "claims_limit",
1482
- type: {
1483
- option: "u16"
2151
+ name: "distributor",
2152
+ writable: true,
2153
+ pda: {
2154
+ seeds: [
2155
+ {
2156
+ kind: "const",
2157
+ value: [
2158
+ 77,
2159
+ 101,
2160
+ 114,
2161
+ 107,
2162
+ 108,
2163
+ 101,
2164
+ 68,
2165
+ 105,
2166
+ 115,
2167
+ 116,
2168
+ 114,
2169
+ 105,
2170
+ 98,
2171
+ 117,
2172
+ 116,
2173
+ 111,
2174
+ 114
2175
+ ]
2176
+ },
2177
+ {
2178
+ kind: "account",
2179
+ path: "mint"
2180
+ },
2181
+ {
2182
+ kind: "arg",
2183
+ path: "version"
2184
+ }
2185
+ ]
1484
2186
  }
2187
+ },
2188
+ {
2189
+ name: "system_program",
2190
+ address: "11111111111111111111111111111111"
2191
+ }
2192
+ ],
2193
+ args: [
2194
+ {
2195
+ name: "version",
2196
+ type: "u64"
1485
2197
  }
1486
2198
  ]
1487
2199
  },
@@ -1563,6 +2275,36 @@ var merkle_distributor_default = {
1563
2275
  ],
1564
2276
  args: []
1565
2277
  },
2278
+ {
2279
+ name: "request_clawback",
2280
+ discriminator: [
2281
+ 57,
2282
+ 57,
2283
+ 31,
2284
+ 191,
2285
+ 239,
2286
+ 66,
2287
+ 54,
2288
+ 8
2289
+ ],
2290
+ accounts: [
2291
+ {
2292
+ name: "distributor",
2293
+ docs: [
2294
+ "The [MerkleDistributor]."
2295
+ ],
2296
+ writable: true
2297
+ },
2298
+ {
2299
+ name: "authority",
2300
+ docs: [
2301
+ "Fee partner signer that may initiate the delayed clawback flow."
2302
+ ],
2303
+ signer: true
2304
+ }
2305
+ ],
2306
+ args: []
2307
+ },
1566
2308
  {
1567
2309
  name: "set_admin",
1568
2310
  discriminator: [
@@ -1708,20 +2450,63 @@ var merkle_distributor_default = {
1708
2450
  docs: [
1709
2451
  "The [System] program."
1710
2452
  ],
1711
- address: "11111111111111111111111111111111"
2453
+ address: "11111111111111111111111111111111"
2454
+ }
2455
+ ],
2456
+ args: [
2457
+ {
2458
+ name: "end_ts",
2459
+ type: {
2460
+ option: "u64"
2461
+ }
2462
+ }
2463
+ ]
2464
+ },
2465
+ {
2466
+ name: "withdraw_clawback_request",
2467
+ discriminator: [
2468
+ 149,
2469
+ 159,
2470
+ 253,
2471
+ 249,
2472
+ 226,
2473
+ 250,
2474
+ 21,
2475
+ 8
2476
+ ],
2477
+ accounts: [
2478
+ {
2479
+ name: "distributor",
2480
+ docs: [
2481
+ "The [MerkleDistributor]."
2482
+ ],
2483
+ writable: true
2484
+ },
2485
+ {
2486
+ name: "authority",
2487
+ docs: [
2488
+ "Fee partner signer that may initiate the delayed clawback flow."
2489
+ ],
2490
+ signer: true
1712
2491
  }
1713
2492
  ],
1714
- args: [
1715
- {
1716
- name: "end_ts",
1717
- type: {
1718
- option: "u64"
1719
- }
1720
- }
1721
- ]
2493
+ args: []
1722
2494
  }
1723
2495
  ],
1724
2496
  accounts: [
2497
+ {
2498
+ name: "AutoClaimState",
2499
+ discriminator: [
2500
+ 216,
2501
+ 43,
2502
+ 239,
2503
+ 75,
2504
+ 58,
2505
+ 129,
2506
+ 132,
2507
+ 12
2508
+ ]
2509
+ },
1725
2510
  {
1726
2511
  name: "ClaimStatus",
1727
2512
  discriminator: [
@@ -1938,9 +2723,142 @@ var merkle_distributor_default = {
1938
2723
  code: 6026,
1939
2724
  name: "NoFeesToClaim",
1940
2725
  msg: "No fees to claim"
2726
+ },
2727
+ {
2728
+ code: 6027,
2729
+ name: "AutoClaimNotPossible",
2730
+ msg: "Auto-claim is available only for instant airdrops"
2731
+ },
2732
+ {
2733
+ code: 6028,
2734
+ name: "AutoClaimEnabled",
2735
+ msg: "Auto-claim is enabled for this airdrop, manual claims are not possible, clawback v2 is required"
2736
+ },
2737
+ {
2738
+ code: 6029,
2739
+ name: "AutoClaimNotEnabled",
2740
+ msg: "Auto-claim is not enabled for this airdrop"
2741
+ },
2742
+ {
2743
+ code: 6030,
2744
+ name: "InvalidAutoClaimTokenAccount",
2745
+ msg: "Invalid auto-claim recipient token account"
2746
+ },
2747
+ {
2748
+ code: 6031,
2749
+ name: "ClawbackRequestAlreadyRequested",
2750
+ msg: "Clawback has already been requested"
2751
+ },
2752
+ {
2753
+ code: 6032,
2754
+ name: "ClawbackRequestNotRequested",
2755
+ msg: "Clawback has not been requested"
2756
+ },
2757
+ {
2758
+ code: 6033,
2759
+ name: "ClawbackRequestDelayPending",
2760
+ msg: "Clawback request delay has not passed yet"
1941
2761
  }
1942
2762
  ],
1943
2763
  types: [
2764
+ {
2765
+ name: "AutoClaimState",
2766
+ docs: [
2767
+ "Tracks reserved and spent SOL for worker auto-claims."
2768
+ ],
2769
+ type: {
2770
+ kind: "struct",
2771
+ fields: [
2772
+ {
2773
+ name: "bump",
2774
+ docs: [
2775
+ "Bump seed."
2776
+ ],
2777
+ type: "u8"
2778
+ },
2779
+ {
2780
+ name: "distributor",
2781
+ docs: [
2782
+ "Distributor account this state belongs to."
2783
+ ],
2784
+ type: "pubkey"
2785
+ },
2786
+ {
2787
+ name: "tx_fee_lamports",
2788
+ docs: [
2789
+ "Fixed reimbursement for transaction processing."
2790
+ ],
2791
+ type: "u64"
2792
+ },
2793
+ {
2794
+ name: "ata_rent_lamports",
2795
+ docs: [
2796
+ "Fixed reimbursement for ATA creation when it is needed."
2797
+ ],
2798
+ type: "u64"
2799
+ },
2800
+ {
2801
+ name: "claim_status_rent_lamports",
2802
+ docs: [
2803
+ "Fixed reimbursement tom cover ClaimStatus account creation."
2804
+ ],
2805
+ type: "u64"
2806
+ },
2807
+ {
2808
+ name: "total_funded",
2809
+ docs: [
2810
+ "Total SOL funded for reimbursements."
2811
+ ],
2812
+ type: "u64"
2813
+ },
2814
+ {
2815
+ name: "total_spent",
2816
+ docs: [
2817
+ "Total SOL reimbursed so far."
2818
+ ],
2819
+ type: "u64"
2820
+ },
2821
+ {
2822
+ name: "claims_processed",
2823
+ docs: [
2824
+ "Number of claims processed by the worker."
2825
+ ],
2826
+ type: "u64"
2827
+ },
2828
+ {
2829
+ name: "ata_creations",
2830
+ docs: [
2831
+ "Number of ATAs funded by the worker path."
2832
+ ],
2833
+ type: "u64"
2834
+ },
2835
+ {
2836
+ name: "buffer1",
2837
+ docs: [
2838
+ "Buffer for additional fields"
2839
+ ],
2840
+ type: {
2841
+ array: [
2842
+ "u8",
2843
+ 32
2844
+ ]
2845
+ }
2846
+ },
2847
+ {
2848
+ name: "buffer2",
2849
+ docs: [
2850
+ "Buffer for additional fields"
2851
+ ],
2852
+ type: {
2853
+ array: [
2854
+ "u8",
2855
+ 32
2856
+ ]
2857
+ }
2858
+ }
2859
+ ]
2860
+ }
2861
+ },
1944
2862
  {
1945
2863
  name: "ClaimClosedEvent",
1946
2864
  docs: [
@@ -2362,14 +3280,56 @@ var merkle_distributor_default = {
2362
3280
  type: "u8"
2363
3281
  },
2364
3282
  {
2365
- name: "buffer",
3283
+ name: "auto_claim",
2366
3284
  docs: [
2367
- "Buffer for additional fields"
3285
+ "Whether Distributor supports auto-claim"
3286
+ ],
3287
+ type: "bool"
3288
+ },
3289
+ {
3290
+ name: "align_buffer_1",
3291
+ docs: [
3292
+ "Extra buffer to keep alignment, may be reused"
3293
+ ],
3294
+ type: {
3295
+ array: [
3296
+ "u8",
3297
+ 4
3298
+ ]
3299
+ }
3300
+ },
3301
+ {
3302
+ name: "fee_partner",
3303
+ docs: [
3304
+ "Partner wallet whose fee schedule was applied, if different from the creator"
3305
+ ],
3306
+ type: "pubkey"
3307
+ },
3308
+ {
3309
+ name: "clawback_request_ts",
3310
+ docs: [
3311
+ "Timestamp when clawback was requested by the fee partner"
3312
+ ],
3313
+ type: "u64"
3314
+ },
3315
+ {
3316
+ name: "buffer_1",
3317
+ docs: [
3318
+ "Buffers for additional fields"
2368
3319
  ],
2369
3320
  type: {
2370
3321
  array: [
2371
3322
  "u8",
2372
- 13
3323
+ 32
3324
+ ]
3325
+ }
3326
+ },
3327
+ {
3328
+ name: "buffer_2",
3329
+ type: {
3330
+ array: [
3331
+ "u8",
3332
+ 32
2373
3333
  ]
2374
3334
  }
2375
3335
  }
@@ -2423,7 +3383,7 @@ var aligned_distributor_default = {
2423
3383
  address: "aMERKpFAWoChCi5oZwPvgsSCoGpZKBiU7fi76bdZjt2",
2424
3384
  metadata: {
2425
3385
  name: "aligned_distributor",
2426
- version: "2.0.0",
3386
+ version: "1.9.0",
2427
3387
  spec: "0.1.0",
2428
3388
  description: "Proxy for merkle distributor that updates Vesting duration according to token market performance."
2429
3389
  },
@@ -2575,9 +3535,9 @@ var aligned_distributor_default = {
2575
3535
  {
2576
3536
  name: "admin",
2577
3537
  docs: [
2578
- "Only Admin can trigger the clawback of funds"
3538
+ "Admin or anybody in case distributor has been clawed back (usually by clawback authority).",
3539
+ "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"
2579
3540
  ],
2580
- writable: true,
2581
3541
  signer: true
2582
3542
  },
2583
3543
  {
@@ -3452,6 +4412,16 @@ var aligned_distributor_default = {
3452
4412
  code: 6014,
3453
4413
  name: "NoFeesToClaim",
3454
4414
  msg: "No fees to claim"
4415
+ },
4416
+ {
4417
+ code: 6015,
4418
+ name: "DurationNotUpdated",
4419
+ msg: "Update won't lead to any changes in unlock schedule"
4420
+ },
4421
+ {
4422
+ code: 6016,
4423
+ name: "ClawbackAlreadyClaimed",
4424
+ msg: "Clawback already claimed"
3455
4425
  }
3456
4426
  ],
3457
4427
  types: [
@@ -3940,14 +4910,56 @@ var aligned_distributor_default = {
3940
4910
  type: "u8"
3941
4911
  },
3942
4912
  {
3943
- name: "buffer",
4913
+ name: "auto_claim",
3944
4914
  docs: [
3945
- "Buffer for additional fields"
4915
+ "Whether Distributor supports auto-claim"
4916
+ ],
4917
+ type: "bool"
4918
+ },
4919
+ {
4920
+ name: "align_buffer_1",
4921
+ docs: [
4922
+ "Extra buffer to keep alignment, may be reused"
4923
+ ],
4924
+ type: {
4925
+ array: [
4926
+ "u8",
4927
+ 4
4928
+ ]
4929
+ }
4930
+ },
4931
+ {
4932
+ name: "fee_partner",
4933
+ docs: [
4934
+ "Partner wallet whose fee schedule was applied, if different from the creator"
4935
+ ],
4936
+ type: "pubkey"
4937
+ },
4938
+ {
4939
+ name: "clawback_request_ts",
4940
+ docs: [
4941
+ "Timestamp when clawback was requested by the fee partner"
4942
+ ],
4943
+ type: "u64"
4944
+ },
4945
+ {
4946
+ name: "buffer_1",
4947
+ docs: [
4948
+ "Buffers for additional fields"
3946
4949
  ],
3947
4950
  type: {
3948
4951
  array: [
3949
4952
  "u8",
3950
- 13
4953
+ 32
4954
+ ]
4955
+ }
4956
+ },
4957
+ {
4958
+ name: "buffer_2",
4959
+ type: {
4960
+ array: [
4961
+ "u8",
4962
+ 32
3951
4963
  ]
3952
4964
  }
3953
4965
  }
@@ -4676,7 +5688,7 @@ var BaseDistributorClient = class {
4676
5688
  distributor: distributorPublicKey,
4677
5689
  from: distributor.tokenVault,
4678
5690
  to: distributor.clawbackReceiver,
4679
- admin: extParams.invoker.publicKey,
5691
+ authority: extParams.invoker.publicKey,
4680
5692
  mint: distributor.mint,
4681
5693
  tokenProgram: tokenProgramId
4682
5694
  };
@@ -4706,6 +5718,84 @@ var BaseDistributorClient = class {
4706
5718
  );
4707
5719
  return { ixs, txId: signature };
4708
5720
  }
5721
+ /**
5722
+ * Requests delayed clawback by the configured fee partner authority.
5723
+ * Once the request is recorded on-chain, clawback can be executed after the
5724
+ * configured delay elapses.
5725
+ */
5726
+ async requestClawback(data, extParams) {
5727
+ const executionParams = this.unwrapExecutionParams(extParams);
5728
+ const invoker = executionParams.invoker.publicKey;
5729
+ common.invariant(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
5730
+ const ixs = await common.createAndEstimateTransaction(
5731
+ (params) => this.prepareRequestClawbackInstructions(data, params),
5732
+ executionParams
5733
+ );
5734
+ const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, invoker);
5735
+ const signature = await wrappedSignAndExecuteTransaction(
5736
+ this.connection,
5737
+ executionParams.invoker,
5738
+ tx,
5739
+ {
5740
+ hash,
5741
+ context,
5742
+ commitment: this.getCommitment()
5743
+ },
5744
+ { sendThrottler: this.sendThrottler, skipSimulation: executionParams.skipSimulation }
5745
+ );
5746
+ return { ixs, txId: signature };
5747
+ }
5748
+ async prepareRequestClawbackInstructions(data, extParams) {
5749
+ if (!extParams.invoker.publicKey) {
5750
+ throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
5751
+ }
5752
+ const ixs = common.prepareBaseInstructions(this.connection, extParams);
5753
+ ixs.push(
5754
+ await this.merkleDistributorProgram.methods.requestClawback().accounts({
5755
+ distributor: new web3_js.PublicKey(data.id),
5756
+ authority: extParams.invoker.publicKey
5757
+ }).instruction()
5758
+ );
5759
+ return ixs;
5760
+ }
5761
+ /**
5762
+ * Withdraws a previously submitted clawback request, cancelling the delayed clawback flow.
5763
+ */
5764
+ async withdrawClawbackRequest(data, extParams) {
5765
+ const executionParams = this.unwrapExecutionParams(extParams);
5766
+ const invoker = executionParams.invoker.publicKey;
5767
+ common.invariant(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
5768
+ const ixs = await common.createAndEstimateTransaction(
5769
+ (params) => this.prepareWithdrawClawbackRequestInstructions(data, params),
5770
+ executionParams
5771
+ );
5772
+ const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, invoker);
5773
+ const signature = await wrappedSignAndExecuteTransaction(
5774
+ this.connection,
5775
+ executionParams.invoker,
5776
+ tx,
5777
+ {
5778
+ hash,
5779
+ context,
5780
+ commitment: this.getCommitment()
5781
+ },
5782
+ { sendThrottler: this.sendThrottler, skipSimulation: executionParams.skipSimulation }
5783
+ );
5784
+ return { ixs, txId: signature };
5785
+ }
5786
+ async prepareWithdrawClawbackRequestInstructions(data, extParams) {
5787
+ if (!extParams.invoker.publicKey) {
5788
+ throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
5789
+ }
5790
+ const ixs = common.prepareBaseInstructions(this.connection, extParams);
5791
+ ixs.push(
5792
+ await this.merkleDistributorProgram.methods.withdrawClawbackRequest().accounts({
5793
+ distributor: new web3_js.PublicKey(data.id),
5794
+ authority: extParams.invoker.publicKey
5795
+ }).instruction()
5796
+ );
5797
+ return ixs;
5798
+ }
4709
5799
  async getClaim(claimStatus) {
4710
5800
  return this.connection.getAccountInfo(common.pk(claimStatus)).then((account) => this.decodeClaimStatus(account));
4711
5801
  }
@@ -4830,7 +5920,7 @@ function decode(program, accountName, accInfo, programKey) {
4830
5920
  var SolanaDistributorClient = class extends BaseDistributorClient {
4831
5921
  async getNewDistributorInstruction(data, accounts) {
4832
5922
  this.validateDistributorArgs(data);
4833
- return this.merkleDistributorProgram.methods.newDistributor(
5923
+ let builder = this.merkleDistributorProgram.methods.newDistributor(
4834
5924
  new BN__default.default(data.version),
4835
5925
  data.root,
4836
5926
  new BN__default.default(data.maxTotalClaim),
@@ -4848,7 +5938,13 @@ var SolanaDistributorClient = class extends BaseDistributorClient {
4848
5938
  // total_amount_locked
4849
5939
  data.claimsClosableByClaimant ?? null,
4850
5940
  data.claimsLimit ?? null
4851
- ).accounts(accounts).accountsPartial({ partnerOracle: this.partnerOracleProgramId, partnerOracleConfig: this.feeConfigPublicKey }).instruction();
5941
+ ).accounts(accounts).accountsPartial({ partnerOracle: this.partnerOracleProgramId, partnerOracleConfig: this.feeConfigPublicKey });
5942
+ if (data.partnerLink) {
5943
+ builder = builder.remainingAccounts([
5944
+ { pubkey: new web3_js.PublicKey(data.partnerLink.address), isSigner: data.partnerLink.isSigner, isWritable: false }
5945
+ ]);
5946
+ }
5947
+ return builder.instruction();
4852
5948
  }
4853
5949
  async getClawbackInstruction(accounts) {
4854
5950
  return this.merkleDistributorProgram.methods.clawback().accounts(accounts).instruction();
@@ -4906,7 +6002,7 @@ var SolanaAlignedDistributorClient = class extends BaseDistributorClient {
4906
6002
  this.validateDistributorArgs(data);
4907
6003
  const alignedArgs = this.getNewAlignedDistributorArgs(data);
4908
6004
  const oracle = data.oracleAddress ? new web3_js.PublicKey(data.oracleAddress) : getTestOraclePda(this.alignedProxyProgram.programId, common.pk(mint), common.pk(admin));
4909
- return this.alignedProxyProgram.methods.newDistributor({
6005
+ let builder = this.alignedProxyProgram.methods.newDistributor({
4910
6006
  claimsClosable: data.claimsClosableByAdmin,
4911
6007
  version: new BN__default.default(data.version),
4912
6008
  root: data.root,
@@ -4925,10 +6021,16 @@ var SolanaAlignedDistributorClient = class extends BaseDistributorClient {
4925
6021
  mint,
4926
6022
  tokenProgram,
4927
6023
  priceOracle: oracle
4928
- }).accountsPartial({ partnerOracle: this.partnerOracleProgramId, partnerOracleConfig: this.feeConfigPublicKey }).instruction();
6024
+ }).accountsPartial({ partnerOracle: this.partnerOracleProgramId, partnerOracleConfig: this.feeConfigPublicKey });
6025
+ if (data.partnerLink) {
6026
+ builder = builder.remainingAccounts([
6027
+ { pubkey: new web3_js.PublicKey(data.partnerLink.address), isSigner: data.partnerLink.isSigner, isWritable: false }
6028
+ ]);
6029
+ }
6030
+ return builder.instruction();
4929
6031
  }
4930
6032
  async getClawbackInstruction(accounts) {
4931
- const { distributor, from, to, mint, tokenProgram, admin } = accounts;
6033
+ const { distributor, from, to, mint, tokenProgram, authority } = accounts;
4932
6034
  const alignedDistributorKey = getAlignedDistributorPda(
4933
6035
  this.alignedProxyProgram.programId,
4934
6036
  common.pk(accounts.distributor)
@@ -4936,7 +6038,7 @@ var SolanaAlignedDistributorClient = class extends BaseDistributorClient {
4936
6038
  const alignedProxy = await this.alignedProxyProgram.account.alignedDistributor.fetch(alignedDistributorKey);
4937
6039
  common.invariant(alignedProxy, "Aligned Distributor proxy account not found");
4938
6040
  return this.alignedProxyProgram.methods.clawback().accounts({
4939
- admin,
6041
+ admin: authority,
4940
6042
  distributor,
4941
6043
  from,
4942
6044
  to,