@zoralabs/coins-sdk 0.2.0 → 0.2.1

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.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/actions/createCoin.ts","../src/constants.ts","../src/utils/validateClientNetwork.ts","../src/metadata/cleanAndValidateMetadataURI.ts","../src/metadata/validateMetadataJSON.ts","../src/metadata/validateMetadataURIContent.ts","../src/utils/attribution.ts","../src/utils/poolConfigUtils.ts","../src/actions/tradeCoin.ts","../src/actions/getOnchainCoinDetails.ts","../src/actions/updateCoinURI.ts","../src/actions/updatePayoutRecipient.ts","../src/client/client.gen.ts","../src/client/sdk.gen.ts","../src/api/api-key.ts","../src/api/queries.ts","../src/api/explore.ts"],"sourcesContent":["import { coinFactoryABI as zoraFactoryImplABI } from \"@zoralabs/protocol-deployments\";\nimport {\n Address,\n TransactionReceipt,\n WalletClient,\n SimulateContractParameters,\n ContractEventArgsFromTopics,\n parseEventLogs,\n zeroAddress,\n keccak256,\n toBytes,\n Hex,\n Account,\n} from \"viem\";\nimport { COIN_FACTORY_ADDRESS } from \"../constants\";\nimport { validateClientNetwork } from \"../utils/validateClientNetwork\";\nimport { GenericPublicClient } from \"src/utils/genericPublicClient\";\nimport { validateMetadataURIContent, ValidMetadataURI } from \"src/metadata\";\nimport { getAttribution } from \"../utils/attribution\";\nimport { base, baseSepolia } from \"viem/chains\";\nimport {\n COIN_ETH_PAIR_POOL_CONFIG,\n COIN_ZORA_PAIR_POOL_CONFIG,\n} from \"src/utils/poolConfigUtils\";\n\nexport type CoinDeploymentLogArgs = ContractEventArgsFromTopics<\n typeof zoraFactoryImplABI,\n \"CoinCreatedV4\"\n>;\n\nexport enum DeployCurrency {\n ZORA = 1,\n ETH = 2,\n}\n\nexport type CreateCoinArgs = {\n name: string;\n symbol: string;\n uri: ValidMetadataURI;\n chainId: number;\n owners?: Address[];\n payoutRecipient: Address;\n platformReferrer?: Address;\n currency?: DeployCurrency;\n};\n\nfunction getPoolConfig(currency: DeployCurrency, chainId: number) {\n if (currency === DeployCurrency.ZORA && chainId == baseSepolia.id) {\n throw new Error(\"ZORA is not supported on Base Sepolia\");\n }\n\n switch (currency) {\n case DeployCurrency.ZORA:\n return COIN_ZORA_PAIR_POOL_CONFIG[\n chainId as keyof typeof COIN_ZORA_PAIR_POOL_CONFIG\n ];\n case DeployCurrency.ETH:\n return COIN_ETH_PAIR_POOL_CONFIG[\n chainId as keyof typeof COIN_ETH_PAIR_POOL_CONFIG\n ];\n default:\n throw new Error(\"Invalid currency\");\n }\n}\n\nexport async function createCoinCall({\n name,\n symbol,\n uri,\n owners,\n payoutRecipient,\n currency,\n chainId = base.id,\n platformReferrer = \"0x0000000000000000000000000000000000000000\",\n}: CreateCoinArgs): Promise<\n SimulateContractParameters<typeof zoraFactoryImplABI, \"deploy\">\n> {\n if (!owners) {\n owners = [payoutRecipient];\n }\n\n if (!currency) {\n currency = chainId !== base.id ? DeployCurrency.ETH : DeployCurrency.ZORA;\n }\n\n const poolConfig = getPoolConfig(currency, chainId);\n\n // This will throw an error if the metadata is not valid\n await validateMetadataURIContent(uri);\n\n return {\n abi: zoraFactoryImplABI,\n functionName: \"deploy\",\n address: COIN_FACTORY_ADDRESS,\n args: [\n payoutRecipient,\n owners,\n uri,\n name,\n symbol,\n poolConfig,\n platformReferrer,\n zeroAddress, // hookAddress\n \"0x\" as Hex, // hookData\n keccak256(toBytes(Math.random().toString())), // coinSalt\n ],\n dataSuffix: getAttribution(),\n } as const;\n}\n\n/**\n * Gets the deployed coin address from transaction receipt logs\n * @param receipt Transaction receipt containing the CoinCreated event\n * @returns The deployment information if found\n */\nexport function getCoinCreateFromLogs(\n receipt: TransactionReceipt,\n): CoinDeploymentLogArgs | undefined {\n const eventLogs = parseEventLogs({\n abi: zoraFactoryImplABI,\n logs: receipt.logs,\n });\n\n return eventLogs.find((log) => log.eventName === \"CoinCreatedV4\")?.args;\n}\n\n// Update createCoin to return both receipt and coin address\nexport async function createCoin(\n call: CreateCoinArgs,\n walletClient: WalletClient,\n publicClient: GenericPublicClient,\n options?: {\n gasMultiplier?: number;\n account?: Account | Address;\n },\n) {\n validateClientNetwork(publicClient);\n\n const createCoinRequest = await createCoinCall(call);\n const { request } = await publicClient.simulateContract({\n ...createCoinRequest,\n account: options?.account ?? walletClient.account,\n });\n\n // Add a 2/5th buffer on gas.\n if (request.gas) {\n // Gas limit multiplier is a percentage argument.\n request.gas = (request.gas * BigInt(options?.gasMultiplier ?? 100)) / 100n;\n }\n const hash = await walletClient.writeContract(request);\n const receipt = await publicClient.waitForTransactionReceipt({ hash });\n const deployment = getCoinCreateFromLogs(receipt);\n\n return {\n hash,\n receipt,\n address: deployment?.coin,\n deployment,\n };\n}\n","import { coinFactoryAddress as zoraFactoryImplAddress } from \"@zoralabs/protocol-deployments\";\nimport { Address } from \"viem\";\nimport { base } from \"viem/chains\";\n\n// this is the same across all chains due to deterministic deploys.\nexport const COIN_FACTORY_ADDRESS = zoraFactoryImplAddress[\"8453\"] as Address;\n\nexport const SUPERCHAIN_WETH_ADDRESS =\n \"0x4200000000000000000000000000000000000006\";\n\nexport const USDC_WETH_POOLS_BY_CHAIN: Record<number, Address> = {\n [base.id]: \"0xd0b53D9277642d899DF5C87A3966A349A798F224\",\n};\n","import { PublicClient } from \"viem\";\nimport { base, baseSepolia } from \"viem/chains\";\n\nexport const validateClientNetwork = (\n publicClient: PublicClient<any, any, any, any>,\n) => {\n const clientChainId = publicClient?.chain?.id;\n if (clientChainId === base.id) {\n return;\n }\n if (clientChainId === baseSepolia.id) {\n return;\n }\n\n throw new Error(\n \"Client network needs to be base or baseSepolia for current coin deployments.\",\n );\n};\n","export type ValidMetadataURI =\n | `ipfs://${string}`\n | `ar://${string}`\n | `data:${string}`\n | `https://${string}`;\n\n/**\n * Clean the metadata URI to HTTPS format\n * @param metadataURI - The metadata URI to clean from IPFS or Arweave\n * @returns The cleaned metadata URI\n * @throws If the metadata URI is a data URI\n */\nexport function cleanAndValidateMetadataURI(uri: ValidMetadataURI) {\n if (uri.startsWith(\"ipfs://\")) {\n return uri.replace(\n \"ipfs://\",\n \"https://magic.decentralized-content.com/ipfs/\",\n );\n }\n if (uri.startsWith(\"ar://\")) {\n return uri.replace(\"ar://\", \"http://arweave.net/\");\n }\n if (uri.startsWith(\"data:\")) {\n return uri;\n // throw new Error(\"Data URIs are not supported\");\n }\n if (uri.startsWith(\"http://\") || uri.startsWith(\"https://\")) {\n return uri;\n }\n\n throw new Error(\"Invalid metadata URI\");\n}\n","export type ValidMetadataJSON = {\n name: string;\n description: string;\n image: string;\n animation_url?: string;\n content?: { uri: string; mime?: string };\n};\n\nfunction validateURIString(uri: unknown) {\n if (typeof uri !== \"string\") {\n throw new Error(\"URI must be a string\");\n }\n if (uri.startsWith(\"ipfs://\")) {\n return true;\n }\n if (uri.startsWith(\"ar://\")) {\n return true;\n }\n if (uri.startsWith(\"https://\")) {\n return true;\n }\n if (uri.startsWith(\"data:\")) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Validate the metadata JSON object\n * @param metadata - The metadata object to validate\n */\nexport function validateMetadataJSON(metadata: ValidMetadataJSON | unknown) {\n if (typeof metadata !== \"object\" || !metadata) {\n throw new Error(\"Metadata must be an object and exist\");\n }\n if (typeof (metadata as { name: unknown }).name !== \"string\") {\n throw new Error(\"Metadata name is required and must be a string\");\n }\n if (typeof (metadata as { description: unknown }).description !== \"string\") {\n throw new Error(\"Metadata description is required and must be a string\");\n }\n if (typeof (metadata as { image: unknown }).image === \"string\") {\n if (!validateURIString((metadata as { image: string }).image)) {\n throw new Error(\"Metadata image is not a valid URI\");\n }\n } else {\n throw new Error(\"Metadata image is required and must be a string\");\n }\n if (\"animation_url\" in metadata) {\n if (\n typeof (metadata as { animation_url?: unknown }).animation_url !==\n \"string\"\n ) {\n throw new Error(\"Metadata animation_url, if provided, must be a string\");\n }\n if (!validateURIString(metadata.animation_url)) {\n throw new Error(\"Metadata animation_url is not a valid URI\");\n }\n }\n const content =\n \"content\" in metadata && (metadata as { content?: unknown }).content;\n if (content) {\n if (typeof (content as { uri?: unknown }).uri !== \"string\") {\n throw new Error(\"If provided, content.uri must be a string\");\n }\n if (!validateURIString((content as { uri: string }).uri)) {\n throw new Error(\"If provided, content.uri must be a valid URI string\");\n }\n if (typeof (content as { mime?: unknown }).mime !== \"string\") {\n throw new Error(\"If provided, content.mime must be a string\");\n }\n }\n\n return true;\n}\n","import {\n cleanAndValidateMetadataURI,\n ValidMetadataURI,\n} from \"./cleanAndValidateMetadataURI\";\nimport { validateMetadataJSON } from \"./validateMetadataJSON\";\n\n/**\n * Validate the metadata URI Content\n * @param metadataURI - The metadata URI to validate\n * @returns true if the metadata is valid, throws an error otherwise\n */\nexport async function validateMetadataURIContent(\n metadataURI: ValidMetadataURI,\n) {\n const cleanedURI = cleanAndValidateMetadataURI(metadataURI);\n const response = await fetch(cleanedURI);\n if (!response.ok) {\n throw new Error(\"Metadata fetch failed\");\n }\n if (\n ![\"application/json\", \"text/plain\"].includes(\n response.headers.get(\"content-type\") ?? \"\",\n )\n ) {\n throw new Error(\"Metadata is not a valid JSON or plain text response type\");\n }\n const metadataJson = await response.json();\n return validateMetadataJSON(metadataJson);\n}\n","import { Hex, keccak256, slice, toHex } from \"viem\";\n\nexport function getAttribution(): Hex {\n const hash = keccak256(toHex(\"api-sdk.zora.engineering\"));\n return slice(hash, 0, 4) as Hex;\n}\n","import { encodeMultiCurvePoolConfig } from \"@zoralabs/protocol-deployments\";\nimport { parseUnits, zeroAddress } from \"viem\";\nimport { base, baseSepolia } from \"viem/chains\";\n\nconst ZORA_DECIMALS = 18;\n\n/**\n * =========================\n * COIN_ETH_PAIR_POOL_CONFIG\n * =========================\n */\n\nexport const ZORA_ADDRESS = \"0x1111111111166b7fe7bd91427724b487980afc69\";\n\nconst COIN_ETH_PAIR_LOWER_TICK = -250000;\nconst COIN_ETH_PAIR_UPPER_TICK = -195_000;\nconst COIN_ETH_PAIR_NUM_DISCOVERY_POSITIONS = 11;\nconst COIN_ETH_PAIR_MAX_DISCOVERY_SUPPLY_SHARE = parseUnits(\"0.05\", 18);\n\nexport const COIN_ETH_PAIR_POOL_CONFIG = {\n [base.id]: encodeMultiCurvePoolConfig({\n currency: zeroAddress,\n tickLower: [COIN_ETH_PAIR_LOWER_TICK],\n tickUpper: [COIN_ETH_PAIR_UPPER_TICK],\n numDiscoveryPositions: [COIN_ETH_PAIR_NUM_DISCOVERY_POSITIONS],\n maxDiscoverySupplyShare: [COIN_ETH_PAIR_MAX_DISCOVERY_SUPPLY_SHARE],\n }),\n [baseSepolia.id]: encodeMultiCurvePoolConfig({\n currency: zeroAddress,\n tickLower: [COIN_ETH_PAIR_LOWER_TICK],\n tickUpper: [COIN_ETH_PAIR_UPPER_TICK],\n numDiscoveryPositions: [COIN_ETH_PAIR_NUM_DISCOVERY_POSITIONS],\n maxDiscoverySupplyShare: [COIN_ETH_PAIR_MAX_DISCOVERY_SUPPLY_SHARE],\n }),\n};\n\nconst COIN_ZORA_PAIR_LOWER_TICK = -138_000; // ( -250000 in ETH land ~= $23 = -138_000 in Zora token land at .022)\nconst COIN_ZORA_PAIR_UPPER_TICK = -81_000; // (-195_000 ~= 5782 = -81_000 in Zora token land at .022)\nconst COIN_ZORA_PAIR_NUM_DISCOVERY_POSITIONS = 11;\nconst COIN_ZORA_PAIR_MAX_DISCOVERY_SUPPLY_SHARE = parseUnits(\n \"0.05\",\n ZORA_DECIMALS,\n);\n\nexport const COIN_ZORA_PAIR_POOL_CONFIG = {\n [base.id]: encodeMultiCurvePoolConfig({\n currency: ZORA_ADDRESS,\n tickLower: [COIN_ZORA_PAIR_LOWER_TICK],\n tickUpper: [COIN_ZORA_PAIR_UPPER_TICK],\n numDiscoveryPositions: [COIN_ZORA_PAIR_NUM_DISCOVERY_POSITIONS],\n maxDiscoverySupplyShare: [COIN_ZORA_PAIR_MAX_DISCOVERY_SUPPLY_SHARE],\n }),\n};\n","import { coinABI } from \"@zoralabs/protocol-deployments\";\nimport { validateClientNetwork } from \"../utils/validateClientNetwork\";\nimport {\n Address,\n TransactionReceipt,\n WalletClient,\n SimulateContractParameters,\n parseEther,\n zeroAddress,\n ContractEventArgsFromTopics,\n parseEventLogs,\n} from \"viem\";\nimport { baseSepolia } from \"viem/chains\";\nimport { GenericPublicClient } from \"src/utils/genericPublicClient\";\nimport { getAttribution } from \"../utils/attribution\";\n// Define trade event args type\n\nexport type SellEventArgs = ContractEventArgsFromTopics<\n typeof coinABI,\n \"CoinSell\"\n>;\nexport type BuyEventArgs = ContractEventArgsFromTopics<\n typeof coinABI,\n \"CoinBuy\"\n>;\n\nexport type TradeEventArgs = SellEventArgs | BuyEventArgs;\n\n// We'll use this address to ensure it will have funds to simulate an eth trade.\n// @dev: This only works on OP chains and is a fix for a bug. Another approach should be taken long term.\nconst OP_BRIDGE_ADDRESS =\n \"0x4200000000000000000000000000000000000016\" as Address;\n\n/**\n * Simulates a buy order to get the expected output amount\n * @param {Object} params - The simulation parameters\n * @param {Address} params.target - The target coin contract address\n * @param {bigint} params.requestedOrderSize - The desired input amount for the buy\n * @param {PublicClient} params.publicClient - The viem public client instance\n * @returns {Promise<{orderSize: bigint, amountOut: bigint}>} The simulated order size and output amount\n */\nexport async function simulateBuy({\n target,\n requestedOrderSize,\n publicClient,\n}: {\n target: Address;\n requestedOrderSize: bigint;\n publicClient: GenericPublicClient;\n}): Promise<{ orderSize: bigint; amountOut: bigint }> {\n const numberResult = await publicClient.simulateContract({\n address: target,\n abi: coinABI,\n functionName: \"buy\",\n dataSuffix: getAttribution(),\n args: [\n OP_BRIDGE_ADDRESS,\n requestedOrderSize,\n 0n, // minAmountOut\n 0n, // sqrtPriceLimitX96\n zeroAddress, // tradeReferrer\n ],\n // We want to ensure that the multicall3 contract has enough ETH to buy in the simulation\n stateOverride: [\n {\n address: baseSepolia.contracts.multicall3.address,\n balance: parseEther(\"10000000\"),\n },\n ],\n });\n const orderSize = numberResult.result[0];\n const amountOut = numberResult.result[1];\n return { orderSize, amountOut };\n}\n\n/**\n * Parameters for creating a trade call\n * @typedef {Object} TradeParams\n * @property {'sell' | 'buy'} direction - The trade direction\n * @property {Address} target - The target coin contract address\n * @property {Object} args - The trade arguments\n * @property {Address} args.recipient - The recipient of the trade output\n * @property {bigint} args.orderSize - The size of the order\n * @property {bigint} [args.minAmountOut] - The minimum amount to receive\n * @property {bigint} [args.sqrtPriceLimitX96] - The price limit for the trade\n * @property {Address} [args.tradeReferrer] - The referrer address for the trade\n */\nexport type TradeParams = {\n direction: \"sell\" | \"buy\";\n target: Address;\n args: {\n recipient: Address;\n orderSize: bigint;\n minAmountOut?: bigint;\n sqrtPriceLimitX96?: bigint;\n tradeReferrer?: Address;\n };\n};\n\n/**\n * Creates a trade call parameters object for buy or sell\n * @param {TradeParams} params - The trade parameters\n * @returns {SimulateContractParameters} The contract call parameters\n */\nexport function tradeCoinCall({\n target,\n direction,\n args: {\n recipient,\n orderSize,\n minAmountOut = 0n,\n sqrtPriceLimitX96 = 0n,\n tradeReferrer = zeroAddress,\n },\n}: TradeParams): SimulateContractParameters {\n return {\n abi: coinABI,\n functionName: direction,\n address: target,\n args: [\n recipient,\n orderSize,\n minAmountOut,\n sqrtPriceLimitX96,\n tradeReferrer,\n ],\n value: direction === \"buy\" ? orderSize : 0n,\n } as const;\n}\n\n/**\n * Gets the trade event from transaction receipt logs\n * @param {TransactionReceipt} receipt - The transaction receipt containing the logs\n * @param {'buy' | 'sell'} direction - The direction of the trade\n * @returns {TradeEventArgs | undefined} The decoded trade event args if found\n */\nexport function getTradeFromLogs(\n receipt: TransactionReceipt,\n direction: \"buy\" | \"sell\",\n): TradeEventArgs | undefined {\n const eventLogs = parseEventLogs({\n abi: coinABI,\n logs: receipt.logs,\n });\n\n if (direction === \"buy\") {\n return eventLogs.find((log) => log.eventName === \"CoinBuy\")?.args;\n }\n return eventLogs.find((log) => log.eventName === \"CoinSell\")?.args;\n}\n\n/**\n * Executes a trade transaction\n * @param {TradeParams} params - The trade parameters\n * @param {PublicClient} publicClient - The viem public client instance\n * @param {WalletClient} walletClient - The viem wallet client instance\n * @returns {Promise<{\n * hash: `0x${string}`,\n * receipt: TransactionReceipt,\n * trade: TradeEventArgs | undefined\n * }>} The transaction result with trade details\n */\nexport async function tradeCoin(\n params: TradeParams,\n walletClient: WalletClient,\n publicClient: GenericPublicClient,\n) {\n validateClientNetwork(publicClient);\n const { request } = await publicClient.simulateContract({\n ...tradeCoinCall(params),\n account: walletClient.account,\n });\n const hash = await walletClient.writeContract(request);\n const receipt = await publicClient.waitForTransactionReceipt({ hash });\n const trade = getTradeFromLogs(receipt, params.direction);\n\n return {\n hash,\n receipt,\n trade,\n };\n}\n","import { coinABI, iUniswapV3PoolABI } from \"@zoralabs/protocol-deployments\";\nimport {\n SUPERCHAIN_WETH_ADDRESS,\n USDC_WETH_POOLS_BY_CHAIN,\n} from \"../constants\";\nimport { GenericPublicClient } from \"../utils/genericPublicClient\";\nimport { validateClientNetwork } from \"../utils/validateClientNetwork\";\nimport {\n Address,\n erc20Abi,\n formatEther,\n isAddressEqual,\n zeroAddress,\n} from \"viem\";\n\ntype Slot0Result = {\n sqrtPriceX96: bigint;\n tick: number;\n observationIndex: number;\n observationCardinality: number;\n observationCardinalityNext: number;\n feeProtocol: number;\n unlocked: boolean;\n};\n\ntype PricingResult = {\n eth: bigint;\n usdc: bigint | null;\n usdcDecimal: number | null;\n ethDecimal: number;\n};\n\n/**\n * Represents the current state of a coin\n * @typedef {Object} OnchainCoinDetails\n * @property {bigint} balance - The user's balance of the coin\n * @property {PricingResult} marketCap - The market cap of the coin\n * @property {PricingResult} liquidity - The liquidity of the coin\n * @property {Address} pool - Pool address\n * @property {Slot0Result} poolState - Current state of the UniswapV3 pool\n * @property {Address[]} owners - List of owners for the coin\n * @property {Address} payoutRecipient - The payout recipient address\n */\nexport type OnchainCoinDetails = {\n balance: bigint;\n marketCap: PricingResult;\n liquidity: PricingResult;\n pool: Address;\n poolState: Slot0Result;\n owners: readonly Address[];\n payoutRecipient: Address;\n};\n\n/**\n * Gets the current state of a coin for a user\n * @param {Object} params - The query parameters\n * @param {Address} params.coin - The coin contract address\n * @param {Address} params.user - The user address to check balance for\n * @param {PublicClient} params.publicClient - The viem public client instance\n * @returns {Promise<OnchainCoinDetails>} The coin's current state\n */\nexport async function getOnchainCoinDetails({\n coin,\n user = zeroAddress,\n publicClient,\n}: {\n coin: Address;\n user?: Address;\n publicClient: GenericPublicClient;\n}): Promise<OnchainCoinDetails> {\n validateClientNetwork(publicClient);\n const [balance, pool, owners, payoutRecipient] = await publicClient.multicall(\n {\n contracts: [\n {\n address: coin,\n abi: coinABI,\n functionName: \"balanceOf\",\n args: [user],\n },\n {\n address: coin,\n abi: coinABI,\n functionName: \"poolAddress\",\n },\n {\n address: coin,\n abi: coinABI,\n functionName: \"owners\",\n },\n {\n address: coin,\n abi: coinABI,\n functionName: \"payoutRecipient\",\n },\n ],\n allowFailure: false,\n },\n );\n\n const USDC_WETH_POOL = USDC_WETH_POOLS_BY_CHAIN[publicClient.chain?.id || 0];\n\n const [\n coinWethPoolSlot0,\n coinWethPoolToken0,\n coinReservesRaw,\n coinTotalSupply,\n wethReservesRaw,\n usdcWethSlot0,\n ] = await publicClient.multicall({\n contracts: [\n {\n address: pool,\n abi: iUniswapV3PoolABI,\n functionName: \"slot0\",\n },\n {\n address: pool,\n abi: iUniswapV3PoolABI,\n functionName: \"token0\",\n },\n {\n address: coin,\n abi: erc20Abi,\n functionName: \"balanceOf\",\n args: [pool],\n },\n {\n address: coin,\n abi: coinABI,\n functionName: \"totalSupply\",\n },\n {\n address: SUPERCHAIN_WETH_ADDRESS,\n abi: erc20Abi,\n functionName: \"balanceOf\",\n args: [pool],\n },\n {\n address: USDC_WETH_POOL ?? coin,\n abi: iUniswapV3PoolABI,\n functionName: \"slot0\",\n },\n ],\n allowFailure: false,\n });\n\n const wethPriceInUsdc = USDC_WETH_POOL\n ? uniswapV3SqrtPriceToBigIntScaled(\n usdcWethSlot0.sqrtPriceX96,\n 18,\n 6,\n true,\n 18,\n )\n : null;\n\n const coinPriceInWeth = uniswapV3SqrtPriceToBigIntScaled(\n coinWethPoolSlot0.sqrtPriceX96,\n 18,\n 18,\n isAddressEqual(coinWethPoolToken0, coin),\n 18,\n );\n\n // Divide by 10^18 to remove percision from `coinPriceInWeth` after math since bigint is decimal.\n const marketCap = (coinPriceInWeth * coinTotalSupply) / 10n ** 18n;\n\n const wethLiquidity = wethReservesRaw;\n // Divide by 10^18 to remove percision from `coinPriceInWeth` after math since bigint is decimal.\n const tokenLiquidity = (coinReservesRaw * coinPriceInWeth) / 10n ** 18n;\n\n return {\n balance,\n pool,\n owners,\n payoutRecipient,\n marketCap: convertEthOutput(marketCap, wethPriceInUsdc),\n liquidity: convertEthOutput(\n wethLiquidity + tokenLiquidity,\n wethPriceInUsdc,\n ),\n poolState: coinWethPoolSlot0,\n };\n}\n\nfunction convertEthOutput(amountETH: bigint, wethToUsdc: bigint | null) {\n return {\n eth: amountETH,\n ethDecimal: parseFloat(formatEther(amountETH)),\n usdc: wethToUsdc ? amountETH * wethToUsdc : null,\n usdcDecimal: wethToUsdc\n ? parseFloat(formatEther((amountETH * wethToUsdc) / 10n ** 18n))\n : null,\n };\n}\n\nfunction uniswapV3SqrtPriceToBigIntScaled(\n sqrtPriceX96: bigint,\n token0Decimals: number,\n token1Decimals: number,\n isToken0Coin: boolean,\n scaleDecimals: number = 18,\n): bigint {\n // (sqrtPrice^2 / 2^192) => ratio\n // We'll do: ratioScaled = (sqrtPrice^2 * 10^scaleDecimals) / 2^192\n const numerator = sqrtPriceX96 * sqrtPriceX96;\n const denominator = 2n ** 192n;\n const scaleFactor = 10n ** BigInt(scaleDecimals);\n\n // raw ratioScaled\n let ratioScaled = (numerator * scaleFactor) / denominator; // BigInt\n\n // Adjust for difference in decimals:\n // ratioScaled *= 10^(dec0 - dec1)\n const decimalsDiff = BigInt(token0Decimals - token1Decimals);\n if (decimalsDiff > 0n) {\n ratioScaled *= 10n ** decimalsDiff;\n } else if (decimalsDiff < 0n) {\n ratioScaled /= 10n ** -decimalsDiff;\n }\n\n if (!isToken0Coin) {\n // We want the reciprocal: coin is token1 => coinPriceInToken0 = 1 / ratio\n // But we also want it scaled by 10^scaleDecimals\n // reciprocalScaled = (10^scaleDecimals * 10^(decimalsDiff)) / ratioScaled\n // (assuming ratioScaled != 0)\n if (ratioScaled === 0n) {\n return 0n; // or some huge number representing infinity\n }\n ratioScaled = (scaleFactor * scaleFactor) / ratioScaled;\n // or if we already included decimalsDiff above, handle carefully.\n }\n\n return ratioScaled;\n}\n","import { coinABI } from \"@zoralabs/protocol-deployments\";\nimport { validateClientNetwork } from \"../utils/validateClientNetwork\";\nimport {\n Address,\n parseEventLogs,\n SimulateContractParameters,\n WalletClient,\n} from \"viem\";\nimport { GenericPublicClient } from \"src/utils/genericPublicClient\";\nimport { getAttribution } from \"../utils/attribution\";\n\nexport type UpdateCoinURIArgs = {\n coin: Address;\n newURI: string;\n};\n\nexport function updateCoinURICall({\n newURI,\n coin,\n}: UpdateCoinURIArgs): SimulateContractParameters {\n if (!newURI.startsWith(\"ipfs://\")) {\n throw new Error(\"URI needs to be an ipfs:// prefix uri\");\n }\n\n return {\n abi: coinABI,\n address: coin,\n functionName: \"setContractURI\",\n args: [newURI],\n dataSuffix: getAttribution(),\n };\n}\n\nexport async function updateCoinURI(\n args: UpdateCoinURIArgs,\n walletClient: WalletClient,\n publicClient: GenericPublicClient,\n) {\n validateClientNetwork(publicClient);\n const call = updateCoinURICall(args);\n const { request } = await publicClient.simulateContract({\n ...call,\n account: walletClient.account!,\n });\n const hash = await walletClient.writeContract(request);\n const receipt = await publicClient.waitForTransactionReceipt({ hash });\n const eventLogs = parseEventLogs({ abi: coinABI, logs: receipt.logs });\n const uriUpdated = eventLogs.find(\n (log) => log.eventName === \"ContractURIUpdated\",\n );\n\n return { hash, receipt, uriUpdated };\n}\n","import { coinABI } from \"@zoralabs/protocol-deployments\";\nimport { validateClientNetwork } from \"../utils/validateClientNetwork\";\nimport {\n Address,\n parseEventLogs,\n SimulateContractParameters,\n WalletClient,\n} from \"viem\";\nimport { GenericPublicClient } from \"src/utils/genericPublicClient\";\nimport { getAttribution } from \"../utils/attribution\";\n\nexport type UpdatePayoutRecipientArgs = {\n coin: Address;\n newPayoutRecipient: string;\n};\n\nexport function updatePayoutRecipientCall({\n newPayoutRecipient,\n coin,\n}: UpdatePayoutRecipientArgs): SimulateContractParameters {\n return {\n abi: coinABI,\n address: coin,\n functionName: \"setPayoutRecipient\",\n args: [newPayoutRecipient],\n dataSuffix: getAttribution(),\n };\n}\n\nexport async function updatePayoutRecipient(\n args: UpdatePayoutRecipientArgs,\n walletClient: WalletClient,\n publicClient: GenericPublicClient,\n) {\n validateClientNetwork(publicClient);\n const call = updatePayoutRecipientCall(args);\n const { request } = await publicClient.simulateContract({\n ...call,\n account: walletClient.account!,\n });\n const hash = await walletClient.writeContract(request);\n const receipt = await publicClient.waitForTransactionReceipt({ hash });\n const eventLogs = parseEventLogs({ abi: coinABI, logs: receipt.logs });\n const payoutRecipientUpdated = eventLogs.find(\n (log) => log.eventName === \"CoinPayoutRecipientUpdated\",\n );\n\n return { hash, receipt, payoutRecipientUpdated };\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { ClientOptions } from \"./types.gen\";\nimport {\n type Config,\n type ClientOptions as DefaultClientOptions,\n createClient,\n createConfig,\n} from \"@hey-api/client-fetch\";\n\n/**\n * The `createClientConfig()` function will be called on client initialization\n * and the returned object will become the client's initial configuration.\n *\n * You may want to initialize your client this way instead of calling\n * `setConfig()`. This is useful for example if you're using Next.js\n * to ensure your client always has the correct values.\n */\nexport type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> =\n (\n override?: Config<DefaultClientOptions & T>,\n ) => Config<Required<DefaultClientOptions> & T>;\n\nexport const client = createClient(\n createConfig<ClientOptions>({\n baseUrl: \"https://api-sdk.zora.engineering/\",\n }),\n);\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type {\n Options as ClientOptions,\n TDataShape,\n Client,\n} from \"@hey-api/client-fetch\";\nimport type {\n GetCoinData,\n GetCoinResponse,\n GetCoinCommentsData,\n GetCoinCommentsResponse,\n GetCoinsData,\n GetCoinsResponse,\n GetExploreData,\n GetExploreResponse,\n GetProfileData,\n GetProfileResponse,\n GetProfileBalancesData,\n GetProfileBalancesResponse,\n} from \"./types.gen\";\nimport { client as _heyApiClient } from \"./client.gen\";\n\nexport type Options<\n TData extends TDataShape = TDataShape,\n ThrowOnError extends boolean = boolean,\n> = ClientOptions<TData, ThrowOnError> & {\n /**\n * You can provide a client instance returned by `createClient()` instead of\n * individual options. This might be also useful if you want to implement a\n * custom client.\n */\n client?: Client;\n /**\n * You can pass arbitrary values through the `meta` object. This can be\n * used to access values that aren't defined as part of the SDK function.\n */\n meta?: Record<string, unknown>;\n};\n\n/**\n * zoraSDK_coin query\n */\nexport const getCoin = <ThrowOnError extends boolean = false>(\n options: Options<GetCoinData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetCoinResponse,\n unknown,\n ThrowOnError\n >({\n url: \"/coin\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_coinComments query\n */\nexport const getCoinComments = <ThrowOnError extends boolean = false>(\n options: Options<GetCoinCommentsData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetCoinCommentsResponse,\n unknown,\n ThrowOnError\n >({\n url: \"/coinComments\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_coins query\n */\nexport const getCoins = <ThrowOnError extends boolean = false>(\n options: Options<GetCoinsData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetCoinsResponse,\n unknown,\n ThrowOnError\n >({\n url: \"/coins\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_explore query\n */\nexport const getExplore = <ThrowOnError extends boolean = false>(\n options: Options<GetExploreData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetExploreResponse,\n unknown,\n ThrowOnError\n >({\n url: \"/explore\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_profile query\n */\nexport const getProfile = <ThrowOnError extends boolean = false>(\n options: Options<GetProfileData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetProfileResponse,\n unknown,\n ThrowOnError\n >({\n url: \"/profile\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_profileBalances query\n */\nexport const getProfileBalances = <ThrowOnError extends boolean = false>(\n options: Options<GetProfileBalancesData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetProfileBalancesResponse,\n unknown,\n ThrowOnError\n >({\n url: \"/profileBalances\",\n ...options,\n });\n};\n","let apiKey: string | undefined;\nexport function setApiKey(key: string) {\n apiKey = key;\n}\n\nexport function getApiKeyMeta() {\n if (!apiKey) {\n return {};\n }\n return {\n headers: {\n \"api-key\": apiKey,\n },\n };\n}\n","import {\n GetCoinCommentsData,\n GetCoinCommentsResponse,\n GetCoinData,\n GetCoinResponse,\n GetCoinsData,\n GetCoinsResponse,\n GetProfileBalancesData,\n GetProfileBalancesResponse,\n GetProfileData,\n GetProfileResponse,\n} from \"../client/types.gen\";\nimport {\n getCoin as getCoinSDK,\n getCoins as getCoinsSDK,\n getCoinComments as getCoinCommentsSDK,\n getProfile as getProfileSDK,\n getProfileBalances as getProfileBalancesSDK,\n} from \"../client/sdk.gen\";\nimport { getApiKeyMeta } from \"./api-key\";\nimport { RequestOptionsType } from \"./query-types\";\nimport { RequestResult } from \"@hey-api/client-fetch\";\n\nexport type { RequestResult };\n\ntype GetCoinQuery = GetCoinData[\"query\"];\nexport type { GetCoinQuery, GetCoinData };\nexport type { GetCoinResponse } from \"../client/types.gen\";\n\nexport type CoinData = NonNullable<GetCoinResponse[\"zora20Token\"]>;\n\nexport const getCoin = async (\n query: GetCoinQuery,\n options?: RequestOptionsType<GetCoinData>,\n): Promise<RequestResult<GetCoinResponse>> => {\n return await getCoinSDK({\n ...options,\n query,\n meta: getApiKeyMeta(),\n });\n};\n\ntype GetCoinsQuery = GetCoinsData[\"query\"];\nexport type { GetCoinsQuery, GetCoinsData };\nexport type { GetCoinsResponse } from \"../client/types.gen\";\n\nexport const getCoins = async (\n query: GetCoinsQuery,\n options?: RequestOptionsType<GetCoinsData>,\n): Promise<RequestResult<GetCoinsResponse>> => {\n return await getCoinsSDK({\n query: {\n coins: query.coins.map((coinData) => JSON.stringify(coinData)) as any,\n },\n meta: getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetCoinCommentsQuery = GetCoinCommentsData[\"query\"];\nexport type { GetCoinCommentsQuery, GetCoinCommentsData };\nexport type { GetCoinCommentsResponse } from \"../client/types.gen\";\n\nexport const getCoinComments = async (\n query: GetCoinCommentsQuery,\n options?: RequestOptionsType<GetCoinCommentsData>,\n): Promise<RequestResult<GetCoinCommentsResponse>> => {\n return await getCoinCommentsSDK({\n query,\n meta: getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetProfileQuery = GetProfileData[\"query\"];\nexport type { GetProfileQuery, GetProfileData };\nexport type { GetProfileResponse } from \"../client/types.gen\";\n\nexport const getProfile = async (\n query: GetProfileQuery,\n options?: RequestOptionsType<GetProfileData>,\n): Promise<RequestResult<GetProfileResponse>> => {\n return await getProfileSDK({\n query,\n meta: getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetProfileBalancesQuery = GetProfileBalancesData[\"query\"];\nexport type { GetProfileBalancesQuery, GetProfileBalancesData };\nexport type { GetProfileBalancesResponse } from \"../client/types.gen\";\n\nexport const getProfileBalances = async (\n query: GetProfileBalancesQuery,\n options?: RequestOptionsType<GetProfileBalancesData>,\n): Promise<RequestResult<GetProfileBalancesResponse>> => {\n return await getProfileBalancesSDK({\n query,\n meta: getApiKeyMeta(),\n ...options,\n });\n};\n","import { getExplore as getExploreSDK } from \"../client/sdk.gen\";\nimport type { GetExploreData, GetExploreResponse } from \"../client/types.gen\";\nimport { getApiKeyMeta } from \"./api-key\";\nimport { RequestOptionsType } from \"./query-types\";\n\n/**\n * The inner type for the explore queries that omits listType.\n * This is used to create the query object for the explore queries.\n */\nexport type QueryRequestType = Omit<GetExploreData[\"query\"], \"listType\">;\n\ntype ExploreResponse = { data?: GetExploreResponse };\n\nexport type ListType = GetExploreData[\"query\"][\"listType\"];\n\nexport type { ExploreResponse };\n\nexport type { GetExploreData };\n\n/**\n * Creates an explore query with the specified list type\n */\nconst createExploreQuery = (\n query: QueryRequestType,\n listType: ListType,\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n getExploreSDK({\n ...options,\n query: { ...query, listType },\n meta: getApiKeyMeta(),\n });\n\n/** Get top gaining coins */\nexport const getCoinsTopGainers = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TOP_GAINERS\", options);\n\n/** Get coins with highest 24h volume */\nexport const getCoinsTopVolume24h = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TOP_VOLUME_24H\", options);\n\n/** Get most valuable coins */\nexport const getCoinsMostValuable = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"MOST_VALUABLE\", options);\n\n/** Get newly created coins */\nexport const getCoinsNew = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> => createExploreQuery(query, \"NEW\", options);\n\n/** Get recently traded coins */\nexport const getCoinsLastTraded = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"LAST_TRADED\", options);\n\n/** Get recently traded unique coins */\nexport const getCoinsLastTradedUnique = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"LAST_TRADED_UNIQUE\", options);\n"],"mappings":";AAAA,SAAS,k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tB,CAAC;AAGI,IAAM,qBAAqB,CAChC,QAA0B,CAAC,GAC3B,YAEA,mBAAmB,OAAO,eAAe,OAAO;AAG3C,IAAM,uBAAuB,CAClC,QAA0B,CAAC,GAC3B,YAEA,mBAAmB,OAAO,kBAAkB,OAAO;AAG9C,IAAM,uBAAuB,CAClC,QAA0B,CAAC,GAC3B,YAEA,mBAAmB,OAAO,iBAAiB,OAAO;AAG7C,IAAM,cAAc,CACzB,QAA0B,CAAC,GAC3B,YAC6B,mBAAmB,OAAO,OAAO,OAAO;AAGhE,IAAM,qBAAqB,CAChC,QAA0B,CAAC,GAC3B,YAEA,mBAAmB,OAAO,eAAe,OAAO;AAG3C,IAAM,2BAA2B,CACtC,QAA0B,CAAC,GAC3B,YAEA,mBAAmB,OAAO,sBAAsB,OAAO;","names":["zeroAddress","keccak256","base","base","baseSepolia","base","baseSepolia","DeployCurrency","baseSepolia","base","zeroAddress","keccak256","zeroAddress","parseEventLogs","baseSepolia","zeroAddress","baseSepolia","parseEventLogs","coinABI","zeroAddress","coinABI","coinABI","parseEventLogs","coinABI","parseEventLogs","coinABI","parseEventLogs","coinABI","parseEventLogs","getCoin","getCoins","getCoinComments","getProfile","getProfileBalances"]}
1
+ {"version":3,"sources":["../src/actions/createCoin.ts","../src/constants.ts","../src/utils/validateClientNetwork.ts","../src/metadata/cleanAndValidateMetadataURI.ts","../src/metadata/validateMetadataJSON.ts","../src/metadata/validateMetadataURIContent.ts","../src/utils/attribution.ts","../src/utils/poolConfigUtils.ts","../src/actions/tradeCoin.ts","../src/actions/getOnchainCoinDetails.ts","../src/actions/updateCoinURI.ts","../src/actions/updatePayoutRecipient.ts","../src/client/client.gen.ts","../src/client/sdk.gen.ts","../src/api/api-key.ts","../src/api/queries.ts","../src/api/explore.ts"],"sourcesContent":["import { coinFactoryABI as zoraFactoryImplABI } from \"@zoralabs/protocol-deployments\";\nimport {\n Address,\n TransactionReceipt,\n WalletClient,\n SimulateContractParameters,\n ContractEventArgsFromTopics,\n parseEventLogs,\n zeroAddress,\n keccak256,\n toBytes,\n Hex,\n Account,\n} from \"viem\";\nimport { COIN_FACTORY_ADDRESS } from \"../constants\";\nimport { validateClientNetwork } from \"../utils/validateClientNetwork\";\nimport { GenericPublicClient } from \"src/utils/genericPublicClient\";\nimport { validateMetadataURIContent, ValidMetadataURI } from \"src/metadata\";\nimport { getAttribution } from \"../utils/attribution\";\nimport { base, baseSepolia } from \"viem/chains\";\nimport {\n COIN_ETH_PAIR_POOL_CONFIG,\n COIN_ZORA_PAIR_POOL_CONFIG,\n} from \"src/utils/poolConfigUtils\";\n\nexport type CoinDeploymentLogArgs = ContractEventArgsFromTopics<\n typeof zoraFactoryImplABI,\n \"CoinCreatedV4\"\n>;\n\nexport enum DeployCurrency {\n ZORA = 1,\n ETH = 2,\n}\n\nexport type CreateCoinArgs = {\n name: string;\n symbol: string;\n uri: ValidMetadataURI;\n chainId: number;\n owners?: Address[];\n payoutRecipient: Address;\n platformReferrer?: Address;\n currency?: DeployCurrency;\n};\n\nfunction getPoolConfig(currency: DeployCurrency, chainId: number) {\n if (currency === DeployCurrency.ZORA && chainId == baseSepolia.id) {\n throw new Error(\"ZORA is not supported on Base Sepolia\");\n }\n\n switch (currency) {\n case DeployCurrency.ZORA:\n return COIN_ZORA_PAIR_POOL_CONFIG[\n chainId as keyof typeof COIN_ZORA_PAIR_POOL_CONFIG\n ];\n case DeployCurrency.ETH:\n return COIN_ETH_PAIR_POOL_CONFIG[\n chainId as keyof typeof COIN_ETH_PAIR_POOL_CONFIG\n ];\n default:\n throw new Error(\"Invalid currency\");\n }\n}\n\nexport async function createCoinCall({\n name,\n symbol,\n uri,\n owners,\n payoutRecipient,\n currency,\n chainId = base.id,\n platformReferrer = \"0x0000000000000000000000000000000000000000\",\n}: CreateCoinArgs): Promise<\n SimulateContractParameters<typeof zoraFactoryImplABI, \"deploy\">\n> {\n if (!owners) {\n owners = [payoutRecipient];\n }\n\n if (!currency) {\n currency = chainId !== base.id ? DeployCurrency.ETH : DeployCurrency.ZORA;\n }\n\n const poolConfig = getPoolConfig(currency, chainId);\n\n // This will throw an error if the metadata is not valid\n await validateMetadataURIContent(uri);\n\n return {\n abi: zoraFactoryImplABI,\n functionName: \"deploy\",\n address: COIN_FACTORY_ADDRESS,\n args: [\n payoutRecipient,\n owners,\n uri,\n name,\n symbol,\n poolConfig,\n platformReferrer,\n zeroAddress, // hookAddress\n \"0x\" as Hex, // hookData\n keccak256(toBytes(Math.random().toString())), // coinSalt\n ],\n dataSuffix: getAttribution(),\n } as const;\n}\n\n/**\n * Gets the deployed coin address from transaction receipt logs\n * @param receipt Transaction receipt containing the CoinCreated event\n * @returns The deployment information if found\n */\nexport function getCoinCreateFromLogs(\n receipt: TransactionReceipt,\n): CoinDeploymentLogArgs | undefined {\n const eventLogs = parseEventLogs({\n abi: zoraFactoryImplABI,\n logs: receipt.logs,\n });\n\n return eventLogs.find((log) => log.eventName === \"CoinCreatedV4\")?.args;\n}\n\n// Update createCoin to return both receipt and coin address\nexport async function createCoin(\n call: CreateCoinArgs,\n walletClient: WalletClient,\n publicClient: GenericPublicClient,\n options?: {\n gasMultiplier?: number;\n account?: Account | Address;\n },\n) {\n validateClientNetwork(publicClient);\n\n const createCoinRequest = await createCoinCall(call);\n const { request } = await publicClient.simulateContract({\n ...createCoinRequest,\n account: options?.account ?? walletClient.account,\n });\n\n // Add a 2/5th buffer on gas.\n if (request.gas) {\n // Gas limit multiplier is a percentage argument.\n request.gas = (request.gas * BigInt(options?.gasMultiplier ?? 100)) / 100n;\n }\n const hash = await walletClient.writeContract(request);\n const receipt = await publicClient.waitForTransactionReceipt({ hash });\n const deployment = getCoinCreateFromLogs(receipt);\n\n return {\n hash,\n receipt,\n address: deployment?.coin,\n deployment,\n };\n}\n","import { coinFactoryAddress as zoraFactoryImplAddress } from \"@zoralabs/protocol-deployments\";\nimport { Address } from \"viem\";\nimport { base } from \"viem/chains\";\n\n// this is the same across all chains due to deterministic deploys.\nexport const COIN_FACTORY_ADDRESS = zoraFactoryImplAddress[\"8453\"] as Address;\n\nexport const SUPERCHAIN_WETH_ADDRESS =\n \"0x4200000000000000000000000000000000000006\";\n\nexport const USDC_WETH_POOLS_BY_CHAIN: Record<number, Address> = {\n [base.id]: \"0xd0b53D9277642d899DF5C87A3966A349A798F224\",\n};\n","import { PublicClient } from \"viem\";\nimport { base, baseSepolia } from \"viem/chains\";\n\nexport const validateClientNetwork = (\n publicClient: PublicClient<any, any, any, any>,\n) => {\n const clientChainId = publicClient?.chain?.id;\n if (clientChainId === base.id) {\n return;\n }\n if (clientChainId === baseSepolia.id) {\n return;\n }\n\n throw new Error(\n \"Client network needs to be base or baseSepolia for current coin deployments.\",\n );\n};\n","export type ValidMetadataURI =\n | `ipfs://${string}`\n | `ar://${string}`\n | `data:${string}`\n | `https://${string}`;\n\n/**\n * Clean the metadata URI to HTTPS format\n * @param metadataURI - The metadata URI to clean from IPFS or Arweave\n * @returns The cleaned metadata URI\n * @throws If the metadata URI is a data URI\n */\nexport function cleanAndValidateMetadataURI(uri: ValidMetadataURI) {\n if (uri.startsWith(\"ipfs://\")) {\n return uri.replace(\n \"ipfs://\",\n \"https://magic.decentralized-content.com/ipfs/\",\n );\n }\n if (uri.startsWith(\"ar://\")) {\n return uri.replace(\"ar://\", \"http://arweave.net/\");\n }\n if (uri.startsWith(\"data:\")) {\n return uri;\n // throw new Error(\"Data URIs are not supported\");\n }\n if (uri.startsWith(\"http://\") || uri.startsWith(\"https://\")) {\n return uri;\n }\n\n throw new Error(\"Invalid metadata URI\");\n}\n","export type ValidMetadataJSON = {\n name: string;\n description: string;\n image: string;\n animation_url?: string;\n content?: { uri: string; mime?: string };\n};\n\nfunction validateURIString(uri: unknown) {\n if (typeof uri !== \"string\") {\n throw new Error(\"URI must be a string\");\n }\n if (uri.startsWith(\"ipfs://\")) {\n return true;\n }\n if (uri.startsWith(\"ar://\")) {\n return true;\n }\n if (uri.startsWith(\"https://\")) {\n return true;\n }\n if (uri.startsWith(\"data:\")) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Validate the metadata JSON object\n * @param metadata - The metadata object to validate\n */\nexport function validateMetadataJSON(metadata: ValidMetadataJSON | unknown) {\n if (typeof metadata !== \"object\" || !metadata) {\n throw new Error(\"Metadata must be an object and exist\");\n }\n if (typeof (metadata as { name: unknown }).name !== \"string\") {\n throw new Error(\"Metadata name is required and must be a string\");\n }\n if (typeof (metadata as { description: unknown }).description !== \"string\") {\n throw new Error(\"Metadata description is required and must be a string\");\n }\n if (typeof (metadata as { image: unknown }).image === \"string\") {\n if (!validateURIString((metadata as { image: string }).image)) {\n throw new Error(\"Metadata image is not a valid URI\");\n }\n } else {\n throw new Error(\"Metadata image is required and must be a string\");\n }\n if (\"animation_url\" in metadata) {\n if (\n typeof (metadata as { animation_url?: unknown }).animation_url !==\n \"string\"\n ) {\n throw new Error(\"Metadata animation_url, if provided, must be a string\");\n }\n if (!validateURIString(metadata.animation_url)) {\n throw new Error(\"Metadata animation_url is not a valid URI\");\n }\n }\n const content =\n \"content\" in metadata && (metadata as { content?: unknown }).content;\n if (content) {\n if (typeof (content as { uri?: unknown }).uri !== \"string\") {\n throw new Error(\"If provided, content.uri must be a string\");\n }\n if (!validateURIString((content as { uri: string }).uri)) {\n throw new Error(\"If provided, content.uri must be a valid URI string\");\n }\n if (typeof (content as { mime?: unknown }).mime !== \"string\") {\n throw new Error(\"If provided, content.mime must be a string\");\n }\n }\n\n return true;\n}\n","import {\n cleanAndValidateMetadataURI,\n ValidMetadataURI,\n} from \"./cleanAndValidateMetadataURI\";\nimport { validateMetadataJSON } from \"./validateMetadataJSON\";\n\n/**\n * Validate the metadata URI Content\n * @param metadataURI - The metadata URI to validate\n * @returns true if the metadata is valid, throws an error otherwise\n */\nexport async function validateMetadataURIContent(\n metadataURI: ValidMetadataURI,\n) {\n const cleanedURI = cleanAndValidateMetadataURI(metadataURI);\n const response = await fetch(cleanedURI);\n if (!response.ok) {\n throw new Error(\"Metadata fetch failed\");\n }\n if (\n ![\"application/json\", \"text/plain\"].includes(\n response.headers.get(\"content-type\") ?? \"\",\n )\n ) {\n throw new Error(\"Metadata is not a valid JSON or plain text response type\");\n }\n const metadataJson = await response.json();\n return validateMetadataJSON(metadataJson);\n}\n","import { Hex, keccak256, slice, toHex } from \"viem\";\n\nexport function getAttribution(): Hex {\n const hash = keccak256(toHex(\"api-sdk.zora.engineering\"));\n return slice(hash, 0, 4) as Hex;\n}\n","import { encodeMultiCurvePoolConfig } from \"@zoralabs/protocol-deployments\";\nimport { parseUnits, zeroAddress } from \"viem\";\nimport { base, baseSepolia } from \"viem/chains\";\n\nconst ZORA_DECIMALS = 18;\n\n/**\n * =========================\n * COIN_ETH_PAIR_POOL_CONFIG\n * =========================\n */\n\nexport const ZORA_ADDRESS = \"0x1111111111166b7fe7bd91427724b487980afc69\";\n\nconst COIN_ETH_PAIR_LOWER_TICK = -250000;\nconst COIN_ETH_PAIR_UPPER_TICK = -195_000;\nconst COIN_ETH_PAIR_NUM_DISCOVERY_POSITIONS = 11;\nconst COIN_ETH_PAIR_MAX_DISCOVERY_SUPPLY_SHARE = parseUnits(\"0.05\", 18);\n\nexport const COIN_ETH_PAIR_POOL_CONFIG = {\n [base.id]: encodeMultiCurvePoolConfig({\n currency: zeroAddress,\n tickLower: [COIN_ETH_PAIR_LOWER_TICK],\n tickUpper: [COIN_ETH_PAIR_UPPER_TICK],\n numDiscoveryPositions: [COIN_ETH_PAIR_NUM_DISCOVERY_POSITIONS],\n maxDiscoverySupplyShare: [COIN_ETH_PAIR_MAX_DISCOVERY_SUPPLY_SHARE],\n }),\n [baseSepolia.id]: encodeMultiCurvePoolConfig({\n currency: zeroAddress,\n tickLower: [COIN_ETH_PAIR_LOWER_TICK],\n tickUpper: [COIN_ETH_PAIR_UPPER_TICK],\n numDiscoveryPositions: [COIN_ETH_PAIR_NUM_DISCOVERY_POSITIONS],\n maxDiscoverySupplyShare: [COIN_ETH_PAIR_MAX_DISCOVERY_SUPPLY_SHARE],\n }),\n};\n\nconst COIN_ZORA_PAIR_LOWER_TICK = -138_000; // ( -250000 in ETH land ~= $23 = -138_000 in Zora token land at .022)\nconst COIN_ZORA_PAIR_UPPER_TICK = -81_000; // (-195_000 ~= 5782 = -81_000 in Zora token land at .022)\nconst COIN_ZORA_PAIR_NUM_DISCOVERY_POSITIONS = 11;\nconst COIN_ZORA_PAIR_MAX_DISCOVERY_SUPPLY_SHARE = parseUnits(\n \"0.05\",\n ZORA_DECIMALS,\n);\n\nexport const COIN_ZORA_PAIR_POOL_CONFIG = {\n [base.id]: encodeMultiCurvePoolConfig({\n currency: ZORA_ADDRESS,\n tickLower: [COIN_ZORA_PAIR_LOWER_TICK],\n tickUpper: [COIN_ZORA_PAIR_UPPER_TICK],\n numDiscoveryPositions: [COIN_ZORA_PAIR_NUM_DISCOVERY_POSITIONS],\n maxDiscoverySupplyShare: [COIN_ZORA_PAIR_MAX_DISCOVERY_SUPPLY_SHARE],\n }),\n};\n","import { coinABI } from \"@zoralabs/protocol-deployments\";\nimport { validateClientNetwork } from \"../utils/validateClientNetwork\";\nimport {\n Address,\n TransactionReceipt,\n WalletClient,\n SimulateContractParameters,\n parseEther,\n zeroAddress,\n ContractEventArgsFromTopics,\n parseEventLogs,\n} from \"viem\";\nimport { baseSepolia } from \"viem/chains\";\nimport { GenericPublicClient } from \"src/utils/genericPublicClient\";\nimport { getAttribution } from \"../utils/attribution\";\n// Define trade event args type\n\nexport type SellEventArgs = ContractEventArgsFromTopics<\n typeof coinABI,\n \"CoinSell\"\n>;\nexport type BuyEventArgs = ContractEventArgsFromTopics<\n typeof coinABI,\n \"CoinBuy\"\n>;\n\nexport type TradeEventArgs = SellEventArgs | BuyEventArgs;\n\n// We'll use this address to ensure it will have funds to simulate an eth trade.\n// @dev: This only works on OP chains and is a fix for a bug. Another approach should be taken long term.\nconst OP_BRIDGE_ADDRESS =\n \"0x4200000000000000000000000000000000000016\" as Address;\n\n/**\n * Simulates a buy order to get the expected output amount\n * @param {Object} params - The simulation parameters\n * @param {Address} params.target - The target coin contract address\n * @param {bigint} params.requestedOrderSize - The desired input amount for the buy\n * @param {PublicClient} params.publicClient - The viem public client instance\n * @returns {Promise<{orderSize: bigint, amountOut: bigint}>} The simulated order size and output amount\n */\nexport async function simulateBuy({\n target,\n requestedOrderSize,\n publicClient,\n}: {\n target: Address;\n requestedOrderSize: bigint;\n publicClient: GenericPublicClient;\n}): Promise<{ orderSize: bigint; amountOut: bigint }> {\n const numberResult = await publicClient.simulateContract({\n address: target,\n abi: coinABI,\n functionName: \"buy\",\n dataSuffix: getAttribution(),\n args: [\n OP_BRIDGE_ADDRESS,\n requestedOrderSize,\n 0n, // minAmountOut\n 0n, // sqrtPriceLimitX96\n zeroAddress, // tradeReferrer\n ],\n // We want to ensure that the multicall3 contract has enough ETH to buy in the simulation\n stateOverride: [\n {\n address: baseSepolia.contracts.multicall3.address,\n balance: parseEther(\"10000000\"),\n },\n ],\n });\n const orderSize = numberResult.result[0];\n const amountOut = numberResult.result[1];\n return { orderSize, amountOut };\n}\n\n/**\n * Parameters for creating a trade call\n * @typedef {Object} TradeParams\n * @property {'sell' | 'buy'} direction - The trade direction\n * @property {Address} target - The target coin contract address\n * @property {Object} args - The trade arguments\n * @property {Address} args.recipient - The recipient of the trade output\n * @property {bigint} args.orderSize - The size of the order\n * @property {bigint} [args.minAmountOut] - The minimum amount to receive\n * @property {bigint} [args.sqrtPriceLimitX96] - The price limit for the trade\n * @property {Address} [args.tradeReferrer] - The referrer address for the trade\n */\nexport type TradeParams = {\n direction: \"sell\" | \"buy\";\n target: Address;\n args: {\n recipient: Address;\n orderSize: bigint;\n minAmountOut?: bigint;\n sqrtPriceLimitX96?: bigint;\n tradeReferrer?: Address;\n };\n};\n\n/**\n * Creates a trade call parameters object for buy or sell\n * @param {TradeParams} params - The trade parameters\n * @returns {SimulateContractParameters} The contract call parameters\n */\nexport function tradeCoinCall({\n target,\n direction,\n args: {\n recipient,\n orderSize,\n minAmountOut = 0n,\n sqrtPriceLimitX96 = 0n,\n tradeReferrer = zeroAddress,\n },\n}: TradeParams): SimulateContractParameters {\n return {\n abi: coinABI,\n functionName: direction,\n address: target,\n args: [\n recipient,\n orderSize,\n minAmountOut,\n sqrtPriceLimitX96,\n tradeReferrer,\n ],\n value: direction === \"buy\" ? orderSize : 0n,\n } as const;\n}\n\n/**\n * Gets the trade event from transaction receipt logs\n * @param {TransactionReceipt} receipt - The transaction receipt containing the logs\n * @param {'buy' | 'sell'} direction - The direction of the trade\n * @returns {TradeEventArgs | undefined} The decoded trade event args if found\n */\nexport function getTradeFromLogs(\n receipt: TransactionReceipt,\n direction: \"buy\" | \"sell\",\n): TradeEventArgs | undefined {\n const eventLogs = parseEventLogs({\n abi: coinABI,\n logs: receipt.logs,\n });\n\n if (direction === \"buy\") {\n return eventLogs.find((log) => log.eventName === \"CoinBuy\")?.args;\n }\n return eventLogs.find((log) => log.eventName === \"CoinSell\")?.args;\n}\n\n/**\n * Executes a trade transaction\n * @param {TradeParams} params - The trade parameters\n * @param {PublicClient} publicClient - The viem public client instance\n * @param {WalletClient} walletClient - The viem wallet client instance\n * @returns {Promise<{\n * hash: `0x${string}`,\n * receipt: TransactionReceipt,\n * trade: TradeEventArgs | undefined\n * }>} The transaction result with trade details\n */\nexport async function tradeCoin(\n params: TradeParams,\n walletClient: WalletClient,\n publicClient: GenericPublicClient,\n) {\n validateClientNetwork(publicClient);\n const { request } = await publicClient.simulateContract({\n ...tradeCoinCall(params),\n account: walletClient.account,\n });\n const hash = await walletClient.writeContract(request);\n const receipt = await publicClient.waitForTransactionReceipt({ hash });\n const trade = getTradeFromLogs(receipt, params.direction);\n\n return {\n hash,\n receipt,\n trade,\n };\n}\n","import { coinABI, iUniswapV3PoolABI } from \"@zoralabs/protocol-deployments\";\nimport {\n SUPERCHAIN_WETH_ADDRESS,\n USDC_WETH_POOLS_BY_CHAIN,\n} from \"../constants\";\nimport { GenericPublicClient } from \"../utils/genericPublicClient\";\nimport { validateClientNetwork } from \"../utils/validateClientNetwork\";\nimport {\n Address,\n erc20Abi,\n formatEther,\n isAddressEqual,\n zeroAddress,\n} from \"viem\";\n\ntype Slot0Result = {\n sqrtPriceX96: bigint;\n tick: number;\n observationIndex: number;\n observationCardinality: number;\n observationCardinalityNext: number;\n feeProtocol: number;\n unlocked: boolean;\n};\n\ntype PricingResult = {\n eth: bigint;\n usdc: bigint | null;\n usdcDecimal: number | null;\n ethDecimal: number;\n};\n\n/**\n * Represents the current state of a coin\n * @typedef {Object} OnchainCoinDetails\n * @property {bigint} balance - The user's balance of the coin\n * @property {PricingResult} marketCap - The market cap of the coin\n * @property {PricingResult} liquidity - The liquidity of the coin\n * @property {Address} pool - Pool address\n * @property {Slot0Result} poolState - Current state of the UniswapV3 pool\n * @property {Address[]} owners - List of owners for the coin\n * @property {Address} payoutRecipient - The payout recipient address\n */\nexport type OnchainCoinDetails = {\n balance: bigint;\n marketCap: PricingResult;\n liquidity: PricingResult;\n pool: Address;\n poolState: Slot0Result;\n owners: readonly Address[];\n payoutRecipient: Address;\n};\n\n/**\n * Gets the current state of a coin for a user\n * @param {Object} params - The query parameters\n * @param {Address} params.coin - The coin contract address\n * @param {Address} params.user - The user address to check balance for\n * @param {PublicClient} params.publicClient - The viem public client instance\n * @returns {Promise<OnchainCoinDetails>} The coin's current state\n */\nexport async function getOnchainCoinDetails({\n coin,\n user = zeroAddress,\n publicClient,\n}: {\n coin: Address;\n user?: Address;\n publicClient: GenericPublicClient;\n}): Promise<OnchainCoinDetails> {\n validateClientNetwork(publicClient);\n const [balance, pool, owners, payoutRecipient] = await publicClient.multicall(\n {\n contracts: [\n {\n address: coin,\n abi: coinABI,\n functionName: \"balanceOf\",\n args: [user],\n },\n {\n address: coin,\n abi: coinABI,\n functionName: \"poolAddress\",\n },\n {\n address: coin,\n abi: coinABI,\n functionName: \"owners\",\n },\n {\n address: coin,\n abi: coinABI,\n functionName: \"payoutRecipient\",\n },\n ],\n allowFailure: false,\n },\n );\n\n const USDC_WETH_POOL = USDC_WETH_POOLS_BY_CHAIN[publicClient.chain?.id || 0];\n\n const [\n coinWethPoolSlot0,\n coinWethPoolToken0,\n coinReservesRaw,\n coinTotalSupply,\n wethReservesRaw,\n usdcWethSlot0,\n ] = await publicClient.multicall({\n contracts: [\n {\n address: pool,\n abi: iUniswapV3PoolABI,\n functionName: \"slot0\",\n },\n {\n address: pool,\n abi: iUniswapV3PoolABI,\n functionName: \"token0\",\n },\n {\n address: coin,\n abi: erc20Abi,\n functionName: \"balanceOf\",\n args: [pool],\n },\n {\n address: coin,\n abi: coinABI,\n functionName: \"totalSupply\",\n },\n {\n address: SUPERCHAIN_WETH_ADDRESS,\n abi: erc20Abi,\n functionName: \"balanceOf\",\n args: [pool],\n },\n {\n address: USDC_WETH_POOL ?? coin,\n abi: iUniswapV3PoolABI,\n functionName: \"slot0\",\n },\n ],\n allowFailure: false,\n });\n\n const wethPriceInUsdc = USDC_WETH_POOL\n ? uniswapV3SqrtPriceToBigIntScaled(\n usdcWethSlot0.sqrtPriceX96,\n 18,\n 6,\n true,\n 18,\n )\n : null;\n\n const coinPriceInWeth = uniswapV3SqrtPriceToBigIntScaled(\n coinWethPoolSlot0.sqrtPriceX96,\n 18,\n 18,\n isAddressEqual(coinWethPoolToken0, coin),\n 18,\n );\n\n // Divide by 10^18 to remove percision from `coinPriceInWeth` after math since bigint is decimal.\n const marketCap = (coinPriceInWeth * coinTotalSupply) / 10n ** 18n;\n\n const wethLiquidity = wethReservesRaw;\n // Divide by 10^18 to remove percision from `coinPriceInWeth` after math since bigint is decimal.\n const tokenLiquidity = (coinReservesRaw * coinPriceInWeth) / 10n ** 18n;\n\n return {\n balance,\n pool,\n owners,\n payoutRecipient,\n marketCap: convertEthOutput(marketCap, wethPriceInUsdc),\n liquidity: convertEthOutput(\n wethLiquidity + tokenLiquidity,\n wethPriceInUsdc,\n ),\n poolState: coinWethPoolSlot0,\n };\n}\n\nfunction convertEthOutput(amountETH: bigint, wethToUsdc: bigint | null) {\n return {\n eth: amountETH,\n ethDecimal: parseFloat(formatEther(amountETH)),\n usdc: wethToUsdc ? amountETH * wethToUsdc : null,\n usdcDecimal: wethToUsdc\n ? parseFloat(formatEther((amountETH * wethToUsdc) / 10n ** 18n))\n : null,\n };\n}\n\nfunction uniswapV3SqrtPriceToBigIntScaled(\n sqrtPriceX96: bigint,\n token0Decimals: number,\n token1Decimals: number,\n isToken0Coin: boolean,\n scaleDecimals: number = 18,\n): bigint {\n // (sqrtPrice^2 / 2^192) => ratio\n // We'll do: ratioScaled = (sqrtPrice^2 * 10^scaleDecimals) / 2^192\n const numerator = sqrtPriceX96 * sqrtPriceX96;\n const denominator = 2n ** 192n;\n const scaleFactor = 10n ** BigInt(scaleDecimals);\n\n // raw ratioScaled\n let ratioScaled = (numerator * scaleFactor) / denominator; // BigInt\n\n // Adjust for difference in decimals:\n // ratioScaled *= 10^(dec0 - dec1)\n const decimalsDiff = BigInt(token0Decimals - token1Decimals);\n if (decimalsDiff > 0n) {\n ratioScaled *= 10n ** decimalsDiff;\n } else if (decimalsDiff < 0n) {\n ratioScaled /= 10n ** -decimalsDiff;\n }\n\n if (!isToken0Coin) {\n // We want the reciprocal: coin is token1 => coinPriceInToken0 = 1 / ratio\n // But we also want it scaled by 10^scaleDecimals\n // reciprocalScaled = (10^scaleDecimals * 10^(decimalsDiff)) / ratioScaled\n // (assuming ratioScaled != 0)\n if (ratioScaled === 0n) {\n return 0n; // or some huge number representing infinity\n }\n ratioScaled = (scaleFactor * scaleFactor) / ratioScaled;\n // or if we already included decimalsDiff above, handle carefully.\n }\n\n return ratioScaled;\n}\n","import { coinABI } from \"@zoralabs/protocol-deployments\";\nimport { validateClientNetwork } from \"../utils/validateClientNetwork\";\nimport {\n Address,\n parseEventLogs,\n SimulateContractParameters,\n WalletClient,\n} from \"viem\";\nimport { GenericPublicClient } from \"src/utils/genericPublicClient\";\nimport { getAttribution } from \"../utils/attribution\";\n\nexport type UpdateCoinURIArgs = {\n coin: Address;\n newURI: string;\n};\n\nexport function updateCoinURICall({\n newURI,\n coin,\n}: UpdateCoinURIArgs): SimulateContractParameters {\n if (!newURI.startsWith(\"ipfs://\")) {\n throw new Error(\"URI needs to be an ipfs:// prefix uri\");\n }\n\n return {\n abi: coinABI,\n address: coin,\n functionName: \"setContractURI\",\n args: [newURI],\n dataSuffix: getAttribution(),\n };\n}\n\nexport async function updateCoinURI(\n args: UpdateCoinURIArgs,\n walletClient: WalletClient,\n publicClient: GenericPublicClient,\n) {\n validateClientNetwork(publicClient);\n const call = updateCoinURICall(args);\n const { request } = await publicClient.simulateContract({\n ...call,\n account: walletClient.account!,\n });\n const hash = await walletClient.writeContract(request);\n const receipt = await publicClient.waitForTransactionReceipt({ hash });\n const eventLogs = parseEventLogs({ abi: coinABI, logs: receipt.logs });\n const uriUpdated = eventLogs.find(\n (log) => log.eventName === \"ContractURIUpdated\",\n );\n\n return { hash, receipt, uriUpdated };\n}\n","import { coinABI } from \"@zoralabs/protocol-deployments\";\nimport { validateClientNetwork } from \"../utils/validateClientNetwork\";\nimport {\n Address,\n parseEventLogs,\n SimulateContractParameters,\n WalletClient,\n} from \"viem\";\nimport { GenericPublicClient } from \"src/utils/genericPublicClient\";\nimport { getAttribution } from \"../utils/attribution\";\n\nexport type UpdatePayoutRecipientArgs = {\n coin: Address;\n newPayoutRecipient: string;\n};\n\nexport function updatePayoutRecipientCall({\n newPayoutRecipient,\n coin,\n}: UpdatePayoutRecipientArgs): SimulateContractParameters {\n return {\n abi: coinABI,\n address: coin,\n functionName: \"setPayoutRecipient\",\n args: [newPayoutRecipient],\n dataSuffix: getAttribution(),\n };\n}\n\nexport async function updatePayoutRecipient(\n args: UpdatePayoutRecipientArgs,\n walletClient: WalletClient,\n publicClient: GenericPublicClient,\n) {\n validateClientNetwork(publicClient);\n const call = updatePayoutRecipientCall(args);\n const { request } = await publicClient.simulateContract({\n ...call,\n account: walletClient.account!,\n });\n const hash = await walletClient.writeContract(request);\n const receipt = await publicClient.waitForTransactionReceipt({ hash });\n const eventLogs = parseEventLogs({ abi: coinABI, logs: receipt.logs });\n const payoutRecipientUpdated = eventLogs.find(\n (log) => log.eventName === \"CoinPayoutRecipientUpdated\",\n );\n\n return { hash, receipt, payoutRecipientUpdated };\n}\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type { ClientOptions } from \"./types.gen\";\nimport {\n type Config,\n type ClientOptions as DefaultClientOptions,\n createClient,\n createConfig,\n} from \"@hey-api/client-fetch\";\n\n/**\n * The `createClientConfig()` function will be called on client initialization\n * and the returned object will become the client's initial configuration.\n *\n * You may want to initialize your client this way instead of calling\n * `setConfig()`. This is useful for example if you're using Next.js\n * to ensure your client always has the correct values.\n */\nexport type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> =\n (\n override?: Config<DefaultClientOptions & T>,\n ) => Config<Required<DefaultClientOptions> & T>;\n\nexport const client = createClient(\n createConfig<ClientOptions>({\n baseUrl: \"https://api-sdk.zora.engineering/\",\n }),\n);\n","// This file is auto-generated by @hey-api/openapi-ts\n\nimport type {\n Options as ClientOptions,\n TDataShape,\n Client,\n} from \"@hey-api/client-fetch\";\nimport type {\n GetApiKeyData,\n GetApiKeyResponse,\n GetCoinData,\n GetCoinResponse,\n GetCoinCommentsData,\n GetCoinCommentsResponse,\n GetCoinsData,\n GetCoinsResponse,\n SetCreateUploadJwtData,\n SetCreateUploadJwtResponse,\n GetExploreData,\n GetExploreResponse,\n GetProfileData,\n GetProfileResponse,\n GetProfileBalancesData,\n GetProfileBalancesResponse,\n GetProfileCoinsData,\n GetProfileCoinsResponse,\n} from \"./types.gen\";\nimport { client as _heyApiClient } from \"./client.gen\";\n\nexport type Options<\n TData extends TDataShape = TDataShape,\n ThrowOnError extends boolean = boolean,\n> = ClientOptions<TData, ThrowOnError> & {\n /**\n * You can provide a client instance returned by `createClient()` instead of\n * individual options. This might be also useful if you want to implement a\n * custom client.\n */\n client?: Client;\n /**\n * You can pass arbitrary values through the `meta` object. This can be\n * used to access values that aren't defined as part of the SDK function.\n */\n meta?: Record<string, unknown>;\n};\n\n/**\n * zoraSDK_apiKey query\n */\nexport const getApiKey = <ThrowOnError extends boolean = false>(\n options: Options<GetApiKeyData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetApiKeyResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/apiKey\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_coin query\n */\nexport const getCoin = <ThrowOnError extends boolean = false>(\n options: Options<GetCoinData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetCoinResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/coin\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_coinComments query\n */\nexport const getCoinComments = <ThrowOnError extends boolean = false>(\n options: Options<GetCoinCommentsData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetCoinCommentsResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/coinComments\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_coins query\n */\nexport const getCoins = <ThrowOnError extends boolean = false>(\n options: Options<GetCoinsData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetCoinsResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/coins\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_createUploadJWT mutation\n */\nexport const setCreateUploadJwt = <ThrowOnError extends boolean = false>(\n options?: Options<SetCreateUploadJwtData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).post<\n SetCreateUploadJwtResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/createUploadJWT\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n },\n });\n};\n\n/**\n * zoraSDK_explore query\n */\nexport const getExplore = <ThrowOnError extends boolean = false>(\n options: Options<GetExploreData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetExploreResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/explore\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_profile query\n */\nexport const getProfile = <ThrowOnError extends boolean = false>(\n options: Options<GetProfileData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetProfileResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/profile\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_profileBalances query\n */\nexport const getProfileBalances = <ThrowOnError extends boolean = false>(\n options: Options<GetProfileBalancesData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetProfileBalancesResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/profileBalances\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_profileCoins query\n */\nexport const getProfileCoins = <ThrowOnError extends boolean = false>(\n options: Options<GetProfileCoinsData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetProfileCoinsResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/profileCoins\",\n ...options,\n });\n};\n","let apiKey: string | undefined;\nexport function setApiKey(key: string) {\n apiKey = key;\n}\n\nexport function getApiKeyMeta() {\n if (!apiKey) {\n return {};\n }\n return {\n headers: {\n \"api-key\": apiKey,\n },\n };\n}\n","import {\n GetCoinCommentsData,\n GetCoinCommentsResponse,\n GetCoinData,\n GetCoinResponse,\n GetCoinsData,\n GetCoinsResponse,\n GetProfileBalancesData,\n GetProfileBalancesResponse,\n GetProfileCoinsData,\n GetProfileCoinsResponse,\n GetProfileData,\n GetProfileResponse,\n} from \"../client/types.gen\";\nimport {\n getCoin as getCoinSDK,\n getCoins as getCoinsSDK,\n getCoinComments as getCoinCommentsSDK,\n getProfile as getProfileSDK,\n getProfileBalances as getProfileBalancesSDK,\n getProfileCoins as getProfileCoinsSDK,\n} from \"../client/sdk.gen\";\nimport { getApiKeyMeta } from \"./api-key\";\nimport { RequestOptionsType } from \"./query-types\";\nimport { RequestResult } from \"@hey-api/client-fetch\";\n\nexport type { RequestResult };\n\ntype GetCoinQuery = GetCoinData[\"query\"];\nexport type { GetCoinQuery, GetCoinData };\nexport type { GetCoinResponse } from \"../client/types.gen\";\n\nexport type CoinData = NonNullable<GetCoinResponse[\"zora20Token\"]>;\n\nexport const getCoin = async (\n query: GetCoinQuery,\n options?: RequestOptionsType<GetCoinData>,\n): Promise<RequestResult<GetCoinResponse>> => {\n return await getCoinSDK({\n ...options,\n query,\n meta: getApiKeyMeta(),\n });\n};\n\ntype GetCoinsQuery = GetCoinsData[\"query\"];\nexport type { GetCoinsQuery, GetCoinsData };\nexport type { GetCoinsResponse } from \"../client/types.gen\";\n\nexport const getCoins = async (\n query: GetCoinsQuery,\n options?: RequestOptionsType<GetCoinsData>,\n): Promise<RequestResult<GetCoinsResponse>> => {\n return await getCoinsSDK({\n query: {\n coins: query.coins.map((coinData) => JSON.stringify(coinData)) as any,\n },\n meta: getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetCoinCommentsQuery = GetCoinCommentsData[\"query\"];\nexport type { GetCoinCommentsQuery, GetCoinCommentsData };\nexport type { GetCoinCommentsResponse } from \"../client/types.gen\";\n\nexport const getCoinComments = async (\n query: GetCoinCommentsQuery,\n options?: RequestOptionsType<GetCoinCommentsData>,\n): Promise<RequestResult<GetCoinCommentsResponse>> => {\n return await getCoinCommentsSDK({\n query,\n meta: getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetProfileQuery = GetProfileData[\"query\"];\nexport type { GetProfileQuery, GetProfileData };\nexport type { GetProfileResponse } from \"../client/types.gen\";\n\nexport const getProfile = async (\n query: GetProfileQuery,\n options?: RequestOptionsType<GetProfileData>,\n): Promise<RequestResult<GetProfileResponse>> => {\n return await getProfileSDK({\n query,\n meta: getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetProfileCoinsQuery = GetProfileCoinsData[\"query\"];\nexport type { GetProfileCoinsQuery, GetProfileCoinsData };\nexport type { GetProfileCoinsResponse } from \"../client/types.gen\";\n\nexport const getProfileCoins = async (\n query: GetProfileCoinsQuery,\n options?: RequestOptionsType<GetProfileCoinsData>,\n): Promise<RequestResult<GetProfileCoinsResponse>> => {\n return await getProfileCoinsSDK({\n query,\n meta: getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetProfileBalancesQuery = GetProfileBalancesData[\"query\"];\nexport type { GetProfileBalancesQuery, GetProfileBalancesData };\nexport type { GetProfileBalancesResponse } from \"../client/types.gen\";\n\nexport const getProfileBalances = async (\n query: GetProfileBalancesQuery,\n options?: RequestOptionsType<GetProfileBalancesData>,\n): Promise<RequestResult<GetProfileBalancesResponse>> => {\n return await getProfileBalancesSDK({\n query,\n meta: getApiKeyMeta(),\n ...options,\n });\n};\n","import { getExplore as getExploreSDK } from \"../client/sdk.gen\";\nimport type { GetExploreData, GetExploreResponse } from \"../client/types.gen\";\nimport { getApiKeyMeta } from \"./api-key\";\nimport { RequestOptionsType } from \"./query-types\";\n\n/**\n * The inner type for the explore queries that omits listType.\n * This is used to create the query object for the explore queries.\n */\nexport type QueryRequestType = Omit<GetExploreData[\"query\"], \"listType\">;\n\ntype ExploreResponse = { data?: GetExploreResponse };\n\nexport type ListType = GetExploreData[\"query\"][\"listType\"];\n\nexport type { ExploreResponse };\n\nexport type { GetExploreData };\n\n/**\n * Creates an explore query with the specified list type\n */\nconst createExploreQuery = (\n query: QueryRequestType,\n listType: ListType,\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n getExploreSDK({\n ...options,\n query: { ...query, listType },\n meta: getApiKeyMeta(),\n });\n\n/** Get top gaining coins */\nexport const getCoinsTopGainers = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TOP_GAINERS\", options);\n\n/** Get coins with highest 24h volume */\nexport const getCoinsTopVolume24h = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TOP_VOLUME_24H\", options);\n\n/** Get most valuable coins */\nexport const getCoinsMostValuable = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"MOST_VALUABLE\", options);\n\n/** Get newly created coins */\nexport const getCoinsNew = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> => createExploreQuery(query, \"NEW\", options);\n\n/** Get recently traded coins */\nexport const getCoinsLastTraded = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"LAST_TRADED\", options);\n\n/** Get recently traded unique coins */\nexport const getCoinsLastTradedUnique = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"LAST_TRADED_UNIQUE\", options);\n"],"mappings":";AAAA,SAAS,kBAAkB,0BAA0B;AACrD;AAAA,EAME;AAAA,EACA,eAAAA;AAAA,EACA,aAAAC;AAAA,EACA;AAAA,OAGK;;;ACbP,SAAS,sBAAsB,8BAA8B;AAE7D,SAAS,YAAY;AAGd,IAAM,uBAAuB,uBAAuB,MAAM;AAE1D,IAAM,0BACX;AAEK,IAAM,2BAAoD;AAAA,EAC/D,CAAC,KAAK,EAAE,GAAG;AACb;;;ACXA,SAAS,QAAAC,OAAM,mBAAmB;AAE3B,IAAM,wBAAwB,CACnC,iBACG;AACH,QAAM,gBAAgB,cAA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WAAc;AAAA,IACzB;AAAA,IACA,MAAM,cAAc;AAAA,IACpB,GAAG;AAAA,EACL,CAAC;AACH;AAMO,IAAMC,mBAAkB,OAC7B,OACA,YACoD;AACpD,SAAO,MAAM,gBAAmB;AAAA,IAC9B;AAAA,IACA,MAAM,cAAc;AAAA,IACpB,GAAG;AAAA,EACL,CAAC;AACH;AAMO,IAAMC,sBAAqB,OAChC,OACA,YACuD;AACvD,SAAO,MAAM,mBAAsB;AAAA,IACjC;AAAA,IACA,MAAM,cAAc;AAAA,IACpB,GAAG;AAAA,EACL,CAAC;AACH;;;AClGA,IAAM,qBAAqB,CACzB,OACA,UACA,YAEA,WAAc;AAAA,EACZ,GAAG;AAAA,EACH,OAAO,EAAE,GAAG,OAAO,SAAS;AAAA,EAC5B,MAAM,cAAc;AACtB,CAAC;AAGI,IAAM,qBAAqB,CAChC,QAA0B,CAAC,GAC3B,YAEA,mBAAmB,OAAO,eAAe,OAAO;AAG3C,IAAM,uBAAuB,CAClC,QAA0B,CAAC,GAC3B,YAEA,mBAAmB,OAAO,kBAAkB,OAAO;AAG9C,IAAM,uBAAuB,CAClC,QAA0B,CAAC,GAC3B,YAEA,mBAAmB,OAAO,iBAAiB,OAAO;AAG7C,IAAM,cAAc,CACzB,QAA0B,CAAC,GAC3B,YAC6B,mBAAmB,OAAO,OAAO,OAAO;AAGhE,IAAM,qBAAqB,CAChC,QAA0B,CAAC,GAC3B,YAEA,mBAAmB,OAAO,eAAe,OAAO;AAG3C,IAAM,2BAA2B,CACtC,QAA0B,CAAC,GAC3B,YAEA,mBAAmB,OAAO,sBAAsB,OAAO;","names":["zeroAddress","keccak256","base","base","baseSepolia","base","baseSepolia","DeployCurrency","baseSepolia","base","zeroAddress","keccak256","zeroAddress","parseEventLogs","baseSepolia","zeroAddress","baseSepolia","parseEventLogs","coinABI","zeroAddress","coinABI","coinABI","parseEventLogs","coinABI","parseEventLogs","coinABI","parseEventLogs","coinABI","parseEventLogs","getCoin","getCoins","getCoinComments","getProfile","getProfileCoins","getProfileBalances"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zoralabs/coins-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "repository": "https://github.com/ourzora/zora-protocol",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -0,0 +1,23 @@
1
+ import {
2
+ SetCreateUploadJwtData,
3
+ SetCreateUploadJwtResponse,
4
+ } from "../client/types.gen";
5
+ import { setCreateUploadJwt as setCreateUploadJwtSDK } from "../client/sdk.gen";
6
+ import { getApiKeyMeta } from "./api-key";
7
+ import { RequestOptionsType } from "./query-types";
8
+ import { RequestResult } from "@hey-api/client-fetch";
9
+
10
+ type SetCreateUploadJwtQuery = SetCreateUploadJwtData["query"];
11
+ export type { SetCreateUploadJwtQuery, SetCreateUploadJwtData };
12
+ export type { SetCreateUploadJwtResponse } from "../client/types.gen";
13
+
14
+ export const setCreateUploadJwt = async (
15
+ query: SetCreateUploadJwtQuery,
16
+ options?: RequestOptionsType<SetCreateUploadJwtData>,
17
+ ): Promise<RequestResult<SetCreateUploadJwtResponse>> => {
18
+ return await setCreateUploadJwtSDK({
19
+ query,
20
+ meta: getApiKeyMeta(),
21
+ ...options,
22
+ });
23
+ };
@@ -7,6 +7,8 @@ import {
7
7
  GetCoinsResponse,
8
8
  GetProfileBalancesData,
9
9
  GetProfileBalancesResponse,
10
+ GetProfileCoinsData,
11
+ GetProfileCoinsResponse,
10
12
  GetProfileData,
11
13
  GetProfileResponse,
12
14
  } from "../client/types.gen";
@@ -16,6 +18,7 @@ import {
16
18
  getCoinComments as getCoinCommentsSDK,
17
19
  getProfile as getProfileSDK,
18
20
  getProfileBalances as getProfileBalancesSDK,
21
+ getProfileCoins as getProfileCoinsSDK,
19
22
  } from "../client/sdk.gen";
20
23
  import { getApiKeyMeta } from "./api-key";
21
24
  import { RequestOptionsType } from "./query-types";
@@ -87,6 +90,21 @@ export const getProfile = async (
87
90
  });
88
91
  };
89
92
 
93
+ type GetProfileCoinsQuery = GetProfileCoinsData["query"];
94
+ export type { GetProfileCoinsQuery, GetProfileCoinsData };
95
+ export type { GetProfileCoinsResponse } from "../client/types.gen";
96
+
97
+ export const getProfileCoins = async (
98
+ query: GetProfileCoinsQuery,
99
+ options?: RequestOptionsType<GetProfileCoinsData>,
100
+ ): Promise<RequestResult<GetProfileCoinsResponse>> => {
101
+ return await getProfileCoinsSDK({
102
+ query,
103
+ meta: getApiKeyMeta(),
104
+ ...options,
105
+ });
106
+ };
107
+
90
108
  type GetProfileBalancesQuery = GetProfileBalancesData["query"];
91
109
  export type { GetProfileBalancesQuery, GetProfileBalancesData };
92
110
  export type { GetProfileBalancesResponse } from "../client/types.gen";
@@ -6,18 +6,24 @@ import type {
6
6
  Client,
7
7
  } from "@hey-api/client-fetch";
8
8
  import type {
9
+ GetApiKeyData,
10
+ GetApiKeyResponse,
9
11
  GetCoinData,
10
12
  GetCoinResponse,
11
13
  GetCoinCommentsData,
12
14
  GetCoinCommentsResponse,
13
15
  GetCoinsData,
14
16
  GetCoinsResponse,
17
+ SetCreateUploadJwtData,
18
+ SetCreateUploadJwtResponse,
15
19
  GetExploreData,
16
20
  GetExploreResponse,
17
21
  GetProfileData,
18
22
  GetProfileResponse,
19
23
  GetProfileBalancesData,
20
24
  GetProfileBalancesResponse,
25
+ GetProfileCoinsData,
26
+ GetProfileCoinsResponse,
21
27
  } from "./types.gen";
22
28
  import { client as _heyApiClient } from "./client.gen";
23
29
 
@@ -38,6 +44,28 @@ export type Options<
38
44
  meta?: Record<string, unknown>;
39
45
  };
40
46
 
47
+ /**
48
+ * zoraSDK_apiKey query
49
+ */
50
+ export const getApiKey = <ThrowOnError extends boolean = false>(
51
+ options: Options<GetApiKeyData, ThrowOnError>,
52
+ ) => {
53
+ return (options.client ?? _heyApiClient).get<
54
+ GetApiKeyResponse,
55
+ unknown,
56
+ ThrowOnError
57
+ >({
58
+ security: [
59
+ {
60
+ name: "api-key",
61
+ type: "apiKey",
62
+ },
63
+ ],
64
+ url: "/apiKey",
65
+ ...options,
66
+ });
67
+ };
68
+
41
69
  /**
42
70
  * zoraSDK_coin query
43
71
  */
@@ -49,6 +77,12 @@ export const getCoin = <ThrowOnError extends boolean = false>(
49
77
  unknown,
50
78
  ThrowOnError
51
79
  >({
80
+ security: [
81
+ {
82
+ name: "api-key",
83
+ type: "apiKey",
84
+ },
85
+ ],
52
86
  url: "/coin",
53
87
  ...options,
54
88
  });
@@ -65,6 +99,12 @@ export const getCoinComments = <ThrowOnError extends boolean = false>(
65
99
  unknown,
66
100
  ThrowOnError
67
101
  >({
102
+ security: [
103
+ {
104
+ name: "api-key",
105
+ type: "apiKey",
106
+ },
107
+ ],
68
108
  url: "/coinComments",
69
109
  ...options,
70
110
  });
@@ -81,11 +121,43 @@ export const getCoins = <ThrowOnError extends boolean = false>(
81
121
  unknown,
82
122
  ThrowOnError
83
123
  >({
124
+ security: [
125
+ {
126
+ name: "api-key",
127
+ type: "apiKey",
128
+ },
129
+ ],
84
130
  url: "/coins",
85
131
  ...options,
86
132
  });
87
133
  };
88
134
 
135
+ /**
136
+ * zoraSDK_createUploadJWT mutation
137
+ */
138
+ export const setCreateUploadJwt = <ThrowOnError extends boolean = false>(
139
+ options?: Options<SetCreateUploadJwtData, ThrowOnError>,
140
+ ) => {
141
+ return (options?.client ?? _heyApiClient).post<
142
+ SetCreateUploadJwtResponse,
143
+ unknown,
144
+ ThrowOnError
145
+ >({
146
+ security: [
147
+ {
148
+ name: "api-key",
149
+ type: "apiKey",
150
+ },
151
+ ],
152
+ url: "/createUploadJWT",
153
+ ...options,
154
+ headers: {
155
+ "Content-Type": "application/json",
156
+ ...options?.headers,
157
+ },
158
+ });
159
+ };
160
+
89
161
  /**
90
162
  * zoraSDK_explore query
91
163
  */
@@ -97,6 +169,12 @@ export const getExplore = <ThrowOnError extends boolean = false>(
97
169
  unknown,
98
170
  ThrowOnError
99
171
  >({
172
+ security: [
173
+ {
174
+ name: "api-key",
175
+ type: "apiKey",
176
+ },
177
+ ],
100
178
  url: "/explore",
101
179
  ...options,
102
180
  });
@@ -113,6 +191,12 @@ export const getProfile = <ThrowOnError extends boolean = false>(
113
191
  unknown,
114
192
  ThrowOnError
115
193
  >({
194
+ security: [
195
+ {
196
+ name: "api-key",
197
+ type: "apiKey",
198
+ },
199
+ ],
116
200
  url: "/profile",
117
201
  ...options,
118
202
  });
@@ -129,7 +213,35 @@ export const getProfileBalances = <ThrowOnError extends boolean = false>(
129
213
  unknown,
130
214
  ThrowOnError
131
215
  >({
216
+ security: [
217
+ {
218
+ name: "api-key",
219
+ type: "apiKey",
220
+ },
221
+ ],
132
222
  url: "/profileBalances",
133
223
  ...options,
134
224
  });
135
225
  };
226
+
227
+ /**
228
+ * zoraSDK_profileCoins query
229
+ */
230
+ export const getProfileCoins = <ThrowOnError extends boolean = false>(
231
+ options: Options<GetProfileCoinsData, ThrowOnError>,
232
+ ) => {
233
+ return (options.client ?? _heyApiClient).get<
234
+ GetProfileCoinsResponse,
235
+ unknown,
236
+ ThrowOnError
237
+ >({
238
+ security: [
239
+ {
240
+ name: "api-key",
241
+ type: "apiKey",
242
+ },
243
+ ],
244
+ url: "/profileCoins",
245
+ ...options,
246
+ });
247
+ };