Account

The Account library exposes methods to handle Phantasma accounts.

MethodReturn typeDescription

Account.getName(from:Address)

String

Returns the name of an account associated to the specified address, if any.

Account.getLastActivity(from:Address)

Timestamp

Returns a timestamp of the last known activity of the specified address.

Account.registerName(target:Address, name:String)

None

Registers a name for the specified address. Names must be fit specified rules (TODO write rules here). Must have a stake of at least 2 SOUL.

Account.unregisterName(target:Address)

None

Unregisters a name from an account. After unregistering, the name becomes available to use in other addresses.

Account.registerScript(target:Address, script:Bytes, abiBytes:Bytes)

None

Registers an account script to the specified address. An account script can contain multiple triggers for custom account behaviours.

Account.hasScript(address:Address)

Bool

Returns true if the specified address has an account script registered to it.

Account.lookUpScript(target:Address)

Bytes

Returns the script of an account, if a script is registered.

Account.lookUpABI(target:Address)

Bytes

Returns the ABI of an account script, if a script is registered.

Account.lookUpName(name:String)

Address

Returns the address that registered the specified name, if any.

Account.migrate(from:Address, target:Address)

None

Migrates an account from one address to another. This will migrate everything, including stakes, storage and DAO memberships. Also any other contracts that support account migration will also receive a migration trigger (allowing them migrate data or do other actions).

Last updated