Hallswap API
Hallswap API allows developers to access liquidity on Hallswap supported chains. Supported chains: Injective, Sei, Archway, Oraichain, Neutron, Terra, Migaloo, Chihuahua
Simulate Swap
GET
https://swap.coinhall.org/v1/swap
Simulates and returns the most optimal swap route between any two tokens within a chain. This simulation may route across multiple different pools to maximise returns, and is the same API that the coinhall.org website uses.
Request Query Parameters
chainId
: the chain ID that you wish to swap on. Supported chain IDs include:injective-1
pacific-1
archway-1
Oraichain
neutron-1
phoenix-1
migaloo-1
chihuahua-1
from
: the denom or contract address of the asset that is being soldto
: the denom or contract address of the asset that is being boughtamount
: the on-chain amount offrom
(ie. must NOT be a floating point number)slippageBps
: the slippage in basis points (ie.50
represents 0.5% slippage)
Responses
Returns a JSON with the following fields:
returnAmount
: the expected on-chain amount ofto
that the caller can expect from executing the swapminimumReceive
: the minimum on-chain amount ofto
that the swap must output for the tx to succeed (this is calculated using the givenslippageBps
)contractInput
: an object containing the input to the Hallswap contract with the following fields (note that this field is meant to be used as is - check out the examples below):address
: the address of the smart contract to run theexecuteMsg
executeMsg
: the JSON containing the execute messagefunds
: an array of objects with the following fields:denom
: the denom of the asset to send for the swapamount
: the on-chain amount ofdenom
to send for the swap
route
: an array of objects with the following fields:returnAsset
: an object containing the following fields:symbol
: the symbol of the asset that you get from the swapicon
: the icon of the asset that you get from the swap
dex
: the dex that the swap is executed on
Such a response can be expected if:
chainId
is invalidfrom
orto
does not existfrom
is equal toto
amount
is negativeslippageBps
is bigger than10000
No routes are found
Examples
Note that this example uses TypeScript and the CosmES package, but can also be adapted fairly easily to cosm.js or feather.js should you prefer to use them.
Annex: Type Definitions
Annex: Contract Addresses
Hallswap Router Contract (Mainnet)
Injective:
inj16lkekzp36vj6a9zjl778a2s5nd9f6ft67w2e90
Sei:
sei1w5t009q9zr8ky8v84sx9n4r9m6ss9ge7xfkuc6xrh479fjg4qmysrqk4lq
Archway:
archway1tjg47350zpgskprjmcm6chuytnx3q893mru8fqg8jakkw2cjwt5s2unkar
Oraichain:
orai1wl3kn5lx6mf67pqmlefus7ge9wj57e3jyp39mzrhwa4hs00q6e9sp3044z
Neutron:
neutron12k4hr2ecm3c8mjjsn6dc9c043xv8p7v4795qt9g2dwp4nmmlgxdqvz2ujp
Terra:
terra1e3nqr8vwu32pzgasraud9avpwdd8phmqgre5kpwlytgedj2emkkq3l67hy
Migaloo:
migaloo10l2nactp2af8uw3xupgmmpsng85fngguk5jj0qy57vc3lfllan9sarp6hf
Chihuahua:
chihuahua1w029h820yzthj3kqfvv6dzd6h84ys26uxg6x0zd3zmc93kutqe9qrwgsn7
Last updated