Skip to content

Latest commit

 

History

History
358 lines (222 loc) · 6.73 KB

README.md

File metadata and controls

358 lines (222 loc) · 6.73 KB

@psychedelic/sonic-js

Table of contents

Classes

Namespaces

Type Aliases

Interfaces

Variables

Functions

Type Aliases

CheckIfOptions

Ƭ CheckIfOptions: Object

Type declaration

Name Type
isNegative? boolean
isNotANumber? boolean
isZero? boolean

SwapActor

Ƭ SwapActor: Actor<Swap>


TokenActor

Ƭ TokenActor: Actor<Token>

Variables

Default

Const Default: Object

Type declaration

Name Type
ENV string
IC_HOST string
SLIPPAGE number
SWAP_CANISTER_ID string

Functions

checkIfObject

checkIfObject(object, options): boolean

Parameters

Name Type Description
object Object -
options CheckIfOptions

Returns

boolean


createSwapActor

createSwapActor(options?): Promise<SwapActor>

Parameters

Name Type Description
options CreateSwapActorOptions

Returns

Promise<SwapActor>


createTokenActor

createTokenActor(options): Promise<TokenActor>

Parameters

Name Type Description
options CreateTokenActorOptions

Returns

Promise<TokenActor>


deserialize

deserialize<T>(jsonString): undefined | T

Type parameters

Name Type
T any

Parameters

Name Type Description
jsonString string

Returns

undefined | T


findMaximalPaths

findMaximalPaths(pairList, tokenList, source, initialAmount): NodeList

Parameters

Name Type
pairList List
tokenList MetadataList
source string
initialAmount BigNumber

Returns

NodeList


findReverseMaximalPaths

findReverseMaximalPaths(pairList, tokenList, source, initialAmount): NodeList

Parameters

Name Type
pairList List
tokenList MetadataList
source string
initialAmount BigNumber

Returns

NodeList


formatAmount

formatAmount(amount): string

Parameters

Name Type
amount string

Returns

string


getDeadline

getDeadline(): bigint

Returns

bigint


parseAllPairs

parseAllPairs(response): List

Parameters

Name Type Description
response PairInfoExt[]

Returns

List


parseSupportedTokenList

parseSupportedTokenList(response): MetadataList

Parameters

Name Type Description
response TokenInfoExt[]

Returns

MetadataList


parseUserLPBalances

parseUserLPBalances(response): Balances

Parameters

Name Type Description
response [string, bigint][]

Returns

Balances


removeEmptyPairs

removeEmptyPairs(pairList): List

Parameters

Name Type
pairList List

Returns

List


serialize

serialize<T>(data): string

Type parameters

Name
T

Parameters

Name Type Description
data T

Returns

string


toBigNumber

toBigNumber(num?, options?): BigNumber

Parameters

Name Type
num? Number
options? ToBigNumberOptions

Returns

BigNumber


toExponential

toExponential(decimals): BigNumber

Parameters

Name Type
decimals Number

Returns

BigNumber