Namespace: helpers
Enumerations
Variables
BUYER
• Const
BUYER: "buyer"
Defined in
helpers/constants.ts:22
SELLER
• Const
SELLER: "seller"
Defined in
helpers/constants.ts:23
WHO_BUYER
• Const
WHO_BUYER: 1
Defined in
helpers/constants.ts:10
WHO_MARKETPLACE
• Const
WHO_MARKETPLACE: 3
Defined in
helpers/constants.ts:12
WHO_PROTOCOL
• Const
WHO_PROTOCOL: 0
Defined in
helpers/constants.ts:9
WHO_SELLER
• Const
WHO_SELLER: 2
Defined in
helpers/constants.ts:11
ZERO_FEE_VALUE
• Const
ZERO_FEE_VALUE: 0
Defined in
helpers/constants.ts:1
Functions
addressWithYou
▸ addressWithYou(address
, walletAddress
, nonEnsAddress?
): string
Parameters
Name | Type |
---|---|
address | string |
walletAddress | string |
nonEnsAddress? | string |
Returns
string
Defined in
helpers/addressFormat.ts:24
bipsToPercentage
▸ bipsToPercentage(values
): number
[]
convert bips to percentage dividing (/) the value by 100
Parameters
Name | Type |
---|---|
values | number [] | bigint [] |
Returns
number
[]
Defined in
helpers/bipsToPercentage.ts:5
calculateSplit
▸ calculateSplit(group
, walletUserAddress
): bigint
Parameters
Name | Type |
---|---|
group | IGetEscrowData [] |
walletUserAddress | string |
Returns
bigint
Defined in
helpers/calculateSplit.ts:55
countdownChallengePeriod
▸ countdownChallengePeriod(end
): string
Parameters
Name | Type |
---|---|
end | Date |
Returns
string
Defined in
helpers/countdownChallengePeriod.ts:1
displayChallengePeriod
▸ displayChallengePeriod(challengePeriod
, useLongFormat?
): string
Parameters
Name | Type |
---|---|
challengePeriod | number |
useLongFormat? | boolean |
Returns
string
Defined in
helpers/displayChallengePeriod.ts:34
formatAmount
▸ formatAmount(amount
, precision
): string
Parameters
Name | Type |
---|---|
amount | bigint |
precision | number | bigint |
Returns
string
Defined in
helpers/formatAmount.ts:3
formatAmountToUSD
▸ formatAmountToUSD(amount
, exchangeValue
): string
Parameters
Name | Type |
---|---|
amount | string | number | bigint |
exchangeValue | number |
Returns
string
Defined in
helpers/formatAmountToUSD.ts:3
getExchangeRates
▸ getExchangeRates(chainId
, tokensAddresses
): Promise
<IResult
>
Parameters
Name | Type |
---|---|
chainId | bigint |
tokensAddresses | string [] |
Returns
Promise
<IResult
>
Defined in
helpers/getExchangeRates.ts:61
getSplitFromLoggedUser
▸ getSplitFromLoggedUser(«destructured»
, walletUserAddress
): bigint
Parameters
Name | Type |
---|---|
«destructured» | IGetEscrowData |
walletUserAddress | string |
Returns
bigint
Defined in
helpers/calculateSplit.ts:6
groupBy
▸ groupBy<T
, K
>(array
, getKey
): Record
<K
, T
[]>
Type parameters
Name | Type |
---|---|
T | T |
K | extends string | number | symbol |
Parameters
Name | Type |
---|---|
array | T [] |
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
Name | Type |
---|---|
address1 | string |
address2 | string |
Returns
boolean
Defined in
helpers/isSameAddress.ts:8
isValidAddress
▸ isValidAddress(address
): any
Parameters
Name | Type |
---|---|
address | string |
Returns
any
Defined in
helpers/isValidAddress.ts:3
nullOrValue
▸ nullOrValue(value
): any
Parameters
Name | Type |
---|---|
value | any |
Returns
any
Defined in
helpers/nullOrValue.ts:3
parseAmount
▸ parseAmount(amount
, precision
): bigint
Parameters
Name | Type |
---|---|
amount | string |
precision | number | bigint |
Returns
bigint
Defined in
helpers/formatAmount.ts:14
percentageToBips
▸ percentageToBips(values
): number
[]
convert percetage to bips multplying (*) the value by 100
Parameters
Name | Type |
---|---|
values | number [] |
Returns
number
[]
Defined in
helpers/percentageToBips.ts:5
reduceAddress
▸ reduceAddress(address
, ensAddress?
): string
Parameters
Name | Type |
---|---|
address | string |
ensAddress? | string |
Returns
string
Defined in
helpers/addressFormat.ts:4
roundPercentage
▸ roundPercentage(amount
): number
Round a percentage to max 2 decimals. If amount > 100, returns 100 If amount < 0, returns 0
Parameters
Name | Type |
---|---|
amount | number |
Returns
number
Defined in
helpers/roundPercentage.ts:6
tag
▸ tag<tag
>(tagHtmlName
): HTMLElementTagNameMap
[tag
]
Helper to create tags html in declarative way
Type parameters
Name | Type |
---|---|
tag | extends keyof HTMLElementTagNameMap |
Parameters
Name | Type |
---|---|
tagHtmlName | tag |
Returns
HTMLElementTagNameMap
[tag
]
HTMLElementTagNameMap by tag name
Defined in
helpers/tag.ts:5
toDate
▸ toDate(seconds
): Date
convert to date getting the BigInt 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
Name | Type |
---|---|
seconds | number | bigint |
Returns
Date
Defined in
helpers/toDate.ts:13
validateAddresses
▸ validateAddresses(address
): boolean
Parameters
Name | Type |
---|---|
address | ValidAddrsProps |
Returns
boolean
Defined in
helpers/validateAddresses.ts:40
validateParameters
▸ validateParameters(data
): Promise
<validAddrsToken
>
Parameters
Name | Type |
---|---|
data | IValidateProps |
Returns
Promise
<validAddrsToken
>
Defined in
helpers/validateParameters.ts:16