Skip to main content

Swap

Imported types#

Token#

type Token {
chainId: ChainId!
address: String!
currency: Currency!
}

TradeOptions#

type TradeOptions {
allowedSlippage: String!
recipient: String!
unixTimestamp: UInt64!
ttl: UInt32
deadline: UInt32
feeOnTransfer: Boolean
}

TradeType#

enum TradeType {
EXACT_INPUT
EXACT_OUTPUT
}

TxOverrides#

type TxOverrides {
gasPrice: BigInt
gasLimit: BigInt
}

ChainId#

enum ChainId {
MAINNET
ROPSTEN
RINKEBY
GOERLI
KOVAN
}

Mutation schemas#

swap#

Select token in and token out and amount for the swap.

swap (
tokenIn: Token!
tokenOut: Token!
amount: BigInt!
tradeType: TradeType!
tradeOptions: TradeOptions!
txOverrides: TxOverrides
): Ethereum_TxReceipt!

exec#

Executes the rade.

exec(
trade: Trade!
tradeOptions: TradeOptions!
txOverrides: TxOverrides
): Ethereum_TxReceipt!

execCall#

Executes swap given swap parameters and chain ID.

execCall(
parameters: SwapParameters!
chainId: ChainId!
txOverrides: TxOverrides
): Ethereum_TxReceipt!

approve#

Approves tokens in the swap.

approve(
token: Token!
amount: BigInt
txOverrides: TxOverrides
): Ethereum_TxReceipt!