Orderly network core.Account
Orderly SDKs / Modules / @orderly.network/core / Account
Class: Account
@orderly.network/core.Account
Account
Example
Table of contents
Constructors
Properties
- _ee
- _singer
- _state
- assetsManager
- configStore
- contractManger
- getWalletAdapter
- keyStore
- walletClient
- instanceName
Accessors
Methods
- _bindEvents
- _checkAccount
- _checkAccountExist
- _checkOrderlyKeyState
- _getAccountInfo
- _getRegisterationNonce
- _getSettleNonce
- _getTimestampFromServer
- _simpleFetch
- createAccount
- createOrderlyKey
- disconnect
- getDomain
- logout
- parseChainId
- setAddress
- settle
- signTypedData
- switchChainId
Constructors
constructor
• new Account(configStore
, keyStore
, getWalletAdapter
, options?
)
Parameters
Name | Type |
---|---|
configStore | ConfigStore |
keyStore | OrderlyKeyStore |
getWalletAdapter | getWalletAdapterFunc |
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
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
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
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
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
Name | Type |
---|---|
T | extends string | symbol |
Parameters
Name | Type |
---|---|
event | T |
fn | (…args : any []) => void |
context? | any |
Returns
EventEmitter
<string
| symbol
, any
>
Defined in
packages/core/src/account.ts:673
signer
• get
signer(): Signer
Returns
Defined in
packages/core/src/account.ts:576
stateValue
• get
stateValue(): AccountState
Returns
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
Name | Type |
---|---|
address | string |
Returns
Promise
<AccountStatusEnum
>
Defined in
packages/core/src/account.ts:226
_checkAccountExist
▸ Private
_checkAccountExist(address
): Promise
<null
| { account_id
: string
; user_id
: string
}>
Parameters
Name | Type |
---|---|
address | string |
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
Name | Type |
---|---|
accountId | string |
orderlyKey | string |
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
Name | Type |
---|---|
url | string |
init | RequestInit |
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
Name | Type |
---|---|
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
Name | Type |
---|---|
onChainDomain? | boolean |
Returns
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
Name | Type |
---|---|
chainId | string | number |
Returns
number
Defined in
packages/core/src/account.ts:554
setAddress
▸ setAddress(address
, wallet?
): Promise
<AccountStatusEnum
>
Parameters
Name | Type |
---|---|
address | string |
wallet? | Object |
wallet.chain | Object |
wallet.chain.id | string | number |
wallet.provider | any |
wallet.wallet? | Object |
wallet.wallet.name | string |
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
Name | Type |
---|---|
toSignatureMessage | Record <string , any > |
Returns
Promise
<string
>
Defined in
packages/core/src/account.ts:396
switchChainId
▸ switchChainId(chainId
): void
Parameters
Name | Type |
---|---|
chainId | string | number |
Returns
void