Skip to content

Commit 8236bde

Browse files
committed
add changelog
1 parent 03214f0 commit 8236bde

File tree

6 files changed

+108
-37
lines changed

6 files changed

+108
-37
lines changed

.github/workflows/unit_tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ jobs:
4242

4343
test-agentkit-typescript:
4444
runs-on: ubuntu-latest
45-
timeout-minutes: 15
4645
strategy:
4746
matrix:
4847
node-version: ["18", "20"]
@@ -57,4 +56,4 @@ jobs:
5756
working-directory: ./typescript
5857
run: |
5958
npm ci
60-
npm run test -- -- --testTimeout=300000
59+
npm run test
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@coinbase/agentkit": minor
3+
---
4+
5+
Added a new wallet provider and action providers to interact with the Safe Protocol
Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,60 @@
1-
# Safe Action Provider
1+
# Safe Action Provider
2+
3+
This directory contains the **SafeActionProvider** implementation, which provides actions to interact with [Safe](https://safe.global/) multi-signature wallets on EVM-compatible blockchains.
4+
5+
## Directory Structure
6+
7+
```
8+
safe/
9+
├── safeApiActionProvider.ts # Provider for Safe API interactions
10+
├── safeWalletActionProvider.ts # Provider for Safe Wallet operations
11+
├── schemas.ts # Action schemas for Safe operations
12+
├── index.ts # Main exports
13+
└── README.md # This file
14+
```
15+
16+
## Actions
17+
18+
### Safe API Actions
19+
20+
- `safeInfo`: Retrieve detailed information about a Safe wallet
21+
- `getAllowanceInfo`: Get current allowance configurations
22+
- `withdrawAllowance`: Withdraw funds from an allowance
23+
24+
### Safe Wallet Actions
25+
26+
- `addSigner`: Add a new signer to a Safe wallet
27+
- `removeSigner`: Remove an existing signer from a Safe wallet
28+
- `changeThreshold`: Modify the number of required signatures
29+
- `approvePending`: Approve a pending transaction
30+
- `enableAllowanceModule`: Activate the allowance module for a Safe
31+
- `setAllowance`: Configure spending allowances for specific addresses
32+
33+
## Adding New Actions
34+
35+
To add new Safe actions:
36+
37+
1. Define your action schema in `schemas.ts`
38+
2. Implement the action in the appropriate provider file:
39+
- Safe API actions in `safeApiActionProvider.ts`
40+
- Safe Wallet actions in `safeWalletActionProvider.ts`
41+
3. Add corresponding tests
42+
43+
## Network Support
44+
45+
The Safe providers support all EVM-compatible networks, including:
46+
47+
- Ethereum (Mainnet & Testnets)
48+
- Base (Mainnet & Testnets)
49+
- Optimism
50+
- Arbitrum
51+
- Optimism
52+
- And other EVM-compatible networks
53+
54+
## Notes
55+
56+
- safeWalletActionProvider requires a safeWalletProvider
57+
- safeWalletProvider connects to an existing Safe account or automatically creates a new one with the provided private key as single signer
58+
- Safe API actions can be used with other evmWalletProvider
59+
60+
For more information on Safe multi-signature wallets visit [Safe Documentation](https://docs.safe.global/).

typescript/agentkit/src/action-providers/safe/safeWalletActionProvider.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,21 @@ export class SafeWalletActionProvider extends ActionProvider<SafeWalletProvider>
3333
*/
3434
@CreateAction({
3535
name: "add_signer",
36-
description: "Add a new signer to the Safe multi-sig wallet",
36+
description: `
37+
Add a new signer to the Safe multi-sig wallet
38+
39+
Takes the following inputs:
40+
- newSigner: Address of the new signer to add
41+
- newThreshold: (Optional) New threshold after adding signer
42+
43+
Important notes:
44+
- Must be called by an existing signer
45+
- Requires confirmation from other signers if current threshold > 1
46+
- New signer must not already be in the Safe
47+
- New threshold cannot exceed number of signers
48+
- If newThreshold not provided, keeps existing threshold if valid, otherwise reduces it
49+
50+
`,
3751
schema: AddSignerSchema,
3852
})
3953
async addSigner(
@@ -151,6 +165,12 @@ Important notes:
151165
description: `
152166
Enables the allowance module for a Safe, allowing for token spending allowances.
153167
168+
Takes the following inputs:
169+
- delegateAddress: Address that will receive the allowance
170+
- tokenAddress: Address of the ERC20 token
171+
- amount: Amount of tokens to allow (e.g. '1.5' for 1.5 tokens)
172+
- resetTimeInMinutes: Time in minutes after which the allowance resets, e.g 1440 for 24 hours (optional, defaults to 0 for one-time allowance)
173+
154174
Important notes:
155175
- Must be called by an existing signer
156176
- Requires confirmation from other signers if threshold > 1

typescript/agentkit/src/wallet-providers/smartWalletProvider.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,18 @@ export class SmartWalletProvider extends EvmWalletProvider {
147147
return smartWalletProvider;
148148
}
149149

150+
/**
151+
* Stub for hash signing
152+
*
153+
* @throws as signing hashes is not implemented for SmartWallets.
154+
*
155+
* @param _ - The hash to sign.
156+
* @returns The signed hash.
157+
*/
158+
async signHash(_: Hex): Promise<Hex> {
159+
throw new Error("Not implemented");
160+
}
161+
150162
/**
151163
* Stub for message signing
152164
*
@@ -359,4 +371,13 @@ export class SmartWalletProvider extends EvmWalletProvider {
359371
throw new Error(`Transfer failed with status ${result.status}`);
360372
}
361373
}
374+
375+
/**
376+
* Gets the public client instance.
377+
*
378+
* @returns The Viem PublicClient instance.
379+
*/
380+
getPublicClient(): ViemPublicClient {
381+
return this.#publicClient;
382+
}
362383
}

typescript/package-lock.json

Lines changed: 0 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)