Module for managing Fennel accounts for Whiteflag
- Source:
Methods
(inner) createAccount(seedopt) → {Promise}
Creates a new Fennel blockchain account
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
seed |
string |
<optional> |
hexadecimal encoded secret seed |
- Source:
Returns:
resolves to newly created account
- Type
- Promise
(inner) deleteAccount(address) → {Promise}
Deletes Fennel blockchain account
Parameters:
| Name | Type | Description |
|---|---|---|
address |
string | the address of the account to be deleted |
- Source:
Returns:
resolves to updated account
- Type
- Promise
(inner) getAccount(address) → {Promise}
Gets Fennel account from the blockchain state by address
Parameters:
| Name | Type | Description |
|---|---|---|
address |
string | the account address |
- Source:
Returns:
resolves to the requested account
- Type
- Promise
(inner) getAddress(fnlPublicKey) → {string}
Derives a Fennel address from a public key
Parameters:
| Name | Type | Description |
|---|---|---|
fnlPublicKey |
string | a hexadecimal encoded public key |
- Source:
Returns:
the Fennel address
- Type
- string
(inner) getKeypair(publicKey, secretKey) → {Promise}
Gets a Polkadot keypair from hexadecimal keys
Parameters:
| Name | Type | Description |
|---|---|---|
publicKey |
string | the hexadecimal public key |
secretKey |
string | the hexadecimal private key |
- Source:
Returns:
resolves to a keypair
- Type
- Promise
(inner) getKeyring(address) → {Promise}
Gets a Polkadot keyring from an address
Parameters:
| Name | Type | Description |
|---|---|---|
address |
string | the address of the account used to sign |
- Source:
Returns:
resolves to a keyring
- Type
- Promise
(inner) getPublicKey(fnlAddress) → {string}
Derives a public key from a Fennel address
Parameters:
| Name | Type | Description |
|---|---|---|
fnlAddress |
string | a Fennel address |
- Source:
Returns:
the hexadecimal encoded public key
- Type
- string
(inner) getSignature(input, address) → {Promise}
Signs an arbitrary input with an account's private key
Parameters:
| Name | Type | Description |
|---|---|---|
input |
string | the input to be signed |
address |
string | the address of the account used to sign |
- Source:
Returns:
resolves to the hexadecmial encoded signature
- Type
- Promise
(inner) initAccounts(fnlConfig, fnlState, fnlApi) → {Promise}
Initialises Fennel accounts management
Parameters:
| Name | Type | Description |
|---|---|---|
fnlConfig |
Object | the Fennel blockchain configuration |
fnlState |
Object | the Fennel blockchain state |
fnlApi |
Object | the Fennel API instance |
- Source:
Returns:
resolves if succesfully initialised
- Type
- Promise
(inner) updateAccount(account) → {Promise}
Updates Fennel blockchain account attributes
Parameters:
| Name | Type | Description |
|---|---|---|
account |
wfAccount | the account information including address to be updated |
- Source:
Returns:
resolves to updated account
- Type
- Promise
(inner) verifySignature(input, signature, publicKey) → {Promise}
Verifies if the signature is valid for the arbitrary input and address
Parameters:
| Name | Type | Description |
|---|---|---|
input |
string | the input that has been signed |
signature |
string | the hexadecmial encoded signature to be verified |
publicKey |
string | the hexadecmial encoded public key of the signature |
- Source:
Returns:
resoilves if signature is valid
- Type
- Promise