@qubic.ts/contracts 0.1.0

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 (83) hide show
  1. package/package.json +17 -0
  2. package/scripts/generate-artifacts.ts +178 -0
  3. package/src/codec/entry-input.test.ts +198 -0
  4. package/src/codec/entry-input.ts +959 -0
  5. package/src/codec/index.ts +8 -0
  6. package/src/generated/contracts/CCF.registry.json +741 -0
  7. package/src/generated/contracts/CCF.types.ts +307 -0
  8. package/src/generated/contracts/GQMPROP.registry.json +518 -0
  9. package/src/generated/contracts/GQMPROP.types.ts +238 -0
  10. package/src/generated/contracts/MLM.registry.json +8 -0
  11. package/src/generated/contracts/MLM.types.ts +42 -0
  12. package/src/generated/contracts/MSVAULT.registry.json +1162 -0
  13. package/src/generated/contracts/MSVAULT.types.ts +598 -0
  14. package/src/generated/contracts/NOST.registry.json +1131 -0
  15. package/src/generated/contracts/NOST.types.ts +515 -0
  16. package/src/generated/contracts/QBAY.registry.json +1492 -0
  17. package/src/generated/contracts/QBAY.types.ts +681 -0
  18. package/src/generated/contracts/QBOND.registry.json +734 -0
  19. package/src/generated/contracts/QBOND.types.ts +397 -0
  20. package/src/generated/contracts/QDRAW.registry.json +112 -0
  21. package/src/generated/contracts/QDRAW.types.ts +110 -0
  22. package/src/generated/contracts/QDUEL.registry.json +466 -0
  23. package/src/generated/contracts/QDUEL.types.ts +265 -0
  24. package/src/generated/contracts/QEARN.registry.json +458 -0
  25. package/src/generated/contracts/QEARN.types.ts +265 -0
  26. package/src/generated/contracts/QIP.registry.json +483 -0
  27. package/src/generated/contracts/QIP.types.ts +194 -0
  28. package/src/generated/contracts/QRAFFLE.registry.json +916 -0
  29. package/src/generated/contracts/QRAFFLE.types.ts +446 -0
  30. package/src/generated/contracts/QRP.registry.json +139 -0
  31. package/src/generated/contracts/QRP.types.ts +144 -0
  32. package/src/generated/contracts/QRWA.registry.json +765 -0
  33. package/src/generated/contracts/QRWA.types.ts +402 -0
  34. package/src/generated/contracts/QSWAP.registry.json +941 -0
  35. package/src/generated/contracts/QSWAP.types.ts +479 -0
  36. package/src/generated/contracts/QTF.registry.json +480 -0
  37. package/src/generated/contracts/QTF.types.ts +346 -0
  38. package/src/generated/contracts/QUOTTERY.registry.json +530 -0
  39. package/src/generated/contracts/QUOTTERY.types.ts +262 -0
  40. package/src/generated/contracts/QUTIL.registry.json +1378 -0
  41. package/src/generated/contracts/QUTIL.types.ts +612 -0
  42. package/src/generated/contracts/QVAULT.registry.json +527 -0
  43. package/src/generated/contracts/QVAULT.types.ts +309 -0
  44. package/src/generated/contracts/QX.registry.json +610 -0
  45. package/src/generated/contracts/QX.types.ts +323 -0
  46. package/src/generated/contracts/RANDOM.registry.json +51 -0
  47. package/src/generated/contracts/RANDOM.types.ts +65 -0
  48. package/src/generated/contracts/RL.registry.json +490 -0
  49. package/src/generated/contracts/RL.types.ts +304 -0
  50. package/src/generated/contracts/SWATCH.registry.json +8 -0
  51. package/src/generated/contracts/SWATCH.types.ts +42 -0
  52. package/src/generated/core-registry.codecs.ts +6622 -0
  53. package/src/generated/core-registry.source.json +14342 -0
  54. package/src/generated/core-registry.ts +14349 -0
  55. package/src/generated/core-registry.types.ts +100 -0
  56. package/src/generator/contract-codecs.fixture.test.ts +17 -0
  57. package/src/generator/contract-codecs.test.ts +115 -0
  58. package/src/generator/contract-codecs.ts +416 -0
  59. package/src/generator/index.ts +14 -0
  60. package/src/generator/per-contract-files.test.ts +70 -0
  61. package/src/generator/per-contract-files.ts +122 -0
  62. package/src/generator/registry-runtime.fixture.test.ts +17 -0
  63. package/src/generator/registry-runtime.test.ts +55 -0
  64. package/src/generator/registry-runtime.ts +28 -0
  65. package/src/generator/registry-types.fixture.test.ts +17 -0
  66. package/src/generator/registry-types.test.ts +55 -0
  67. package/src/generator/registry-types.ts +75 -0
  68. package/src/index.test.ts +29 -0
  69. package/src/index.ts +49 -0
  70. package/src/registry/index.ts +17 -0
  71. package/src/registry/io-layout.fixture.test.ts +24 -0
  72. package/src/registry/io-layout.test.ts +93 -0
  73. package/src/registry/io-layout.ts +57 -0
  74. package/src/registry/normalize.ts +61 -0
  75. package/src/registry/schema.fixture.test.ts +21 -0
  76. package/src/registry/schema.ts +97 -0
  77. package/src/registry/types.ts +98 -0
  78. package/test/fixtures/io-layout.contracts.json +32 -0
  79. package/test/fixtures/io-layout.layouts.json +14 -0
  80. package/test/fixtures/registry.sample.codecs.ts +100 -0
  81. package/test/fixtures/registry.sample.json +27 -0
  82. package/test/fixtures/registry.sample.runtime.ts +54 -0
  83. package/test/fixtures/registry.sample.types.ts +16 -0
@@ -0,0 +1,144 @@
1
+ /* eslint-disable */
2
+ /* This file is generated. Do not edit manually. */
3
+
4
+ export type QRP_AddAllowedSC_input = {
5
+ readonly scIndex: bigint;
6
+ };
7
+ export type QRP_AddAllowedSC_output = {
8
+ readonly returnCode: number;
9
+ };
10
+ export type QRP_GetAllowedSC_input = Record<string, never>;
11
+ export type QRP_GetAllowedSC_output = {
12
+ readonly allowedSC: ReadonlyArray<string>;
13
+ };
14
+ export type QRP_GetAvailableReserve_input = Record<string, never>;
15
+ export type QRP_GetAvailableReserve_output = {
16
+ readonly availableReserve: bigint;
17
+ };
18
+ export type QRP_RemoveAllowedSC_input = {
19
+ readonly scIndex: bigint;
20
+ };
21
+ export type QRP_RemoveAllowedSC_output = {
22
+ readonly returnCode: number;
23
+ };
24
+ export type QRP_WithdrawReserve_input = {
25
+ readonly revenue: bigint;
26
+ };
27
+ export type QRP_WithdrawReserve_output = {
28
+ readonly allocatedRevenue: bigint;
29
+ readonly returnCode: number;
30
+ };
31
+
32
+ export interface ContractTypeMap {
33
+ QRP: {
34
+ readonly contractIndex: 21;
35
+ readonly functions: {
36
+ GetAvailableReserve: {
37
+ readonly kind: "function";
38
+ readonly inputType: 1;
39
+ readonly inputTypeName: "GetAvailableReserve_input";
40
+ readonly outputTypeName: "GetAvailableReserve_output";
41
+ readonly input: QRP_GetAvailableReserve_input;
42
+ readonly output: QRP_GetAvailableReserve_output;
43
+ };
44
+ GetAllowedSC: {
45
+ readonly kind: "function";
46
+ readonly inputType: 2;
47
+ readonly inputTypeName: "GetAllowedSC_input";
48
+ readonly outputTypeName: "GetAllowedSC_output";
49
+ readonly input: QRP_GetAllowedSC_input;
50
+ readonly output: QRP_GetAllowedSC_output;
51
+ };
52
+ };
53
+ readonly procedures: {
54
+ WithdrawReserve: {
55
+ readonly kind: "procedure";
56
+ readonly inputType: 1;
57
+ readonly inputTypeName: "WithdrawReserve_input";
58
+ readonly outputTypeName: "WithdrawReserve_output";
59
+ readonly input: QRP_WithdrawReserve_input;
60
+ readonly output: QRP_WithdrawReserve_output;
61
+ };
62
+ AddAllowedSC: {
63
+ readonly kind: "procedure";
64
+ readonly inputType: 2;
65
+ readonly inputTypeName: "AddAllowedSC_input";
66
+ readonly outputTypeName: "AddAllowedSC_output";
67
+ readonly input: QRP_AddAllowedSC_input;
68
+ readonly output: QRP_AddAllowedSC_output;
69
+ };
70
+ RemoveAllowedSC: {
71
+ readonly kind: "procedure";
72
+ readonly inputType: 3;
73
+ readonly inputTypeName: "RemoveAllowedSC_input";
74
+ readonly outputTypeName: "RemoveAllowedSC_output";
75
+ readonly input: QRP_RemoveAllowedSC_input;
76
+ readonly output: QRP_RemoveAllowedSC_output;
77
+ };
78
+ };
79
+ };
80
+ }
81
+
82
+ export type ContractName = keyof ContractTypeMap & string;
83
+ export type FunctionName<C extends ContractName> = keyof ContractTypeMap[C]["functions"] & string;
84
+ export type ProcedureName<C extends ContractName> = keyof ContractTypeMap[C]["procedures"] & string;
85
+
86
+ export type FunctionInput<
87
+ C extends ContractName,
88
+ F extends FunctionName<C>,
89
+ > = ContractTypeMap[C]["functions"][F]["input"];
90
+ export type FunctionOutput<
91
+ C extends ContractName,
92
+ F extends FunctionName<C>,
93
+ > = ContractTypeMap[C]["functions"][F]["output"];
94
+
95
+ export type ProcedureInput<
96
+ C extends ContractName,
97
+ P extends ProcedureName<C>,
98
+ > = ContractTypeMap[C]["procedures"][P]["input"];
99
+ export type ProcedureOutput<
100
+ C extends ContractName,
101
+ P extends ProcedureName<C>,
102
+ > = ContractTypeMap[C]["procedures"][P]["output"];
103
+
104
+ export const contractCodecRegistry = {
105
+ QRP: {
106
+ contractIndex: 21,
107
+ functions: {
108
+ GetAvailableReserve: {
109
+ kind: "function",
110
+ inputType: 1,
111
+ inputTypeName: "GetAvailableReserve_input",
112
+ outputTypeName: "GetAvailableReserve_output",
113
+ },
114
+ GetAllowedSC: {
115
+ kind: "function",
116
+ inputType: 2,
117
+ inputTypeName: "GetAllowedSC_input",
118
+ outputTypeName: "GetAllowedSC_output",
119
+ },
120
+ },
121
+ procedures: {
122
+ WithdrawReserve: {
123
+ kind: "procedure",
124
+ inputType: 1,
125
+ inputTypeName: "WithdrawReserve_input",
126
+ outputTypeName: "WithdrawReserve_output",
127
+ },
128
+ AddAllowedSC: {
129
+ kind: "procedure",
130
+ inputType: 2,
131
+ inputTypeName: "AddAllowedSC_input",
132
+ outputTypeName: "AddAllowedSC_output",
133
+ },
134
+ RemoveAllowedSC: {
135
+ kind: "procedure",
136
+ inputType: 3,
137
+ inputTypeName: "RemoveAllowedSC_input",
138
+ outputTypeName: "RemoveAllowedSC_output",
139
+ },
140
+ },
141
+ },
142
+ } as const satisfies Readonly<Record<ContractName, unknown>>;
143
+
144
+ export type RuntimeContractCodecRegistry = typeof contractCodecRegistry;