Velar SDK 0.6.9
Installation:
npm i @velarprotocol/velar-sdkVelar SDK Types:
import { ContractPrincipalCV, PostCondition, PostConditionMode, UIntCV } from "@stacks/transactions";
export interface SwapConfig {
account: string;
inToken: string;
outToken: string;
}
export interface ISwapService {
swap(args: SwapPayload): Promise<SwapResponse>;
getComputedAmount(args: ComputedAmountPayload): Promise<number>;
}
enum SwapType {
ONE = 1,
TWO = 2
}
export interface ComputedAmountPayload {
amount: Number;
slippage?: Number;
type?: SwapType;
}
export interface SwapResponse {
contractAddress: string,
contractName: string,
functionName: string,
functionArgs: [
UIntCV, // pool id
ContractPrincipalCV, // pool token0 address
ContractPrincipalCV, // pool token1 address
ContractPrincipalCV, // in token address
ContractPrincipalCV, // out token address
ContractPrincipalCV, // staking contract
UIntCV, // amount in
UIntCV // amount out
],
postConditions: Array<PostCondition>,
postConditionMode: PostConditionMode,
}
export declare class SwapService {
constructor(args: SwapConfig);
swap(args: SwapPayload): Promise<SwapResponse>;
getComputedAmount(args: ComputedAmountPayload): Promise<number>;
}VELAR SDK Interface:
Swap Exact Tokens For Tokens and Multihop:
Swap Tokens For Exact Tokens:
getPairs:
Available tokens:
Pairs:
For more detailed information and additional functions, please refer to the npm library here.
Last updated
Was this helpful?

