cardano-web3-js / CW3Types / Account
Class: Account
Defined in: src/core/account.ts:4
Constructors
Constructor
new Account():
Account
Returns
Account
Properties
__config
__config:
AccountConfig
Defined in: src/core/account.ts:6
Methods
exportAccount()
exportAccount():
AccountExportV1
Defined in: src/core/account.ts:229
Export account configuration
Returns
Account configuration
getDecodedXprvKey()
getDecodedXprvKey(
password
):string
Defined in: src/core/account.ts:263
Decode key from encrypted state
Parameters
password
string
Password to decrypt the key
Returns
string
Decoded xprv key
Throws
Error if account is not encrypted or account type is wrong
getDelegation()
getDelegation():
Promise
<AccountDelegation
>
Defined in: src/core/account.ts:315
Returns
Promise
<AccountDelegation
>
getEncodedXprvKey()
getEncodedXprvKey(
password
):string
Defined in: src/core/account.ts:250
Encode key to encrypted state
Parameters
password
string
Password to encrypt the key
Returns
string
Encoded xprv key
Throws
Error if account type is wrong or xprv key is not found
Throws
Error if account is already encrypted
getState()
getState():
Promise
<AccountState
>
Defined in: src/core/account.ts:275
Get account state and update internal state
Returns
Promise
<AccountState
>
Account state
fromAddress()
static
fromAddress(cw3
,address
):Account
Defined in: src/core/account.ts:149
Create a new account from address
Parameters
cw3
CardanoWeb3 instance
address
string
Bech32 address
Returns
Account
Account instance
fromConnector()
static
fromConnector(cw3
,connector
):Promise
<Account
>
Defined in: src/core/account.ts:116
Create a new account from connector
Parameters
cw3
CardanoWeb3 instance
connector
Connector instance
Returns
Promise
<Account
>
Account instance
fromMnemonic()
static
fromMnemonic(cw3
,mnemonic
,password
,accountPath
,addressPath
):Account
Defined in: src/core/account.ts:32
Create a new account from mnemonic
Parameters
cw3
CardanoWeb3 instance
mnemonic
string
24-word mnemonic
password
string
Optional password to encrypt the xprv key
accountPath
Account derivation path (e.g. [1852, 1815, 0])
addressPath
Address derivation path (e.g. [0, 0])
Returns
Account
Account instance
fromXprvKey()
static
fromXprvKey(cw3
,xprvKey
,password
,accountPath
,addressPath
):Account
Defined in: src/core/account.ts:52
Create a new account from xprv key
Parameters
cw3
CardanoWeb3 instance
xprvKey
string
Extended private key
password
string
Optional password to encrypt the xprv key
accountPath
Account derivation path (e.g. [1852, 1815, 0])
addressPath
Address derivation path (e.g. [0, 0])
Returns
Account
Account instance
fromXpubKey()
static
fromXpubKey(cw3
,xpubKey
,addressPath
):Account
Defined in: src/core/account.ts:88
Create a new account from xpub key (limited functionality)
Parameters
cw3
CardanoWeb3 instance
xpubKey
string
Extended public key
addressPath
Address derivation path (e.g. [0, 0])
Returns
Account
Account instance
importAccount()
static
importAccount(cw3
,config
):Account
Defined in: src/core/account.ts:198
Import an account from configuration
Parameters
cw3
CardanoWeb3 instance
config
Account configuration
Returns
Account
Account instance