-
Notifications
You must be signed in to change notification settings - Fork 70
@liquality.utils
- asyncSetImmediate
- compare
- ensure0x
- ensureBuffer
- hash160
- isHex
- padHexStart
- remove0x
- retry
- sha256
- sleep
- toStringDeep
- validateExpiration
- validateSecret
- validateSecretAndHash
- validateSecretHash
- validateValue
▸ asyncSetImmediate(): Promise<unknown>
Promise<unknown>
▸ compare(a, b): boolean
| Name | Type |
|---|---|
a |
BigNumberish |
b |
BigNumberish |
boolean
▸ ensure0x(hash): string
Appends 0x if missing from hex string
| Name | Type |
|---|---|
hash |
string |
string
▸ ensureBuffer(message): false | Buffer
Ensure message is in buffer format.
| Name | Type | Description |
|---|---|---|
message |
any |
any string. |
false | Buffer
Buffer.
▸ hash160(message): string
Get hash160 of message.
| Name | Type | Description |
|---|---|---|
message |
string |
message in string or Buffer. |
string
the hash160 of a string.
▸ isHex(hex): boolean
| Name | Type |
|---|---|
hex |
string |
boolean
▸ padHexStart(hex, lengthBytes?): string
Pad a hex string with '0'
| Name | Type | Description |
|---|---|---|
hex |
string |
The hex string to pad. |
lengthBytes? |
number |
The length of the final string in bytes |
string
a padded string with length greater or equal to the given length rounded up to the nearest even number.
▸ remove0x(hash): string
Removes 0x if it exists in hex string
| Name | Type |
|---|---|
hash |
string |
string
▸ retry<T>(method, startWaitTime?, waitBackoff?, retryNumber?): Promise<T>
| Name |
|---|
T |
| Name | Type | Default value |
|---|---|---|
method |
() => Promise<T> |
undefined |
startWaitTime |
number |
500 |
waitBackoff |
number |
2 |
retryNumber |
number |
5 |
Promise<T>
▸ sha256(data): string
| Name | Type |
|---|---|
data |
string |
string
▸ sleep(ms): Promise<void>
| Name | Type |
|---|---|
ms |
number |
Promise<void>
▸ toStringDeep<I, O>(input): O
| Name |
|---|
I |
O |
| Name | Type |
|---|---|
input |
I |
O
▸ validateExpiration(expiration): void
| Name | Type |
|---|---|
expiration |
number |
void
▸ validateSecret(secret): void
| Name | Type |
|---|---|
secret |
string |
void
▸ validateSecretAndHash(secret, secretHash): void
| Name | Type |
|---|---|
secret |
string |
secretHash |
string |
void
▸ validateSecretHash(secretHash): void
| Name | Type |
|---|---|
secretHash |
string |
void
▸ validateValue(value): void
| Name | Type |
|---|---|
value |
BigNumberish |
void