@neynar/nodejs-sdk
Version:
SDK to interact with Neynar APIs (https://docs.neynar.com/reference/quickstart)
739 lines • 78.5 kB
JavaScript
"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.115.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.FetchTrendingFungiblesTimeWindowEnum = exports.FetchTrendingFungiblesNetworkEnum = exports.FetchRelevantFungibleOwnersNetworkEnum = exports.FetchFungibleTradesTimeWindowEnum = exports.FetchFungibleTradesNetworkEnum = 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 {
/**
* Create a signature for a given x402 resource using the specified wallet.
* @summary Create x402 signature
* @param {string} xWalletId Wallet ID to use for transactions
* @param {string} xApiKey
* @param {CreateX402SignatureRequest} createX402SignatureRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<CreateX402Signature200Response>} A promise that resolves to a `CreateX402Signature200Response` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/create-x402-signature)
*
*/
createX402Signature: async (xWalletId, xApiKey, createX402SignatureRequest, options = {}) => {
// verify required parameter 'xWalletId' is not null or undefined
(0, common_1.assertParamExists)('createX402Signature', 'xWalletId', xWalletId);
// verify required parameter 'xApiKey' is not null or undefined
(0, common_1.assertParamExists)('createX402Signature', 'xApiKey', xApiKey);
// verify required parameter 'createX402SignatureRequest' is not null or undefined
(0, common_1.assertParamExists)('createX402Signature', 'createX402SignatureRequest', createX402SignatureRequest);
const localVarPath = `/v2/signature/x402/`;
// 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);
}
if (xApiKey != null) {
localVarHeaderParameter['x-api-key'] = String(xApiKey);
}
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)(createX402SignatureRequest, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* 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 -> [wow.xyz](https://wow.xyz) - clanker -> [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,
};
},
/**
* Get recent trades for a specific fungible within a timeframe. Returns trades ordered by timestamp (most recent first).
* @summary Get fungible trades
* @param {FetchFungibleTradesNetworkEnum} network
* @param {string} address Contract address
* @param {FetchFungibleTradesTimeWindowEnum} [timeWindow] Time window for trades e.g. \"1h\", \"6h\", \"12h\", \"24h\", \"7d\"
* @param {number | null} [minAmountUsd] Minimum USD amount to filter trades
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FetchFungibleTrades200Response>} A promise that resolves to a `FetchFungibleTrades200Response` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-fungible-trades)
*
*/
fetchFungibleTrades: async (network, address, timeWindow, minAmountUsd, options = {}) => {
// verify required parameter 'network' is not null or undefined
(0, common_1.assertParamExists)('fetchFungibleTrades', 'network', network);
// verify required parameter 'address' is not null or undefined
(0, common_1.assertParamExists)('fetchFungibleTrades', 'address', address);
const localVarPath = `/v2/farcaster/fungible/trades/`;
// 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 (network !== undefined) {
localVarQueryParameter['network'] = network;
}
if (address !== undefined) {
localVarQueryParameter['address'] = address;
}
if (timeWindow !== undefined) {
localVarQueryParameter['time_window'] = timeWindow;
}
if (minAmountUsd !== undefined) {
localVarQueryParameter['min_amount_usd'] = minAmountUsd;
}
(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,
};
},
/**
* Fetch details for fungible assets identified by fungible identifiers.
* @summary Fetch fungibles
* @param {string} fungibles Comma-separated fungible identifiers
* @param {boolean} [xNeynarExperimental] Enables experimental features including filtering based on the Neynar score. See [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a) for more details.
* @param {number | null} [viewerFid] Optional FID of the viewer to personalize cast count filtering
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FungiblesResponseSchema>} A promise that resolves to a `FungiblesResponseSchema` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-fungibles)
*
*/
fetchFungibles: async (fungibles, xNeynarExperimental, viewerFid, options = {}) => {
// verify required parameter 'fungibles' is not null or undefined
(0, common_1.assertParamExists)('fetchFungibles', 'fungibles', fungibles);
const localVarPath = `/v2/farcaster/fungibles/`;
// 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 (fungibles !== undefined) {
localVarQueryParameter['fungibles'] = fungibles;
}
if (viewerFid !== undefined) {
localVarQueryParameter['viewer_fid'] = viewerFid;
}
if (xNeynarExperimental != null) {
localVarHeaderParameter['x-neynar-experimental'] = typeof xNeynarExperimental === 'string'
? xNeynarExperimental
: JSON.stringify(xNeynarExperimental);
}
(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,
};
},
/**
* 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\'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,
};
},
/**
* Fetch trending fungibles based on buy activity from watched addresses. Returns fungibles ranked by USD buy volume and buy count within the specified time window.
* @summary Trending fungibles
* @param {FetchTrendingFungiblesNetworkEnum} network
* @param {FetchTrendingFungiblesTimeWindowEnum} [timeWindow] Time window for trending calculations e.g. \"1h\", \"6h\", \"12h\", \"24h\", \"7d\"
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FetchTrendingFungibles200Response>} A promise that resolves to a `FetchTrendingFungibles200Response` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-trending-fungibles)
*
*/
fetchTrendingFungibles: async (network, timeWindow, options = {}) => {
// verify required parameter 'network' is not null or undefined
(0, common_1.assertParamExists)('fetchTrendingFungibles', 'network', network);
const localVarPath = `/v2/farcaster/fungible/trending/`;
// 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 (network !== undefined) {
localVarQueryParameter['network'] = network;
}
if (timeWindow !== undefined) {
localVarQueryParameter['time_window'] = timeWindow;
}
(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. Requires x-wallet-id header.
* @summary Register Farcaster account onchain
* @param {string} xWalletId Wallet ID to use for transactions
* @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 (xWalletId, registerUserOnChainReqBody, options = {}) => {
// verify required parameter 'xWalletId' is not null or undefined
(0, common_1.assertParamExists)('registerAccountOnchain', 'xWalletId', xWalletId);
// 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);
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)(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 {
/**
* Create a signature for a given x402 resource using the specified wallet.
* @summary Create x402 signature
* @param {string} xWalletId Wallet ID to use for transactions
* @param {string} xApiKey
* @param {CreateX402SignatureRequest} createX402SignatureRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<CreateX402Signature200Response>} A promise that resolves to a `CreateX402Signature200Response` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/create-x402-signature)
*
*/
async createX402Signature(xWalletId, xApiKey, createX402SignatureRequest, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.createX402Signature(xWalletId, xApiKey, createX402SignatureRequest, 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.createX402Signature']) === 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);
},
/**
* 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 -> [wow.xyz](https://wow.xyz) - clanker -> [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);
},
/**
* Get recent trades for a specific fungible within a timeframe. Returns trades ordered by timestamp (most recent first).
* @summary Get fungible trades
* @param {FetchFungibleTradesNetworkEnum} network
* @param {string} address Contract address
* @param {FetchFungibleTradesTimeWindowEnum} [timeWindow] Time window for trades e.g. \"1h\", \"6h\", \"12h\", \"24h\", \"7d\"
* @param {number | null} [minAmountUsd] Minimum USD amount to filter trades
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FetchFungibleTrades200Response>} A promise that resolves to a `FetchFungibleTrades200Response` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-fungible-trades)
*
*/
async fetchFungibleTrades(network, address, timeWindow, minAmountUsd, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.fetchFungibleTrades(network, address, timeWindow, minAmountUsd, 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.fetchFungibleTrades']) === 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 details for fungible assets identified by fungible identifiers.
* @summary Fetch fungibles
* @param {string} fungibles Comma-separated fungible identifiers
* @param {boolean} [xNeynarExperimental] Enables experimental features including filtering based on the Neynar score. See [docs](https://neynar.notion.site/Experimental-Features-1d2655195a8b80eb98b4d4ae7b76ae4a) for more details.
* @param {number | null} [viewerFid] Optional FID of the viewer to personalize cast count filtering
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FungiblesResponseSchema>} A promise that resolves to a `FungiblesResponseSchema` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-fungibles)
*
*/
async fetchFungibles(fungibles, xNeynarExperimental, viewerFid, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.fetchFungibles(fungibles, xNeynarExperimental, 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.fetchFungibles']) === 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\'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);
},
/**
* Fetch trending fungibles based on buy activity from watched addresses. Returns fungibles ranked by USD buy volume and buy count within the specified time window.
* @summary Trending fungibles
* @param {FetchTrendingFungiblesNetworkEnum} network
* @param {FetchTrendingFungiblesTimeWindowEnum} [timeWindow] Time window for trending calculations e.g. \"1h\", \"6h\", \"12h\", \"24h\", \"7d\"
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @returns {Promise<FetchTrendingFungibles200Response>} A promise that resolves to a `FetchTrendingFungibles200Response` object
*
* For more information, refer to the [API documentation](https://docs.neynar.com/reference/fetch-trending-fungibles)
*
*/
async fetchTrendingFungibles(network, timeWindow, options) {
var _a, _b, _c;
const localVarAxiosArgs = await localVarAxiosParamCreator.fetchTrendingFungibles(network, timeWindow, 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.fetchTrendingFungibles']) === 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 documentati