Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Dynamic codec namespaces #218

Open
Open
@0x009922

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 via client.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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /