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