UNPKG

@neynar/nodejs-sdk

Version:

SDK to interact with Neynar APIs (https://docs.neynar.com/reference/quickstart)

750 lines 51.2 kB
"use strict"; /* tslint:disable */ /* eslint-disable */ /** * Neynar API * The Neynar API allows you to interact with the Farcaster protocol among other things. See the [Neynar docs](https://docs.neynar.com/reference) for more details. * * The version of the OpenAPI document: 3.34.0 * Contact: team@neynar.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SimulateNftMintNetworkEnum = exports.FetchUserBalanceNetworksEnum = exports.FetchRelevantFungibleOwnersNetworkEnum = exports.DeployFungibleFactoryEnum = exports.DeployFungibleNetworkEnum = exports.DeployFungibleMetadataNsfwEnum = exports.OnchainApi = exports.OnchainApiFactory = exports.OnchainApiFp = exports.OnchainApiAxiosParamCreator = void 0; const axios_1 = __importDefault(require("axios")); // Some imports not used depending on template conditions // @ts-ignore const common_1 = require("../common"); // @ts-ignore const base_1 = require("../base"); /** * OnchainApi - axios parameter creator * @export */ const OnchainApiAxiosParamCreator = function (configuration) { return { /** * Creates a new token. This is an allowlisted API, reach out if you want access. * @summary Deploy fungible * @param {string} owner Ethereum address of the one who is creating the token * @param {string} symbol Symbol/Ticker for the token * @param {string} name Name of the token * @param {File | null} [metadataMedia] Media file associated with the token. Supported formats are image/jpeg, image/gif and image/png * @param {string} [metadataDescription] Description of the token * @param {DeployFungibleMetadataNsfwEnum} [metadataNsfw] Indicates if the token is NSFW (Not Safe For Work). * @param {string} [metadataWebsiteLink] Website link related to the token * @param {string} [metadataTwitter] Twitter profile link * @param {string} [metadataDiscord] Discord server link * @param {string} [metadataTelegram] Telegram link * @param {DeployFungibleNetworkEnum} [network] Network/Chain name * @param {DeployFungibleFactoryEnum} [factory] Factory name - wow -&gt; [wow.xyz](https://wow.xyz) - clanker -&gt; [clanker.world](https://www.clanker.world) * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<DeployFungibleResponse>} A promise that resolves to a `DeployFungibleResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/deploy-fungible) * */ deployFungible: async (owner, symbol, name, metadataMedia, metadataDescription, metadataNsfw, metadataWebsiteLink, metadataTwitter, metadataDiscord, metadataTelegram, network, factory, options = {}) => { // verify required parameter 'owner' is not null or undefined (0, common_1.assertParamExists)('deployFungible', 'owner', owner); // verify required parameter 'symbol' is not null or undefined (0, common_1.assertParamExists)('deployFungible', 'symbol', symbol); // verify required parameter 'name' is not null or undefined (0, common_1.assertParamExists)('deployFungible', 'name', name); const localVarPath = `/v2/fungible/`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)(); // authentication ApiKeyAuth required await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration); if (owner !== undefined) { localVarFormParams.append('owner', owner); } if (symbol !== undefined) { localVarFormParams.append('symbol', symbol); } if (name !== undefined) { localVarFormParams.append('name', name); } if (metadataMedia !== undefined) { localVarFormParams.append('metadata[media]', metadataMedia); } if (metadataDescription !== undefined) { localVarFormParams.append('metadata[description]', metadataDescription); } if (metadataNsfw !== undefined) { localVarFormParams.append('metadata[nsfw]', metadataNsfw); } if (metadataWebsiteLink !== undefined) { localVarFormParams.append('metadata[website_link]', metadataWebsiteLink); } if (metadataTwitter !== undefined) { localVarFormParams.append('metadata[twitter]', metadataTwitter); } if (metadataDiscord !== undefined) { localVarFormParams.append('metadata[discord]', metadataDiscord); } if (metadataTelegram !== undefined) { localVarFormParams.append('metadata[telegram]', metadataTelegram); } if (network !== undefined) { localVarFormParams.append('network', network); } if (factory !== undefined) { localVarFormParams.append('factory', factory); } localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = localVarFormParams; return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Fetch a list of relevant owners for a on chain asset. If a viewer is provided, only relevant holders will be shown. This usually shows on a fungible asset page as \"X, Y, Z and N others you know own this asset\". * @summary Relevant owners * @param {string} contractAddress Contract address of the fungible asset * @param {FetchRelevantFungibleOwnersNetworkEnum} network Network of the fungible asset. * @param {number} [viewerFid] If you provide a viewer_fid, the response will include token holders from the user\&#39;s network, respecting their mutes and blocks and including viewer_context; if not provided, the response will show top token holders across the network—both sets can be combined to generate a longer list if desired. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<RelevantFungibleOwnersResponse>} A promise that resolves to a `RelevantFungibleOwnersResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-relevant-fungible-owners) * */ fetchRelevantFungibleOwners: async (contractAddress, network, viewerFid, options = {}) => { // verify required parameter 'contractAddress' is not null or undefined (0, common_1.assertParamExists)('fetchRelevantFungibleOwners', 'contractAddress', contractAddress); // verify required parameter 'network' is not null or undefined (0, common_1.assertParamExists)('fetchRelevantFungibleOwners', 'network', network); const localVarPath = `/v2/farcaster/fungible/owner/relevant/`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication ApiKeyAuth required await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration); if (contractAddress !== undefined) { localVarQueryParameter['contract_address'] = contractAddress; } if (network !== undefined) { localVarQueryParameter['network'] = network; } if (viewerFid !== undefined) { localVarQueryParameter['viewer_fid'] = viewerFid; } (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Fetches the token balances of a user given their FID * @summary Token balance * @param {number} fid FID of the user to fetch * @param {Array<FetchUserBalanceNetworksEnum>} networks Comma separated list of networks to fetch balances for * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<BalanceResponse>} A promise that resolves to a `BalanceResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-balance) * */ fetchUserBalance: async (fid, networks, options = {}) => { // verify required parameter 'fid' is not null or undefined (0, common_1.assertParamExists)('fetchUserBalance', 'fid', fid); // verify required parameter 'networks' is not null or undefined (0, common_1.assertParamExists)('fetchUserBalance', 'networks', networks); const localVarPath = `/v2/farcaster/user/balance/`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication ApiKeyAuth required await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration); if (fid !== undefined) { localVarQueryParameter['fid'] = fid; } if (networks) { localVarQueryParameter['networks'] = networks; } (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Mints an NFT to one or more recipients on a specified network and contract, using a configured server wallet. Contact us to set up your wallet configuration if you don\'t have one. * @summary Mint NFT(s) * @param {string} xWalletId Wallet ID to use for transactions * @param {MintNftRequest} mintNftRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<MintNft200Response>} A promise that resolves to a `MintNft200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/mint-nft) * */ mintNft: async (xWalletId, mintNftRequest, options = {}) => { // verify required parameter 'xWalletId' is not null or undefined (0, common_1.assertParamExists)('mintNft', 'xWalletId', xWalletId); // verify required parameter 'mintNftRequest' is not null or undefined (0, common_1.assertParamExists)('mintNft', 'mintNftRequest', mintNftRequest); const localVarPath = `/v2/farcaster/nft/mint/`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication ApiKeyAuth required await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration); if (xWalletId != null) { localVarHeaderParameter['x-wallet-id'] = String(xWalletId); } localVarHeaderParameter['Content-Type'] = 'application/json'; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(mintNftRequest, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Register a new farcaster account onchain. Optionally you can pass in signers to register a new account and create multiple signers in a single transaction * @summary Register Farcaster account onchain * @param {RegisterUserOnChainReqBody} registerUserOnChainReqBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<RegisterUserOnChainResponse>} A promise that resolves to a `RegisterUserOnChainResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/register-account-onchain) * */ registerAccountOnchain: async (registerUserOnChainReqBody, options = {}) => { // verify required parameter 'registerUserOnChainReqBody' is not null or undefined (0, common_1.assertParamExists)('registerAccountOnchain', 'registerUserOnChainReqBody', registerUserOnChainReqBody); const localVarPath = `/v2/farcaster/user/register/`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication ApiKeyAuth required await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(registerUserOnChainReqBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Send fungibles in bulk to several farcaster users. A funded wallet is to required use this API. React out to us on the Neynar channel on farcaster to get your wallet address. * @summary Send fungibles * @param {string} xWalletId Wallet ID to use for transactions * @param {TransactionSendFungiblesReqBody} transactionSendFungiblesReqBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<TransactionSendFungiblesResponse>} A promise that resolves to a `TransactionSendFungiblesResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/send-fungibles-to-users) * */ sendFungiblesToUsers: async (xWalletId, transactionSendFungiblesReqBody, options = {}) => { // verify required parameter 'xWalletId' is not null or undefined (0, common_1.assertParamExists)('sendFungiblesToUsers', 'xWalletId', xWalletId); // verify required parameter 'transactionSendFungiblesReqBody' is not null or undefined (0, common_1.assertParamExists)('sendFungiblesToUsers', 'transactionSendFungiblesReqBody', transactionSendFungiblesReqBody); const localVarPath = `/v2/farcaster/fungible/send/`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication ApiKeyAuth required await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration); if (xWalletId != null) { localVarHeaderParameter['x-wallet-id'] = String(xWalletId); } localVarHeaderParameter['Content-Type'] = 'application/json'; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(transactionSendFungiblesReqBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Simulates mint calldata for the given recipients, contract, and network. Useful for previewing calldata and ABI before minting. * @summary Simulate NFT mint calldata * @param {string} recipients JSON array of recipients (same structure as POST). * @param {string} nftContractAddress Ethereum address * @param {SimulateNftMintNetworkEnum} network Network to mint on. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<SimulateNftMintResponse>} A promise that resolves to a `SimulateNftMintResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/simulate-nft-mint) * */ simulateNftMint: async (recipients, nftContractAddress, network, options = {}) => { // verify required parameter 'recipients' is not null or undefined (0, common_1.assertParamExists)('simulateNftMint', 'recipients', recipients); // verify required parameter 'nftContractAddress' is not null or undefined (0, common_1.assertParamExists)('simulateNftMint', 'nftContractAddress', nftContractAddress); // verify required parameter 'network' is not null or undefined (0, common_1.assertParamExists)('simulateNftMint', 'network', network); const localVarPath = `/v2/farcaster/nft/mint/`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication ApiKeyAuth required await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "x-api-key", configuration); if (recipients !== undefined) { localVarQueryParameter['recipients'] = recipients; } if (nftContractAddress !== undefined) { localVarQueryParameter['nft_contract_address'] = nftContractAddress; } if (network !== undefined) { localVarQueryParameter['network'] = network; } (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; exports.OnchainApiAxiosParamCreator = OnchainApiAxiosParamCreator; /** * OnchainApi - functional programming interface * @export */ const OnchainApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.OnchainApiAxiosParamCreator)(configuration); return { /** * Creates a new token. This is an allowlisted API, reach out if you want access. * @summary Deploy fungible * @param {string} owner Ethereum address of the one who is creating the token * @param {string} symbol Symbol/Ticker for the token * @param {string} name Name of the token * @param {File | null} [metadataMedia] Media file associated with the token. Supported formats are image/jpeg, image/gif and image/png * @param {string} [metadataDescription] Description of the token * @param {DeployFungibleMetadataNsfwEnum} [metadataNsfw] Indicates if the token is NSFW (Not Safe For Work). * @param {string} [metadataWebsiteLink] Website link related to the token * @param {string} [metadataTwitter] Twitter profile link * @param {string} [metadataDiscord] Discord server link * @param {string} [metadataTelegram] Telegram link * @param {DeployFungibleNetworkEnum} [network] Network/Chain name * @param {DeployFungibleFactoryEnum} [factory] Factory name - wow -&gt; [wow.xyz](https://wow.xyz) - clanker -&gt; [clanker.world](https://www.clanker.world) * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<DeployFungibleResponse>} A promise that resolves to a `DeployFungibleResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/deploy-fungible) * */ async deployFungible(owner, symbol, name, metadataMedia, metadataDescription, metadataNsfw, metadataWebsiteLink, metadataTwitter, metadataDiscord, metadataTelegram, network, factory, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.deployFungible(owner, symbol, name, metadataMedia, metadataDescription, metadataNsfw, metadataWebsiteLink, metadataTwitter, metadataDiscord, metadataTelegram, network, factory, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['OnchainApi.deployFungible']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Fetch a list of relevant owners for a on chain asset. If a viewer is provided, only relevant holders will be shown. This usually shows on a fungible asset page as \"X, Y, Z and N others you know own this asset\". * @summary Relevant owners * @param {string} contractAddress Contract address of the fungible asset * @param {FetchRelevantFungibleOwnersNetworkEnum} network Network of the fungible asset. * @param {number} [viewerFid] If you provide a viewer_fid, the response will include token holders from the user\&#39;s network, respecting their mutes and blocks and including viewer_context; if not provided, the response will show top token holders across the network—both sets can be combined to generate a longer list if desired. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<RelevantFungibleOwnersResponse>} A promise that resolves to a `RelevantFungibleOwnersResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-relevant-fungible-owners) * */ async fetchRelevantFungibleOwners(contractAddress, network, viewerFid, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.fetchRelevantFungibleOwners(contractAddress, network, viewerFid, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['OnchainApi.fetchRelevantFungibleOwners']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Fetches the token balances of a user given their FID * @summary Token balance * @param {number} fid FID of the user to fetch * @param {Array<FetchUserBalanceNetworksEnum>} networks Comma separated list of networks to fetch balances for * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<BalanceResponse>} A promise that resolves to a `BalanceResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-balance) * */ async fetchUserBalance(fid, networks, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.fetchUserBalance(fid, networks, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['OnchainApi.fetchUserBalance']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Mints an NFT to one or more recipients on a specified network and contract, using a configured server wallet. Contact us to set up your wallet configuration if you don\'t have one. * @summary Mint NFT(s) * @param {string} xWalletId Wallet ID to use for transactions * @param {MintNftRequest} mintNftRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<MintNft200Response>} A promise that resolves to a `MintNft200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/mint-nft) * */ async mintNft(xWalletId, mintNftRequest, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.mintNft(xWalletId, mintNftRequest, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['OnchainApi.mintNft']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Register a new farcaster account onchain. Optionally you can pass in signers to register a new account and create multiple signers in a single transaction * @summary Register Farcaster account onchain * @param {RegisterUserOnChainReqBody} registerUserOnChainReqBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<RegisterUserOnChainResponse>} A promise that resolves to a `RegisterUserOnChainResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/register-account-onchain) * */ async registerAccountOnchain(registerUserOnChainReqBody, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.registerAccountOnchain(registerUserOnChainReqBody, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['OnchainApi.registerAccountOnchain']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Send fungibles in bulk to several farcaster users. A funded wallet is to required use this API. React out to us on the Neynar channel on farcaster to get your wallet address. * @summary Send fungibles * @param {string} xWalletId Wallet ID to use for transactions * @param {TransactionSendFungiblesReqBody} transactionSendFungiblesReqBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<TransactionSendFungiblesResponse>} A promise that resolves to a `TransactionSendFungiblesResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/send-fungibles-to-users) * */ async sendFungiblesToUsers(xWalletId, transactionSendFungiblesReqBody, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.sendFungiblesToUsers(xWalletId, transactionSendFungiblesReqBody, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['OnchainApi.sendFungiblesToUsers']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Simulates mint calldata for the given recipients, contract, and network. Useful for previewing calldata and ABI before minting. * @summary Simulate NFT mint calldata * @param {string} recipients JSON array of recipients (same structure as POST). * @param {string} nftContractAddress Ethereum address * @param {SimulateNftMintNetworkEnum} network Network to mint on. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<SimulateNftMintResponse>} A promise that resolves to a `SimulateNftMintResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/simulate-nft-mint) * */ async simulateNftMint(recipients, nftContractAddress, network, options) { var _a, _b, _c; const localVarAxiosArgs = await localVarAxiosParamCreator.simulateNftMint(recipients, nftContractAddress, network, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['OnchainApi.simulateNftMint']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, }; }; exports.OnchainApiFp = OnchainApiFp; /** * OnchainApi - factory interface * @export */ const OnchainApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.OnchainApiFp)(configuration); return { /** * Creates a new token. This is an allowlisted API, reach out if you want access. * @summary Deploy fungible * @param {OnchainApiDeployFungibleRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<DeployFungibleResponse>} A promise that resolves to a `DeployFungibleResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/deploy-fungible) * */ deployFungible(requestParameters, options) { return localVarFp.deployFungible(requestParameters.owner, requestParameters.symbol, requestParameters.name, requestParameters.metadataMedia, requestParameters.metadataDescription, requestParameters.metadataNsfw, requestParameters.metadataWebsiteLink, requestParameters.metadataTwitter, requestParameters.metadataDiscord, requestParameters.metadataTelegram, requestParameters.network, requestParameters.factory, options).then((request) => request(axios, basePath)); }, /** * Fetch a list of relevant owners for a on chain asset. If a viewer is provided, only relevant holders will be shown. This usually shows on a fungible asset page as \"X, Y, Z and N others you know own this asset\". * @summary Relevant owners * @param {OnchainApiFetchRelevantFungibleOwnersRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<RelevantFungibleOwnersResponse>} A promise that resolves to a `RelevantFungibleOwnersResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-relevant-fungible-owners) * */ fetchRelevantFungibleOwners(requestParameters, options) { return localVarFp.fetchRelevantFungibleOwners(requestParameters.contractAddress, requestParameters.network, requestParameters.viewerFid, options).then((request) => request(axios, basePath)); }, /** * Fetches the token balances of a user given their FID * @summary Token balance * @param {OnchainApiFetchUserBalanceRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<BalanceResponse>} A promise that resolves to a `BalanceResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-balance) * */ fetchUserBalance(requestParameters, options) { return localVarFp.fetchUserBalance(requestParameters.fid, requestParameters.networks, options).then((request) => request(axios, basePath)); }, /** * Mints an NFT to one or more recipients on a specified network and contract, using a configured server wallet. Contact us to set up your wallet configuration if you don\'t have one. * @summary Mint NFT(s) * @param {OnchainApiMintNftRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<MintNft200Response>} A promise that resolves to a `MintNft200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/mint-nft) * */ mintNft(requestParameters, options) { return localVarFp.mintNft(requestParameters.xWalletId, requestParameters.mintNftRequest, options).then((request) => request(axios, basePath)); }, /** * Register a new farcaster account onchain. Optionally you can pass in signers to register a new account and create multiple signers in a single transaction * @summary Register Farcaster account onchain * @param {OnchainApiRegisterAccountOnchainRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<RegisterUserOnChainResponse>} A promise that resolves to a `RegisterUserOnChainResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/register-account-onchain) * */ registerAccountOnchain(requestParameters, options) { return localVarFp.registerAccountOnchain(requestParameters.registerUserOnChainReqBody, options).then((request) => request(axios, basePath)); }, /** * Send fungibles in bulk to several farcaster users. A funded wallet is to required use this API. React out to us on the Neynar channel on farcaster to get your wallet address. * @summary Send fungibles * @param {OnchainApiSendFungiblesToUsersRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<TransactionSendFungiblesResponse>} A promise that resolves to a `TransactionSendFungiblesResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/send-fungibles-to-users) * */ sendFungiblesToUsers(requestParameters, options) { return localVarFp.sendFungiblesToUsers(requestParameters.xWalletId, requestParameters.transactionSendFungiblesReqBody, options).then((request) => request(axios, basePath)); }, /** * Simulates mint calldata for the given recipients, contract, and network. Useful for previewing calldata and ABI before minting. * @summary Simulate NFT mint calldata * @param {OnchainApiSimulateNftMintRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @returns {Promise<SimulateNftMintResponse>} A promise that resolves to a `SimulateNftMintResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/simulate-nft-mint) * */ simulateNftMint(requestParameters, options) { return localVarFp.simulateNftMint(requestParameters.recipients, requestParameters.nftContractAddress, requestParameters.network, options).then((request) => request(axios, basePath)); }, }; }; exports.OnchainApiFactory = OnchainApiFactory; /** * OnchainApi - object-oriented interface * @export * @class OnchainApi * @extends {BaseAPI} */ class OnchainApi extends base_1.BaseAPI { /** * Creates a new token. This is an allowlisted API, reach out if you want access. * @summary Deploy fungible * @param {OnchainApiDeployFungibleRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OnchainApi * @returns {Promise<DeployFungibleResponse>} A promise that resolves to a `DeployFungibleResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/deploy-fungible) * */ deployFungible(requestParameters, options) { return (0, exports.OnchainApiFp)(this.configuration).deployFungible(requestParameters.owner, requestParameters.symbol, requestParameters.name, requestParameters.metadataMedia, requestParameters.metadataDescription, requestParameters.metadataNsfw, requestParameters.metadataWebsiteLink, requestParameters.metadataTwitter, requestParameters.metadataDiscord, requestParameters.metadataTelegram, requestParameters.network, requestParameters.factory, options).then((request) => request(this.axios, this.basePath)); } /** * Fetch a list of relevant owners for a on chain asset. If a viewer is provided, only relevant holders will be shown. This usually shows on a fungible asset page as \"X, Y, Z and N others you know own this asset\". * @summary Relevant owners * @param {OnchainApiFetchRelevantFungibleOwnersRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OnchainApi * @returns {Promise<RelevantFungibleOwnersResponse>} A promise that resolves to a `RelevantFungibleOwnersResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-relevant-fungible-owners) * */ fetchRelevantFungibleOwners(requestParameters, options) { return (0, exports.OnchainApiFp)(this.configuration).fetchRelevantFungibleOwners(requestParameters.contractAddress, requestParameters.network, requestParameters.viewerFid, options).then((request) => request(this.axios, this.basePath)); } /** * Fetches the token balances of a user given their FID * @summary Token balance * @param {OnchainApiFetchUserBalanceRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OnchainApi * @returns {Promise<BalanceResponse>} A promise that resolves to a `BalanceResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-user-balance) * */ fetchUserBalance(requestParameters, options) { return (0, exports.OnchainApiFp)(this.configuration).fetchUserBalance(requestParameters.fid, requestParameters.networks, options).then((request) => request(this.axios, this.basePath)); } /** * Mints an NFT to one or more recipients on a specified network and contract, using a configured server wallet. Contact us to set up your wallet configuration if you don\'t have one. * @summary Mint NFT(s) * @param {OnchainApiMintNftRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OnchainApi * @returns {Promise<MintNft200Response>} A promise that resolves to a `MintNft200Response` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/mint-nft) * */ mintNft(requestParameters, options) { return (0, exports.OnchainApiFp)(this.configuration).mintNft(requestParameters.xWalletId, requestParameters.mintNftRequest, options).then((request) => request(this.axios, this.basePath)); } /** * Register a new farcaster account onchain. Optionally you can pass in signers to register a new account and create multiple signers in a single transaction * @summary Register Farcaster account onchain * @param {OnchainApiRegisterAccountOnchainRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OnchainApi * @returns {Promise<RegisterUserOnChainResponse>} A promise that resolves to a `RegisterUserOnChainResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/register-account-onchain) * */ registerAccountOnchain(requestParameters, options) { return (0, exports.OnchainApiFp)(this.configuration).registerAccountOnchain(requestParameters.registerUserOnChainReqBody, options).then((request) => request(this.axios, this.basePath)); } /** * Send fungibles in bulk to several farcaster users. A funded wallet is to required use this API. React out to us on the Neynar channel on farcaster to get your wallet address. * @summary Send fungibles * @param {OnchainApiSendFungiblesToUsersRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OnchainApi * @returns {Promise<TransactionSendFungiblesResponse>} A promise that resolves to a `TransactionSendFungiblesResponse` object * * For more information, refer to the [API documentation](https://docs.neynar.com/reference/send-fungibles-to-users) * */ sendFungiblesToUsers(requestParameters, options) { return (0, exports.OnchainApiFp)(this.configuration).sendFungiblesToUsers(requestParameters.xWalletId, requestParameters.transactionSendFungiblesReqBody, options).then((request) => request(this.axios, this.basePath)); } /** * Simulates mint calldata for the given recipients, contract, and network. Useful for previewing calldata and ABI before minting. * @summary Simulate NFT mint calldata * @param {OnchainApiSimulateNftMintRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OnchainApi * @returns {Promise<SimulateNftMintResponse>} A promise that resolves to a `SimulateNftMintResponse` object * * For more information, refer to the [API document