An Account is a user or an organization on Valist that can publish their own projects. An account can be used for an individual, team or an organization. Accounts are used interchangeably for Teams or Personal accounts on Valist.
Account IDs
An accountID is the unique identifier Valist's smart contracts use to identify accounts. It is the keccak256 hash of the Chain ID concatenated by the Account Name.
Generate ID Function
The generate ID function generates an ID for an account.
1
exportfunctiongenerateID(
2
parentID: ethers.BigNumberish,
3
name: string
4
): string
Copied!
Parameters
Type
Description
ParentID
BigNumber
The parentID.
β
If you're generating an account ID, this is the chain ID which the account belongs to.
If you're generating a project ID, this is the account ID.
If you're generating a release ID, this is the project ID.
Name
String
The name of the account, project, or release. Also used as a parameter in the createAccount method.
Account Metadata
The SDK exposes the account metadata class to provide an interface for the data keys associated with an account.
1
// Class for account metadata
2
β
3
exportclassAccountMeta{
4
/** account image */
5
public image?: string;
6
/** account friendly name. */
7
public name?: string;
8
/** short description of the account. */
9
public description?: string;
10
/** link to the account website. */
11
public external_url?: string;
12
}
Copied!
The Valist client class has the following public methods interacting with accounts.
Account Methods
Create Account Method
This method creates an account on Valist. It takes in the name, account metadata and the list of members as parameters.
1
asynccreateAccount(
2
name: string,
3
meta: AccountMeta,
4
members: string[]
5
): Promise<TransactionResponse>
Copied!
Parameters
Type
Description
name
string
Desired name of the account. Also used to generate the accountID.
meta
AccountMeta
Metadata associated with the account. (Can be updated)
members
array<string>
List of addresses that are will control this account.
AccountExists method Readonly
This method checks if an account exists on the Valist Registry on IPFS
1
asyncaccountExists(
2
accountID: ethers.BigNumberish
3
): Promise<boolean>
Copied!
Parameter
Type
Description
accountID
BigNumber
accountId
GetAccountMeta Method Readonly
This method returns the metadata associated with the account.