Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/dirty-kids-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sei-js/mcp-server": patch
---

Move to Record type for writeContract params arg
4 changes: 2 additions & 2 deletions packages/mcp-server/src/core/services/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function readContract(params: ReadContractParameters, network = DEF
* @returns Transaction hash
* @throws Error if no private key is available
*/
export async function writeContract(params: WriteContractParameters, network = DEFAULT_NETWORK): Promise<Hash> {
export async function writeContract(params: Record<string, any>, network = DEFAULT_NETWORK): Promise<Hash> {
// Get private key from environment
const key = getPrivateKeyAsHex();

Expand All @@ -28,7 +28,7 @@ export async function writeContract(params: WriteContractParameters, network = D
}

const client = getWalletClient(key, network);
return await client.writeContract(params);
return await client.writeContract(params as any);
}

/**
Expand Down
6 changes: 2 additions & 4 deletions packages/mcp-server/src/core/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,13 +797,11 @@ export function registerEVMTools(server: McpServer) {
// Parse ABI if it's a string
const parsedAbi = typeof abi === 'string' ? JSON.parse(abi) : abi;

const contractParams: WriteContractParameters = {
const contractParams: Record<string, any> = {
address: contractAddress as Address,
abi: parsedAbi,
functionName,
args,
chain: null, // This will use the default chain from the client
account: null // This will use the default account from the client
args
};

const txHash = await services.writeContract(contractParams, network);
Expand Down
4 changes: 1 addition & 3 deletions packages/mcp-server/src/tests/core/tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1968,9 +1968,7 @@ describe('EVM Tools', () => {
address: writeParams.contractAddress,
abi: writeParams.abi,
functionName: writeParams.functionName,
args: writeParams.args,
chain: null, // This is added by the implementation
account: null // This is added by the implementation
args: writeParams.args
},
'sei' // DEFAULT_NETWORK
);
Expand Down