The signature for creating an order can be either from an EVM or a Bitcoin wallet, regardless of the assets being traded. However, before an order containing a Bitcoin asset can be placed, a Bitcoin wallet must have been authorized; conversely, before an order containing an EVM asset can be placed, an EVM wallet must have been authorized. See the Authorize wallet API call below.
When signing an order with a fixed amount with an EVM wallet, create the signature by signing this EIP-712 message:
When signing an order cancellation with a Bitcoin wallet, create the signature by signing a message constructed as follows:
const swapDescription = isBuy ? `Swap ${amount} ${quoteSymbol} for ${baseSymbol}` : `Swap ${amount} ${baseSymbol} for ${quoteSymbol}`
const message = `[funkybit] Please sign this message to authorize order cancellation. This action will not cost any gas fees.\n${swapDescription}\nAddress: ${address}, Nonce: ${nonce}`
The bitcoin signature should be created following the same rules as for authentication.
When withdrawing an EVM asset, create the signature by signing this EIP-712 message (the chainId must be the correct one for the token being withdrawn):
When withdrawing a Bitcoin asset, create the signature by signing this message:
const message = `[funkybit] Please sign this message to authorize withdrawal of ${amountInSats} ${symbol} from the exchange to your wallet.\nAddress: ${address}, Timestamp: ${new Date().toISOString()}`
The bitcoin signature should be created following the same rules as for authentication.
This is used to authorize a Bitcoin wallet for an existing EVM account, or to authorize an EVM wallet for an existing Bitcoin account. A given account can have at most 1 Bitcoin wallet and 1 EVM wallet. The wallet being added must not have already been added as either a primary or an additional wallet.
To authorize a Bitcoin wallet for an existing EVM wallet, sign this EIP-712 message (any valid chain id can be used):
To authorize an EVM wallet for an existing Bitcoin wallet, sign this message:
const message = `[funkybit] Please sign this message to authorize EVM wallet ${authorizedAddress.toLowerCase()}. This action will not cost any gas fees.\nAddress: ${address}, Timestamp: ${new Date().toISOString()}`
The bitcoin signature should be created following the same rules as for authentication.