Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
4275191
feat: add delegation-based caveat enforcer actions
cursoragent Aug 6, 2025
32ca7cb
feat: move caveat enforcer client to main export
cursoragent Aug 6, 2025
5bc38de
refactor: modify existing actions to accept delegation instead of cre…
cursoragent Aug 6, 2025
9828c52
refactor: simplify actions to only accept delegation and use environm…
cursoragent Aug 6, 2025
309219d
refactor: replace custom error types with standard Error constructor
cursoragent Aug 6, 2025
0f08e24
refactor: consolidate parameter types into single CaveatEnforcerParam…
cursoragent Aug 6, 2025
fa47fa7
test: update caveatUtils.test.ts to use new delegation interface
cursoragent Aug 6, 2025
f34de6c
refactor: remove client exports from actions index (moved to main exp…
cursoragent Aug 7, 2025
1fbd944
refactor: add caveatEnforcerActions back to actions export
cursoragent Aug 7, 2025
06f21cb
refactor: use destructuring in findMatchingCaveat function
cursoragent Aug 7, 2025
5b2a354
style: remove extra whitespace in getCaveatAvailableAmount.ts
cursoragent Aug 7, 2025
5c2e0a5
Fix tests
jeffsmale90 Aug 7, 2025
5a1ee52
use getDelegationHashoffchain function instead of delegation-core has…
jeffsmale90 Aug 7, 2025
89628de
Fix package exports, straggling tests, and import order.
jeffsmale90 Aug 7, 2025
b61ee8c
Improve internals of getCaveatAvailableAmount actions. Improve valida…
jeffsmale90 Aug 7, 2025
23ba21c
Improve action tests, remove client tests.
jeffsmale90 Aug 7, 2025
246694e
Move caveatEnforcerClient into it's own file
jeffsmale90 Aug 8, 2025
0b03514
Fix jsdoc comments in getCaveatAvailableAmount.ts
jeffsmale90 Aug 8, 2025
8a7843a
Remove duplicate createCaveatEnforcerClient and type
jeffsmale90 Aug 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions packages/delegation-toolkit/src/actions/caveatEnforcerClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { PublicClient } from 'viem';

import type { DeleGatorEnvironment } from '../types';
import {
caveatEnforcerActions,
type CaveatEnforcerParams,
type PeriodTransferResult,
type StreamingResult,
} from './getCaveatAvailableAmount';

/**
* Type for client extended with caveat enforcer actions.
*/
export type CaveatEnforcerClient = PublicClient &
ReturnType<ReturnType<typeof caveatEnforcerActions>>;

/**
* Create a viem client extended with caveat enforcer actions.
*
* @param params - The parameters object.
* @param params.client - The viem public client.
* @param params.environment - The delegator environment.
* @returns The extended client with caveat enforcer actions.
*/
export function createCaveatEnforcerClient({
client,
environment,
}: {
client: PublicClient;
environment: DeleGatorEnvironment;
}): CaveatEnforcerClient {
return client.extend(caveatEnforcerActions({ environment }));
}

// Re-export types for convenience
export type { CaveatEnforcerParams, PeriodTransferResult, StreamingResult };
Loading
Loading