Developers

funkybit offers REST and Websocket APIs for all exchange functions.

The funkybit API endpoint is https://api.funkybit.fun/

Authentication for both APIs is the same, and starts with an ECDSA key pair and the associated EVM address address.

Define this sign-in message:

const message = {
    message: '[funkybit] Please sign this message to verify your ownership of this wallet address. This action will not cost any gas fees.',
    address: `${address.toLowerCase()}`,
    chainId: chainId,
    timestamp: new Date().toISOString()
}

Next sign the following EIP-712 message:

{
  domain: {
    name: 'funkybit',
    chainId: chainId
  },
  types: {
    EIP712Domain: [
      { name: 'name', type: 'string' },
      { name: 'chainId', type: 'uint32' }
    ],
    'Sign In': [
      { name: 'message', type: 'string' },
      { name: 'address', type: 'string' },
      { name: 'chainId', type: 'uint32' },
      { name: 'timestamp', type: 'string' }
    ]
  },
  message: message,
  primaryType: 'Sign In'
}

Now construct the auth token as:

const authToken = `${signInMessageBody}.${signature}`

where signInMessageBody is simply message converted to a JSON string and base64url-encoded.

To authenticate to the REST API, send a Authorization: Bearer <AUTH-TOKEN> HTTP header.

To authenticate to the Websocket API, use wss://api.funkybit.fun/connect?auth=<AUTH-TOKEN> as the websocket connection URL.

Any valid chain id can be used.

Last updated