Complete reference for Bloxchain TypeScript SDK classes and methods. Contract source of truth: Solidity in contracts/. See CODEBASE_DOCUMENTATION.md.
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 all broadcaster addresses for the broadcaster role.
const broadcasters = await secureOwnable.getBroadcasters()Returns the recovery address.
const recovery = await secureOwnable.getRecovery()Returns whether the contract is initialized.
const isInit = await secureOwnable.initialized()Requests a time-delayed transfer of the owner role to the recovery address at request time (snapshotted in the pending tx). Rotating recovery later does not change that stored beneficiary. See the Ownership transfer vs recovery section in the SecureOwnable guide.
const result = await secureOwnable.transferOwnershipRequest({ from: account.address })transferOwnershipDelayedApproval(txId: bigint, options?: TransactionOptions): Promise<TransactionResult>
Approves a pending ownership transfer after the time lock. Callable by current owner or current recovery; execution still assigns owner to the address snapshotted at request time (may differ from getRecovery() at approval time).
updateBroadcasterRequest(newBroadcaster: Address, location: bigint, options?: TransactionOptions): Promise<TransactionResult>
Requests a broadcaster update at the given index (location in the broadcaster role set).
const result = await secureOwnable.updateBroadcasterRequest(
'0x...',
locationIndex,
{ from: account.address }
)updateRecoveryRequestAndApprove(metaTx: MetaTransaction, options?: TransactionOptions): Promise<TransactionResult>
Requests and approves a recovery update using a signed meta-transaction (owner signs, broadcaster submits).
updateTimeLockRequestAndApprove(metaTx: MetaTransaction, options?: TransactionOptions): Promise<TransactionResult>
Requests and approves a time lock period update using a signed meta-transaction.
The RuntimeRBAC class provides type-safe access to RuntimeRBAC contracts. It extends BaseStateMachine and provides batch-based role configuration.
constructor(
client: PublicClient,
walletClient?: WalletClient,
contractAddress: Address,
chain: Chain
)Gets role information by hash. Return shape includes roleName, roleHash (or roleHashReturn), maxWallets, walletCount, isProtected.
Checks if a wallet has a specific role.
const hasRole = await runtimeRBAC.hasRole('0x...', '0x...')Gets all authorized wallets for a role.
const wallets = await runtimeRBAC.getAuthorizedWallets('0x...')Gets all roles assigned to a wallet.
const roles = await runtimeRBAC.getWalletRoles('0x...')Returns the list of supported roles.
const roles = await runtimeRBAC.getSupportedRoles()Gets function schema information.
const schema = await runtimeRBAC.getFunctionSchema('0xa9059cbb')roleConfigBatchRequestAndApprove(metaTx: MetaTransaction, options?: TransactionOptions): Promise<TransactionResult>
Requests and approves a RBAC configuration batch using a meta-transaction.
const txHash = await runtimeRBAC.roleConfigBatchRequestAndApprove(
metaTx,
{ from: account.address }
)roleConfigBatchExecutionParams(definitionAddress: Address, actions: RoleConfigAction[]): Promise<Hex>
Calls the deployed RuntimeRBACDefinitions contract to build execution params (single source of truth with Solidity).
const definitionAddress = deployedAddresses.sepolia.RuntimeRBACDefinitions.address; // from deployed-addresses.json for your chain
const executionParams = await runtimeRBAC.roleConfigBatchExecutionParams(definitionAddress, actions);
// Or use definition helper: import { roleConfigBatchExecutionParams } from '@bloxchain/sdk'; const executionParams = await roleConfigBatchExecutionParams(client, definitionAddress, actions);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_TIME_DELAY_CANCEL'
| 'SIGN_META_REQUEST_AND_APPROVE'
| 'SIGN_META_APPROVE'
| 'SIGN_META_CANCEL'
| 'EXECUTE_META_REQUEST_AND_APPROVE'
| 'EXECUTE_META_APPROVE'
| 'EXECUTE_META_CANCEL'
type TxStatus =
| 'UNDEFINED'
| 'PENDING'
| 'COMPLETED'
| 'CANCELLED'interface TransactionOptions {
from?: Address
value?: bigint
gas?: bigint
gasPrice?: bigint
maxFeePerGas?: bigint
maxPriorityFeePerGas?: bigint
nonce?: number
}class BloxchainError extends Error {
code: string
details?: any
}
class ContractError extends BloxchainError {
contractAddress: Address
method: string
}
class ValidationError extends BloxchainError {
field: string
value: any
}
class ComplianceError extends BloxchainError {
violation: ComplianceViolation
}import { SecureOwnable } from '@bloxchain/sdk'
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: