wrap-cli icon indicating copy to clipboard operation
wrap-cli copied to clipboard

Configurable Invoker Encoding

Open dOrgJelli opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. Currently invocations are done in a way that assumes a specific type of encoding. The current Polywrap encoding standard is based on msgpack, but we have talked about using other standards such as JSON and IPLD.

Describe the solution you'd like Invokers can be configured with different encoding schemes. These can be added to the invoker upon creation. Currently invokers live within the client so you would need to add this to the client's constructor:

new PolywrapClient({
  encoding: [msgpack, json, wasm_bindgen, extendable]
});

// where "extendable" is an encoder that loads other encoders
wrapEncoderWrappers = [
  "wrap://ens/domain.eth/new-encoder"
];

Also it's important to think about "lazy copying / encoding" when passing data between modules. If this existed, encoding could happen on-the-fly, and possibly on a per-property bassis.

Here's a fun sketch, not to be taken too seriously: image

Describe alternatives you've considered Unsure, would love to hear more opinions!

Additional context @Niraj-Kamdar and others have talked about IPLD encoding a lot, and @nerfZael had recently done some investigation into JSON / JSValue wasm encoding as well. I've done research into wasm-bindgen.

dOrgJelli avatar Aug 24 '22 20:08 dOrgJelli