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