Namespace: helpers
Enumerations
Variables
ADDRESS_ZERO
• Const
ADDRESS_ZERO: any
= ethers.ZeroAddress
Defined in
BUYER
• Const
BUYER: "buyer"
Defined in
CHAIN_ID
• Const
CHAIN_ID: Object
Type declaration
Name | Type |
---|---|
arbitrumOne | bigint |
arbitrumSepolia | bigint |
development | bigint |
mainnet | bigint |
Defined in
ETH_ADDRESS
• Const
ETH_ADDRESS: any
= ADDRESS_ZERO
Defined in
MAX_UINT256
• Const
MAX_UINT256: any
= ethers.MaxUint256
Defined in
ONE_DAY_IN_SEC
• Const
ONE_DAY_IN_SEC: 86400
Defined in
SELLER
• Const
SELLER: "seller"
Defined in
WHO_BUYER
• Const
WHO_BUYER: 1
Defined in
WHO_MARKETPLACE
• Const
WHO_MARKETPLACE: 3
Defined in
WHO_PROTOCOL
• Const
WHO_PROTOCOL: 0
Defined in
WHO_SELLER
• Const
WHO_SELLER: 2
Defined in
ZERO_FEE_VALUE
• Const
ZERO_FEE_VALUE: 0
Defined in
metamaskUrl
• Const
metamaskUrl: "https://metamask.io/download/"
Defined in
Functions
addressWithYou
▸ addressWithYou(address
, walletAddress
, nonEnsAddress?
): string
Parameters
Name | Type |
---|---|
address | string |
walletAddress | string |
nonEnsAddress? | string |
Returns
string
Defined in
bipsToPercentage
▸ bipsToPercentage(values
): number
[]
convert bips to percentage dividing (/) the value by 100
Parameters
Name | Type |
---|---|
values | number [] | bigint [] |
Returns
number
[]
Defined in
calculateSplit
▸ calculateSplit(group
, walletUserAddress
): bigint
Parameters
Name | Type |
---|---|
group | IGetEscrowData [] |
walletUserAddress | string |
Returns
bigint
Defined in
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? | any |
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
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 | number |
tokensAddresses | string [] |
Returns
Promise
<IResult
>
Defined in
helpers/getExchangeRates.ts:69
getSplitFromLoggedUser
▸ getSplitFromLoggedUser(«destructured»
, walletUserAddress
): bigint
Parameters
Name | Type |
---|---|
«destructured» | IGetEscrowData |
walletUserAddress | string |
Returns
bigint
Defined in
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
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
isValidAddress
▸ isValidAddress(address
): any
Parameters
Name | Type |
---|---|
address | string |
Returns
any
Defined in
nullOrValue
▸ nullOrValue(value
): any
Parameters
Name | Type |
---|---|
value | any |
Returns
any
Defined in
parseAmount
▸ parseAmount(amount
, precision
): bigint
Parameters
Name | Type |
---|---|
amount | string |
precision | number | bigint |
Returns
bigint
Defined in
percentageToBips
▸ percentageToBips(values
): number
[]
convert percetage to bips multplying (*) the value by 100
Parameters
Name | Type |
---|---|
values | number [] |
Returns
number
[]
Defined in
reduceAddress
▸ reduceAddress(address
, ensAddress?
): string
Parameters
Name | Type |
---|---|
address | string |
ensAddress? | string |
Returns
string
Defined in
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
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
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
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
>