@zoralabs/coins-sdk 0.6.0 → 0.7.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/utils/validateClientNetwork.ts","../src/metadata/cleanAndValidateMetadataURI.ts","../src/metadata/validateMetadataJSON.ts","../src/metadata/validateMetadataURIContent.ts","../src/utils/getChainFromId.ts","../src/client/client.gen.ts","../src/client/sdk.gen.ts","../src/api/api-key.ts","../src/api/explore.ts","../src/api/queries.ts","../src/api/create.ts","../src/api/social.ts","../src/utils/rethrowDecodedRevert.ts","../src/actions/updateCoinURI.ts","../src/utils/attribution.ts","../src/actions/updatePayoutRecipient.ts","../src/actions/tradeCoin.ts","../src/api/api-raw.ts","../src/uploader/metadata.ts","../src/api/internal.ts","../src/uploader/providers/zora.ts"],"sourcesContent":["import {\n coinFactoryAddress,\n coinFactoryABI as zoraFactoryImplABI,\n} from \"@zoralabs/protocol-deployments\";\nimport {\n Address,\n TransactionReceipt,\n WalletClient,\n ContractEventArgsFromTopics,\n parseEventLogs,\n Hex,\n Account,\n isAddressEqual,\n} from \"viem\";\nimport { base } from \"viem/chains\";\nimport { validateClientNetwork } from \"../utils/validateClientNetwork\";\nimport { GenericPublicClient } from \"../utils/genericPublicClient\";\nimport { validateMetadataURIContent } from \"../metadata\";\nimport { ValidMetadataURI } from \"../uploader/types\";\nimport { getChainFromId } from \"../utils/getChainFromId\";\nimport { postCreateContent } from \"../api\";\nimport { rethrowDecodedRevert } from \"../utils/rethrowDecodedRevert\";\n\nexport type CoinDeploymentLogArgs = ContractEventArgsFromTopics<\n typeof zoraFactoryImplABI,\n \"CoinCreatedV4\"\n>;\n\nconst STARTING_MARKET_CAPS = {\n LOW: \"LOW\",\n HIGH: \"HIGH\",\n} as const;\nexport type StartingMarketCap = keyof typeof STARTING_MARKET_CAPS;\n\nexport interface RawUriMetadata {\n type: \"RAW_URI\";\n uri: string;\n}\n\nconst CONTENT_COIN_CURRENCIES = {\n CREATOR_COIN: \"CREATOR_COIN\",\n ZORA: \"ZORA\",\n ETH: \"ETH\",\n CREATOR_COIN_OR_ZORA: \"CREATOR_COIN_OR_ZORA\",\n} as const;\nexport type ContentCoinCurrency = keyof typeof CONTENT_COIN_CURRENCIES;\n\nexport const CreateConstants = {\n StartingMarketCaps: STARTING_MARKET_CAPS,\n ContentCoinCurrencies: CONTENT_COIN_CURRENCIES,\n} as const;\n\nexport type CreateCoinArgs = {\n creator: string;\n name: string;\n symbol: string;\n metadata: RawUriMetadata;\n currency: ContentCoinCurrency;\n chainId?: number;\n startingMarketCap?: StartingMarketCap;\n platformReferrer?: string;\n additionalOwners?: Address[];\n payoutRecipientOverride?: Address;\n skipMetadataValidation?: boolean;\n};\n\ntype TransactionParameters = {\n to: Address;\n data: Hex;\n value: bigint;\n};\n\ntype CreateCoinCallResponse = {\n calls: TransactionParameters[];\n predictedCoinAddress: Address;\n};\n\nexport async function createCoinCall({\n creator,\n name,\n symbol,\n metadata,\n currency,\n chainId = base.id,\n payoutRecipientOverride,\n additionalOwners,\n platformReferrer,\n skipMetadataValidation = false,\n}: CreateCoinArgs): Promise<CreateCoinCallResponse> {\n // Validate metadata URI\n if (!skipMetadataValidation) {\n await validateMetadataURIContent(metadata.uri as ValidMetadataURI);\n }\n\n const createContentRequest = await postCreateContent({\n currency,\n chainId,\n metadata,\n creator,\n name,\n symbol,\n platformReferrer,\n additionalOwners,\n payoutRecipientOverride,\n });\n\n if (!createContentRequest.data?.calls) {\n throw new Error(\"Failed to create content calldata\");\n }\n\n return {\n calls: createContentRequest.data.calls.map((data) => ({\n to: data.to as Address,\n data: data.data as Hex,\n value: BigInt(data.value),\n })),\n predictedCoinAddress: createContentRequest.data\n .predictedCoinAddress as Address,\n };\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,\n walletClient,\n publicClient,\n options,\n}: {\n call: CreateCoinArgs;\n walletClient: WalletClient;\n publicClient: GenericPublicClient;\n options?: {\n gasMultiplier?: number;\n account?: Account | Address;\n skipValidateTransaction?: boolean;\n };\n}) {\n validateClientNetwork(publicClient);\n\n const chainId = call.chainId ?? publicClient.chain.id;\n\n const callRequest = await createCoinCall({\n ...call,\n chainId,\n });\n\n if (callRequest.calls.length !== 1) {\n throw new Error(\"Only one call is supported for this SDK version\");\n }\n\n const createContentCall = callRequest.calls[0];\n\n if (!createContentCall) {\n throw new Error(\"Failed to load create content calldata from API\");\n }\n\n const coinFactoryAddressForChain =\n coinFactoryAddress[call.chainId as keyof typeof coinFactoryAddress];\n\n // Sanity check that the call is for the correct factory contract\n if (!isAddressEqual(createContentCall.to, coinFactoryAddressForChain)) {\n throw new Error(\"Creator coin is not supported for this SDK version\");\n }\n\n // Sanity check to ensure no buy orders are sent with there parameters\n if (createContentCall.value !== 0n) {\n throw new Error(\n \"Creator coin and purchase is not supported for this SDK version.\",\n );\n }\n\n // Prefer a LocalAccount from the wallet client when available to ensure\n // offline signing (eth_sendRawTransaction) instead of wallet_sendTransaction\n // which can error when a `from` field is present.\n const selectedAccount =\n (typeof options?.account === \"string\" ? undefined : options?.account) ??\n walletClient.account;\n\n if (!selectedAccount) {\n throw new Error(\"Account is required\");\n }\n\n const viemCall = {\n ...createContentCall,\n account: selectedAccount,\n };\n\n // simulate call\n if (!options?.skipValidateTransaction) {\n try {\n await publicClient.call(viemCall);\n } catch (err) {\n rethrowDecodedRevert(err, zoraFactoryImplABI);\n }\n }\n\n const gasEstimate = options?.skipValidateTransaction\n ? 10_000_000n\n : await publicClient.estimateGas(viemCall);\n const gasPrice = await publicClient.getGasPrice();\n\n const hash = await (async () => {\n try {\n return await walletClient.sendTransaction({\n ...viemCall,\n gasPrice,\n gas: gasEstimate,\n chain: publicClient.chain,\n });\n } catch (err) {\n rethrowDecodedRevert(err, zoraFactoryImplABI);\n }\n })();\n\n const receipt = await publicClient.waitForTransactionReceipt({\n hash,\n });\n\n const deployment = getCoinCreateFromLogs(receipt);\n\n return {\n hash,\n receipt,\n address: deployment?.coin,\n deployment,\n chain: getChainFromId(publicClient.chain.id),\n };\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","import { ValidMetadataURI } from \"../uploader/types\";\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 { cleanAndValidateMetadataURI } from \"./cleanAndValidateMetadataURI\";\nimport { ValidMetadataURI } from \"../uploader/types\";\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 { base, baseSepolia, Chain } from \"viem/chains\";\n\nexport function getChainFromId(chainId: number): Chain {\n if (chainId === base.id) {\n return base;\n }\n if (chainId === baseSepolia.id) {\n return baseSepolia;\n }\n\n throw new Error(`Chain ID ${chainId} not supported`);\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 GetCoinHoldersData,\n GetCoinHoldersResponse,\n GetCoinPriceHistoryData,\n GetCoinPriceHistoryResponse,\n GetCoinSwapsData,\n GetCoinSwapsResponse,\n GetCoinsData,\n GetCoinsResponse,\n GetCoinsListData,\n GetCoinsListResponse,\n GetContentCoinPoolConfigData,\n GetContentCoinPoolConfigResponse,\n SetCreateUploadJwtData,\n SetCreateUploadJwtResponse,\n GetCreatorCoinPoolConfigData,\n GetCreatorCoinPoolConfigResponse,\n GetCreatorLivestreamCommentsData,\n GetCreatorLivestreamCommentsResponse,\n GetExploreData,\n GetExploreResponse,\n GetFeaturedCreatorsData,\n GetFeaturedCreatorsResponse,\n GetLatestLiveStreamsData,\n GetLatestLiveStreamsResponse,\n GetProfileData,\n GetProfileResponse,\n GetProfileBalancesData,\n GetProfileBalancesResponse,\n GetProfileBySocialHandleData,\n GetProfileBySocialHandleResponse,\n GetProfileCoinsData,\n GetProfileCoinsResponse,\n GetProfileSocialData,\n GetProfileSocialResponse,\n GetTokenInfoData,\n GetTokenInfoResponse,\n GetTopLiveStreamsData,\n GetTopLiveStreamsResponse,\n GetTraderLeaderboardData,\n GetTraderLeaderboardResponse,\n GetTrendCoinData,\n GetTrendCoinResponse,\n GetTrendsByNameData,\n GetTrendsByNameResponse,\n GetWalletTradeActivityData,\n GetWalletTradeActivityResponse,\n PostQuoteData,\n PostQuoteResponse,\n PostQuoteError,\n PostCreateContentData,\n PostCreateContentResponse,\n PostCreateContentError,\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_coinHolders query\n */\nexport const getCoinHolders = <ThrowOnError extends boolean = false>(\n options: Options<GetCoinHoldersData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetCoinHoldersResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/coinHolders\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_coinPriceHistory query\n */\nexport const getCoinPriceHistory = <ThrowOnError extends boolean = false>(\n options: Options<GetCoinPriceHistoryData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetCoinPriceHistoryResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/coinPriceHistory\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_coinSwaps query\n */\nexport const getCoinSwaps = <ThrowOnError extends boolean = false>(\n options: Options<GetCoinSwapsData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetCoinSwapsResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/coinSwaps\",\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_coinsList query\n */\nexport const getCoinsList = <ThrowOnError extends boolean = false>(\n options?: Options<GetCoinsListData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).get<\n GetCoinsListResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/coinsList\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_contentCoinPoolConfig query\n */\nexport const getContentCoinPoolConfig = <ThrowOnError extends boolean = false>(\n options: Options<GetContentCoinPoolConfigData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetContentCoinPoolConfigResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/contentCoinPoolConfig\",\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_creatorCoinPoolConfig query\n */\nexport const getCreatorCoinPoolConfig = <ThrowOnError extends boolean = false>(\n options?: Options<GetCreatorCoinPoolConfigData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).get<\n GetCreatorCoinPoolConfigResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/creatorCoinPoolConfig\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_creatorLivestreamComments query\n */\nexport const getCreatorLivestreamComments = <\n ThrowOnError extends boolean = false,\n>(\n options: Options<GetCreatorLivestreamCommentsData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetCreatorLivestreamCommentsResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/creatorLivestreamComments\",\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 security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/explore\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_featuredCreators query\n */\nexport const getFeaturedCreators = <ThrowOnError extends boolean = false>(\n options?: Options<GetFeaturedCreatorsData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).get<\n GetFeaturedCreatorsResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/featuredCreators\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_latestLiveStreams query\n */\nexport const getLatestLiveStreams = <ThrowOnError extends boolean = false>(\n options?: Options<GetLatestLiveStreamsData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).get<\n GetLatestLiveStreamsResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/latestLiveStreams\",\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_profileBySocialHandle query\n */\nexport const getProfileBySocialHandle = <ThrowOnError extends boolean = false>(\n options: Options<GetProfileBySocialHandleData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetProfileBySocialHandleResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/profileBySocialHandle\",\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\n/**\n * zoraSDK_profileSocial query\n */\nexport const getProfileSocial = <ThrowOnError extends boolean = false>(\n options: Options<GetProfileSocialData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetProfileSocialResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/profileSocial\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_tokenInfo query\n */\nexport const getTokenInfo = <ThrowOnError extends boolean = false>(\n options: Options<GetTokenInfoData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetTokenInfoResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/tokenInfo\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_topLiveStreams query\n */\nexport const getTopLiveStreams = <ThrowOnError extends boolean = false>(\n options?: Options<GetTopLiveStreamsData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).get<\n GetTopLiveStreamsResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/topLiveStreams\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_traderLeaderboard query\n */\nexport const getTraderLeaderboard = <ThrowOnError extends boolean = false>(\n options?: Options<GetTraderLeaderboardData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).get<\n GetTraderLeaderboardResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/traderLeaderboard\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_trendCoin query\n */\nexport const getTrendCoin = <ThrowOnError extends boolean = false>(\n options: Options<GetTrendCoinData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetTrendCoinResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/trendCoin\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_trendsByName query\n */\nexport const getTrendsByName = <ThrowOnError extends boolean = false>(\n options: Options<GetTrendsByNameData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetTrendsByNameResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/trendsByName\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_walletTradeActivity query\n */\nexport const getWalletTradeActivity = <ThrowOnError extends boolean = false>(\n options: Options<GetWalletTradeActivityData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetWalletTradeActivityResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/walletTradeActivity\",\n ...options,\n });\n};\n\nexport const postQuote = <ThrowOnError extends boolean = false>(\n options?: Options<PostQuoteData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).post<\n PostQuoteResponse,\n PostQuoteError,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/quote\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n },\n });\n};\n\nexport const postCreateContent = <ThrowOnError extends boolean = false>(\n options?: Options<PostCreateContentData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).post<\n PostCreateContentResponse,\n PostCreateContentError,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/create/content\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n },\n });\n};\n","let apiKey: string | undefined;\nexport function setApiKey(key: string | undefined) {\n apiKey = key;\n}\n\nexport function getApiKey() {\n return apiKey;\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 getExplore as getExploreSDK,\n getTrendCoin as getTrendCoinSDK,\n getTrendsByName as getTrendsByNameSDK,\n} from \"../client/sdk.gen\";\nimport type {\n GetExploreData,\n GetExploreResponse,\n GetTrendCoinData,\n GetTrendCoinResponse,\n GetTrendsByNameData,\n GetTrendsByNameResponse,\n} 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\nexport type TrendCoinResponse = { data?: GetTrendCoinResponse };\n\nexport type TrendsByNameResponse = { data?: GetTrendsByNameResponse };\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 ...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\nexport const getCreatorCoins = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"NEW_CREATORS\", options);\n\nexport const getMostValuableCreatorCoins = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"MOST_VALUABLE_CREATORS\", options);\n\nexport const getExploreTopVolumeCreators24h = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TOP_VOLUME_CREATORS_24H\", options);\n\nexport const getExploreTopVolumeAll24h = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TOP_VOLUME_ALL_24H\", options);\n\nexport const getExploreNewAll = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> => createExploreQuery(query, \"NEW_ALL\", options);\n\nexport const getExploreFeaturedCreators = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"FEATURED_CREATORS\", options);\n\nexport const getExploreFeaturedVideos = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"FEATURED_VIDEOS\", options);\n\n/** Get trending coins across all types */\nexport const getTrendingAll = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TRENDING_ALL\", options);\n\n/** Get trending creator coins */\nexport const getTrendingCreators = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TRENDING_CREATORS\", options);\n\n/** Get trending posts */\nexport const getTrendingPosts = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TRENDING_POSTS\", options);\n\n/** Get most valuable trend coins */\nexport const getMostValuableTrends = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"MOST_VALUABLE_TRENDS\", options);\n\n/** Get new trend coins */\nexport const getNewTrends = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> => createExploreQuery(query, \"NEW_TRENDS\", options);\n\n/** Get top volume trend coins (24h) */\nexport const getTopVolumeTrends24h = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TOP_VOLUME_TRENDS_24H\", options);\n\n/** Get trending trend coins */\nexport const getTrendingTrends = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TRENDING_TRENDS\", options);\n\n/** Get most valuable coins across all types */\nexport const getMostValuableAll = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"MOST_VALUABLE_ALL\", options);\n\n/** Look up a single trend coin by ticker (case-insensitive) */\nexport const getTrend = (\n query: GetTrendCoinData[\"query\"],\n options?: RequestOptionsType<GetTrendCoinData>,\n): Promise<TrendCoinResponse> =>\n getTrendCoinSDK({\n ...options,\n query,\n ...getApiKeyMeta(),\n });\n\n/** Search trend coins by name, with fuzzy search (paginated) */\nexport const getTrends = (\n query: GetTrendsByNameData[\"query\"],\n options?: RequestOptionsType<GetTrendsByNameData>,\n): Promise<TrendsByNameResponse> =>\n getTrendsByNameSDK({\n ...options,\n query,\n ...getApiKeyMeta(),\n });\n\n/** Generic explore query for any list type */\nexport const getExploreList = (\n listType: ListType,\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> => createExploreQuery(query, listType, options);\n","import {\n GetCoinCommentsData,\n GetCoinCommentsResponse,\n GetCoinData,\n GetCoinHoldersData,\n GetCoinHoldersResponse,\n GetCoinPriceHistoryData,\n GetCoinPriceHistoryResponse,\n GetCoinResponse,\n GetCoinsData,\n GetCoinsResponse,\n GetCoinSwapsData,\n GetCoinSwapsResponse,\n GetProfileBalancesData,\n GetProfileBalancesResponse,\n GetProfileCoinsData,\n GetProfileCoinsResponse,\n GetProfileData,\n GetProfileResponse,\n GetFeaturedCreatorsData,\n GetFeaturedCreatorsResponse,\n GetTraderLeaderboardData,\n GetTraderLeaderboardResponse,\n GetProfileSocialResponse,\n GetProfileSocialData,\n GetTokenInfoData,\n GetTokenInfoResponse,\n GetContentCoinPoolConfigData,\n GetContentCoinPoolConfigResponse,\n GetCreatorCoinPoolConfigData,\n GetCreatorCoinPoolConfigResponse,\n GetCreatorLivestreamCommentsData,\n GetCreatorLivestreamCommentsResponse,\n GetWalletTradeActivityData,\n GetWalletTradeActivityResponse,\n} from \"../client/types.gen\";\nimport {\n getCoin as getCoinSDK,\n getCoins as getCoinsSDK,\n getCoinComments as getCoinCommentsSDK,\n getCoinHolders as getCoinHoldersSDK,\n getCoinPriceHistory as getCoinPriceHistorySDK,\n getCoinSwaps as getCoinSwapsSDK,\n getProfile as getProfileSDK,\n getProfileBalances as getProfileBalancesSDK,\n getProfileCoins as getProfileCoinsSDK,\n getProfileSocial as getProfileSocialSDK,\n getTokenInfo as getTokenInfoSDK,\n getFeaturedCreators as getFeaturedCreatorsSDK,\n getTraderLeaderboard as getTraderLeaderboardSDK,\n getContentCoinPoolConfig as getContentCoinPoolConfigSDK,\n getCreatorCoinPoolConfig as getCreatorCoinPoolConfigSDK,\n getCreatorLivestreamComments as getCreatorLivestreamCommentsSDK,\n getWalletTradeActivity as getWalletTradeActivitySDK,\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 ...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 ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetCoinHoldersQuery = GetCoinHoldersData[\"query\"];\nexport type { GetCoinHoldersQuery, GetCoinHoldersData };\nexport type { GetCoinHoldersResponse } from \"../client/types.gen\";\n\nexport const getCoinHolders = async (\n query: GetCoinHoldersQuery,\n options?: RequestOptionsType<GetCoinHoldersData>,\n): Promise<RequestResult<GetCoinHoldersResponse>> => {\n return await getCoinHoldersSDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetCoinPriceHistoryQuery = GetCoinPriceHistoryData[\"query\"];\nexport type { GetCoinPriceHistoryQuery, GetCoinPriceHistoryData };\nexport type { GetCoinPriceHistoryResponse } from \"../client/types.gen\";\n\nexport const getCoinPriceHistory = async (\n query: GetCoinPriceHistoryQuery,\n options?: RequestOptionsType<GetCoinPriceHistoryData>,\n): Promise<RequestResult<GetCoinPriceHistoryResponse>> => {\n return await getCoinPriceHistorySDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetCoinSwapsQuery = GetCoinSwapsData[\"query\"];\nexport type { GetCoinSwapsQuery, GetCoinSwapsData };\nexport type { GetCoinSwapsResponse } from \"../client/types.gen\";\n\nexport const getCoinSwaps = async (\n query: GetCoinSwapsQuery,\n options?: RequestOptionsType<GetCoinSwapsData>,\n): Promise<RequestResult<GetCoinSwapsResponse>> => {\n return await getCoinSwapsSDK({\n query,\n ...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 ...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 ...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 ...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 ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetProfileSocialQuery = GetProfileSocialData[\"query\"];\nexport type { GetProfileSocialQuery, GetProfileSocialData };\nexport type { GetProfileSocialResponse } from \"../client/types.gen\";\n\nexport const getProfileSocial = async (\n query: GetProfileSocialQuery,\n options?: RequestOptionsType<GetProfileSocialData>,\n): Promise<RequestResult<GetProfileSocialResponse>> => {\n return await getProfileSocialSDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetTokenInfoQuery = GetTokenInfoData[\"query\"];\nexport type { GetTokenInfoQuery, GetTokenInfoData };\nexport type { GetTokenInfoResponse } from \"../client/types.gen\";\n\nexport const getTokenInfo = async (\n query: GetTokenInfoQuery,\n options?: RequestOptionsType<GetTokenInfoData>,\n): Promise<RequestResult<GetTokenInfoResponse>> => {\n return await getTokenInfoSDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetFeaturedCreatorsQuery = GetFeaturedCreatorsData[\"query\"];\nexport type { GetFeaturedCreatorsQuery, GetFeaturedCreatorsData };\nexport type { GetFeaturedCreatorsResponse } from \"../client/types.gen\";\n\nexport const getFeaturedCreators = async (\n query: GetFeaturedCreatorsQuery = {},\n options?: RequestOptionsType<GetFeaturedCreatorsData>,\n): Promise<RequestResult<GetFeaturedCreatorsResponse>> => {\n return await getFeaturedCreatorsSDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetTraderLeaderboardQuery = GetTraderLeaderboardData[\"query\"];\nexport type { GetTraderLeaderboardQuery, GetTraderLeaderboardData };\nexport type { GetTraderLeaderboardResponse } from \"../client/types.gen\";\n\nexport const getTraderLeaderboard = async (\n query: GetTraderLeaderboardQuery = {},\n options?: RequestOptionsType<GetTraderLeaderboardData>,\n): Promise<RequestResult<GetTraderLeaderboardResponse>> => {\n return await getTraderLeaderboardSDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetContentCoinPoolConfigQuery = GetContentCoinPoolConfigData[\"query\"];\nexport type { GetContentCoinPoolConfigQuery, GetContentCoinPoolConfigData };\nexport type { GetContentCoinPoolConfigResponse } from \"../client/types.gen\";\n\nexport const getContentCoinPoolConfig = async (\n query: GetContentCoinPoolConfigQuery,\n options?: RequestOptionsType<GetContentCoinPoolConfigData>,\n): Promise<RequestResult<GetContentCoinPoolConfigResponse>> => {\n return await getContentCoinPoolConfigSDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetCreatorCoinPoolConfigQuery = GetCreatorCoinPoolConfigData[\"query\"];\nexport type { GetCreatorCoinPoolConfigQuery, GetCreatorCoinPoolConfigData };\nexport type { GetCreatorCoinPoolConfigResponse } from \"../client/types.gen\";\n\nexport const getCreatorCoinPoolConfig = async (\n query: GetCreatorCoinPoolConfigQuery,\n options?: RequestOptionsType<GetCreatorCoinPoolConfigData>,\n): Promise<RequestResult<GetCreatorCoinPoolConfigResponse>> => {\n return await getCreatorCoinPoolConfigSDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetCreatorLivestreamCommentsQuery =\n GetCreatorLivestreamCommentsData[\"query\"];\nexport type {\n GetCreatorLivestreamCommentsQuery,\n GetCreatorLivestreamCommentsData,\n};\nexport type { GetCreatorLivestreamCommentsResponse } from \"../client/types.gen\";\n\nexport const getCreatorLivestreamComments = async (\n query: GetCreatorLivestreamCommentsQuery,\n options?: RequestOptionsType<GetCreatorLivestreamCommentsData>,\n): Promise<RequestResult<GetCreatorLivestreamCommentsResponse>> => {\n return await getCreatorLivestreamCommentsSDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetWalletTradeActivityQuery = GetWalletTradeActivityData[\"query\"];\nexport type { GetWalletTradeActivityQuery, GetWalletTradeActivityData };\nexport type { GetWalletTradeActivityResponse } from \"../client/types.gen\";\n\nexport const getWalletTradeActivity = async (\n query: GetWalletTradeActivityQuery,\n options?: RequestOptionsType<GetWalletTradeActivityData>,\n): Promise<RequestResult<GetWalletTradeActivityResponse>> => {\n return await getWalletTradeActivitySDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n","import {\n PostCreateContentData,\n PostCreateContentResponse,\n} from \"../client/types.gen\";\nimport { postCreateContent as postCreateContentSDK } from \"../client/sdk.gen\";\nimport { getApiKeyMeta } from \"./api-key\";\nimport { RequestOptionsType } from \"./query-types\";\nimport { RequestResult } from \"@hey-api/client-fetch\";\n\ntype PostCreateContentQuery = PostCreateContentData[\"body\"];\nexport type { PostCreateContentQuery, PostCreateContentResponse };\n\nexport type CoinCreateData = NonNullable<PostCreateContentResponse>;\n\nexport const postCreateContent = async (\n body: PostCreateContentQuery,\n options?: RequestOptionsType<PostCreateContentData>,\n): Promise<RequestResult<PostCreateContentResponse>> => {\n return await postCreateContentSDK({\n ...options,\n body,\n ...getApiKeyMeta(),\n });\n};\n","import {\n GetProfileBySocialHandleData,\n GetProfileBySocialHandleResponse,\n} from \"../client/types.gen\";\nimport { getProfileBySocialHandle as getProfileBySocialHandleSDK } from \"../client/sdk.gen\";\nimport { getApiKeyMeta } from \"./api-key\";\nimport { RequestOptionsType } from \"./query-types\";\nimport { RequestResult } from \"@hey-api/client-fetch\";\n\ntype GetProfileBySocialHandleQuery = GetProfileBySocialHandleData[\"query\"];\nexport type { GetProfileBySocialHandleQuery, GetProfileBySocialHandleData };\nexport type { GetProfileBySocialHandleResponse } from \"../client/types.gen\";\n\nexport const getProfileBySocialHandle = async (\n query: GetProfileBySocialHandleQuery,\n options?: RequestOptionsType<GetProfileBySocialHandleData>,\n): Promise<RequestResult<GetProfileBySocialHandleResponse>> => {\n return await getProfileBySocialHandleSDK({\n ...options,\n query,\n ...getApiKeyMeta(),\n });\n};\n","import {\n Abi,\n BaseError,\n ContractFunctionRevertedError,\n decodeErrorResult,\n Hex,\n} from \"viem\";\n\nexport function rethrowDecodedRevert(err: unknown, abi: Abi): never {\n if (err instanceof BaseError) {\n const revertError = err.walk(\n (e) => e instanceof ContractFunctionRevertedError,\n );\n if (revertError instanceof ContractFunctionRevertedError) {\n // Try to decode using factory ABI\n try {\n const revertData =\n typeof (revertError as any).data === \"object\" &&\n (revertError as any).data !== null &&\n \"data\" in (revertError as any).data\n ? (revertError as any).data.data\n : (revertError as any).data;\n const decoded = decodeErrorResult({\n abi,\n data: revertData as Hex,\n });\n const name = decoded.errorName;\n const args = decoded.args as ReadonlyArray<unknown> | undefined;\n const message =\n Array.isArray(args) && args.length > 0\n ? `${name}(${args.map((a) => String(a)).join(\", \")})`\n : name;\n throw new Error(`Create coin transaction reverted: ${message}`);\n } catch {\n const errorName = (revertError as any).data?.errorName as\n | string\n | undefined;\n if (errorName) {\n const args = (revertError as any).data?.args as unknown[] | undefined;\n const message =\n Array.isArray(args) && args.length > 0\n ? `${errorName}(${args.map((a) => String(a)).join(\", \")})`\n : errorName;\n throw new Error(`Create coin transaction reverted: ${message}`);\n }\n }\n }\n }\n throw err;\n}\n","import { coinABI } from \"@zoralabs/protocol-deployments\";\nimport { validateClientNetwork } from \"../utils/validateClientNetwork\";\nimport {\n Account,\n Address,\n parseEventLogs,\n SimulateContractParameters,\n WalletClient,\n} from \"viem\";\nimport { GenericPublicClient } from \"../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 account?: Account | Address,\n) {\n validateClientNetwork(publicClient);\n const call = updateCoinURICall(args);\n const { request } = await publicClient.simulateContract({\n ...call,\n account: 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 { 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 { coinABI } from \"@zoralabs/protocol-deployments\";\nimport { validateClientNetwork } from \"../utils/validateClientNetwork\";\nimport {\n Account,\n Address,\n parseEventLogs,\n SimulateContractParameters,\n WalletClient,\n} from \"viem\";\nimport { GenericPublicClient } from \"../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 account?: Account | Address,\n) {\n validateClientNetwork(publicClient);\n const call = updatePayoutRecipientCall(args);\n const { request } = await publicClient.simulateContract({\n ...call,\n account: 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","import { permit2ABI, permit2Address } from \"@zoralabs/protocol-deployments\";\nimport {\n Account,\n Address,\n erc20Abi,\n WalletClient,\n maxUint256,\n Hex,\n} from \"viem\";\nimport { base } from \"viem/chains\";\nimport { postQuote, PostQuoteResponse } from \"../client\";\nimport { GenericPublicClient } from \"../utils/genericPublicClient\";\n\ntype TradeERC20 = {\n type: \"erc20\";\n address: Address;\n};\n\ntype TradeETH = {\n type: \"eth\";\n};\n\ntype PermitDetails = {\n token: Address;\n amount: bigint;\n expiration: number;\n nonce: number;\n};\n\ntype Permit = {\n details: PermitDetails;\n spender: Address;\n sigDeadline: bigint;\n};\n\ntype PermitDetailsStringAmounts = {\n token: Address;\n amount: string;\n expiration: number;\n nonce: number;\n};\n\ntype PermitStringAmounts = {\n details: PermitDetailsStringAmounts;\n spender: Address;\n sigDeadline: string;\n};\n\ntype SignatureWithPermit<TPermit = Permit> = {\n signature: Hex;\n permit: TPermit;\n};\n\nfunction convertBigIntToString(permit: Permit): PermitStringAmounts {\n return {\n ...permit,\n details: {\n ...permit.details,\n amount: `${permit.details.amount}`,\n },\n sigDeadline: `${permit.sigDeadline}`,\n };\n}\n\nconst PERMIT_SINGLE_TYPES = {\n PermitSingle: [\n { name: \"details\", type: \"PermitDetails\" },\n { name: \"spender\", type: \"address\" },\n { name: \"sigDeadline\", type: \"uint256\" },\n ],\n PermitDetails: [\n { name: \"token\", type: \"address\" },\n { name: \"amount\", type: \"uint160\" },\n { name: \"expiration\", type: \"uint48\" },\n { name: \"nonce\", type: \"uint48\" },\n ],\n};\n\ntype TradeCurrency = TradeERC20 | TradeETH;\n\nexport type TradeParameters = {\n sell: TradeCurrency;\n buy: TradeCurrency;\n amountIn: bigint;\n slippage?: number;\n // can be smart wallet or EOA here.\n sender: Address;\n // needs to be EOA, if signer is blank assumes EOA in sender.\n signer?: Address;\n recipient?: Address;\n signatures?: SignatureWithPermit<PermitStringAmounts>[];\n permitActiveSeconds?: number;\n};\n\nexport async function tradeCoin({\n tradeParameters,\n walletClient,\n account,\n publicClient,\n validateTransaction = true,\n}: {\n tradeParameters: TradeParameters;\n walletClient: WalletClient;\n account?: Account | Address;\n publicClient: GenericPublicClient;\n validateTransaction?: boolean;\n}) {\n const quote = await createTradeCall(tradeParameters);\n\n if (!account) {\n account = walletClient.account;\n }\n if (!account) {\n throw new Error(\"Account is required\");\n }\n\n // Set default recipient to wallet sender address if not provided\n if (!tradeParameters.recipient) {\n tradeParameters.recipient =\n typeof account === \"string\" ? account : account.address;\n }\n\n // todo replace any\n const signatures: { signature: Hex; permit: any }[] = [];\n if (quote.permits) {\n for (const permit of quote.permits) {\n // return values: amount, expiration, nonce\n const [, , nonce] = await publicClient.readContract({\n abi: permit2ABI,\n address: permit2Address[base.id],\n functionName: \"allowance\",\n args: [\n typeof account === \"string\" ? account : account.address,\n permit.permit.details.token as Address,\n permit.permit.spender as Address,\n ],\n });\n const permitToken = permit.permit.details.token as Address;\n const allowance = await publicClient.readContract({\n abi: erc20Abi,\n address: permitToken,\n functionName: \"allowance\",\n args: [\n typeof account === \"string\" ? account : account.address,\n permit2Address[base.id],\n ],\n });\n if (allowance < BigInt(permit.permit.details.amount)) {\n const approvalTx = await walletClient.writeContract({\n abi: erc20Abi,\n address: permitToken,\n functionName: \"approve\",\n chain: base,\n args: [permit2Address[base.id], maxUint256],\n account,\n });\n await publicClient.waitForTransactionReceipt({\n hash: approvalTx,\n });\n }\n const message = {\n details: {\n token: permit.permit.details.token as Address,\n amount: BigInt(permit.permit.details.amount!),\n expiration: Number(permit.permit.details.expiration!),\n nonce: nonce,\n },\n spender: permit.permit.spender as Address,\n sigDeadline: BigInt(permit.permit.sigDeadline!),\n };\n const signature = await walletClient.signTypedData({\n domain: {\n name: \"Permit2\",\n chainId: base.id,\n verifyingContract: permit2Address[base.id],\n },\n primaryType: \"PermitSingle\",\n types: PERMIT_SINGLE_TYPES,\n message,\n account,\n });\n signatures.push({\n signature,\n permit: convertBigIntToString(message),\n });\n }\n }\n\n const newQuote = await createTradeCall({\n ...tradeParameters,\n signatures,\n });\n\n const call = {\n to: newQuote.call.target as Address,\n data: newQuote.call.data as Hex,\n value: BigInt(newQuote.call.value),\n chain: base,\n account,\n };\n\n // simulate call\n if (validateTransaction) {\n await publicClient.call(call);\n }\n\n const gasEstimate = validateTransaction\n ? await publicClient.estimateGas(call)\n : 10_000_000n;\n const gasPrice = await publicClient.getGasPrice();\n\n const tx = await walletClient.sendTransaction({\n ...call,\n gasPrice,\n gas: gasEstimate,\n });\n\n const receipt = await publicClient.waitForTransactionReceipt({\n hash: tx,\n });\n\n return receipt;\n}\n\nexport async function createTradeCall(\n tradeParameters: TradeParameters,\n): Promise<PostQuoteResponse> {\n if (tradeParameters.slippage && tradeParameters.slippage > 1) {\n throw new Error(\"Slippage must be less than 1, max 0.99\");\n }\n if (tradeParameters.amountIn === BigInt(0)) {\n throw new Error(\"Amount in must be greater than 0\");\n }\n\n const quote = await postQuote({\n body: {\n tokenIn: tradeParameters.sell,\n tokenOut: tradeParameters.buy,\n amountIn: tradeParameters.amountIn.toString(),\n slippage: tradeParameters.slippage,\n chainId: base.id,\n sender: tradeParameters.sender,\n recipient: tradeParameters.recipient || tradeParameters.sender,\n signatures: tradeParameters.signatures,\n },\n });\n\n if (!quote.data) {\n console.error(quote);\n const errorBody = quote.error as\n | { error?: string; errorType?: string }\n | undefined;\n const errorMessage = errorBody?.error || \"Quote failed\";\n const err = new Error(errorMessage);\n (err as any).errorType = errorBody?.errorType;\n (err as any).errorBody = errorBody;\n throw err;\n }\n\n return quote.data;\n}\n","import { client } from \"../client/client.gen\";\nimport { createConfig } from \"@hey-api/client-fetch\";\nimport { getApiKeyMeta } from \"./api-key\";\n\nexport const apiGet = (path: string, data?: Record<string, unknown>) =>\n client.get({ url: path, query: data, ...getApiKeyMeta() });\n\nexport const apiPost = (path: string, data?: Record<string, unknown>) =>\n client.post({ url: path, body: data, ...getApiKeyMeta() });\n\nexport const setApiBaseUrl = (baseUrl: string) => {\n client.setConfig(createConfig({ baseUrl }));\n};\n","import {\n CreateMetadataParameters,\n Uploader,\n UploadResult,\n ValidMetadataURI,\n} from \"./types\";\n\ntype Metadata = {\n name: string;\n symbol: string;\n description: string;\n image: string;\n properties?: Record<string, string>;\n animation_url?: string;\n content?: {\n uri: string;\n mime: string | undefined;\n };\n};\n\nexport function validateImageMimeType(mimeType: string) {\n if (\n ![\n \"image/png\",\n \"image/jpeg\",\n \"image/jpg\",\n \"image/gif\",\n \"image/svg+xml\",\n ].includes(mimeType)\n ) {\n throw new Error(\"Image must be a PNG, JPEG, JPG, GIF or SVG\");\n }\n}\n\nexport function getURLFromUploadResult(uploadResult: UploadResult) {\n return new URL(uploadResult.url);\n}\n\nexport class CoinMetadataBuilder {\n private name: string | undefined;\n private description: string | undefined;\n private symbol: string | undefined;\n private imageFile: File | undefined;\n private imageURL: URL | undefined;\n private mediaFile: File | undefined;\n private mediaURL: URL | undefined;\n private mediaMimeType: string | undefined;\n private properties: Record<string, string> | undefined;\n\n withName(name: string) {\n this.name = name;\n if (typeof name !== \"string\") {\n throw new Error(\"Name must be a string\");\n }\n\n return this;\n }\n\n withSymbol(symbol: string) {\n this.symbol = symbol;\n if (typeof symbol !== \"string\") {\n throw new Error(\"Symbol must be a string\");\n }\n\n return this;\n }\n\n withDescription(description: string) {\n this.description = description;\n if (typeof description !== \"string\") {\n throw new Error(\"Description must be a string\");\n }\n\n return this;\n }\n\n withImage(image: File) {\n if (this.imageURL) {\n throw new Error(\"Image URL already set\");\n }\n if (!(image instanceof File)) {\n throw new Error(\"Image must be a File\");\n }\n validateImageMimeType(image.type);\n this.imageFile = image;\n\n return this;\n }\n\n withImageURI(imageURI: string) {\n if (this.imageFile) {\n throw new Error(\"Image file already set\");\n }\n if (typeof imageURI !== \"string\") {\n throw new Error(\"Image URI must be a string\");\n }\n const url = new URL(imageURI);\n this.imageURL = url;\n\n return this;\n }\n\n withProperties(properties: Record<string, string>) {\n for (const [key, value] of Object.entries(properties)) {\n if (typeof key !== \"string\") {\n throw new Error(\"Property key must be a string\");\n }\n if (typeof value !== \"string\") {\n throw new Error(\"Property value must be a string\");\n }\n }\n if (!this.properties) {\n this.properties = {};\n }\n this.properties = { ...this.properties, ...properties };\n\n return this;\n }\n\n withMedia(media: File) {\n if (this.mediaURL) {\n throw new Error(\"Media URL already set\");\n }\n if (!(media instanceof File)) {\n throw new Error(\"Media must be a File\");\n }\n this.mediaMimeType = media.type;\n this.mediaFile = media;\n\n return this;\n }\n\n withMediaURI(mediaURI: string, mediaMimeType: string | undefined) {\n if (this.mediaFile) {\n throw new Error(\"Media file already set\");\n }\n if (typeof mediaURI !== \"string\") {\n throw new Error(\"Media URI must be a string\");\n }\n const url = new URL(mediaURI);\n this.mediaURL = url;\n this.mediaMimeType = mediaMimeType;\n\n return this;\n }\n\n validate() {\n if (!this.name) {\n throw new Error(\"Name is required\");\n }\n if (!this.symbol) {\n throw new Error(\"Symbol is required\");\n }\n if (!this.imageFile && !this.imageURL) {\n throw new Error(\"Image is required\");\n }\n\n return this;\n }\n\n generateMetadata(): Metadata {\n return {\n name: this.name!,\n symbol: this.symbol!,\n description: this.description!,\n image: this.imageURL!.toString(),\n animation_url: this.mediaURL?.toString(),\n content: this.mediaURL\n ? {\n uri: this.mediaURL?.toString(),\n mime: this.mediaMimeType,\n }\n : undefined,\n properties: this.properties,\n };\n }\n\n async upload(uploader: Uploader): Promise<{\n url: ValidMetadataURI;\n createMetadataParameters: CreateMetadataParameters;\n metadata: Metadata;\n }> {\n this.validate();\n\n if (this.imageFile) {\n const uploadResult = await uploader.upload(this.imageFile);\n this.imageURL = getURLFromUploadResult(uploadResult);\n }\n if (this.mediaFile) {\n const uploadResult = await uploader.upload(this.mediaFile);\n this.mediaURL = getURLFromUploadResult(uploadResult);\n }\n const metadata = this.generateMetadata();\n const uploadResult = await uploader.upload(\n new File([JSON.stringify(metadata)], \"metadata.json\", {\n type: \"application/json\",\n }),\n );\n\n return {\n url: getURLFromUploadResult(uploadResult).toString() as ValidMetadataURI,\n createMetadataParameters: {\n name: this.name!,\n symbol: this.symbol!,\n metadata: {\n type: \"RAW_URI\",\n uri: uploadResult.url,\n },\n },\n metadata,\n };\n }\n}\n\nexport function createMetadataBuilder() {\n return new CoinMetadataBuilder();\n}\n","import {\n SetCreateUploadJwtData,\n SetCreateUploadJwtResponse,\n} from \"../client/types.gen\";\nimport { setCreateUploadJwt as setCreateUploadJwtSDK } from \"../client/sdk.gen\";\nimport { getApiKeyMeta } from \"./api-key\";\nimport { RequestOptionsType } from \"./query-types\";\nimport { RequestResult } from \"@hey-api/client-fetch\";\n\ntype SetCreateUploadJwtQuery = SetCreateUploadJwtData[\"body\"];\nexport type { SetCreateUploadJwtQuery, SetCreateUploadJwtData };\nexport type { SetCreateUploadJwtResponse } from \"../client/types.gen\";\n\nexport const setCreateUploadJwt = async (\n body: SetCreateUploadJwtQuery,\n options?: RequestOptionsType<SetCreateUploadJwtData>,\n): Promise<RequestResult<SetCreateUploadJwtResponse>> => {\n return await setCreateUploadJwtSDK({\n body,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n","import { Address } from \"viem\";\nimport { Uploader, UploadOptions, UploadResult } from \"../types\";\nimport { getApiKey } from \"../../api/api-key\";\nimport { setCreateUploadJwt } from \"../../api/internal\";\n\nconst JWT_TTL_MS = 1000 * 60 * 60; // 1 hour\nconst JWT_FETCH_TIMEOUT_MS = 15_000; // 15 seconds\n\n/**\n * Zora IPFS uploader implementation\n */\nexport class ZoraUploader implements Uploader {\n constructor(creatorAddress: Address) {\n this.creatorAddress = creatorAddress;\n if (!getApiKey()) {\n throw new Error(\"API key is required for metadata interactions\");\n }\n }\n\n private creatorAddress: Address;\n private jwtApiKey: string | undefined;\n private jwtApiKeyExpiresAt: number | undefined;\n\n private invalidateJwt() {\n this.jwtApiKey = undefined;\n this.jwtApiKeyExpiresAt = undefined;\n }\n\n private async getJWTApiKey(signal?: AbortSignal) {\n if (\n this.jwtApiKey &&\n this.jwtApiKeyExpiresAt &&\n this.jwtApiKeyExpiresAt > Date.now()\n ) {\n return this.jwtApiKey;\n }\n\n const jwtSignal = AbortSignal.timeout(JWT_FETCH_TIMEOUT_MS);\n const combinedSignal = signal\n ? AbortSignal.any([signal, jwtSignal])\n : jwtSignal;\n\n const response = await setCreateUploadJwt(\n {\n creatorAddress: this.creatorAddress,\n },\n { signal: combinedSignal },\n );\n this.jwtApiKey = response.data?.createUploadJwtFromApiKey;\n if (!this.jwtApiKey) {\n throw new Error(\"Failed to create upload JWT\");\n }\n\n this.jwtApiKeyExpiresAt = Date.now() + JWT_TTL_MS;\n\n return this.jwtApiKey;\n }\n\n private buildUploadSignal(options?: UploadOptions): AbortSignal | undefined {\n const { signal, timeout } = options ?? {};\n if (signal && timeout) {\n return AbortSignal.any([signal, AbortSignal.timeout(timeout)]);\n }\n if (timeout) {\n return AbortSignal.timeout(timeout);\n }\n return signal;\n }\n\n private async doUpload(\n file: File,\n jwt: string,\n signal?: AbortSignal,\n ): Promise<Response> {\n const formData = new FormData();\n formData.append(\"file\", file, file.name);\n\n return fetch(\"https://ipfs-uploader.zora.co/api/v0/add?cid-version=1\", {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${jwt}`,\n Accept: \"*/*\",\n },\n body: formData,\n signal,\n });\n }\n\n async upload(file: File, options?: UploadOptions): Promise<UploadResult> {\n const uploadSignal = this.buildUploadSignal(options);\n\n const jwt = await this.getJWTApiKey(uploadSignal);\n let response = await this.doUpload(file, jwt, uploadSignal);\n\n // On 401, refresh the JWT exactly once and retry\n if (response.status === 401) {\n this.invalidateJwt();\n const freshJwt = await this.getJWTApiKey(uploadSignal);\n response = await this.doUpload(file, freshJwt, uploadSignal);\n }\n\n if (!response.ok) {\n console.error(await response.text());\n throw new Error(`Failed to upload file: ${response.statusText}`);\n }\n\n const data = (await response.json()) as {\n cid: string;\n size: number | undefined;\n mimeType: string | undefined;\n };\n\n return {\n url: `ipfs://${data.cid}`,\n size: data.size,\n mimeType: data.mimeType,\n };\n }\n}\n\n/**\n * Create a new Zora IPFS uploader\n */\nexport function createZoraUploaderForCreator(\n creat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cAAQ,MAAM,MAAM,SAAS,KAAK,CAAC;AACnC,YAAM,IAAI,MAAM,0BAA0B,SAAS,UAAU,EAAE;AAAA,IACjE;AAEA,UAAM,OAAQ,MAAM,SAAS,KAAK;AAMlC,WAAO;AAAA,MACL,KAAK,UAAU,KAAK,GAAG;AAAA,MACvB,MAAM,KAAK;AAAA,MACX,UAAU,KAAK;AAAA,IACjB;AAAA,EACF;AACF;AAKO,SAAS,6BACd,gBACU;AACV,SAAO,IAAI,aAAa,cAAc;AACxC;","names":["base","base","baseSepolia","getCoin","getCoins","getCoinHolders","getCoinPriceHistory","getCoinSwaps","getCoinComments","getProfile","getProfileCoins","getProfileBalances","getProfileSocial","getTokenInfo","getFeaturedCreators","getTraderLeaderboard","getContentCoinPoolConfig","getCreatorCoinPoolConfig","getCreatorLivestreamComments","getWalletTradeActivity","postCreateContent","getProfileBySocialHandle","base","postCreateContent","parseEventLogs","parseEventLogs","coinABI","parseEventLogs","coinABI","parseEventLogs","base","base","createConfig","createConfig","uploadResult","setCreateUploadJwt","setCreateUploadJwt"]}
1
+ {"version":3,"sources":["../src/actions/createCoin.ts","../src/client/client.gen.ts","../src/client/sdk.gen.ts","../src/api/api-key.ts","../src/api/explore.ts","../src/api/queries.ts","../src/api/create.ts","../src/api/social.ts","../src/metadata/cleanAndValidateMetadataURI.ts","../src/metadata/validateMetadataJSON.ts","../src/metadata/validateMetadataURIContent.ts","../src/utils/calls.ts","../src/utils/getChainFromId.ts","../src/utils/rethrowDecodedRevert.ts","../src/utils/userOperation.ts","../src/utils/validateClientNetwork.ts","../src/actions/updateCoinURI.ts","../src/utils/attribution.ts","../src/actions/updatePayoutRecipient.ts","../src/actions/tradeCoin.ts","../src/api/api-raw.ts","../src/uploader/metadata.ts","../src/api/internal.ts","../src/uploader/providers/zora.ts"],"sourcesContent":["import {\n coinFactoryAddress,\n coinFactoryABI as zoraFactoryImplABI,\n} from \"@zoralabs/protocol-deployments\";\nimport {\n Account,\n Address,\n ContractEventArgsFromTopics,\n decodeFunctionData,\n Hex,\n isAddressEqual,\n parseEventLogs,\n TransactionReceipt,\n WalletClient,\n} from \"viem\";\nimport { BundlerClient } from \"viem/account-abstraction\";\nimport { base } from \"viem/chains\";\nimport { postCreateContent } from \"../api\";\nimport { validateMetadataURIContent } from \"../metadata\";\nimport { ValidMetadataURI } from \"../uploader/types\";\nimport { GenericCall, toUserOperationCalls } from \"../utils/calls\";\nimport { GenericPublicClient } from \"../utils/genericPublicClient\";\nimport { getChainFromId } from \"../utils/getChainFromId\";\nimport { rethrowDecodedRevert } from \"../utils/rethrowDecodedRevert\";\nimport {\n prepareUserOperation,\n submitUserOperation,\n} from \"../utils/userOperation\";\nimport { validateClientNetwork } from \"../utils/validateClientNetwork\";\n\nexport type CoinDeploymentLogArgs = ContractEventArgsFromTopics<\n typeof zoraFactoryImplABI,\n \"CoinCreatedV4\"\n>;\n\nconst STARTING_MARKET_CAPS = {\n LOW: \"LOW\",\n HIGH: \"HIGH\",\n} as const;\nexport type StartingMarketCap = keyof typeof STARTING_MARKET_CAPS;\n\nexport interface RawUriMetadata {\n type: \"RAW_URI\";\n uri: string;\n}\n\nconst CONTENT_COIN_CURRENCIES = {\n CREATOR_COIN: \"CREATOR_COIN\",\n ZORA: \"ZORA\",\n ETH: \"ETH\",\n CREATOR_COIN_OR_ZORA: \"CREATOR_COIN_OR_ZORA\",\n} as const;\nexport type ContentCoinCurrency = keyof typeof CONTENT_COIN_CURRENCIES;\n\nexport const CreateConstants = {\n StartingMarketCaps: STARTING_MARKET_CAPS,\n ContentCoinCurrencies: CONTENT_COIN_CURRENCIES,\n} as const;\n\nexport type CreateCoinArgs = {\n creator: string;\n name: string;\n symbol: string;\n metadata: RawUriMetadata;\n currency: ContentCoinCurrency;\n chainId?: number;\n startingMarketCap?: StartingMarketCap;\n platformReferrer?: string;\n additionalOwners?: Address[];\n payoutRecipientOverride?: Address;\n skipMetadataValidation?: boolean;\n /**\n * Enable smart wallet routing. When true, the API resolves the creator's\n * linked smart wallet and returns a single call wrapped in the smart wallet's\n * `execute`, so the coin is deployed and owned by the smart wallet (executed by\n * an owner EOA). Used by {@link createCoinSmartWallet}. Defaults to false.\n */\n enableSmartWalletRouting?: boolean;\n};\n\ntype TransactionParameters = {\n to: Address;\n data: Hex;\n value: bigint;\n};\n\ntype CreateCoinCallResponse = {\n calls: TransactionParameters[];\n predictedCoinAddress: Address;\n /**\n * Whether the API applied smart wallet routing. False (or undefined) means the\n * call targets the factory directly (EOA creation); true means it is wrapped in\n * the smart wallet's `execute`.\n */\n usedSmartWalletRouting?: boolean;\n};\n\nexport async function createCoinCall({\n creator,\n name,\n symbol,\n metadata,\n currency,\n chainId = base.id,\n payoutRecipientOverride,\n additionalOwners,\n platformReferrer,\n skipMetadataValidation = false,\n enableSmartWalletRouting,\n}: CreateCoinArgs): Promise<CreateCoinCallResponse> {\n // Validate metadata URI\n if (!skipMetadataValidation) {\n await validateMetadataURIContent(metadata.uri as ValidMetadataURI);\n }\n\n const createContentRequest = await postCreateContent({\n currency,\n chainId,\n metadata,\n creator,\n name,\n symbol,\n platformReferrer,\n additionalOwners,\n payoutRecipientOverride,\n enableSmartWalletRouting,\n });\n\n if (!createContentRequest.data?.calls) {\n throw new Error(\"Failed to create content calldata\");\n }\n\n return {\n calls: createContentRequest.data.calls.map((data) => ({\n to: data.to as Address,\n data: data.data as Hex,\n value: BigInt(data.value),\n })),\n predictedCoinAddress: createContentRequest.data\n .predictedCoinAddress as Address,\n usedSmartWalletRouting: createContentRequest.data.usedSmartWalletRouting,\n };\n}\n\n/**\n * Validates the assembled calls for creating a coin.\n *\n * Asserts the invariants this SDK version supports: a single call, targeting the\n * coin factory for the given chain, with no attached value (no buy-on-create).\n * Shared by both the EOA execution path (`createCoin`) and the user-operation\n * path so both validate identically.\n */\nexport function validateCreateCoinCalls(\n calls: GenericCall[],\n chainId: number,\n): void {\n if (calls.length !== 1) {\n throw new Error(\"Only one call is supported for this SDK version\");\n }\n\n const createContentCall = calls[0];\n\n if (!createContentCall) {\n throw new Error(\"Failed to load create content calldata from API\");\n }\n\n const coinFactoryAddressForChain =\n coinFactoryAddress[chainId as keyof typeof coinFactoryAddress];\n\n // Sanity check that the call is for the correct factory contract\n if (!isAddressEqual(createContentCall.to, coinFactoryAddressForChain)) {\n throw new Error(\"Creator coin is not supported for this SDK version\");\n }\n\n // Sanity check to ensure no buy orders are sent with these parameters\n if (createContentCall.value !== 0n) {\n throw new Error(\n \"Creator coin and purchase is not supported for this SDK version.\",\n );\n }\n}\n\n/**\n * Validates the assembled calls for creating a coin via smart wallet routing.\n *\n * Unlike {@link validateCreateCoinCalls}, the call targets the creator's smart\n * wallet (its `execute` method), not the factory — so the factory-target check\n * does not apply. The key guard is that the API actually applied routing:\n * `enableSmartWalletRouting` is best-effort and silently falls back to EOA\n * creation when the creator has no linked smart wallet, which must not be\n * mistaken for a smart wallet creation.\n */\nexport function validateCreateCoinSmartWalletCalls(\n calls: GenericCall[],\n { usedSmartWalletRouting }: { usedSmartWalletRouting?: boolean },\n): void {\n if (!usedSmartWalletRouting) {\n throw new Error(\n \"Smart wallet routing was not applied. The creator must have a linked smart wallet; otherwise use createCoin for EOA creation.\",\n );\n }\n\n if (calls.length !== 1) {\n throw new Error(\"Only one call is supported for this SDK version\");\n }\n\n const createContentCall = calls[0];\n\n if (!createContentCall) {\n throw new Error(\"Failed to load create content calldata from API\");\n }\n\n // Sanity check to ensure no buy orders are sent with these parameters\n if (createContentCall.value !== 0n) {\n throw new Error(\n \"Creator coin and purchase is not supported for this SDK version.\",\n );\n }\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\ntype CreateCoinOptions = {\n gasMultiplier?: number;\n account?: Account | Address;\n skipValidateTransaction?: boolean;\n};\n\n/** Minimal ABI for the Coinbase Smart Wallet `execute` method, used to unwrap a routed call. */\nconst coinbaseSmartWalletExecuteABI = [\n {\n type: \"function\",\n name: \"execute\",\n stateMutability: \"payable\",\n inputs: [\n { name: \"target\", type: \"address\" },\n { name: \"value\", type: \"uint256\" },\n { name: \"data\", type: \"bytes\" },\n ],\n outputs: [],\n },\n] as const;\n\n/**\n * Unwraps the smart wallet `execute(target, value, data)` call that the API\n * returns under smart wallet routing into its inner factory call.\n *\n * The bundler/account (`toCoinbaseSmartAccount.encodeCalls`) re-wraps a single\n * call in `execute` when forming the user operation, so the inner call — not the\n * pre-wrapped one — must be fed to the user-operation path; passing the wrapped\n * call would double-wrap it. The inner call still executes with the smart wallet\n * as `msg.sender`, so the deployed coin's CREATE2 address is unchanged (the API's\n * predicted address remains valid).\n *\n * Throws if the call is not a recognizable `execute` call, so an unexpected shape\n * fails loudly rather than silently double-wrapping.\n */\nfunction unwrapSmartWalletExecuteCall(call: GenericCall): GenericCall {\n let decoded;\n try {\n decoded = decodeFunctionData({\n abi: coinbaseSmartWalletExecuteABI,\n data: call.data,\n });\n } catch {\n throw new Error(\n \"Expected a smart wallet `execute` call from smart wallet routing, but the routed call could not be decoded.\",\n );\n }\n\n const [target, value, data] = decoded.args;\n return { to: target, value, data };\n}\n\n/**\n * Selects the account used to sign and send the create transaction.\n *\n * Prefers a LocalAccount from the wallet client when available to ensure offline\n * signing (eth_sendRawTransaction) instead of wallet_sendTransaction, which can\n * error when a `from` field is present.\n */\nfunction selectExecutionAccount(\n walletClient: WalletClient,\n account?: Account | Address,\n): Account {\n const selected =\n (typeof account === \"string\" ? undefined : account) ?? walletClient.account;\n\n if (!selected) {\n throw new Error(\"Account is required\");\n }\n\n return selected;\n}\n\n/**\n * Simulates, gas-estimates, sends and awaits a single create call, then parses\n * the deployment from the receipt logs. Shared by {@link createCoin} (factory\n * call) and {@link createCoinSmartWallet} (smart wallet `execute` call) so both\n * return the same shape.\n */\nasync function executeCreateContentCall({\n createContentCall,\n account,\n walletClient,\n publicClient,\n skipValidateTransaction,\n}: {\n createContentCall: GenericCall;\n account: Account;\n walletClient: WalletClient;\n publicClient: GenericPublicClient;\n skipValidateTransaction?: boolean;\n}) {\n const viemCall = {\n ...createContentCall,\n account,\n };\n\n // simulate call\n if (!skipValidateTransaction) {\n try {\n await publicClient.call(viemCall);\n } catch (err) {\n rethrowDecodedRevert(err, zoraFactoryImplABI);\n }\n }\n\n const gasEstimate = skipValidateTransaction\n ? 10_000_000n\n : await publicClient.estimateGas(viemCall);\n const gasPrice = await publicClient.getGasPrice();\n\n const hash = await (async () => {\n try {\n return await walletClient.sendTransaction({\n ...viemCall,\n gasPrice,\n gas: gasEstimate,\n chain: publicClient.chain,\n });\n } catch (err) {\n rethrowDecodedRevert(err, zoraFactoryImplABI);\n }\n })();\n\n const receipt = await publicClient.waitForTransactionReceipt({\n hash,\n });\n\n const deployment = getCoinCreateFromLogs(receipt);\n\n return {\n hash,\n receipt,\n address: deployment?.coin,\n deployment,\n chain: getChainFromId(publicClient.chain.id),\n };\n}\n\n// Update createCoin to return both receipt and coin address\nexport async function createCoin({\n call,\n walletClient,\n publicClient,\n options,\n}: {\n call: CreateCoinArgs;\n walletClient: WalletClient;\n publicClient: GenericPublicClient;\n options?: CreateCoinOptions;\n}) {\n validateClientNetwork(publicClient);\n\n const chainId = call.chainId ?? publicClient.chain.id;\n\n const { calls } = await createCoinCall({\n ...call,\n chainId,\n });\n\n validateCreateCoinCalls(calls, chainId);\n\n const createContentCall = calls[0]!;\n\n const account = selectExecutionAccount(walletClient, options?.account);\n\n return executeCreateContentCall({\n createContentCall,\n account,\n walletClient,\n publicClient,\n skipValidateTransaction: options?.skipValidateTransaction,\n });\n}\n\n/**\n * Creates a coin owned by the caller's smart wallet via a user operation.\n *\n * Requests smart wallet routing from the API, which resolves the creator's\n * linked smart wallet and returns the deploy wrapped in the smart wallet's\n * `execute`. That wrapped call is unwrapped to its inner factory call and\n * submitted as a user operation through `bundlerClient` — so the smart wallet\n * deploys and owns the coin while gas is paid from the smart wallet's\n * user-operation prefund (rather than from an owner EOA). The bundler/account\n * re-wraps the inner call in `execute` itself, and the smart wallet remains\n * `msg.sender`, so the deployed coin's CREATE2 address matches the API's\n * prediction.\n *\n * Mirrors {@link createCoin}'s return shape. Throws if the API did not apply\n * routing (e.g. the creator has no linked smart wallet) — use {@link createCoin}\n * for EOA creation in that case.\n */\nexport async function createCoinSmartWallet({\n call,\n bundlerClient,\n publicClient,\n}: {\n call: CreateCoinArgs;\n bundlerClient: BundlerClient;\n publicClient: GenericPublicClient;\n // `options` is accepted for signature parity with createCoin but does not\n // apply to the user-operation path: the account comes from the bundler client,\n // and gas/validation are handled by the bundler during preparation.\n options?: CreateCoinOptions;\n}) {\n validateClientNetwork(publicClient);\n\n const account = bundlerClient.account;\n if (!account) {\n throw new Error(\"Account is required: the bundler client has no account\");\n }\n\n const chainId = call.chainId ?? publicClient.chain.id;\n\n const { calls, usedSmartWalletRouting } = await createCoinCall({\n ...call,\n chainId,\n enableSmartWalletRouting: true,\n });\n\n validateCreateCoinSmartWalletCalls(calls, { usedSmartWalletRouting });\n\n // Unwrap the routed `execute` call so the bundler re-wraps the inner call\n // itself instead of double-wrapping (see unwrapSmartWalletExecuteCall).\n const innerCall = unwrapSmartWalletExecuteCall(calls[0]!);\n\n const userOperation = await prepareUserOperation({\n bundlerClient,\n account,\n calls: toUserOperationCalls([innerCall]),\n });\n\n const userOpReceipt = await submitUserOperation({\n bundlerClient,\n account,\n userOperation,\n });\n\n if (!userOpReceipt.success) {\n throw new Error(\n `User operation reverted${userOpReceipt.reason ? `: ${userOpReceipt.reason}` : \"\"}`,\n );\n }\n\n // Parse the deployment from this user operation's own logs (not the whole\n // bundle's), so a co-bundled CoinCreatedV4 can't be misattributed.\n const eventLogs = parseEventLogs({\n abi: zoraFactoryImplABI,\n logs: userOpReceipt.logs,\n });\n const deployment = eventLogs.find(\n (log) => log.eventName === \"CoinCreatedV4\",\n )?.args;\n\n return {\n hash: userOpReceipt.receipt.transactionHash,\n receipt: userOpReceipt.receipt,\n address: deployment?.coin,\n deployment,\n chain: getChainFromId(publicClient.chain.id),\n };\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 GetCoinHoldersData,\n GetCoinHoldersResponse,\n GetCoinPriceHistoryData,\n GetCoinPriceHistoryResponse,\n GetCoinSwapsData,\n GetCoinSwapsResponse,\n GetCoinsData,\n GetCoinsResponse,\n GetCoinsListData,\n GetCoinsListResponse,\n GetContentCoinPoolConfigData,\n GetContentCoinPoolConfigResponse,\n SetCreateUploadJwtData,\n SetCreateUploadJwtResponse,\n GetCreatorCoinPoolConfigData,\n GetCreatorCoinPoolConfigResponse,\n GetCreatorLivestreamCommentsData,\n GetCreatorLivestreamCommentsResponse,\n GetExploreData,\n GetExploreResponse,\n GetFeaturedCreatorsData,\n GetFeaturedCreatorsResponse,\n GetLatestLiveStreamsData,\n GetLatestLiveStreamsResponse,\n GetProfileData,\n GetProfileResponse,\n GetProfileBalancesData,\n GetProfileBalancesResponse,\n GetProfileBySocialHandleData,\n GetProfileBySocialHandleResponse,\n GetProfileCoinsData,\n GetProfileCoinsResponse,\n GetProfileSocialData,\n GetProfileSocialResponse,\n GetTokenInfoData,\n GetTokenInfoResponse,\n GetTopLiveStreamsData,\n GetTopLiveStreamsResponse,\n GetTraderLeaderboardData,\n GetTraderLeaderboardResponse,\n GetTrendCoinData,\n GetTrendCoinResponse,\n GetTrendsByNameData,\n GetTrendsByNameResponse,\n GetWalletTradeActivityData,\n GetWalletTradeActivityResponse,\n PostQuoteData,\n PostQuoteResponse,\n PostQuoteError,\n PostCreateContentData,\n PostCreateContentResponse,\n PostCreateContentError,\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_coinHolders query\n */\nexport const getCoinHolders = <ThrowOnError extends boolean = false>(\n options: Options<GetCoinHoldersData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetCoinHoldersResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/coinHolders\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_coinPriceHistory query\n */\nexport const getCoinPriceHistory = <ThrowOnError extends boolean = false>(\n options: Options<GetCoinPriceHistoryData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetCoinPriceHistoryResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/coinPriceHistory\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_coinSwaps query\n */\nexport const getCoinSwaps = <ThrowOnError extends boolean = false>(\n options: Options<GetCoinSwapsData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetCoinSwapsResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/coinSwaps\",\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_coinsList query\n */\nexport const getCoinsList = <ThrowOnError extends boolean = false>(\n options?: Options<GetCoinsListData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).get<\n GetCoinsListResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/coinsList\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_contentCoinPoolConfig query\n */\nexport const getContentCoinPoolConfig = <ThrowOnError extends boolean = false>(\n options: Options<GetContentCoinPoolConfigData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetContentCoinPoolConfigResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/contentCoinPoolConfig\",\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_creatorCoinPoolConfig query\n */\nexport const getCreatorCoinPoolConfig = <ThrowOnError extends boolean = false>(\n options?: Options<GetCreatorCoinPoolConfigData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).get<\n GetCreatorCoinPoolConfigResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/creatorCoinPoolConfig\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_creatorLivestreamComments query\n */\nexport const getCreatorLivestreamComments = <\n ThrowOnError extends boolean = false,\n>(\n options: Options<GetCreatorLivestreamCommentsData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetCreatorLivestreamCommentsResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/creatorLivestreamComments\",\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 security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/explore\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_featuredCreators query\n */\nexport const getFeaturedCreators = <ThrowOnError extends boolean = false>(\n options?: Options<GetFeaturedCreatorsData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).get<\n GetFeaturedCreatorsResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/featuredCreators\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_latestLiveStreams query\n */\nexport const getLatestLiveStreams = <ThrowOnError extends boolean = false>(\n options?: Options<GetLatestLiveStreamsData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).get<\n GetLatestLiveStreamsResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/latestLiveStreams\",\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_profileBySocialHandle query\n */\nexport const getProfileBySocialHandle = <ThrowOnError extends boolean = false>(\n options: Options<GetProfileBySocialHandleData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetProfileBySocialHandleResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/profileBySocialHandle\",\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\n/**\n * zoraSDK_profileSocial query\n */\nexport const getProfileSocial = <ThrowOnError extends boolean = false>(\n options: Options<GetProfileSocialData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetProfileSocialResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/profileSocial\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_tokenInfo query\n */\nexport const getTokenInfo = <ThrowOnError extends boolean = false>(\n options: Options<GetTokenInfoData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetTokenInfoResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/tokenInfo\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_topLiveStreams query\n */\nexport const getTopLiveStreams = <ThrowOnError extends boolean = false>(\n options?: Options<GetTopLiveStreamsData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).get<\n GetTopLiveStreamsResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/topLiveStreams\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_traderLeaderboard query\n */\nexport const getTraderLeaderboard = <ThrowOnError extends boolean = false>(\n options?: Options<GetTraderLeaderboardData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).get<\n GetTraderLeaderboardResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/traderLeaderboard\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_trendCoin query\n */\nexport const getTrendCoin = <ThrowOnError extends boolean = false>(\n options: Options<GetTrendCoinData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetTrendCoinResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/trendCoin\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_trendsByName query\n */\nexport const getTrendsByName = <ThrowOnError extends boolean = false>(\n options: Options<GetTrendsByNameData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetTrendsByNameResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/trendsByName\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_walletTradeActivity query\n */\nexport const getWalletTradeActivity = <ThrowOnError extends boolean = false>(\n options: Options<GetWalletTradeActivityData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetWalletTradeActivityResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/walletTradeActivity\",\n ...options,\n });\n};\n\nexport const postQuote = <ThrowOnError extends boolean = false>(\n options?: Options<PostQuoteData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).post<\n PostQuoteResponse,\n PostQuoteError,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/quote\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n },\n });\n};\n\nexport const postCreateContent = <ThrowOnError extends boolean = false>(\n options?: Options<PostCreateContentData, ThrowOnError>,\n) => {\n return (options?.client ?? _heyApiClient).post<\n PostCreateContentResponse,\n PostCreateContentError,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/create/content\",\n ...options,\n headers: {\n \"Content-Type\": \"application/json\",\n ...options?.headers,\n },\n });\n};\n","let apiKey: string | undefined;\nexport function setApiKey(key: string | undefined) {\n apiKey = key;\n}\n\nexport function getApiKey() {\n return apiKey;\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 getExplore as getExploreSDK,\n getTrendCoin as getTrendCoinSDK,\n getTrendsByName as getTrendsByNameSDK,\n} from \"../client/sdk.gen\";\nimport type {\n GetExploreData,\n GetExploreResponse,\n GetTrendCoinData,\n GetTrendCoinResponse,\n GetTrendsByNameData,\n GetTrendsByNameResponse,\n} 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\nexport type TrendCoinResponse = { data?: GetTrendCoinResponse };\n\nexport type TrendsByNameResponse = { data?: GetTrendsByNameResponse };\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 ...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\nexport const getCreatorCoins = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"NEW_CREATORS\", options);\n\nexport const getMostValuableCreatorCoins = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"MOST_VALUABLE_CREATORS\", options);\n\nexport const getExploreTopVolumeCreators24h = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TOP_VOLUME_CREATORS_24H\", options);\n\nexport const getExploreTopVolumeAll24h = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TOP_VOLUME_ALL_24H\", options);\n\nexport const getExploreNewAll = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> => createExploreQuery(query, \"NEW_ALL\", options);\n\nexport const getExploreFeaturedCreators = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"FEATURED_CREATORS\", options);\n\nexport const getExploreFeaturedVideos = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"FEATURED_VIDEOS\", options);\n\n/** Get trending coins across all types */\nexport const getTrendingAll = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TRENDING_ALL\", options);\n\n/** Get trending creator coins */\nexport const getTrendingCreators = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TRENDING_CREATORS\", options);\n\n/** Get trending posts */\nexport const getTrendingPosts = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TRENDING_POSTS\", options);\n\n/** Get most valuable trend coins */\nexport const getMostValuableTrends = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"MOST_VALUABLE_TRENDS\", options);\n\n/** Get new trend coins */\nexport const getNewTrends = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> => createExploreQuery(query, \"NEW_TRENDS\", options);\n\n/** Get top volume trend coins (24h) */\nexport const getTopVolumeTrends24h = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TOP_VOLUME_TRENDS_24H\", options);\n\n/** Get trending trend coins */\nexport const getTrendingTrends = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"TRENDING_TRENDS\", options);\n\n/** Get most valuable coins across all types */\nexport const getMostValuableAll = (\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n createExploreQuery(query, \"MOST_VALUABLE_ALL\", options);\n\n/** Look up a single trend coin by ticker (case-insensitive) */\nexport const getTrend = (\n query: GetTrendCoinData[\"query\"],\n options?: RequestOptionsType<GetTrendCoinData>,\n): Promise<TrendCoinResponse> =>\n getTrendCoinSDK({\n ...options,\n query,\n ...getApiKeyMeta(),\n });\n\n/** Search trend coins by name, with fuzzy search (paginated) */\nexport const getTrends = (\n query: GetTrendsByNameData[\"query\"],\n options?: RequestOptionsType<GetTrendsByNameData>,\n): Promise<TrendsByNameResponse> =>\n getTrendsByNameSDK({\n ...options,\n query,\n ...getApiKeyMeta(),\n });\n\n/** Generic explore query for any list type */\nexport const getExploreList = (\n listType: ListType,\n query: QueryRequestType = {},\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> => createExploreQuery(query, listType, options);\n","import {\n GetCoinCommentsData,\n GetCoinCommentsResponse,\n GetCoinData,\n GetCoinHoldersData,\n GetCoinHoldersResponse,\n GetCoinPriceHistoryData,\n GetCoinPriceHistoryResponse,\n GetCoinResponse,\n GetCoinsData,\n GetCoinsResponse,\n GetCoinSwapsData,\n GetCoinSwapsResponse,\n GetProfileBalancesData,\n GetProfileBalancesResponse,\n GetProfileCoinsData,\n GetProfileCoinsResponse,\n GetProfileData,\n GetProfileResponse,\n GetFeaturedCreatorsData,\n GetFeaturedCreatorsResponse,\n GetTraderLeaderboardData,\n GetTraderLeaderboardResponse,\n GetProfileSocialResponse,\n GetProfileSocialData,\n GetTokenInfoData,\n GetTokenInfoResponse,\n GetContentCoinPoolConfigData,\n GetContentCoinPoolConfigResponse,\n GetCreatorCoinPoolConfigData,\n GetCreatorCoinPoolConfigResponse,\n GetCreatorLivestreamCommentsData,\n GetCreatorLivestreamCommentsResponse,\n GetWalletTradeActivityData,\n GetWalletTradeActivityResponse,\n} from \"../client/types.gen\";\nimport {\n getCoin as getCoinSDK,\n getCoins as getCoinsSDK,\n getCoinComments as getCoinCommentsSDK,\n getCoinHolders as getCoinHoldersSDK,\n getCoinPriceHistory as getCoinPriceHistorySDK,\n getCoinSwaps as getCoinSwapsSDK,\n getProfile as getProfileSDK,\n getProfileBalances as getProfileBalancesSDK,\n getProfileCoins as getProfileCoinsSDK,\n getProfileSocial as getProfileSocialSDK,\n getTokenInfo as getTokenInfoSDK,\n getFeaturedCreators as getFeaturedCreatorsSDK,\n getTraderLeaderboard as getTraderLeaderboardSDK,\n getContentCoinPoolConfig as getContentCoinPoolConfigSDK,\n getCreatorCoinPoolConfig as getCreatorCoinPoolConfigSDK,\n getCreatorLivestreamComments as getCreatorLivestreamCommentsSDK,\n getWalletTradeActivity as getWalletTradeActivitySDK,\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 ...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 ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetCoinHoldersQuery = GetCoinHoldersData[\"query\"];\nexport type { GetCoinHoldersQuery, GetCoinHoldersData };\nexport type { GetCoinHoldersResponse } from \"../client/types.gen\";\n\nexport const getCoinHolders = async (\n query: GetCoinHoldersQuery,\n options?: RequestOptionsType<GetCoinHoldersData>,\n): Promise<RequestResult<GetCoinHoldersResponse>> => {\n return await getCoinHoldersSDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetCoinPriceHistoryQuery = GetCoinPriceHistoryData[\"query\"];\nexport type { GetCoinPriceHistoryQuery, GetCoinPriceHistoryData };\nexport type { GetCoinPriceHistoryResponse } from \"../client/types.gen\";\n\nexport const getCoinPriceHistory = async (\n query: GetCoinPriceHistoryQuery,\n options?: RequestOptionsType<GetCoinPriceHistoryData>,\n): Promise<RequestResult<GetCoinPriceHistoryResponse>> => {\n return await getCoinPriceHistorySDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetCoinSwapsQuery = GetCoinSwapsData[\"query\"];\nexport type { GetCoinSwapsQuery, GetCoinSwapsData };\nexport type { GetCoinSwapsResponse } from \"../client/types.gen\";\n\nexport const getCoinSwaps = async (\n query: GetCoinSwapsQuery,\n options?: RequestOptionsType<GetCoinSwapsData>,\n): Promise<RequestResult<GetCoinSwapsResponse>> => {\n return await getCoinSwapsSDK({\n query,\n ...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 ...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 ...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 ...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 ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetProfileSocialQuery = GetProfileSocialData[\"query\"];\nexport type { GetProfileSocialQuery, GetProfileSocialData };\nexport type { GetProfileSocialResponse } from \"../client/types.gen\";\n\nexport const getProfileSocial = async (\n query: GetProfileSocialQuery,\n options?: RequestOptionsType<GetProfileSocialData>,\n): Promise<RequestResult<GetProfileSocialResponse>> => {\n return await getProfileSocialSDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetTokenInfoQuery = GetTokenInfoData[\"query\"];\nexport type { GetTokenInfoQuery, GetTokenInfoData };\nexport type { GetTokenInfoResponse } from \"../client/types.gen\";\n\nexport const getTokenInfo = async (\n query: GetTokenInfoQuery,\n options?: RequestOptionsType<GetTokenInfoData>,\n): Promise<RequestResult<GetTokenInfoResponse>> => {\n return await getTokenInfoSDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetFeaturedCreatorsQuery = GetFeaturedCreatorsData[\"query\"];\nexport type { GetFeaturedCreatorsQuery, GetFeaturedCreatorsData };\nexport type { GetFeaturedCreatorsResponse } from \"../client/types.gen\";\n\nexport const getFeaturedCreators = async (\n query: GetFeaturedCreatorsQuery = {},\n options?: RequestOptionsType<GetFeaturedCreatorsData>,\n): Promise<RequestResult<GetFeaturedCreatorsResponse>> => {\n return await getFeaturedCreatorsSDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetTraderLeaderboardQuery = GetTraderLeaderboardData[\"query\"];\nexport type { GetTraderLeaderboardQuery, GetTraderLeaderboardData };\nexport type { GetTraderLeaderboardResponse } from \"../client/types.gen\";\n\nexport const getTraderLeaderboard = async (\n query: GetTraderLeaderboardQuery = {},\n options?: RequestOptionsType<GetTraderLeaderboardData>,\n): Promise<RequestResult<GetTraderLeaderboardResponse>> => {\n return await getTraderLeaderboardSDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetContentCoinPoolConfigQuery = GetContentCoinPoolConfigData[\"query\"];\nexport type { GetContentCoinPoolConfigQuery, GetContentCoinPoolConfigData };\nexport type { GetContentCoinPoolConfigResponse } from \"../client/types.gen\";\n\nexport const getContentCoinPoolConfig = async (\n query: GetContentCoinPoolConfigQuery,\n options?: RequestOptionsType<GetContentCoinPoolConfigData>,\n): Promise<RequestResult<GetContentCoinPoolConfigResponse>> => {\n return await getContentCoinPoolConfigSDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetCreatorCoinPoolConfigQuery = GetCreatorCoinPoolConfigData[\"query\"];\nexport type { GetCreatorCoinPoolConfigQuery, GetCreatorCoinPoolConfigData };\nexport type { GetCreatorCoinPoolConfigResponse } from \"../client/types.gen\";\n\nexport const getCreatorCoinPoolConfig = async (\n query: GetCreatorCoinPoolConfigQuery,\n options?: RequestOptionsType<GetCreatorCoinPoolConfigData>,\n): Promise<RequestResult<GetCreatorCoinPoolConfigResponse>> => {\n return await getCreatorCoinPoolConfigSDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetCreatorLivestreamCommentsQuery =\n GetCreatorLivestreamCommentsData[\"query\"];\nexport type {\n GetCreatorLivestreamCommentsQuery,\n GetCreatorLivestreamCommentsData,\n};\nexport type { GetCreatorLivestreamCommentsResponse } from \"../client/types.gen\";\n\nexport const getCreatorLivestreamComments = async (\n query: GetCreatorLivestreamCommentsQuery,\n options?: RequestOptionsType<GetCreatorLivestreamCommentsData>,\n): Promise<RequestResult<GetCreatorLivestreamCommentsResponse>> => {\n return await getCreatorLivestreamCommentsSDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n\ntype GetWalletTradeActivityQuery = GetWalletTradeActivityData[\"query\"];\nexport type { GetWalletTradeActivityQuery, GetWalletTradeActivityData };\nexport type { GetWalletTradeActivityResponse } from \"../client/types.gen\";\n\nexport const getWalletTradeActivity = async (\n query: GetWalletTradeActivityQuery,\n options?: RequestOptionsType<GetWalletTradeActivityData>,\n): Promise<RequestResult<GetWalletTradeActivityResponse>> => {\n return await getWalletTradeActivitySDK({\n query,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n","import {\n PostCreateContentData,\n PostCreateContentResponse,\n} from \"../client/types.gen\";\nimport { postCreateContent as postCreateContentSDK } from \"../client/sdk.gen\";\nimport { getApiKeyMeta } from \"./api-key\";\nimport { RequestOptionsType } from \"./query-types\";\nimport { RequestResult } from \"@hey-api/client-fetch\";\n\ntype PostCreateContentQuery = PostCreateContentData[\"body\"];\nexport type { PostCreateContentQuery, PostCreateContentResponse };\n\nexport type CoinCreateData = NonNullable<PostCreateContentResponse>;\n\nexport const postCreateContent = async (\n body: PostCreateContentQuery,\n options?: RequestOptionsType<PostCreateContentData>,\n): Promise<RequestResult<PostCreateContentResponse>> => {\n return await postCreateContentSDK({\n ...options,\n body,\n ...getApiKeyMeta(),\n });\n};\n","import {\n GetProfileBySocialHandleData,\n GetProfileBySocialHandleResponse,\n} from \"../client/types.gen\";\nimport { getProfileBySocialHandle as getProfileBySocialHandleSDK } from \"../client/sdk.gen\";\nimport { getApiKeyMeta } from \"./api-key\";\nimport { RequestOptionsType } from \"./query-types\";\nimport { RequestResult } from \"@hey-api/client-fetch\";\n\ntype GetProfileBySocialHandleQuery = GetProfileBySocialHandleData[\"query\"];\nexport type { GetProfileBySocialHandleQuery, GetProfileBySocialHandleData };\nexport type { GetProfileBySocialHandleResponse } from \"../client/types.gen\";\n\nexport const getProfileBySocialHandle = async (\n query: GetProfileBySocialHandleQuery,\n options?: RequestOptionsType<GetProfileBySocialHandleData>,\n): Promise<RequestResult<GetProfileBySocialHandleResponse>> => {\n return await getProfileBySocialHandleSDK({\n ...options,\n query,\n ...getApiKeyMeta(),\n });\n};\n","import { ValidMetadataURI } from \"../uploader/types\";\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 { cleanAndValidateMetadataURI } from \"./cleanAndValidateMetadataURI\";\nimport { ValidMetadataURI } from \"../uploader/types\";\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 let response: Response;\n const cleanedURI = cleanAndValidateMetadataURI(metadataURI);\n\n try {\n response = await fetch(cleanedURI);\n } catch (error) {\n // handle actual fetch failures (i.e. network errors)\n const errorMessage = error instanceof Error ? error.message : String(error);\n throw new Error(\n `Metadata fetch failed for URL '${cleanedURI}': ${errorMessage}`,\n );\n }\n\n if (!response.ok) {\n throw new Error(\n `Metadata fetch failed for URL '${cleanedURI}': ${response.statusText ? `${response.statusText} (HTTP ${response.status})` : `HTTP ${response.status}`}`,\n );\n }\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\n const metadataJson = await response.json();\n return validateMetadataJSON(metadataJson);\n}\n","import {\n type Abi,\n type Address,\n concatHex,\n type ContractFunctionArgs,\n type ContractFunctionName,\n type ContractFunctionParameters,\n encodeFunctionData,\n type Hex,\n} from \"viem\";\n\nconst EMPTY_HEX: Hex = \"0x\";\n\ntype WritableMutability = \"payable\" | \"nonpayable\";\n\ntype WritableFunction<abi extends Abi | readonly unknown[]> =\n ContractFunctionName<abi, WritableMutability>;\n\ntype WritableArgs<\n abi extends Abi | readonly unknown[],\n functionName extends WritableFunction<abi>,\n> = ContractFunctionArgs<abi, WritableMutability, functionName>;\n\nexport type ContractCall<\n abi extends Abi | readonly unknown[] = readonly unknown[],\n fn extends WritableFunction<abi> = WritableFunction<abi>,\n args extends WritableArgs<abi, fn> = WritableArgs<abi, fn>,\n> = ContractFunctionParameters<abi, WritableMutability, fn, args> & {\n /** Optional ETH value to send with the call. */\n value?: bigint;\n /**\n * Optional calldata appended after the encoded function data, e.g. for\n * attribution. Mirrors viem's `dataSuffix`; concatenated by {@link toGenericCall}.\n */\n dataSuffix?: Hex;\n};\n\nexport const isContractCall = (\n call: ContractCall | SendCall,\n): call is ContractCall => {\n return (\n (call as ContractCall).address !== undefined &&\n (call as ContractCall).abi !== undefined &&\n (call as ContractCall).functionName !== undefined\n );\n};\n\nexport type SendCall = {\n to: Address;\n value?: bigint;\n};\n\nexport const isSendCall = (call: ContractCall | SendCall): call is SendCall => {\n return !isContractCall(call) && (call as SendCall).to !== undefined;\n};\n\n/**\n * A normalized, fully-encoded contract call.\n *\n * This is the canonical call shape emitted by the action `createAndValidate*Calls`\n * builders. It intentionally matches the encoded-call form accepted by both\n * `walletClient.sendTransaction` (EOA execution) and viem's bundler client\n * `prepareUserOperation` / `sendUserOperation` (smart wallet / user operation\n * execution), so a single call list can drive either flow.\n */\nexport type GenericCall = {\n to: Address;\n data: Hex;\n value: bigint;\n};\n\n/**\n * The encoded-call shape accepted by viem's bundler client `calls` parameter\n * (`prepareUserOperation` / `sendUserOperation`).\n *\n * `data` and `value` are optional on viem's side; we always populate them from a\n * {@link GenericCall}.\n */\nexport type UserOperationCall = {\n to: Address;\n data?: Hex;\n value?: bigint;\n};\n\n/**\n * Converts a contract call or send call to a generic call.\n */\nexport function toGenericCall(call: ContractCall | SendCall): GenericCall {\n // convert a simple send call to a user operation call\n if (isSendCall(call)) {\n return {\n to: call.to,\n value: call.value ?? 0n,\n data: EMPTY_HEX,\n };\n }\n\n // convert a contract call to a user operation call\n // if the call has a data suffix, we need to manually concatenate it with the call data\n // it is used to add the attribution to the call data\n const { dataSuffix } = call;\n const callData = encodeFunctionData(call);\n const data = dataSuffix ? concatHex([callData, dataSuffix]) : callData;\n\n return {\n to: call.address,\n value: call.value ?? 0n,\n data,\n };\n}\n\n/**\n * Adapts a list of {@link GenericCall} into the call shape expected by viem's\n * bundler client.\n *\n * A {@link GenericCall} is already fully encoded calldata, so this is a thin\n * adapter rather than an encoder. It exists as an explicit seam: it owns any\n * future divergence between our `GenericCall` shape and viem's user-operation\n * call type, and keeps the conversion point obvious at call sites.\n */\nexport function toUserOperationCalls(\n calls: GenericCall[],\n): UserOperationCall[] {\n return calls.map((call) => ({\n to: call.to,\n data: call.data,\n value: call.value,\n }));\n}\n","import { base, baseSepolia, Chain } from \"viem/chains\";\n\nexport function getChainFromId(chainId: number): Chain {\n if (chainId === base.id) {\n return base;\n }\n if (chainId === baseSepolia.id) {\n return baseSepolia;\n }\n\n throw new Error(`Chain ID ${chainId} not supported`);\n}\n","import {\n Abi,\n BaseError,\n ContractFunctionRevertedError,\n decodeErrorResult,\n Hex,\n} from \"viem\";\n\nexport function rethrowDecodedRevert(err: unknown, abi: Abi): never {\n if (err instanceof BaseError) {\n const revertError = err.walk(\n (e) => e instanceof ContractFunctionRevertedError,\n );\n if (revertError instanceof ContractFunctionRevertedError) {\n // Try to decode using factory ABI\n try {\n const revertData =\n typeof (revertError as any).data === \"object\" &&\n (revertError as any).data !== null &&\n \"data\" in (revertError as any).data\n ? (revertError as any).data.data\n : (revertError as any).data;\n const decoded = decodeErrorResult({\n abi,\n data: revertData as Hex,\n });\n const name = decoded.errorName;\n const args = decoded.args as ReadonlyArray<unknown> | undefined;\n const message =\n Array.isArray(args) && args.length > 0\n ? `${name}(${args.map((a) => String(a)).join(\", \")})`\n : name;\n throw new Error(`Create coin transaction reverted: ${message}`);\n } catch {\n const errorName = (revertError as any).data?.errorName as\n | string\n | undefined;\n if (errorName) {\n const args = (revertError as any).data?.args as unknown[] | undefined;\n const message =\n Array.isArray(args) && args.length > 0\n ? `${errorName}(${args.map((a) => String(a)).join(\", \")})`\n : errorName;\n throw new Error(`Create coin transaction reverted: ${message}`);\n }\n }\n }\n }\n throw err;\n}\n","import { formatEther, Hex } from \"viem\";\nimport type {\n BundlerClient,\n SmartAccount,\n UserOperation,\n UserOperationReceipt,\n} from \"viem/account-abstraction\";\nimport { UserOperationCall } from \"./calls\";\n\n// Coinbase Smart Wallet uses ERC-4337 entry point 0.6.\nexport type PreparedUserOperation = UserOperation<\"0.6\">;\n\n/**\n * Prepares a user operation from a list of contract calls.\n * Returns a fully-populated UserOperation (gas estimated, nonce filled) with a\n * stub signature from gas estimation. Must be re-signed before submitting.\n */\nexport const prepareUserOperation = async ({\n bundlerClient,\n account,\n calls,\n}: {\n bundlerClient: BundlerClient;\n account: SmartAccount;\n calls: readonly UserOperationCall[];\n}): Promise<PreparedUserOperation> => {\n const prepared = await bundlerClient.prepareUserOperation({\n account,\n calls,\n });\n return prepared as PreparedUserOperation;\n};\n\n/**\n * Signs and submits a prepared user operation, then waits for the receipt.\n *\n * The prepared op carries a stub signature from gas estimation, so we re-sign\n * here before sending. Otherwise viem's sendUserOperation would forward the\n * stub and the bundler would reject it as invalid.\n */\nexport const submitUserOperation = async ({\n bundlerClient,\n account,\n userOperation,\n}: {\n bundlerClient: BundlerClient;\n account: SmartAccount;\n userOperation: PreparedUserOperation;\n}): Promise<UserOperationReceipt> => {\n let hash: Hex;\n const signature = await account.signUserOperation(userOperation);\n\n try {\n hash = await bundlerClient.sendUserOperation({\n account,\n ...userOperation,\n signature,\n });\n } catch (error) {\n // handle gas errors to provide better user feedback\n if (isGasError(error)) {\n throw new CoinbaseGasError(error);\n }\n throw error;\n }\n\n return bundlerClient.waitForUserOperationReceipt({ hash });\n};\n\ntype CoinbaseBundlerError = {\n stack: string;\n message: string;\n cause: unknown;\n details: string;\n docsPath: string;\n shortMessage: string;\n version: string;\n name: string;\n};\n\nexport class CoinbaseGasError extends Error {\n cause: unknown;\n details: string;\n required?: bigint;\n available?: bigint;\n constructor(error: CoinbaseBundlerError) {\n let message: string;\n let available: bigint | undefined;\n let required: bigint | undefined;\n\n const match = error.details.match(\n /precheck failed: sender balance and deposit together is (\\d+)? but must be at least (\\d+)? to pay for this operation/,\n );\n\n if (match) {\n available = match[1] ? BigInt(match[1]) : undefined;\n required = match[2] ? BigInt(match[2]) : undefined;\n\n if (available !== undefined && required !== undefined) {\n message = `Insufficient balance. You need at least ${formatEther(required)} ETH to pay for this operation, but you only have ${formatEther(available)} ETH.`;\n } else if (required !== undefined) {\n message = `Insufficient balance. Make sure you have at least ${formatEther(required)} ETH in your wallet.`;\n } else {\n message = `Insufficient balance. Make sure you have enough ETH to pay for this operation.`;\n }\n } else {\n message = error.details ?? error.message;\n }\n\n super(message);\n this.cause = error.cause;\n this.details = error.details;\n this.available = available;\n this.required = required;\n }\n}\n\nfunction isGasError(error: unknown): error is CoinbaseBundlerError {\n return (\n (error as CoinbaseBundlerError).details?.startsWith(\n \"precheck failed: sender balance and deposit together is\",\n ) ?? false\n );\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","import { coinABI } from \"@zoralabs/protocol-deployments\";\nimport {\n Account,\n Address,\n parseEventLogs,\n SimulateContractParameters,\n WalletClient,\n} from \"viem\";\nimport { BundlerClient, SmartAccount } from \"viem/account-abstraction\";\nimport { getAttribution } from \"../utils/attribution\";\nimport { toGenericCall, toUserOperationCalls } from \"../utils/calls\";\nimport { GenericPublicClient } from \"../utils/genericPublicClient\";\nimport {\n prepareUserOperation,\n submitUserOperation,\n} from \"../utils/userOperation\";\nimport { validateClientNetwork } from \"../utils/validateClientNetwork\";\n\nexport type UpdateCoinURIArgs = {\n coin: Address;\n newURI: string;\n};\n\n/**\n * Validates the arguments for updating a coin's URI.\n *\n * Asserts the new URI is an `ipfs://` URI. Shared by the contract-call builder\n * (`updateCoinURICall`) and the user-operation path so both validate identically.\n */\nexport function validateUpdateCoinURI({ newURI }: UpdateCoinURIArgs): void {\n if (!newURI.startsWith(\"ipfs://\")) {\n throw new Error(\"URI needs to be an ipfs:// prefix uri\");\n }\n}\n\nexport function updateCoinURICall(\n args: UpdateCoinURIArgs,\n): SimulateContractParameters {\n validateUpdateCoinURI(args);\n\n const { coin, newURI } = args;\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 account?: Account | Address,\n) {\n validateClientNetwork(publicClient);\n\n const call = updateCoinURICall(args);\n\n const { request } = await publicClient.simulateContract({\n ...call,\n account: account ?? walletClient.account,\n });\n\n const hash = await walletClient.writeContract(request);\n\n const receipt = await publicClient.waitForTransactionReceipt({ hash });\n\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\n/**\n * Updates a coin's URI from the caller's smart wallet via a user operation.\n *\n * Builds the `setContractURI` call, submits it through the bundler client (which\n * wraps it in the smart wallet's `execute`), and parses the result. Mirrors\n * {@link updateCoinURI}'s return shape (`hash` is the settled transaction hash,\n * `receipt` the underlying transaction receipt).\n */\nexport async function updateCoinURISmartWallet(\n args: UpdateCoinURIArgs,\n bundlerClient: BundlerClient,\n publicClient: GenericPublicClient,\n account?: SmartAccount,\n) {\n const resolvedAccount = account ?? bundlerClient.account;\n if (!resolvedAccount) {\n throw new Error(\"Account is required\");\n }\n\n validateClientNetwork(publicClient);\n\n // updateCoinURICall validates the args and assembles the contract call\n const call = updateCoinURICall(args);\n\n const calls = toUserOperationCalls([toGenericCall(call)]);\n\n const userOp = await prepareUserOperation({\n bundlerClient,\n account: resolvedAccount,\n calls,\n });\n\n const userOpReceipt = await submitUserOperation({\n bundlerClient,\n account: resolvedAccount,\n userOperation: userOp,\n });\n\n if (!userOpReceipt.success) {\n throw new Error(\n `User operation reverted${userOpReceipt.reason ? `: ${userOpReceipt.reason}` : \"\"}`,\n );\n }\n\n const eventLogs = parseEventLogs({ abi: coinABI, logs: userOpReceipt.logs });\n const uriUpdated = eventLogs.find(\n (log) => log.eventName === \"ContractURIUpdated\",\n );\n\n return {\n hash: userOpReceipt.receipt.transactionHash,\n receipt: userOpReceipt.receipt,\n uriUpdated,\n };\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 { coinABI } from \"@zoralabs/protocol-deployments\";\nimport {\n Account,\n Address,\n isAddress,\n parseEventLogs,\n SimulateContractParameters,\n WalletClient,\n} from \"viem\";\nimport { BundlerClient, SmartAccount } from \"viem/account-abstraction\";\nimport { getAttribution } from \"../utils/attribution\";\nimport { toGenericCall, toUserOperationCalls } from \"../utils/calls\";\nimport { GenericPublicClient } from \"../utils/genericPublicClient\";\nimport {\n prepareUserOperation,\n submitUserOperation,\n} from \"../utils/userOperation\";\nimport { validateClientNetwork } from \"../utils/validateClientNetwork\";\n\nexport type UpdatePayoutRecipientArgs = {\n coin: Address;\n newPayoutRecipient: string;\n};\n\n/**\n * Validates the arguments for updating a coin's payout recipient.\n *\n * Asserts the new payout recipient is a valid address. Shared by the\n * contract-call builder (`updatePayoutRecipientCall`) and the user-operation path\n * so both validate identically.\n */\nexport function validateUpdatePayoutRecipient({\n newPayoutRecipient,\n}: UpdatePayoutRecipientArgs): void {\n if (!isAddress(newPayoutRecipient)) {\n throw new Error(\"Payout recipient must be a valid address\");\n }\n}\n\nexport function updatePayoutRecipientCall(\n args: UpdatePayoutRecipientArgs,\n): SimulateContractParameters {\n validateUpdatePayoutRecipient(args);\n\n const { coin, newPayoutRecipient } = args;\n\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 account?: Account | Address,\n) {\n validateClientNetwork(publicClient);\n\n const call = updatePayoutRecipientCall(args);\n\n const { request } = await publicClient.simulateContract({\n ...call,\n account: account ?? walletClient.account!,\n });\n\n const hash = await walletClient.writeContract(request);\n\n const receipt = await publicClient.waitForTransactionReceipt({ hash });\n\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\n/**\n * Updates a coin's payout recipient from the caller's smart wallet via a user\n * operation.\n *\n * Builds the `setPayoutRecipient` call, submits it through the bundler client\n * (which wraps it in the smart wallet's `execute`), and parses the result.\n * Mirrors {@link updatePayoutRecipient}'s return shape (`hash` is the settled\n * transaction hash, `receipt` the underlying transaction receipt).\n */\nexport async function updatePayoutRecipientSmartWallet(\n args: UpdatePayoutRecipientArgs,\n bundlerClient: BundlerClient,\n publicClient: GenericPublicClient,\n account?: SmartAccount,\n) {\n const resolvedAccount = account ?? bundlerClient.account;\n if (!resolvedAccount) {\n throw new Error(\"Account is required\");\n }\n\n validateClientNetwork(publicClient);\n\n // updatePayoutRecipientCall validates the args and assembles the contract call\n const call = updatePayoutRecipientCall(args);\n\n const calls = toUserOperationCalls([toGenericCall(call)]);\n\n const userOp = await prepareUserOperation({\n bundlerClient,\n account: resolvedAccount,\n calls,\n });\n\n const userOpReceipt = await submitUserOperation({\n bundlerClient,\n account: resolvedAccount,\n userOperation: userOp,\n });\n\n if (!userOpReceipt.success) {\n throw new Error(\n `User operation reverted${userOpReceipt.reason ? `: ${userOpReceipt.reason}` : \"\"}`,\n );\n }\n\n const eventLogs = parseEventLogs({ abi: coinABI, logs: userOpReceipt.logs });\n const payoutRecipientUpdated = eventLogs.find(\n (log) => log.eventName === \"CoinPayoutRecipientUpdated\",\n );\n\n return {\n hash: userOpReceipt.receipt.transactionHash,\n receipt: userOpReceipt.receipt,\n payoutRecipientUpdated,\n };\n}\n","import { permit2ABI, permit2Address } from \"@zoralabs/protocol-deployments\";\nimport {\n Account,\n Address,\n encodeFunctionData,\n erc20Abi,\n Hex,\n maxUint256,\n TransactionReceipt,\n WalletClient,\n} from \"viem\";\nimport { BundlerClient, SmartAccount } from \"viem/account-abstraction\";\nimport { base } from \"viem/chains\";\nimport { postQuote, PostQuoteResponse } from \"../client\";\nimport { GenericCall, toUserOperationCalls } from \"../utils/calls\";\nimport { GenericPublicClient } from \"../utils/genericPublicClient\";\nimport {\n prepareUserOperation,\n submitUserOperation,\n} from \"../utils/userOperation\";\n\ntype TradeERC20 = {\n type: \"erc20\";\n address: Address;\n};\n\ntype TradeETH = {\n type: \"eth\";\n};\n\ntype PermitDetails = {\n token: Address;\n amount: bigint;\n expiration: number;\n nonce: number;\n};\n\ntype Permit = {\n details: PermitDetails;\n spender: Address;\n sigDeadline: bigint;\n};\n\ntype PermitDetailsStringAmounts = {\n token: Address;\n amount: string;\n expiration: number;\n nonce: number;\n};\n\ntype PermitStringAmounts = {\n details: PermitDetailsStringAmounts;\n spender: Address;\n sigDeadline: string;\n};\n\ntype SignatureWithPermit<TPermit = Permit> = {\n signature: Hex;\n permit: TPermit;\n};\n\nfunction convertBigIntToString(permit: Permit): PermitStringAmounts {\n return {\n ...permit,\n details: {\n ...permit.details,\n amount: `${permit.details.amount}`,\n },\n sigDeadline: `${permit.sigDeadline}`,\n };\n}\n\nconst PERMIT_SINGLE_TYPES = {\n PermitSingle: [\n { name: \"details\", type: \"PermitDetails\" },\n { name: \"spender\", type: \"address\" },\n { name: \"sigDeadline\", type: \"uint256\" },\n ],\n PermitDetails: [\n { name: \"token\", type: \"address\" },\n { name: \"amount\", type: \"uint160\" },\n { name: \"expiration\", type: \"uint48\" },\n { name: \"nonce\", type: \"uint48\" },\n ],\n};\n\ntype TradeCurrency = TradeERC20 | TradeETH;\n\nexport type TradeParameters = {\n sell: TradeCurrency;\n buy: TradeCurrency;\n amountIn: bigint;\n slippage?: number;\n // can be smart wallet or EOA here.\n sender: Address;\n // needs to be EOA, if signer is blank assumes EOA in sender.\n signer?: Address;\n recipient?: Address;\n signatures?: SignatureWithPermit<PermitStringAmounts>[];\n permitActiveSeconds?: number;\n};\n\ntype SignPermitTypedData = (params: {\n domain: { name: string; chainId: number; verifyingContract: Address };\n types: typeof PERMIT_SINGLE_TYPES;\n primaryType: \"PermitSingle\";\n message: Permit;\n}) => Promise<Hex>;\n\n/**\n * Resolves the permit2 requirements for a trade quote.\n *\n * For each permit the quote requires, reads the on-chain permit2 nonce and the\n * token's permit2 allowance, signs the permit2 `PermitSingle` typed data with the\n * provided signer, and — when the token's permit2 allowance is insufficient —\n * collects the ERC20 `approve(permit2, max)` call needed before the trade.\n *\n * The approval is returned as a {@link GenericCall} rather than executed, so the\n * caller decides how to run it: `tradeCoin` (EOA) sends it as a prior\n * transaction; `tradeCoinSmartWallet` batches it into the trade's user operation.\n */\nasync function resolveTradePermits({\n quote,\n owner,\n publicClient,\n signTypedData,\n}: {\n quote: PostQuoteResponse;\n owner: Address;\n publicClient: GenericPublicClient;\n signTypedData: SignPermitTypedData;\n}): Promise<{\n signatures: SignatureWithPermit<PermitStringAmounts>[];\n approvalCalls: GenericCall[];\n}> {\n const signatures: SignatureWithPermit<PermitStringAmounts>[] = [];\n const approvalCalls: GenericCall[] = [];\n\n if (!quote.permits) {\n return { signatures, approvalCalls };\n }\n\n for (const permit of quote.permits) {\n // permit2 allowance returns [amount, expiration, nonce]\n const [, , nonce] = await publicClient.readContract({\n abi: permit2ABI,\n address: permit2Address[base.id],\n functionName: \"allowance\",\n args: [\n owner,\n permit.permit.details.token as Address,\n permit.permit.spender as Address,\n ],\n });\n\n const permitToken = permit.permit.details.token as Address;\n const allowance = await publicClient.readContract({\n abi: erc20Abi,\n address: permitToken,\n functionName: \"allowance\",\n args: [owner, permit2Address[base.id]],\n });\n\n if (allowance < BigInt(permit.permit.details.amount)) {\n approvalCalls.push({\n to: permitToken,\n data: encodeFunctionData({\n abi: erc20Abi,\n functionName: \"approve\",\n args: [permit2Address[base.id], maxUint256],\n }),\n value: 0n,\n });\n }\n\n const message: Permit = {\n details: {\n token: permit.permit.details.token as Address,\n amount: BigInt(permit.permit.details.amount!),\n expiration: Number(permit.permit.details.expiration!),\n nonce,\n },\n spender: permit.permit.spender as Address,\n sigDeadline: BigInt(permit.permit.sigDeadline!),\n };\n\n const signature = await signTypedData({\n domain: {\n name: \"Permit2\",\n chainId: base.id,\n verifyingContract: permit2Address[base.id],\n },\n primaryType: \"PermitSingle\",\n types: PERMIT_SINGLE_TYPES,\n message,\n });\n\n signatures.push({\n signature,\n permit: convertBigIntToString(message),\n });\n }\n\n return { signatures, approvalCalls };\n}\n\nexport async function tradeCoin({\n tradeParameters,\n walletClient,\n account,\n publicClient,\n validateTransaction = true,\n}: {\n tradeParameters: TradeParameters;\n walletClient: WalletClient;\n account?: Account | Address;\n publicClient: GenericPublicClient;\n validateTransaction?: boolean;\n}): Promise<TransactionReceipt> {\n const quote = await createTradeCall(tradeParameters);\n\n if (!account) {\n account = walletClient.account;\n }\n if (!account) {\n throw new Error(\"Account is required\");\n }\n const resolvedAccount = account;\n const owner =\n typeof resolvedAccount === \"string\"\n ? resolvedAccount\n : resolvedAccount.address;\n\n // Set default recipient to wallet sender address if not provided\n if (!tradeParameters.recipient) {\n tradeParameters.recipient = owner;\n }\n\n const { signatures, approvalCalls } = await resolveTradePermits({\n quote,\n owner,\n publicClient,\n signTypedData: (typedData) =>\n walletClient.signTypedData({ ...typedData, account: resolvedAccount }),\n });\n\n // EOA path: execute each required permit2 approval as its own transaction\n for (const approvalCall of approvalCalls) {\n const approvalTx = await walletClient.sendTransaction({\n ...approvalCall,\n account: resolvedAccount,\n chain: base,\n });\n await publicClient.waitForTransactionReceipt({ hash: approvalTx });\n }\n\n const newQuote = await createTradeCall({\n ...tradeParameters,\n signatures,\n });\n\n const call = {\n to: newQuote.call.target as Address,\n data: newQuote.call.data as Hex,\n value: BigInt(newQuote.call.value),\n chain: base,\n account: resolvedAccount,\n };\n\n // simulate call\n if (validateTransaction) {\n await publicClient.call(call);\n }\n\n const gasEstimate = validateTransaction\n ? await publicClient.estimateGas(call)\n : 10_000_000n;\n const gasPrice = await publicClient.getGasPrice();\n\n const tx = await walletClient.sendTransaction({\n ...call,\n gasPrice,\n gas: gasEstimate,\n });\n\n const receipt = await publicClient.waitForTransactionReceipt({\n hash: tx,\n });\n\n return receipt;\n}\n\n/**\n * Executes a trade from the caller's smart wallet via a user operation.\n *\n * Mirrors {@link tradeCoin} but routes through a bundler client: the smart\n * account is both the token holder and the permit2 signer (ERC-1271), and any\n * required permit2 approval is batched into the same user operation as the trade\n * (rather than sent as a prior transaction). Returns the settled transaction\n * receipt.\n */\nexport async function tradeCoinSmartWallet({\n tradeParameters,\n bundlerClient,\n account,\n publicClient,\n}: {\n tradeParameters: TradeParameters;\n bundlerClient: BundlerClient;\n account?: SmartAccount;\n publicClient: GenericPublicClient;\n}) {\n const resolvedAccount = account ?? bundlerClient.account;\n if (!resolvedAccount) {\n throw new Error(\"Account is required\");\n }\n\n const owner = resolvedAccount.address;\n\n // The smart wallet is both the sender (token holder) and the permit signer.\n const params: TradeParameters = {\n ...tradeParameters,\n sender: owner,\n recipient: tradeParameters.recipient ?? owner,\n };\n\n const quote = await createTradeCall(params);\n\n const { signatures, approvalCalls } = await resolveTradePermits({\n quote,\n owner,\n publicClient,\n signTypedData: (typedData) => resolvedAccount.signTypedData(typedData),\n });\n\n const newQuote = await createTradeCall({\n ...params,\n signatures,\n });\n\n const tradeCall: GenericCall = {\n to: newQuote.call.target as Address,\n data: newQuote.call.data as Hex,\n value: BigInt(newQuote.call.value),\n };\n\n // Batch any required permit2 approvals + the trade into one user operation\n const calls = toUserOperationCalls([...approvalCalls, tradeCall]);\n\n const userOp = await prepareUserOperation({\n bundlerClient,\n account: resolvedAccount,\n calls,\n });\n\n const userOpReceipt = await submitUserOperation({\n bundlerClient,\n account: resolvedAccount,\n userOperation: userOp,\n });\n\n if (!userOpReceipt.success) {\n throw new Error(\n `User operation reverted${userOpReceipt.reason ? `: ${userOpReceipt.reason}` : \"\"}`,\n );\n }\n\n return userOpReceipt.receipt;\n}\n\n/**\n * Validates the parameters for a trade.\n *\n * Asserts slippage is within bounds and a non-zero input amount is provided.\n * Shared by the quote builder (`createTradeCall`) and the user-operation path so\n * both validate identically before any network request is made.\n */\nexport function validateTradeParameters(\n tradeParameters: TradeParameters,\n): void {\n if (tradeParameters.slippage && tradeParameters.slippage > 1) {\n throw new Error(\"Slippage must be less than 1, max 0.99\");\n }\n if (tradeParameters.amountIn === BigInt(0)) {\n throw new Error(\"Amount in must be greater than 0\");\n }\n}\n\nexport async function createTradeCall(\n tradeParameters: TradeParameters,\n): Promise<PostQuoteResponse> {\n return createQuote(tradeParameters);\n}\n\nexport async function createQuote(\n tradeParameters: TradeParameters,\n): Promise<PostQuoteResponse> {\n validateTradeParameters(tradeParameters);\n\n const quote = await postQuote({\n body: {\n tokenIn: tradeParameters.sell,\n tokenOut: tradeParameters.buy,\n amountIn: tradeParameters.amountIn.toString(),\n slippage: tradeParameters.slippage,\n chainId: base.id,\n sender: tradeParameters.sender,\n recipient: tradeParameters.recipient || tradeParameters.sender,\n signatures: tradeParameters.signatures,\n },\n });\n\n if (!quote.data) {\n console.error(quote);\n const errorBody = quote.error as\n | { error?: string; errorType?: string }\n | undefined;\n const errorMessage = errorBody?.error || \"Quote failed\";\n const err = new Error(errorMessage);\n (err as any).errorType = errorBody?.errorType;\n (err as any).errorBody = errorBody;\n throw err;\n }\n\n return quote.data;\n}\n","import { client } from \"../client/client.gen\";\nimport { createConfig } from \"@hey-api/client-fetch\";\nimport { getApiKeyMeta } from \"./api-key\";\n\nexport const apiGet = (path: string, data?: Record<string, unknown>) =>\n client.get({ url: path, query: data, ...getApiKeyMeta() });\n\nexport const apiPost = (path: string, data?: Record<string, unknown>) =>\n client.post({ url: path, body: data, ...getApiKeyMeta() });\n\nexport const apiUrl = (path: string) => {\n const baseUrl = client.getConfig().baseUrl ?? \"\";\n // normalize the join boundary so we never end up with double slashes\n // (or a missing slash) between the base URL and the path\n const normalizedBase = baseUrl.replace(/\\/+$/, \"\");\n const normalizedPath = path.replace(/^\\/+/, \"\");\n return `${normalizedBase}/${normalizedPath}`;\n};\n\nexport const setApiBaseUrl = (baseUrl: string) => {\n client.setConfig(createConfig({ baseUrl }));\n};\n","import {\n CreateMetadataParameters,\n Uploader,\n UploadResult,\n ValidMetadataURI,\n} from \"./types\";\n\ntype Metadata = {\n name: string;\n symbol: string;\n description: string;\n image: string;\n properties?: Record<string, string>;\n animation_url?: string;\n content?: {\n uri: string;\n mime: string | undefined;\n };\n};\n\nexport function validateImageMimeType(mimeType: string) {\n if (\n ![\n \"image/png\",\n \"image/jpeg\",\n \"image/jpg\",\n \"image/gif\",\n \"image/svg+xml\",\n ].includes(mimeType)\n ) {\n throw new Error(\"Image must be a PNG, JPEG, JPG, GIF or SVG\");\n }\n}\n\nexport function getURLFromUploadResult(uploadResult: UploadResult) {\n return new URL(uploadResult.url);\n}\n\nexport class CoinMetadataBuilder {\n private name: string | undefined;\n private description: string | undefined;\n private symbol: string | undefined;\n private imageFile: File | undefined;\n private imageURL: URL | undefined;\n private mediaFile: File | undefined;\n private mediaURL: URL | undefined;\n private mediaMimeType: string | undefined;\n private properties: Record<string, string> | undefined;\n\n withName(name: string) {\n this.name = name;\n if (typeof name !== \"string\") {\n throw new Error(\"Name must be a string\");\n }\n\n return this;\n }\n\n withSymbol(symbol: string) {\n this.symbol = symbol;\n if (typeof symbol !== \"string\") {\n throw new Error(\"Symbol must be a string\");\n }\n\n return this;\n }\n\n withDescription(description: string) {\n this.description = description;\n if (typeof description !== \"string\") {\n throw new Error(\"Description must be a string\");\n }\n\n return this;\n }\n\n withImage(image: File) {\n if (this.imageURL) {\n throw new Error(\"Image URL already set\");\n }\n if (!(image instanceof File)) {\n throw new Error(\"Image must be a File\");\n }\n validateImageMimeType(image.type);\n this.imageFile = image;\n\n return this;\n }\n\n withImageURI(imageURI: string) {\n if (this.imageFile) {\n throw new Error(\"Image file already set\");\n }\n if (typeof imageURI !== \"string\") {\n throw new Error(\"Image URI must be a string\");\n }\n const url = new URL(imageURI);\n this.imageURL = url;\n\n return this;\n }\n\n withProperties(properties: Record<string, string>) {\n for (const [key, value] of Object.entries(properties)) {\n if (typeof key !== \"string\") {\n throw new Error(\"Property key must be a string\");\n }\n if (typeof value !== \"string\") {\n throw new Error(\"Property value must be a string\");\n }\n }\n if (!this.properties) {\n this.properties = {};\n }\n this.properties = { ...this.properties, ...properties };\n\n return this;\n }\n\n withMedia(media: File) {\n if (this.mediaURL) {\n throw new Error(\"Media URL already set\");\n }\n if (!(media instanceof File)) {\n throw new Error(\"Media must be a File\");\n }\n this.mediaMimeType = media.type;\n this.mediaFile = media;\n\n return this;\n }\n\n withMediaURI(mediaURI: string, mediaMimeType: string | undefined) {\n if (this.mediaFile) {\n throw new Error(\"Media file already set\");\n }\n if (typeof mediaURI !== \"string\") {\n throw new Error(\"Media URI must be a string\");\n }\n const url = new URL(mediaURI);\n this.mediaURL = url;\n this.mediaMimeType = mediaMimeType;\n\n return this;\n }\n\n validate() {\n if (!this.name) {\n throw new Error(\"Name is required\");\n }\n if (!this.symbol) {\n throw new Error(\"Symbol is required\");\n }\n if (!this.imageFile && !this.imageURL) {\n throw new Error(\"Image is required\");\n }\n\n return this;\n }\n\n generateMetadata(): Metadata {\n return {\n name: this.name!,\n symbol: this.symbol!,\n description: this.description!,\n image: this.imageURL!.toString(),\n animation_url: this.mediaURL?.toString(),\n content: this.mediaURL\n ? {\n uri: this.mediaURL?.toString(),\n mime: this.mediaMimeType,\n }\n : undefined,\n properties: this.properties,\n };\n }\n\n async upload(uploader: Uploader): Promise<{\n url: ValidMetadataURI;\n createMetadataParameters: CreateMetadataParameters;\n metadata: Metadata;\n }> {\n this.validate();\n\n if (this.imageFile) {\n const uploadResult = await uploader.upload(this.imageFile);\n this.imageURL = getURLFromUploadResult(uploadResult);\n }\n if (this.mediaFile) {\n const uploadResult = await uploader.upload(this.mediaFile);\n this.mediaURL = getURLFromUploadResult(uploadResult);\n }\n const metadata = this.generateMetadata();\n const uploadResult = await uploader.upload(\n new File([JSON.stringify(metadata)], \"metadata.json\", {\n type: \"application/json\",\n }),\n );\n\n return {\n url: getURLFromUploadResult(uploadResult).toString() as ValidMetadataURI,\n createMetadataParameters: {\n name: this.name!,\n symbol: this.symbol!,\n metadata: {\n type: \"RAW_URI\",\n uri: uploadResult.url,\n },\n },\n metadata,\n };\n }\n}\n\nexport function createMetadataBuilder() {\n return new CoinMetadataBuilder();\n}\n","import {\n SetCreateUploadJwtData,\n SetCreateUploadJwtResponse,\n} from \"../client/types.gen\";\nimport { setCreateUploadJwt as setCreateUploadJwtSDK } from \"../client/sdk.gen\";\nimport { getApiKeyMeta } from \"./api-key\";\nimport { RequestOptionsType } from \"./query-types\";\nimport { RequestResult } from \"@hey-api/client-fetch\";\n\ntype SetCreateUploadJwtQuery = SetCreateUploadJwtData[\"body\"];\nexport type { SetCreateUploadJwtQuery, SetCreateUploadJwtData };\nexport type { SetCreateUploadJwtResponse } from \"../client/types.gen\";\n\nexport const setCreateUploadJwt = async (\n body: SetCreateUploadJwtQuery,\n options?: RequestOptionsType<SetCreateUploadJwtData>,\n): Promise<RequestResult<SetCreateUploadJwtResponse>> => {\n return await setCreateUploadJwtSDK({\n body,\n ...getApiKeyMeta(),\n ...options,\n });\n};\n","import { Address } from \"viem\";\nimport { Uploader, UploadOptions, UploadResult } from \"../types\";\nimport { getApiKey } from \"../../api/api-key\";\nimport { setCreateUploadJwt } from \"../../api/internal\";\n\nconst JWT_TTL_MS = 1000 * 60 * 60; // 1 hour\nconst JWT_FETCH_TIMEOUT_MS = 15_000; // 15 seconds\n\n/**\n * Zora IPFS uploader implementation\n */\nexport class ZoraUploader implements Uploader {\n constructor(creatorAddress: Address) {\n this.creatorAddress = creatorAddress;\n if (!getApiKey()) {\n throw new Error(\"API key is required for metadata interactions\");\n }\n }\n\n private creatorAddress: Address;\n private jwtApiKey: string | undefined;\n private jwtApiKeyExpiresAt: number | undefined;\n\n private invalidateJwt() {\n this.jwtApiKey = undefined;\n this.jwtApiKeyExpiresAt = undefined;\n }\n\n private async getJWTApiKey(signal?: AbortSignal) {\n if (\n this.jwtApiKey &&\n this.jwtApiKeyExpiresAt &&\n this.jwtApiKeyExpiresAt > Date.now()\n ) {\n return this.jwtApiKey;\n }\n\n const jwtSignal = AbortSignal.timeout(JWT_FETCH_TIMEOUT_MS);\n const combinedSignal = signal\n ? AbortSignal.any([signal, jwtSignal])\n : jwtSignal;\n\n const response = await setCreateUploadJwt(\n {\n creatorAddress: this.creatorAddress,\n },\n { signal: combinedSignal },\n );\n this.jwtApiKey = response.data?.createUploadJwtFromApiKey;\n if (!this.jwtApiKey) {\n throw new Error(\"Failed to create upload JWT\");\n }\n\n this.jwtApiKeyExpiresAt = Date.now() + JWT_TTL_MS;\n\n return this.jwtApiKey;\n }\n\n private buildUploadSignal(options?: UploadOptions): AbortSignal | undefined {\n const { signal, timeout } = options ?? {};\n if (signal && timeout) {\n return AbortSignal.any([signal, AbortSignal.timeout(timeout)]);\n }\n if (timeout) {\n return AbortSignal.timeout(timeout);\n }\n return signal;\n }\n\n private async doUpload(\n file: File,\n jwt: string,\n signal?: AbortSignal,\n ): Promise<Response> {\n const formData = new FormData();\n formData.append(\"file\", file, file.name);\n\n return fetch(\"https://ipfs-uploader.zora.co/api/v0/add?cid-version=1\", {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${jwt}`,\n Accept: \"*/*\",\n },\n body: formData,\n signal,\n });\n }\n\n async upload(file: File, options?: UploadOptions): Promise<UploadResult> {\n const uploadSignal = this.buildUploadSignal(options);\n\n const jwt = await this.getJWTApiKey(uploadSignal);\n let response = await this.doUpload(file, jwt, uploadSignal);\n\n // On 401, refresh the JWT exactly once and retry\n if (response.status === 401) {\n this.invalidateJwt();\n const freshJwt = await this.getJWTApiKey(uploadSignal);\n response = await this.doUpload(file, freshJwt, uploadSignal);\n }\n\n if (!response.ok) {\n console.error(await response.text());\n throw new Error(`Failed to upload file: ${response.statusText}`);\n }\n\n const data = (await response.json()) as {\n cid: string;\n size: number | undefined;\n mimeType: string | undefined;\n };\n\n return {\n url: `ipfs://${data.cid}`,\n size: data.size,\n mimeType: data.mimeType,\n };\n }\n}\n\n/**\n * Create a new Zora IPFS uploader\n */\nexport function createZoraUploaderForCreator(\n creatorAddress: Address,\n): Uploader {\n return new ZoraUploader(creatorAddress);\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA,kBAAkB;AAAA,OACb;AACP;AAAA,EAIE;AAAA,EAEA;AAAA,EACA;AAAA,OAGK;AAEP,SAAS,QAAAA,aAAY;;;ACbrB;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AAeA,IAAM,SAAS;AAAA,EACpB,aAA4B;AAAA,IAC1B,SAAS;AAAA,EACX,CAAC;AACH;;;ACoFO,IAAM,UAAU,CACrB,YACG;AACH,UAAQ,QAAQ,UAAU,QAAe,IAIvC;AAAA,IACA,UAAU;AAAA,MACR;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,KAAK;AAAA,IACL,GAAG;AAAA,EACL,CAAC;AACH;AAKO,IAAM,kBAAkB,CAC7B,YACG;AACH,UAAQ,QAAQ,UAAU,QAAe,IAIvC;AAAA,IACA,UAAU;AAAA,MACR;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,KAAK;AAAA,IACL,GAAG;AAAA,EACL,CAAC;AACH;AAKO,IAAM,iBAAiB,CAC5B,YACG;AACH,UAAQ,QAAQ,UAAU,QAAe,IAIvC;AAAA,IACA,UAAU;AAAA,MACR;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,K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U,GAAG;AAAA,QAC5B,QAAQ;AAAA,MACV;AAAA,MACA,MAAM;AAAA,MACN;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,OAAO,MAAY,SAAgD;AACvE,UAAM,eAAe,KAAK,kBAAkB,OAAO;AAEnD,UAAM,MAAM,MAAM,KAAK,aAAa,YAAY;AAChD,QAAI,WAAW,MAAM,KAAK,SAAS,MAAM,KAAK,YAAY;AAG1D,QAAI,SAAS,WAAW,KAAK;AAC3B,WAAK,cAAc;AACnB,YAAM,WAAW,MAAM,KAAK,aAAa,YAAY;AACrD,iBAAW,MAAM,KAAK,SAAS,MAAM,UAAU,YAAY;AAAA,IAC7D;AAEA,QAAI,CAAC,SAAS,IAAI;AAChB,cAAQ,MAAM,MAAM,SAAS,KAAK,CAAC;AACnC,YAAM,IAAI,MAAM,0BAA0B,SAAS,UAAU,EAAE;AAAA,IACjE;AAEA,UAAM,OAAQ,MAAM,SAAS,KAAK;AAMlC,WAAO;AAAA,MACL,KAAK,UAAU,KAAK,GAAG;AAAA,MACvB,MAAM,KAAK;AAAA,MACX,UAAU,KAAK;AAAA,IACjB;AAAA,EACF;AACF;AAKO,SAAS,6BACd,gBACU;AACV,SAAO,IAAI,aAAa,cAAc;AACxC;","names":["base","getCoin","getCoins","getCoinHolders","getCoinPriceHistory","getCoinSwaps","getCoinComments","getProfile","getProfileCoins","getProfileBalances","getProfileSocial","getTokenInfo","getFeaturedCreators","getTraderLeaderboard","getContentCoinPoolConfig","getCreatorCoinPoolConfig","getCreatorLivestreamComments","getWalletTradeActivity","postCreateContent","getProfileBySocialHandle","base","baseSepolia","base","postCreateContent","parseEventLogs","parseEventLogs","coinABI","parseEventLogs","coinABI","parseEventLogs","encodeFunctionData","base","base","encodeFunctionData","createConfig","createConfig","uploadResult","setCreateUploadJwt","setCreateUploadJwt"]}
@@ -1 +1 @@
1
- {"version":3,"file":"validateMetadataURIContent.d.ts","sourceRoot":"","sources":["../../src/metadata/validateMetadataURIContent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,wBAAsB,0BAA0B,CAC9C,WAAW,EAAE,gBAAgB,oBAgB9B"}
1
+ {"version":3,"file":"validateMetadataURIContent.d.ts","sourceRoot":"","sources":["../../src/metadata/validateMetadataURIContent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,wBAAsB,0BAA0B,CAC9C,WAAW,EAAE,gBAAgB,oBA+B9B"}