App API

Brink's App API is primarily used to retrieve order data for display on front ends

Get API Information

GET https://app-api.brink.trade/info

This endpoint returns Brink API information, such as the version of the API.

Estimate Cost of an Order

GET https://app-api.brink.trade/estimateOrderCost

Get cost estimation for a given swap

Path Parameters

NameTypeDescription

owner*

address

address of owner

tokenIn*

address

Address of token to be traded

tokenOut*

address

Address of token to be received

tokenInAmount*

bigint

number of tokens to be traded

tokenOutAmount*

bigin

number of tokens to be received

		{
				tokenIn: {...},
				tokenOut: {...},
				tokenInAmount: <int>,
				tokenOutAmount: <int>,
				tokenInAmountDecimals: <int>,
				tokenOutAmountDecimals: <int>,
				gasPrice: <decimal>,
				marketPrices: {
					ETH_USD: <decimal>,
					TokenIn_ETH: <decimal>,
					TokenOut_ETH: <decimal>
				},
				marketCosts: {
					TokenInAmount_TokenOut: <decimal>,
					TokenInAmount_ETH: <decimal>,
					TokenInAmount_USD: <decimal>,
					TokenOutAmount_TokenIn: <decimal>,
					TokenOutAmount_ETH: <decimal>,
					TokenOutAmount_USD: <decimal>
				},
				totalGasEstimate: {
					type: ‘totals’,
					gas: <int>,
					gas_ETH: <decimal>,
					gas_USD: <decimal>,
					gas_TokenIn: <decimal>,
					gas_TokenOut: <decimal>
				},
				gasEstimates: [
					{
						type: ‘brinkAccountDeploy’,
						gas: <int>,
						gas_ETH: <decimal>,
						gas_USD: <decimal>,
						gas_[TokenInAddress]: <decimal>,
						gas_[TokenOutAddress]: <decimal>
					},
					{
						type: ‘tokenSwap’,
						gas: <int>,
						gas_ETH: <decimal>,
						gas_USD: <decimal>,
						gas_[TokenInAddress]: <decimal>,
						gas_[TokenOutAddress]: <decimal>
					},
					{
						type: ‘nftBuy’,
						gas: <int>,
						gas_ETH: <decimal>,
						gas_USD: <decimal>,
						gas_[TokenInAddress]: <decimal>,
						gas_[TokenOutAddress]: <decimal>
					},
					{
						type: ‘overhead’,
						gas: <int>,
						gas_ETH: <decimal>,
						gas_USD: <decimal>,
						gas_[TokenInAddress]: <decimal>,
						gas_[TokenOutAddress]: <decimal>
					}
				]
			}

Get Order Details for a Single Order

GET https://app-api.brink.trade/orders/<hash>

Using the hash of the order, retrieve order details about an order

Path Parameters

NameTypeDescription

includeHistory

Boolean

true/false (Default false) Include cost history of order

startTime

Timestamp

Must be included if includeHistory is true. startTime for cost history Format: 2021-09-05T06:54:14.752Z All dates in UTC

endTime

Timestamp

Must be included if includeHistory is true. endTime for cost history Format: 2021-09-05T06:54:14.752Z All dates in UTC

{
	hash:0x..’
	tokenIn: {...},
	tokenOut: {...},
	tokenInAmount: <int>,
	tokenOutAmount: <int>,
	tokenInAmountDecimals: <int>,
	tokenOutAmountDecimals: <int>,
	signedMessage: {...},
	messageType: TOKEN_TO_NFT,
	transactions: [
			{
				status: ‘success’,
				Hash: <TX_HASH>
			},
			{
				status: ‘failed’,
				Hash: <TX_HASH>
			}
		],
		costHistory: [
				{
					time: <timestamp>,
					estimatedCost: {
						ETH: <decimal>,
						TokenIn: <decimal>,
						TokenOut: <decimal>
					},
					estimateOutput: {
						ETH: <decimal>,
						TokenIn: <decimal>,
						TokenOut: <decimal>
					},
					floorPrice: {
						ETH: <decimal>,
						TokenIn: <decimal>
					}
				},

		]
}

Retrieve Orders

GET https://app-api.brink.trade/orders

Endpoint to retrieve a list of orders specified by at the account level, and some other options such as order status

Path Parameters

NameTypeDescription

account

String

Account address

signer

String

Signer address

page

Int

Used for pagination, default 1

pageSize

Int

Used for pagination, default 30

sortDirection

String

<'asc'> or <'desc'> (default value) Sorted by creation time

status

String

Options: 'canceled'

'filled'

'expired'

'open'

'all' (default value)

asset

String

Filter by asset being traded String Address

	{
		count: 571,
		account: <0x123>,
		owner: <0x123>,
		nextPage: <url>,
		orders: [{
			created: <TIMESTAMP>,
			type: <limit_swap_token_to_token,...> - same as VERIFIER types,
			signedMessage: <SignedMessage>,
			status: <open|filled|canceled|expired>,
			transactions: [
				{
					hash: 0x1234,
					success: true | false
				}
			],
			insufficientFunds: true|false,
			neverExecutable: true|false,

			… additional fields depend on VERIFIER type
			… i.e for limit_swap_token_to_token:
			typeFields: {
				bitmapIndex: <BIGINT>,
				bit: <BIGINT>,
				tokenIn: 0x123,
				tokenInAmount: <BIGINT>,
				tokenOut: 0xabc,
				tokenOutAmount: <BIGINT>
				expiryBlock: <BIGINT>
			}
		}]
	}

Last updated