Skip to main content

Event Subscriptions

Subscribe to real-time vault events.

Vault Events

const unsubscribe = client.onVaultEvent((event) => {
console.log('Event:', event.type);
console.log('Data:', event.data);
});

// Later: stop listening
unsubscribe();

Operation Events

const unsubscribe = client.onOperation((event) => {
console.log('Operation executed');
console.log('Target:', event.target);
console.log('Value:', event.value);
console.log('TX Hash:', event.txHash);
});

Event Types

OperationExecuted

Emitted when an operation is executed through the vault.

{
type: 'OperationExecuted',
target: '0x...',
value: 0n,
data: '0x...',
txHash: '0x...',
}

Deposit

Emitted when ETH is deposited to the vault.

{
type: 'Deposit',
from: '0x...',
amount: 1000000000000000000n,
}

Withdrawal

Emitted when ETH is withdrawn from the vault.

{
type: 'Withdrawal',
to: '0x...',
amount: 500000000000000000n,
}