mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 22:46:49 +01:00
* WIP New APIs for dealing with custodians/exchanges * Simplified things * More API refinements + index.html file for quick viewing * Finishing touches on spec * Switched cryptoCode to paymentMethod as this allows us to differentiate between onchain and lightning * Moved draft API docs to "/docs-draft" * WIP baby steps * Added DB migration for CustodianAccountData * Rough but working POST /v1/api/custodian-account + GET /v1/api/custodian * WIP + early Kraken API client * Moved service registration to proper location * Working create + list custodian accounts + permissions + WIP Kraken client * Kraken API Balances call is working * Added asset balances to response * List Custodian Accounts call does not load assetBalances by default, because it can fail. Can be requested when needed. * Call to get the details of 1 specific custodian account * Added permissions to swagger * Added "tradableAssetPairs" to Kraken custodian response + cache the tradable pairs in memory for 24 hours * Removed unused file * WIP + Moved files to better locations * Updated docs * Working API endpoint to get info on a trade (same response as creating a new trade) * Working API endpoints for Deposit + Trade + untested Withdraw * Delete custodian account * Trading works, better error handling, cleanup * Working withdrawals + New endpoint for getting bid/ask prices * Completed withdrawals + new endpoint for getting info on a past withdrawal to simplify testing, Enums are output as strings, * Better error handling when withdrawing to a wrong destination * WithdrawalAddressName in config is now a string per currency (dictionary) * Added TODOs * Only show the custodian account "config" to users who are allowed * Added the new permissions to the API Keys UI * Renamed KrakenClient to KrakenExchange * WIP Kraken Config Form * Removed files for UI again, will make separate PR later * Fixed docs + Refactored to use PaymentMethod more + Added "name" to custodian account + Using cancelationToken everywhere * Updated withdrawal info docs * First unit test * Complete tests for /api/v1/custodians and /api/v1/custodian-accounts endpoints + Various improvements and fixes * Mock custodian and more exceptions * Many more tests + cleanup, moved files to better locations * More tests * WIP more tests * Greenfield API tests complete * Added missing "Name" column * Cleanup, TODOs and beginning of Kraken Tests * Added Kraken tests using public endpoints + handling of "SATS" currency * Added 1st mocked Kraken API call: GetAssetBalancesAsync * Added assert for bad config * Mocked more Kraken API responses + added CreationDate to withdrawal response * pr review club changes * Make Kraken Custodian a plugin * Re-added User-Agent header as it is required * Fixed bug in market trade on Kraken using a percentage as qty * A short delay so Kraken has the time to execute the market order and we don't fetch the details too quickly. * Merged the draft swagger into the main swagger since it didn't work anymore * Fixed API permissions test * Removed 2 TODOs * Fixed unit test * Remove Kraken Api as it should be separate opt-in plugin * Flatten namespace hierarchy and use InnerExeption instead of OriginalException * Remove useless line * Make sure account is from a specific store * Proper error if custodian code not found * Remove various warnings * Remove various warnings * Handle CustodianApiException through an exception filter * Store custodian-account blob directly * Remove duplications, transform methods into property * Improve docs tags * Make sure the custodianCode saved is canonical * Fix test Co-authored-by: Wouter Samaey <wouter.samaey@storefront.be> Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
1040 lines
42 KiB
JSON
1040 lines
42 KiB
JSON
{
|
|
"paths": {
|
|
"/api/v1/custodians": {
|
|
"get": {
|
|
"tags": [
|
|
"Custodians (Experimental)"
|
|
],
|
|
"summary": "List supported custodians",
|
|
"description": "List all supported custodians for the BTCPay instance. You can install plugins to add more custodians.",
|
|
"operationId": "Custodians_GetSupportedCustodians",
|
|
"responses": {
|
|
"200": {
|
|
"description": "list of supported custodians",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/CustodianData"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"API_Key": [],
|
|
"Basic": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/stores/{storeId}/custodian-accounts": {
|
|
"get": {
|
|
"tags": [
|
|
"Custodians (Experimental)"
|
|
],
|
|
"summary": "List store custodian accounts",
|
|
"parameters": [
|
|
{
|
|
"name": "storeId",
|
|
"in": "path",
|
|
"required": true,
|
|
"description": "The Store ID",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "assetBalances",
|
|
"in": "query",
|
|
"required": false,
|
|
"description": "Enable if you want the result to include the 'assetBalances' field. This will make the call slower or could cause the call to fail if the asset balances cannot be loaded (i.e. due to a bad API key).",
|
|
"schema": {
|
|
"type": "boolean",
|
|
"default": false
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "List of custodian accounts for the store.",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/CustodianAccountData"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "If you are authenticated but forbidden to view the store's custodian accounts"
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"tags": [
|
|
"Custodians (Experimental)"
|
|
],
|
|
"summary": "Add a custodial account to a store.",
|
|
"description": "Add a custodial account to a store.",
|
|
"requestBody": {
|
|
"x-name": "request",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/CreateCustodianAccountRequest"
|
|
}
|
|
}
|
|
},
|
|
"required": true,
|
|
"x-position": 1
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Information about the new custodian account",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/CustodianAccountData"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "If you are authenticated but forbidden to add new custodian account"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"API_Key": [
|
|
"btcpay.store.canmanagecustodianaccounts"
|
|
],
|
|
"Basic": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/stores/{storeId}/custodian-accounts/{accountId}": {
|
|
"get": {
|
|
"tags": [
|
|
"Custodians (Experimental)"
|
|
],
|
|
"summary": "Get store custodian account",
|
|
"parameters": [
|
|
{
|
|
"name": "storeId",
|
|
"in": "path",
|
|
"required": true,
|
|
"description": "The Store ID",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "accountId",
|
|
"in": "path",
|
|
"required": true,
|
|
"description": "The Custodian Account ID",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "assetBalances",
|
|
"in": "query",
|
|
"required": false,
|
|
"description": "Enable if you want the result to include the 'assetBalances' field. This will make the call slower or could cause the call to fail if the asset balances cannot be loaded (i.e. due to a bad API key).",
|
|
"schema": {
|
|
"type": "boolean",
|
|
"default": false
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "List of custodian accounts for the store.",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/CustodianAccountData"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "If you are authenticated but forbidden to view the custodian account"
|
|
}
|
|
}
|
|
},
|
|
"put": {
|
|
"tags": [
|
|
"Custodians (Experimental)"
|
|
],
|
|
"summary": "Update custodial account",
|
|
"description": "Update custodial account",
|
|
"requestBody": {
|
|
"x-name": "request",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/CreateCustodianAccountRequest"
|
|
}
|
|
}
|
|
},
|
|
"required": true,
|
|
"x-position": 1
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "The updated custodian account",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/CustodianAccountData"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"403": {
|
|
"description": "If you are authenticated but forbidden to modify new custodian account"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"API_Key": [
|
|
"btcpay.store.canmanagecustodianaccounts"
|
|
],
|
|
"Basic": []
|
|
}
|
|
]
|
|
},
|
|
"delete": {
|
|
"tags": [
|
|
"Custodians (Experimental)"
|
|
],
|
|
"summary": "Delete store custodian account",
|
|
"description": "Deletes a custodial account",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Custodian account deleted"
|
|
},
|
|
"403": {
|
|
"description": "If you are authenticated but forbidden to delete the custodian account"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/v1/stores/{storeId}/custodian-accounts/{accountId}/trades/quote": {
|
|
"get": {
|
|
"tags": [
|
|
"Custodians (Experimental)"
|
|
],
|
|
"summary": "Get quote for trading one asset for another",
|
|
"description": "Get the current bid and ask price for converting one asset into another.",
|
|
"parameters": [
|
|
{
|
|
"name": "storeId",
|
|
"in": "path",
|
|
"required": true,
|
|
"description": "The Store ID",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "accountId",
|
|
"in": "path",
|
|
"required": true,
|
|
"description": "The Custodian Account ID.",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "fromAsset",
|
|
"in": "query",
|
|
"required": true,
|
|
"description": "The asset to convert.",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "toAsset",
|
|
"in": "query",
|
|
"required": true,
|
|
"description": "The asset you want.",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "The quote for converting one asset to another.",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/QuoteResultData"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "No tradable asset pair found for this trade."
|
|
},
|
|
"403": {
|
|
"description": "If you are authenticated but forbidden to create trades"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"API_Key": [
|
|
"btcpay.store.canviewcustodianaccounts"
|
|
],
|
|
"Basic": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/stores/{storeId}/custodian-accounts/{accountId}/trades/market": {
|
|
"post": {
|
|
"tags": [
|
|
"Custodians (Experimental)"
|
|
],
|
|
"summary": "Trade one asset for another",
|
|
"description": "Trade one asset for another using a market order (=instant purchase with instant result or failure). A suitable asset pair will automatically be selected. If no asset pair is available, the call will fail.",
|
|
"parameters": [
|
|
{
|
|
"name": "storeId",
|
|
"in": "path",
|
|
"required": true,
|
|
"description": "The Store ID",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "accountId",
|
|
"in": "path",
|
|
"required": true,
|
|
"description": "The Custodian Account ID.",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"x-name": "request",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/TradeRequestData"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Information about the trade that was executed",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/TradeResultData"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "No tradable asset pair found for this trade."
|
|
},
|
|
"403": {
|
|
"description": "If you are authenticated but forbidden to create trades"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"API_Key": [
|
|
"btcpay.store.cantradecustodianaccounts"
|
|
],
|
|
"Basic": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/stores/{storeId}/custodian-accounts/{accountId}/addresses/{paymentMethod}": {
|
|
"get": {
|
|
"tags": [
|
|
"Custodians (Experimental)"
|
|
],
|
|
"summary": "Get a deposit address for custodian",
|
|
"description": "Get a new deposit address for the custodian using the specified payment method (network + crypto code).",
|
|
"parameters": [
|
|
{
|
|
"name": "storeId",
|
|
"in": "path",
|
|
"required": true,
|
|
"description": "The Store ID",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "accountId",
|
|
"in": "path",
|
|
"required": true,
|
|
"description": "The Custodian Account ID.",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "paymentMethod",
|
|
"in": "path",
|
|
"required": true,
|
|
"description": "The payment method to use for the deposit. Example: \"BTC-OnChain\" or \"BTC-Lightning\"",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "deposit address",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "object",
|
|
"properties": {
|
|
"depositAddress": {
|
|
"type": "string",
|
|
"description": "The address to deposit your funds."
|
|
}
|
|
},
|
|
"description": "A bitcoin address belonging to the custodian"
|
|
},
|
|
"example": {
|
|
"depositAddress": "bc1qxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "The custodian does not support deposits using this payment method."
|
|
},
|
|
"403": {
|
|
"description": "If you are authenticated but forbidden to get the deposit address"
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"API_Key": [
|
|
"btcpay.store.candeposittocustodianaccounts"
|
|
],
|
|
"Basic": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/stores/{storeId}/custodian-accounts/{accountId}/withdrawals": {
|
|
"post": {
|
|
"tags": [
|
|
"Custodians (Experimental)"
|
|
],
|
|
"summary": "Withdraw to store wallet",
|
|
"description": "Withdraw an asset to your store wallet.",
|
|
"parameters": [
|
|
{
|
|
"name": "storeId",
|
|
"in": "path",
|
|
"required": true,
|
|
"description": "The Store ID",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "accountId",
|
|
"in": "path",
|
|
"required": true,
|
|
"description": "The Custodian Account ID.",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"x-name": "request",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/WithdrawalRequestData"
|
|
}
|
|
}
|
|
},
|
|
"required": true,
|
|
"x-position": 1
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Information about the withdrawal that was executed",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/WithdrawalResultData"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Withdrawal is not possible because you don't have this much in your account."
|
|
},
|
|
"404": {
|
|
"description": "Withdrawal is not possible for this asset."
|
|
},
|
|
"403": {
|
|
"description": "Forbidden",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"oneOf": [
|
|
{
|
|
"type": "string",
|
|
"description": "If you are authenticated but forbidden to create trades"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Withdrawing to the address provided is not allowed"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"API_Key": [
|
|
"btcpay.store.canwithdrawfromcustodianaccounts"
|
|
],
|
|
"Basic": []
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"/api/v1/stores/{storeId}/custodian-accounts/{accountId}/withdrawals/{withdrawalId}": {
|
|
"post": {
|
|
"tags": [
|
|
"Custodians (Experimental)"
|
|
],
|
|
"summary": "Get withdrawal info",
|
|
"description": "Get the details about a past withdrawal.",
|
|
"parameters": [
|
|
{
|
|
"name": "storeId",
|
|
"in": "path",
|
|
"required": true,
|
|
"description": "The Store ID",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "accountId",
|
|
"in": "path",
|
|
"required": true,
|
|
"description": "The Custodian Account ID.",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
{
|
|
"name": "withdrawalId",
|
|
"in": "path",
|
|
"required": true,
|
|
"description": "The Withdrawal ID.",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Information about the withdrawal",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/WithdrawalResultData"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"404": {
|
|
"description": "Withdrawal not found."
|
|
},
|
|
"403": {
|
|
"description": "Forbidden",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"oneOf": [
|
|
{
|
|
"type": "string",
|
|
"description": "If you are authenticated but forbidden to create trades"
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Withdrawing to the address provided is not allowed"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"API_Key": [
|
|
"btcpay.store.canwithdrawfromcustodianaccounts"
|
|
],
|
|
"Basic": []
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"CustodianData": {
|
|
"type": "object",
|
|
"properties": {
|
|
"code": {
|
|
"type": "string",
|
|
"description": "The unique code of the custodian.",
|
|
"nullable": false
|
|
},
|
|
"label": {
|
|
"type": "string",
|
|
"description": "The name of the custodian.",
|
|
"nullable": false
|
|
},
|
|
"depositablePaymentMethods": {
|
|
"type": "array",
|
|
"description": "A list of payment methods (crypto code + network) you can deposit to the custodian.",
|
|
"nullable": false
|
|
},
|
|
"withdrawablePaymentMethods": {
|
|
"type": "array",
|
|
"description": "A list of payment methods (crypto code + network) you can withdraw from the custodian.",
|
|
"nullable": false
|
|
},
|
|
"tradableAssetPairs": {
|
|
"type": "array",
|
|
"description": "A list of tradable asset pairs, or NULL if the custodian cannot trades/convert assets.",
|
|
"nullable": true
|
|
}
|
|
},
|
|
"example": {
|
|
"code": "kraken",
|
|
"name": "Kraken",
|
|
"tradableAssetPairs": [
|
|
"BTC/USD",
|
|
"BTC/EUR",
|
|
"LTC/USD",
|
|
"LTC/EUR"
|
|
],
|
|
"withdrawablePaymentMethods": [
|
|
"BTC-OnChain",
|
|
"LTC-OnChain"
|
|
],
|
|
"depositablePaymentMethods": [
|
|
"BTC-OnChain",
|
|
"LTC-OnChain"
|
|
]
|
|
}
|
|
},
|
|
"CustodianAccountData": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": "The unique code of the customer's account with this custodian. The format depends on the custodian."
|
|
},
|
|
"storeId": {
|
|
"type": "string",
|
|
"description": "The store ID."
|
|
},
|
|
"custodianCode": {
|
|
"type": "string",
|
|
"description": "The code for the custodian."
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "The name of the custodian account."
|
|
},
|
|
"assetBalances": {
|
|
"type": "array",
|
|
"nullable": true,
|
|
"description": "A real-time loaded list of all assets (fiat and crypto) on this custodian and the quantity held in the account. Assets with qty 0 can be omitted.",
|
|
"items": {
|
|
"$ref": "#/components/schemas/AssetBalanceData"
|
|
}
|
|
},
|
|
"config": {
|
|
"type": "object",
|
|
"nullable": true,
|
|
"description": "The configuration of this custodian account. Specific contents depend on the custodian and your access permissions."
|
|
}
|
|
},
|
|
"example": {
|
|
"accountId": "xxxxxxxxxxxxxxx",
|
|
"storeId": "xxxxxxxxxxxxxx",
|
|
"custodianCode": "kraken",
|
|
"name": "My Kraken Account",
|
|
"assetBalances": [
|
|
{
|
|
"asset": "BTC",
|
|
"qty": 1.23456
|
|
},
|
|
{
|
|
"asset": "USD",
|
|
"qty": 123456.78
|
|
}
|
|
],
|
|
"config": {
|
|
"WithdrawToAddressNamePerPaymentMethod": {
|
|
"BTC-OnChain": "My Ledger Nano"
|
|
},
|
|
"ApiKey": "xxx",
|
|
"PrivateKey": "xxx"
|
|
}
|
|
}
|
|
},
|
|
"CreateCustodianAccountRequest": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"description": "The unique code of the customer's account with this custodian. The format depends on the custodian."
|
|
},
|
|
"storeId": {
|
|
"type": "string",
|
|
"description": "The store ID."
|
|
},
|
|
"custodianCode": {
|
|
"type": "string",
|
|
"description": "The code for the custodian."
|
|
},
|
|
"name": {
|
|
"type": "string",
|
|
"description": "The name of the custodian account."
|
|
},
|
|
"config": {
|
|
"type": "object",
|
|
"nullable": true,
|
|
"description": "The configuration of this custodian account. Specific contents depend on the custodian and your access permissions."
|
|
}
|
|
},
|
|
"example": {
|
|
"accountId": "xxxxxxxxxxxxxxx",
|
|
"storeId": "xxxxxxxxxxxxxx",
|
|
"custodianCode": "kraken",
|
|
"name": "My Kraken Account",
|
|
"config": {
|
|
"WithdrawToAddressNamePerPaymentMethod": {
|
|
"BTC-OnChain": "My Ledger Nano"
|
|
},
|
|
"ApiKey": "xxx",
|
|
"PrivateKey": "xxx"
|
|
}
|
|
}
|
|
},
|
|
"QuoteResultData": {
|
|
"type": "object",
|
|
"properties": {
|
|
"fromAsset": {
|
|
"type": "string",
|
|
"description": "The asset to trade.",
|
|
"nullable": false
|
|
},
|
|
"toAsset": {
|
|
"type": "string",
|
|
"description": "The asset you want.",
|
|
"nullable": false
|
|
},
|
|
"bid": {
|
|
"type": "number",
|
|
"description": "The bid price.",
|
|
"nullable": false
|
|
},
|
|
"ask": {
|
|
"type": "number",
|
|
"description": "The ask price",
|
|
"nullable": false
|
|
}
|
|
},
|
|
"example": {
|
|
"fromAsset": "USD",
|
|
"toAsset": "BTC",
|
|
"bid": 30000.12,
|
|
"ask": 30002.24
|
|
}
|
|
},
|
|
"TradeRequestData": {
|
|
"type": "object",
|
|
"properties": {
|
|
"fromAsset": {
|
|
"type": "string",
|
|
"description": "The asset to trade.",
|
|
"nullable": false
|
|
},
|
|
"toAsset": {
|
|
"type": "string",
|
|
"description": "The asset you want.",
|
|
"nullable": false
|
|
},
|
|
"qty": {
|
|
"oneOf": [
|
|
{
|
|
"type": "number",
|
|
"description": "The qty of fromAsset to convert into toAsset."
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "The percent of fromAsset to convert into toAsset. The value must end with \"%\" to be considered a percentage."
|
|
}
|
|
],
|
|
"nullable": false
|
|
}
|
|
},
|
|
"example": {
|
|
"fromAsset": "USD",
|
|
"toAsset": "BTC",
|
|
"qty": "50%"
|
|
}
|
|
},
|
|
"TradeResultData": {
|
|
"type": "object",
|
|
"properties": {
|
|
"fromAsset": {
|
|
"type": "string",
|
|
"description": "The asset to trade."
|
|
},
|
|
"toAsset": {
|
|
"type": "string",
|
|
"description": "The asset you want."
|
|
},
|
|
"ledgerEntries": {
|
|
"type": "array",
|
|
"description": "The asset entries that were changed during the trade. This is an array of at least 2 items with the asset sold and the asset gained. It may also include ledger entries for the costs of the trade and possibly exchange tokens used.",
|
|
"items": {
|
|
"$ref": "#/components/schemas/LedgerEntryData"
|
|
}
|
|
},
|
|
"tradeId": {
|
|
"type": "string",
|
|
"description": "The unique ID of the trade used by the exchange. This ID can be used to get the details of this trade at a later time.",
|
|
"nullable": true
|
|
},
|
|
"accountId": {
|
|
"type": "string",
|
|
"description": "The unique ID of the custodian account used.",
|
|
"nullable": false
|
|
},
|
|
"custodianCode": {
|
|
"type": "string",
|
|
"description": "The code of the custodian used.",
|
|
"nullable": false
|
|
}
|
|
},
|
|
"example": {
|
|
"fromAsset": "USD",
|
|
"toAsset": "BTC",
|
|
"ledgerEntries": [
|
|
{
|
|
"asset": "BTC",
|
|
"qty": 1.23456,
|
|
"type": "Trade"
|
|
},
|
|
{
|
|
"asset": "USD",
|
|
"qty": -61728,
|
|
"type": "Trade"
|
|
},
|
|
{
|
|
"asset": "BTC",
|
|
"qty": -0.00123456,
|
|
"type": "Fee"
|
|
},
|
|
{
|
|
"asset": "KFEE",
|
|
"qty": -123.456,
|
|
"type": "Fee"
|
|
}
|
|
],
|
|
"tradeId": "XXXX-XXXX-XXXX-XXXX",
|
|
"accountId": "xxxxxxxxxxxxxx",
|
|
"custodianCode": "kraken"
|
|
}
|
|
},
|
|
"WithdrawalRequestData": {
|
|
"type": "object",
|
|
"properties": {
|
|
"paymentMethod": {
|
|
"type": "string",
|
|
"description": "The payment method (cryptocode + network) of the withdrawal.",
|
|
"nullable": false
|
|
},
|
|
"qty": {
|
|
"type": "number",
|
|
"description": "The qty to withdraw.",
|
|
"nullable": false
|
|
}
|
|
},
|
|
"example": {
|
|
"paymentMethod": "BTC-OnChain",
|
|
"qty": 0.123456
|
|
}
|
|
},
|
|
"WithdrawalResultData": {
|
|
"type": "object",
|
|
"properties": {
|
|
"asset": {
|
|
"type": "string",
|
|
"description": "The asset that is being withdrawn."
|
|
},
|
|
"paymentMethod": {
|
|
"type": "string",
|
|
"description": "The payment method that is used (crypto code + network)."
|
|
},
|
|
"ledgerEntries": {
|
|
"type": "array",
|
|
"description": "The asset entries that were changed during the withdrawal. The first item is always the withdrawal itself. It could also includes ledger entries for the costs and may include credits or exchange tokens to give a discount.",
|
|
"items": {
|
|
"$ref": "#/components/schemas/LedgerEntryData"
|
|
}
|
|
},
|
|
"withdrawalId": {
|
|
"type": "string",
|
|
"description": "The unique ID of the withdrawal used by the exchange.",
|
|
"nullable": true
|
|
},
|
|
"accountId": {
|
|
"type": "string",
|
|
"description": "The unique ID of the custodian account used.",
|
|
"nullable": false
|
|
},
|
|
"custodianCode": {
|
|
"type": "string",
|
|
"description": "The code of the custodian used.",
|
|
"nullable": false
|
|
},
|
|
"status": {
|
|
"type": "string",
|
|
"description": "The status of the withdrawal: 'Queued', 'Complete', 'Failed' or 'Unknown'.",
|
|
"nullable": false
|
|
},
|
|
"transactionId": {
|
|
"type": "string",
|
|
"description": "The transaction ID on the blockchain once the withdrawal has been executed.",
|
|
"nullable": true
|
|
},
|
|
"targetAddress": {
|
|
"type": "string",
|
|
"description": "The address where the funds were sent to once the withdrawal has been executed.",
|
|
"nullable": true
|
|
}
|
|
},
|
|
"example": {
|
|
"asset": "BTC",
|
|
"paymentMethod": "BTC-OnChain",
|
|
"ledgerEntries": [
|
|
{
|
|
"asset": "BTC",
|
|
"qty": -0.123456,
|
|
"type": "Withdrawal"
|
|
},
|
|
{
|
|
"asset": "BTC",
|
|
"qty": -0.005,
|
|
"type": "Fee"
|
|
}
|
|
],
|
|
"withdrawalId": "XXXX-XXXX-XXXX-XXXX",
|
|
"accountId": "xxxxxxxxxxxxxxx",
|
|
"custodianCode": "kraken",
|
|
"status": "Complete",
|
|
"transactionId": "xxxxxxxxxxxxxxx",
|
|
"targetAddress": "bc1qxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
}
|
|
},
|
|
"LedgerEntryData": {
|
|
"type": "object",
|
|
"description": "A single ledger entry meaning an asset and qty has changed (increased or decreased).",
|
|
"properties": {
|
|
"asset": {
|
|
"type": "string",
|
|
"description": "An asset.",
|
|
"nullable": false
|
|
},
|
|
"qty": {
|
|
"type": "number",
|
|
"description": "The quantity changed of the asset. Can be positive or negative.",
|
|
"nullable": false
|
|
},
|
|
"type": {
|
|
"type": "string",
|
|
"description": "Trade, Fee or Withdrawal",
|
|
"nullable": false
|
|
}
|
|
},
|
|
"example": {
|
|
"asset": "BTC",
|
|
"qty": 1.23456,
|
|
"type": "Trade"
|
|
}
|
|
},
|
|
"AssetBalanceData": {
|
|
"type": "object",
|
|
"description": "An asset and it's qty.",
|
|
"properties": {
|
|
"asset": {
|
|
"type": "string",
|
|
"description": "An asset.",
|
|
"nullable": false
|
|
},
|
|
"qty": {
|
|
"type": "number",
|
|
"description": "The quantity changed of the asset. Can be positive or negative.",
|
|
"nullable": false
|
|
}
|
|
},
|
|
"example": {
|
|
"asset": "BTC",
|
|
"qty": 1.23456
|
|
}
|
|
},
|
|
"LedgerEntryType": {
|
|
"type": "string",
|
|
"enum": [
|
|
"Trade",
|
|
"Fee",
|
|
"Withdrawal"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"tags": [
|
|
{
|
|
"name": "Custodians (Experimental)"
|
|
}
|
|
]
|
|
}
|