I'm trying to call a contract located in Aurora from a contract located in Near. I'm using AssemblyScript and I'm struggling with passing arguments to the Aurora contract itself. I receive ERR_BORSH_DESERIALIZE panic from the Aurora contract. Can anybody help me with figuring out how I would encode arguments? Here is sample code:
import { BorshSerializer } from '@serial-as/borsh'
@serializable
class FunctionCallArgs {
contract: Uint8Array;
input: Uint8Array;
}
export function myFunction(): void {
const args: FunctionCallArgs = {
contract: util.stringToBytes(contractAddress),
input: util.stringToBytes(abiEncodedFn),
};
const argsBorsh = BorshSerializer.encode(args);
ContractPromise.create("aurora", "call", argsBorsh, 100);
}
I managed to find a solution. The flow of calling the contract was right, however I had two errors in implementation.
And finally monkey-patched "encode_static_array" method in the library to not allocate space before adding bytes to buffer. So removed: