curl --request POST \
--url https://app.crown-brlv.com/api/v1/accounts/{account-id}/external-wallets \
--header 'Content-Type: application/json' \
--data '
{
"address": "0xdDa4775Ed1d0c831B006FD4061Edb1b30693a44c",
"challenge": "Crown: whitelist wallet 0xdda4775ed1d0c831b006fd4061edb1b30693a44c for account 019712cf-c86d-703f-85b8-bdaa4fc8d254. Expires at 2024-01-15T10:45:00Z.",
"signature": "0x055b70e307b8ebbba01105a026164f5a8526af8ddf7149e3184d1d7e0bee4279377d982f2592028cdcea412105aece8b41529aac93e1c29545b9286d6c0071f41b",
"capabilities": [
"fx"
],
"custody-type": "self",
"custody-country": "BRA",
"owner-type": "account-holder"
}
'import requests
url = "https://app.crown-brlv.com/api/v1/accounts/{account-id}/external-wallets"
payload = {
"address": "0xdDa4775Ed1d0c831B006FD4061Edb1b30693a44c",
"challenge": "Crown: whitelist wallet 0xdda4775ed1d0c831b006fd4061edb1b30693a44c for account 019712cf-c86d-703f-85b8-bdaa4fc8d254. Expires at 2024-01-15T10:45:00Z.",
"signature": "0x055b70e307b8ebbba01105a026164f5a8526af8ddf7149e3184d1d7e0bee4279377d982f2592028cdcea412105aece8b41529aac93e1c29545b9286d6c0071f41b",
"capabilities": ["fx"],
"custody-type": "self",
"custody-country": "BRA",
"owner-type": "account-holder"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
address: '0xdDa4775Ed1d0c831B006FD4061Edb1b30693a44c',
challenge: 'Crown: whitelist wallet 0xdda4775ed1d0c831b006fd4061edb1b30693a44c for account 019712cf-c86d-703f-85b8-bdaa4fc8d254. Expires at 2024-01-15T10:45:00Z.',
signature: '0x055b70e307b8ebbba01105a026164f5a8526af8ddf7149e3184d1d7e0bee4279377d982f2592028cdcea412105aece8b41529aac93e1c29545b9286d6c0071f41b',
capabilities: ['fx'],
'custody-type': 'self',
'custody-country': 'BRA',
'owner-type': 'account-holder'
})
};
fetch('https://app.crown-brlv.com/api/v1/accounts/{account-id}/external-wallets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.crown-brlv.com/api/v1/accounts/{account-id}/external-wallets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'address' => '0xdDa4775Ed1d0c831B006FD4061Edb1b30693a44c',
'challenge' => 'Crown: whitelist wallet 0xdda4775ed1d0c831b006fd4061edb1b30693a44c for account 019712cf-c86d-703f-85b8-bdaa4fc8d254. Expires at 2024-01-15T10:45:00Z.',
'signature' => '0x055b70e307b8ebbba01105a026164f5a8526af8ddf7149e3184d1d7e0bee4279377d982f2592028cdcea412105aece8b41529aac93e1c29545b9286d6c0071f41b',
'capabilities' => [
'fx'
],
'custody-type' => 'self',
'custody-country' => 'BRA',
'owner-type' => 'account-holder'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.crown-brlv.com/api/v1/accounts/{account-id}/external-wallets"
payload := strings.NewReader("{\n \"address\": \"0xdDa4775Ed1d0c831B006FD4061Edb1b30693a44c\",\n \"challenge\": \"Crown: whitelist wallet 0xdda4775ed1d0c831b006fd4061edb1b30693a44c for account 019712cf-c86d-703f-85b8-bdaa4fc8d254. Expires at 2024-01-15T10:45:00Z.\",\n \"signature\": \"0x055b70e307b8ebbba01105a026164f5a8526af8ddf7149e3184d1d7e0bee4279377d982f2592028cdcea412105aece8b41529aac93e1c29545b9286d6c0071f41b\",\n \"capabilities\": [\n \"fx\"\n ],\n \"custody-type\": \"self\",\n \"custody-country\": \"BRA\",\n \"owner-type\": \"account-holder\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.crown-brlv.com/api/v1/accounts/{account-id}/external-wallets")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"0xdDa4775Ed1d0c831B006FD4061Edb1b30693a44c\",\n \"challenge\": \"Crown: whitelist wallet 0xdda4775ed1d0c831b006fd4061edb1b30693a44c for account 019712cf-c86d-703f-85b8-bdaa4fc8d254. Expires at 2024-01-15T10:45:00Z.\",\n \"signature\": \"0x055b70e307b8ebbba01105a026164f5a8526af8ddf7149e3184d1d7e0bee4279377d982f2592028cdcea412105aece8b41529aac93e1c29545b9286d6c0071f41b\",\n \"capabilities\": [\n \"fx\"\n ],\n \"custody-type\": \"self\",\n \"custody-country\": \"BRA\",\n \"owner-type\": \"account-holder\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.crown-brlv.com/api/v1/accounts/{account-id}/external-wallets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"address\": \"0xdDa4775Ed1d0c831B006FD4061Edb1b30693a44c\",\n \"challenge\": \"Crown: whitelist wallet 0xdda4775ed1d0c831b006fd4061edb1b30693a44c for account 019712cf-c86d-703f-85b8-bdaa4fc8d254. Expires at 2024-01-15T10:45:00Z.\",\n \"signature\": \"0x055b70e307b8ebbba01105a026164f5a8526af8ddf7149e3184d1d7e0bee4279377d982f2592028cdcea412105aece8b41529aac93e1c29545b9286d6c0071f41b\",\n \"capabilities\": [\n \"fx\"\n ],\n \"custody-type\": \"self\",\n \"custody-country\": \"BRA\",\n \"owner-type\": \"account-holder\"\n}"
response = http.request(request)
puts response.read_body{
"external-wallet": {
"address": "0xdDa4775Ed1d0c831B006FD4061Edb1b30693a44c",
"capabilities": [
"fx"
],
"created-at": "2024-01-15T10:31:12Z"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"code": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"code": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"code": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"code": "<string>"
}
}Whitelist External Wallet
Whitelists an external wallet for the account at once, with no approval step. The signature must be the wallet itself signing the challenge issued for this account and wallet by POST /v1/accounts/{account-id}/external-wallets/{address}/challenge.
account-id is the caller’s own account or one of its sub-accounts. Requires the manage-wallets capability on the account.
The wallet takes the fields and rules of one declared at sub-account creation:
- A wallet whose
capabilitiesisfxalone needscustody-type,custody-country(ISO-3) andowner-type. It needscustodian-namewithexchangecustody and refuses it withself, and needsowner-namewith athird-partyowner and refuses it otherwise. - Any other wallet accepts
owner-typeaccount-holderonly, and noowner-name.
Any wallet that signs with its own key can be whitelisted here. A smart-contract wallet, or an address that cannot sign such as an exchange deposit address, cannot: contact Crown for those.
Refusals
400Invalid value for signature: Invalid signaturewhen the signature is not the wallet’s own.400Invalid value for signature: Must be a 65-byte signature as 0x-prefixed hex.400Invalid value for challenge: Is not the challenge issued for this account and wallet.400Invalid value for challenge: Has expired.400when a field rule above is broken, for exampleMissing required field: custody-type.403when the account lacks themanage-walletscapability.404when the account is neither the caller’s nor one of its sub-accounts.422when another account already uses the address. A wallet withrewardsmust not be in use by any account at all.422when the account already has the wallet.422when Crown rejected the wallet for this account.422This account is being closed and can only withdraw funds.
curl --request POST \
--url https://app.crown-brlv.com/api/v1/accounts/{account-id}/external-wallets \
--header 'Content-Type: application/json' \
--data '
{
"address": "0xdDa4775Ed1d0c831B006FD4061Edb1b30693a44c",
"challenge": "Crown: whitelist wallet 0xdda4775ed1d0c831b006fd4061edb1b30693a44c for account 019712cf-c86d-703f-85b8-bdaa4fc8d254. Expires at 2024-01-15T10:45:00Z.",
"signature": "0x055b70e307b8ebbba01105a026164f5a8526af8ddf7149e3184d1d7e0bee4279377d982f2592028cdcea412105aece8b41529aac93e1c29545b9286d6c0071f41b",
"capabilities": [
"fx"
],
"custody-type": "self",
"custody-country": "BRA",
"owner-type": "account-holder"
}
'import requests
url = "https://app.crown-brlv.com/api/v1/accounts/{account-id}/external-wallets"
payload = {
"address": "0xdDa4775Ed1d0c831B006FD4061Edb1b30693a44c",
"challenge": "Crown: whitelist wallet 0xdda4775ed1d0c831b006fd4061edb1b30693a44c for account 019712cf-c86d-703f-85b8-bdaa4fc8d254. Expires at 2024-01-15T10:45:00Z.",
"signature": "0x055b70e307b8ebbba01105a026164f5a8526af8ddf7149e3184d1d7e0bee4279377d982f2592028cdcea412105aece8b41529aac93e1c29545b9286d6c0071f41b",
"capabilities": ["fx"],
"custody-type": "self",
"custody-country": "BRA",
"owner-type": "account-holder"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
address: '0xdDa4775Ed1d0c831B006FD4061Edb1b30693a44c',
challenge: 'Crown: whitelist wallet 0xdda4775ed1d0c831b006fd4061edb1b30693a44c for account 019712cf-c86d-703f-85b8-bdaa4fc8d254. Expires at 2024-01-15T10:45:00Z.',
signature: '0x055b70e307b8ebbba01105a026164f5a8526af8ddf7149e3184d1d7e0bee4279377d982f2592028cdcea412105aece8b41529aac93e1c29545b9286d6c0071f41b',
capabilities: ['fx'],
'custody-type': 'self',
'custody-country': 'BRA',
'owner-type': 'account-holder'
})
};
fetch('https://app.crown-brlv.com/api/v1/accounts/{account-id}/external-wallets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.crown-brlv.com/api/v1/accounts/{account-id}/external-wallets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'address' => '0xdDa4775Ed1d0c831B006FD4061Edb1b30693a44c',
'challenge' => 'Crown: whitelist wallet 0xdda4775ed1d0c831b006fd4061edb1b30693a44c for account 019712cf-c86d-703f-85b8-bdaa4fc8d254. Expires at 2024-01-15T10:45:00Z.',
'signature' => '0x055b70e307b8ebbba01105a026164f5a8526af8ddf7149e3184d1d7e0bee4279377d982f2592028cdcea412105aece8b41529aac93e1c29545b9286d6c0071f41b',
'capabilities' => [
'fx'
],
'custody-type' => 'self',
'custody-country' => 'BRA',
'owner-type' => 'account-holder'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.crown-brlv.com/api/v1/accounts/{account-id}/external-wallets"
payload := strings.NewReader("{\n \"address\": \"0xdDa4775Ed1d0c831B006FD4061Edb1b30693a44c\",\n \"challenge\": \"Crown: whitelist wallet 0xdda4775ed1d0c831b006fd4061edb1b30693a44c for account 019712cf-c86d-703f-85b8-bdaa4fc8d254. Expires at 2024-01-15T10:45:00Z.\",\n \"signature\": \"0x055b70e307b8ebbba01105a026164f5a8526af8ddf7149e3184d1d7e0bee4279377d982f2592028cdcea412105aece8b41529aac93e1c29545b9286d6c0071f41b\",\n \"capabilities\": [\n \"fx\"\n ],\n \"custody-type\": \"self\",\n \"custody-country\": \"BRA\",\n \"owner-type\": \"account-holder\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.crown-brlv.com/api/v1/accounts/{account-id}/external-wallets")
.header("Content-Type", "application/json")
.body("{\n \"address\": \"0xdDa4775Ed1d0c831B006FD4061Edb1b30693a44c\",\n \"challenge\": \"Crown: whitelist wallet 0xdda4775ed1d0c831b006fd4061edb1b30693a44c for account 019712cf-c86d-703f-85b8-bdaa4fc8d254. Expires at 2024-01-15T10:45:00Z.\",\n \"signature\": \"0x055b70e307b8ebbba01105a026164f5a8526af8ddf7149e3184d1d7e0bee4279377d982f2592028cdcea412105aece8b41529aac93e1c29545b9286d6c0071f41b\",\n \"capabilities\": [\n \"fx\"\n ],\n \"custody-type\": \"self\",\n \"custody-country\": \"BRA\",\n \"owner-type\": \"account-holder\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.crown-brlv.com/api/v1/accounts/{account-id}/external-wallets")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"address\": \"0xdDa4775Ed1d0c831B006FD4061Edb1b30693a44c\",\n \"challenge\": \"Crown: whitelist wallet 0xdda4775ed1d0c831b006fd4061edb1b30693a44c for account 019712cf-c86d-703f-85b8-bdaa4fc8d254. Expires at 2024-01-15T10:45:00Z.\",\n \"signature\": \"0x055b70e307b8ebbba01105a026164f5a8526af8ddf7149e3184d1d7e0bee4279377d982f2592028cdcea412105aece8b41529aac93e1c29545b9286d6c0071f41b\",\n \"capabilities\": [\n \"fx\"\n ],\n \"custody-type\": \"self\",\n \"custody-country\": \"BRA\",\n \"owner-type\": \"account-holder\"\n}"
response = http.request(request)
puts response.read_body{
"external-wallet": {
"address": "0xdDa4775Ed1d0c831B006FD4061Edb1b30693a44c",
"capabilities": [
"fx"
],
"created-at": "2024-01-15T10:31:12Z"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"code": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"code": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"code": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"code": "<string>"
}
}Body
The wallet's personal_sign (EIP-191) signature of the challenge, 65 bytes as 0x-prefixed hex. A last byte of 0 or 1, or 27 or 28, is accepted
^0x[0-9a-fA-F]{130}$"0x055b70e307b8ebbba01105a026164f5a8526af8ddf7149e3184d1d7e0bee4279377d982f2592028cdcea412105aece8b41529aac93e1c29545b9286d6c0071f41b"
What the wallet is for. A wallet with rewards earns the account's rewards, receives FX payouts too, and belongs to that account alone. A wallet with fx alone only receives FX payouts, and several accounts can have the same one. Omitted, the wallet does both
1fx, rewards ["fx"]