@dedot/codegen 0.0.1-next.c3d95ac1.3 → 0.0.1-next.d9aff57d.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/cjs/generator/ConstsGen.js +3 -3
  2. package/cjs/generator/ErrorsGen.js +6 -6
  3. package/cjs/generator/EventsGen.js +6 -6
  4. package/cjs/generator/IndexGen.js +7 -3
  5. package/cjs/generator/JsonRpcGen.js +8 -8
  6. package/cjs/generator/QueryGen.js +19 -10
  7. package/cjs/generator/RuntimeApisGen.js +11 -11
  8. package/cjs/generator/TxGen.js +11 -9
  9. package/cjs/generator/TypeImports.js +11 -9
  10. package/cjs/generator/TypesGen.js +3 -3
  11. package/cjs/generator/known-codecs.js +1 -1
  12. package/cjs/index.js +17 -16
  13. package/cjs/templates/consts.hbs +1 -1
  14. package/cjs/templates/errors.hbs +1 -1
  15. package/cjs/templates/events.hbs +1 -1
  16. package/cjs/templates/index.hbs +14 -9
  17. package/cjs/templates/json-rpc.hbs +1 -1
  18. package/cjs/templates/query.hbs +1 -1
  19. package/cjs/templates/runtime.hbs +1 -1
  20. package/cjs/templates/tx.hbs +1 -1
  21. package/generator/ApiGen.d.ts +4 -4
  22. package/generator/ConstsGen.d.ts +1 -1
  23. package/generator/ConstsGen.js +3 -3
  24. package/generator/ErrorsGen.d.ts +1 -1
  25. package/generator/ErrorsGen.js +6 -6
  26. package/generator/EventsGen.d.ts +1 -1
  27. package/generator/EventsGen.js +6 -6
  28. package/generator/IndexGen.d.ts +1 -1
  29. package/generator/IndexGen.js +7 -3
  30. package/generator/JsonRpcGen.d.ts +3 -2
  31. package/generator/JsonRpcGen.js +6 -6
  32. package/generator/QueryGen.d.ts +1 -1
  33. package/generator/QueryGen.js +19 -10
  34. package/generator/RuntimeApisGen.d.ts +2 -2
  35. package/generator/RuntimeApisGen.js +9 -9
  36. package/generator/TxGen.d.ts +1 -1
  37. package/generator/TxGen.js +11 -9
  38. package/generator/TypeImports.d.ts +8 -3
  39. package/generator/TypeImports.js +11 -9
  40. package/generator/TypesGen.d.ts +1 -1
  41. package/generator/TypesGen.js +3 -3
  42. package/generator/known-codecs.d.ts +1 -1
  43. package/generator/known-codecs.js +1 -1
  44. package/index.d.ts +2 -2
  45. package/index.js +18 -17
  46. package/package.json +15 -17
  47. package/templates/consts.hbs +1 -1
  48. package/templates/errors.hbs +1 -1
  49. package/templates/events.hbs +1 -1
  50. package/templates/index.hbs +14 -9
  51. package/templates/json-rpc.hbs +1 -1
  52. package/templates/query.hbs +1 -1
  53. package/templates/runtime.hbs +1 -1
  54. package/templates/tx.hbs +1 -1
@@ -2,6 +2,6 @@
2
2
 
3
3
  {{{ importTypes }}}
4
4
 
5
- export interface ChainConsts extends GenericChainConsts {
5
+ export interface ChainConsts<Rv extends RpcVersion> extends GenericChainConsts<Rv> {
6
6
  {{{ defTypeOut }}}
7
7
  }
@@ -2,6 +2,6 @@
2
2
 
3
3
  {{{ importTypes }}}
4
4
 
5
- export interface ChainErrors extends GenericChainErrors {
5
+ export interface ChainErrors<Rv extends RpcVersion> extends GenericChainErrors<Rv> {
6
6
  {{{ defTypeOut }}}
7
7
  }
@@ -2,6 +2,6 @@
2
2
 
3
3
  {{{ importTypes }}}
4
4
 
5
- export interface ChainEvents extends GenericChainEvents {
5
+ export interface ChainEvents<Rv extends RpcVersion> extends GenericChainEvents<Rv> {
6
6
  {{{ defTypeOut }}}
7
7
  }
@@ -1,6 +1,6 @@
1
1
  // Generated by @dedot/codegen
2
2
 
3
- import { GenericSubstrateApi } from '@dedot/types';
3
+ {{{importTypes}}}
4
4
  import { ChainConsts } from './consts';
5
5
  import { ChainStorage } from './query';
6
6
  import { ChainJsonRpcApis } from './json-rpc';
@@ -11,12 +11,17 @@ import { ChainTx } from './tx';
11
11
 
12
12
  export * from './types';
13
13
 
14
- export interface {{{interfaceName}}}Api extends GenericSubstrateApi {
15
- rpc: ChainJsonRpcApis;
16
- consts: ChainConsts;
17
- query: ChainStorage;
18
- errors: ChainErrors;
19
- events: ChainEvents;
20
- call: RuntimeApis;
21
- tx: ChainTx;
14
+ export interface Versioned{{{interfaceName}}}Api<Rv extends RpcVersion> extends GenericSubstrateApi<Rv> {
15
+ rpc: ChainJsonRpcApis<Rv>;
16
+ consts: ChainConsts<Rv>;
17
+ query: ChainStorage<Rv>;
18
+ errors: ChainErrors<Rv>;
19
+ events: ChainEvents<Rv>;
20
+ call: RuntimeApis<Rv>;
21
+ tx: ChainTx<Rv>;
22
+ }
23
+
24
+ export interface {{{interfaceName}}}Api {
25
+ legacy: Versioned{{{interfaceName}}}Api<RpcLegacy>;
26
+ v2: Versioned{{{interfaceName}}}Api<RpcV2>;
22
27
  }
@@ -2,4 +2,4 @@
2
2
 
3
3
  {{{ importTypes }}}
4
4
 
5
- export type ChainJsonRpcApis = Pick<JsonRpcApis, {{{jsonRpcMethods}}}> & GenericJsonRpcApis;
5
+ export type ChainJsonRpcApis<Rv extends RpcVersion> = Pick<JsonRpcApis, {{{jsonRpcMethods}}}> & GenericJsonRpcApis<Rv>;
@@ -2,6 +2,6 @@
2
2
 
3
3
  {{{ importTypes }}}
4
4
 
5
- export interface ChainStorage extends GenericChainStorage {
5
+ export interface ChainStorage<Rv extends RpcVersion> extends GenericChainStorage<Rv> {
6
6
  {{{ defTypeOut }}}
7
7
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  {{{ importTypes }}}
4
4
 
5
- export interface RuntimeApis extends GenericRuntimeApis {
5
+ export interface RuntimeApis<Rv extends RpcVersion> extends GenericRuntimeApis<Rv> {
6
6
  {{{ runtimeCallsOut }}}
7
7
  }
8
8
 
package/templates/tx.hbs CHANGED
@@ -4,6 +4,6 @@
4
4
 
5
5
  {{{ defTypes }}}
6
6
 
7
- export interface ChainTx extends GenericChainTx<TxCall> {
7
+ export interface ChainTx<Rv extends RpcVersion> extends GenericChainTx<Rv, TxCall<Rv>> {
8
8
  {{{ txDefsOut }}}
9
9
  }