sriram1983007 commited on
Commit
bc33fcd
·
verified ·
1 Parent(s): 8588613

Card: 0.17.0 smart-account checks, MCP 0.10.0

Browse files
Files changed (1) hide show
  1. README.md +4 -3
README.md CHANGED
@@ -167,7 +167,7 @@ If this is useful for your agent, a ❤️ like on this page helps others find i
167
 
168
  ## 🔌 Use It From an AI Agent (MCP)
169
 
170
- [`sra-riskgate-mcp`](https://pypi.org/project/sra-riskgate-mcp/) gives Claude Desktop, Cursor and other MCP clients eight tools to call **before** paying:
171
 
172
  | Tool | What it does | Needs |
173
  | --- | --- | --- |
@@ -178,6 +178,7 @@ If this is useful for your agent, a ❤️ like on this page helps others find i
178
  | `check_x402_authorization` | The same checks for the x402 signature itself (the EIP-3009 `TransferWithAuthorization` typed data) before signing; expired, post-dated or long-lived authorizations and permits are held; Circle Gateway batched payments are supported | Nothing |
179
  | `check_circle_wallets_request` | The same checks for a Circle Wallets API request (transfer, contract execution, signing) before it is sent to Circle; approvals, raw messages and wallet upgrades are held | Nothing |
180
  | `check_delegation` | An EIP-7702 authorization before signing: always held, naming the contract and whether it is valid on every chain | Nothing |
 
181
  | `check_payment_with_model` | Full review by SRA-RiskGate-4B over your policy, the payment and your verification results | This model served locally (for example with Ollama) |
182
 
183
  ```json
@@ -192,10 +193,10 @@ Pass the payment's own text as `untrusted_text` so self-asserted claims are held
192
 
193
  ## 📦 Python SDK: One Call Before Every Payment (PyPI)
194
 
195
- The `sra-riskgate` SDK runs fast deterministic checks before the model is involved: an offline match against the OFAC SDN list's crypto addresses (a dated snapshot, not a screening service), supported asset and chain, address and amount validation, a per-payment ceiling, USDC depeg in both directions, and a scan for payment text that claims its own verification. From 0.8.0 it can also hold the first payment to a new payee (`known_recipients`) and always reject addresses you block (`blocked_addresses`). It never raises on bad payment data: invalid payments are rejected and anything unexpected becomes `hold`. From 0.9.0, `check_transaction(tx, ...)` checks the exact transaction an agent is about to sign: a USDC `transfer` gets the same checks, and token approvals (including unlimited `approve()`), other functions, other contracts and native ETH are held. From 0.11.0, check_authorization(typed_data, ...) does the same for x402 payments, which the agent pays by signing an EIP-3009 authorization instead of sending a transaction: the signature must be for USDC on that chain, from the agent’s wallet, and valid for at most an hour by default, and the decoded payment then gets every check above. From 0.12.0, Circle Arc is supported (5042 mainnet, 5042002 testnet): on Arc, USDC is the native asset, so a plain native send is checked as a USDC payment, read at 18 decimals and rounded up to a whole micro-USDC before the payment check. From 0.12.1, EIP-7702 code delegation is always held (`CODE_DELEGATION`): a type-4 transaction or any `authorizationList` hands the whole account to contract code, on every chain if signed with chain id 0, and `check_delegation()` holds a signed authorization before the agent signs it. From 0.13.0, Circle Gateway batched x402 payments (nanopayments) are checked: an authorization signed for Gateway's `GatewayWalletBatched` domain with Circle's GatewayWallet contract gets its own validity limit (default 8 days, since Gateway requires at least 3 and Circle's SDK signs for 7) and every payment check above, while a look-alike Gateway contract is held. Shown live on Arc Testnet: a Gateway payment approved and accepted by Circle, three unsafe ones stopped before signing. From 0.14.0, Circle Wallets (developer-controlled) requests are checked before they are sent to Circle, which signs as soon as it accepts them: transfers, contract executions (an `approve()` is held), typed-data and transaction signing, with `sign/message` and wallet upgrades always held. `guard_circle_wallets()` wraps Circle's Python SDK so blocked requests never reach Circle (`pip install "sra-riskgate[circle]"`). Shown live on Arc Testnet: a USDC payment from a Circle wallet approved and completed, an unlimited approval, an unknown payee and an unlimited permit stopped before reaching Circle. From 0.15.0, a payee that imitates one of your known payees (address poisoning: the same first and last characters, such as `0x2ffb…b7ee` for `0x2ffb88…472deb7ee`) is rejected as `LOOKALIKE_RECIPIENT`, naming the payee it imitates. From 0.16.0, pass the sender's account code (the result of `eth_getCode`) as `account_code`: an account already delegated through EIP-7702 to a contract you did not expect is held as `ACCOUNT_DELEGATED` and the agent is told to stop signing, because that contract can move the wallet's funds without another signature (list the delegates you trust in `expected_delegates`). Shown live on Base Sepolia (2026-10-30): an agent's USDC transfer ([tx](https://sepolia.basescan.org/tx/0x575f36cbd56e323e4191de267fe8c229900a85fab925d3c16d6c4ee3da6a67f2)) and an x402 EIP-3009 payment ([tx](https://sepolia.basescan.org/tx/0x22c23ed654570f6c96a2beea478232aa8b72a3215ecacbad095c9e149f87be1f)) were approved and settled on chain, while an unlimited approval, a look-alike payee, a 30-day x402 authorization and a self-vouching request were stopped before signing.
196
 
197
  ```bash
198
- pip install --upgrade "sra-riskgate>=0.16.0"
199
  ```
200
 
201
  ```python
 
167
 
168
  ## 🔌 Use It From an AI Agent (MCP)
169
 
170
+ [`sra-riskgate-mcp`](https://pypi.org/project/sra-riskgate-mcp/) gives Claude Desktop, Cursor and other MCP clients nine tools to call **before** paying:
171
 
172
  | Tool | What it does | Needs |
173
  | --- | --- | --- |
 
178
  | `check_x402_authorization` | The same checks for the x402 signature itself (the EIP-3009 `TransferWithAuthorization` typed data) before signing; expired, post-dated or long-lived authorizations and permits are held; Circle Gateway batched payments are supported | Nothing |
179
  | `check_circle_wallets_request` | The same checks for a Circle Wallets API request (transfer, contract execution, signing) before it is sent to Circle; approvals, raw messages and wallet upgrades are held | Nothing |
180
  | `check_delegation` | An EIP-7702 authorization before signing: always held, naming the contract and whether it is valid on every chain | Nothing |
181
+ | `check_user_operation` | An ERC-4337 UserOperation from a smart account (Coinbase Smart Wallet, Safe, Kernel, Nexus, SimpleAccount), call by call: an approval hidden in a batch is held, payments to the same payee are summed | Nothing |
182
  | `check_payment_with_model` | Full review by SRA-RiskGate-4B over your policy, the payment and your verification results | This model served locally (for example with Ollama) |
183
 
184
  ```json
 
193
 
194
  ## 📦 Python SDK: One Call Before Every Payment (PyPI)
195
 
196
+ The `sra-riskgate` SDK runs fast deterministic checks before the model is involved: an offline match against the OFAC SDN list's crypto addresses (a dated snapshot, not a screening service), supported asset and chain, address and amount validation, a per-payment ceiling, USDC depeg in both directions, and a scan for payment text that claims its own verification. From 0.8.0 it can also hold the first payment to a new payee (`known_recipients`) and always reject addresses you block (`blocked_addresses`). It never raises on bad payment data: invalid payments are rejected and anything unexpected becomes `hold`. From 0.9.0, `check_transaction(tx, ...)` checks the exact transaction an agent is about to sign: a USDC `transfer` gets the same checks, and token approvals (including unlimited `approve()`), other functions, other contracts and native ETH are held. From 0.11.0, check_authorization(typed_data, ...) does the same for x402 payments, which the agent pays by signing an EIP-3009 authorization instead of sending a transaction: the signature must be for USDC on that chain, from the agent’s wallet, and valid for at most an hour by default, and the decoded payment then gets every check above. From 0.12.0, Circle Arc is supported (5042 mainnet, 5042002 testnet): on Arc, USDC is the native asset, so a plain native send is checked as a USDC payment, read at 18 decimals and rounded up to a whole micro-USDC before the payment check. From 0.12.1, EIP-7702 code delegation is always held (`CODE_DELEGATION`): a type-4 transaction or any `authorizationList` hands the whole account to contract code, on every chain if signed with chain id 0, and `check_delegation()` holds a signed authorization before the agent signs it. From 0.13.0, Circle Gateway batched x402 payments (nanopayments) are checked: an authorization signed for Gateway's `GatewayWalletBatched` domain with Circle's GatewayWallet contract gets its own validity limit (default 8 days, since Gateway requires at least 3 and Circle's SDK signs for 7) and every payment check above, while a look-alike Gateway contract is held. Shown live on Arc Testnet: a Gateway payment approved and accepted by Circle, three unsafe ones stopped before signing. From 0.14.0, Circle Wallets (developer-controlled) requests are checked before they are sent to Circle, which signs as soon as it accepts them: transfers, contract executions (an `approve()` is held), typed-data and transaction signing, with `sign/message` and wallet upgrades always held. `guard_circle_wallets()` wraps Circle's Python SDK so blocked requests never reach Circle (`pip install "sra-riskgate[circle]"`). Shown live on Arc Testnet: a USDC payment from a Circle wallet approved and completed, an unlimited approval, an unknown payee and an unlimited permit stopped before reaching Circle. From 0.15.0, a payee that imitates one of your known payees (address poisoning: the same first and last characters, such as `0x2ffb…b7ee` for `0x2ffb88…472deb7ee`) is rejected as `LOOKALIKE_RECIPIENT`, naming the payee it imitates. From 0.16.0, pass the sender's account code (the result of `eth_getCode`) as `account_code`: an account already delegated through EIP-7702 to a contract you did not expect is held as `ACCOUNT_DELEGATED` and the agent is told to stop signing, because that contract can move the wallet's funds without another signature (list the delegates you trust in `expected_delegates`). Shown live on Base Sepolia (2026-10-30): an agent's USDC transfer ([tx](https://sepolia.basescan.org/tx/0x575f36cbd56e323e4191de267fe8c229900a85fab925d3c16d6c4ee3da6a67f2)) and an x402 EIP-3009 payment ([tx](https://sepolia.basescan.org/tx/0x22c23ed654570f6c96a2beea478232aa8b72a3215ecacbad095c9e149f87be1f)) were approved and settled on chain, while an unlimited approval, a look-alike payee, a 30-day x402 authorization and a self-vouching request were stopped before signing. From 0.17.0, smart accounts are covered: `check_user_operation(user_op, chain_id=...)` decodes the calls an ERC-4337 UserOperation makes (Coinbase Smart Wallet, CDP smart accounts, Safe, Kernel, Nexus, SimpleAccount) and checks each one, so an unlimited `approve()` hidden in a batch next to a payment is held and payments to the same payee are summed against your limit; self-calls, delegatecalls and unexpected paymasters are held too. Tested against callData produced by viem and permissionless for seven account types.
197
 
198
  ```bash
199
+ pip install --upgrade "sra-riskgate>=0.17.0"
200
  ```
201
 
202
  ```python