@agether/agether 2.6.3 → 2.6.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agether/agether",
3
- "version": "2.6.3",
3
+ "version": "2.6.4",
4
4
  "description": "OpenClaw plugin for Agether — onchain credit for AI agents on Ethereum & Base",
5
5
  "main": "src/index.ts",
6
6
  "openclaw": {
package/src/index.ts CHANGED
@@ -166,7 +166,7 @@ function getConfig(api: any): PluginConfig {
166
166
  activeChainId = chainId; // Update module-level for txLink
167
167
  return {
168
168
  privateKey: resolvePrivateKey(),
169
- agentId: cachedAgentId || cfg.agentId,
169
+ agentId: cachedAgentIds[chainId] || cfg.agentId,
170
170
  rpcUrl: resolveRpcUrl(chainId),
171
171
  chainId,
172
172
  chainConfigured,
@@ -174,7 +174,7 @@ function getConfig(api: any): PluginConfig {
174
174
  }
175
175
 
176
176
  // Module-level cache
177
- let cachedAgentId: string | undefined;
177
+ const cachedAgentIds: Record<number, string> = {}; // chainId → agentId (chain-specific!)
178
178
  let activeChainId: ChainId = ChainId.Ethereum;
179
179
  let chainOverride: ChainId | undefined; // set by agether_set_chain, survives stale api.config
180
180
 
@@ -193,7 +193,7 @@ function requireChain(cfg: PluginConfig): void {
193
193
  }
194
194
 
195
195
  function createClient(cfg: PluginConfig): MorphoClient {
196
- const agentId = cachedAgentId || cfg.agentId;
196
+ const agentId = cachedAgentIds[cfg.chainId] || cfg.agentId;
197
197
  return new MorphoClient({
198
198
  privateKey: cfg.privateKey,
199
199
  rpcUrl: cfg.rpcUrl,
@@ -204,7 +204,7 @@ function createClient(cfg: PluginConfig): MorphoClient {
204
204
 
205
205
  /** Persist agentId to openclaw.json so it survives restarts. */
206
206
  function persistAgentId(agentId: string): string {
207
- cachedAgentId = agentId;
207
+ cachedAgentIds[activeChainId] = agentId;
208
208
  try {
209
209
  const home = process.env.HOME || process.env.USERPROFILE || "/root";
210
210
  const cfgPath = path.join(home, ".openclaw", "openclaw.json");