liquid-sdk 1.1.0 → 1.2.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/index.mjs CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  encodePacked,
6
6
  keccak256,
7
7
  getAddress,
8
+ parseAbiItem,
8
9
  zeroAddress as zeroAddress2
9
10
  } from "viem";
10
11
  import { base as base2 } from "viem/chains";
@@ -819,6 +820,52 @@ var LiquidLpLockerAbi = [
819
820
  }
820
821
  ];
821
822
 
823
+ // src/abis/LiquidToken.ts
824
+ var LiquidTokenAbi = [
825
+ {
826
+ type: "function",
827
+ name: "updateImage",
828
+ inputs: [{ name: "image_", type: "string" }],
829
+ outputs: [],
830
+ stateMutability: "nonpayable"
831
+ },
832
+ {
833
+ type: "function",
834
+ name: "updateMetadata",
835
+ inputs: [{ name: "metadata_", type: "string" }],
836
+ outputs: [],
837
+ stateMutability: "nonpayable"
838
+ },
839
+ {
840
+ type: "function",
841
+ name: "updateAdmin",
842
+ inputs: [{ name: "admin_", type: "address" }],
843
+ outputs: [],
844
+ stateMutability: "nonpayable"
845
+ },
846
+ {
847
+ type: "event",
848
+ name: "UpdateImage",
849
+ inputs: [{ name: "image", type: "string", indexed: false }],
850
+ anonymous: false
851
+ },
852
+ {
853
+ type: "event",
854
+ name: "UpdateMetadata",
855
+ inputs: [{ name: "metadata", type: "string", indexed: false }],
856
+ anonymous: false
857
+ },
858
+ {
859
+ type: "event",
860
+ name: "UpdateAdmin",
861
+ inputs: [
862
+ { name: "oldAdmin", type: "address", indexed: false },
863
+ { name: "newAdmin", type: "address", indexed: false }
864
+ ],
865
+ anonymous: false
866
+ }
867
+ ];
868
+
822
869
  // src/abis/ERC20.ts
823
870
  var ERC20Abi = [
824
871
  {
@@ -1547,8 +1594,232 @@ var LiquidSDK = class {
1547
1594
  args: [poolId]
1548
1595
  });
1549
1596
  }
1597
+ // ── Token Metadata Updates ──────────────────────────────────────────
1598
+ /**
1599
+ * Update a token's image. Must be called by the token admin.
1600
+ */
1601
+ async updateImage(tokenAddress, newImage) {
1602
+ if (!this.walletClient?.account) {
1603
+ throw new Error("walletClient with account required for updateImage");
1604
+ }
1605
+ return await this.walletClient.writeContract({
1606
+ address: tokenAddress,
1607
+ abi: LiquidTokenAbi,
1608
+ functionName: "updateImage",
1609
+ args: [newImage],
1610
+ chain: base2,
1611
+ account: this.walletClient.account
1612
+ });
1613
+ }
1614
+ /**
1615
+ * Update a token's metadata. Must be called by the token admin.
1616
+ */
1617
+ async updateMetadata(tokenAddress, newMetadata) {
1618
+ if (!this.walletClient?.account) {
1619
+ throw new Error("walletClient with account required for updateMetadata");
1620
+ }
1621
+ return await this.walletClient.writeContract({
1622
+ address: tokenAddress,
1623
+ abi: LiquidTokenAbi,
1624
+ functionName: "updateMetadata",
1625
+ args: [newMetadata],
1626
+ chain: base2,
1627
+ account: this.walletClient.account
1628
+ });
1629
+ }
1630
+ // ── Token Discovery ─────────────────────────────────────────────────
1631
+ /**
1632
+ * Get all tokens deployed by a specific address by querying TokenCreated events.
1633
+ * @param deployer - The address that deployed the tokens (msgSender)
1634
+ * @param fromBlock - Starting block to search from (defaults to 0n)
1635
+ * @param toBlock - Ending block to search to (defaults to 'latest')
1636
+ */
1637
+ async getDeployedTokens(deployer, fromBlock, toBlock) {
1638
+ const logs = await this.publicClient.getLogs({
1639
+ address: ADDRESSES.FACTORY,
1640
+ event: parseAbiItem(
1641
+ "event TokenCreated(address msgSender, address indexed tokenAddress, address indexed tokenAdmin, string tokenImage, string tokenName, string tokenSymbol, string tokenMetadata, string tokenContext, int24 startingTick, address poolHook, bytes32 poolId, address pairedToken, address locker, address mevModule, uint256 extensionsSupply, address[] extensions)"
1642
+ ),
1643
+ fromBlock: fromBlock ?? 0n,
1644
+ toBlock: toBlock ?? "latest"
1645
+ });
1646
+ return logs.filter((log) => {
1647
+ const sender = log.args.msgSender;
1648
+ return sender && getAddress(sender) === getAddress(deployer);
1649
+ }).map((log) => {
1650
+ const args = log.args;
1651
+ return {
1652
+ msgSender: args.msgSender,
1653
+ tokenAddress: args.tokenAddress,
1654
+ tokenAdmin: args.tokenAdmin,
1655
+ tokenImage: args.tokenImage,
1656
+ tokenName: args.tokenName,
1657
+ tokenSymbol: args.tokenSymbol,
1658
+ tokenMetadata: args.tokenMetadata,
1659
+ tokenContext: args.tokenContext,
1660
+ startingTick: args.startingTick,
1661
+ poolHook: args.poolHook,
1662
+ poolId: args.poolId,
1663
+ pairedToken: args.pairedToken,
1664
+ locker: args.locker,
1665
+ mevModule: args.mevModule,
1666
+ extensionsSupply: args.extensionsSupply,
1667
+ extensions: args.extensions
1668
+ };
1669
+ });
1670
+ }
1550
1671
  };
1551
1672
 
1673
+ // src/abis/LiquidUniv4EthDevBuy.ts
1674
+ var LiquidUniv4EthDevBuyAbi = [
1675
+ {
1676
+ type: "constructor",
1677
+ inputs: [
1678
+ { name: "factory_", type: "address" },
1679
+ { name: "weth_", type: "address" },
1680
+ { name: "universalRouter_", type: "address" },
1681
+ { name: "permit2_", type: "address" }
1682
+ ],
1683
+ stateMutability: "nonpayable"
1684
+ },
1685
+ {
1686
+ type: "function",
1687
+ name: "factory",
1688
+ inputs: [],
1689
+ outputs: [{ name: "", type: "address" }],
1690
+ stateMutability: "view"
1691
+ },
1692
+ {
1693
+ type: "function",
1694
+ name: "weth",
1695
+ inputs: [],
1696
+ outputs: [{ name: "", type: "address" }],
1697
+ stateMutability: "view"
1698
+ },
1699
+ {
1700
+ type: "function",
1701
+ name: "universalRouter",
1702
+ inputs: [],
1703
+ outputs: [{ name: "", type: "address" }],
1704
+ stateMutability: "view"
1705
+ },
1706
+ {
1707
+ type: "function",
1708
+ name: "permit2",
1709
+ inputs: [],
1710
+ outputs: [{ name: "", type: "address" }],
1711
+ stateMutability: "view"
1712
+ },
1713
+ {
1714
+ type: "function",
1715
+ name: "receiveTokens",
1716
+ inputs: [
1717
+ {
1718
+ name: "deploymentConfig",
1719
+ type: "tuple",
1720
+ components: [
1721
+ {
1722
+ name: "tokenConfig",
1723
+ type: "tuple",
1724
+ components: [
1725
+ { name: "tokenAdmin", type: "address" },
1726
+ { name: "name", type: "string" },
1727
+ { name: "symbol", type: "string" },
1728
+ { name: "salt", type: "bytes32" },
1729
+ { name: "image", type: "string" },
1730
+ { name: "metadata", type: "string" },
1731
+ { name: "context", type: "string" },
1732
+ { name: "originatingChainId", type: "uint256" }
1733
+ ]
1734
+ },
1735
+ {
1736
+ name: "poolConfig",
1737
+ type: "tuple",
1738
+ components: [
1739
+ { name: "hook", type: "address" },
1740
+ { name: "pairedToken", type: "address" },
1741
+ { name: "tickIfToken0IsLiquid", type: "int24" },
1742
+ { name: "tickSpacing", type: "int24" },
1743
+ { name: "poolData", type: "bytes" }
1744
+ ]
1745
+ },
1746
+ {
1747
+ name: "lockerConfig",
1748
+ type: "tuple",
1749
+ components: [
1750
+ { name: "locker", type: "address" },
1751
+ { name: "rewardAdmins", type: "address[]" },
1752
+ { name: "rewardRecipients", type: "address[]" },
1753
+ { name: "rewardBps", type: "uint16[]" },
1754
+ { name: "tickLower", type: "int24[]" },
1755
+ { name: "tickUpper", type: "int24[]" },
1756
+ { name: "positionBps", type: "uint16[]" },
1757
+ { name: "lockerData", type: "bytes" }
1758
+ ]
1759
+ },
1760
+ {
1761
+ name: "mevModuleConfig",
1762
+ type: "tuple",
1763
+ components: [
1764
+ { name: "mevModule", type: "address" },
1765
+ { name: "mevModuleData", type: "bytes" }
1766
+ ]
1767
+ },
1768
+ {
1769
+ name: "extensionConfigs",
1770
+ type: "tuple[]",
1771
+ components: [
1772
+ { name: "extension", type: "address" },
1773
+ { name: "msgValue", type: "uint256" },
1774
+ { name: "extensionBps", type: "uint16" },
1775
+ { name: "extensionData", type: "bytes" }
1776
+ ]
1777
+ }
1778
+ ]
1779
+ },
1780
+ {
1781
+ name: "tokenPoolKey",
1782
+ type: "tuple",
1783
+ components: [
1784
+ { name: "currency0", type: "address" },
1785
+ { name: "currency1", type: "address" },
1786
+ { name: "fee", type: "uint24" },
1787
+ { name: "tickSpacing", type: "int24" },
1788
+ { name: "hooks", type: "address" }
1789
+ ]
1790
+ },
1791
+ { name: "token", type: "address" },
1792
+ { name: "extensionSupply", type: "uint256" },
1793
+ { name: "extensionIndex", type: "uint256" }
1794
+ ],
1795
+ outputs: [],
1796
+ stateMutability: "payable"
1797
+ },
1798
+ {
1799
+ type: "function",
1800
+ name: "supportsInterface",
1801
+ inputs: [{ name: "interfaceId", type: "bytes4" }],
1802
+ outputs: [{ name: "", type: "bool" }],
1803
+ stateMutability: "pure"
1804
+ },
1805
+ {
1806
+ type: "event",
1807
+ name: "EthDevBuy",
1808
+ inputs: [
1809
+ { name: "token", type: "address", indexed: true },
1810
+ { name: "user", type: "address", indexed: true },
1811
+ { name: "ethAmount", type: "uint256", indexed: false },
1812
+ { name: "tokenAmount", type: "uint256", indexed: false }
1813
+ ],
1814
+ anonymous: false
1815
+ },
1816
+ { type: "error", name: "InvalidEthDevBuyPercentage", inputs: [] },
1817
+ { type: "error", name: "InvalidMsgValue", inputs: [] },
1818
+ { type: "error", name: "InvalidPairedTokenPoolKey", inputs: [] },
1819
+ { type: "error", name: "ReentrancyGuardReentrantCall", inputs: [] },
1820
+ { type: "error", name: "Unauthorized", inputs: [] }
1821
+ ];
1822
+
1552
1823
  // src/utils/tick-math.ts
1553
1824
  var LOG_BASE = Math.log(1.0001);
1554
1825
  var DEFAULT_TICK_SPACING = 200;
@@ -1676,6 +1947,8 @@ export {
1676
1947
  LiquidSDK,
1677
1948
  LiquidSniperAuctionV2Abi,
1678
1949
  LiquidSniperUtilV2Abi,
1950
+ LiquidTokenAbi,
1951
+ LiquidUniv4EthDevBuyAbi,
1679
1952
  LiquidVaultAbi,
1680
1953
  POOL_POSITIONS,
1681
1954
  TOKEN,