sriram1983007 commited on
Commit
56cee15
·
verified ·
1 Parent(s): 9e8dfce

Card: sra-riskgate 1.4.0 screening providers and 1.3.0 model prompts

Browse files
Files changed (1) hide show
  1. README.md +2 -2
README.md CHANGED
@@ -244,10 +244,10 @@ Pass the payment's own text as `untrusted_text` so self-asserted claims are held
244
 
245
  ## 📦 Python SDK: One Call Before Every Payment (PyPI)
246
 
247
- 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. From 0.18.0, the SDK also checks what actually settled: `verify_settlement(receipt, ...)` confirms a mined receipt holds exactly the approved USDC payment (right payer, payee and amount, and for x402 the approved authorization), and `verify_gateway_balances(...)` confirms a Circle Gateway payment from balances read before and after. An x402 server asking for a signature valid longer than an hour (`maxTimeoutSeconds`) is held before the agent signs. From 0.19.0, `verify_settlement` checks any ERC-20 on any EVM chain, and from 0.20.0 named stablecoins fill in the contract and decimals (`token="USDT"` on Ethereum, `"USDB"` from Bridge on Ethereum and Base, `"USDG"` on Ethereum and Robinhood Chain, and USDC), each read on chain before release. 0.20.0 also adds `check_allowances(owner, {spender: allowance})` for pull payments such as loan repayments and subscriptions, which need no new signature: an unlimited, oversized or unexpected standing allowance is held, and one held by a sanctioned or blocked spender is rejected. From 1.0.0, the checks before signing cover them too: `check_payment`, `check_transaction`, `check_user_operation` and Circle Wallets transfers check USDT, USDB and USDG as well as USDC once you enable them with `allowed_tokens=["USDC", "USDT", "USDB", "USDG"]` (USDC only by default, so upgrading never starts approving a token you did not choose). The token is read from the contract called, approvals and permits are held for every token, and a smart-account batch is summed across tokens. Read on chain before release, only USDC implements EIP-3009, so an x402 signature for USDT, USDB or USDG is held: it could never settle. From 1.0.0 the public API follows semantic versioning ([details](https://github.com/sriram1983007-dev/sra-riskgate#usdt-usdb-and-usdg-100)). From 1.1.0, `register_stablecoin(symbol, chain_id, contract, decimals)` adds any US-dollar stablecoin on any EVM chain (a testnet dollar, PYUSD, an L2's own stablecoin), and every check then treats it like a built-in token; it is still held until enabled with `allowed_tokens`, and a registration can never change USDC, USDT, USDB or USDG ([details](https://github.com/sriram1983007-dev/sra-riskgate#your-own-stablecoin-or-chain-110)).
248
 
249
  ```bash
250
- pip install --upgrade "sra-riskgate>=1.1.0"
251
  ```
252
 
253
  ```python
 
244
 
245
  ## 📦 Python SDK: One Call Before Every Payment (PyPI)
246
 
247
+ 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. From 0.18.0, the SDK also checks what actually settled: `verify_settlement(receipt, ...)` confirms a mined receipt holds exactly the approved USDC payment (right payer, payee and amount, and for x402 the approved authorization), and `verify_gateway_balances(...)` confirms a Circle Gateway payment from balances read before and after. An x402 server asking for a signature valid longer than an hour (`maxTimeoutSeconds`) is held before the agent signs. From 0.19.0, `verify_settlement` checks any ERC-20 on any EVM chain, and from 0.20.0 named stablecoins fill in the contract and decimals (`token="USDT"` on Ethereum, `"USDB"` from Bridge on Ethereum and Base, `"USDG"` on Ethereum and Robinhood Chain, and USDC), each read on chain before release. 0.20.0 also adds `check_allowances(owner, {spender: allowance})` for pull payments such as loan repayments and subscriptions, which need no new signature: an unlimited, oversized or unexpected standing allowance is held, and one held by a sanctioned or blocked spender is rejected. From 1.0.0, the checks before signing cover them too: `check_payment`, `check_transaction`, `check_user_operation` and Circle Wallets transfers check USDT, USDB and USDG as well as USDC once you enable them with `allowed_tokens=["USDC", "USDT", "USDB", "USDG"]` (USDC only by default, so upgrading never starts approving a token you did not choose). The token is read from the contract called, approvals and permits are held for every token, and a smart-account batch is summed across tokens. Read on chain before release, only USDC implements EIP-3009, so an x402 signature for USDT, USDB or USDG is held: it could never settle. From 1.0.0 the public API follows semantic versioning ([details](https://github.com/sriram1983007-dev/sra-riskgate#usdt-usdb-and-usdg-100)). From 1.1.0, `register_stablecoin(symbol, chain_id, contract, decimals)` adds any US-dollar stablecoin on any EVM chain (a testnet dollar, PYUSD, an L2's own stablecoin), and every check then treats it like a built-in token; it is still held until enabled with `allowed_tokens`, and a registration can never change USDC, USDT, USDB or USDG ([details](https://github.com/sriram1983007-dev/sra-riskgate#your-own-stablecoin-or-chain-110)). From 1.2.0 and 1.3.0, `with_dispute_window()`, `payment_messages()` and `dispute_messages()` build this model's exact training prompts, and `parse_payment_verdict()` / `parse_dispute_verdict()` read its answer, failing closed. From 1.4.0, `check_payment(screening_providers=[...])` adds outside address screening: Chainalysis's free sanctions API, Range and Webacy are built in, and any other provider (such as TRM Labs) plugs in with `CallableProvider`. A provider's sanctions match or severe risk rejects, high risk holds, and a provider with no usable answer holds; only the sender's and recipient's addresses are sent. The adapters follow each provider's published API documentation and are tested against responses shaped like it ([details](https://github.com/sriram1983007-dev/sra-riskgate#screening-providers-chainalysis-range-webacy-and-your-own-140)).
248
 
249
  ```bash
250
+ pip install --upgrade "sra-riskgate>=1.4.0"
251
  ```
252
 
253
  ```python