This application provides sample code that showcases the Coinbase Prime APIs. The example UI interacts with both the REST and WebSocket endpoints.
The application was built using Svelte, Carbon Design System, and TailWind CSS.
Requires Node.js 16.x+
git clone git@github.com:coinbase-samples/prime-explorer-js.git
Init via npm:
cd prime-explorer-js
npm install
Navigate to the Prime Settings page and pull the API credentials:
https://prime.coinbase.com/portfolio/{your_portfolio_id}/settings/address-book
Optionally, access Exchange credentials (sandbox or prod):
https://public.sandbox.exchange.coinbase.com/profile/api
Add the following environment variables to a .env file in base of the repository:
PROD_SVC_ACCOUNTID=YOUR_SENDER_COMP_ID
PROD_ACCESS_KEY=YOUR_ACCESS_KEY
PROD_PORTFOLIO_ID=YOUR_PORTFOLIO_ID
PROD_PASSPHRASE=YOUR_PASSPHRASE
PROD_SIGNING_KEY=YOUR_SIGNING_KEY
PROD_URL=wss://ws-feed.prime.coinbase.com
PROD_API_HOST=https://api.prime.coinbase.com
PORT=YOUR_PORT
HTTP_HOST=http://localhost
ENTITY_ID=YOUR_ENTITY_ID
Validate the values contained in the .env file:
source .env
echo $PROD_SVC_ACCOUNTID
Optional
To test a partial list of the Coinbase Exchange endpoints, add the following to the .env file:
EXCHANGE_PROD_ACCESS_KEY=YOUR_ACCESS_KEY
EXCHANGE_PROD_PASSPHRASE=YOUR_PASSPHRASE
EXCHANGE_PROD_SIGNING_KEY=YOUR_SIGNING_KEY
npm run dev
Navigate to localhost:{{yourPort}}. You should see the app running.
npm run build