JavaScript API integration template for SplitNOW, the multi-wallet instant crypto exchange. 🐙🪼
- 0 dependencies
- Works on frontend: React, NextJS, SvelteKit, etc
- Works on backend: Node, Bun, etc
This repository exports three functions that wrap around the SplitNOW API to help you get up and running with creating quotes & orders quickly, no matter your use case:
async function createAndFetchQuote(
SPLITNOW_API_KEY, // string
fromAmount, // number
fromAssetId, // string
fromNetworkId, // string
toAssetId, // string
toNetworkId // string
) // returns Promise<object>async function createAndFetchOrder(
SPLITNOW_API_KEY, // string
quoteId, // string
fromAmount, // number
fromAssetId, // string
fromNetworkId, // string
walletDistributions, // object[]
) // returns Promise<object>async function getOrderStatus(
SPLITNOW_API_KEY, // string
orderId, // string
) // returns Promise<object>- Create a SplitNOW account at https://splitnow.io/auth/register
- Head to the API keys page on your account dashboard at https://splitnow.io/account/api-keys
- Copy your account's API key and store it in a safe place.
Note on rate limits: The default rate-limit of each API key is 60 requests per minute. Don't hesitate to contact SplitNOW if you need more. We scale to meet any demand instantly!
Note on security: Never expose your SplitNOW API key to clients! If you think your API key may have been accidentally leaked, please contact support right away so that we can get you set up with a fresh one.
Note on restricted regions: Our API services are not available to users in the Restricted Regions, directly or indirectly, in accordance with our Terms of Service.
git clone https://github.com/splitnow/api-quickstart-js
cd api-quickstart-jsTo ensure a seamless SplitNOW API integration for your use case, you must first understand the 3-step flow when using the SplitNOW API.
Below is a short explainer of each step so that you can best fit each step into your own software & workflows.
- Suppose
const quoteData = await createAndFetchQuote(/* your params here */) - You'll want to save
quoteData.quoteIdbecause you need this vaue to create your order in the next step. - You'll also probably want to do something such as filter through
quoteData.ratesto see which exchanges are available and at what rate - If the
exchangeRatekey of a rate object in thequoteData.ratesarray is0, the pair might not be supported on that exchange. - You can pick any exchange no matter what, though. Our systems fall back to the next best rate if your selection is unavailable!
- Suppose
const orderData = await createAndFetchOrder(/* your params here */)(remember to pass in the quote ID from the previous step) - The
orderDataobject contains important information you'll need for initiating the order:orderData.depositAddress&orderData.depositAmount. - Once you've sent the deposit, we take care of everything else automatically! just make sure you send the right amount! and also save orderData.orderId so you can check the status later
- Suppose
const orderStatus = await getOrderStatus(/* your params here */)(remember to pass in the order ID from the previous step) - Your 6-digit order ID is returned as
orderStatus.orderId - You'll probably want to do something with
orderStatus.orderStatussuch as update your app's client or trigger a notification once the order status changes. - If you want a human-readable order status such as for your UI, use
orderStatus.orderStatusText - Once
orderStatus.orderStatusiscompleted, it's all done and the wallets are funded as requested! Enjoy!
- Official API docs: https://splitnow.io/api/docs
- Free 24/7 email support: support@splitnow.io
- Free community support: SplitNOW API Developers Chat
Unlicensed (Whitelabelled)
More information: https://unlicense.org