Skip to Content

@cfxdevkit/core


@cfxdevkit/core / deriveAccount

Function: deriveAccount()

deriveAccount(mnemonic, index, coreNetworkId?, accountType?): DerivedAccount

Defined in: packages/core/src/wallet/derivation.ts:213

Derive a single account at a specific index

Convenience function for deriving just one account.

Parameters

mnemonic

string

BIP-39 mnemonic phrase

index

number

Account index to derive

coreNetworkId?

number = CORE_NETWORK_IDS.LOCAL

Core Space network ID (default: 2029 for local)

accountType?

‘standard’ or ‘mining’ (default: ‘standard’)

"standard" | "mining"

Returns

DerivedAccount

The derived account

Example

const account = deriveAccount(mnemonic, 5); console.log(account.index); // 5