Truffle Personalities
Alias the default Truffle or Ganache accounts with relatable names.
Behavior
Truffle Personalities will alias n
accounts, where n
is the lesser of the number of accounts provided and the number of names available. The default list of names, in order of assignment, is as follows:
ALICE
BOB
CAROL
DAVID
EVE
FRANK
GRACE
HEIDI
IVAN
JUDY
KATHERINE
LIAM
MICHAEL
NIAJ
OLIVIA
PEGGY
QUENTIN
RICHARD
SYBIL
TRENT
ULYSSES
VICTOR
WENDY
XIMENA
YAAKOV
ZARA
Installation
npm install --save truffle-personalities
Usage
Pass the accounts
array provided to Truffle's contract
function to Truffle Personalities.
const trufflePersonalities = ; ;
Options
An options
object may be passed as the second argument.
Option | Description | Default |
---|---|---|
context |
the object to which aliases are assigned | accounts |
names |
array of names to assign before using the default names | [] |
toLowerCase |
boolean describing whether to convert names to lower case rather than to upper case | false |
Examples
Pass a list of custom names to override the defaults. This example proposes the use of NOLAN
as "nobody", or an uninvolved third party, and OWEN
as a contract's owner.
; accountsNOLAN === undefined;// => true accountsnolan === accounts0;// => true accountsowen === accounts1;// => true accountsalice === accounts2;// => true
Pass the global
object as the context
option in order to access the aliased addresses as standalone variables.
; accountsALICE === undefined;// => true ALICE === accounts0;// => true