liquid-sdk 1.1.0 → 1.3.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.d.ts CHANGED
@@ -151,6 +151,17 @@ interface TokenCreatedEvent {
151
151
  mevModule: Address;
152
152
  extensionsSupply: bigint;
153
153
  extensions: Address[];
154
+ /** Block number where the token was created (populated by discovery methods) */
155
+ blockNumber?: bigint;
156
+ }
157
+ /** Options for querying deployed tokens. */
158
+ interface GetTokensOptions {
159
+ /** Filter by deployer address (msgSender). If omitted, returns all tokens. */
160
+ deployer?: Address;
161
+ /** Starting block to search from (defaults to factory deployment block) */
162
+ fromBlock?: bigint;
163
+ /** Ending block to search to (defaults to 'latest') */
164
+ toBlock?: bigint | "latest";
154
165
  }
155
166
  interface AirdropInfo {
156
167
  admin: Address;
@@ -243,6 +254,50 @@ declare class LiquidSDK {
243
254
  isExtensionEnabled(extensionAddress: Address): Promise<boolean>;
244
255
  getMevBlockDelay(): Promise<bigint>;
245
256
  getPoolUnlockTime(poolId: Hex): Promise<bigint>;
257
+ /**
258
+ * Update a token's image. Must be called by the token admin.
259
+ */
260
+ updateImage(tokenAddress: Address, newImage: string): Promise<Hash>;
261
+ /**
262
+ * Update a token's metadata. Must be called by the token admin.
263
+ */
264
+ updateMetadata(tokenAddress: Address, newMetadata: string): Promise<Hash>;
265
+ /**
266
+ * Get all tokens deployed by a specific address by querying TokenCreated events.
267
+ * @param deployer - The address that deployed the tokens (msgSender)
268
+ * @param fromBlock - Starting block to search from (defaults to 0n)
269
+ * @param toBlock - Ending block to search to (defaults to 'latest')
270
+ */
271
+ getDeployedTokens(deployer: Address, fromBlock?: bigint, toBlock?: bigint | "latest"): Promise<TokenCreatedEvent[]>;
272
+ /**
273
+ * Query TokenCreated events with optional filtering.
274
+ *
275
+ * Use this for token discovery, indexing, or building token lists.
276
+ * Returns events in chronological order with block numbers for pagination.
277
+ *
278
+ * @example
279
+ * // Get all tokens
280
+ * const allTokens = await sdk.getTokens();
281
+ *
282
+ * // Get tokens by deployer
283
+ * const myTokens = await sdk.getTokens({ deployer: myAddress });
284
+ *
285
+ * // Paginate with block ranges
286
+ * const page1 = await sdk.getTokens({ fromBlock: 20000000n, toBlock: 20100000n });
287
+ * const page2 = await sdk.getTokens({ fromBlock: 20100001n, toBlock: 20200000n });
288
+ */
289
+ getTokens(options?: GetTokensOptions): Promise<TokenCreatedEvent[]>;
290
+ /**
291
+ * Look up a single token's on-chain event data by contract address.
292
+ *
293
+ * Returns the full TokenCreated event including metadata, context, poolId,
294
+ * hook, locker, extensions — everything a wallet or aggregator needs to
295
+ * display the token. Returns `null` if not found.
296
+ *
297
+ * This is indexed on-chain (tokenAddress is indexed in the event), so it's
298
+ * a single RPC call regardless of how many tokens exist.
299
+ */
300
+ getTokenEvent(tokenAddress: Address): Promise<TokenCreatedEvent | null>;
246
301
  }
247
302
 
248
303
  declare const ADDRESSES: {
@@ -320,6 +375,8 @@ declare const POOL_POSITIONS: {
320
375
  */
321
376
  declare const DEFAULTS: {
322
377
  readonly HOOK: `0x${string}`;
378
+ /** LP Locker with fee conversion (converts fees to ETH before distributing) */
379
+ readonly LOCKER: `0x${string}`;
323
380
  readonly TICK_SPACING: 200;
324
381
  readonly TICK_IF_TOKEN0_IS_LIQUID: -230400;
325
382
  /** Static fee on buys (ETH → token): 1% (100 bps). Fees collected in ETH. */
@@ -1592,6 +1649,312 @@ declare const LiquidLpLockerAbi: readonly [{
1592
1649
  readonly stateMutability: "view";
1593
1650
  }];
1594
1651
 
1652
+ declare const LiquidTokenAbi: readonly [{
1653
+ readonly type: "function";
1654
+ readonly name: "updateImage";
1655
+ readonly inputs: readonly [{
1656
+ readonly name: "image_";
1657
+ readonly type: "string";
1658
+ }];
1659
+ readonly outputs: readonly [];
1660
+ readonly stateMutability: "nonpayable";
1661
+ }, {
1662
+ readonly type: "function";
1663
+ readonly name: "updateMetadata";
1664
+ readonly inputs: readonly [{
1665
+ readonly name: "metadata_";
1666
+ readonly type: "string";
1667
+ }];
1668
+ readonly outputs: readonly [];
1669
+ readonly stateMutability: "nonpayable";
1670
+ }, {
1671
+ readonly type: "function";
1672
+ readonly name: "updateAdmin";
1673
+ readonly inputs: readonly [{
1674
+ readonly name: "admin_";
1675
+ readonly type: "address";
1676
+ }];
1677
+ readonly outputs: readonly [];
1678
+ readonly stateMutability: "nonpayable";
1679
+ }, {
1680
+ readonly type: "event";
1681
+ readonly name: "UpdateImage";
1682
+ readonly inputs: readonly [{
1683
+ readonly name: "image";
1684
+ readonly type: "string";
1685
+ readonly indexed: false;
1686
+ }];
1687
+ readonly anonymous: false;
1688
+ }, {
1689
+ readonly type: "event";
1690
+ readonly name: "UpdateMetadata";
1691
+ readonly inputs: readonly [{
1692
+ readonly name: "metadata";
1693
+ readonly type: "string";
1694
+ readonly indexed: false;
1695
+ }];
1696
+ readonly anonymous: false;
1697
+ }, {
1698
+ readonly type: "event";
1699
+ readonly name: "UpdateAdmin";
1700
+ readonly inputs: readonly [{
1701
+ readonly name: "oldAdmin";
1702
+ readonly type: "address";
1703
+ readonly indexed: false;
1704
+ }, {
1705
+ readonly name: "newAdmin";
1706
+ readonly type: "address";
1707
+ readonly indexed: false;
1708
+ }];
1709
+ readonly anonymous: false;
1710
+ }];
1711
+
1712
+ declare const LiquidUniv4EthDevBuyAbi: readonly [{
1713
+ readonly type: "constructor";
1714
+ readonly inputs: readonly [{
1715
+ readonly name: "factory_";
1716
+ readonly type: "address";
1717
+ }, {
1718
+ readonly name: "weth_";
1719
+ readonly type: "address";
1720
+ }, {
1721
+ readonly name: "universalRouter_";
1722
+ readonly type: "address";
1723
+ }, {
1724
+ readonly name: "permit2_";
1725
+ readonly type: "address";
1726
+ }];
1727
+ readonly stateMutability: "nonpayable";
1728
+ }, {
1729
+ readonly type: "function";
1730
+ readonly name: "factory";
1731
+ readonly inputs: readonly [];
1732
+ readonly outputs: readonly [{
1733
+ readonly name: "";
1734
+ readonly type: "address";
1735
+ }];
1736
+ readonly stateMutability: "view";
1737
+ }, {
1738
+ readonly type: "function";
1739
+ readonly name: "weth";
1740
+ readonly inputs: readonly [];
1741
+ readonly outputs: readonly [{
1742
+ readonly name: "";
1743
+ readonly type: "address";
1744
+ }];
1745
+ readonly stateMutability: "view";
1746
+ }, {
1747
+ readonly type: "function";
1748
+ readonly name: "universalRouter";
1749
+ readonly inputs: readonly [];
1750
+ readonly outputs: readonly [{
1751
+ readonly name: "";
1752
+ readonly type: "address";
1753
+ }];
1754
+ readonly stateMutability: "view";
1755
+ }, {
1756
+ readonly type: "function";
1757
+ readonly name: "permit2";
1758
+ readonly inputs: readonly [];
1759
+ readonly outputs: readonly [{
1760
+ readonly name: "";
1761
+ readonly type: "address";
1762
+ }];
1763
+ readonly stateMutability: "view";
1764
+ }, {
1765
+ readonly type: "function";
1766
+ readonly name: "receiveTokens";
1767
+ readonly inputs: readonly [{
1768
+ readonly name: "deploymentConfig";
1769
+ readonly type: "tuple";
1770
+ readonly components: readonly [{
1771
+ readonly name: "tokenConfig";
1772
+ readonly type: "tuple";
1773
+ readonly components: readonly [{
1774
+ readonly name: "tokenAdmin";
1775
+ readonly type: "address";
1776
+ }, {
1777
+ readonly name: "name";
1778
+ readonly type: "string";
1779
+ }, {
1780
+ readonly name: "symbol";
1781
+ readonly type: "string";
1782
+ }, {
1783
+ readonly name: "salt";
1784
+ readonly type: "bytes32";
1785
+ }, {
1786
+ readonly name: "image";
1787
+ readonly type: "string";
1788
+ }, {
1789
+ readonly name: "metadata";
1790
+ readonly type: "string";
1791
+ }, {
1792
+ readonly name: "context";
1793
+ readonly type: "string";
1794
+ }, {
1795
+ readonly name: "originatingChainId";
1796
+ readonly type: "uint256";
1797
+ }];
1798
+ }, {
1799
+ readonly name: "poolConfig";
1800
+ readonly type: "tuple";
1801
+ readonly components: readonly [{
1802
+ readonly name: "hook";
1803
+ readonly type: "address";
1804
+ }, {
1805
+ readonly name: "pairedToken";
1806
+ readonly type: "address";
1807
+ }, {
1808
+ readonly name: "tickIfToken0IsLiquid";
1809
+ readonly type: "int24";
1810
+ }, {
1811
+ readonly name: "tickSpacing";
1812
+ readonly type: "int24";
1813
+ }, {
1814
+ readonly name: "poolData";
1815
+ readonly type: "bytes";
1816
+ }];
1817
+ }, {
1818
+ readonly name: "lockerConfig";
1819
+ readonly type: "tuple";
1820
+ readonly components: readonly [{
1821
+ readonly name: "locker";
1822
+ readonly type: "address";
1823
+ }, {
1824
+ readonly name: "rewardAdmins";
1825
+ readonly type: "address[]";
1826
+ }, {
1827
+ readonly name: "rewardRecipients";
1828
+ readonly type: "address[]";
1829
+ }, {
1830
+ readonly name: "rewardBps";
1831
+ readonly type: "uint16[]";
1832
+ }, {
1833
+ readonly name: "tickLower";
1834
+ readonly type: "int24[]";
1835
+ }, {
1836
+ readonly name: "tickUpper";
1837
+ readonly type: "int24[]";
1838
+ }, {
1839
+ readonly name: "positionBps";
1840
+ readonly type: "uint16[]";
1841
+ }, {
1842
+ readonly name: "lockerData";
1843
+ readonly type: "bytes";
1844
+ }];
1845
+ }, {
1846
+ readonly name: "mevModuleConfig";
1847
+ readonly type: "tuple";
1848
+ readonly components: readonly [{
1849
+ readonly name: "mevModule";
1850
+ readonly type: "address";
1851
+ }, {
1852
+ readonly name: "mevModuleData";
1853
+ readonly type: "bytes";
1854
+ }];
1855
+ }, {
1856
+ readonly name: "extensionConfigs";
1857
+ readonly type: "tuple[]";
1858
+ readonly components: readonly [{
1859
+ readonly name: "extension";
1860
+ readonly type: "address";
1861
+ }, {
1862
+ readonly name: "msgValue";
1863
+ readonly type: "uint256";
1864
+ }, {
1865
+ readonly name: "extensionBps";
1866
+ readonly type: "uint16";
1867
+ }, {
1868
+ readonly name: "extensionData";
1869
+ readonly type: "bytes";
1870
+ }];
1871
+ }];
1872
+ }, {
1873
+ readonly name: "tokenPoolKey";
1874
+ readonly type: "tuple";
1875
+ readonly components: readonly [{
1876
+ readonly name: "currency0";
1877
+ readonly type: "address";
1878
+ }, {
1879
+ readonly name: "currency1";
1880
+ readonly type: "address";
1881
+ }, {
1882
+ readonly name: "fee";
1883
+ readonly type: "uint24";
1884
+ }, {
1885
+ readonly name: "tickSpacing";
1886
+ readonly type: "int24";
1887
+ }, {
1888
+ readonly name: "hooks";
1889
+ readonly type: "address";
1890
+ }];
1891
+ }, {
1892
+ readonly name: "token";
1893
+ readonly type: "address";
1894
+ }, {
1895
+ readonly name: "extensionSupply";
1896
+ readonly type: "uint256";
1897
+ }, {
1898
+ readonly name: "extensionIndex";
1899
+ readonly type: "uint256";
1900
+ }];
1901
+ readonly outputs: readonly [];
1902
+ readonly stateMutability: "payable";
1903
+ }, {
1904
+ readonly type: "function";
1905
+ readonly name: "supportsInterface";
1906
+ readonly inputs: readonly [{
1907
+ readonly name: "interfaceId";
1908
+ readonly type: "bytes4";
1909
+ }];
1910
+ readonly outputs: readonly [{
1911
+ readonly name: "";
1912
+ readonly type: "bool";
1913
+ }];
1914
+ readonly stateMutability: "pure";
1915
+ }, {
1916
+ readonly type: "event";
1917
+ readonly name: "EthDevBuy";
1918
+ readonly inputs: readonly [{
1919
+ readonly name: "token";
1920
+ readonly type: "address";
1921
+ readonly indexed: true;
1922
+ }, {
1923
+ readonly name: "user";
1924
+ readonly type: "address";
1925
+ readonly indexed: true;
1926
+ }, {
1927
+ readonly name: "ethAmount";
1928
+ readonly type: "uint256";
1929
+ readonly indexed: false;
1930
+ }, {
1931
+ readonly name: "tokenAmount";
1932
+ readonly type: "uint256";
1933
+ readonly indexed: false;
1934
+ }];
1935
+ readonly anonymous: false;
1936
+ }, {
1937
+ readonly type: "error";
1938
+ readonly name: "InvalidEthDevBuyPercentage";
1939
+ readonly inputs: readonly [];
1940
+ }, {
1941
+ readonly type: "error";
1942
+ readonly name: "InvalidMsgValue";
1943
+ readonly inputs: readonly [];
1944
+ }, {
1945
+ readonly type: "error";
1946
+ readonly name: "InvalidPairedTokenPoolKey";
1947
+ readonly inputs: readonly [];
1948
+ }, {
1949
+ readonly type: "error";
1950
+ readonly name: "ReentrancyGuardReentrantCall";
1951
+ readonly inputs: readonly [];
1952
+ }, {
1953
+ readonly type: "error";
1954
+ readonly name: "Unauthorized";
1955
+ readonly inputs: readonly [];
1956
+ }];
1957
+
1595
1958
  declare const ERC20Abi: readonly [{
1596
1959
  readonly type: "function";
1597
1960
  readonly name: "name";
@@ -1949,4 +2312,56 @@ interface SniperAuctionConfig {
1949
2312
  */
1950
2313
  declare function encodeSniperAuctionData(config: SniperAuctionConfig): Hex;
1951
2314
 
1952
- export { ADDRESSES, type AirdropInfo, DEFAULTS, DEFAULT_CHAIN, DEFAULT_CHAIN_ID, DEFAULT_RPC_URL, DEFAULT_TRANCHES_USD, type DeployTokenParams, type DeployTokenResult, type DeploymentConfig, type DeploymentInfo, type DevBuyParams, type DynamicFeeConfig, ERC20Abi, EXTERNAL, type ExtensionConfig, FEE, LiquidAirdropV2Abi, LiquidFactoryAbi, LiquidFeeLockerAbi, LiquidHookDynamicFeeV2Abi, LiquidLpLockerAbi, LiquidMevBlockDelayAbi, LiquidPoolExtensionAllowlistAbi, LiquidSDK, type LiquidSDKConfig, LiquidSniperAuctionV2Abi, LiquidSniperUtilV2Abi, LiquidVaultAbi, type LockerConfig, type MarketCapTranche, type MarketCapTrancheUSD, type MevModuleConfig, POOL_POSITIONS, type PoolConfig, type PoolDynamicConfigVars, type PoolDynamicFeeVars, type PoolKey, type PoolPosition, type PositionArrays, type PositionConfig, type SniperAuctionConfig, type SniperAuctionFeeConfig, type SniperAuctionState, TOKEN, type TokenConfig, type TokenCreatedEvent, type TokenRewardInfo, type VaultAllocation, createDefaultPositions, createPositions, createPositionsUSD, describePositions, encodeDynamicFeePoolData, encodeSniperAuctionData, encodeStaticFeePoolData, getTickFromMarketCapETH, getTickFromMarketCapStable, getTickFromMarketCapUSD, marketCapFromTickETH, marketCapFromTickUSD };
2315
+ /** Provenance who launched the token and from where. */
2316
+ interface LiquidContext {
2317
+ /** System that deployed the token (e.g. "SDK", "Rainbow Wallet", "Liquid CLI") */
2318
+ interface: string;
2319
+ /** Social platform origin (e.g. "Farcaster", "Twitter") */
2320
+ platform?: string;
2321
+ /** Social post/message ID that triggered the deploy */
2322
+ messageId?: string;
2323
+ /** User ID on the originating platform */
2324
+ id?: string;
2325
+ }
2326
+ /** Social media link for token metadata. */
2327
+ interface SocialMediaUrl {
2328
+ platform: string;
2329
+ url: string;
2330
+ }
2331
+ /** Token info for aggregators and explorers. */
2332
+ interface LiquidMetadata {
2333
+ /** Token/project description */
2334
+ description?: string;
2335
+ /** Social media links */
2336
+ socialMediaUrls?: SocialMediaUrl[];
2337
+ /** Audit report URLs */
2338
+ auditUrls?: string[];
2339
+ }
2340
+ /**
2341
+ * Build a JSON string for the on-chain `context` field.
2342
+ *
2343
+ * @example
2344
+ * buildContext({ interface: "My App", platform: "Farcaster" })
2345
+ * // '{"interface":"My App","platform":"Farcaster"}'
2346
+ */
2347
+ declare function buildContext(input?: Partial<LiquidContext>): string;
2348
+ /**
2349
+ * Build a JSON string for the on-chain `metadata` field.
2350
+ *
2351
+ * @example
2352
+ * buildMetadata({ description: "A cool token" })
2353
+ * // '{"description":"A cool token"}'
2354
+ */
2355
+ declare function buildMetadata(input?: Partial<LiquidMetadata>): string;
2356
+ /**
2357
+ * Parse a context JSON string back into a typed object.
2358
+ * Returns `null` if the string is empty or not valid JSON.
2359
+ */
2360
+ declare function parseContext(contextString: string): LiquidContext | null;
2361
+ /**
2362
+ * Parse a metadata JSON string back into a typed object.
2363
+ * Returns `null` if the string is empty or not valid JSON.
2364
+ */
2365
+ declare function parseMetadata(metadataString: string): LiquidMetadata | null;
2366
+
2367
+ export { ADDRESSES, type AirdropInfo, DEFAULTS, DEFAULT_CHAIN, DEFAULT_CHAIN_ID, DEFAULT_RPC_URL, DEFAULT_TRANCHES_USD, type DeployTokenParams, type DeployTokenResult, type DeploymentConfig, type DeploymentInfo, type DevBuyParams, type DynamicFeeConfig, ERC20Abi, EXTERNAL, type ExtensionConfig, FEE, type GetTokensOptions, LiquidAirdropV2Abi, type LiquidContext, LiquidFactoryAbi, LiquidFeeLockerAbi, LiquidHookDynamicFeeV2Abi, LiquidLpLockerAbi, type LiquidMetadata, LiquidMevBlockDelayAbi, LiquidPoolExtensionAllowlistAbi, LiquidSDK, type LiquidSDKConfig, LiquidSniperAuctionV2Abi, LiquidSniperUtilV2Abi, LiquidTokenAbi, LiquidUniv4EthDevBuyAbi, LiquidVaultAbi, type LockerConfig, type MarketCapTranche, type MarketCapTrancheUSD, type MevModuleConfig, POOL_POSITIONS, type PoolConfig, type PoolDynamicConfigVars, type PoolDynamicFeeVars, type PoolKey, type PoolPosition, type PositionArrays, type PositionConfig, type SniperAuctionConfig, type SniperAuctionFeeConfig, type SniperAuctionState, type SocialMediaUrl, TOKEN, type TokenConfig, type TokenCreatedEvent, type TokenRewardInfo, type VaultAllocation, buildContext, buildMetadata, createDefaultPositions, createPositions, createPositionsUSD, describePositions, encodeDynamicFeePoolData, encodeSniperAuctionData, encodeStaticFeePoolData, getTickFromMarketCapETH, getTickFromMarketCapStable, getTickFromMarketCapUSD, marketCapFromTickETH, marketCapFromTickUSD, parseContext, parseMetadata };