Complete reference for all Guardian TypeScript SDK classes, methods, and types.
The SecureOwnable class provides type-safe access to SecureOwnable contracts.
constructor(
client: PublicClient,
walletClient?: WalletClient,
contractAddress: Address,
chain: Chain
)Parameters:
client: Viem public client for read operationswalletClient: Optional wallet client for write operationscontractAddress: Address of the deployed contractchain: Chain configuration
Returns the current owner of the contract.
const owner = await secureOwnable.owner()Returns the time lock period in seconds.
const period = await secureOwnable.getTimeLockPeriodSec()Returns the current broadcaster address.
const broadcaster = await secureOwnable.broadcaster()Returns the current recovery address.
const recovery = await secureOwnable.recovery()Returns the current event forwarder address.
const forwarder = await secureOwnable.eventForwarder()Checks if the contract is initialized.
const initialized = await secureOwnable.isInitialized()Requests a transfer of ownership.
const txHash = await secureOwnable.transferOwnershipRequest(
'0x...',
{ from: account.address }
)Approves a delayed ownership transfer.
const txHash = await secureOwnable.transferOwnershipDelayedApproval(
1n,
{ from: account.address }
)Requests a broadcaster update.
const txHash = await secureOwnable.updateBroadcasterRequest(
'0x...',
{ from: account.address }
)Requests and approves a recovery update.
const txHash = await secureOwnable.updateRecoveryRequestAndApprove(
'0x...',
{ from: account.address }
)Requests and approves a time lock period update.
const txHash = await secureOwnable.updateTimeLockRequestAndApprove(
3600n, // 1 hour
{ from: account.address }
)The DynamicRBAC class provides type-safe access to DynamicRBAC contracts.
constructor(
client: PublicClient,
walletClient?: WalletClient,
contractAddress: Address,
chain: Chain
)Checks if role editing is enabled.
const enabled = await dynamicRBAC.roleEditingEnabled()Gets role information by hash.
const role = await dynamicRBAC.getRole('0x...')Checks if an account has a specific role.
const hasRole = await dynamicRBAC.hasRole('0x...', '0x...')Returns the total number of roles.
const count = await dynamicRBAC.getRoleCount()updateRoleEditingToggleRequestAndApprove(enabled: boolean, options?: TransactionOptions): Promise<Hash>
Requests and approves role editing toggle.
const txHash = await dynamicRBAC.updateRoleEditingToggleRequestAndApprove(
true,
{ from: account.address }
)type Address = `0x${string}`
type Hash = `0x${string}`
type OperationType =
| 'OWNERSHIP_TRANSFER'
| 'BROADCASTER_UPDATE'
| 'RECOVERY_UPDATE'
| 'TIMELOCK_UPDATE'
| 'ROLE_EDITING_TOGGLE'
| 'CUSTOM'
type TxAction =
| 'EXECUTE_TIME_DELAY_REQUEST'
| 'EXECUTE_TIME_DELAY_APPROVE'
| 'EXECUTE_META_REQUEST_AND_APPROVE'
| 'EXECUTE_META_APPROVE'
type TxStatus =
| 'UNDEFINED'
| 'PENDING'
| 'COMPLETED'
| 'CANCELLED'interface TransactionOptions {
from?: Address
value?: bigint
gas?: bigint
gasPrice?: bigint
maxFeePerGas?: bigint
maxPriorityFeePerGas?: bigint
nonce?: number
}class GuardianError extends Error {
code: string
details?: any
}
class ContractError extends GuardianError {
contractAddress: Address
method: string
}
class ValidationError extends GuardianError {
field: string
value: any
}
class ComplianceError extends GuardianError {
violation: ComplianceViolation
}import { SecureOwnable } from '@guardian/sdk/typescript'
import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'
const client = createPublicClient({
chain: mainnet,
transport: http()
})
const secureOwnable = new SecureOwnable(
client,
undefined,
'0x...',
mainnet
)
// Read operations
const owner = await secureOwnable.owner()
const timeLock = await secureOwnable.getTimeLockPeriodSec()
console.log('Owner:', owner)
console.log('Time lock period:', timeLock)Need more details? Check out the specific guides: