I have custom RPC
, which looks like so
#[rpc(client, server)]
pub trait SomeRpcApi {
#[method(name = "some_submitData")]
async fn submit_data(
&self,
id: u64,
message: [u8; 32],
) -> RpcResult<()>;
}
and I'm trying to call it using this TS script
const api = await ApiPromise.create({
provider: wsProvider,
rpc: {
some: {
submitData: {
description: '',
params: [
{
name: 'id',
type: 'u64'
},
{
name: 'message',
type: '[u8; 32]'
}
],
type: 'RpcResult<((), u32)>'
}
}
}
});
const message = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32]);
const id = api.createType('u64', 1);
const data = api.createType('[u8; 32]', message);
const resp = await api.rpc.time.submitForSigning(id, data);
bun on submitting I'm getting this error:
RPC-CORE: submitData(id: u64, message: [u8; 32]): RpcResult<((), u32)>:: -32602: invalid type: string "0x1ddf7f02f19991b8e2b56d7e325f05835bb1d66b5c0d87ba98b4230f2a28c085", expected a sequence at line 1 column 68
Where's the issue here? Thanks.
Vec<u8>
and getting this error on it's construction:Error: createType(Vec<u8>):: Bytes: required length less than remainder, expected at least 14281, found 32
polkadot-v0.9.30
if that helps.Vec<u8>
works with 10 bytes at most, and then error...