### Install and Initialize Quidax SDK Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Install the package using npm or yarn. Instantiate the Quidax class with your private API key. The instance provides access to various service namespaces. ```typescript // Install // npm install quidax-package // yarn add quidax-package import Quidax from 'quidax-package'; const quidax = new Quidax(process.env.QUIDAX_API_KEY!); ``` -------------------------------- ### Install Quidax Package with yarn Source: https://github.com/ridbay/quidax-sdk-nodejs/blob/master/README.md Install the quidax-package using yarn. This is an alternative package manager for Node.js projects. ```bash yarn add quidax-package ``` -------------------------------- ### Install Quidax Package with npm Source: https://github.com/ridbay/quidax-sdk-nodejs/blob/master/README.md Install the quidax-package using npm. This is the standard way to add the package to your project. ```bash npm install quidax-package ``` -------------------------------- ### Fetch Crypto Withdrawal Fees Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Get the current network fee for withdrawing a cryptocurrency. Specify the network for multi-chain tokens. ```typescript import Quidax from 'quidax-package'; const quidax = new Quidax(process.env.QUIDAX_API_KEY!); // Fetch BTC withdrawal fee const btcFee = await quidax.fees.getCryptoWithdrawalFees('btc'); // { status: 'success', data: { fee: '0.0001', currency: 'btc' } } // Fetch USDT withdrawal fee on TRC-20 const usdtFee = await quidax.fees.getCryptoWithdrawalFees('usdt', 'trc20'); // { status: 'success', data: { fee: '1', currency: 'usdt', network: 'trc20' } } console.log(`Estimated fee: ${usdtFee.data?.fee} USDT`); ``` -------------------------------- ### Initialize Quidax SDK and Perform Operations Source: https://github.com/ridbay/quidax-sdk-nodejs/blob/master/README.md Demonstrates initializing the Quidax SDK with an API key and performing common operations like creating a sub-account, fetching market tickers, and creating an instant order. Ensure your QUIDAX_API_KEY is set in your environment variables. ```typescript import Quidax from 'quidax-package'; const quidax = new Quidax(process.env.QUIDAX_API_KEY!); // Create sub account (using camelCase alias) await quidax.user.createSubAccount('user@example.com', 'Ada', 'Lovelace', '+2348000000000'); // Fetch market tickers const tickers = await quidax.market.fetchMarketTickers(); console.log(tickers.data); // Create instant order const instant = await quidax.orders.createInstantOrder('USER_ID', 'btc', 0.5); console.log(instant.data); ``` -------------------------------- ### Create, Refresh, and Confirm Instant Swap Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Use this flow to perform instant currency-to-currency swaps. Ensure you handle quotation expiration by optionally refreshing it before confirmation. ```typescript import Quidax from 'quidax-package'; const quidax = new Quidax(process.env.QUIDAX_API_KEY!); const USER_ID = 'usr_abc123'; // Step 1 – Create a swap quotation (swap 0.5 BTC → ETH) const quotation = await quidax.swap.createInstantSwap(USER_ID, 'btc', 'eth', '0.5'); // { status: 'success', data: { id: 'quot_001', from_currency: 'btc', to_currency: 'eth', from_amount: '0.5', to_amount: '8.2', expires_at: '...' } } // Step 2 (optional) – Refresh if the quotation expired const refreshed = await quidax.swap.refreshInstantSwap( USER_ID, 'btc', 'eth', '0.5', quotation.data.id, ); // Step 3 – Confirm the swap await quidax.swap.confirmInstantSwap(USER_ID, quotation.data.id); ``` -------------------------------- ### Import and Instantiate Quidax Class Source: https://github.com/ridbay/quidax-sdk-nodejs/blob/master/README.md Import the Quidax class for use in your JavaScript or TypeScript project. Instantiate the class with your private key. ```javascript const Quidax = require('quidax-package'); // JavaScript ``` ```typescript import Quidax from 'quidax-package'; // Typescript ``` ```javascript const quidax = new Quidax(PRIVATE_KEY); ``` -------------------------------- ### Create Order Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Supports placing both standard limit/market orders and instant orders. ```APIDOC ## Orders Service (`quidax.orders`) Supports placing and managing both standard limit/market orders and instant orders (sell crypto for NGN or USDT). Also provides order history retrieval and cancellation. ### Method `createOrder(userId, market, type, orderType, price, volume)` ### Description Places a standard limit or market order for a specified trading pair. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user placing the order. - `market` (string) - Required - The trading pair (e.g., 'btcngn'). - `type` (string) - Required - The order type ('buy' or 'sell'). - `orderType` (string) - Required - The order execution type ('limit' or 'market'). - `price` (string) - Required - The price for limit orders, '0' for market orders. - `volume` (string) - Required - The amount of the base currency to trade. ### Method `createInstantOrder(userId, currency, volume)` ### Description Creates an instant sell order for a specified cryptocurrency to be exchanged for NGN or USDT. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user. - `currency` (string) - Required - The cryptocurrency to sell (e.g., 'btc', 'eth'). - `volume` (number) - Required - The amount of cryptocurrency to sell. ### Response Example (Instant Order Creation) ```json { "status": "success", "data": { "id": "inst_001", "type": "sell", "volume": "0.5", "state": "pending" } } ``` ``` -------------------------------- ### Place and Manage Orders with Node.js SDK Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Supports placing standard limit/market orders, instant orders, and managing order history. Requires a valid USER_ID. ```typescript import Quidax from 'quidax-package'; const quidax = new Quidax(process.env.QUIDAX_API_KEY!); const USER_ID = 'usr_abc123'; // Place a limit order (buy 0.01 BTC at ₦45,000,000) const limitOrder = await quidax.orders.createOrder( USER_ID, 'btcngn', 'buy', 'limit', '45000000', '0.01', ); // Place a market order const marketOrder = await quidax.orders.createOrder( USER_ID, 'ethngn', 'sell', 'market', '0', '0.5', ); // Create an instant sell order (sell 0.5 BTC → NGN) const instant = await quidax.orders.createInstantOrder(USER_ID, 'btc', 0.5); // { status: 'success', data: { id: 'inst_001', type: 'sell', volume: '0.5', state: 'pending' } } // Confirm the instant order await quidax.orders.confirmInstantOrder(USER_ID, instant.data.id); // Create an instant sell order to USDT const instantUsdt = await quidax.orders.createInstantOrder/* Usdt */(USER_ID, 'eth', 1.0); // Fetch all instant orders for a currency (done state, descending) const history = await quidax.orders.fetchInstantOrdersByCurrency(USER_ID, 'btc'); // Fetch a single instant order const one = await quidax.orders.fetchInstantOrder(USER_ID, 'inst_001'); // Fetch paginated standard orders with filters const orders = await quidax.orders.fetchOrders(USER_ID, { market: 'btcngn', state: 'done', order_by: 'desc', per_page: 20, page: 1, }); // Fetch a single order by ID const singleOrder = await quidax.orders.fetchOrder(USER_ID, 'ord_xyz'); // Cancel an open order await quidax.orders.cancelOrder(USER_ID, 'ord_xyz'); // Fetch paginated instant orders const instantOrders = await quidax.orders.fetchInstantOrders(USER_ID, { state: 'done', per_page: 10 }); ``` -------------------------------- ### Swap Service Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Enables instant currency-to-currency swaps using a quotation flow: create a quotation, optionally refresh it if the rate expires, then confirm to execute the swap. ```APIDOC ## Swap Service (`quidax.swap`) Enables instant currency-to-currency swaps using a quotation flow: create a quotation, optionally refresh it if the rate expires, then confirm to execute the swap. ### Create Instant Swap Quotation ```ts const quotation = await quidax.swap.createInstantSwap(USER_ID, 'btc', 'eth', '0.5'); // { status: 'success', data: { id: 'quot_001', from_currency: 'btc', to_currency: 'eth', from_amount: '0.5', to_amount: '8.2', expires_at: '...' } } ``` ### Refresh Instant Swap Quotation ```ts const refreshed = await quidax.swap.refreshInstantSwap( USER_ID, 'btc', 'eth', '0.5', quotation.data.id ); ``` ### Confirm Instant Swap ```ts await quidax.swap.confirmInstantSwap(USER_ID, quotation.data.id); ``` ### Create Temporary Instant Swap ```ts const tempQuote = await quidax.swap.create_temporary_instant_swap('btc', 'usdt', '1.0'); ``` ### Fetch Swap Transaction ```ts const tx = await quidax.swap.fetchSwapTransaction(USER_ID, 'swptx_001'); // { status: 'success', data: { id: 'swptx_001', from_currency: 'btc', to_currency: 'eth', state: 'done' } } ``` ### Fetch All Swap Transactions ```ts const allSwaps = await quidax.swap.getSwapTransactions(USER_ID); ``` ``` -------------------------------- ### Create Instant Order Source: https://github.com/ridbay/quidax-sdk-nodejs/blob/master/README.md Creates an instant order for a specified user ID, currency, and amount. ```APIDOC ## Create Instant Order ### Description Creates an instant order for a specified user, currency, and amount. ### Method `createInstantOrder` ### Parameters - **userId** (string) - Required - The ID of the user placing the order. - **currency** (string) - Required - The currency symbol for the order (e.g., 'btc'). - **amount** (number) - Required - The amount of the currency to order. ### Response All methods return a typed envelope with the shape `{ status, message?, data, meta? }` where `data` contains the endpoint-specific payload. ``` -------------------------------- ### Fetch Latest Changes from Origin Source: https://github.com/ridbay/quidax-sdk-nodejs/blob/master/CONTRIBUTING.md Use this command to fetch the latest updates from the remote repository before rebasing. ```bash $ git fetch origin ``` -------------------------------- ### Create Temporary Instant Swap Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Obtain a temporary quotation for a swap without requiring user context. Useful for quick rate checks. ```typescript const tempQuote = await quidax.swap.create_temporary_instant_swap('btc', 'usdt', '1.0'); ``` -------------------------------- ### Fetch Market Tickers with Node.js SDK Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Retrieves live market ticker data for all trading pairs. Ensure your API key is set in the environment variables. ```typescript import Quidax from 'quidax-package'; const quidax = new Quidax(process.env.QUIDAX_API_KEY!); const tickers = await quidax.market.fetchMarketTickers(); // { // status: 'success', // data: { // btcngn: { buy: '45000000', sell: '44800000', low: '44000000', high: '46000000', last: '44900000', volume: '12.3' }, // ethngn: { ... }, // usdtngn: { ... }, // ... // } // } const btcPrice = tickers.data?.btcngn?.last; console.log(`BTC last price: ₦${btcPrice}`); ``` -------------------------------- ### Wallets Service Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Handles creation and retrieval of crypto wallet addresses and balances for sub-accounts, supporting multi-network tokens. ```APIDOC ## Wallets Service (`quidax.wallets`) ### Description Handles creation and retrieval of crypto wallet addresses and wallet balances for sub-accounts. Supports multi-network tokens such as USDT (ERC-20, TRC-20, BEP-20). ### Methods #### `createPaymentAddress(userId: string, currency: string, network: NetworkType)` Creates a payment address for a given user and currency. Use 'none' for single-network currencies. *Parameters* - `userId` (string) - The ID of the sub-account. - `currency` (string) - The cryptocurrency currency (e.g., 'btc', 'usdt'). - `network` (NetworkType) - The network type (e.g., 'btc', 'bep20', 'erc20', 'trc20', 'doge', 'polygon', 'solana', 'none'). *Example Response* ```json { "status": "success", "data": { "address": "T...", "currency": "usdt", "network": "trc20" } } ``` #### `fetchPaymentAddress(userId: string, currency: string)` Fetches the most recently generated payment address for a given user and currency. #### `fetchPaymentAddresses(userId: string, currency: string)` Fetches all generated payment addresses for a given user and currency. #### `fetchPaymentAddressById(userId: string, currency: string, addressId: string)` Fetches a specific payment address by its ID. #### `reEnqueGeneratedWalletAddress(userId: string, currency: string, addressId: string)` Re-enqueues a generated wallet address to retry webhook delivery. #### `fetchUserWallet(userId: string, currency: string)` Fetches the balance for a single wallet of a given user and currency. *Example Response* ```json { "status": "success", "data": { "currency": "btc", "balance": "0.5", "locked": "0.0" } } ``` #### `fetchAllUserWallets(userId: string)` Fetches all wallet balances for a given user. ``` -------------------------------- ### Wallets Service: Manage Payment Addresses and Balances Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Handle crypto wallet addresses and balances for sub-accounts. Supports multi-network tokens like USDT. You can create, fetch, and re-enqueue payment addresses, as well as retrieve single or all wallet balances for a user. ```typescript import Quidax from 'quidax-package'; import type { NetworkType } from 'quidax-package'; // 'btc'|'bep20'|'erc20'|'trc20'|'doge'|'polygon'|'solana'|'none' const quidax = new Quidax(process.env.QUIDAX_API_KEY!); ``` ```typescript const USER_ID = 'usr_abc123'; ``` ```typescript // Create a payment address (pass 'none' for single-network currencies) const btcAddr = await quidax.wallets.createPaymentAddress(USER_ID, 'btc', 'none'); const usdtAddr = await quidax.wallets.createPaymentAddress(USER_ID, 'usdt', 'trc20'); // { status: 'success', data: { address: 'T...', currency: 'usdt', network: 'trc20' } } ``` ```typescript // Fetch the most recently generated address const latest = await quidax.wallets.fetchPaymentAddress(USER_ID, 'btc'); ``` ```typescript // Fetch all generated addresses for a currency const allAddrs = await quidax.wallets.fetchPaymentAddresses(USER_ID, 'usdt'); ``` ```typescript // Fetch a specific address by its ID const specific = await quidax.wallets.fetchPaymentAddressById(USER_ID, 'usdt', 'addr_001'); ``` ```typescript // Re-enqueue a generated address (retry webhook delivery) await quidax.wallets.reEnqueGeneratedWalletAddress(USER_ID, 'btc', 'addr_001'); ``` ```typescript // Fetch a single wallet balance const wallet = await quidax.wallets.fetchUserWallet(USER_ID, 'btc'); // { status: 'success', data: { currency: 'btc', balance: '0.5', locked: '0.0' } } ``` ```typescript // Fetch all wallet balances for a user const allWallets = await quidax.wallets.fetchAllUserWallets(USER_ID); ``` -------------------------------- ### Fetch Deposit Records with Node.js SDK Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Retrieves deposit records for a sub-account, with filtering by currency, state, pagination, and date ranges. Requires a USER_ID. ```typescript import Quidax from 'quidax-package'; const quidax = new Quidax(process.env.QUIDAX_API_KEY!); const USER_ID = 'usr_abc123'; // Fetch a single deposit by ID const deposit = await quidax.deposits.fetchSingleDeposit(USER_ID, 'dep_001'); // { status: 'success', data: { id: 'dep_001', currency: 'btc', amount: '0.01', state: 'accepted' } } // Fetch all BTC deposits with state 'accepted', paginated const page1 = await quidax.deposits.fetchAllDeposit(USER_ID, 'btc', 'accepted', '20', '1'); // Fetch deposits by date range const byDate = await quidax.deposits.fetchAllDepositByDate( USER_ID, 'usdt', 'accepted', '50', // per_page '2024-01-01', // start_date '2024-03-31', // end_date ); // { status: 'success', data: [...], meta: { page: 1, per_page: 50, total: 120 } } ``` -------------------------------- ### Fetch Market Tickers Source: https://github.com/ridbay/quidax-sdk-nodejs/blob/master/README.md Fetches all available market tickers from the Quidax platform. ```APIDOC ## Fetch Market Tickers ### Description Fetches all available market tickers. ### Method `fetchMarketTickers` ### Parameters None ### Response All methods return a typed envelope with the shape `{ status, message?, data, meta? }` where `data` contains the endpoint-specific payload. The `data` field will contain the market tickers. ``` -------------------------------- ### Create Sub Account Source: https://github.com/ridbay/quidax-sdk-nodejs/blob/master/README.md Creates a new sub-account for a user. Requires user's email, first name, last name, and phone number. ```APIDOC ## Create Sub Account ### Description Creates a new sub-account for a user. ### Method `createSubAccount` ### Parameters - **email** (string) - Required - The email address of the user. - **firstName** (string) - Required - The first name of the user. - **lastName** (string) - Required - The last name of the user. - **phoneNumber** (string) - Required - The phone number of the user. ### Response All methods return a typed envelope with the shape `{ status, message?, data, meta? }` where `data` contains the endpoint-specific payload. ``` -------------------------------- ### Swap Services Source: https://github.com/ridbay/quidax-sdk-nodejs/blob/master/README.md Manage cryptocurrency swaps. ```APIDOC ## Swap Services ### create_instant_swap Initiates an instant cryptocurrency swap. #### Method `quidax.swap.create_instant_swap(user_id, from_currency, to_currency, from_amount)` ### confirm_instant_swap Confirms an initiated instant swap. #### Method `quidax.swap.confirm_instant_swap(user_id, quotation_id)` ### refresh_instant_swap Refreshes an existing instant swap quotation. #### Method `quidax.swap.refresh_instant_swap(user_id, from_currency, to_currency, from_amount, quotation_id)` ### fetch_swap_transaction Fetches details of a specific swap transaction. #### Method `quidax.swap.fetch_swap_transaction(user_id, swap_transaction_id)` ### get_swap_transactions Fetches a list of all swap transactions for a user. #### Method `quidax.swap.get_swap_transactions(user_id)` ``` -------------------------------- ### User Services Source: https://github.com/ridbay/quidax-sdk-nodejs/blob/master/README.md Manage user accounts and sub-accounts. ```APIDOC ## User Services ### create_subAccount Creates a new sub-account for a user. #### Method `quidax.user.create_subAccount(email, firstname, lastname, phone_number)` ### fetch_single_subAccount Fetches details of a single sub-account. #### Method `quidax.user.fetch_single_subAccount(email)` ### fetch_all_subAccounts Fetches a list of all sub-accounts. #### Method `quidax.user.fetch_all_subAccounts()` ``` -------------------------------- ### Order Services Source: https://github.com/ridbay/quidax-sdk-nodejs/blob/master/README.md Manage and create various types of orders. ```APIDOC ## Order Services ### create_order Creates a standard order. #### Method `quidax.orders.create_order(user_id, market, side, ord_type, price, volume)` ### create_instant_order Creates an instant order. #### Method `quidax.orders.create_instant_order(user_id, currency, volume)` ### create_instant_order_usdt Creates an instant order using USDT. #### Method `quidax.orders.create_instant_order_usdt(user_id, currency, volume)` ### confirm_instant_order Confirms an instant order. #### Method `quidax.orders.confirm_instant_order(user_id, instant_order_id)` ### fetch_instant_order Fetches details of an instant order. #### Method `quidax.orders.fetch_instant_order(user_id, instant_order_id)` ### fetch_instant_orders_by_currency Fetches instant orders by currency. #### Method `quidax.orders.fetch_instant_orders_by_currency(user_id, currency)` ``` -------------------------------- ### Fetch All Swap Transactions Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Retrieve a list of all swap transactions associated with a user ID. ```typescript // Fetch all swap transactions for a user const allSwaps = await quidax.swap.getSwapTransactions(USER_ID); ``` -------------------------------- ### User Service: Create, Fetch, and Edit Sub-Accounts Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Manage sub-accounts for your Quidax merchant account. This includes creating new sub-accounts with user details, fetching them by email or ID, retrieving all sub-accounts, and editing existing ones. You can also fetch your parent (merchant) account details. ```typescript import Quidax from 'quidax-package'; const quidax = new Quidax(process.env.QUIDAX_API_KEY!); ``` ```typescript // Create a new sub-account const created = await quidax.user.createSubAccount( 'ada@example.com', 'Ada', 'Lovelace', '+2348000000000', ); // { status: 'success', data: { id: 'usr_abc123', email: 'ada@example.com', ... } } ``` ```typescript // Fetch a sub-account by email const byEmail = await quidax.user.fetchSingleSubAccount('ada@example.com'); ``` ```typescript // Fetch a sub-account by user ID const byId = await quidax.user.fetchSubAccount('usr_abc123'); ``` ```typescript // Fetch all sub-accounts under the merchant const all = await quidax.user.fetchAllSubAccounts(); // { status: 'success', data: [ { id: 'usr_abc123', ... }, ... ] } ``` ```typescript // Edit a sub-account const updated = await quidax.user.editSubAccount('usr_abc123', { firstname: 'Ada', lastname: 'Byron', phone_number: '+2348111111111', }); ``` ```typescript // Fetch the parent (merchant) account const me = await quidax.user.fetchParentAccount(); // { status: 'success', data: { id: 'merchant_xyz', email: 'merchant@company.com', ... } } ``` -------------------------------- ### Fetch All Beneficiaries Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Retrieve a paginated list of all saved beneficiaries for a sub-account. Supports pagination parameters like 'per_page' and 'page'. ```typescript // Fetch all beneficiaries (paginated) const all = await quidax.beneficiaries.fetchBeneficiaries(USER_ID, { per_page: 10, page: 1 }); ``` -------------------------------- ### Manage Withdrawals with Node.js SDK Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Manages the full withdrawal lifecycle, including creating, fetching, and cancelling withdrawals. Supports NGN and crypto withdrawals across multiple networks. Requires a USER_ID. ```typescript import Quidax from 'quidax-package'; const quidax = new Quidax(process.env.QUIDAX_API_KEY!); const USER_ID = 'usr_abc123'; // Withdraw crypto to an external address (BTC) const btcWithdrawal = await quidax.withdrawals.createWithdrawal( USER_ID, 'btc', '0.01', '1A1zP1eP5QGefi2DMPTfTL5SLmv7Divf', 'btc', ); // Withdraw USDT (TRC-20) const usdtWithdrawal = await quidax.withdrawals.createWithdrawal( USER_ID, 'usdt', '100', 'TXq...', 'trc20', ); // Withdraw NGN to a merchant account const ngnWithdrawal = await quidax.withdrawals.createAWithdrawalToMerchant( '5000', USER_ID, 'merchant_xyz', ); // Fetch all withdrawals (paginated) const all = await quidax.withdrawals.fetchWithdrawals(USER_ID, { state: 'accepted', per_page: 25, page: 1, }); // Fetch a single withdrawal const one = await quidax.withdrawals.fetchWithdrawal(USER_ID, 'wdl_001'); // { status: 'success', data: { id: 'wdl_001', currency: 'btc', amount: '0.01', state: 'accepted' } } // Cancel a pending withdrawal await quidax.withdrawals.cancelWithdrawal(USER_ID, 'wdl_001'); // Look up by your own reference string const byRef = await quidax.withdrawals.fetchWithdrawByReference(USER_ID, 'MY_REF_12345'); ``` -------------------------------- ### Confirm Instant Order Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Confirms an instant sell order. ```APIDOC ### Method `confirmInstantOrder(userId, orderId)` ### Description Confirms a previously created instant order. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user. - `orderId` (string) - Required - The ID of the instant order to confirm. ``` -------------------------------- ### Wallet Services Source: https://github.com/ridbay/quidax-sdk-nodejs/blob/master/README.md Manage user wallets and payment addresses. ```APIDOC ## Wallet Services ### create_payment_address Creates a new payment address for a user and currency. #### Method `quidax.wallets.create_payment_address(user_id, currency, network)` ### fetch_payment_address Fetches a specific payment address for a user and currency. #### Method `quidax.wallets.fetch_payment_address(user_id, currency)` ### fetch_payment_addresses Fetches all payment addresses for a user and currency. #### Method `quidax.wallets.fetch_payment_addresses(user_id, currency)` ### fetch_user_wallet Fetches the wallet balance for a specific user and currency. #### Method `quidax.wallets.fetch_user_wallet(user_id, currency)` ### fetch_all_user_wallets Fetches all wallet balances for a given user. #### Method `quidax.wallets.fetch_all_user_wallets(user_id)` ``` -------------------------------- ### Fetch Deposits Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Retrieves deposit records with filtering and pagination. ```APIDOC ## Deposits Service (`quidax.deposits`) Retrieves deposit records for a sub-account, with support for filtering by currency, state, pagination, and date ranges. ### Method `fetchSingleDeposit(userId, depositId)` ### Description Fetches a single deposit record by its ID. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user. - `depositId` (string) - Required - The ID of the deposit. ### Response Example ```json { "status": "success", "data": { "id": "dep_001", "currency": "btc", "amount": "0.01", "state": "accepted" } } ``` ### Method `fetchAllDeposit(userId, currency, state, perPage, page)` ### Description Fetches all deposits for a specific currency and state, with pagination. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user. - `currency` (string) - Required - The currency to filter deposits by (e.g., 'btc'). - `state` (string) - Required - The state of the deposits to filter by (e.g., 'accepted'). - `perPage` (string) - Required - The number of deposits per page. - `page` (string) - Required - The page number to retrieve. ### Method `fetchAllDepositByDate(userId, currency, state, perPage, startDate, endDate)` ### Description Fetches deposits within a specified date range, with filtering by currency and state, and supports pagination. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user. - `currency` (string) - Required - The currency to filter deposits by (e.g., 'usdt'). - `state` (string) - Required - The state of the deposits to filter by (e.g., 'accepted'). - `perPage` (string) - Required - The number of deposits per page. - `startDate` (string) - Required - The start date for the filter (YYYY-MM-DD). - `endDate` (string) - Required - The end date for the filter (YYYY-MM-DD). ### Response Example ```json { "status": "success", "data": [...], "meta": { "page": 1, "per_page": 50, "total": 120 } } ``` ``` -------------------------------- ### User Service Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Manages sub-accounts (users) under the merchant's Quidax account, including creation, fetching, and editing. It also allows fetching the parent merchant account. ```APIDOC ## User Service (`quidax.user`) ### Description Manages the merchant's sub-accounts (users created under the merchant's Quidax account). Supports creating, fetching, and editing sub-accounts as well as fetching the authenticated merchant (parent) account. ### Methods #### `createSubAccount(email: string, firstname: string, lastname: string, phone_number: string)` Creates a new sub-account. *Example Response* ```json { "status": "success", "data": { "id": "usr_abc123", "email": "ada@example.com", "firstname": "Ada", "lastname": "Lovelace", "phone_number": "+2348000000000" } } ``` #### `fetchSingleSubAccount(email: string)` Fetches a sub-account by email. #### `fetchSubAccount(userId: string)` Fetches a sub-account by user ID. #### `fetchAllSubAccounts()` Fetches all sub-accounts under the merchant. *Example Response* ```json { "status": "success", "data": [ { "id": "usr_abc123", "email": "ada@example.com", "firstname": "Ada", "lastname": "Lovelace", "phone_number": "+2348000000000" } ] } ``` #### `editSubAccount(userId: string, updates: object)` Edits an existing sub-account. *Parameters* - `userId` (string) - The ID of the sub-account to edit. - `updates` (object) - An object containing fields to update (e.g., `firstname`, `lastname`, `phone_number`). #### `fetchParentAccount()` Fetches the parent (merchant) account details. *Example Response* ```json { "status": "success", "data": { "id": "merchant_xyz", "email": "merchant@company.com" } } ``` ``` -------------------------------- ### Create Beneficiary Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Save a new withdrawal destination (beneficiary) for a sub-account. Requires currency, address, and a label. ```typescript import Quidax from 'quidax-package'; const quidax = new Quidax(process.env.QUIDAX_API_KEY!); const USER_ID = 'usr_abc123'; // Create a new beneficiary const ben = await quidax.beneficiaries.createBeneficiary(USER_ID, { currency: 'btc', address: '1A1zP1eP5QGefi2DMPTfTL5SLmv7Divf', label: 'My cold wallet', }); // { status: 'success', data: { id: 'ben_001', currency: 'btc', address: '1A1z...' } } ``` -------------------------------- ### Fetch Orders Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Retrieves order history with filtering and pagination. ```APIDOC ### Method `fetchOrders(userId, options)` ### Description Fetches paginated standard orders with support for various filters. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user. - `options` (object) - Optional - Filtering and pagination options. - `market` (string) - Optional - Filter by trading pair. - `state` (string) - Optional - Filter by order state (e.g., 'done'). - `order_by` (string) - Optional - Sorting order ('desc' or 'asc'). - `per_page` (number) - Optional - Number of orders per page. - `page` (number) - Optional - The page number to retrieve. ### Method `fetchInstantOrders(userId, options)` ### Description Fetches paginated instant orders with support for filtering by state. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user. - `options` (object) - Optional - Filtering and pagination options. - `state` (string) - Optional - Filter by order state (e.g., 'done'). - `per_page` (number) - Optional - Number of orders per page. ### Method `fetchInstantOrdersByCurrency(userId, currency)` ### Description Fetches all instant orders for a specific currency, sorted in descending order. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user. - `currency` (string) - Required - The cryptocurrency to filter by (e.g., 'btc'). ### Method `fetchInstantOrder(userId, orderId)` ### Description Fetches a single instant order by its ID. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user. - `orderId` (string) - Required - The ID of the instant order. ### Method `fetchOrder(userId, orderId)` ### Description Fetches a single standard order by its ID. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user. - `orderId` (string) - Required - The ID of the order. ``` -------------------------------- ### Manage Withdrawals Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Manages the full withdrawal lifecycle: creating, fetching, and cancelling withdrawals. ```APIDOC ## Withdrawals Service (`quidax.withdrawals`) Manages the full withdrawal lifecycle: creating, fetching, cancelling withdrawals, and looking them up by reference. Supports NGN and crypto withdrawals across multiple networks. ### Method `createWithdrawal(userId, currency, amount, address, network)` ### Description Withdraws cryptocurrency to an external address. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user. - `currency` (string) - Required - The cryptocurrency to withdraw (e.g., 'btc', 'usdt'). - `amount` (string) - Required - The amount to withdraw. - `address` (string) - Required - The external withdrawal address. - `network` (string) - Required - The network for the withdrawal (e.g., 'btc', 'trc20'). ### Method `createAWithdrawalToMerchant(amount, userId, merchantId)` ### Description Withdraws NGN to a merchant account. ### Parameters #### Path Parameters - `amount` (string) - Required - The amount to withdraw. - `userId` (string) - Required - The ID of the user. - `merchantId` (string) - Required - The ID of the merchant account. ### Method `fetchWithdrawals(userId, options)` ### Description Fetches all withdrawals with support for filtering and pagination. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user. - `options` (object) - Optional - Filtering and pagination options. - `state` (string) - Optional - Filter by withdrawal state (e.g., 'accepted'). - `per_page` (number) - Optional - Number of withdrawals per page. - `page` (number) - Optional - The page number to retrieve. ### Method `fetchWithdrawal(userId, withdrawalId)` ### Description Fetches a single withdrawal by its ID. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user. - `withdrawalId` (string) - Required - The ID of the withdrawal. ### Response Example ```json { "status": "success", "data": { "id": "wdl_001", "currency": "btc", "amount": "0.01", "state": "accepted" } } ``` ### Method `cancelWithdrawal(userId, withdrawalId)` ### Description Cancels a pending withdrawal. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user. - `withdrawalId` (string) - Required - The ID of the withdrawal to cancel. ### Method `fetchWithdrawByReference(userId, reference)` ### Description Looks up a withdrawal by your own reference string. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user. - `reference` (string) - Required - Your reference string for the withdrawal. ``` -------------------------------- ### Withdrawal Services Source: https://github.com/ridbay/quidax-sdk-nodejs/blob/master/README.md Initiate withdrawals to merchants. ```APIDOC ## Withdrawal Services ### create_a_withdrawal_to_merchant Creates a withdrawal from a user's account to a merchant's account. #### Method `quidax.withdrawals.create_a_withdrawal_to_merchant(amount, user_id, merchant_id)` ``` -------------------------------- ### Error Handling Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt All methods throw typed errors. Catch them to handle specific HTTP failure scenarios. ```APIDOC ## Error Handling All methods throw typed errors. Catch them to handle specific HTTP failure scenarios. ```ts try { const result = await quidax.wallets.createPaymentAddress('usr_invalid', 'btc', 'none'); console.log(result.data); } catch (err: any) { // err.code – HTTP status code (400, 401, 500, ...) // err.message – Human-readable error message from the API // err.status – API status string (e.g. 'error') if (err.code === 401) { console.error('Invalid API key'); } else if (err.code === 400) { console.error('Bad request:', err.message); } else { console.error('Server error:', err.message); } } ``` ``` -------------------------------- ### Fetch Swap Transaction Record Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Retrieve details for a specific swap transaction using its ID. ```typescript // Fetch a specific swap transaction record const tx = await quidax.swap.fetchSwapTransaction(USER_ID, 'swptx_001'); // { status: 'success', data: { id: 'swptx_001', from_currency: 'btc', to_currency: 'eth', state: 'done' } } ``` -------------------------------- ### Market Services Source: https://github.com/ridbay/quidax-sdk-nodejs/blob/master/README.md Retrieve market data. ```APIDOC ## Market Services ### fetch_market_tickers Fetches the current market tickers. #### Method `quidax.market.fetch_market_tickers()` ``` -------------------------------- ### Deposit Services Source: https://github.com/ridbay/quidax-sdk-nodejs/blob/master/README.md Manage deposit information. ```APIDOC ## Deposit Services ### fetch_single_deposit Fetches details of a single deposit. #### Method `quidax.deposits.fetch_single_deposit(user_id, deposit_id)` ### fetch_all_deposit Fetches all deposits for a user, with optional filtering by currency and state. #### Method `quidax.deposits.fetch_all_deposit(user_id, currency, state, per_page?, page?)` ### fetch_all_deposit_by_date Fetches all deposits within a specified date range. #### Method `quidax.deposits.fetch_all_deposit_by_date(user_id, currency, state, per_page, start_date, end_date)` ``` -------------------------------- ### Address Service Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Validates whether a given crypto address is valid for a currency on a specific network before initiating a withdrawal. ```APIDOC ## Address Service (`quidax.address`) Validates whether a given crypto address is valid for a currency on a specific network before initiating a withdrawal. ### Validate Address ```ts // Validate a Bitcoin address const btcCheck = await quidax.address.validateAddress('btc', '1A1zP1eP5QGefi2DMPTfTL5SLmv7Divf'); // { status: 'success', data: { valid: true } } // Validate a USDT address on TRC-20 const usdtCheck = await quidax.address.validateAddress('usdt', 'TXqAbCd...', 'trc20'); // { status: 'success', data: { valid: false } } if (!usdtCheck.data?.valid) { console.error('Invalid withdrawal address — aborting'); } ``` ``` -------------------------------- ### Fees Service Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Retrieves the current network fee for withdrawing a cryptocurrency, with optional network specification for multi-chain tokens. ```APIDOC ## Fees Service (`quidax.fees`) Retrieves the current network fee for withdrawing a cryptocurrency, with optional network specification for multi-chain tokens. ### Get Crypto Withdrawal Fees ```ts // Fetch BTC withdrawal fee const btcFee = await quidax.fees.getCryptoWithdrawalFees('btc'); // { status: 'success', data: { fee: '0.0001', currency: 'btc' } } // Fetch USDT withdrawal fee on TRC-20 const usdtFee = await quidax.fees.getCryptoWithdrawalFees('usdt', 'trc20'); // { status: 'success', data: { fee: '1', currency: 'usdt', network: 'trc20' } } console.log(`Estimated fee: ${usdtFee.data?.fee} USDT`); ``` ``` -------------------------------- ### Fetch Single Beneficiary Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Retrieve details for a specific saved beneficiary using its ID. ```typescript // Fetch a single beneficiary const one = await quidax.beneficiaries.fetchBeneficiary(USER_ID, 'ben_001'); ``` -------------------------------- ### Rebase Off Main Branch Source: https://github.com/ridbay/quidax-sdk-nodejs/blob/master/CONTRIBUTING.md Rebase your local branch onto the main branch to integrate latest changes and maintain a clean git history. ```bash $ git rebase origin/main ``` -------------------------------- ### Handle API Errors Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Catch typed errors thrown by SDK methods to handle specific HTTP failure scenarios. Errors contain code, message, and status properties. ```typescript import Quidax from 'quidax-package'; const quidax = new Quidax(process.env.QUIDAX_API_KEY!); try { const result = await quidax.wallets.createPaymentAddress('usr_invalid', 'btc', 'none'); console.log(result.data); } catch (err: any) { // err.code – HTTP status code (400, 401, 500, ...) // err.message – Human-readable error message from the API // err.status – API status string (e.g. 'error') if (err.code === 401) { console.error('Invalid API key'); } else if (err.code === 400) { console.error('Bad request:', err.message); } else { console.error('Server error:', err.message); } } ``` -------------------------------- ### Validate Crypto Address Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Check if a given cryptocurrency address is valid for a specific currency and network before initiating a withdrawal. ```typescript import Quidax from 'quidax-package'; const quidax = new Quidax(process.env.QUIDAX_API_KEY!); // Validate a Bitcoin address const btcCheck = await quidax.address.validateAddress('btc', '1A1zP1eP5QGefi2DMPTfTL5SLmv7Divf'); // { status: 'success', data: { valid: true } } // Validate a USDT address on TRC-20 const usdtCheck = await quidax.address.validateAddress('usdt', 'TXqAbCd...', 'trc20'); // { status: 'success', data: { valid: false } } if (!usdtCheck.data?.valid) { console.error('Invalid withdrawal address — aborting'); } ``` -------------------------------- ### Edit Beneficiary Label Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Update the label for an existing beneficiary. Only the label can be edited via this method. ```typescript // Edit a beneficiary's label const edited = await quidax.beneficiaries.editBeneficiary(USER_ID, 'ben_001', { label: 'Hardware wallet — Ledger', }); ``` -------------------------------- ### Cancel Order Source: https://context7.com/ridbay/quidax-sdk-nodejs/llms.txt Cancels an open order. ```APIDOC ### Method `cancelOrder(userId, orderId)` ### Description Cancels an open standard order. ### Parameters #### Path Parameters - `userId` (string) - Required - The ID of the user. - `orderId` (string) - Required - The ID of the order to cancel. ```