RPC-CORE: getApps(acc: AccountId): undefined:: -32602: Invalid params: 0x prefix is missing. Error: -32602: Invalid params: 0x prefix is missing

Viewed 52
 const api = await ApiPromise.create({provider:wsProvider,
rpc:{
  cf:{
    getApps:{
      description:"JUST For Test",
      params:[{
        name:"acc",
        type:"AccountId"
      }]
    }
  }
}});
const alice = keyring.addFromUri('//Alice');
let ker = crypto.encodeDerivedAddress(alice.publicKey,0);
let d =  await api.rpc.cf.getApps(ker);

Rust Pallet Code

//function which I am calling
pub fn get_apps(acc:T::AccountId)->Vec<Vec<u8>>{
let data = <AppStore<T>>::get(acc);
data
}

Rust RPC

use jsonrpc_core::{Error as RpcError, ErrorCode, Result};
use jsonrpc_derive::rpc;
use sp_api::ProvideRuntimeApi;
use sp_blockchain::HeaderBackend;
use sp_runtime::{generic::BlockId,traits::Block as BlockT};
use std::sync::Arc;
use cf_runtime::AppApi as AppStorageApi;

#[rpc]
 pub trait AppApi<BlockHash,AccountId>{  
#[rpc(name="cf_getApps")]
fn get_apps(&self,at:Option<BlockHash>,acc:AccountId)->Result<Vec<Vec<u8>>>;
}

I have tried other prefix like 42 , 5 ,2 but not getting success , I did't understand anything how this error come again and again , and what is the default prefix for substrate node.

0 Answers
Related