UNPKG

@bancor/carbon-sdk

Version:

The SDK is a READ-ONLY tool, intended to facilitate working with Carbon contracts. It's a convenient wrapper around our matching algorithm, allowing programs and users get a ready to use transaction data that will allow them to manage strategies and fulfi

43 lines 2.75 kB
import { BigNumber, BigNumberish } from '../utils/numerics'; import { Contracts } from './Contracts'; import { PayableOverrides, PopulatedTransaction } from 'ethers'; import { EncodedOrder, TradeAction } from '../common/types'; /** * Class that composes and populates transactions for trade and strategy management. */ export default class Composer { private _contracts; constructor(contracts: Contracts); /** * * @param {string} sourceToken - The address of the token to be traded. * @param {string} targetToken - The address of the token to be received. * @param {TradeAction[]} tradeActions - The list of trade actions to be executed. * @param {BigNumberish} deadline - The deadline for the trade. * @param {BigNumberish} maxInput - The maximum amount of source token to be traded. * @param {PayableOverrides} overrides - The overrides for the transaction. * @returns {Promise<PopulatedTransaction>} - The populated transaction. */ tradeByTargetAmount(sourceToken: string, targetToken: string, tradeActions: TradeAction[], deadline: BigNumberish, maxInput: BigNumberish, overrides?: PayableOverrides): Promise<PopulatedTransaction>; /** * Populates a transaction to trade a given amount of source token. * @param {string} sourceToken - The address of the token to be traded. * @param {string} targetToken - The address of the token to be received. * @param {TradeAction[]} tradeActions - The list of trade actions to be executed. * @param {BigNumberish} deadline - The deadline for the trade. * @param {BigNumberish} minReturn - The minimum amount of target token to be received. * @param {PayableOverrides} overrides - The overrides for the transaction. * @returns {Promise<PopulatedTransaction>} - The populated transaction. */ tradeBySourceAmount(sourceToken: string, targetToken: string, tradeActions: TradeAction[], deadline: BigNumberish, minReturn: BigNumberish, overrides?: PayableOverrides): Promise<PopulatedTransaction>; createStrategy(token0: string, token1: string, order0: EncodedOrder, order1: EncodedOrder, overrides?: PayableOverrides): Promise<PopulatedTransaction>; batchCreateStrategies(strategies: { token0: string; token1: string; order0: EncodedOrder; order1: EncodedOrder; }[], overrides?: PayableOverrides): Promise<PopulatedTransaction>; deleteStrategy(id: BigNumber): Promise<PopulatedTransaction>; updateStrategy(strategyId: BigNumber, token0: string, token1: string, currentOrders: [EncodedOrder, EncodedOrder], newOrders: [EncodedOrder, EncodedOrder], overrides?: PayableOverrides): Promise<PopulatedTransaction>; } //# sourceMappingURL=Composer.d.ts.map