@moonpay/cli 0.5.0 → 0.5.2
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/dist/{chunk-AH5VMN63.js → chunk-PBRXVTTG.js} +299 -253
- package/dist/{chunk-AH5VMN63.js.map → chunk-PBRXVTTG.js.map} +1 -1
- package/dist/index.js +68 -3
- package/dist/index.js.map +1 -1
- package/dist/{mcp-VOEHXIOY.js → mcp-TDQN25MO.js} +5 -119
- package/dist/mcp-TDQN25MO.js.map +1 -0
- package/package.json +1 -1
- package/skills/moonpay-mcp/SKILL.md +4 -6
- package/skills/moonpay-missions/SKILL.md +7 -2
- package/skills/moonpay-polymarket-ready/SKILL.md +112 -0
- package/skills/moonpay-swap-tokens/SKILL.md +33 -10
- package/dist/mcp-VOEHXIOY.js.map +0 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: moonpay-polymarket-ready
|
|
3
|
+
description: Fund a Polygon wallet for Polymarket trading. Buy POL for gas and bridge or buy USDC.e so the wallet is ready to trade.
|
|
4
|
+
tags: [trading, setup]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Polymarket ready
|
|
8
|
+
|
|
9
|
+
## Goal
|
|
10
|
+
|
|
11
|
+
Get a Polygon wallet funded with POL (gas) and USDC.e (trading) so it's ready for Polymarket.
|
|
12
|
+
|
|
13
|
+
Polymarket runs on Polygon. To trade, the user needs:
|
|
14
|
+
- **POL** — native gas token for transaction fees
|
|
15
|
+
- **USDC.e** (`0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174`) — the token Polymarket uses for bets
|
|
16
|
+
|
|
17
|
+
## Key addresses
|
|
18
|
+
|
|
19
|
+
| Token | Chain | Address |
|
|
20
|
+
|-------|-------|---------|
|
|
21
|
+
| POL (native) | Polygon | `0x0000000000000000000000000000000000000000` |
|
|
22
|
+
| USDC.e | Polygon | `0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174` |
|
|
23
|
+
| ETH (native) | Ethereum | `0x0000000000000000000000000000000000000000` |
|
|
24
|
+
|
|
25
|
+
## Workflow
|
|
26
|
+
|
|
27
|
+
### 1. Check or create wallet
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
mp wallet list
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The user's Polygon address is the same as their Ethereum address (EVM wallets share one address across all EVM chains).
|
|
34
|
+
|
|
35
|
+
If no wallets exist, create one:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
mp wallet create --name main
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 2. Check existing Polygon balances
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
mp token balance list --wallet <eth-address> --chain polygon
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
If the wallet already has POL and USDC.e, they're set.
|
|
48
|
+
|
|
49
|
+
### 3. Get POL for gas
|
|
50
|
+
|
|
51
|
+
Buy POL directly with fiat — easiest way to get gas on Polygon:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
mp buy --token pol --amount 5 --wallet <eth-address> --email <email>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Alternatively, bridge ETH → POL if the user already has ETH:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
mp token bridge \
|
|
61
|
+
--from-wallet <wallet-name> --from-chain ethereum \
|
|
62
|
+
--from-token 0x0000000000000000000000000000000000000000 \
|
|
63
|
+
--from-amount 0.001 \
|
|
64
|
+
--to-chain polygon \
|
|
65
|
+
--to-token 0x0000000000000000000000000000000000000000
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
~$2-5 worth of POL covers hundreds of transactions.
|
|
69
|
+
|
|
70
|
+
### 4. Get USDC.e for trading
|
|
71
|
+
|
|
72
|
+
Bridge ETH on Ethereum to USDC.e on Polygon in one step:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
mp token bridge \
|
|
76
|
+
--from-wallet <wallet-name> --from-chain ethereum \
|
|
77
|
+
--from-token 0x0000000000000000000000000000000000000000 \
|
|
78
|
+
--from-amount 0.005 \
|
|
79
|
+
--to-chain polygon \
|
|
80
|
+
--to-token 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Alternatively, if the user already has USDC on Ethereum, bridge it directly:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
mp token bridge \
|
|
87
|
+
--from-wallet <wallet-name> --from-chain ethereum \
|
|
88
|
+
--from-token 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 \
|
|
89
|
+
--from-amount 10 \
|
|
90
|
+
--to-chain polygon \
|
|
91
|
+
--to-token 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 5. Verify
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
mp token balance list --wallet <eth-address> --chain polygon
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Confirm both POL and USDC.e are present.
|
|
101
|
+
|
|
102
|
+
## Tips
|
|
103
|
+
|
|
104
|
+
- Bridge times from Ethereum → Polygon are typically 5-20 seconds
|
|
105
|
+
- POL is very cheap for gas — a few dollars covers hundreds of transactions
|
|
106
|
+
- The fiat buy option (`mp buy`) is the fastest path if the user has no crypto yet
|
|
107
|
+
|
|
108
|
+
## Related skills
|
|
109
|
+
|
|
110
|
+
- **moonpay-swap-tokens** — Bridge commands and supported chains
|
|
111
|
+
- **moonpay-check-wallet** — Check Polygon balances
|
|
112
|
+
- **moonpay-buy-crypto** — Buy POL or ETH with fiat
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: moonpay-swap-tokens
|
|
3
|
-
description: Swap or bridge tokens across chains. Use when the user wants to swap, bridge, or move tokens
|
|
3
|
+
description: Swap tokens on the same chain or bridge tokens across chains. Use when the user wants to swap, bridge, or move tokens.
|
|
4
4
|
tags: [trading]
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -8,29 +8,51 @@ tags: [trading]
|
|
|
8
8
|
|
|
9
9
|
## Goal
|
|
10
10
|
|
|
11
|
-
Swap tokens on
|
|
11
|
+
Swap tokens on the same chain, or bridge tokens across chains. Two commands:
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
- **`mp token swap`** — same chain, different tokens
|
|
14
|
+
- **`mp token bridge`** — cross chain
|
|
15
|
+
|
|
16
|
+
Both build via swaps.xyz, sign locally, broadcast, and register for tracking.
|
|
17
|
+
|
|
18
|
+
## Commands
|
|
19
|
+
|
|
20
|
+
### Swap (same chain)
|
|
14
21
|
|
|
15
22
|
```bash
|
|
16
23
|
mp token swap \
|
|
24
|
+
--wallet <wallet-name> \
|
|
25
|
+
--chain <chain> \
|
|
26
|
+
--from-token <token-address> \
|
|
27
|
+
--from-amount <amount> \
|
|
28
|
+
--to-token <token-address>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Supports exact-out: use `--to-amount` instead of `--from-amount`.
|
|
32
|
+
|
|
33
|
+
### Bridge (cross chain)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
mp token bridge \
|
|
17
37
|
--from-wallet <wallet-name> \
|
|
18
38
|
--from-chain <chain> \
|
|
19
39
|
--from-token <token-address> \
|
|
20
40
|
--from-amount <amount> \
|
|
41
|
+
--to-chain <chain> \
|
|
21
42
|
--to-token <token-address> \
|
|
22
|
-
--to-chain <chain> # optional, defaults to from-chain
|
|
23
43
|
--to-wallet <wallet-name> # optional, defaults to from-wallet
|
|
24
44
|
```
|
|
25
45
|
|
|
46
|
+
Supports exact-out: use `--to-amount` instead of `--from-amount`.
|
|
47
|
+
|
|
26
48
|
## Examples
|
|
27
49
|
|
|
28
50
|
### Same-chain swap (SOL → USDC on Solana)
|
|
29
51
|
|
|
30
52
|
```bash
|
|
31
53
|
mp token swap \
|
|
32
|
-
--
|
|
33
|
-
--from-token
|
|
54
|
+
--wallet main --chain solana \
|
|
55
|
+
--from-token So11111111111111111111111111111111111111111 \
|
|
34
56
|
--from-amount 0.1 \
|
|
35
57
|
--to-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
|
|
36
58
|
```
|
|
@@ -38,7 +60,7 @@ mp token swap \
|
|
|
38
60
|
### Cross-chain bridge (ETH → USDC.e on Polygon)
|
|
39
61
|
|
|
40
62
|
```bash
|
|
41
|
-
mp token
|
|
63
|
+
mp token bridge \
|
|
42
64
|
--from-wallet funded --from-chain ethereum \
|
|
43
65
|
--from-token 0x0000000000000000000000000000000000000000 \
|
|
44
66
|
--from-amount 0.003 \
|
|
@@ -50,7 +72,7 @@ mp token swap \
|
|
|
50
72
|
|
|
51
73
|
```bash
|
|
52
74
|
mp token swap \
|
|
53
|
-
--
|
|
75
|
+
--wallet funded --chain polygon \
|
|
54
76
|
--from-token 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 \
|
|
55
77
|
--from-amount 5 \
|
|
56
78
|
--to-token 0x0000000000000000000000000000000000000000
|
|
@@ -69,12 +91,13 @@ solana, ethereum, base, polygon, arbitrum, optimism, bnb, avalanche, bitcoin (br
|
|
|
69
91
|
5. Broadcasts to the network
|
|
70
92
|
6. Registers for tracking
|
|
71
93
|
|
|
94
|
+
`token swap` calls `token bridge` under the hood with `from-chain` = `to-chain`.
|
|
95
|
+
|
|
72
96
|
## Tips
|
|
73
97
|
|
|
74
98
|
- If the user provides token names/symbols, resolve to addresses with `mp token search --query "USDC" --chain solana`
|
|
75
99
|
- Check balances first with `mp token balance list --wallet <address> --chain <chain>`
|
|
76
|
-
-
|
|
77
|
-
- Native tokens use `0x0000000000000000000000000000000000000000` (EVM) or `So11111111111111111111111111111111111111112` (Solana)
|
|
100
|
+
- Native tokens use `0x0000000000000000000000000000000000000000` (EVM) or `So11111111111111111111111111111111111111111` (Solana)
|
|
78
101
|
|
|
79
102
|
## Related skills
|
|
80
103
|
|
package/dist/mcp-VOEHXIOY.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/mcp.ts","../src/tools/x402/request/tool.ts","../src/tools/x402/request/schema.ts"],"sourcesContent":["import { Server } from \"@modelcontextprotocol/sdk/server/index.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport { z } from \"zod\";\nimport { zodToJsonSchema } from \"zod-to-json-schema\";\nimport { callTool } from \"./client\";\nimport { resolveBaseUrl } from \"./auth\";\nimport type { Tool } from \"./tools/shared\";\nimport { walletCreate } from \"./tools/wallet/create/tool\";\nimport { walletImport } from \"./tools/wallet/import/tool\";\nimport { walletList } from \"./tools/wallet/list/tool\";\nimport { walletRetrieve } from \"./tools/wallet/retrieve/tool\";\nimport { walletDelete } from \"./tools/wallet/delete/tool\";\nimport { transactionSign } from \"./tools/transaction/sign/tool\";\nimport { messageSign } from \"./tools/message/sign/tool\";\nimport { bitcoinBalanceRetrieve } from \"./tools/bitcoin/balance/tool\";\nimport { x402Request } from \"./tools/x402/request/tool\";\nimport { tokenSwap } from \"./tools/token/swap/tool\";\nimport { virtualAccountWalletRegister } from \"./tools/virtual-account/wallet/register/tool\";\nimport schemas from \"./generated/schemas.json\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst LOCAL_TOOLS: Tool<any>[] = [\n walletCreate,\n walletImport,\n walletList,\n walletRetrieve,\n walletDelete,\n transactionSign,\n messageSign,\n bitcoinBalanceRetrieve,\n x402Request,\n tokenSwap,\n virtualAccountWalletRegister,\n];\n\nconst localToolMap = new Map(LOCAL_TOOLS.map((t) => [t.schema.name, t]));\n\n/**\n * Resolve a remote schema's $ref to the actual properties object.\n */\nfunction resolveRemoteSchema(schema: (typeof schemas)[number]) {\n const input = schema.inputSchema as any;\n if (input.$ref && input.definitions) {\n const defName = input.$ref.replace(\"#/definitions/\", \"\");\n return input.definitions[defName] ?? input;\n }\n return input;\n}\n\nexport async function startMcpServer() {\n const server = new Server(\n { name: \"moonpay\", version: \"1.0.0\" },\n { capabilities: { tools: { listChanged: true } } },\n );\n\n // Build tool definitions — local tools use Zod→JSON, remote use JSON directly\n const toolDefs: Array<{\n name: string;\n description: string;\n inputSchema: Record<string, unknown>;\n }> = LOCAL_TOOLS.map((tool) => ({\n name: tool.schema.name,\n description: tool.schema.description,\n inputSchema: zodToJsonSchema(tool.schema.input) as Record<string, unknown>,\n }));\n\n const remotePropsMap = new Map<string, Record<string, any>>();\n for (const schema of schemas) {\n if (localToolMap.has(schema.name)) continue;\n const resolved = resolveRemoteSchema(schema);\n remotePropsMap.set(\n schema.name,\n (resolved.properties ?? {}) as Record<string, any>,\n );\n toolDefs.push({\n name: schema.name,\n description: schema.description,\n inputSchema: {\n type: \"object\",\n properties: resolved.properties ?? {},\n ...(resolved.required ? { required: resolved.required } : {}),\n ...(resolved.additionalProperties !== undefined\n ? { additionalProperties: resolved.additionalProperties }\n : {}),\n },\n });\n }\n\n const toolDefMap = new Map(toolDefs.map((t) => [t.name, t]));\n\n // tools/list — return raw JSON schemas directly\n server.setRequestHandler(ListToolsRequestSchema, async () => ({\n tools: toolDefs.map((t) => ({\n name: t.name,\n description: t.description,\n inputSchema: t.inputSchema,\n })),\n }));\n\n // tools/call\n server.setRequestHandler(CallToolRequestSchema, async (request) => {\n const { name, arguments: params = {} } = request.params;\n\n if (!toolDefMap.has(name)) {\n return {\n content: [{ type: \"text\" as const, text: `Unknown tool: ${name}` }],\n isError: true,\n };\n }\n\n try {\n // Local tool — coerce nullable fields then run handler\n const localTool = localToolMap.get(name);\n if (localTool) {\n // Fill missing nullable fields with null (MCP clients may omit them)\n const shape = (localTool.schema.input as z.ZodObject<z.ZodRawShape>).shape ?? {};\n for (const [key, field] of Object.entries(shape)) {\n if (\n params[key] === undefined &&\n (field as z.ZodTypeAny)._def.typeName === \"ZodNullable\"\n ) {\n params[key] = null;\n }\n }\n\n const result = await localTool.handler(params);\n return {\n content: [\n { type: \"text\" as const, text: JSON.stringify(result, null, 2) },\n ],\n };\n }\n\n // Remote tool — coerce types then call API\n const props = remotePropsMap.get(name) ?? {};\n for (const [key, prop] of Object.entries(props)) {\n if (params[key] === undefined) {\n const nullable = Array.isArray(prop.type)\n ? prop.type.includes(\"null\")\n : prop.anyOf?.some((t: any) => t.type === \"null\");\n if (nullable) params[key] = null;\n }\n const isNum =\n prop.type === \"number\" ||\n prop.type === \"integer\" ||\n (Array.isArray(prop.type) &&\n prop.type.some(\n (t: string) => t === \"number\" || t === \"integer\",\n )) ||\n prop.anyOf?.some(\n (t: any) => t.type === \"number\" || t.type === \"integer\",\n );\n if (isNum && typeof params[key] === \"string\") {\n params[key] = Number(params[key]);\n }\n }\n\n const baseUrl = resolveBaseUrl();\n const result = await callTool(baseUrl, name, params);\n return {\n content: [\n { type: \"text\" as const, text: JSON.stringify(result, null, 2) },\n ],\n };\n } catch (error) {\n return {\n content: [\n {\n type: \"text\" as const,\n text: error instanceof Error ? error.message : String(error),\n },\n ],\n isError: true,\n };\n }\n });\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n","import { Keypair, VersionedTransaction, VersionedMessage } from \"@solana/web3.js\";\nimport axios from \"axios\";\nimport { wrapAxiosWithPayment } from \"@x402/axios\";\nimport { x402Client } from \"@x402/core/client\";\nimport { ExactSvmScheme } from \"@x402/svm\";\nimport type { Address } from \"@solana/addresses\";\nimport type { SignatureDictionary } from \"@solana/signers\";\nimport type { Transaction } from \"@solana/transactions\";\nimport { createTool } from \"../../shared\";\nimport { findWalletOrThrow, resolveSigningKey } from \"../../wallet/store\";\nimport { x402RequestSchema } from \"./schema\";\n\nconst SOLANA_NETWORK = \"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp\" as const;\n\nfunction createLocalX402Client(walletAddress: string, secretKey: Uint8Array) {\n const keypair = Keypair.fromSecretKey(secretKey);\n\n const signer = {\n address: walletAddress as Address,\n signTransactions: async (\n transactions: readonly Transaction[],\n ): Promise<readonly SignatureDictionary[]> => {\n return transactions.map((transaction) => {\n const messageBytes = new Uint8Array(transaction.messageBytes);\n const message = VersionedMessage.deserialize(messageBytes);\n const numSigs = Object.keys(transaction.signatures).length;\n const tx = new VersionedTransaction(\n message,\n new Array(numSigs).fill(new Uint8Array(64)),\n );\n\n tx.sign([keypair]);\n\n const signerIndex = message.staticAccountKeys.findIndex(\n (key) => key.toBase58() === walletAddress,\n );\n if (signerIndex === -1) {\n throw new Error(\n `Wallet ${walletAddress} is not a signer for this transaction`,\n );\n }\n\n return {\n [walletAddress]: tx.signatures[signerIndex],\n } as SignatureDictionary;\n });\n },\n };\n\n const client = new x402Client();\n const svmScheme = new ExactSvmScheme(signer);\n client.register(SOLANA_NETWORK, svmScheme);\n client.registerV1(\"solana\", svmScheme);\n\n return wrapAxiosWithPayment(axios.create(), client);\n}\n\nexport const x402Request = createTool(\n x402RequestSchema,\n async ({ method, url, body, params, wallet: walletNameOrAddress }) => {\n const walletMetadata = findWalletOrThrow(walletNameOrAddress);\n const { privateKey, address } = resolveSigningKey(walletMetadata, \"solana\");\n const client = createLocalX402Client(address, privateKey);\n\n let response;\n switch (method) {\n case \"GET\":\n response = await client.get(url, { params });\n break;\n case \"POST\":\n response = await client.post(url, body || {}, { params });\n break;\n case \"PUT\":\n response = await client.put(url, body || {}, { params });\n break;\n case \"PATCH\":\n response = await client.patch(url, body || {}, { params });\n break;\n case \"DELETE\":\n response = await client.delete(url, { params });\n break;\n default:\n throw new Error(`Unsupported HTTP method: ${method}`);\n }\n\n return {\n status: response.status,\n data: response.data,\n headers: response.headers as Record<string, string>,\n };\n },\n);\n","import { z } from \"zod\";\nimport { defineToolSchema } from \"../../shared\";\n\nexport const x402RequestSchema = defineToolSchema({\n name: \"x402_request\",\n description:\n \"Make an HTTP request to an x402-protected endpoint. Automatically handles payment when a 402 Payment Required response is received, signing the payment transaction with the local wallet.\",\n input: z.object({\n method: z\n .enum([\"GET\", \"POST\", \"PUT\", \"PATCH\", \"DELETE\"])\n .describe(\"HTTP method\"),\n url: z\n .string()\n .url()\n .refine((u) => u.startsWith(\"https://\"), { message: \"URL must use HTTPS\" })\n .refine(\n (u) => {\n try {\n const host = new URL(u).hostname;\n return !host.match(/^(localhost|127\\.|10\\.|172\\.(1[6-9]|2\\d|3[01])\\.|192\\.168\\.|169\\.254\\.|0\\.0\\.0\\.0|\\[::1\\])/);\n } catch { return false; }\n },\n { message: \"URL must not target private/internal addresses\" },\n )\n .describe(\n \"Full HTTPS URL of the x402-protected endpoint (e.g., 'https://agents.moonpay.com/api/x402/tools/market_digest_retrieve')\",\n ),\n body: z\n .record(z.any())\n .nullable()\n .describe(\"Request body (for POST, PUT, PATCH)\"),\n params: z.record(z.any()).nullable().describe(\"Query parameters\"),\n wallet: z.string().describe(\"Wallet name or address to pay with\"),\n }),\n output: z.object({\n status: z.number().describe(\"HTTP status code\"),\n data: z.any().describe(\"Response data\"),\n headers: z.record(z.string()).describe(\"Response headers\"),\n }),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,SAAS,uBAAuB;;;ACPhC,SAAS,SAAS,sBAAsB,wBAAwB;AAChE,OAAO,WAAW;AAClB,SAAS,4BAA4B;AACrC,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;;;ACJ/B,SAAS,SAAS;AAGX,IAAM,oBAAoB,iBAAiB;AAAA,EAChD,MAAM;AAAA,EACN,aACE;AAAA,EACF,OAAO,EAAE,OAAO;AAAA,IACd,QAAQ,EACL,KAAK,CAAC,OAAO,QAAQ,OAAO,SAAS,QAAQ,CAAC,EAC9C,SAAS,aAAa;AAAA,IACzB,KAAK,EACF,OAAO,EACP,IAAI,EACJ,OAAO,CAAC,MAAM,EAAE,WAAW,UAAU,GAAG,EAAE,SAAS,qBAAqB,CAAC,EACzE;AAAA,MACC,C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