### Install dependencies (viem and dotenv) Source: https://docs.frax.com/frxusd/cross-chain-mint-and-redeem-quickstart Installs the required dependencies, including viem and dotenv, using npm. ```bash npm install dotenv@^16.4.7 viem@^2.23.4 ``` -------------------------------- ### Install Solana wallet adapter dependencies Source: https://docs.frax.com/frxusd/cross-chain-transfers-quickstarts/transfer-from-solana Run this command in your project directory to install the required Solana wallet adapter packages. The command specifies versions @solana/wallet-adapter-react@^0.15.35 and @solana/wallet-adapter-wallets@^0.19.32. ```bash npm install @solana/wallet-adapter-react@^0.15.35 @solana/wallet-adapter-wallets@^0.19.32 ``` -------------------------------- ### Install Graph CLI Source: https://docs.frax.com/fraxtal/tools/indexers Install the Graph CLI globally using npm. Required before initializing a subgraph. ```bash $ npm install -g @graphprotocol/graph-cli ``` -------------------------------- ### Set Up Wallet and Public Clients Source: https://docs.frax.com/frxusd/stake-and-unstake-quickstart-ethereum Creates a wallet client and a public client for Ethereum mainnet using viem. The wallet client uses the account from the configuration constants. ```javascript // Set up wallet client const ethereumWalletClient = createWalletClient({ chain: mainnet, transport: http(), account, }); // Set up public client const ethereumPublicClient = createPublicClient({ chain: mainnet, transport: http(), }); ``` -------------------------------- ### GET /processDeposit Response Source: https://docs.frax.com/fraxnet/api/frxusd-endpoints Example JSON response from the /processDeposit endpoint, showing a successful deposit processing with transaction hashes and USDC amount. ```json { "ok": true, "createFraxNetDepositTx": "0x...", "contractAlreadyDeployed": false, "processDepositTx": "0x...", "depositAddress": "0x...", "usdcAmount": "1000000" } ``` -------------------------------- ### Set up wallet client with viem for Ethereum mainnet Source: https://docs.frax.com/frxusd/mint-and-redeem-quickstarts/buidl Configures a wallet client on the source chain using viem. This example uses Ethereum mainnet and the account defined in the configuration constants. Required for minting and redeeming frxUSD with BUIDL. ```javascript // Set up a wallet client on the source chain const ethereumClient = createWalletClient({ chain: mainnet, transport: http(), account, }); ``` -------------------------------- ### GET /fetchAddress Response Source: https://docs.frax.com/fraxnet/api/frxusd-endpoints Example JSON response from the /fetchAddress endpoint, showing a successful retrieval of a deterministic deposit address with beneficiary and targetEid parameters. ```json { "ok": true, "deploymentAddress": "0x...", "params": { "beneficiary": "0x...", "targetEid": 30332 } } ``` -------------------------------- ### GET /processRedemption Response Source: https://docs.frax.com/fraxnet/api/frxusd-endpoints Example JSON response from the /processRedemption endpoint, showing a successful redemption with transaction hashes, frxUSD amount, and CCTP relay status. ```json { "ok": true, "createFraxNetDepositTx": "0x...", "contractAlreadyDeployed": false, "processRedemptionTx": "0x...", "depositAddress": "0x...", "frxUSDAmount": "1000000000000000000", "cctpRelay": { "status": "pending_attestation", "jobId": "0x...", "destDomain": 13 } } ``` -------------------------------- ### Initialize a new Node.js project Source: https://docs.frax.com/frxusd/cross-chain-mint-and-redeem-quickstart Creates a new directory and initializes a Node.js project with default settings using npm init -y. ```bash mkdir frxusd-cross-chain-minting cd frxusd-cross-chain-minting npm init -y ``` -------------------------------- ### Set Up Wallet and Public Clients for Arbitrum Source: https://docs.frax.com/frxusd/stake-and-unstake-quickstart-evm-chains Creates a wallet client and a public client for the Arbitrum network using viem. The wallet client uses the account from the configuration constants. ```javascript // Set up wallet client const arbitrumWalletClient = createWalletClient({ chain: arbitrum, transport: http(), account, }); // Set up public client const arbitrumPublicClient = createPublicClient({ chain: arbitrum, transport: http(), }); ``` -------------------------------- ### GET /fetchAddress Source: https://docs.frax.com/fraxnet/api Get deposit address for frxUSD operations. ```APIDOC ## GET /fetchAddress ### Description Get deposit address for frxUSD operations. ### Method GET ### Endpoint /fetchAddress ### Response #### Success Response (200) - **ok** (boolean) - Indicates success. #### Response Example { "ok": true } ``` -------------------------------- ### GET /branded/fetchAddress Source: https://docs.frax.com/fraxnet/api Get deposit address for branded stablecoin operations. ```APIDOC ## GET /branded/fetchAddress ### Description Get deposit address for branded stablecoin operations. ### Method GET ### Endpoint /branded/fetchAddress ### Response #### Success Response (200) - **ok** (boolean) - Indicates success. #### Response Example { "ok": true } ``` -------------------------------- ### Initialize Envio indexer with pnpx envio init Source: https://docs.frax.com/fraxtal/tools/indexers Run this command to auto-generate an indexer from any verified contract. Requires pnpm (pnpx) and an existing contract to verify. ```bash $ pnpx envio init ``` -------------------------------- ### Create and initialize Node.js project Source: https://docs.frax.com/frxusd/stake-and-unstake-quickstart-evm-chains Commands to create a new directory and initialize a Node.js project with default settings. This sets up the project structure for the staking script. ```bash mkdir frxusd-staking-arbitrum cd frxusd-staking-arbitrum npm init -y ``` -------------------------------- ### GET /activeJobs Source: https://docs.frax.com/fraxnet/api/cctp-relay Get a summary of all CCTP relay jobs and their statuses. No parameters required. ```APIDOC ## GET /activeJobs ### Description Summary of all CCTP relay jobs and their statuses. No parameters required. ### Method GET ### Endpoint /activeJobs ### Parameters None ### Response #### Success Response (200) - **ok** (boolean) - Indicates success - **total_jobs** (number) - Total number of jobs - **total_active** (number) - Number of active jobs - **counts** (object) - Counts by status - **pending_attestation** (number) - Jobs pending attestation - **relaying** (number) - Jobs being relayed - **complete** (number) - Completed jobs - **already_relayed** (number) - Jobs already relayed - **failed** (number) - Failed jobs - **active_jobs** (array) - List of active jobs - **job_id** (string) - Job ID - **status** (string) - Current status - **dest_domain** (number) - Destination domain ID - **created_at** (number) - Timestamp of job creation #### Response Example ``` { "ok": true, "total_jobs": 42, "total_active": 5, "counts": { "pending_attestation": 3, "relaying": 2, "complete": 30, "already_relayed": 5, "failed": 2 }, "active_jobs": [ { "job_id": "0x...", "status": "pending_attestation", "dest_domain": 0, "created_at": 1709729600 } ] } ``` ``` -------------------------------- ### Set Up Wallet and Public Clients with viem Source: https://docs.frax.com/frxusd/cross-chain-mint-and-redeem-quickstart Creates wallet and public clients for Ethereum mainnet and Base mainnet using viem. The wallet client uses the configured account, and public clients are used for reading chain data. ```javascript // Set up wallet and public clients const ethereumWalletClient = createWalletClient({ chain: mainnet, transport: http(), account, }); const ethereumPublicClient = createPublicClient({ chain: mainnet, transport: http(), }); const baseWalletClient = createWalletClient({ chain: base, transport: http(), account, }); const basePublicClient = createPublicClient({ chain: base, transport: http(), }); ``` -------------------------------- ### Set Up Wallet and Public Clients with viem Source: https://docs.frax.com/frxusd/cross-chain-transfers-quickstarts/transfer-with-fraxtal Creates wallet and public clients for Ethereum mainnet, Fraxtal mainnet, and Arbitrum mainnet using viem. These clients are used to conduct frxUSD transfers between the specified chains. ```javascript // Set up wallet clients const ethereumWalletClient = createWalletClient({ chain: mainnet, transport: http(), account, }); const fraxtalWalletClient = createWalletClient({ chain: fraxtal, transport: http(), account, }); const arbitrumWalletClient = createWalletClient({ chain: arbitrum, transport: http(), account, }); // Set up public clients for different chains const ethereumPublicClient = createPublicClient({ chain: mainnet, transport: http(), }); const fraxtalPublicClient = createPublicClient({ chain: fraxtal, transport: http(), }); const arbitrumPublicClient = createPublicClient({ chain: arbitrum, transport: http(), }); ``` -------------------------------- ### Install @fraxfinance/layerzero-v2-upgradeable Source: https://docs.frax.com/protocol/crosschain/code Install the Frax LayerZero V2 upgradeable package via npm to use the OFT contracts and Solidity libraries. ```bash npm install @fraxfinance/layerzero-v2-upgradeable ``` -------------------------------- ### initialize(uint256 _maxSlippage) Source: https://docs.frax.com/fraxnet/contracts/rwaRedemptionCoordinator Can be used via upgradeToAndCall to initialize post-deployment. Fails if already initialized. ```APIDOC ## initialize(uint256 _maxSlippage) ### Description Can be used via upgradeToAndCall to initialize post-deployment. Fails if already initialized. ### Parameters - **_maxSlippage** (uint256) - Required - Maximum allowed slippage in base 1e5. ### Errors - **AlreadyInitialized()** - Thrown if `initialize()` is called more than once. ``` -------------------------------- ### Install Goldsky CLI Source: https://docs.frax.com/fraxtal/tools/indexers Install the Goldsky CLI using the provided curl command. This is the first step to using Goldsky for indexing Fraxtal data. ```bash $ curl https://goldsky.com | sh ``` -------------------------------- ### Subgraph Query URL Example Source: https://docs.frax.com/fraxtal/tools/indexers Example query URL for a subgraph on The Graph's decentralized network. Replace [api-key] with your own API key from Subgraph Studio. ```text https://gateway.network.thegraph.com/api/[api-key]/subgraphs/id/HdVdERFUe8h61vm2fDyycgxjsde5PbB832NHgJfZNqK ```