Orderly SDKs / Modules / @orderly.network/core / Account

Class: Account

@orderly.network/core.Account

Account

Example

const account = new Account();
account.login("0x1234567890");

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Account(configStore, keyStore, getWalletAdapter, options?)

Parameters

NameType
configStoreConfigStore
keyStoreOrderlyKeyStore
getWalletAdaptergetWalletAdapterFunc
options?Partial<{ contracts: IContract }>

Defined in

packages/core/src/account.ts:88

Properties

_ee

Private _ee: EventEmitter<string | symbol, any>

Defined in

packages/core/src/account.ts:67


_singer

Private Optional _singer: Signer

Defined in

packages/core/src/account.ts:59


_state

Private _state: AccountState

Defined in

packages/core/src/account.ts:71


assetsManager

assetsManager: Assets

Defined in

packages/core/src/account.ts:69


configStore

Private Readonly configStore: ConfigStore

Defined in

packages/core/src/account.ts:89


contractManger

Private Readonly contractManger: IContract

Defined in

packages/core/src/account.ts:80


getWalletAdapter

Private Readonly getWalletAdapter: getWalletAdapterFunc

Defined in

packages/core/src/account.ts:91


keyStore

Readonly keyStore: OrderlyKeyStore

Defined in

packages/core/src/account.ts:90


walletClient

Optional walletClient: WalletAdapter

Defined in

packages/core/src/account.ts:84


instanceName

Static instanceName: string = "account"

Defined in

packages/core/src/account.ts:57

Accessors

accountId

get accountId(): undefined | string

Returns

undefined | string

Defined in

packages/core/src/account.ts:175


accountIdHashStr

get accountIdHashStr(): undefined | string

Returns

undefined | string

Defined in

packages/core/src/account.ts:180


address

get address(): undefined | string

Returns

undefined | string

Defined in

packages/core/src/account.ts:192


chainId

get chainId(): undefined | string | number

Returns

undefined | string | number

Defined in

packages/core/src/account.ts:196


off

get off(): <T>(event: T, fn?: (…args: any[]) => void, context?: any, once?: boolean) => EventEmitter<string | symbol, any>

Returns

fn

▸ <T>(event, fn?, context?, once?): EventEmitter<string | symbol, any>

Type parameters
NameType
Textends string | symbol
Parameters
NameType
eventT
fn?(…args: any[]) => void
context?any
once?boolean
Returns

EventEmitter<string | symbol, any>

Defined in

packages/core/src/account.ts:676


on

get on(): <T>(event: T, fn: (…args: any[]) => void, context?: any) => EventEmitter<string | symbol, any>

Returns

fn

▸ <T>(event, fn, context?): EventEmitter<string | symbol, any>

Add a listener for a given event.

Type parameters
NameType
Textends string | symbol
Parameters
NameType
eventT
fn(…args: any[]) => void
context?any
Returns

EventEmitter<string | symbol, any>

Defined in

packages/core/src/account.ts:670


once

get once(): <T>(event: T, fn: (…args: any[]) => void, context?: any) => EventEmitter<string | symbol, any>

Returns

fn

▸ <T>(event, fn, context?): EventEmitter<string | symbol, any>

Add a one-time listener for a given event.

Type parameters
NameType
Textends string | symbol
Parameters
NameType
eventT
fn(…args: any[]) => void
context?any
Returns

EventEmitter<string | symbol, any>

Defined in

packages/core/src/account.ts:673


signer

get signer(): Signer

Returns

Signer

Defined in

packages/core/src/account.ts:576


stateValue

get stateValue(): AccountState

Returns

AccountState

Defined in

packages/core/src/account.ts:170


wallet

get wallet(): undefined | WalletAdapter

Returns

undefined | WalletAdapter

Defined in

packages/core/src/account.ts:584

Methods

_bindEvents

Private _bindEvents(): void

set user positions count

Returns

void

Defined in

packages/core/src/account.ts:219


_checkAccount

Private _checkAccount(address): Promise<AccountStatusEnum>

Parameters

NameType
addressstring

Returns

Promise<AccountStatusEnum>

Defined in

packages/core/src/account.ts:226


_checkAccountExist

Private _checkAccountExist(address): Promise<null | { account_id: string ; user_id: string }>

Parameters

NameType
addressstring

Returns

Promise<null | { account_id: string ; user_id: string }>

Defined in

packages/core/src/account.ts:330


_checkOrderlyKeyState

Private _checkOrderlyKeyState(accountId, orderlyKey): Promise<any>

Parameters

NameType
accountIdstring
orderlyKeystring

Returns

Promise<any>

Defined in

packages/core/src/account.ts:564


_getAccountInfo

Private _getAccountInfo(): Promise<any>

Returns

Promise<any>

Defined in

packages/core/src/account.ts:615


_getRegisterationNonce

Private _getRegisterationNonce(): Promise<{ nonce: any = res.data.registration_nonce; timestamp: any = res.timestamp }>

Returns

Promise<{ nonce: any = res.data.registration_nonce; timestamp: any = res.timestamp }>

Defined in

packages/core/src/account.ts:588


_getSettleNonce

Private _getSettleNonce(): Promise<any>

Returns

Promise<any>

Defined in

packages/core/src/account.ts:623


_getTimestampFromServer

Private _getTimestampFromServer(): Promise<any>

Returns

Promise<any>

Defined in

packages/core/src/account.ts:605


_simpleFetch

Private _simpleFetch(url, init?): Promise<any>

Parameters

NameType
urlstring
initRequestInit

Returns

Promise<any>

Defined in

packages/core/src/account.ts:648


createAccount

createAccount(): Promise<any>

Returns

Promise<any>

Defined in

packages/core/src/account.ts:344


createOrderlyKey

createOrderlyKey(expiration?): Promise<any>

Parameters

NameType
expiration?number

Returns

Promise<any>

Defined in

packages/core/src/account.ts:407


disconnect

disconnect(): Promise<void>

Returns

Promise<void>

Defined in

packages/core/src/account.ts:531


getDomain

getDomain(onChainDomain?): SignatureDomain

Parameters

NameType
onChainDomain?boolean

Returns

SignatureDomain

Defined in

packages/core/src/account.ts:654


logout

logout(): void

Returns

void

Defined in

packages/core/src/account.ts:111


parseChainId

Private parseChainId(chainId): number

Parameters

NameType
chainIdstring | number

Returns

number

Defined in

packages/core/src/account.ts:554


setAddress

setAddress(address, wallet?): Promise<AccountStatusEnum>

Parameters

NameType
addressstring
wallet?Object
wallet.chainObject
wallet.chain.idstring | number
wallet.providerany
wallet.wallet?Object
wallet.wallet.namestring

Returns

Promise<AccountStatusEnum>

Defined in

packages/core/src/account.ts:115


settle

settle(): Promise<any>

Returns

Promise<any>

Defined in

packages/core/src/account.ts:474


signTypedData

signTypedData(toSignatureMessage): Promise<string>

Parameters

NameType
toSignatureMessageRecord<string, any>

Returns

Promise<string>

Defined in

packages/core/src/account.ts:396


switchChainId

switchChainId(chainId): void

Parameters

NameType
chainIdstring | number

Returns

void

Defined in

packages/core/src/account.ts:547