iroha-javascript icon indicating copy to clipboard operation
iroha-javascript copied to clipboard

Examples for the documentation

Open 6r1d opened this issue 3 years ago • 4 comments

Hello.

I'd like to add the common language guide to the Iroha documentation. Since Iroha-JS very convenient for the users, it is necessary for the examples.

How stable are the examples displayed in the JavaScript tutorial?

I am mostly interested in:

  • [ ] Loading the JSON configuration for Iroha so it could be used by the JavaScript library
  • [ ] Client setup, given the configuration above
  • [ ] Registering an Iroha domain
  • [ ] Registering an Iroha account
  • [ ] Registering an asset
  • [ ] Minting an asset mentioned above
  • [ ] Listing domains / accounts / assets, displaying an output

Potentially, it'll be great to enable these examples as tests, marking the parts useful for the end user with the comments.

6r1d avatar Oct 18 '22 15:10 6r1d

Hello!

Currently the repo already has documentation examples here: https://github.com/hyperledger/iroha-javascript/tree/iroha2/packages/docs-recipes/src

They are not a part of end-2-end tests, but they are type-checked. Tests has a significant part of this functionality, but I don't think it makes sense to write everything you've listed as tests. They have a bit different goal.

Anyway, I think it is worth to re-write current "documentation recipes" to both align your interests and to include them into documentation via snippets mechanism.

0x009922 avatar Oct 28 '22 05:10 0x009922

@6r1d, I think the issue was resolved with https://github.com/hyperledger/iroha-2-docs/pull/234. Could you verify it?

0x009922 avatar Feb 27 '23 08:02 0x009922

Related issues:

  • https://github.com/hyperledger/iroha-2-docs/issues/275
  • https://github.com/hyperledger/iroha-2-docs/issues/276

0x009922 avatar Mar 10 '23 10:03 0x009922

Hello!

These links appear empty:

  • packages/docs-recipes/src/5.1.register-asset.ts
  • packages/docs-recipes/src/5.2.mint-registered-asset.ts

So there are no samples for registering assets. In particular, I'm looking for an example of working with stores. There seems to be none.

I was able to figure out how to register new store data by looking at a sample from rust:

const storeAssetInstruction = SetKeyValueExpr({
    object_id: Expression('Raw', Value('Id', IdBox('AssetId', assetId))),
    key: Expression('Raw', Value('Name', 'ping')),
    value: Expression('Raw', Value('String', 'pong')),
  });

But it'd be great to have a sample for JS.

matisalimbene avatar Dec 18 '23 19:12 matisalimbene