Connection provider
Wallet provider
Sol Cerberus config options:
{
appId: PublicKey // The ID identifying the Sol Cerberus APP (if empty a random one will be created)
appChangedCallback?: Function // will be called whenever the app has changed
rulesChangedCallback?: Function // will be called whenever a rule has changed
rolesChangedCallback?: Function // will be called whenever a role has changed
permsAutoUpdate?: boolean // Defines if the permissions (rules) should be automatically fetched when they change.
cluster?: ClusterType // Defines the Solana cluster, either: 'devnet', 'testnet' or 'mainnet-beta' (inferred from connection when not provided)
confirmOptions: { //The RPC confirm options:
skipPreflight?: boolean; // Disables transaction verification step
commitment?: Commitment; // Desired commitment level
preflightCommitment?: Commitment; // Preflight commitment level
maxRetries?: number; // Maximum number of times for the RPC node to retry
minContextSlot?: number; //The minimum slot that the request can be evaluated at
}
}
Private
Internal
#appPrivate
Internal
#appPrivate
Internal
#appPrivate
Internal
#appPrivate
Internal
#assignedPrivate
Internal
#clusterPrivate
Internal
#collectionsPrivate
Internal
#permissionsPrivate
Internal
#permsPrivate
Internal
#programPrivate
Internal
#providerPrivate
Internal
#rolesPrivate
Internal
#rulesPrivate
Internal
#walletGenerates the required account PDAs to perform the provided transaction.
The resource trying to
The permission required to access the resource
special settings for fetching accounts: { namespace?: Integer representing the kind of permission. useCPI?: Boolean, defaultAccounts?: Object containing already fetched accounts PDA (to avoid duplicating requests) }
The fetched accounts, for instance:
{
solCerberusApp: app PDA,
solCerberusRule: rule PDA,
solCerberusRole: role PDA,
solCerberusToken: tokenAccount PDA,
solCerberusMetadata: Metaplex PDA,
solCerberusSeed: Seed PDA,
solCerberus: Program PDA,
}
Adds new Permission into the cached perms
Create new Rule/Permission
The role getting the permission, only alphanumeric characters (a-z, A-Z,0-9) and 16 characters max.
The resource in which the permission will have effect
The permission
Settings:
{
namespace: integer // Defines the type of rules: 0: Default rule, 1: AssignRole rule, etc..
expiresAt: Date // The time at which the rule won't be valid anymore
getIx: boolean // Returns the instruction instead of executing the command on Solana's RPC (default false)
confirmOptions: { // The RPC confirm options:
skipPreflight?: boolean; // Disables transaction verification step
commitment?: Commitment; // Desired commitment level
preflightCommitment?: Commitment; // Preflight commitment level
maxRetries?: number; // Maximum number of times for the RPC node to retry
minContextSlot?: number; //The minimum slot that the request can be evaluated at
}
}
Assign a Role to the provided address or to all addresses ("*")
String representing the role to assign, only alphanumeric characters (a-z, A-Z,0-9) and 16 characters max.
Either 'wallet', 'nft' or 'collection'
The Solana address (or wildcard "") to which the role is assigned. The wilcard "" means that role will be applied to everyone.
Settings:
{
expiresAt: Date //The time at which the role won't be valid anymore
getIx: boolean // Returns the instruction instead of executing the command on Solana's RPC (default false)
confirmOptions: { //The RPC confirm options:
skipPreflight?: boolean; // Disables transaction verification step
commitment?: Commitment; // Desired commitment level
preflightCommitment?: Commitment; // Preflight commitment level
maxRetries?: number; // Maximum number of times for the RPC node to retry
minContextSlot?: number; //The minimum slot that the request can be evaluated at
}
}
array of strings containing the addresses (or wildcards "*") used as filters
Retrieves Perms from IDB (When available)
Retrieves Roles from IDB (When available)
Delete Sol Cerberus APP
Settings:
{
collector?: PublicKey // The wallet receiving the funds (defaults to authority)
getIx?: boolean //Returns the instruction instead of executing the command on Solana's RPC
confirmOptions?: { //The RPC confirm options:
skipPreflight?: boolean; // Disables transaction verification step
commitment?: Commitment; // Desired commitment level
preflightCommitment?: Commitment; // Preflight commitment level
maxRetries?: number; // Maximum number of times for the RPC node to retry
minContextSlot?: number; //The minimum slot that the request can be evaluated at
}
}
Delete the Role assigned to the provided address or to wildcard "*" (all addresses)
String: The role name.
Either 'wallet', 'nft' or 'collection'
String | PubKey: The Solana address (or wildcard "*") to which the role is assigned.
Settings:
{
collector?: PublicKey // The wallet receiving the funds (defaults to authority)
getIx?: boolean // Returns the instruction instead of executing the command on Solana's RPC
confirmOptions?: { // The RPC confirm options:
skipPreflight?: boolean; // Disables transaction verification step
commitment?: Commitment; // Desired commitment level
preflightCommitment?: Commitment; // Preflight commitment level
maxRetries?: number; // Maximum number of times for the RPC node to retry
minContextSlot?: number; //The minimum slot that the request can be evaluated at
}
}
Delete Rule/Permission
The role name
The resource name
The permission name
Settings:
{
namespace?: integer // Defines the type of rules: 0: Default rule, 1: AssignRole rule, etc..
collector?: PublicKey // The wallet receiving the funds (defaults to authority)
getIx?: boolean Returns the instruction instead of executing the command on Solana's RPC
confirmOptions?: { // The RPC confirm options:
skipPreflight?: boolean; // Disables transaction verification step
commitment?: Commitment; // Desired commitment level
preflightCommitment?: Commitment; // Preflight commitment level
maxRetries?: number; // Maximum number of times for the RPC node to retry
minContextSlot?: number; //The minimum slot that the request can be evaluated at
}
}
Fetches all roles
special settings for fetching accounts:
{
useCache?: Boolean // Defines if cache should be used or not.
groupBy?: rolesGroupedBy // Either rolesGroupedBy.Role, rolesGroupedBy.Address or rolesGroupedBy.None
}
Roles (format depends on the options.groupBy used)
Fetches all assigned roles for the current program
Program accounts filters: https://solanacookbook.com/guides/get-program-accounts.html#deep-dive
special settings for fetching accounts:
{
useCache?: Boolean // Defines if cache should be used or not.
groupBy?: rolesGroupedBy // Either rolesGroupedBy.Role, rolesGroupedBy.Address or rolesGroupedBy.None
}
Roles (format depends on the options.groupBy used)
Fetches PDA accounts in parallel
Fetches the roles assigned to the provided addresses
Program accounts filters: https://solanacookbook.com/guides/get-program-accounts.html#deep-dive
Finds the first Rule definition matching the provided Role, Resource, Permission and namespace.
Adds NFT fetcher (only needed when using NFT authentication)
Adds NFT fetcher (only needed when using NFT authentication)
Fetched roles
Roles grouped by address, E.G:
{
Ak94...2Uat: {
role1: {
addressType: "nft"
nftMints?: [PublicKey, PublicKey, ..]
expiresAt: 103990020
},
role2: {...}
},
ekB12...tR38: {...}
}
Fetched roles
Addresses grouped by roles
Parse Roles grouping by Role or Address:
Initializes a Sol Cerberus APP
Name to identify the APP
The backup wallet (null for none)
Settings:
{
cached: boolean // Wether the Roles and Permissions should be cached on client side (default true)
getIx: boolean //Returns the instruction instead of executing the command on Solana's RPC (default false)
confirmOptions: { //The RPC confirm options:
skipPreflight?: boolean; // Disables transaction verification step
commitment?: Commitment; // Desired commitment level
preflightCommitment?: Commitment; // Preflight commitment level
maxRetries?: number; // Maximum number of times for the RPC node to retry
minContextSlot?: number; //The minimum slot that the request can be evaluated at
}
}
Subscribes to Sol Cerberus App updates to refresh the app data whenever the APP has been updated.
Subscribes to Sol Cerberus Role assignation updates (only when a callback is defined)
Subscribes to Sol Cerberus Rules updates to refresh permissions
Fetches the roles assigned to the provided address
Defines the login options:
{
wallet: PublicKey // The Public key used for authentication
nfts: [[NFTAddressType, CollectionAddressType], ..] // List containing pairs of NFT mint and his corresponding Collection address.
collectionAddress: PublicKey // The address of the Collection (only required when login via NFT Collection address)
wildcard: boolean // Fetches or not the roles associated to all wallets via wildcard "*" (Default true)
}
Parse Permissions into following mapped format:
{
0: {
role1: {
resource1: {
permission1: {
expiresAt: null;
},
resource2: {...}
},
},
role2: {...}
},
1: {...}
}
Parses Roles into IDB rows with the following format:
{
role: 'TriangleMaster',
address: '*',
addressType: 'wallet',
expiresAt: 1689033410616 // Time in milliseconds
}
Roles accounts fetched from Solana
Executes Add/Delete Role/Rule instructions, updating the corresponding SC APP cache date:
So the users can know when was the last time the Rules/Roles were updated.
RPC method to execute (e.g: addRule, assignRole, etc..)
Either cacheUpdated.Role or cacheUpdated.Rule
Settings:
{
getIx?: boolean Returns the instruction instead of executing the command on Solana's RPC
confirmOptions?: { // The RPC confirm options:
skipPreflight?: boolean; // Disables transaction verification step
commitment?: Commitment; // Desired commitment level
preflightCommitment?: Commitment; // Preflight commitment level
maxRetries?: number; // Maximum number of times for the RPC node to retry
minContextSlot?: number; //The minimum slot that the request can be evaluated at
}
}
string
Set the assigned roles within the instance.
List containing the list of roles corresponding to the provided addresses
Stores Perms on IDB (When available)
Stores Roles on IDB (When available)
Updates a Sol Cerberus APP
Name to identify the APP
The backup wallet (null for none)
Settings:
{
authority: PublicKey // Updates the authority of the Sol Cerberus APP
cached: boolean // Wether the Roles and Permissions should be cached on client side (default true)
getIx: boolean // Returns the instruction instead of executing the command on Solana's RPC (default false)
confirmOptions: { //The RPC confirm options:
skipPreflight?: boolean; // Disables transaction verification step
commitment?: Commitment; // Desired commitment level
preflightCommitment?: Commitment; // Preflight commitment level
maxRetries?: number; // Maximum number of times for the RPC node to retry
minContextSlot?: number; //The minimum slot that the request can be evaluated at
}
}
Returns the first valid (not expired) assigned address
Generated using TypeDoc
Creates Sol Cerberus client