get_wallet_info
Retrieve wallet information for Solana accounts, including address, balance, and token details, from the connected P-Link payment system.
Instructions
Retrieve the wallet infos about the connected P-Link account (Solana wallet address, wallet balance, tokens detail)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pubk | No | The Solana address of the wallet you want to see, if not provided, uses the currently connected user wallet address. |
Implementation Reference
- src/tools/payments.ts:107-143 (handler)The main handler function that retrieves wallet information by making API calls to get user details and wallet balance.export async function get_my_wallet_info(reqBody: any) { var pubk = ''; var result = {error:'Not found'} as any if (reqBody.pubk) { pubk = reqBody.pubk; result = { pubk } } else { const { apiKey } = resolveAuth(undefined, undefined); var jsP = { myKey: apiKey } const fet = await fetch(BASE + '/api/getAPIUser', { method: 'POST', headers: { Accept: 'application.json', 'Content-Type': 'application/json' }, body: JSON.stringify(jsP) }); var dat = await fet.text(); result = JSON.parse(dat); pubk = result.pubk; } if (pubk) { const walletInfos = await fetch(BASE + '/api/walletInfos/' + pubk + '/1/'+(new Date().getTime()), { method: 'POST', body: JSON.stringify(reqBody) }); const walletBalance = await walletInfos.json(); result = { ...result, ...walletBalance }; return result; } throw Error("Invalid API_KEY"); }
- src/tools/payments.ts:40-42 (schema)Zod schema defining the optional 'pubk' input parameter for the get_wallet_info tool.export const getGetWalletInfosShape = { pubk: z.string().optional().describe("The Solana address of the wallet you want to see, if not provided, uses the currently connected user wallet address.") };
- src/solution.ts:62-67 (registration)Tool registration in the tools list returned by ListToolsRequestHandler, including name, description, inputSchema, and annotations.{ name: "get_wallet_info", description: get_my_wallet_info_title, inputSchema: jsonSchema(zodToJsonSchema(z.object(getGetWalletInfosShape))).jsonSchema, annotations: { title: get_my_wallet_info_title, readOnlyHint: true } },
- src/solution.ts:142-144 (registration)Dispatch case in the CallToolRequestHandler switch statement that invokes the get_my_wallet_info handler.case "get_wallet_info": result = await get_my_wallet_info(args); break;