THORChain Actions API
The Actions API from THORChain — 1 operation(s) for actions.
The Actions API from THORChain — 1 operation(s) for actions.
openapi: 3.0.0
info:
title: Thornode Auth Actions API
version: 3.19.1
contact:
email: devs@thorchain.org
description: Thornode REST API.
tags:
- name: Actions
paths:
/v2/actions:
get:
description: 'List actions along with their related transactions. An action is generated by one or more
inbound transactions with the intended action set in the transaction memo. The action may
result in one or more outbound transactions. Results are paginated by sets of 50.
Filters may be applied to query actions.
'
operationId: GetActions
parameters:
- description: 'Comma separated list. Address of sender or recipient of any in/out transaction related
to the action.
'
example: tbnb1fj2lqj8dvr5pumfchc7ntlfqd2v6zdxqwjewf5
in: query
name: address
schema:
type: string
- description: ID of any in/out tx related to the action
example: 2F624637DE179665BA3322B864DB9F30001FD37B4E0D22A0B6ECE6A5B078DAB4
in: query
name: txid
schema:
type: string
- description: 'Comma separated list. Any asset that is part of the action (CHAIN.SYMBOL)
Additionally, synth, nosynth, and norune filters can be used for swap, add/withdraw actions.
'
examples:
filterAsset:
summary: Query action that are neither synth nor rune asset
value: nosynth,norune
regularAsset:
summary: Regular multiple asset query. (having at least either one of them)
value: BTC.BTC,THOR.RUNE
in: query
name: asset
schema:
type: string
- description: 'One or more comma separated unique types of action
(swap, addLiquidity, withdraw, donate, refund, switch, thorname, runePoolDeposit, runePoolWithdraw)
'
example: swap,addLiquidity
in: query
name: type
schema:
type: string
- description: "One or more comma separated transaction type of the action, it's the tx type parsed\nfrom memo. For example: Loan is a swap event but it's considered as loan tx type\nType of Transactions: \n\"unknown\", \"add\", \"withdraw\", \"swap\", \"limitOrder\", \"outbound\", \"donate\",\n\"bond\", \"unbond\", \"leave\", \"yggdrasilFund\", \"yggdrasilReturn\", \"reserve\",\n\"refund\", \"migrate\", \"ragnarok\", \"switch\", \"noOp\", \"consolidate\", \"thorname\",\n\"loanOpen\", \"loanRepayment\"\n"
example: loanOpen,loanRepayment
in: query
name: txType
schema:
type: string
- description: 'Comma separated list. Affiliate address of the action (swap, refund)
'
examples:
multiple:
summary: Query affiliates that one is THORName and other is address
value: ts,thor102y0m3uptg0vvudeyh00r2fnz70wq7d8y7mu2g
regular:
value: thor102y0m3uptg0vvudeyh00r2fnz70wq7d8y7mu2g
in: query
name: affiliate
schema:
type: string
- description: number of actions returned, default is 50
in: query
name: limit
schema:
format: int64
maximum: 50
minimum: 0
type: integer
- description: pagination offset, default is 0
in: query
name: offset
schema:
format: int64
minimum: 0
type: integer
- description: if this is given, the actions for the next page will be given
in: query
name: nextPageToken
schema:
format: int64
minimum: 0
type: integer
- description: if this is given, the actions older than the timestamp will be given
in: query
name: timestamp
schema:
format: int64
minimum: 0
type: integer
- description: if this is given, the actions older than the height will be given
in: query
name: height
schema:
format: int64
minimum: 0
type: integer
- description: if this is given, the actions for the previous page will be given
in: query
name: prevPageToken
schema:
format: int64
minimum: 0
type: integer
- description: if this is given, the actions newer than the timestamp will be given
in: query
name: fromTimestamp
schema:
format: int64
minimum: 0
type: integer
- description: if this is given, the actions newer than the height will be given
in: query
name: fromHeight
schema:
format: int64
minimum: 0
type: integer
responses:
'200':
$ref: '#/components/responses/ActionsResponse'
summary: Actions List
tags:
- Actions
components:
responses:
ActionsResponse:
content:
application/json:
schema:
properties:
actions:
items:
$ref: '#/components/schemas/Action'
type: array
count:
description: 'Int64, number of results matching the given filters. It may be -1 if
Midgard is having trouble counting the results and has to cancel the count query
(temporary fix). Also, if new action parameters is used it won''t be returned.
'
type: string
meta:
$ref: '#/components/schemas/ActionMeta'
required:
- actions
- meta
type: object
description: Returns an array of actions for the given filters.
schemas:
BondMetadata:
properties:
fee:
description: node operator fee
type: string
memo:
description: Transaction memo of bond event
type: string
nodeAddress:
description: node address
type: string
provider:
description: bond provider address
type: string
required:
- memo
- nodeAddress
type: object
ContractMetadata:
properties:
attributes:
description: contract attributes emitted from its event
type: object
contractType:
description: contract type defined by cosmwasm
type: string
funds:
description: contract funds emitted from its event
type: string
msg:
description: contract massages emitted from its event
type: object
required:
- contractType
- attributes
type: object
Metadata:
properties:
addLiquidity:
$ref: '#/components/schemas/AddLiquidityMetadata'
bond:
$ref: '#/components/schemas/BondMetadata'
contract:
$ref: '#/components/schemas/ContractMetadata'
failed:
$ref: '#/components/schemas/FailedMetadata'
limitSwap:
$ref: '#/components/schemas/LimitSwapMetadata'
rebond:
$ref: '#/components/schemas/RebondMetadata'
refund:
$ref: '#/components/schemas/RefundMetadata'
runePoolDeposit:
$ref: '#/components/schemas/RunePoolDepositMetadata'
runePoolWithdraw:
$ref: '#/components/schemas/RunePoolWithdrawMetadata'
send:
$ref: '#/components/schemas/SendMetadata'
swap:
$ref: '#/components/schemas/SwapMetadata'
tcy:
$ref: '#/components/schemas/TcyMetadata'
thorname:
$ref: '#/components/schemas/ThornameMetadata'
withdraw:
$ref: '#/components/schemas/WithdrawMetadata'
type: object
RunePoolDepositMetadata:
properties:
units:
description: "Int64, amount of units assigned to the member as result of the \ndeposit\n"
type: string
required:
- units
type: object
RefundMetadata:
properties:
affiliateAddress:
description: Affiliate fee address of the swap, empty if fee swap
type: string
affiliateFee:
description: Int64 (Basis points, 0-1000, where 1000=10%)
type: string
memo:
description: Transaction memo of the refund action
type: string
networkFees:
$ref: '#/components/schemas/NetworkFees'
reason:
description: Reason for the refund
type: string
txType:
description: "The type of the transaction given from its Memo\nType of Transaction type: \n\"unknown\", \"add\", \"withdraw\", \"swap\", \"limitOrder\", \"outbound\", \"donate\",\n\"bond\", \"unbond\", \"leave\", \"yggdrasilFund\", \"yggdrasilReturn\", \"reserve\",\n\"refund\", \"migrate\", \"ragnarok\", \"switch\", \"noOp\", \"consolidate\", \"thorname\",\n\"loanOpen\", \"loanRepayment\"\n"
example: loanOpen
type: string
required:
- networkFees
- reason
- memo
- affiliateFee
- affiliateAddress
- txType
type: object
TcyMetadata:
properties:
memo:
description: Transaction memo of tcy message.
type: string
required:
- memo
type: object
LimitSwapMetadata:
properties:
memo:
description: Transaction memo of bond event
type: string
required:
- memo
type: object
Coin:
description: Represents a digital currency amount
properties:
amount:
description: Int64(e8), asset Amount.
type: string
asset:
description: Asset in CHAIN.SYMBOL format
type: string
required:
- asset
- amount
type: object
FailedMetadata:
properties:
code:
description: failed transaction code
type: string
memo:
description: failed transaction memo
type: string
reason:
description: failed transaction code
type: string
required:
- memo
- reason
- code
type: object
Transaction:
description: Transaction data
properties:
address:
description: Sender address
type: string
affiliate:
description: if transactions flaged as affiliate
type: boolean
coins:
$ref: '#/components/schemas/Coins'
height:
description: 'The thorchain height that the outbound transaction occurred.
'
type: string
txID:
description: 'Transaction id hash. Some transactions (such as outbound transactions made in the
native asset) may have a zero value.
'
type: string
required:
- txID
- address
- coins
type: object
ThornameMetadata:
properties:
address:
description: The CHAIN address thorname has been registered to.
type: string
chain:
description: The thorname's chain.
type: string
expire:
description: Int64, THORChain block height in which THORName expires.
type: string
fundAmount:
description: Int64, the amount of funding for the THORName registration.
type: string
memo:
description: Transaction memo of thorname deposit message.
type: string
owner:
description: owner's THOR address.
example: thor102y0m3uptg0vvudeyh00r2fnz70wq7d8y7mu2g
type: string
registrationFee:
description: Int64, the registration fee paid.
type: string
thorname:
description: The thorname registered to the address.
type: string
txType:
description: The type of the transaction given from its Memo.
type: string
required:
- memo
- thorname
- address
- owner
- expire
- chain
- fundAmount
- registrationFee
- txType
type: object
WithdrawMetadata:
properties:
asymmetry:
description: 'Decimal (-1.0 <=> 1.0), indicates how asymmetrical the withdrawal was. 0 means
totally symmetrical
'
type: string
basisPoints:
description: 'Int64 (Basis points, 0-10000, where 10000=100%), percentage of total pool ownership
withdrawn
'
type: string
impermanentLossProtection:
description: Int64, additional Rune paid out because of impermanent loss protection
type: string
liquidityUnits:
description: 'Int64, amount of liquidity units removed from the member as result of the withdrawal
'
type: string
memo:
description: Transaction memo of the withdraw action
type: string
networkFees:
$ref: '#/components/schemas/NetworkFees'
required:
- liquidityUnits
- asymmetry
- basisPoints
- networkFees
- impermanentLossProtection
- memo
type: object
NetworkFees:
description: 'List of network fees associated to an action. One network fee is charged for each
outbound transaction
'
items:
$ref: '#/components/schemas/Coin'
type: array
SendMetadata:
properties:
code:
description: failed transaction code
type: string
memo:
description: Transaction memo of the send action
type: string
networkFees:
$ref: '#/components/schemas/NetworkFees'
reason:
description: failed transaction code
type: string
required:
- networkFees
- memo
- reason
- code
type: object
RunePoolWithdrawMetadata:
properties:
affiliateAddress:
description: Transaction affiliate address
type: string
affiliateAmount:
description: Int64, Transaction affiliate amount in rune
type: string
affiliateBasisPoint:
description: Transaction affiliate basis point
type: string
basisPoints:
description: 'Int64 (Basis points, 0-10000, where 10000=100%), percentage of total ownership
withdrawn
'
type: string
units:
description: 'Int64, amount of units removed from the member as result of the withdrawal
'
type: string
required:
- units
- basisPoints
- affiliateAmount
- affiliateAddress
- affiliateBasisPoint
type: object
RebondMetadata:
properties:
memo:
description: Transaction memo of bond event
type: string
newBondAddress:
description: new bond address
type: string
nodeAddress:
description: node address
type: string
required:
- memo
- nodeAddress
- newBondAddress
type: object
AddLiquidityMetadata:
properties:
affiliateAddress:
description: Affiliate fee address of the addLiquidity
type: string
affiliateFee:
description: Int64 (Basis points, 0-1000, where 1000=10%)
type: string
liquidityUnits:
description: 'Int64, amount of liquidity units assigned to the member as result of the liquidity
deposit
'
type: string
memo:
description: Transaction memo of the addLiquidity action
type: string
required:
- liquidityUnits
- memo
- affiliateAddress
- affiliateFee
type: object
Action:
description: action details among with related transactions
properties:
date:
description: Int64, nano timestamp of the block at which the action was registered
type: string
height:
description: Int64, height of the block at which the action was registered
type: string
in:
description: Inbound transactions related to the action
items:
$ref: '#/components/schemas/Transaction'
type: array
metadata:
$ref: '#/components/schemas/Metadata'
out:
description: Outbound transactions related to the action
items:
$ref: '#/components/schemas/Transaction'
type: array
pools:
description: Pools involved in the action
items:
type: string
type: array
status:
description: 'Indicates if the action is completed or if related outbound transactions are still
pending, failed to be processed.
'
enum:
- success
- pending
- failed
type: string
type:
description: Type of action
enum:
- swap
- addLiquidity
- withdraw
- donate
- refund
- switch
- thorname
- send
- runePoolDeposit
- runePoolWithdraw
type: string
required:
- pools
- type
- status
- in
- out
- date
- height
- metadata
type: object
StreamingSwapMeta:
description: Streaming Metadata associated with the action if it was streaming swap
properties:
count:
description: Int64, Number of swaps events which already happened.
type: string
depositedCoin:
$ref: '#/components/schemas/Coin'
failedSwapReasons:
description: Array of failed swaps reasons in streaming swap.
items:
description: The reason why swap got failed
type: string
type: array
failedSwaps:
description: Array of failed swaps index in streaming swap.
items:
description: Int64, Failed Swap number
type: string
type: array
inCoin:
$ref: '#/components/schemas/Coin'
interval:
description: Int64, Number of blocks between swpas. (Blocks/Swap) E.g. 1 means every block.
type: string
lastHeight:
description: 'Int64, The last blockheight the final swap happened (not outbound). This field will be missing until the final swap happens.
'
type: string
outCoin:
$ref: '#/components/schemas/Coin'
outEstimation:
description: 'Int64, The estimated output based on the first swap block * quantity.
This is the current method quote calculate the estimation.
'
type: string
quantity:
description: 'Int64, Number of swaps which thorchain is planning to execute. Total count at the end might be less.
'
type: string
required:
- count
- quantity
- interval
- lastHeight
- inCoin
- outCoin
- depositedCoin
- outEstimation
type: object
ActionMeta:
description: action query metadata
properties:
nextPageToken:
description: "Int64, The last action event_id that can be used for pagination. \nThis token is needed to be given for next page.\n"
type: string
prevPageToken:
description: 'Int64, The first action event_id that can be used for previous pagination.
This token is needed to be given for previous page.
'
type: string
required:
- nextPageToken
- prevPageToken
type: object
Coins:
items:
$ref: '#/components/schemas/Coin'
type: array
SwapMetadata:
properties:
affiliateAddress:
description: Affiliate fee address of the swap, empty if fee swap
type: string
affiliateFee:
description: Int64 (Basis points, 0-1000, where 1000=10%)
type: string
inPriceUSD:
description: in asset price usd at the first interval
type: string
isStreamingSwap:
description: indicate whether this action was streaming
example: true
type: boolean
liquidityFee:
description: Int64(e8), RUNE amount charged as swap liquidity fee
type: string
memo:
description: Transaction memo of the swap action
type: string
networkFees:
$ref: '#/components/schemas/NetworkFees'
outPriceUSD:
description: out asset price usd at the first interval
type: string
streamingSwapMeta:
$ref: '#/components/schemas/StreamingSwapMeta'
swapSlip:
description: Int64 (Basis points, 0-10000, where 10000=100%), swap slip percentage
type: string
swapTarget:
description: Int64(e8), minimum output amount specified for the swap
type: string
txType:
description: "The type of the transaction given from its Memo.\nType of Transaction: \n\"unknown\", \"add\", \"withdraw\", \"swap\", \"limitOrder\", \"outbound\", \"donate\",\n\"bond\", \"unbond\", \"leave\", \"yggdrasilFund\", \"yggdrasilReturn\", \"reserve\",\n\"refund\", \"migrate\", \"ragnarok\", \"switch\", \"noOp\", \"consolidate\", \"thorname\",\n\"loanOpen\", \"loanRepayment\"\n"
example: loanOpen
type: string
required:
- networkFees
- liquidityFee
- swapSlip
- swapTarget
- affiliateFee
- affiliateAddress
- memo
- isStreamingSwap
- txType
- inPriceUSD
- outPriceUSD
type: object