@inkwell.ar/sdk
Version:
SDK for interacting with the Inkwell Blog CRUD AO process using aoconnect for deployment and interactions
76 lines • 2.38 kB
TypeScript
import { Role, LogLevel } from '../types';
export interface BlogPermission {
blog_id: string;
roles: Role[];
last_updated: number;
}
export interface WalletPermission {
wallet: string;
roles: string[];
last_updated: number;
}
export interface RegistryStats {
version: string;
wallet_count: number;
blog_count: number;
total_permissions: number;
}
export interface SyncResult {
wallet: string;
roles: string[];
synced: boolean;
}
export interface SyncResponse {
message: string;
synced_wallets: number;
results: SyncResult[];
}
export declare class BlogRegistrySDK {
private aoconnect;
private registryProcessId;
private logger;
constructor(ao?: any, registryProcessId?: string, logLevel?: LogLevel);
/**
* Note: Write operations (register, remove, update) are only available to blog processes
* for security reasons. The registry uses msg.From as the blog ID to ensure only
* the actual blog process can modify its own permissions.
*/
/**
* Get all blogs a wallet has permissions for
*/
getWalletBlogs(wallet: string): Promise<BlogPermission[]>;
/**
* Get all wallets with permissions for a specific blog
*/
getBlogWallets(blogId: string): Promise<WalletPermission[]>;
/**
* Check if a wallet has a specific role for a blog
*/
checkWalletRole(wallet: string, blogId: string, role: string): Promise<boolean>;
/**
* Get registry statistics
*/
getRegistryStats(): Promise<RegistryStats>;
/**
* Note: Bulk operations and sync operations are only available to blog processes
* for security reasons. The registry uses msg.From as the blog ID to ensure only
* the actual blog process can modify its own permissions.
*/
/**
* Get all blogs that a wallet can admin
*/
getAdminBlogs(wallet: string): Promise<BlogPermission[]>;
/**
* Get all blogs that a wallet can edit
*/
getEditableBlogs(wallet: string): Promise<BlogPermission[]>;
/**
* Check if a wallet can admin a specific blog
*/
canAdminBlog(wallet: string, blogId: string): Promise<boolean>;
/**
* Check if a wallet can edit a specific blog
*/
canEditBlog(wallet: string, blogId: string): Promise<boolean>;
}
//# sourceMappingURL=blog-registry-sdk.d.ts.map