1- import { ForeignCallResult , ForeignCallParams } from './types.js' ;
1+ import { ForeignCallResult , ForeignCallParams , ResolveForeignCallResult } from './types.js' ;
22import { decodeNoirArguments , encodeForeignCallResult , encodeForeignCallResultNew } from './encode.js' ;
33import { MultiChainClient } from '../../../ethereum/client.js' ;
44import { Oracle , RpcOracle } from '../types.js' ;
@@ -12,7 +12,8 @@ import { Oracle, RpcOracle } from '../types.js';
1212// This needs to be a type, not an interface because TypedJSONRPCServer requires it to have an index signature.
1313/* eslint-disable-next-line @typescript-eslint/consistent-type-definitions */
1414export type JSONRPCServerMethods = {
15- resolve_foreign_call ( params : any , serverParams : ServerParams ) : Promise < ForeignCallResult > ;
15+ // Note: resolve_foreign_call is not included here as it has a different signature (requires serverParams)
16+ // It's added directly in app.ts using jsonRPCServer.addMethod()
1617 get_header ( params : ForeignCallParams ) : ForeignCallResult ;
1718 get_account ( params : ForeignCallParams ) : ForeignCallResult ;
1819 get_proof ( params : ForeignCallParams ) : ForeignCallResult ;
@@ -42,7 +43,7 @@ export async function getOracleHandler(oracle: Oracle, params: ForeignCallParams
4243}
4344
4445// New protocol handler (for resolve_foreign_call)
45- export async function getOracleHandlerNew ( oracle : Oracle , params : ForeignCallParams ) : Promise < { values : ( string | string [ ] ) [ ] } > {
46+ export async function getOracleHandlerNew ( oracle : Oracle , params : ForeignCallParams ) : Promise < ResolveForeignCallResult > {
4647 const noirArguments = decodeNoirArguments ( params ) ;
4748 const noirOutputs = await oracle ( noirArguments ) ;
4849 const result = encodeForeignCallResultNew ( noirOutputs ) ;
@@ -53,7 +54,7 @@ export async function getRpcOracleHandlerNew(
5354 rpcOracle : RpcOracle ,
5455 params : ForeignCallParams ,
5556 { client } : ServerParams
56- ) : Promise < { values : ( string | string [ ] ) [ ] } > {
57+ ) : Promise < ResolveForeignCallResult > {
5758 const oracle = rpcOracle . bind ( null , client ) ;
5859 return getOracleHandlerNew ( oracle , params ) ;
5960}
0 commit comments