cardano-web3-js / Account
Class: Account
Constructors
new Account()
new Account():
Account
Returns
Properties
__config
__config:
AccountConfig
Defined in
__state
__state:
AccountState
Defined in
Methods
decodeAndUpdateXprvKey()
decodeAndUpdateXprvKey(
password
):string
Decode key from encrypted state and update internal state
Parameters
• password: string
Password to decrypt the key
Returns
string
Decoded xprv key
Defined in
decodeXprvKey()
decodeXprvKey(
password
):string
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
Defined in
encodeAndUpdateXprvKey()
encodeAndUpdateXprvKey(
password
):string
Encode key to encrypted state and update internal state
Parameters
• password: string
Password to encrypt the key
Returns
string
Encoded xprv key
Defined in
encodeXprvKey()
encodeXprvKey(
password
):string
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
Defined in
exportAccount()
exportAccount():
AccountExportV1
Export account configuration
Returns
Account configuration
Throws
Error if account type is not exportable
Defined in
updateState()
updateState():
Promise
<AccountState
>
Get account state and update internal state
Returns
Promise
<AccountState
>
Account state
Defined in
fromConnector()
static
fromConnector(cw3
,connector
):Promise
<Account
>
Create a new account from connector
Parameters
• cw3: CardanoWeb3
CardanoWeb3 instance
• connector: Connector
Connector instance
Returns
Promise
<Account
>
Account instance
Defined in
fromMnemonic()
static
fromMnemonic(cw3
,mnemonic
,accountPath
,addressPath
):Account
Create a new account from mnemonic
Parameters
• cw3: CardanoWeb3
CardanoWeb3 instance
• mnemonic: string
24-word mnemonic
• accountPath: AccountDerivationPath
Account derivation path (e.g. [1852, 1815, 0])
• addressPath: AddressDerivationPath
Address derivation path (e.g. [0, 0])
Returns
Account instance
Defined in
fromXprvKey()
static
fromXprvKey(cw3
,xprvKey
,accountPath
,addressPath
):Account
Create a new account from xprv key
Parameters
• cw3: CardanoWeb3
CardanoWeb3 instance
• xprvKey: string
Extended private key
• accountPath: AccountDerivationPath
Account derivation path (e.g. [1852, 1815, 0])
• addressPath: AddressDerivationPath
Address derivation path (e.g. [0, 0])
Returns
Account instance
Defined in
fromXpubKey()
static
fromXpubKey(cw3
,xpubKey
,addressPath
):Account
Create a new account from xpub key (limited functionality)
Parameters
• cw3: CardanoWeb3
CardanoWeb3 instance
• xpubKey: string
Extended public key
• addressPath: AddressDerivationPath
Address derivation path (e.g. [0, 0])
Returns
Account instance
Defined in
importAccount()
static
importAccount(cw3
,config
):Account
Import an account from configuration
Parameters
• cw3: CardanoWeb3
CardanoWeb3 instance
• config: AccountExportV1
Account configuration
Returns
Account instance