@zoralabs/coins-sdk 0.4.3 → 0.4.7
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/CHANGELOG.md +30 -2
- package/dist/api/explore.d.ts +18 -0
- package/dist/api/explore.d.ts.map +1 -1
- package/dist/client/sdk.gen.d.ts +156 -1
- package/dist/client/sdk.gen.d.ts.map +1 -1
- package/dist/client/types.gen.d.ts +435 -3
- package/dist/client/types.gen.d.ts.map +1 -1
- package/dist/index.cjs +19 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/api/explore.ts +62 -0
- package/src/client/sdk.gen.ts +72 -0
- package/src/client/types.gen.ts +468 -3
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/utils/rethrowDecodedRevert.ts","../src/actions/updateCoinURI.ts","../src/utils/attribution.ts","../src/actions/updatePayoutRecipient.ts","../src/actions/tradeCoin.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 GetCoinSwapsData,\n GetCoinSwapsResponse,\n GetCoinsData,\n GetCoinsResponse,\n GetContentCoinPoolConfigData,\n GetContentCoinPoolConfigResponse,\n SetCreateUploadJwtData,\n SetCreateUploadJwtResponse,\n GetCreatorCoinPoolConfigData,\n GetCreatorCoinPoolConfigResponse,\n GetExploreData,\n GetExploreResponse,\n GetFeaturedCreatorsData,\n GetFeaturedCreatorsResponse,\n GetProfileData,\n GetProfileResponse,\n GetProfileBalancesData,\n GetProfileBalancesResponse,\n GetProfileCoinsData,\n GetProfileCoinsResponse,\n GetProfileSocialData,\n GetProfileSocialResponse,\n GetTokenInfoData,\n GetTokenInfoResponse,\n GetTraderLeaderboardData,\n GetTraderLeaderboardResponse,\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_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_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_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_profile query\n */\nexport const getProfile = <ThrowOnError extends boolean = false>(\n options: Options<GetProfileData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetProfileResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/profile\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_profileBalances query\n */\nexport const getProfileBalances = <ThrowOnError extends boolean = false>(\n options: Options<GetProfileBalancesData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetProfileBalancesResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/profileBalances\",\n ...options,\n });\n};\n\n/**\n * zoraSDK_profileCoins query\n */\nexport const getProfileCoins = <ThrowOnError extends boolean = false>(\n options: Options<GetProfileCoinsData, ThrowOnError>,\n) => {\n return (options.client ?? _heyApiClient).get<\n GetProfileCoinsResponse,\n unknown,\n ThrowOnError\n >({\n security: [\n {\n name: \"api-key\",\n type: \"apiKey\",\n },\n ],\n url: \"/profileCoins\",\n ...options,\n });\n};\n\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_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\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 { getExplore as getExploreSDK } from \"../client/sdk.gen\";\nimport type { GetExploreData, GetExploreResponse } from \"../client/types.gen\";\nimport { getApiKeyMeta } from \"./api-key\";\nimport { RequestOptionsType } from \"./query-types\";\n\n/**\n * The inner type for the explore queries that omits listType.\n * This is used to create the query object for the explore queries.\n */\nexport type QueryRequestType = Omit<GetExploreData[\"query\"], \"listType\">;\n\ntype ExploreResponse = { data?: GetExploreResponse };\n\nexport type ListType = GetExploreData[\"query\"][\"listType\"];\n\nexport type { ExploreResponse };\n\nexport type { GetExploreData };\n\n/**\n * Creates an explore query with the specified list type\n */\nconst createExploreQuery = (\n query: QueryRequestType,\n listType: ListType,\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n getExploreSDK({\n ...options,\n query: { ...query, listType },\n ...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","import {\n GetCoinCommentsData,\n GetCoinCommentsResponse,\n GetCoinData,\n GetCoinHoldersData,\n GetCoinHoldersResponse,\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 GetContentCoinPoolConfigData,\n GetContentCoinPoolConfigResponse,\n GetCreatorCoinPoolConfigData,\n GetCreatorCoinPoolConfigResponse,\n} from \"../client/types.gen\";\nimport {\n getCoin as getCoinSDK,\n getCoins as getCoinsSDK,\n getCoinComments as getCoinCommentsSDK,\n getCoinHolders as getCoinHoldersSDK,\n getCoinSwaps as getCoinSwapsSDK,\n getProfile as getProfileSDK,\n getProfileBalances as getProfileBalancesSDK,\n getProfileCoins as getProfileCoinsSDK,\n getProfileSocial as getProfileSocialSDK,\n getFeaturedCreators as getFeaturedCreatorsSDK,\n getTraderLeaderboard as getTraderLeaderboardSDK,\n getContentCoinPoolConfig as getContentCoinPoolConfigSDK,\n getCreatorCoinPoolConfig as getCreatorCoinPoolConfigSDK,\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 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 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","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 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 throw new Error(\"Quote failed\");\n }\n\n return quote.data;\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, UploadResult } from \"../types\";\nimport { getApiKey } from \"../../api/api-key\";\nimport { setCreateUploadJwt } from \"../../api/internal\";\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 async getJWTApiKey() {\n if (\n this.jwtApiKey &&\n this.jwtApiKeyExpiresAt &&\n this.jwtApiKeyExpiresAt > Date.now()\n ) {\n return this.jwtApiKey;\n }\n // Expires in 1 hour\n this.jwtApiKeyExpiresAt = Date.now() + 1000 * 60 * 60;\n\n const response = await setCreateUploadJwt({\n creatorAddress: this.creatorAddress,\n });\n this.jwtApiKey = response.data?.createUploadJwtFromApiKey;\n if (!this.jwtApiKey) {\n throw new Error(\"Failed to create upload JWT\");\n }\n\n return this.jwtApiKey;\n }\n\n async upload(file: File): Promise<UploadResult> {\n const jwtApiKey = await this.getJWTApiKey();\n const formData = new FormData();\n formData.append(\"file\", file, file.name);\n\n const response = await fetch(\n \"https://ipfs-uploader.zora.co/api/v0/add?cid-version=1\",\n {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${jwtApiKey}`,\n Accept: \"*/*\",\n },\n body: formData,\n },\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,EAKE;AAAA,EAGA;AAAA,OACK;AACP,SAAS,QAAAA,aAAY;;;ACbrB,SAAS,MAAM,mBAAmB;AAE3B,IAAM,wBAAwB,CACnC,iBACG;AACH,QAAM,gBAAgB,cAAc,OAAO;AAC3C,MAAI,kBAAkB,KAAK,IAAI;AAC7B;AAAA,EACF;AACA,MAAI,kBAAkB,YAAY,IAAI;AACpC;AAAA,EACF;AAEA,QAAM,IAAI;AAAA,IACR;AAAA,EACF;AACF;;;ACTO,SAAS,4BAA4B,KAAuB;AACjE,MAAI,IAAI,WAAW,SAAS,GAAG;AAC7B,WAAO,IAAI;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,MAAI,IAAI,WAAW,OAAO,GAAG;AAC3B,WAAO,IAAI,QAAQ,SAAS,qBAAqB;AAAA,EACnD;AACA,MAAI,IAAI,WAAW,OAAO,GAAG;AAC3B,WAAO;AAAA,EAET;AACA,MAAI,IAAI,WAAW,SAAS,KAAK,IAAI,WAAW,UAAU,GAAG;AAC3D,WAAO;AAAA,EACT;AAEA,QAAM,IAAI,MAAM,sBAAsB;AACxC;;;ACnBA,SAAS,kBAAkB,KAAc;AACvC,MAAI,OAAO,QAAQ,UAAU;AAC3B,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AACA,MAAI,IAAI,WAAW,SAAS,GAAG;AAC7B,WAAO;AAAA,EACT;AACA,MAAI,IAAI,WAAW,OAAO,GAAG;AAC3B,WAAO;AAAA,EACT;AACA,MAAI,IAAI,WAAW,UAAU,GAAG;AAC9B,WAAO;AAAA,EACT;AACA,MAAI,IAAI,WAAW,OAAO,GAAG;AAC3B,WAAO;AAAA,EACT;AAEA,SAAO;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,UAAM,WAAW,MAAMC,oBAAmB;AAAA,MACxC,gBAAgB,KAAK;AAAA,IACvB,CAAC;AACD,SAAK,YAAY,SAAS,MAAM;AAChC,QAAI,CAAC,KAAK,WAAW;AACnB,YAAM,IAAI,MAAM,6BAA6B;AAAA,IAC/C;AAEA,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,OAAO,MAAmC;AAC9C,UAAM,YAAY,MAAM,KAAK,aAAa;AAC1C,UAAM,WAAW,IAAI,SAAS;AAC9B,aAAS,OAAO,QAAQ,MAAM,KAAK,IAAI;AAEvC,UAAM,WAAW,MAAM;AAAA,MACrB;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,SAAS;AAAA,UACP,eAAe,UAAU,SAAS;AAAA,UAClC,QAAQ;AAAA,QACV;AAAA,QACA,MAAM;AAAA,MACR;AAAA,IACF;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","base","baseSepolia","getCoin","getCoins","getCoinHolders","getCoinSwaps","getCoinComments","getProfile","getProfileCoins","getProfileBalances","getProfileSocial","getFeaturedCreators","getTraderLeaderboard","getContentCoinPoolConfig","getCreatorCoinPoolConfig","postCreateContent","base","postCreateContent","parseEventLogs","parseEventLogs","coinABI","parseEventLogs","coinABI","parseEventLogs","base","base","uploadResult","setCreateUploadJwt","setCreateUploadJwt"]}
|
|
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/utils/rethrowDecodedRevert.ts","../src/actions/updateCoinURI.ts","../src/utils/attribution.ts","../src/actions/updatePayoutRecipient.ts","../src/actions/tradeCoin.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 GetCoinSwapsData,\n GetCoinSwapsResponse,\n GetCoinsData,\n GetCoinsResponse,\n GetCoinsListData,\n GetCoinsListResponse,\n GetContentCoinPoolConfigData,\n GetContentCoinPoolConfigResponse,\n SetCreateUploadJwtData,\n SetCreateUploadJwtResponse,\n GetCreatorCoinPoolConfigData,\n GetCreatorCoinPoolConfigResponse,\n GetExploreData,\n GetExploreResponse,\n GetFeaturedCreatorsData,\n GetFeaturedCreatorsResponse,\n GetLatestLiveStreamsData,\n GetLatestLiveStreamsResponse,\n GetProfileData,\n GetProfileResponse,\n GetProfileBalancesData,\n GetProfileBalancesResponse,\n GetProfileCoinsData,\n GetProfileCoinsResponse,\n GetProfileSocialData,\n GetProfileSocialResponse,\n GetTokenInfoData,\n GetTokenInfoResponse,\n GetTopLiveStreamsData,\n GetTopLiveStreamsResponse,\n GetTraderLeaderboardData,\n GetTraderLeaderboardResponse,\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_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_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_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\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 { getExplore as getExploreSDK } from \"../client/sdk.gen\";\nimport type { GetExploreData, GetExploreResponse } from \"../client/types.gen\";\nimport { getApiKeyMeta } from \"./api-key\";\nimport { RequestOptionsType } from \"./query-types\";\n\n/**\n * The inner type for the explore queries that omits listType.\n * This is used to create the query object for the explore queries.\n */\nexport type QueryRequestType = Omit<GetExploreData[\"query\"], \"listType\">;\n\ntype ExploreResponse = { data?: GetExploreResponse };\n\nexport type ListType = GetExploreData[\"query\"][\"listType\"];\n\nexport type { ExploreResponse };\n\nexport type { GetExploreData };\n\n/**\n * Creates an explore query with the specified list type\n */\nconst createExploreQuery = (\n query: QueryRequestType,\n listType: ListType,\n options?: RequestOptionsType<GetExploreData>,\n): Promise<ExploreResponse> =>\n getExploreSDK({\n ...options,\n query: { ...query, listType },\n ...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/** 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 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 GetContentCoinPoolConfigData,\n GetContentCoinPoolConfigResponse,\n GetCreatorCoinPoolConfigData,\n GetCreatorCoinPoolConfigResponse,\n} from \"../client/types.gen\";\nimport {\n getCoin as getCoinSDK,\n getCoins as getCoinsSDK,\n getCoinComments as getCoinCommentsSDK,\n getCoinHolders as getCoinHoldersSDK,\n getCoinSwaps as getCoinSwapsSDK,\n getProfile as getProfileSDK,\n getProfileBalances as getProfileBalancesSDK,\n getProfileCoins as getProfileCoinsSDK,\n getProfileSocial as getProfileSocialSDK,\n getFeaturedCreators as getFeaturedCreatorsSDK,\n getTraderLeaderboard as getTraderLeaderboardSDK,\n getContentCoinPoolConfig as getContentCoinPoolConfigSDK,\n getCreatorCoinPoolConfig as getCreatorCoinPoolConfigSDK,\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 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 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","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 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 throw new Error(\"Quote failed\");\n }\n\n return quote.data;\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, UploadResult } from \"../types\";\nimport { getApiKey } from \"../../api/api-key\";\nimport { setCreateUploadJwt } from \"../../api/internal\";\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 async getJWTApiKey() {\n if (\n this.jwtApiKey &&\n this.jwtApiKeyExpiresAt &&\n this.jwtApiKeyExpiresAt > Date.now()\n ) {\n return this.jwtApiKey;\n }\n // Expires in 1 hour\n this.jwtApiKeyExpiresAt = Date.now() + 1000 * 60 * 60;\n\n const response = await setCreateUploadJwt({\n creatorAddress: this.creatorAddress,\n });\n this.jwtApiKey = response.data?.createUploadJwtFromApiKey;\n if (!this.jwtApiKey) {\n throw new Error(\"Failed to create upload JWT\");\n }\n\n return this.jwtApiKey;\n }\n\n async upload(file: File): Promise<UploadResult> {\n const jwtApiKey = await this.getJWTApiKey();\n const formData = new FormData();\n formData.append(\"file\", file, file.name);\n\n const response = await fetch(\n \"https://ipfs-uploader.zora.co/api/v0/add?cid-version=1\",\n {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${jwtApiKey}`,\n Accept: \"*/*\",\n },\n body: formData,\n },\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,EAKE;AAAA,EAGA;AAAA,OACK;AACP,SAAS,QAAAA,aAAY;;;ACbrB,SAAS,MAAM,mBAAmB;AAE3B,IAAM,wBAAwB,CACnC,iBACG;AACH,QAAM,gBAAgB,cAAc,OAAO;AAC3C,MAAI,kBAAkB,KAAK,IAAI;AAC7B;AAAA,EACF;AACA,MAAI,kBAAkB,YAAY,IAAI;AACpC;AAAA,EACF;AAEA,QAAM,IAAI;AAAA,IACR;AAAA,EACF;AACF;;;ACTO,SAAS,4BAA4B,KAAuB;AACjE,MAAI,IAAI,WAAW,SAAS,GAAG;AAC7B,WAAO,IAAI;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,MAAI,IAAI,WAAW,OAAO,GAAG;AAC3B,WAAO,IAAI,QAAQ,SAAS,qBAAqB;AAAA,EACnD;AACA,MAAI,IAAI,WAAW,OAAO,GAAG;AAC3B,WAAO;AAAA,EAET;AACA,MAAI,IAAI,WAAW,SAAS,KAAK,IAAI,WAAW,UAAU,GAAG;AAC3D,WAAO;AAAA,EACT;AAEA,QAAM,IAAI,MAAM,sBAAsB;AACxC;;;ACnBA,SAAS,kBAAkB,KAAc;AACvC,MAAI,OAAO,QAAQ,UAAU;AAC3B,UAAM,IAAI,MAAM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AAAA,EAEA,MAAM,OAAO,MAAmC;AAC9C,UAAM,YAAY,MAAM,KAAK,aAAa;AAC1C,UAAM,WAAW,IAAI,SAAS;AAC9B,aAAS,OAAO,QAAQ,MAAM,KAAK,IAAI;AAEvC,UAAM,WAAW,MAAM;AAAA,MACrB;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,QACR,SAAS;AAAA,UACP,eAAe,UAAU,SAAS;AAAA,UAClC,QAAQ;AAAA,QACV;AAAA,QACA,MAAM;AAAA,MACR;AAAA,IACF;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","base","baseSepolia","getCoin","getCoins","getCoinHolders","getCoinSwaps","getCoinComments","getProfile","getProfileCoins","getProfileBalances","getProfileSocial","getFeaturedCreators","getTraderLeaderboard","getContentCoinPoolConfig","getCreatorCoinPoolConfig","postCreateContent","base","postCreateContent","parseEventLogs","parseEventLogs","coinABI","parseEventLogs","coinABI","parseEventLogs","base","base","uploadResult","setCreateUploadJwt","setCreateUploadJwt"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zoralabs/coins-sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"repository": "https://github.com/ourzora/zora-protocol",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@hey-api/client-fetch": "^0.8.3",
|
|
26
|
-
"@zoralabs/protocol-deployments": "^0.7.
|
|
26
|
+
"@zoralabs/protocol-deployments": "^0.7.5"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"abitype": "^1.0.8",
|
package/src/api/explore.ts
CHANGED
|
@@ -112,3 +112,65 @@ export const getExploreFeaturedVideos = (
|
|
|
112
112
|
options?: RequestOptionsType<GetExploreData>,
|
|
113
113
|
): Promise<ExploreResponse> =>
|
|
114
114
|
createExploreQuery(query, "FEATURED_VIDEOS", options);
|
|
115
|
+
|
|
116
|
+
/** Get trending coins across all types */
|
|
117
|
+
export const getTrendingAll = (
|
|
118
|
+
query: QueryRequestType = {},
|
|
119
|
+
options?: RequestOptionsType<GetExploreData>,
|
|
120
|
+
): Promise<ExploreResponse> =>
|
|
121
|
+
createExploreQuery(query, "TRENDING_ALL", options);
|
|
122
|
+
|
|
123
|
+
/** Get trending creator coins */
|
|
124
|
+
export const getTrendingCreators = (
|
|
125
|
+
query: QueryRequestType = {},
|
|
126
|
+
options?: RequestOptionsType<GetExploreData>,
|
|
127
|
+
): Promise<ExploreResponse> =>
|
|
128
|
+
createExploreQuery(query, "TRENDING_CREATORS", options);
|
|
129
|
+
|
|
130
|
+
/** Get trending posts */
|
|
131
|
+
export const getTrendingPosts = (
|
|
132
|
+
query: QueryRequestType = {},
|
|
133
|
+
options?: RequestOptionsType<GetExploreData>,
|
|
134
|
+
): Promise<ExploreResponse> =>
|
|
135
|
+
createExploreQuery(query, "TRENDING_POSTS", options);
|
|
136
|
+
|
|
137
|
+
/** Get most valuable trend coins */
|
|
138
|
+
export const getMostValuableTrends = (
|
|
139
|
+
query: QueryRequestType = {},
|
|
140
|
+
options?: RequestOptionsType<GetExploreData>,
|
|
141
|
+
): Promise<ExploreResponse> =>
|
|
142
|
+
createExploreQuery(query, "MOST_VALUABLE_TRENDS", options);
|
|
143
|
+
|
|
144
|
+
/** Get new trend coins */
|
|
145
|
+
export const getNewTrends = (
|
|
146
|
+
query: QueryRequestType = {},
|
|
147
|
+
options?: RequestOptionsType<GetExploreData>,
|
|
148
|
+
): Promise<ExploreResponse> => createExploreQuery(query, "NEW_TRENDS", options);
|
|
149
|
+
|
|
150
|
+
/** Get top volume trend coins (24h) */
|
|
151
|
+
export const getTopVolumeTrends24h = (
|
|
152
|
+
query: QueryRequestType = {},
|
|
153
|
+
options?: RequestOptionsType<GetExploreData>,
|
|
154
|
+
): Promise<ExploreResponse> =>
|
|
155
|
+
createExploreQuery(query, "TOP_VOLUME_TRENDS_24H", options);
|
|
156
|
+
|
|
157
|
+
/** Get trending trend coins */
|
|
158
|
+
export const getTrendingTrends = (
|
|
159
|
+
query: QueryRequestType = {},
|
|
160
|
+
options?: RequestOptionsType<GetExploreData>,
|
|
161
|
+
): Promise<ExploreResponse> =>
|
|
162
|
+
createExploreQuery(query, "TRENDING_TRENDS", options);
|
|
163
|
+
|
|
164
|
+
/** Get most valuable coins across all types */
|
|
165
|
+
export const getMostValuableAll = (
|
|
166
|
+
query: QueryRequestType = {},
|
|
167
|
+
options?: RequestOptionsType<GetExploreData>,
|
|
168
|
+
): Promise<ExploreResponse> =>
|
|
169
|
+
createExploreQuery(query, "MOST_VALUABLE_ALL", options);
|
|
170
|
+
|
|
171
|
+
/** Generic explore query for any list type */
|
|
172
|
+
export const getExploreList = (
|
|
173
|
+
listType: ListType,
|
|
174
|
+
query: QueryRequestType = {},
|
|
175
|
+
options?: RequestOptionsType<GetExploreData>,
|
|
176
|
+
): Promise<ExploreResponse> => createExploreQuery(query, listType, options);
|
package/src/client/sdk.gen.ts
CHANGED
|
@@ -18,6 +18,8 @@ import type {
|
|
|
18
18
|
GetCoinSwapsResponse,
|
|
19
19
|
GetCoinsData,
|
|
20
20
|
GetCoinsResponse,
|
|
21
|
+
GetCoinsListData,
|
|
22
|
+
GetCoinsListResponse,
|
|
21
23
|
GetContentCoinPoolConfigData,
|
|
22
24
|
GetContentCoinPoolConfigResponse,
|
|
23
25
|
SetCreateUploadJwtData,
|
|
@@ -28,6 +30,8 @@ import type {
|
|
|
28
30
|
GetExploreResponse,
|
|
29
31
|
GetFeaturedCreatorsData,
|
|
30
32
|
GetFeaturedCreatorsResponse,
|
|
33
|
+
GetLatestLiveStreamsData,
|
|
34
|
+
GetLatestLiveStreamsResponse,
|
|
31
35
|
GetProfileData,
|
|
32
36
|
GetProfileResponse,
|
|
33
37
|
GetProfileBalancesData,
|
|
@@ -38,6 +42,8 @@ import type {
|
|
|
38
42
|
GetProfileSocialResponse,
|
|
39
43
|
GetTokenInfoData,
|
|
40
44
|
GetTokenInfoResponse,
|
|
45
|
+
GetTopLiveStreamsData,
|
|
46
|
+
GetTopLiveStreamsResponse,
|
|
41
47
|
GetTraderLeaderboardData,
|
|
42
48
|
GetTraderLeaderboardResponse,
|
|
43
49
|
PostQuoteData,
|
|
@@ -198,6 +204,28 @@ export const getCoins = <ThrowOnError extends boolean = false>(
|
|
|
198
204
|
});
|
|
199
205
|
};
|
|
200
206
|
|
|
207
|
+
/**
|
|
208
|
+
* zoraSDK_coinsList query
|
|
209
|
+
*/
|
|
210
|
+
export const getCoinsList = <ThrowOnError extends boolean = false>(
|
|
211
|
+
options?: Options<GetCoinsListData, ThrowOnError>,
|
|
212
|
+
) => {
|
|
213
|
+
return (options?.client ?? _heyApiClient).get<
|
|
214
|
+
GetCoinsListResponse,
|
|
215
|
+
unknown,
|
|
216
|
+
ThrowOnError
|
|
217
|
+
>({
|
|
218
|
+
security: [
|
|
219
|
+
{
|
|
220
|
+
name: "api-key",
|
|
221
|
+
type: "apiKey",
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
url: "/coinsList",
|
|
225
|
+
...options,
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
|
|
201
229
|
/**
|
|
202
230
|
* zoraSDK_contentCoinPoolConfig query
|
|
203
231
|
*/
|
|
@@ -312,6 +340,28 @@ export const getFeaturedCreators = <ThrowOnError extends boolean = false>(
|
|
|
312
340
|
});
|
|
313
341
|
};
|
|
314
342
|
|
|
343
|
+
/**
|
|
344
|
+
* zoraSDK_latestLiveStreams query
|
|
345
|
+
*/
|
|
346
|
+
export const getLatestLiveStreams = <ThrowOnError extends boolean = false>(
|
|
347
|
+
options?: Options<GetLatestLiveStreamsData, ThrowOnError>,
|
|
348
|
+
) => {
|
|
349
|
+
return (options?.client ?? _heyApiClient).get<
|
|
350
|
+
GetLatestLiveStreamsResponse,
|
|
351
|
+
unknown,
|
|
352
|
+
ThrowOnError
|
|
353
|
+
>({
|
|
354
|
+
security: [
|
|
355
|
+
{
|
|
356
|
+
name: "api-key",
|
|
357
|
+
type: "apiKey",
|
|
358
|
+
},
|
|
359
|
+
],
|
|
360
|
+
url: "/latestLiveStreams",
|
|
361
|
+
...options,
|
|
362
|
+
});
|
|
363
|
+
};
|
|
364
|
+
|
|
315
365
|
/**
|
|
316
366
|
* zoraSDK_profile query
|
|
317
367
|
*/
|
|
@@ -422,6 +472,28 @@ export const getTokenInfo = <ThrowOnError extends boolean = false>(
|
|
|
422
472
|
});
|
|
423
473
|
};
|
|
424
474
|
|
|
475
|
+
/**
|
|
476
|
+
* zoraSDK_topLiveStreams query
|
|
477
|
+
*/
|
|
478
|
+
export const getTopLiveStreams = <ThrowOnError extends boolean = false>(
|
|
479
|
+
options?: Options<GetTopLiveStreamsData, ThrowOnError>,
|
|
480
|
+
) => {
|
|
481
|
+
return (options?.client ?? _heyApiClient).get<
|
|
482
|
+
GetTopLiveStreamsResponse,
|
|
483
|
+
unknown,
|
|
484
|
+
ThrowOnError
|
|
485
|
+
>({
|
|
486
|
+
security: [
|
|
487
|
+
{
|
|
488
|
+
name: "api-key",
|
|
489
|
+
type: "apiKey",
|
|
490
|
+
},
|
|
491
|
+
],
|
|
492
|
+
url: "/topLiveStreams",
|
|
493
|
+
...options,
|
|
494
|
+
});
|
|
495
|
+
};
|
|
496
|
+
|
|
425
497
|
/**
|
|
426
498
|
* zoraSDK_traderLeaderboard query
|
|
427
499
|
*/
|