cronos-agent-wallet 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,9 +90,23 @@ async function main() {
|
|
|
90
90
|
| `chainId` | `number` | Yes | Chain ID (e.g., 338). Sent to backend for negotiation. |
|
|
91
91
|
| `usdcAddress` | `string` | Yes | ERC20 Token Address used for payment. |
|
|
92
92
|
| `dailyLimit` | `number` | No | Max USDC allowed to spend per 24h. Default: 1.0 |
|
|
93
|
+
| `strictPolicy` | `boolean` | No | If `true`, Agent crashes if local config hash != on-chain hash. Default: `true`. |
|
|
94
|
+
| `anchors` | `object` | No | On-chain registry addresses. Auto-filled for Cronos Testnet. |
|
|
95
|
+
| `analyticsUrl` | `string` | No | URL for centralized logging of payment decisions (e.g. `https://api.myapp.com/analytics`). |
|
|
93
96
|
| `allowedMerchants` | `string[]` | No | List of Merchant IDs to trust. If empty, allows all. |
|
|
94
97
|
| `trustedFacilitators` | `string[]` | No | List of Gateway URLs to trust (e.g., localhost). |
|
|
95
98
|
|
|
99
|
+
## 🛡️ Security Workflow (Strict Mode)
|
|
100
|
+
|
|
101
|
+
When `strictPolicy` is `true`, you must register your configuration hash on-chain whenever you change limits.
|
|
102
|
+
|
|
103
|
+
1. **Define Limits**: Set `dailyLimit` in your code.
|
|
104
|
+
2. **Seal Policy**: Run the setup script to write the hash to the `AgentPolicyRegistry`.
|
|
105
|
+
```bash
|
|
106
|
+
npx ts-node set_policy.ts
|
|
107
|
+
```
|
|
108
|
+
3. **Run Agent**: The Agent verifies `Local Hash == On-Chain Hash` before making any payment.
|
|
109
|
+
|
|
96
110
|
## API Reference
|
|
97
111
|
|
|
98
112
|
### `agent.fetch<T>(url, options): Promise<T>`
|
package/dist/config.d.ts
CHANGED
package/dist/config.js
CHANGED
|
@@ -7,5 +7,6 @@ exports.AGENT_CONFIG_DEFAULTS = {
|
|
|
7
7
|
merchantRegistry: "0x1948175dDB81DA08a4cf17BE4E0C95B97dD11F5c",
|
|
8
8
|
agentPolicyRegistry: "0xce3b58c9ae8CA4724d6FA8684d2Cb89546FF4E43",
|
|
9
9
|
policyVerifier: "0xFCb2D2279256B62A1E4E07BCDed26B6546bBc33b"
|
|
10
|
-
}
|
|
10
|
+
},
|
|
11
|
+
strictPolicy: true // 🛡️ ENFORCE: Agent will fail if policy hash mismatches chain
|
|
11
12
|
};
|