### Query Protocol State with 'cast' (Bash) Source: https://github.com/jpfraneto/feydocs.lat/blob/main/docs/pages/getting-started.mdx Demonstrates how to query the state of the Fey Protocol using the 'cast' command-line tool. It includes examples for checking the total supply of the FEY token and retrieving token deployment information. Requires 'cast' to be installed and configured with an RPC URL for the Base Mainnet. ```bash # Check FEY total supply cast call 0xD09cf0982A32DD6856e12d6BF2F08A822eA5D91D \ "totalSupply()(uint256)" --rpc-url https://mainnet.base.org # Get token deployment info cast call 0x8EEF0dC80ADf57908bB1be0236c2a72a7e379C2d \ "tokenDeploymentInfo(address)" [TOKEN_ADDRESS] \ --rpc-url https://mainnet.base.org ``` -------------------------------- ### Install mdast-util-gfm-task-list-item Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/mdast-util-gfm-task-list-item/readme.md Installation instructions for the mdast-util-gfm-task-list-item package using npm, and import examples for Deno and browser environments via esm.sh. ```shell npm install mdast-util-gfm-task-list-item ``` ```js import {gfmTaskListItemFromMarkdown, gfmTaskListItemToMarkdown} from 'https://esm.sh/mdast-util-gfm-task-list-item@2' ``` ```html ``` -------------------------------- ### Install micromark-factory-destination Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/micromark-factory-destination/readme.md Installation instructions for micromark-factory-destination using npm, and examples for Deno and browser environments using esm.sh. ```sh npm install micromark-factory-destination ``` ```js import {factoryDestination} from 'https://esm.sh/micromark-factory-destination@1' ``` ```html ``` -------------------------------- ### Local Development Setup Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/confbox/README.md Instructions for setting up a local development environment for the confbox project. This includes cloning the repository, installing Node.js, enabling Corepack, installing dependencies with pnpm, and running tests. ```md
Local development - Clone this repository - Install the latest LTS version of [Node.js](https://nodejs.org/en/) - Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable` - Install dependencies using `pnpm install` - Run tests using `pnpm dev` or `pnpm test`
``` -------------------------------- ### Project Dependency Installation (Shell) Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/lodash-es/release.md Installs project dependencies using npm. This includes initial installation and production dependency installation after setting up specific modules. ```shell npm i npm i --production ``` -------------------------------- ### Multi-Command Program Example (JavaScript) Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/katex/node_modules/commander/Readme.md Example of a multi-command-line program using Commander.js. Defines a main program with options and then defines two commands: 'setup' and 'exec'. Each command has its own description, options, and action handler. Useful for complex CLI applications with distinct sub-commands. ```javascript const { Command } = require('commander'); const program = new Command(); program .version('0.0.1') .option('-c, --config ', 'set config path', './deploy.conf'); program .command('setup [env]') .description('run setup commands for all envs') .option('-s, --setup_mode ', 'Which setup mode to use', 'normal') .action((env, options) => { env = env || 'all'; console.log('read config from %s', program.opts().config); console.log('setup for %s env(s) with %s mode', env, options.setup_mode); }); program .command('exec ``` ```html ``` -------------------------------- ### Configure help options in Commander.js Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@solana/errors/node_modules/commander/Readme.md Customize help option flags and description using .helpOption(), or disable the built-in help entirely by passing false. Use .addHelpOption() to add a manually constructed help option. ```javascript program .helpOption('-e, --HELP', 'read more information'); ``` -------------------------------- ### Defining Commands with Action Handlers (JavaScript) Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@solana/errors/node_modules/commander/Readme.md Demonstrates how to define commands with attached action handlers using commander.js. This approach allows for immediate execution logic when a command is invoked, including handling arguments and options. ```javascript // Command implemented using action handler (description is supplied separately to `.command`) // Returns new command for configuring. program .command('clone [destination]') .description('clone a repository into a newly created directory') .action((source, destination) => { console.log('clone command called'); }); // Command implemented using stand-alone executable file, indicated by adding description as second parameter to `.command`. // Returns `this` for adding more commands. program .command('start ', 'start named service') .command('stop [service]', 'stop named service, or all if no name supplied'); // Command prepared separately. // Returns `this` for adding more commands. program .addCommand(build.makeBuildCommand()); ``` -------------------------------- ### Get augmented PATH string with npmRunPath Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/npm-run-path/readme.md Demonstrates how to use npmRunPath() to get the PATH prepended with locally installed binaries. The example shows retrieving the original PATH, getting the augmented PATH that includes node_modules/.bin directories, and executing a locally installed binary using child_process. ```javascript const childProcess = require('child_process'); const npmRunPath = require('npm-run-path'); console.log(process.env.PATH); //=> '/usr/local/bin' console.log(npmRunPath()); //=> '/Users/sindresorhus/dev/foo/node_modules/.bin:/Users/sindresorhus/dev/node_modules/.bin:/Users/sindresorhus/node_modules/.bin:/Users/node_modules/.bin:/node_modules/.bin:/usr/local/bin' // `foo` is a locally installed binary childProcess.execFileSync('foo', { env: npmRunPath.env() }); ``` -------------------------------- ### Quick Start - Create New Hono Project with npm Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/hono/README.md Bootstrap a new Hono project using the official npm create command. This is the recommended way to set up a new Hono application with all necessary dependencies and project structure pre-configured. ```bash npm create hono@latest ``` -------------------------------- ### Creating Commands with Commander.js Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@solana/errors/node_modules/commander/Readme.md Illustrates the use of the `createCommand()` factory function to instantiate new Commander.js commands. This function can be used instead of the `new Command()` constructor and is also available as a method on the Command object for creating subcommands. ```javascript const { createCommand } = require('commander'); const program = createCommand(); ``` -------------------------------- ### Basic d3.line() Initialization in Vanilla JS Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/d3-sankey/node_modules/d3-shape/README.md This example shows the basic setup for using d3-shape in a vanilla JavaScript environment via CDN. It first loads d3-path and d3-shape, then initializes a d3.line() generator. This is a starting point for creating line visualizations. ```html ``` -------------------------------- ### Define Commands and Actions with Commander.js Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/commander/Readme.md This JavaScript example defines multiple commands ('setup', 'exec', and a catch-all '*') with their respective options, descriptions, and action handlers using Commander.js. It demonstrates how to set up sub-commands with arguments and options, define aliases, and handle default actions for unknown commands. Dependencies include the 'commander' module. ```javascript var program = require('commander'); program .version('0.1.0') .option('-C, --chdir ', 'change the working directory') .option('-c, --config ', 'set config path. defaults to ./deploy.conf') .option('-T, --no-tests', 'ignore test hook'); program .command('setup [env]') .description('run setup commands for all envs') .option("-s, --setup_mode [mode]", "Which setup mode to use") .action(function(env, options){ var mode = options.setup_mode || "normal"; env = env || 'all'; console.log('setup for %s env(s) with %s mode', env, mode); }); program .command('exec ') .alias('ex') .description('execute the given remote cmd') .option("-e, --exec_mode ", "Which exec mode to use") .action(function(cmd, options){ console.log('exec "%s" using %s mode', cmd, options.exec_mode); }).on('--help', function() { console.log(''); console.log('Examples:'); console.log(''); console.log(' $ deploy exec sequential'); console.log(' $ deploy exec async'); }); program .command('*') .action(function(env){ console.log('deploying "%s"', env); }); program.parse(process.argv); ``` -------------------------------- ### Setup and Teardown with `intro` and `outro` Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@clack/prompts/README.md Demonstrates how to use the `intro` and `outro` functions to display messages at the beginning and end of a prompt session. These are essential for providing context and feedback to the user. ```javascript import { intro, outro } from '@clack/prompts'; intro(`create-my-app`); // Do stuff outro(`You're all set!`); ``` -------------------------------- ### Declaring Program Variable in Commander.js Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@solana/errors/node_modules/commander/Readme.md This section provides different ways to declare the `program` object in Commander.js. It shows CommonJS (`require`) and ECMAScript Module (`import`) syntaxes for both JavaScript and TypeScript, catering to various project setups. ```javascript // CommonJS (.cjs) const { program } = require('commander'); ``` ```javascript // CommonJS (.cjs) const { Command } = require('commander'); const program = new Command(); ``` ```javascript // ECMAScript (.mjs) import { Command } from 'commander'; const program = new Command(); ``` ```typescript // TypeScript (.ts) import { Command } from 'commander'; const program = new Command(); ``` -------------------------------- ### Setup Web3 Provider and Contract (Python) Source: https://github.com/jpfraneto/feydocs.lat/blob/main/docs/dist/llms-full.txt Initializes a Web3 provider connected to the Base mainnet and sets up a contract instance for the factory using its address and ABI in Python. This is a prerequisite for interacting with the contract programmatically. ```python from web3 import Web3 # Setup w3 = Web3(Web3.HTTPProvider('https://mainnet.base.org')) factory = w3.eth.contract(address=FACTORY, abi=factory_abi) ``` -------------------------------- ### Install @farcaster/quick-auth Client Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@farcaster/quick-auth/README.md Instructions for installing the Farcaster Quick Auth client library using npm, yarn, or pnpm. ```sh npm install @auth-server/client # or yarn add @auth-server/client # or pnpm add @auth-server/client ``` -------------------------------- ### Install esast-util-from-js Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/esast-util-from-js/readme.md Installation instructions for esast-util-from-js using npm, and examples for Deno and browser environments using esm.sh. ```sh npm install esast-util-from-js ``` ```js import {fromJs} from 'https://esm.sh/esast-util-from-js@2' ``` ```html ``` -------------------------------- ### Install remark-mdx-frontmatter and remark-frontmatter Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/remark-mdx-frontmatter/README.md Installs the necessary packages for using remark-mdx-frontmatter. It requires both `remark-frontmatter` and `remark-mdx-frontmatter`. ```sh npm install remark-frontmatter remark-mdx-frontmatter ``` -------------------------------- ### Install local-pkg using npm Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/local-pkg/README.md Installs the local-pkg package using npm. This is the first step before using any of its functionalities in your project. ```bash npm i local-pkg ``` -------------------------------- ### Install path-key using npm Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/path-key/readme.md Install the path-key module using npm. This command adds the package as a dependency to your project. ```bash npm install path-key ``` -------------------------------- ### Create Basic Hono Application with TypeScript Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/hono/README.md Initialize a new Hono web application with a simple GET route handler. This example demonstrates the basic setup required to create a functional Hono app, importing the Hono class and defining a route that returns plain text. The app is exported as the default module for deployment on supported runtimes. ```typescript import { Hono } from 'hono' const app = new Hono() app.get('/', (c) => c.text('Hono!')) export default app ``` -------------------------------- ### Initialize and Ready Farcaster Miniapp SDK (JavaScript) Source: https://github.com/jpfraneto/feydocs.lat/blob/main/docs/dist/example/index.html This JavaScript code snippet demonstrates how to asynchronously import and initialize the Farcaster miniapp SDK. It calls the `ready()` function to signal that the app is loaded and ready to display content, with extensive logging for debugging potential issues during import and execution. It handles both named and default exports and ensures `ready()` is called after the DOM is fully loaded. ```javascript // Initialize Farcaster miniapp SDK and call ready() when app loads (async () => { console.log('[Farcaster SDK] Self-invoking async function started'); try { // Import the SDK with better error handling console.log('[Farcaster SDK] Importing @farcaster/miniapp-sdk'); const sdkModule = await import('@farcaster/miniapp-sdk'); console.log('[Farcaster SDK] Raw import result:', sdkModule); // Handle both named and default exports const sdk = sdkModule.sdk || sdkModule.default; console.log('[Farcaster SDK] SDK object:', sdk); console.log('[Farcaster SDK] SDK available:', !!sdk); console.log('[Farcaster SDK] SDK actions available:', !!sdk?.actions); console.log('[Farcaster SDK] SDK ready function available:', typeof sdk?.actions?.ready); if (!sdk || !sdk.actions || typeof sdk.actions.ready !== 'function') { console.warn('[Farcaster SDK] SDK structure unexpected:', { sdk, actions: sdk?.actions }); return; } // Call ready() after the app is fully loaded and ready to display // This hides the splash screen and displays the content const callReady = async () => { try { console.log('[Farcaster SDK] Attempting to call sdk.actions.ready()'); await sdk.actions.ready(); console.log('[Farcaster SDK] sdk.actions.ready() called successfully'); } catch (error) { // More detailed error logging console.warn('[Farcaster SDK] Error during sdk.actions.ready():', error); console.warn('[Farcaster SDK] Error details:', { name: error.name, message: error.message, stack: error.stack }); } }; // If page is already loaded, call immediately // Otherwise wait for DOMContentLoaded const readyState = document.readyState; console.log('[Farcaster SDK] Document readyState:', readyState); if (readyState === 'complete' || readyState === 'interactive') { // Use setTimeout to ensure all scripts have loaded console.log('[Farcaster SDK] setTimeout for callReady immediately'); setTimeout(callReady, 0); } else { console.log('[Farcaster SDK] Waiting for DOMContentLoaded to call callReady'); document.addEventListener('DOMContentLoaded', () => { console.log('[Farcaster SDK] DOMContentLoaded event fired'); callReady(); }); } } catch (error) { // More detailed error logging for import failures console.warn('[Farcaster SDK] Failed to import SDK:', error); console.warn('[Farcaster SDK] Error details:', { name: error.name, message: error.message, stack: error.stack }); } console.log('[Farcaster SDK] Self-invoking async function finished'); })(); ``` -------------------------------- ### Install and Use jsesc Binary Globally Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/jsesc/README.md Install the jsesc command-line tool globally via npm to enable string escaping directly from the shell. This example shows installation and basic usage for escaping strings with special characters. ```bash npm install -g jsesc ``` -------------------------------- ### Install locate-path via npm Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/locate-path/readme.md This command installs the 'locate-path' package using npm. It is a prerequisite for using the module in a Node.js project. ```bash $ npm install locate-path ``` -------------------------------- ### Initialize ethers.js Contract Instances Source: https://github.com/jpfraneto/feydocs.lat/blob/main/docs/pages/reference/addresses.mdx Creates contract instances using ethers.js library with JsonRpcProvider connection to Base mainnet. Demonstrates setup for factory, token, and hook contracts with their respective ABIs, enabling contract method calls and event listening. ```javascript import { ethers } from 'ethers'; // Provider setup const provider = new ethers.JsonRpcProvider('https://mainnet.base.org'); // Contract instances const factory = new ethers.Contract( '0x8EEF0dC80ADf57908bB1be0236c2a72a7e379C2d', factoryABI, provider ); const feyToken = new ethers.Contract( '0xD09cf0982A32DD6856e12d6BF2F08A822eA5D91D', erc20ABI, provider ); const hook = new ethers.Contract( '0x5B409184204b86f708d3aeBb3cad3F02835f68cC', hookABI, provider ); ``` -------------------------------- ### Install string-width using npm Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/string-width/readme.md Install the string-width package using npm for use in your Node.js project. This is the primary way to add the library's functionality to your application. ```sh npm install string-width ``` -------------------------------- ### Install hast-util-classnames Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/hast-util-classnames/readme.md Installation instructions for hast-util-classnames using npm, Deno, and in the browser via esm.sh. ```sh npm install hast-util-classnames ``` ```js import {classnames} from 'https://esm.sh/hast-util-classnames@3' ``` ```html ``` -------------------------------- ### Programmatically install a package using installPackage function (TypeScript) Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@antfu/install-pkg/README.md Demonstrates how to use the `installPackage` function from the `@antfu/install-pkg` library in TypeScript to install a package ('vite' in this example). It requires Node.js environment with TypeScript support and the `@antfu/install-pkg` package. The function can optionally run silently. ```typescript import { installPackage } from '@antfu/install-pkg' await installPackage('vite', { silent: true }) ``` -------------------------------- ### Defining Options with Commander.js Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@solana/errors/node_modules/commander/Readme.md Demonstrates how to define command-line options using the `.option()` method in Commander.js. This includes defining short and long flags, option arguments (like ''), and descriptions that appear in the help output. It also explains how multi-word options are camel-cased. ```javascript program .option('-p, --port ', 'server port number') .option('--trace', 'add extra debugging output') .option('--ws, --workspace ', 'use a custom workspace') ``` -------------------------------- ### Initialize Farcaster Mini App SDK and Call Ready Source: https://github.com/jpfraneto/feydocs.lat/blob/main/docs/dist/guides/extensions/index.html Initializes the Farcaster miniapp SDK and calls the `ready()` function when the application loads. It includes robust error handling for SDK import and function calls, ensuring the splash screen is hidden and content is displayed upon readiness. Dependencies include the '@farcaster/miniapp-sdk' package. ```javascript // Initialize Farcaster miniapp SDK and call ready() when app loads (async () => { console.log('[Farcaster SDK] Self-invoking async function started'); try { // Import the SDK with better error handling console.log('[Farcaster SDK] Importing @farcaster/miniapp-sdk'); const sdkModule = await import('@farcaster/miniapp-sdk'); console.log('[Farcaster SDK] Raw import result:', sdkModule); // Handle both named and default exports const sdk = sdkModule.sdk || sdkModule.default; console.log('[Farcaster SDK] SDK object:', sdk); console.log('[Farcaster SDK] SDK available:', !!sdk); console.log('[Farcaster SDK] SDK actions available:', !!sdk?.actions); console.log('[Farcaster SDK] SDK ready function available:', typeof sdk?.actions?.ready); if (!sdk || !sdk.actions || typeof sdk.actions.ready !== 'function') { console.warn('[Farcaster SDK] SDK structure unexpected:', { sdk, actions: sdk?.actions }); return; } // Call ready() after the app is fully loaded and ready to display // This hides the splash screen and displays the content const callReady = async () => { try { console.log('[Farcaster SDK] Attempting to call sdk.actions.ready()'); await sdk.actions.ready(); console.log('[Farcaster SDK] sdk.actions.ready() called successfully'); } catch (error) { // More detailed error logging console.warn('[Farcaster SDK] Error during sdk.actions.ready():', error); console.warn('[Farcaster SDK] Error details:', { name: error.name, message: error.message, stack: error.stack }); } }; // If page is already loaded, call immediately // Otherwise wait for DOMContentLoaded const readyState = document.readyState; console.log('[Farcaster SDK] Document readyState:', readyState); if (readyState === 'complete' || readyState === 'interactive') { // Use setTimeout to ensure all scripts have loaded console.log('[Farcaster SDK] setTimeout for callReady immediately'); setTimeout(callReady, 0); } else { console.log('[Farcaster SDK] Waiting for DOMContentLoaded to call callReady'); document.addEventListener('DOMContentLoaded', () => { console.log('[Farcaster SDK] DOMContentLoaded event fired'); callReady(); }); } } catch (error) { // More detailed error logging for import failures console.warn('[Farcaster SDK] Failed to import SDK:', error); console.warn('[Farcaster SDK] Error details:', { name: error.name, message: error.message, stack: error.stack }); } console.log('[Farcaster SDK] Self-invoking async function finished'); })(); ``` -------------------------------- ### Usage Example: Calculate string width Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/string-width/readme.md Demonstrates how to import and use the stringWidth function. It shows examples of calculating the width of a regular character, a fullwidth character, and a string with ANSI escape codes. ```javascript import stringWidth from 'string-width'; stringWidth('a'); //=> 1 stringWidth('古'); //=> 2 stringWidth('\u001B[1m古\u001B[22m'); //=> 2 ``` -------------------------------- ### Advanced Option Configuration in JavaScript Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@solana/errors/node_modules/commander/Readme.md This snippet illustrates advanced option configurations using the `Option` class in JavaScript. It demonstrates setting options with default values, predefined choices, environment variable sources, presets, custom argument parsers, conflict detection, and implication rules. These features allow for highly customized command-line interfaces. ```javascript program .addOption(new Option('-s, --secret').hideHelp()) .addOption(new Option('-t, --timeout ', 'timeout in seconds').default(60, 'one minute')) .addOption(new Option('-d, --drink ', 'drink size').choices(['small', 'medium', 'large'])) .addOption(new Option('-p, --port ', 'port number').env('PORT')) .addOption(new Option('--donate [amount]', 'optional donation in dollars').preset('20').argParser(parseFloat)) .addOption(new Option('--disable-server', 'disables the server').conflicts('port')) .addOption(new Option('--free-drink', 'small drink included free ').implies({ drink: 'small' })); ``` -------------------------------- ### vite-node CLI Help and Options Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/vite-node/README.md Display help information and available options for the vite-node CLI. Supports ViteNodeServer options via dot syntax for advanced configuration. ```bash npx vite-node -h npx vite-node --options.deps.inline="module-name" --options.deps.external="/module-regexp/" index.ts ``` -------------------------------- ### Install unified package for Node.js, Deno, and Browsers Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/unified/readme.md Instructions for installing the unified package. It is ESM only and requires Node.js version 16+. Examples are provided for npm, Deno using esm.sh, and browsers using esm.sh. ```sh npm install unified ``` ```js import {unified} from 'https://esm.sh/unified@11' ``` ```html ``` -------------------------------- ### Default Option Value (JavaScript) Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@solana/errors/node_modules/commander/Readme.md Illustrates how to set a default value for an option using the third argument in the .option() method. If the option is not provided on the command line, its default value is used. This example sets a default cheese type. ```javascript program .option('-c, --cheese ', 'add the specified type of cheese', 'blue'); program.parse(); console.log(`cheese: ${program.opts().cheese}`); ``` -------------------------------- ### Usage Examples for local-pkg Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/local-pkg/README.md Demonstrates how to use the various functions provided by the local-pkg library. It shows checking for package existence, getting package information, resolving module paths, and dynamic module imports across CJS and ESM. ```typescript import { getPackageInfo, importModule, isPackageExists, resolveModule, } from 'local-pkg' isPackageExists('local-pkg') // true isPackageExists('foo') // false await getPackageInfo('local-pkg') /* { * name: "local-pkg", * version: "0.1.0", * rootPath: "/path/to/node_modules/local-pkg", * packageJson: { * ... * } * } */ // similar to `require.resolve` but works also in ESM resolveModule('local-pkg') // '/path/to/node_modules/local-pkg/dist/index.cjs' // similar to `await import()` but works also in CJS const { importModule } = await importModule('local-pkg') ``` -------------------------------- ### Initialize Farcaster SDK and Call Ready (JavaScript) Source: https://github.com/jpfraneto/feydocs.lat/blob/main/docs/dist/getting-started/index.html Initializes the Farcaster miniapp SDK and calls the `ready()` function when the application loads. It imports the SDK with error handling and waits for the DOM to be fully loaded before executing `sdk.actions.ready()`. This process is crucial for hiding the splash screen and displaying the miniapp content. Dependencies include the `@farcaster/miniapp-sdk` package. ```javascript async () => { console.log('[Farcaster SDK] Self-invoking async function started'); try { console.log('[Farcaster SDK] Importing @farcaster/miniapp-sdk'); const sdkModule = await import('@farcaster/miniapp-sdk'); console.log('[Farcaster SDK] Raw import result:', sdkModule); const sdk = sdkModule.sdk || sdkModule.default; console.log('[Farcaster SDK] SDK object:', sdk); console.log('[Farcaster SDK] SDK available:', !!sdk); console.log('[Farcaster SDK] SDK actions available:', !!sdk?.actions); console.log('[Farcaster SDK] SDK ready function available:', typeof sdk?.actions?.ready); if (!sdk || !sdk.actions || typeof sdk.actions.ready !== 'function') { console.warn('[Farcaster SDK] SDK structure unexpected:', { sdk, actions: sdk?.actions }); return; } const callReady = async () => { try { console.log('[Farcaster SDK] Attempting to call sdk.actions.ready()'); await sdk.actions.ready(); console.log('[Farcaster SDK] sdk.actions.ready() called successfully'); } catch (error) { console.warn('[Farcaster SDK] Error during sdk.actions.ready():', error); console.warn('[Farcaster SDK] Error details:', { name: error.name, message: error.message, stack: error.stack }); } }; const readyState = document.readyState; console.log('[Farcaster SDK] Document readyState:', readyState); if (readyState === 'complete' || readyState === 'interactive') { console.log('[Farcaster SDK] setTimeout for callReady immediately'); setTimeout(callReady, 0); } else { console.log('[Farcaster SDK] Waiting for DOMContentLoaded to call callReady'); document.addEventListener('DOMContentLoaded', () => { console.log('[Farcaster SDK] DOMContentLoaded event fired'); callReady(); }); } } catch (error) { console.warn('[Farcaster SDK] Failed to import SDK:', error); console.warn('[Farcaster SDK] Error details:', { name: error.name, message: error.message, stack: error.stack }); } console.log('[Farcaster SDK] Self-invoking async function finished'); }(); ``` -------------------------------- ### Setup NuqsAdapter with TanStack Router Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/nuqs/README.md Configures Nuqs for TanStack Router v1+ applications (experimental support, does not cover TanStack Start). Wraps the Outlet component in the root route to enable query parameter management. Note: TanStack Start support is not yet implemented. ```typescript // src/routes/__root.tsx import { NuqsAdapter } from 'nuqs/adapters/tanstack-router' import { Outlet, createRootRoute } from '@tanstack/react-router' export const Route = createRootRoute({ component: () => ( <> ) }) ``` -------------------------------- ### Building and Testing the Code Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@scure/base/README.md Provides the command to install dependencies, build the project, and run the test suite. This is the standard procedure for local development and verification. ```bash npm install && npm run build && npm test ``` -------------------------------- ### Install detect-node-es Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/detect-node-es/Readme.md Instructions for installing the detect-node-es package using npm. This is the initial step to include the library in your project. ```shell npm install --save detect-node-es ``` -------------------------------- ### Install property-information Package Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/property-information/readme.md Instructions for installing the property-information package using npm, and how to import it in Deno and browser environments via esm.sh. ```sh npm install property-information ``` ```js import * as propertyInformation from 'https://esm.sh/property-information@6' ``` ```html ``` -------------------------------- ### Implement Custom Argument Processing Function Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@solana/errors/node_modules/commander/Readme.md Apply custom processing to command arguments by passing a callback function that receives the user-specified value and previous value, returning the new processed value. Supports optional default starting values. ```javascript program .command('add') .argument('', 'integer argument', myParseInt) .argument('[second]', 'integer argument', myParseInt, 1000) .action((first, second) => { console.log(`${first} + ${second} = ${first + second}`); }); ``` -------------------------------- ### List Key Fey Protocol Contract Addresses (Table) Source: https://github.com/jpfraneto/feydocs.lat/blob/main/docs/pages/getting-started.mdx Presents a table of key Fey Protocol contract addresses for the Base Mainnet. This includes the Factory, FEY Token, xFeyVault, Hook, Fee Locker, and LP Locker contracts. Useful for quick reference during integration or development. ```markdown | Contract | Address | | ------------------- | -------------------------------------------- | | Factory | `0x8EEF0dC80ADf57908bB1be0236c2a72a7e379C2d` | | FEY Token | `0xD09cf0982A32DD6856e12d6BF2F08A822eA5D91D` | | xFeyVault (Staking) | `0x72f5565Ab147105614ca4Eb83ecF15f751Fd8C50` | | Hook | `0x5B409184204b86f708d3aeBb3cad3F02835f68cC` | | Fee Locker | `0xf739FC4094F3Df0a1Be08E2925b609F3C3Aa13c6` | | LP Locker | `0x975aF6a738f502935AFE64633Ad3EA2A3eb3e7Fa` | ``` -------------------------------- ### Basic Hono Application Setup on Node.js Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@hono/node-server/README.md Demonstrates the fundamental setup for running a Hono application on Node.js using the `@hono/node-server` adapter. It imports necessary modules, creates a Hono app instance, defines a simple route, and starts the server. ```ts import { serve } from '@hono/node-server' import { Hono } from 'hono' const app = new Hono() app.get('/', (c) => c.text('Hono meets Node.js')) serve(app, (info) => { console.log(`Listening on http://localhost:${info.port}`) // Listening on http://localhost:3000 }) ``` -------------------------------- ### Use positionFromEstree with Acorn Parser Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/unist-util-position-from-estree/readme.md Example demonstrating how to parse JavaScript code with Acorn and then use positionFromEstree to get the position of various nodes. ```js import {parse} from 'acorn' import {positionFromEstree} from 'unist-util-position-from-estree' // Make acorn support line/column. const node = parse('function x() { console.log(1) }', { ecmaVersion: 2020, locations: true }) console.log(positionFromEstree(node)) // `Program` console.log(positionFromEstree(node.body[0].id)) // `x` console.log(positionFromEstree(node.body[0].body.body[0].expression)) // Call ``` -------------------------------- ### Display Automated Help Information in Commander.js Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@solana/errors/node_modules/commander/Readme.md Shows the default automated help output generated by Commander.js for a 'pizza' application. It includes usage instructions, available options, and descriptions. The help command is automatically added if subcommands are present. ```console $ node ./examples/pizza --help Usage: pizza [options] An application for pizza ordering Options: -p, --peppers Add peppers -c, --cheese Add the specified type of cheese (default: "marble") -C, --no-cheese You do not want any cheese -h, --help display help for command ``` -------------------------------- ### Install p-locate Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/p-locate/readme.md Install the p-locate package using npm. This is the initial step required before using the package in your project. ```bash npm install p-locate ``` -------------------------------- ### Optional Value Option (JavaScript) Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@solana/errors/node_modules/commander/Readme.md Demonstrates an option that can be used as a boolean or optionally take a value (e.g., --cheese [type]). The option is undefined if not present, true if present without a value, and has the specified value if provided. Handles arguments starting with a dash. ```javascript program .option('-c, --cheese [type]', 'Add cheese with optional type'); program.parse(process.argv); const options = program.opts(); if (options.cheese === undefined) console.log('no cheese'); else if (options.cheese === true) console.log('add cheese'); else console.log(`add cheese type ${options.cheese}`); ``` -------------------------------- ### Install mdast-util-mdx-expression Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/mdast-util-mdx-expression/readme.md Installation instructions for mdast-util-mdx-expression using npm, Deno, and browser script tags. ```sh npm install mdast-util-mdx-expression ``` ```js import {mdxExpressionFromMarkdown, mdxExpressionToMarkdown} from 'https://esm.sh/mdast-util-mdx-expression@2' ``` ```html ``` -------------------------------- ### Variadic Options in JavaScript Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@solana/errors/node_modules/commander/Readme.md This snippet demonstrates how to declare variadic options using the `...` notation in JavaScript. Variadic options allow for multiple arguments to be passed, which are then parsed as an array. The parsing stops at the first argument starting with a dash or a `--` argument. Dependencies: `commander` library. ```javascript program .option('-n, --number ', 'specify numbers') .option('-l, --letter [letters...]', 'specify letters'); program.parse(); console.log('Options: ', program.opts()); console.log('Remaining arguments: ', program.args); ``` -------------------------------- ### Execute Current Package's Binary with execa and get-bin-path Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/execa/readme.md Explains how to execute a binary defined in the current package's `package.json` using `execa` in combination with `get-bin-path`. This method validates the `bin` field setup in `package.json` without hardcoding paths. ```javascript const {getBinPathSync} = require('get-bin-path'); const binPath = getBinPathSync(); const subprocess = execa(binPath); ``` -------------------------------- ### Installation via NPM Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/style-to-js/README.md Provides the command to install the style-to-js package using npm. This is the standard method for adding the library to a Node.js project. ```sh npm install style-to-js --save ``` -------------------------------- ### Custom Version Option Flags in JavaScript Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/@solana/errors/node_modules/commander/Readme.md This example demonstrates how to customize the flags and description for the version option in JavaScript. By passing additional parameters to the `version` method, you can define custom flags and a description, similar to how options are defined using the `option` method. This is useful for providing more specific version information. ```javascript program.version('0.0.1', '-v, --vers', 'output the current version'); ``` -------------------------------- ### Install Pathe using npm, yarn, or pnpm Source: https://github.com/jpfraneto/feydocs.lat/blob/main/node_modules/pathe/README.md Demonstrates how to install the pathe package using common package managers. This is the first step before importing and using the library's functionalities. ```bash # npm npm i pathe # yarn yarn add pathe # pnpm pnpm i pathe ```