Managing Accounts
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
export function generateID(
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
export class AccountMeta {
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
async createAccount(
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
async accountExists(
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.
1
async getAccountMeta(
2
accountID: ethers.BigNumberish
3
): Promise<AccountMeta>
Copied!
Parameter
Type
Description
accountID
BigNumber
The accountID for the account

setAccountMeta Method

Resets the metadata for an existing account.
1
async setAccountMeta(
2
accountID: ethers.BigNumberish,
3
meta: AccountMeta
4
): Promise<TransactionResponse>
Copied!
Parameter
Type
Description
accountID
BigNumber
The accountID for the account
meta
​AccountMeta​
Updated metadata class for the account.

addAccountMember Method

An account can be used interchangeably as teams. Teams can add or remove members for an account. Add account member adds an address to the account.
1
async addAccountMember(
2
accountID: ethers.BigNumberish,
3
address: string
4
): Promise<TransactionResponse>
Copied!
Parameter
Type
Description
accountID
BigNumber
The accountID for the account to add to.
address
string
Address to add.

removeAccountMember

Removes an address form the account.
1
async removeAccountMember(
2
accountID: ethers.BigNumberish,
3
address: string
4
): Promise<TransactionResponse>
Copied!
Parameter
Type
Description
accountID
BigNumber
The accountID for the account to remove from.
address
string
Address to remove.
​

getAccountMembers Method ReadOnly

Returns the list of members of the account.
1
async getAccountMembers(
2
accountID: ethers.BigNumberish
3
): Promise<string[]>
Copied!
Parameter
Type
Description
accountID
BigNumber
The accountID for the account.

isAccountMember Method ReadOnly

Checks if a particular address is a member of an account.
1
async isAccountMember(
2
accountID: ethers.BigNumberish,
3
address: string
4
): Promise<boolean>
Copied!
Parameter
Type
Description
accountID
BigNumber
The accountID for the account.
address
string
Address of the member
​
Export as PDF
Copy link