Skip to content

Commit

Permalink
Adapt documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
soerenbf committed Oct 2, 2023
1 parent 0beaf38 commit 8918814
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 127 deletions.
5 changes: 2 additions & 3 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ module.exports = {
tsconfigRootDir: __dirname,
project: [
'./packages/**/tsconfig.json',
'./packages/**/tsconfig.eslint.json',
'./tsconfig.eslint.json',
'./examples/tsconfig.eslint.json',
'./docs/**/tsconfig.json',
'**/tsconfig.eslint.json',
],
},
plugins: ['@typescript-eslint', 'import'],
Expand Down
13 changes: 6 additions & 7 deletions docs/pages/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,25 @@ utility functions}.
A good way to get started is to check out the {@page runnable-examples.md
runnable examples}.

To create a GRPC-Client in NodeJS-SDK:
To create a GRPC-Client for use with nodeJS:

```ts
import { credentials } from '@grpc/grpc-js/';
import { createConcordiumClient } from '@concordium/node-sdk';
import { ConcordiumGRPCNodeClient, credentials } from '@concordium/web-sdk/nodejs';
...
return createConcordiumClient(
return new ConcordiumGRPCNodeClient(
address,
port,
credentials.createSsl(),
{ timeout: 15000 }
);
```

To create a GRPC-Client in the Web-SDK:
To create a GRPC-Client for use in a browser (requires GRPC-web enabled on the node):

```ts
import { createConcordiumClient } from '@concordium/web-sdk';
import { ConcordiumGRPCWebClient } from '@concordium/web-sdk';
...
return createConcordiumClient(
return new ConcordiumGRPCWebClient(
address,
port,
{ timeout: 15000 }
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/misc-pages/grpc-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ interface as the grpc v1 node client:
- [getModuleSource](#getmodulesource)
<!--toc:end-->

## GRPCv1-Client
## GRPCv1-Client (only accessible prior to version 10)

The ConcordiumNodeClient defines the interface to be used to send and receive
data from a concordium-node.
Expand Down
46 changes: 4 additions & 42 deletions docs/pages/misc-pages/upgrade-guide.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
## Common SDK version 10 (Web 7) (Node 10)

### Common
## SDK version 10

Several types have been replaced with a module containing the type itself together with functions for constructing and
converting the type:
Expand Down Expand Up @@ -48,12 +46,9 @@ The API now uses dedicated types instead of language primitives:
- Uses `Duration` instead of a bigint.
Can be constructed using `Duration.fromMillis(<integer>)`.

### Web

The `@concordium/web-sdk` now requires bundlers to respect `exports` field of
`package.json` of a module. This is due to relying on entrypoints declared in
the `exports` field of `@concordium/common-sdk`
and correspondingly `@concordium/rust-bindings` to make it possible to select
the `exports` field of `@concordium/rust-bindings` to make it possible to select
only parts of the SDK to include in your application.
Furthermore, the SDK is now published as an ES module, making it possible to
eliminate dead code.
Expand Down Expand Up @@ -96,12 +91,9 @@ with web3-id proofs.

### NodeJS

The `@concordium/node-sdk` module is no longer compatible with
The `@concordium/web-sdk` module is not compatible with
node versions <16 and is published only as an ES module.
This is due to relying on entrypoints declared in the `exports` field
of `@concordium/common-sdk` and correspondingly `@concordium/rust-bindings`
to make it possible to select only parts of the SDK to include in your
application.
This, in turn, requires users to also run applications as ES modules.

The easiest way to run your node application as an ES module, is by setting
the `type` field of `package.json` to be set to `"module"`:
Expand All @@ -121,36 +113,6 @@ For **TypeScript** users, at least typescript version 4.7 is required along
with the setting `compilerOptions.moduleResultion` to `"node16"` or
`"nodenext"` to match the resolution strategy of node version 16 and later.

The following entrypoints are made available for consumers of
`@concordium/node-sdk`:

- `@concordium/node-sdk` exposes the full API of the SDK.
- `@concordium/node-sdk/cis0` entrypoint exposes functionality for working
with contracts adhering to the
[CIS-0](https://proposals.concordium.software/CIS/cis-0.html) standard.
- `@concordium/node-sdk/cis2` entrypoint exposes functionality for working
with contracts adhering to the
[CIS-2](https://proposals.concordium.software/CIS/cis-2.html) standard.
- `@concordium/node-sdk/cis4` entrypoint exposes functionality for working
with contracts adhering to the
[CIS-4](https://proposals.concordium.software/CIS/cis-4.html) standard.
- `@concordium/node-sdk/client` entrypoint exposes the **(deprecated)**
grpc client for interacting with a nodes GPRCv1 interface.
- `@concordium/node-sdk/grpc` entrypoint exposes the grpc client for
interacting with a nodes GRPCv2 interface.
- `@concordium/node-sdk/id` entrypoint exposes functionality for working
with ID proofs.
- `@concordium/node-sdk/schema` entrypoint exposes functionality for working
with smart contract schemas, i.e.(de)serializing types using a smart contract schema.
- This uses the wasm entrypoint at `@concordium/rust-bindings/dapp`.
- `@concordium/node-sdk/types` entrypoint exposes functionality for working
with concordium domain types.
- `@concordium/node-sdk/wasm` entrypoint exposes a variety of functionality for
working with concordium domain types, which requires WASM.
- This uses the wasm entrypoint at `@concorodium/rust-bindings/wallet`.
- `@concordium/node-sdk/web3-id` entrypoint exposes functionality for working
with web3-id proofs.

## Common SDK version 5 to 6 (Web 2->3) (Node 5->6)

Some classes and types have been renamed or changed, and should be update if used.
Expand Down
3 changes: 2 additions & 1 deletion docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"moduleResolution": "NodeNext"
},
"include": [
"../packages/**/*"
"../packages/**/*",
"./typedoc.config.cjs"
],
"exclude": [
"../packages/ccd-js-gen/**/*"
Expand Down
79 changes: 79 additions & 0 deletions docs/typedoc.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('node:path');

module.exports = {
name: 'Concordium JS-SDKs',
out: path.resolve(__dirname, '../typedoc'),
entryPointStrategy: 'expand',
entryPoints: [
path.resolve(__dirname, '../packages/sdk/src/index.ts'),
path.resolve(__dirname, '../packages/sdk/src/nodejs/index.ts'),
],
tsconfig: path.resolve(__dirname, '../tsconfig.json'),
readme: path.resolve(__dirname, './pages/documentation.md'),
plugin: [
'@knodes/typedoc-plugin-code-blocks',
'@knodes/typedoc-plugin-pages',
'typedoc-plugin-merge-modules',
],
mergeModulesMergeMode: 'module',
pluginCodeBlocks: {
source: path.resolve(__dirname, '../examples'),
},
pluginPages: {
source: path.resolve(__dirname, './pages'),
pages: [
{
name: 'Concordium JS-SDKs',
children: [
{
name: 'CIS2-Contracts',
source: 'cis2-contracts.md',
},
{
name: 'Identity Proofs',
source: 'identity-proofs.md',
},
{
name: 'Runnable Examples',
source: 'runnable-examples.md',
},
{
name: 'Transactions',
source: 'transactions.md',
},
{
name: 'Utility Functions',
source: 'utility-functions.md',
},
{
name: 'Miscellaneous Pages',
childrenDir: 'misc-pages',
children: [
{
name: 'Account Creation',
source: 'account-creation.md',
},
{
name: 'Optimizing bundled applications',
source: 'bundler-optimizations.md',
},
{
name: 'GRPCv1 to GRPCv2 Migration Guide',
source: 'grpc-migration.md',
},
{
name: 'Old GRPC-Client',
source: 'grpc-v1.md',
},
{
name: 'Upgrade Guide',
source: 'upgrade-guide.md',
},
],
},
],
},
],
},
};
73 changes: 0 additions & 73 deletions docs/typedoc.json

This file was deleted.

0 comments on commit 8918814

Please sign in to comment.