-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
Context:
- Iroha has a WASM-based executor, which could declare its data model via the same
schema.json
format as used for the main Iroha data model. It is available viaclient.find.executorDataModel()
. - Iroha JS "hardcodes" the main Iroha data model as static codecs
- Iroha JS doesn't provide tools to create a dynamic codec from the schema
In theory, the users of the SDK might want to use the schema returned from the FindExecutorDataModel
query to encode something. For this, the SDK could provide some tooling like this:
import type { SchemaDefinition } from '@iroha/core/data-model/schema'
// new API
import { DynamicNamespace } from '@iroha/core/codec'
const SCHEMA = {
Foo: {
Struct: [{ name: 'bar', type: 'String' }]
}
} satisfies SchemaDefinition
const ns = new DynamicNamespace(SCHEMA)
const fooEncoded = ns.get('Foo')!.encode({ bar: 'hey' })
Metadata
Metadata
Assignees
Labels
No labels