Namespace: utils
@orderly.network/core.utilsTable of contents
Type Aliases
Functions
- base64url
- calculateStringHash
- formatByUnits
- getGlobalObject
- getTimestamp
- isHex
- isHexString
- parseAccountId
- parseBrokerHash
- parseTokenHash
- parseUnits
Type Aliases
SignatureDomain
Ƭ SignatureDomain:Object
Type declaration
Name | Type |
---|---|
chainId | number |
name | string |
verifyingContract | string |
version | string |
Defined in
packages/core/src/utils.ts:12Functions
base64url
▸ base64url(aStr
): string
Parameters
Name | Type |
---|---|
aStr | string |
Returns
string
Defined in
packages/core/src/utils.ts:19calculateStringHash
▸ calculateStringHash(input
): string
Parameters
Name | Type |
---|---|
input | string |
Returns
string
Defined in
packages/core/src/utils.ts:41formatByUnits
▸ formatByUnits(amount
, unit?
): string
Parameters
Name | Type | Default value |
---|---|---|
amount | string | undefined |
unit | number | "ether" | "gwei" | "ether" |
Returns
string
Defined in
packages/core/src/utils.ts:49getGlobalObject
▸ getGlobalObject(): typeofglobalThis
Returns
typeofglobalThis
Defined in
packages/core/src/utils.ts:65getTimestamp
▸ getTimestamp():number
Returns
number
Defined in
packages/core/src/utils.ts:86isHex
▸ isHex(value
): boolean
Parameters
Name | Type |
---|---|
value | string |
Returns
boolean
Defined in
packages/core/src/utils.ts:56isHexString
▸ isHexString(value
): boolean
Parameters
Name | Type |
---|---|
value | string |
Returns
boolean
Defined in
packages/core/src/utils.ts:61parseAccountId
▸ parseAccountId(userAddress
, brokerId
): string
Parameters
Name | Type |
---|---|
userAddress | string |
brokerId | string |
Returns
string
Defined in
packages/core/src/utils.ts:27parseBrokerHash
▸ parseBrokerHash(brokerId
): string
Parameters
Name | Type |
---|---|
brokerId | string |
Returns
string
Defined in
packages/core/src/utils.ts:23parseTokenHash
▸ parseTokenHash(tokenSymbol
): string
Parameters
Name | Type |
---|---|
tokenSymbol | string |
Returns
string
Defined in
packages/core/src/utils.ts:37parseUnits
▸ parseUnits(value
, unit?
): bigint
Converts the //decimal string// %%value%% to a BigInt, assuming
%%unit%% decimal places. The %%unit%% may the number of decimal places
or the name of a unit (e.g. "gwei"
for 9 decimal places).
Parameters
Name | Type |
---|---|
value | string |
unit? | string | Numeric |
Returns
bigint