@wowok/agent-mcp 2.3.7 → 2.3.9

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 (43) hide show
  1. package/dist/index.d.ts +1 -15838
  2. package/dist/index.js +40 -394
  3. package/dist/schema/call/base.d.ts +24 -24
  4. package/dist/schema/call/bridge-handler.d.ts +5 -0
  5. package/dist/schema/call/bridge-handler.js +234 -0
  6. package/dist/schema/call/bridge.d.ts +2212 -0
  7. package/dist/schema/call/bridge.js +408 -0
  8. package/dist/schema/call/handler.js +29 -15
  9. package/dist/schema/call/index.d.ts +1 -0
  10. package/dist/schema/call/index.js +1 -0
  11. package/dist/schema/call/service.js +1 -1
  12. package/dist/schema/index.d.ts +1 -0
  13. package/dist/schema/index.js +1 -0
  14. package/dist/schema/local/index.d.ts +70 -70
  15. package/dist/schema/local/index.js +2 -2
  16. package/dist/schema/messenger/index.d.ts +74 -74
  17. package/dist/schema/operations.d.ts +24302 -0
  18. package/dist/schema/operations.js +393 -0
  19. package/dist/schema-query/index.d.ts +3 -1
  20. package/dist/schema-query/index.js +63 -3
  21. package/dist/schemas/account_operation.output.json +1397 -0
  22. package/dist/schemas/bridge_operation.output.json +64 -0
  23. package/dist/schemas/bridge_operation.schema.json +547 -0
  24. package/dist/schemas/guard2file.output.json +84 -0
  25. package/dist/schemas/index.json +33 -14
  26. package/dist/schemas/local_info_operation.output.json +70 -0
  27. package/dist/schemas/local_mark_operation.output.json +114 -0
  28. package/dist/schemas/machineNode2file.output.json +89 -0
  29. package/dist/schemas/messenger_operation.output.json +1068 -0
  30. package/dist/schemas/onchain_events.output.json +513 -0
  31. package/dist/schemas/onchain_operations.output.json +1766 -0
  32. package/dist/schemas/onchain_operations.schema.json +8324 -49
  33. package/dist/schemas/onchain_operations_service.schema.json +1 -1
  34. package/dist/schemas/onchain_table_data.output.json +1938 -0
  35. package/dist/schemas/onchain_table_data.schema.json +483 -22
  36. package/dist/schemas/query_toolkit.output.json +18 -0
  37. package/dist/schemas/query_toolkit.schema.json +454 -19
  38. package/dist/schemas/schema_query.output.json +42 -0
  39. package/dist/schemas/schema_query.schema.json +1 -0
  40. package/dist/schemas/wip_file.output.json +116 -0
  41. package/dist/schemas/wip_file.schema.json +163 -15
  42. package/dist/schemas/wowok_buildin_info.output.json +577 -0
  43. package/package.json +2 -2
@@ -1967,7 +1967,7 @@ export declare const CallResultSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
1967
1967
  txDigest: string;
1968
1968
  }>;
1969
1969
  packageId: z.ZodString;
1970
- parsedJson: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1970
+ parsedJson: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
1971
1971
  sender: z.ZodString;
1972
1972
  timestampMs: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
1973
1973
  transactionModule: z.ZodString;
@@ -1982,7 +1982,7 @@ export declare const CallResultSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
1982
1982
  };
1983
1983
  bcsEncoding: "base64";
1984
1984
  packageId: string;
1985
- parsedJson: Record<string, string | number | boolean>;
1985
+ parsedJson: Record<string, string | number | boolean | null>;
1986
1986
  sender: string;
1987
1987
  transactionModule: string;
1988
1988
  bcs: string;
@@ -1995,7 +1995,7 @@ export declare const CallResultSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
1995
1995
  };
1996
1996
  bcsEncoding: "base64";
1997
1997
  packageId: string;
1998
- parsedJson: Record<string, string | number | boolean>;
1998
+ parsedJson: Record<string, string | number | boolean | null>;
1999
1999
  sender: string;
2000
2000
  transactionModule: string;
2001
2001
  bcs: string;
@@ -2012,7 +2012,7 @@ export declare const CallResultSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
2012
2012
  txDigest: string;
2013
2013
  }>;
2014
2014
  packageId: z.ZodString;
2015
- parsedJson: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
2015
+ parsedJson: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
2016
2016
  sender: z.ZodString;
2017
2017
  timestampMs: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
2018
2018
  transactionModule: z.ZodString;
@@ -2027,7 +2027,7 @@ export declare const CallResultSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
2027
2027
  };
2028
2028
  bcsEncoding: "base58";
2029
2029
  packageId: string;
2030
- parsedJson: Record<string, string | number | boolean>;
2030
+ parsedJson: Record<string, string | number | boolean | null>;
2031
2031
  sender: string;
2032
2032
  transactionModule: string;
2033
2033
  bcs: string;
@@ -2040,7 +2040,7 @@ export declare const CallResultSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
2040
2040
  };
2041
2041
  bcsEncoding: "base58";
2042
2042
  packageId: string;
2043
- parsedJson: Record<string, string | number | boolean>;
2043
+ parsedJson: Record<string, string | number | boolean | null>;
2044
2044
  sender: string;
2045
2045
  transactionModule: string;
2046
2046
  bcs: string;
@@ -2720,7 +2720,7 @@ export declare const CallResultSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
2720
2720
  };
2721
2721
  bcsEncoding: "base64";
2722
2722
  packageId: string;
2723
- parsedJson: Record<string, string | number | boolean>;
2723
+ parsedJson: Record<string, string | number | boolean | null>;
2724
2724
  sender: string;
2725
2725
  transactionModule: string;
2726
2726
  bcs: string;
@@ -2733,7 +2733,7 @@ export declare const CallResultSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
2733
2733
  };
2734
2734
  bcsEncoding: "base58";
2735
2735
  packageId: string;
2736
- parsedJson: Record<string, string | number | boolean>;
2736
+ parsedJson: Record<string, string | number | boolean | null>;
2737
2737
  sender: string;
2738
2738
  transactionModule: string;
2739
2739
  bcs: string;
@@ -3010,7 +3010,7 @@ export declare const CallResultSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
3010
3010
  };
3011
3011
  bcsEncoding: "base64";
3012
3012
  packageId: string;
3013
- parsedJson: Record<string, string | number | boolean>;
3013
+ parsedJson: Record<string, string | number | boolean | null>;
3014
3014
  sender: string;
3015
3015
  transactionModule: string;
3016
3016
  bcs: string;
@@ -3023,7 +3023,7 @@ export declare const CallResultSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObj
3023
3023
  };
3024
3024
  bcsEncoding: "base58";
3025
3025
  packageId: string;
3026
- parsedJson: Record<string, string | number | boolean>;
3026
+ parsedJson: Record<string, string | number | boolean | null>;
3027
3027
  sender: string;
3028
3028
  transactionModule: string;
3029
3029
  bcs: string;
@@ -4595,7 +4595,7 @@ export declare const CallOutputSchema: z.ZodObject<{
4595
4595
  txDigest: string;
4596
4596
  }>;
4597
4597
  packageId: z.ZodString;
4598
- parsedJson: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
4598
+ parsedJson: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
4599
4599
  sender: z.ZodString;
4600
4600
  timestampMs: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
4601
4601
  transactionModule: z.ZodString;
@@ -4610,7 +4610,7 @@ export declare const CallOutputSchema: z.ZodObject<{
4610
4610
  };
4611
4611
  bcsEncoding: "base64";
4612
4612
  packageId: string;
4613
- parsedJson: Record<string, string | number | boolean>;
4613
+ parsedJson: Record<string, string | number | boolean | null>;
4614
4614
  sender: string;
4615
4615
  transactionModule: string;
4616
4616
  bcs: string;
@@ -4623,7 +4623,7 @@ export declare const CallOutputSchema: z.ZodObject<{
4623
4623
  };
4624
4624
  bcsEncoding: "base64";
4625
4625
  packageId: string;
4626
- parsedJson: Record<string, string | number | boolean>;
4626
+ parsedJson: Record<string, string | number | boolean | null>;
4627
4627
  sender: string;
4628
4628
  transactionModule: string;
4629
4629
  bcs: string;
@@ -4640,7 +4640,7 @@ export declare const CallOutputSchema: z.ZodObject<{
4640
4640
  txDigest: string;
4641
4641
  }>;
4642
4642
  packageId: z.ZodString;
4643
- parsedJson: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
4643
+ parsedJson: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
4644
4644
  sender: z.ZodString;
4645
4645
  timestampMs: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
4646
4646
  transactionModule: z.ZodString;
@@ -4655,7 +4655,7 @@ export declare const CallOutputSchema: z.ZodObject<{
4655
4655
  };
4656
4656
  bcsEncoding: "base58";
4657
4657
  packageId: string;
4658
- parsedJson: Record<string, string | number | boolean>;
4658
+ parsedJson: Record<string, string | number | boolean | null>;
4659
4659
  sender: string;
4660
4660
  transactionModule: string;
4661
4661
  bcs: string;
@@ -4668,7 +4668,7 @@ export declare const CallOutputSchema: z.ZodObject<{
4668
4668
  };
4669
4669
  bcsEncoding: "base58";
4670
4670
  packageId: string;
4671
- parsedJson: Record<string, string | number | boolean>;
4671
+ parsedJson: Record<string, string | number | boolean | null>;
4672
4672
  sender: string;
4673
4673
  transactionModule: string;
4674
4674
  bcs: string;
@@ -5348,7 +5348,7 @@ export declare const CallOutputSchema: z.ZodObject<{
5348
5348
  };
5349
5349
  bcsEncoding: "base64";
5350
5350
  packageId: string;
5351
- parsedJson: Record<string, string | number | boolean>;
5351
+ parsedJson: Record<string, string | number | boolean | null>;
5352
5352
  sender: string;
5353
5353
  transactionModule: string;
5354
5354
  bcs: string;
@@ -5361,7 +5361,7 @@ export declare const CallOutputSchema: z.ZodObject<{
5361
5361
  };
5362
5362
  bcsEncoding: "base58";
5363
5363
  packageId: string;
5364
- parsedJson: Record<string, string | number | boolean>;
5364
+ parsedJson: Record<string, string | number | boolean | null>;
5365
5365
  sender: string;
5366
5366
  transactionModule: string;
5367
5367
  bcs: string;
@@ -5638,7 +5638,7 @@ export declare const CallOutputSchema: z.ZodObject<{
5638
5638
  };
5639
5639
  bcsEncoding: "base64";
5640
5640
  packageId: string;
5641
- parsedJson: Record<string, string | number | boolean>;
5641
+ parsedJson: Record<string, string | number | boolean | null>;
5642
5642
  sender: string;
5643
5643
  transactionModule: string;
5644
5644
  bcs: string;
@@ -5651,7 +5651,7 @@ export declare const CallOutputSchema: z.ZodObject<{
5651
5651
  };
5652
5652
  bcsEncoding: "base58";
5653
5653
  packageId: string;
5654
- parsedJson: Record<string, string | number | boolean>;
5654
+ parsedJson: Record<string, string | number | boolean | null>;
5655
5655
  sender: string;
5656
5656
  transactionModule: string;
5657
5657
  bcs: string;
@@ -6339,7 +6339,7 @@ export declare const CallOutputSchema: z.ZodObject<{
6339
6339
  };
6340
6340
  bcsEncoding: "base64";
6341
6341
  packageId: string;
6342
- parsedJson: Record<string, string | number | boolean>;
6342
+ parsedJson: Record<string, string | number | boolean | null>;
6343
6343
  sender: string;
6344
6344
  transactionModule: string;
6345
6345
  bcs: string;
@@ -6352,7 +6352,7 @@ export declare const CallOutputSchema: z.ZodObject<{
6352
6352
  };
6353
6353
  bcsEncoding: "base58";
6354
6354
  packageId: string;
6355
- parsedJson: Record<string, string | number | boolean>;
6355
+ parsedJson: Record<string, string | number | boolean | null>;
6356
6356
  sender: string;
6357
6357
  transactionModule: string;
6358
6358
  bcs: string;
@@ -6737,7 +6737,7 @@ export declare const CallOutputSchema: z.ZodObject<{
6737
6737
  };
6738
6738
  bcsEncoding: "base64";
6739
6739
  packageId: string;
6740
- parsedJson: Record<string, string | number | boolean>;
6740
+ parsedJson: Record<string, string | number | boolean | null>;
6741
6741
  sender: string;
6742
6742
  transactionModule: string;
6743
6743
  bcs: string;
@@ -6750,7 +6750,7 @@ export declare const CallOutputSchema: z.ZodObject<{
6750
6750
  };
6751
6751
  bcsEncoding: "base58";
6752
6752
  packageId: string;
6753
- parsedJson: Record<string, string | number | boolean>;
6753
+ parsedJson: Record<string, string | number | boolean | null>;
6754
6754
  sender: string;
6755
6755
  transactionModule: string;
6756
6756
  bcs: string;
@@ -0,0 +1,5 @@
1
+ import type { CallOutput } from "./base.js";
2
+ export declare function handleBridgeOperations(args: any): Promise<{
3
+ content: any[];
4
+ structuredContent: CallOutput;
5
+ }>;
@@ -0,0 +1,234 @@
1
+ import { BridgeClient, LocalMark, } from "@wowok/wowok";
2
+ let _bridgeClient = null;
3
+ let _bridgeClientEnv = null;
4
+ function getBridgeClient(env) {
5
+ const envObj = env || {};
6
+ const curAccount = envObj?.account;
7
+ if (_bridgeClient === null || _bridgeClientEnv === null || curAccount !== _bridgeClientEnv?.account) {
8
+ _bridgeClient = new BridgeClient({ wowEnv: envObj });
9
+ _bridgeClientEnv = envObj;
10
+ }
11
+ return _bridgeClient;
12
+ }
13
+ function getBridgeClientForQuery() {
14
+ if (_bridgeClient !== null)
15
+ return _bridgeClient;
16
+ _bridgeClient = new BridgeClient({});
17
+ _bridgeClientEnv = {};
18
+ return _bridgeClient;
19
+ }
20
+ function validateMainnet(env) {
21
+ const network = env?.network;
22
+ if (network && network !== "mainnet") {
23
+ throw new Error(`Bridge only supports WOW mainnet (current network: '${network}'). Only mainnet provides cross-chain functionality.`);
24
+ }
25
+ }
26
+ async function resolveWowAddress(addrOrName, env) {
27
+ if (!addrOrName) {
28
+ const acc = env?.account;
29
+ return acc;
30
+ }
31
+ if (/^0x[0-9a-fA-F]{64}$/.test(addrOrName))
32
+ return addrOrName;
33
+ try {
34
+ const addr = await LocalMark.Instance().get_address(addrOrName);
35
+ if (addr)
36
+ return addr;
37
+ return addrOrName;
38
+ }
39
+ catch {
40
+ return addrOrName;
41
+ }
42
+ }
43
+ function safeJson(obj) {
44
+ return JSON.stringify(obj, (_k, v) => typeof v === "bigint" ? v.toString() : v, 2);
45
+ }
46
+ function convertBigInts(obj) {
47
+ if (typeof obj === "bigint")
48
+ return obj.toString();
49
+ if (Array.isArray(obj))
50
+ return obj.map(convertBigInts);
51
+ if (obj && typeof obj === "object") {
52
+ const out = {};
53
+ for (const k of Object.keys(obj))
54
+ out[k] = convertBigInts(obj[k]);
55
+ return out;
56
+ }
57
+ return obj;
58
+ }
59
+ function ok(message, result) {
60
+ const safeResult = convertBigInts(result);
61
+ const output = { message, result: { type: "data", data: safeResult } };
62
+ return {
63
+ content: [
64
+ { type: "text", text: message },
65
+ { type: "text", text: safeJson(safeResult) },
66
+ ],
67
+ structuredContent: output,
68
+ };
69
+ }
70
+ function err(message) {
71
+ const output = { message, result: { type: "error", error: message } };
72
+ return {
73
+ content: [{ type: "text", text: message }],
74
+ structuredContent: output,
75
+ };
76
+ }
77
+ export async function handleBridgeOperations(args) {
78
+ if (!args || typeof args !== "object") {
79
+ return err("Invalid args: expected an object with operation_type");
80
+ }
81
+ let validated;
82
+ try {
83
+ const { strictParse } = await import("./base.js");
84
+ validated = strictParse((await import("./bridge.js")).BridgeOperationsSchema, args, "bridge_operations input");
85
+ }
86
+ catch (e) {
87
+ return err(`Parameter validation failed: ${e?.message ?? String(e)}`);
88
+ }
89
+ const env = validated.env;
90
+ try {
91
+ switch (validated.operation_type) {
92
+ case "cross_chain_wow_to_evm": {
93
+ validateMainnet(env);
94
+ const data = validated.data;
95
+ const client = getBridgeClient(env);
96
+ const result = await client.bridgeWowToEvmSimple({
97
+ token: data.token,
98
+ amount: BigInt(data.amount),
99
+ withdrawTo: data.withdrawTo,
100
+ waitForFinalization: false,
101
+ });
102
+ return ok(`WOW→EVM cross-chain step 1 (deposit) submitted. transferId=${result.transferId}, activeEvmAccount=${result.activeEvmAccount}. ` +
103
+ `Next: poll query_transfer_status until bridge signs (~1-5 min), then call claim_wow_to_evm to complete.`, result);
104
+ }
105
+ case "cross_chain_evm_to_wow": {
106
+ validateMainnet(env);
107
+ const data = validated.data;
108
+ const recipientWowAddress = await resolveWowAddress(data.recipientWowAddress, env);
109
+ const client = getBridgeClient(env);
110
+ const result = await client.bridgeEvmToWowSimple({
111
+ token: data.token,
112
+ amount: BigInt(data.amount),
113
+ recipientWowAddress,
114
+ waitForFinalization: false,
115
+ });
116
+ return ok(`EVM→WOW cross-chain submitted. transferId=${result.transferId}, activeEvmAccount=${result.activeEvmAccount}. ` +
117
+ `Bridge will auto-claim on WOW (~10-20 min). Poll query_transfer_status to monitor progress.`, result);
118
+ }
119
+ case "claim_wow_to_evm": {
120
+ validateMainnet(env);
121
+ const data = validated.data;
122
+ const client = getBridgeClient(env);
123
+ const result = await client.claimWowToEvm(data.transferId);
124
+ return ok(`WOW→EVM claim (step 2) completed. transferId=${result.transferId}, claimTxHash=${result.claimTxHash}`, result);
125
+ }
126
+ case "withdraw": {
127
+ const data = validated.data;
128
+ const client = getBridgeClientForQuery();
129
+ let tokenAddress = data.tokenAddress;
130
+ if (!tokenAddress && data.token && data.token !== "ETH") {
131
+ const cfg = client.config;
132
+ const chain = cfg?.evmChains?.find((c) => c.name === (data.network ?? "mainnet"));
133
+ const tokenMeta = chain?.tokens?.find((t) => t.symbol === data.token);
134
+ tokenAddress = tokenMeta?.evmAddress;
135
+ if (!tokenAddress) {
136
+ return err(`Cannot resolve ERC20 token address for symbol '${data.token}' on chain '${data.network ?? "mainnet"}'. Please pass tokenAddress explicitly.`);
137
+ }
138
+ }
139
+ const result = await client.withdrawFromActiveEvmAccount({
140
+ to: data.to,
141
+ amount: BigInt(data.amount),
142
+ tokenAddress,
143
+ token: data.token ? data.token : undefined,
144
+ network: data.network,
145
+ });
146
+ return ok(`Withdrawal submitted. transferId=${result.transferId}, txHash=${result.txHash}`, result);
147
+ }
148
+ case "query_active_evm_account": {
149
+ const data = validated.data ?? {};
150
+ const client = getBridgeClientForQuery();
151
+ const result = await client.queryActiveEvmAccount({
152
+ network: data.network,
153
+ tokens: data.tokens,
154
+ });
155
+ return ok(`activeEvmAccount: ${result.address} (${result.chains.length} chain(s))`, result);
156
+ }
157
+ case "query_supported_evm_chains": {
158
+ const client = getBridgeClientForQuery();
159
+ const result = await client.querySupportedEvmChains();
160
+ return ok(`${result.length} EVM chain(s) supported: ${result.map(c => `${c.name}(chainId=${c.chainId})`).join(", ")}`, result);
161
+ }
162
+ case "query_supported_tokens": {
163
+ const data = validated.data ?? {};
164
+ const client = getBridgeClientForQuery();
165
+ const result = await client.querySupportedTokens({
166
+ network: data.network,
167
+ });
168
+ const totalTokens = result.reduce((sum, c) => sum + c.tokens.length, 0);
169
+ return ok(`${result.length} chain(s), ${totalTokens} token entries: ${result.map((c) => `${c.chainName}(${c.tokens.length} tokens)`).join(", ")}`, result);
170
+ }
171
+ case "query_transfer_list": {
172
+ const data = validated.data ?? {};
173
+ const client = getBridgeClientForQuery();
174
+ let result = await client.queryTransferList({
175
+ onlyActive: data.onlyActive,
176
+ });
177
+ if (data.status) {
178
+ result = result.filter((r) => r.status === data.status);
179
+ }
180
+ if (data.direction) {
181
+ result = result.filter((r) => r.direction === data.direction);
182
+ }
183
+ if (data.token) {
184
+ result = result.filter((r) => r.token === data.token);
185
+ }
186
+ if (data.limit && data.limit > 0) {
187
+ result = result.slice(0, data.limit);
188
+ }
189
+ const active = result.filter(r => r.status !== "success" && r.status !== "failed").length;
190
+ return ok(`${result.length} transfer record(s) (${active} in progress)${data.status || data.direction || data.token ? " (filtered)" : ""}`, result);
191
+ }
192
+ case "query_transfer_status": {
193
+ const data = validated.data;
194
+ const client = getBridgeClientForQuery();
195
+ const refresh = data.refresh !== false;
196
+ if (refresh) {
197
+ try {
198
+ await Promise.race([
199
+ client.refreshTransferStatus(data.transferId),
200
+ new Promise((_, reject) => setTimeout(() => reject(new Error("refresh timeout")), 15_000)),
201
+ ]);
202
+ }
203
+ catch {
204
+ }
205
+ }
206
+ const result = await client.queryTransferStatus(data.transferId);
207
+ if (!result) {
208
+ return err(`transferId '${data.transferId}' not found. ` +
209
+ `Use query_transfer_list to see all valid transferIds. ` +
210
+ `Note: transfer history is persisted in cache.db and restored on MCP restart, ` +
211
+ `so this transferId may never have been created in this environment.`);
212
+ }
213
+ return ok(`Transfer ${data.transferId}: ${result.direction} / ${result.step} / ${result.status}`, result);
214
+ }
215
+ case "manage_evm_rpc": {
216
+ const data = validated.data;
217
+ const client = getBridgeClientForQuery();
218
+ const result = await client.manageEvmRpc({
219
+ op: data.op,
220
+ network: data.network,
221
+ rpcUrls: data.rpcUrls,
222
+ });
223
+ return ok(`RPC '${data.op}' operation ${result.success ? "succeeded" : "failed"}`, result);
224
+ }
225
+ default: {
226
+ return err(`Unsupported operation_type: ${validated.operation_type}`);
227
+ }
228
+ }
229
+ }
230
+ catch (e) {
231
+ const msg = e?.message ?? String(e);
232
+ return err(`Bridge operation failed: ${msg}`);
233
+ }
234
+ }