> ## Documentation Index
> Fetch the complete documentation index at: https://staging-docs.orderly.network/llms.txt
> Use this file to discover all available pages before exploring further.

# Orderly network core.utils

[Orderly SDKs](/sdks/tech-doc/README.md) / [Modules](/sdks/tech-doc/modules.md) / [@orderly.network/core](/sdks/tech-doc/modules/orderly_network_core.md) / utils

# Namespace: utils

[@orderly.network/core](/sdks/tech-doc/modules/orderly_network_core.md).utils

## Table of contents

### Type Aliases

* [SignatureDomain](/sdks/tech-doc/modules/orderly_network_core.utils.md#signaturedomain)

### Functions

* [base64url](/sdks/tech-doc/modules/orderly_network_core.utils.md#base64url)
* [calculateStringHash](/sdks/tech-doc/modules/orderly_network_core.utils.md#calculatestringhash)
* [formatByUnits](/sdks/tech-doc/modules/orderly_network_core.utils.md#formatbyunits)
* [getGlobalObject](/sdks/tech-doc/modules/orderly_network_core.utils.md#getglobalobject)
* [getTimestamp](/sdks/tech-doc/modules/orderly_network_core.utils.md#gettimestamp)
* [isHex](/sdks/tech-doc/modules/orderly_network_core.utils.md#ishex)
* [isHexString](/sdks/tech-doc/modules/orderly_network_core.utils.md#ishexstring)
* [parseAccountId](/sdks/tech-doc/modules/orderly_network_core.utils.md#parseaccountid)
* [parseBrokerHash](/sdks/tech-doc/modules/orderly_network_core.utils.md#parsebrokerhash)
* [parseTokenHash](/sdks/tech-doc/modules/orderly_network_core.utils.md#parsetokenhash)
* [parseUnits](/sdks/tech-doc/modules/orderly_network_core.utils.md#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:12](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/core/src/utils.ts#L12)

## Functions

### base64url

▸ **base64url**(`aStr`): `string`

#### Parameters

| Name | Type |
| :- | :- |
| `aStr` | `string` |

#### Returns

`string`

#### Defined in

[packages/core/src/utils.ts:19](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/core/src/utils.ts#L19)

***

### calculateStringHash

▸ **calculateStringHash**(`input`): `string`

#### Parameters

| Name | Type |
| :- | :- |
| `input` | `string` |

#### Returns

`string`

#### Defined in

[packages/core/src/utils.ts:41](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/core/src/utils.ts#L41)

***

### formatByUnits

▸ **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:49](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/core/src/utils.ts#L49)

***

### getGlobalObject

▸ **getGlobalObject**(): typeof `globalThis`

#### Returns

typeof `globalThis`

#### Defined in

[packages/core/src/utils.ts:65](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/core/src/utils.ts#L65)

***

### getTimestamp

▸ **getTimestamp**(): `number`

#### Returns

`number`

#### Defined in

[packages/core/src/utils.ts:86](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/core/src/utils.ts#L86)

***

### isHex

▸ **isHex**(`value`): `boolean`

#### Parameters

| Name | Type |
| :- | :- |
| `value` | `string` |

#### Returns

`boolean`

#### Defined in

[packages/core/src/utils.ts:56](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/core/src/utils.ts#L56)

***

### isHexString

▸ **isHexString**(`value`): `boolean`

#### Parameters

| Name | Type |
| :- | :- |
| `value` | `string` |

#### Returns

`boolean`

#### Defined in

[packages/core/src/utils.ts:61](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/core/src/utils.ts#L61)

***

### parseAccountId

▸ **parseAccountId**(`userAddress`, `brokerId`): `string`

#### Parameters

| Name | Type |
| :- | :- |
| `userAddress` | `string` |
| `brokerId` | `string` |

#### Returns

`string`

#### Defined in

[packages/core/src/utils.ts:27](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/core/src/utils.ts#L27)

***

### parseBrokerHash

▸ **parseBrokerHash**(`brokerId`): `string`

#### Parameters

| Name | Type |
| :- | :- |
| `brokerId` | `string` |

#### Returns

`string`

#### Defined in

[packages/core/src/utils.ts:23](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/core/src/utils.ts#L23)

***

### parseTokenHash

▸ **parseTokenHash**(`tokenSymbol`): `string`

#### Parameters

| Name | Type |
| :- | :- |
| `tokenSymbol` | `string` |

#### Returns

`string`

#### Defined in

[packages/core/src/utils.ts:37](https://github.com/OrderlyNetwork/js-sdk/blob/ba995f2/packages/core/src/utils.ts#L37)

***

### parseUnits

▸ **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`

#### Defined in

node\_modules/.pnpm/ethers\@6.12.1/node\_modules/ethers/lib.commonjs/utils/units.d.ts:14


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.