Hierarchy

  • SolCerberus

Constructors

  • Creates Sol Cerberus client

    Parameters

    • connection: Connection

      Connection provider

    • wallet: any

      Wallet provider

    • options: SolCerberusOptionsType = {}

      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
      }
      }

    Returns SolCerberus

Properties

#appData: null | DecodeStruct<{
    fields: [{
        name: "id";
        type: "publicKey";
    }, {
        name: "authority";
        type: "publicKey";
    }, {
        name: "recovery";
        type: {
            option: "publicKey";
        };
    }, {
        name: "bump";
        type: "u8";
    }, {
        name: "name";
        type: "string";
    }, {
        name: "rolesUpdatedAt";
        type: "i64";
    }, {
        name: "rulesUpdatedAt";
        type: "i64";
    }];
    kind: "struct";
}, RecursiveDepth4<[{
    name: "AllowedRule";
    type: {
        fields: [{
            name: "appId";
            type: "publicKey";
        }, {
            name: "namespace";
            type: "u8";
        }, {
            name: "resource";
            type: "string";
        }, {
            name: "permission";
            type: "string";
        }];
        kind: "struct";
    };
}, {
    name: "AppData";
    type: {
        fields: [{
            name: "id";
            type: "publicKey";
        }, {
            name: "recovery";
            type: {
                option: "publicKey";
            };
        }, {
            name: "name";
            type: "string";
        }, {
            name: "cached";
            type: "bool";
        }];
        kind: "struct";
    };
}, {
    name: "UpdateAppData";
    type: {
        fields: [{
            name: "authority";
            type: "publicKey";
        }, {
            name: "recovery";
            type: {
                option: "publicKey";
            };
        }, {
            name: "name";
            type: "string";
        }, {
            name: "cached";
            type: "bool";
        }, {
            name: "fee";
            type: {
                option: "u64";
            };
        }, {
            name: "accountType";
            type: "u8";
        }, {
            name: "expiresAt";
            type: {
                option: "i64";
            };
        }];
        kind: "struct";
    };
}], DecodedHelper<[{
    name: "AllowedRule";
    type: {
        fields: [{
            name: "appId";
            type: "publicKey";
        }, {
            name: "namespace";
            type: "u8";
        }, {
            name: "resource";
            type: "string";
        }, {
            name: "permission";
            type: "string";
        }];
        kind: "struct";
    };
}, {
    name: "AppData";
    type: {
        fields: [{
            name: "id";
            type: "publicKey";
        }, {
            name: "recovery";
            type: {
                option: "publicKey";
            };
        }, {
            name: "name";
            type: "string";
        }, {
            name: "cached";
            type: "bool";
        }];
        kind: "struct";
    };
}, {
    name: "UpdateAppData";
    type: {
        fields: [{
            name: "authority";
            type: "publicKey";
        }, {
            name: "recovery";
            type: {
                option: "publicKey";
            };
        }, {
            name: "name";
            type: "string";
        }, {
            name: "cached";
            type: "bool";
        }, {
            name: "fee";
            type: {
                option: "u64";
            };
        }, {
            name: "accountType";
            type: "u8";
        }, {
            name: "expiresAt";
            type: {
                option: "i64";
            };
        }];
        kind: "struct";
    };
}], DecodedHelper<[{
    name: "AllowedRule";
    type: {
        fields: [{
            name: "appId";
            type: "publicKey";
        }, {
            name: "namespace";
            type: "u8";
        }, {
            name: "resource";
            type: "string";
        }, {
            name: "permission";
            type: "string";
        }];
        kind: "struct";
    };
}, {
    name: "AppData";
    type: {
        fields: [{
            name: "id";
            type: "publicKey";
        }, {
            name: "recovery";
            type: {
                option: "publicKey";
            };
        }, {
            name: "name";
            type: "string";
        }, {
            name: "cached";
            type: "bool";
        }];
        kind: "struct";
    };
}, {
    name: "UpdateAppData";
    type: {
        fields: [{
            name: "authority";
            type: "publicKey";
        }, {
            name: "recovery";
            type: {
                option: "publicKey";
            };
        }, {
            name: "name";
            type: "string";
        }, {
            name: "cached";
            type: "bool";
        }, {
            name: "fee";
            type: {
                option: "u64";
            };
        }, {
            name: "accountType";
            type: "u8";
        }, {
            name: "expiresAt";
            type: {
                option: "i64";
            };
        }];
        kind: "struct";
    };
}], DecodedHelper<[{
    name: "AllowedRule";
    type: {
        fields: [{
            name: "appId";
            type: "publicKey";
        }, {
            name: "namespace";
            type: "u8";
        }, {
            name: "resource";
            type: "string";
        }, {
            name: "permission";
            type: "string";
        }];
        kind: "struct";
    };
}, {
    name: "AppData";
    type: {
        fields: [{
            name: "id";
            type: "publicKey";
        }, {
            name: "recovery";
            type: {
                option: "publicKey";
            };
        }, {
            name: "name";
            type: "string";
        }, {
            name: "cached";
            type: "bool";
        }];
        kind: "struct";
    };
}, {
    name: "UpdateAppData";
    type: {
        fields: [{
            name: "authority";
            type: "publicKey";
        }, {
            name: "recovery";
            type: {
                option: "publicKey";
            };
        }, {
            name: "name";
            type: "string";
        }, {
            name: "cached";
            type: "bool";
        }, {
            name: "fee";
            type: {
                option: "u64";
            };
        }, {
            name: "accountType";
            type: "u8";
        }, {
            name: "expiresAt";
            type: {
                option: "i64";
            };
        }];
        kind: "struct";
    };
}], EmptyDefined>>>>> = null
#appId: PublicKey
#appListener: null | number = null
#appPda: null | PublicKey = null
#assignedRoles: AddressByRoleType = {}
#cluster: ClusterType
#collectionsMints: CollectionsMintsType = {}
#permissions: null | CachedPermsType = null
#permsAutoUpdate: boolean = true
#program: Program<SolCerberusTypes>
#provider: default
#rolesListener: null | number = null
#rulesListener: null | number = null
#wallet: PublicKey

Accessors

  • get appData(): null | DecodeStruct<{
        fields: [{
            name: "id";
            type: "publicKey";
        }, {
            name: "authority";
            type: "publicKey";
        }, {
            name: "recovery";
            type: {
                option: "publicKey";
            };
        }, {
            name: "bump";
            type: "u8";
        }, {
            name: "name";
            type: "string";
        }, {
            name: "rolesUpdatedAt";
            type: "i64";
        }, {
            name: "rulesUpdatedAt";
            type: "i64";
        }];
        kind: "struct";
    }, RecursiveDepth4<[{
        name: "AllowedRule";
        type: {
            fields: [{
                name: "appId";
                type: "publicKey";
            }, {
                name: "namespace";
                type: "u8";
            }, {
                name: "resource";
                type: "string";
            }, {
                name: "permission";
                type: "string";
            }];
            kind: "struct";
        };
    }, {
        name: "AppData";
        type: {
            fields: [{
                name: "id";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }];
            kind: "struct";
        };
    }, {
        name: "UpdateAppData";
        type: {
            fields: [{
                name: "authority";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }, {
                name: "fee";
                type: {
                    option: "u64";
                };
            }, {
                name: "accountType";
                type: "u8";
            }, {
                name: "expiresAt";
                type: {
                    option: "i64";
                };
            }];
            kind: "struct";
        };
    }], DecodedHelper<[{
        name: "AllowedRule";
        type: {
            fields: [{
                name: "appId";
                type: "publicKey";
            }, {
                name: "namespace";
                type: "u8";
            }, {
                name: "resource";
                type: "string";
            }, {
                name: "permission";
                type: "string";
            }];
            kind: "struct";
        };
    }, {
        name: "AppData";
        type: {
            fields: [{
                name: "id";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }];
            kind: "struct";
        };
    }, {
        name: "UpdateAppData";
        type: {
            fields: [{
                name: "authority";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }, {
                name: "fee";
                type: {
                    option: "u64";
                };
            }, {
                name: "accountType";
                type: "u8";
            }, {
                name: "expiresAt";
                type: {
                    option: "i64";
                };
            }];
            kind: "struct";
        };
    }], DecodedHelper<[{
        name: "AllowedRule";
        type: {
            fields: [{
                name: "appId";
                type: "publicKey";
            }, {
                name: "namespace";
                type: "u8";
            }, {
                name: "resource";
                type: "string";
            }, {
                name: "permission";
                type: "string";
            }];
            kind: "struct";
        };
    }, {
        name: "AppData";
        type: {
            fields: [{
                name: "id";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }];
            kind: "struct";
        };
    }, {
        name: "UpdateAppData";
        type: {
            fields: [{
                name: "authority";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }, {
                name: "fee";
                type: {
                    option: "u64";
                };
            }, {
                name: "accountType";
                type: "u8";
            }, {
                name: "expiresAt";
                type: {
                    option: "i64";
                };
            }];
            kind: "struct";
        };
    }], DecodedHelper<[{
        name: "AllowedRule";
        type: {
            fields: [{
                name: "appId";
                type: "publicKey";
            }, {
                name: "namespace";
                type: "u8";
            }, {
                name: "resource";
                type: "string";
            }, {
                name: "permission";
                type: "string";
            }];
            kind: "struct";
        };
    }, {
        name: "AppData";
        type: {
            fields: [{
                name: "id";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }];
            kind: "struct";
        };
    }, {
        name: "UpdateAppData";
        type: {
            fields: [{
                name: "authority";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }, {
                name: "fee";
                type: {
                    option: "u64";
                };
            }, {
                name: "accountType";
                type: "u8";
            }, {
                name: "expiresAt";
                type: {
                    option: "i64";
                };
            }];
            kind: "struct";
        };
    }], EmptyDefined>>>>>
  • Returns null | DecodeStruct<{
        fields: [{
            name: "id";
            type: "publicKey";
        }, {
            name: "authority";
            type: "publicKey";
        }, {
            name: "recovery";
            type: {
                option: "publicKey";
            };
        }, {
            name: "bump";
            type: "u8";
        }, {
            name: "name";
            type: "string";
        }, {
            name: "rolesUpdatedAt";
            type: "i64";
        }, {
            name: "rulesUpdatedAt";
            type: "i64";
        }];
        kind: "struct";
    }, RecursiveDepth4<[{
        name: "AllowedRule";
        type: {
            fields: [{
                name: "appId";
                type: "publicKey";
            }, {
                name: "namespace";
                type: "u8";
            }, {
                name: "resource";
                type: "string";
            }, {
                name: "permission";
                type: "string";
            }];
            kind: "struct";
        };
    }, {
        name: "AppData";
        type: {
            fields: [{
                name: "id";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }];
            kind: "struct";
        };
    }, {
        name: "UpdateAppData";
        type: {
            fields: [{
                name: "authority";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }, {
                name: "fee";
                type: {
                    option: "u64";
                };
            }, {
                name: "accountType";
                type: "u8";
            }, {
                name: "expiresAt";
                type: {
                    option: "i64";
                };
            }];
            kind: "struct";
        };
    }], DecodedHelper<[{
        name: "AllowedRule";
        type: {
            fields: [{
                name: "appId";
                type: "publicKey";
            }, {
                name: "namespace";
                type: "u8";
            }, {
                name: "resource";
                type: "string";
            }, {
                name: "permission";
                type: "string";
            }];
            kind: "struct";
        };
    }, {
        name: "AppData";
        type: {
            fields: [{
                name: "id";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }];
            kind: "struct";
        };
    }, {
        name: "UpdateAppData";
        type: {
            fields: [{
                name: "authority";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }, {
                name: "fee";
                type: {
                    option: "u64";
                };
            }, {
                name: "accountType";
                type: "u8";
            }, {
                name: "expiresAt";
                type: {
                    option: "i64";
                };
            }];
            kind: "struct";
        };
    }], DecodedHelper<[{
        name: "AllowedRule";
        type: {
            fields: [{
                name: "appId";
                type: "publicKey";
            }, {
                name: "namespace";
                type: "u8";
            }, {
                name: "resource";
                type: "string";
            }, {
                name: "permission";
                type: "string";
            }];
            kind: "struct";
        };
    }, {
        name: "AppData";
        type: {
            fields: [{
                name: "id";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }];
            kind: "struct";
        };
    }, {
        name: "UpdateAppData";
        type: {
            fields: [{
                name: "authority";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }, {
                name: "fee";
                type: {
                    option: "u64";
                };
            }, {
                name: "accountType";
                type: "u8";
            }, {
                name: "expiresAt";
                type: {
                    option: "i64";
                };
            }];
            kind: "struct";
        };
    }], DecodedHelper<[{
        name: "AllowedRule";
        type: {
            fields: [{
                name: "appId";
                type: "publicKey";
            }, {
                name: "namespace";
                type: "u8";
            }, {
                name: "resource";
                type: "string";
            }, {
                name: "permission";
                type: "string";
            }];
            kind: "struct";
        };
    }, {
        name: "AppData";
        type: {
            fields: [{
                name: "id";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }];
            kind: "struct";
        };
    }, {
        name: "UpdateAppData";
        type: {
            fields: [{
                name: "authority";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }, {
                name: "fee";
                type: {
                    option: "u64";
                };
            }, {
                name: "accountType";
                type: "u8";
            }, {
                name: "expiresAt";
                type: {
                    option: "i64";
                };
            }];
            kind: "struct";
        };
    }], EmptyDefined>>>>>

Methods

  • Generates the required account PDAs to perform the provided transaction.

    Parameters

    • resource: string

      The resource trying to

    • permission: string

      The permission required to access the resource

    • options: AccountsOptionsType = {}

      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) }

    Returns Promise<AccountsType>

    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,
    }
  • Create new Rule/Permission

    Parameters

    • role: string

      The role getting the permission, only alphanumeric characters (a-z, A-Z,0-9) and 16 characters max.

    • resource: string

      The resource in which the permission will have effect

    • permission: string

      The permission

    • options: AddRuleOptionsType = {}

      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
      }
      }

    Returns Promise<string | TransactionInstruction>

  • Parameters

    Returns Promise<string | TransactionInstruction>

  • Parameters

    Returns Promise<string | TransactionInstruction>

  • Assign a Role to the provided address or to all addresses ("*")

    Parameters

    • role: string

      String representing the role to assign, only alphanumeric characters (a-z, A-Z,0-9) and 16 characters max.

    • addressType: addressTypes

      Either 'wallet', 'nft' or 'collection'

    • address: string | PublicKey

      The Solana address (or wildcard "") to which the role is assigned. The wilcard "" means that role will be applied to everyone.

    • options: AssignRoleOptionsType = {}

      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
      }
      }

    Returns Promise<string | TransactionInstruction>

  • Whether the DB version exists or not

    Parameters

    • dbType: "Rule" | "Role"

      The db type, either Rule or Role

    • version: number

      number, the version of the DB

    Returns Promise<boolean>

    boolean

  • Delete Sol Cerberus APP

    Parameters

    • options: DeleteAppOptionsType = {}

      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
      }
      }

    Returns Promise<string | TransactionInstruction>

  • Delete the Role assigned to the provided address or to wildcard "*" (all addresses)

    Parameters

    • role: string

      String: The role name.

    • addressType: addressTypes

      Either 'wallet', 'nft' or 'collection'

    • address: string | PublicKey

      String | PubKey: The Solana address (or wildcard "*") to which the role is assigned.

    • options: DeleteAssignedRoleOptionsType = {}

      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
      }
      }

    Returns Promise<string | TransactionInstruction>

  • Delete Rule/Permission

    Parameters

    • role: string

      The role name

    • resource: string

      The resource name

    • permission: string

      The permission name

    • options: DeleteRuleOptionsType = {}

      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
      }
      }

    Returns Promise<string | TransactionInstruction>

  • Returns Promise<null | DecodeStruct<{
        fields: [{
            name: "id";
            type: "publicKey";
        }, {
            name: "authority";
            type: "publicKey";
        }, {
            name: "recovery";
            type: {
                option: "publicKey";
            };
        }, {
            name: "bump";
            type: "u8";
        }, {
            name: "name";
            type: "string";
        }, {
            name: "rolesUpdatedAt";
            type: "i64";
        }, {
            name: "rulesUpdatedAt";
            type: "i64";
        }];
        kind: "struct";
    }, RecursiveDepth4<[{
        name: "AllowedRule";
        type: {
            fields: [{
                name: "appId";
                type: "publicKey";
            }, {
                name: "namespace";
                type: "u8";
            }, {
                name: "resource";
                type: "string";
            }, {
                name: "permission";
                type: "string";
            }];
            kind: "struct";
        };
    }, {
        name: "AppData";
        type: {
            fields: [{
                name: "id";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }];
            kind: "struct";
        };
    }, {
        name: "UpdateAppData";
        type: {
            fields: [{
                name: "authority";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }, {
                name: "fee";
                type: {
                    option: "u64";
                };
            }, {
                name: "accountType";
                type: "u8";
            }, {
                name: "expiresAt";
                type: {
                    option: "i64";
                };
            }];
            kind: "struct";
        };
    }], DecodedHelper<[{
        name: "AllowedRule";
        type: {
            fields: [{
                name: "appId";
                type: "publicKey";
            }, {
                name: "namespace";
                type: "u8";
            }, {
                name: "resource";
                type: "string";
            }, {
                name: "permission";
                type: "string";
            }];
            kind: "struct";
        };
    }, {
        name: "AppData";
        type: {
            fields: [{
                name: "id";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }];
            kind: "struct";
        };
    }, {
        name: "UpdateAppData";
        type: {
            fields: [{
                name: "authority";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }, {
                name: "fee";
                type: {
                    option: "u64";
                };
            }, {
                name: "accountType";
                type: "u8";
            }, {
                name: "expiresAt";
                type: {
                    option: "i64";
                };
            }];
            kind: "struct";
        };
    }], DecodedHelper<[{
        name: "AllowedRule";
        type: {
            fields: [{
                name: "appId";
                type: "publicKey";
            }, {
                name: "namespace";
                type: "u8";
            }, {
                name: "resource";
                type: "string";
            }, {
                name: "permission";
                type: "string";
            }];
            kind: "struct";
        };
    }, {
        name: "AppData";
        type: {
            fields: [{
                name: "id";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }];
            kind: "struct";
        };
    }, {
        name: "UpdateAppData";
        type: {
            fields: [{
                name: "authority";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }, {
                name: "fee";
                type: {
                    option: "u64";
                };
            }, {
                name: "accountType";
                type: "u8";
            }, {
                name: "expiresAt";
                type: {
                    option: "i64";
                };
            }];
            kind: "struct";
        };
    }], DecodedHelper<[{
        name: "AllowedRule";
        type: {
            fields: [{
                name: "appId";
                type: "publicKey";
            }, {
                name: "namespace";
                type: "u8";
            }, {
                name: "resource";
                type: "string";
            }, {
                name: "permission";
                type: "string";
            }];
            kind: "struct";
        };
    }, {
        name: "AppData";
        type: {
            fields: [{
                name: "id";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }];
            kind: "struct";
        };
    }, {
        name: "UpdateAppData";
        type: {
            fields: [{
                name: "authority";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }, {
                name: "fee";
                type: {
                    option: "u64";
                };
            }, {
                name: "accountType";
                type: "u8";
            }, {
                name: "expiresAt";
                type: {
                    option: "i64";
                };
            }];
            kind: "struct";
        };
    }], EmptyDefined>>>>>>

  • Finds the first Rule definition matching the provided Role, Resource, Permission and namespace.

    Parameters

    • roles: AddressByRoleType
    • resource: string
    • permission: string
    • namespace: number = namespaces.Rule

    Returns null | [string, string, string, number]

  • Clear all assigned roles added with the login() method.

    Returns boolean

    boolean

  • Returns Promise<null | DecodeStruct<{
        fields: [{
            name: "id";
            type: "publicKey";
        }, {
            name: "authority";
            type: "publicKey";
        }, {
            name: "recovery";
            type: {
                option: "publicKey";
            };
        }, {
            name: "bump";
            type: "u8";
        }, {
            name: "name";
            type: "string";
        }, {
            name: "rolesUpdatedAt";
            type: "i64";
        }, {
            name: "rulesUpdatedAt";
            type: "i64";
        }];
        kind: "struct";
    }, RecursiveDepth4<[{
        name: "AllowedRule";
        type: {
            fields: [{
                name: "appId";
                type: "publicKey";
            }, {
                name: "namespace";
                type: "u8";
            }, {
                name: "resource";
                type: "string";
            }, {
                name: "permission";
                type: "string";
            }];
            kind: "struct";
        };
    }, {
        name: "AppData";
        type: {
            fields: [{
                name: "id";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }];
            kind: "struct";
        };
    }, {
        name: "UpdateAppData";
        type: {
            fields: [{
                name: "authority";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }, {
                name: "fee";
                type: {
                    option: "u64";
                };
            }, {
                name: "accountType";
                type: "u8";
            }, {
                name: "expiresAt";
                type: {
                    option: "i64";
                };
            }];
            kind: "struct";
        };
    }], DecodedHelper<[{
        name: "AllowedRule";
        type: {
            fields: [{
                name: "appId";
                type: "publicKey";
            }, {
                name: "namespace";
                type: "u8";
            }, {
                name: "resource";
                type: "string";
            }, {
                name: "permission";
                type: "string";
            }];
            kind: "struct";
        };
    }, {
        name: "AppData";
        type: {
            fields: [{
                name: "id";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }];
            kind: "struct";
        };
    }, {
        name: "UpdateAppData";
        type: {
            fields: [{
                name: "authority";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }, {
                name: "fee";
                type: {
                    option: "u64";
                };
            }, {
                name: "accountType";
                type: "u8";
            }, {
                name: "expiresAt";
                type: {
                    option: "i64";
                };
            }];
            kind: "struct";
        };
    }], DecodedHelper<[{
        name: "AllowedRule";
        type: {
            fields: [{
                name: "appId";
                type: "publicKey";
            }, {
                name: "namespace";
                type: "u8";
            }, {
                name: "resource";
                type: "string";
            }, {
                name: "permission";
                type: "string";
            }];
            kind: "struct";
        };
    }, {
        name: "AppData";
        type: {
            fields: [{
                name: "id";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }];
            kind: "struct";
        };
    }, {
        name: "UpdateAppData";
        type: {
            fields: [{
                name: "authority";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }, {
                name: "fee";
                type: {
                    option: "u64";
                };
            }, {
                name: "accountType";
                type: "u8";
            }, {
                name: "expiresAt";
                type: {
                    option: "i64";
                };
            }];
            kind: "struct";
        };
    }], DecodedHelper<[{
        name: "AllowedRule";
        type: {
            fields: [{
                name: "appId";
                type: "publicKey";
            }, {
                name: "namespace";
                type: "u8";
            }, {
                name: "resource";
                type: "string";
            }, {
                name: "permission";
                type: "string";
            }];
            kind: "struct";
        };
    }, {
        name: "AppData";
        type: {
            fields: [{
                name: "id";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }];
            kind: "struct";
        };
    }, {
        name: "UpdateAppData";
        type: {
            fields: [{
                name: "authority";
                type: "publicKey";
            }, {
                name: "recovery";
                type: {
                    option: "publicKey";
                };
            }, {
                name: "name";
                type: "string";
            }, {
                name: "cached";
                type: "bool";
            }, {
                name: "fee";
                type: {
                    option: "u64";
                };
            }, {
                name: "accountType";
                type: "u8";
            }, {
                name: "expiresAt";
                type: {
                    option: "i64";
                };
            }];
            kind: "struct";
        };
    }], EmptyDefined>>>>>>

  • Adds NFT fetcher (only needed when using NFT authentication)

    Parameters

    Returns Promise<[string, null | PublicKey]>

  • Parameters

    • roles: AddressByRoleType
    • resource: string
    • permission: string
    • namespace: number = namespaces.Rule

    Returns Promise<null | PublicKey>

  • Adds NFT fetcher (only needed when using NFT authentication)

    Parameters

    Returns Promise<[string, null | PublicKey]>

  • Returns True if the rule is allowed for at least one of the provided roles.

    Parameters

    • resource: string
    • permission: string
    • namespace: number = namespaces.Rule

    Returns boolean

  • Parameters

    • role: string
    • resource: string
    • permission: string
    • namespace: number = namespaces.Rule

    Returns boolean

  • Initializes a Sol Cerberus APP

    Parameters

    • name: string

      Name to identify the APP

    • recovery: null | PublicKey = null

      The backup wallet (null for none)

    • options: InitializeAppOptionsType = {}

      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
      }
      }

    Returns Promise<string | TransactionInstruction>

  • Parameters

    • db: null | IDBPDatabase<unknown>

    Returns Promise<boolean>

  • Fetches the roles assigned to the provided address

    Parameters

    • options: LoginOptionsType = {}

      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)
      }

    Returns Promise<AddressByRoleType>

  • Parameters

    • addressType: DecodeEnum<{
          kind: "enum";
          variants: [{
              name: "Wallet";
          }, {
              name: "Nft";
          }, {
              name: "Collection";
          }];
      }, DecodedHelper<[{
          name: "AllowedRule";
          type: {
              fields: [{
                  name: "appId";
                  type: "publicKey";
              }, {
                  name: "namespace";
                  type: "u8";
              }, {
                  name: "resource";
                  type: "string";
              }, {
                  name: "permission";
                  type: "string";
              }];
              kind: "struct";
          };
      }, {
          name: "AppData";
          type: {
              fields: [{
                  name: "id";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }];
              kind: "struct";
          };
      }, {
          name: "UpdateAppData";
          type: {
              fields: [{
                  name: "authority";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }, {
                  name: "fee";
                  type: {
                      option: "u64";
                  };
              }, {
                  name: "accountType";
                  type: "u8";
              }, {
                  name: "expiresAt";
                  type: {
                      option: "i64";
                  };
              }];
              kind: "struct";
          };
      }], DecodedHelper<[{
          name: "AllowedRule";
          type: {
              fields: [{
                  name: "appId";
                  type: "publicKey";
              }, {
                  name: "namespace";
                  type: "u8";
              }, {
                  name: "resource";
                  type: "string";
              }, {
                  name: "permission";
                  type: "string";
              }];
              kind: "struct";
          };
      }, {
          name: "AppData";
          type: {
              fields: [{
                  name: "id";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }];
              kind: "struct";
          };
      }, {
          name: "UpdateAppData";
          type: {
              fields: [{
                  name: "authority";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }, {
                  name: "fee";
                  type: {
                      option: "u64";
                  };
              }, {
                  name: "accountType";
                  type: "u8";
              }, {
                  name: "expiresAt";
                  type: {
                      option: "i64";
                  };
              }];
              kind: "struct";
          };
      }], DecodedHelper<[{
          name: "AllowedRule";
          type: {
              fields: [{
                  name: "appId";
                  type: "publicKey";
              }, {
                  name: "namespace";
                  type: "u8";
              }, {
                  name: "resource";
                  type: "string";
              }, {
                  name: "permission";
                  type: "string";
              }];
              kind: "struct";
          };
      }, {
          name: "AppData";
          type: {
              fields: [{
                  name: "id";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }];
              kind: "struct";
          };
      }, {
          name: "UpdateAppData";
          type: {
              fields: [{
                  name: "authority";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }, {
                  name: "fee";
                  type: {
                      option: "u64";
                  };
              }, {
                  name: "accountType";
                  type: "u8";
              }, {
                  name: "expiresAt";
                  type: {
                      option: "i64";
                  };
              }];
              kind: "struct";
          };
      }], EmptyDefined>>>>

    Returns "wallet" | "nft" | "collection"

  • Parse Permissions into following mapped format:

    {
    0: {
    role1: {
    resource1: {
    permission1: {
    expiresAt: null;
    },
    resource2: {...}
    },
    },
    role2: {...}
    },
    1: {...}
    }

    Parameters

    • fetchedPerms: ProgramAccount<DecodeStruct<{
          fields: [{
              name: "appId";
              type: "publicKey";
          }, {
              name: "namespace";
              type: "u8";
          }, {
              name: "role";
              type: "string";
          }, {
              name: "resource";
              type: "string";
          }, {
              name: "permission";
              type: "string";
          }, {
              name: "expiresAt";
              type: {
                  option: "i64";
              };
          }, {
              name: "bump";
              type: "u8";
          }];
          kind: "struct";
      }, RecursiveDepth4<[{
          name: "AllowedRule";
          type: {
              fields: [{
                  name: "appId";
                  type: "publicKey";
              }, {
                  name: "namespace";
                  type: "u8";
              }, {
                  name: "resource";
                  type: "string";
              }, {
                  name: "permission";
                  type: "string";
              }];
              kind: "struct";
          };
      }, {
          name: "AppData";
          type: {
              fields: [{
                  name: "id";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }];
              kind: "struct";
          };
      }, {
          name: "UpdateAppData";
          type: {
              fields: [{
                  name: "authority";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }, {
                  name: "fee";
                  type: {
                      option: "u64";
                  };
              }, {
                  name: "accountType";
                  type: "u8";
              }, {
                  name: "expiresAt";
                  type: {
                      option: "i64";
                  };
              }];
              kind: "struct";
          };
      }], DecodedHelper<[{
          name: "AllowedRule";
          type: {
              fields: [{
                  name: "appId";
                  type: "publicKey";
              }, {
                  name: "namespace";
                  type: "u8";
              }, {
                  name: "resource";
                  type: "string";
              }, {
                  name: "permission";
                  type: "string";
              }];
              kind: "struct";
          };
      }, {
          name: "AppData";
          type: {
              fields: [{
                  name: "id";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }];
              kind: "struct";
          };
      }, {
          name: "UpdateAppData";
          type: {
              fields: [{
                  name: "authority";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }, {
                  name: "fee";
                  type: {
                      option: "u64";
                  };
              }, {
                  name: "accountType";
                  type: "u8";
              }, {
                  name: "expiresAt";
                  type: {
                      option: "i64";
                  };
              }];
              kind: "struct";
          };
      }], DecodedHelper<[{
          name: "AllowedRule";
          type: {
              fields: [{
                  name: "appId";
                  type: "publicKey";
              }, {
                  name: "namespace";
                  type: "u8";
              }, {
                  name: "resource";
                  type: "string";
              }, {
                  name: "permission";
                  type: "string";
              }];
              kind: "struct";
          };
      }, {
          name: "AppData";
          type: {
              fields: [{
                  name: "id";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }];
              kind: "struct";
          };
      }, {
          name: "UpdateAppData";
          type: {
              fields: [{
                  name: "authority";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }, {
                  name: "fee";
                  type: {
                      option: "u64";
                  };
              }, {
                  name: "accountType";
                  type: "u8";
              }, {
                  name: "expiresAt";
                  type: {
                      option: "i64";
                  };
              }];
              kind: "struct";
          };
      }], DecodedHelper<[{
          name: "AllowedRule";
          type: {
              fields: [{
                  name: "appId";
                  type: "publicKey";
              }, {
                  name: "namespace";
                  type: "u8";
              }, {
                  name: "resource";
                  type: "string";
              }, {
                  name: "permission";
                  type: "string";
              }];
              kind: "struct";
          };
      }, {
          name: "AppData";
          type: {
              fields: [{
                  name: "id";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }];
              kind: "struct";
          };
      }, {
          name: "UpdateAppData";
          type: {
              fields: [{
                  name: "authority";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }, {
                  name: "fee";
                  type: {
                      option: "u64";
                  };
              }, {
                  name: "accountType";
                  type: "u8";
              }, {
                  name: "expiresAt";
                  type: {
                      option: "i64";
                  };
              }];
              kind: "struct";
          };
      }], EmptyDefined>>>>>>[]

    Returns CachedPermsType

  • Parses Roles into IDB rows with the following format:

    {
    role: 'TriangleMaster',
    address: '*',
    addressType: 'wallet',
    expiresAt: 1689033410616 // Time in milliseconds
    }

    Parameters

    • fetchedRoles: ProgramAccount<DecodeStruct<{
          fields: [{
              name: "appId";
              type: "publicKey";
          }, {
              name: "address";
              type: {
                  option: "publicKey";
              };
          }, {
              name: "role";
              type: "string";
          }, {
              name: "addressType";
              type: {
                  defined: "AddressType";
              };
          }, {
              name: "expiresAt";
              type: {
                  option: "i64";
              };
          }, {
              name: "bump";
              type: "u8";
          }];
          kind: "struct";
      }, RecursiveDepth4<[{
          name: "AllowedRule";
          type: {
              fields: [{
                  name: "appId";
                  type: "publicKey";
              }, {
                  name: "namespace";
                  type: "u8";
              }, {
                  name: "resource";
                  type: "string";
              }, {
                  name: "permission";
                  type: "string";
              }];
              kind: "struct";
          };
      }, {
          name: "AppData";
          type: {
              fields: [{
                  name: "id";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }];
              kind: "struct";
          };
      }, {
          name: "UpdateAppData";
          type: {
              fields: [{
                  name: "authority";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }, {
                  name: "fee";
                  type: {
                      option: "u64";
                  };
              }, {
                  name: "accountType";
                  type: "u8";
              }, {
                  name: "expiresAt";
                  type: {
                      option: "i64";
                  };
              }];
              kind: "struct";
          };
      }], DecodedHelper<[{
          name: "AllowedRule";
          type: {
              fields: [{
                  name: "appId";
                  type: "publicKey";
              }, {
                  name: "namespace";
                  type: "u8";
              }, {
                  name: "resource";
                  type: "string";
              }, {
                  name: "permission";
                  type: "string";
              }];
              kind: "struct";
          };
      }, {
          name: "AppData";
          type: {
              fields: [{
                  name: "id";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }];
              kind: "struct";
          };
      }, {
          name: "UpdateAppData";
          type: {
              fields: [{
                  name: "authority";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }, {
                  name: "fee";
                  type: {
                      option: "u64";
                  };
              }, {
                  name: "accountType";
                  type: "u8";
              }, {
                  name: "expiresAt";
                  type: {
                      option: "i64";
                  };
              }];
              kind: "struct";
          };
      }], DecodedHelper<[{
          name: "AllowedRule";
          type: {
              fields: [{
                  name: "appId";
                  type: "publicKey";
              }, {
                  name: "namespace";
                  type: "u8";
              }, {
                  name: "resource";
                  type: "string";
              }, {
                  name: "permission";
                  type: "string";
              }];
              kind: "struct";
          };
      }, {
          name: "AppData";
          type: {
              fields: [{
                  name: "id";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }];
              kind: "struct";
          };
      }, {
          name: "UpdateAppData";
          type: {
              fields: [{
                  name: "authority";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }, {
                  name: "fee";
                  type: {
                      option: "u64";
                  };
              }, {
                  name: "accountType";
                  type: "u8";
              }, {
                  name: "expiresAt";
                  type: {
                      option: "i64";
                  };
              }];
              kind: "struct";
          };
      }], DecodedHelper<[{
          name: "AllowedRule";
          type: {
              fields: [{
                  name: "appId";
                  type: "publicKey";
              }, {
                  name: "namespace";
                  type: "u8";
              }, {
                  name: "resource";
                  type: "string";
              }, {
                  name: "permission";
                  type: "string";
              }];
              kind: "struct";
          };
      }, {
          name: "AppData";
          type: {
              fields: [{
                  name: "id";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }];
              kind: "struct";
          };
      }, {
          name: "UpdateAppData";
          type: {
              fields: [{
                  name: "authority";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }, {
                  name: "fee";
                  type: {
                      option: "u64";
                  };
              }, {
                  name: "accountType";
                  type: "u8";
              }, {
                  name: "expiresAt";
                  type: {
                      option: "i64";
                  };
              }];
              kind: "struct";
          };
      }], EmptyDefined>>>>>>[]

      Roles accounts fetched from Solana

    Returns RoleType[]

  • Parameters

    • resource: string
    • permission: string

    Returns string[][]

  • Executes Add/Delete Role/Rule instructions, updating the corresponding SC APP cache date:

    • "rules_updated_at"
    • "roles_updated_at"

    So the users can know when was the last time the Rules/Roles were updated.

    Parameters

    • method: any

      RPC method to execute (e.g: addRule, assignRole, etc..)

    • cacheType: cacheUpdated

      Either cacheUpdated.Role or cacheUpdated.Rule

    • options: runMethodOptionsType

      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
      }
      }

    Returns Promise<any>

    string

  • Set the assigned roles within the instance.

    Parameters

    • newRoles: RoleType[][]

      List containing the list of roles corresponding to the provided addresses

    Returns void

  • Stores Perms on IDB (When available)

    Parameters

    • fetchedPerms: ProgramAccount<DecodeStruct<{
          fields: [{
              name: "appId";
              type: "publicKey";
          }, {
              name: "namespace";
              type: "u8";
          }, {
              name: "role";
              type: "string";
          }, {
              name: "resource";
              type: "string";
          }, {
              name: "permission";
              type: "string";
          }, {
              name: "expiresAt";
              type: {
                  option: "i64";
              };
          }, {
              name: "bump";
              type: "u8";
          }];
          kind: "struct";
      }, RecursiveDepth4<[{
          name: "AllowedRule";
          type: {
              fields: [{
                  name: "appId";
                  type: "publicKey";
              }, {
                  name: "namespace";
                  type: "u8";
              }, {
                  name: "resource";
                  type: "string";
              }, {
                  name: "permission";
                  type: "string";
              }];
              kind: "struct";
          };
      }, {
          name: "AppData";
          type: {
              fields: [{
                  name: "id";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }];
              kind: "struct";
          };
      }, {
          name: "UpdateAppData";
          type: {
              fields: [{
                  name: "authority";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }, {
                  name: "fee";
                  type: {
                      option: "u64";
                  };
              }, {
                  name: "accountType";
                  type: "u8";
              }, {
                  name: "expiresAt";
                  type: {
                      option: "i64";
                  };
              }];
              kind: "struct";
          };
      }], DecodedHelper<[{
          name: "AllowedRule";
          type: {
              fields: [{
                  name: "appId";
                  type: "publicKey";
              }, {
                  name: "namespace";
                  type: "u8";
              }, {
                  name: "resource";
                  type: "string";
              }, {
                  name: "permission";
                  type: "string";
              }];
              kind: "struct";
          };
      }, {
          name: "AppData";
          type: {
              fields: [{
                  name: "id";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }];
              kind: "struct";
          };
      }, {
          name: "UpdateAppData";
          type: {
              fields: [{
                  name: "authority";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }, {
                  name: "fee";
                  type: {
                      option: "u64";
                  };
              }, {
                  name: "accountType";
                  type: "u8";
              }, {
                  name: "expiresAt";
                  type: {
                      option: "i64";
                  };
              }];
              kind: "struct";
          };
      }], DecodedHelper<[{
          name: "AllowedRule";
          type: {
              fields: [{
                  name: "appId";
                  type: "publicKey";
              }, {
                  name: "namespace";
                  type: "u8";
              }, {
                  name: "resource";
                  type: "string";
              }, {
                  name: "permission";
                  type: "string";
              }];
              kind: "struct";
          };
      }, {
          name: "AppData";
          type: {
              fields: [{
                  name: "id";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }];
              kind: "struct";
          };
      }, {
          name: "UpdateAppData";
          type: {
              fields: [{
                  name: "authority";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }, {
                  name: "fee";
                  type: {
                      option: "u64";
                  };
              }, {
                  name: "accountType";
                  type: "u8";
              }, {
                  name: "expiresAt";
                  type: {
                      option: "i64";
                  };
              }];
              kind: "struct";
          };
      }], DecodedHelper<[{
          name: "AllowedRule";
          type: {
              fields: [{
                  name: "appId";
                  type: "publicKey";
              }, {
                  name: "namespace";
                  type: "u8";
              }, {
                  name: "resource";
                  type: "string";
              }, {
                  name: "permission";
                  type: "string";
              }];
              kind: "struct";
          };
      }, {
          name: "AppData";
          type: {
              fields: [{
                  name: "id";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }];
              kind: "struct";
          };
      }, {
          name: "UpdateAppData";
          type: {
              fields: [{
                  name: "authority";
                  type: "publicKey";
              }, {
                  name: "recovery";
                  type: {
                      option: "publicKey";
                  };
              }, {
                  name: "name";
                  type: "string";
              }, {
                  name: "cached";
                  type: "bool";
              }, {
                  name: "fee";
                  type: {
                      option: "u64";
                  };
              }, {
                  name: "accountType";
                  type: "u8";
              }, {
                  name: "expiresAt";
                  type: {
                      option: "i64";
                  };
              }];
              kind: "struct";
          };
      }], EmptyDefined>>>>>>[]

    Returns Promise<void>

  • Stores Roles on IDB (When available)

    Parameters

    • parsedRoles: RoleType[]
    • fullyFetched: boolean = false

    Returns Promise<void>

  • Updates a Sol Cerberus APP

    Parameters

    • name: string

      Name to identify the APP

    • recovery: null | PublicKey = null

      The backup wallet (null for none)

    • options: UpdateAppOptionsType = {}

      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 Promise<string | TransactionInstruction>

Generated using TypeDoc