Skip to main content

Namespace: helpers

Enumerations

Variables

ADDRESS_ZERO

Const ADDRESS_ZERO: any = constants.AddressZero

Defined in

helpers/constants.ts:4


BUYER

Const BUYER: "buyer"

Defined in

helpers/constants.ts:31


CHAIN_ID

Const CHAIN_ID: Object

Type declaration

NameType
arbitrumOnenumber
developmentnumber
goerlinumber

Defined in

helpers/constants.ts:36


ETH_ADDRESS

Const ETH_ADDRESS: any = ADDRESS_ZERO

Defined in

helpers/constants.ts:10


MAX_UINT256

Const MAX_UINT256: any = constants.MaxUint256

Defined in

helpers/constants.ts:5


ONE_DAY_IN_SEC

Const ONE_DAY_IN_SEC: 86400

Defined in

helpers/constants.ts:6


SELLER

Const SELLER: "seller"

Defined in

helpers/constants.ts:32


WHO_BUYER

Const WHO_BUYER: 1

Defined in

helpers/constants.ts:19


WHO_MARKETPLACE

Const WHO_MARKETPLACE: 3

Defined in

helpers/constants.ts:21


WHO_PROTOCOL

Const WHO_PROTOCOL: 0

Defined in

helpers/constants.ts:18


WHO_SELLER

Const WHO_SELLER: 2

Defined in

helpers/constants.ts:20


ZERO

Const ZERO: any

Defined in

helpers/constants.ts:34


ZERO_FEE_VALUE

Const ZERO_FEE_VALUE: 0

Defined in

helpers/constants.ts:8


metamaskUrl

Const metamaskUrl: "https://metamask.io/download/"

Defined in

helpers/constants.ts:42

Functions

addressWithYou

addressWithYou(address, currentUserAddress, nonEnsAddress?): string

Parameters

NameType
addressstring
currentUserAddressstring
nonEnsAddress?string

Returns

string

Defined in

helpers/addressFormat.ts:24


bipsToPercentage

bipsToPercentage(values): number[]

convert bips to percentage dividing (/) the value by 100

Parameters

NameType
valuesnumber[]

Returns

number[]

Defined in

helpers/bipsToPercentage.ts:5


calculateSplit

calculateSplit(group, walletUserAddress): any

Parameters

NameType
groupIGetEscrowData[]
walletUserAddressstring

Returns

any

Defined in

helpers/calculateSplit.ts:56


checkBalance

checkBalance(balance, amount): void

Parameters

NameType
balanceBigNumber
amountBigNumber

Returns

void

Defined in

helpers/checkBalance.ts:3


countdownChallengePeriod

countdownChallengePeriod(end): string

Parameters

NameType
endDate

Returns

string

Defined in

helpers/countdownChallengePeriod.ts:1


displayChallengePeriod

displayChallengePeriod(challengePeriod): string

Parameters

NameType
challengePeriodnumber

Returns

string

Defined in

helpers/displayChallengePeriod.ts:34


displayDecimals

displayDecimals(tokenSymbol): 2 | 4

Parameters

NameType
tokenSymbolstring

Returns

2 | 4

Defined in

helpers/displayAmount.ts:24


displayableAmount

displayableAmount(amount, tokenPrecision): any

Parameters

NameType
amountBigNumberJs
tokenPrecisionnumber

Returns

any

Defined in

helpers/displayAmount.ts:10


displayableAmountBN

displayableAmountBN(amount, tokenPrecision): any

Parameters

NameType
amountBigNumberJs
tokenPrecisionnumber

Returns

any

Defined in

helpers/displayAmount.ts:17


formatAmount

formatAmount(amount, precision, symbol): string

Parameters

NameType
amountany
precisionnumber
symbolstring

Returns

string

Defined in

helpers/formatAmount.ts:4


formatAmountToUSD

formatAmountToUSD(amount, exchangeValue): string

Parameters

NameType
amountany
exchangeValuenumber

Returns

string

Defined in

helpers/formatAmountToUSD.ts:4


getExchangeRates

getExchangeRates(tokensSymbols): Promise<IResult>

Parameters

NameType
tokensSymbolsstring[]

Returns

Promise<IResult>

Defined in

helpers/getExchangeRates.ts:31


getSplitFromLoggedUser

getSplitFromLoggedUser(__namedParameters, walletUserAddress): number

Parameters

NameType
__namedParametersIGetEscrowData
walletUserAddressstring

Returns

number

Defined in

helpers/calculateSplit.ts:7


groupBy

groupBy<T, K>(array, getKey): Record<K, T[]>

Type parameters

NameType
TT
Kextends string | number | symbol

Parameters

NameType
arrayT[]
getKey(item: T) => K

Returns

Record<K, T[]>

Defined in

helpers/groupBy.ts:1


isSameAddress

isSameAddress(address1, address2): boolean

isSameAddress function compares two addresses, if equal returns true otherwise false.

Always use this function to compare addresses, and avoid to call toLowerCase() directly

Parameters

NameType
address1string
address2string

Returns

boolean

Defined in

helpers/isSameAddress.ts:8


isValidAddress

isValidAddress(address): any

Parameters

NameType
addressstring

Returns

any

Defined in

helpers/isValidAddress.ts:3


nullOrValue

nullOrValue(value): any

Parameters

NameType
valueany

Returns

any

Defined in

helpers/nullOrValue.ts:3


parse

parse(value, decimals): any

Parameters

NameType
valueany
decimalsnumber

Returns

any

Defined in

helpers/toBigNumber.ts:4


percentageToBips

percentageToBips(values): number[]

convert percetage to bips multplying (*) the value by 100

Parameters

NameType
valuesnumber[]

Returns

number[]

Defined in

helpers/percentageToBips.ts:5


reduceAddress

reduceAddress(address, ensAddress?): string

Parameters

NameType
addressstring
ensAddress?string

Returns

string

Defined in

helpers/addressFormat.ts:4


tag

tag<tag>(tagHtmlName): HTMLElementTagNameMap[tag]

Helper to create tags html in declarative way

Type parameters

NameType
tagextends keyof HTMLElementTagNameMap

Parameters

NameType
tagHtmlNametag

Returns

HTMLElementTagNameMap[tag]

HTMLElementTagNameMap by tag name

Defined in

helpers/tag.ts:5


toDate

toDate(seconds): Date

convert to date getting the BigNumber timestamp without milliseconds and converting it to date with milliseconds

Every timestamp that come from the blockchain should be passed by this function The blockchain provide the timestamp without the milleseconds.

So the fields: challenge_period_start, challenge_period_end, paid_at, release_at, ...etc_at, should use this function to parse the seconds in valid date.

Parameters

NameType
secondsany

Returns

Date

Defined in

helpers/toDate.ts:15


validateAddress

validateAddress(address): boolean

Parameters

NameType
addressValidAddressProps

Returns

boolean

Defined in

helpers/validateAddress.ts:40


validateParameters

validateParameters(data): Promise<AddressToReturn>

Parameters

NameType
dataIValidateProps

Returns

Promise<AddressToReturn>

Defined in

helpers/validateParameters.ts:16