@aztec/foundation 0.61.0 → 0.63.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 (150) hide show
  1. package/dest/abi/abi.d.ts +708 -228
  2. package/dest/abi/abi.d.ts.map +1 -1
  3. package/dest/abi/abi.js +92 -8
  4. package/dest/abi/decoder.d.ts.map +1 -1
  5. package/dest/abi/decoder.js +8 -6
  6. package/dest/abi/encoder.d.ts.map +1 -1
  7. package/dest/abi/encoder.js +4 -1
  8. package/dest/abi/event_selector.d.ts +4 -0
  9. package/dest/abi/event_selector.d.ts.map +1 -1
  10. package/dest/abi/event_selector.js +7 -1
  11. package/dest/abi/utils.d.ts +8 -0
  12. package/dest/abi/utils.d.ts.map +1 -1
  13. package/dest/abi/utils.js +23 -1
  14. package/dest/aztec-address/index.d.ts +19 -3
  15. package/dest/aztec-address/index.d.ts.map +1 -1
  16. package/dest/aztec-address/index.js +43 -14
  17. package/dest/buffer/buffer32.d.ts +1 -0
  18. package/dest/buffer/buffer32.d.ts.map +1 -1
  19. package/dest/buffer/buffer32.js +4 -1
  20. package/dest/config/env_var.d.ts +1 -1
  21. package/dest/config/env_var.d.ts.map +1 -1
  22. package/dest/crypto/index.d.ts +1 -0
  23. package/dest/crypto/index.d.ts.map +1 -1
  24. package/dest/crypto/index.js +2 -1
  25. package/dest/crypto/keys/index.d.ts +5 -0
  26. package/dest/crypto/keys/index.d.ts.map +1 -0
  27. package/dest/crypto/keys/index.js +8 -0
  28. package/dest/eth-address/index.d.ts +2 -6
  29. package/dest/eth-address/index.d.ts.map +1 -1
  30. package/dest/eth-address/index.js +3 -7
  31. package/dest/eth-signature/eth_signature.d.ts +2 -0
  32. package/dest/eth-signature/eth_signature.d.ts.map +1 -1
  33. package/dest/eth-signature/eth_signature.js +7 -1
  34. package/dest/fields/fields.d.ts +1 -3
  35. package/dest/fields/fields.d.ts.map +1 -1
  36. package/dest/fields/fields.js +2 -1
  37. package/dest/json-rpc/client/fetch.d.ts +21 -0
  38. package/dest/json-rpc/client/fetch.d.ts.map +1 -0
  39. package/dest/json-rpc/client/fetch.js +66 -0
  40. package/dest/json-rpc/client/index.d.ts +2 -1
  41. package/dest/json-rpc/client/index.d.ts.map +1 -1
  42. package/dest/json-rpc/client/index.js +3 -2
  43. package/dest/json-rpc/client/safe_json_rpc_client.d.ts +13 -0
  44. package/dest/json-rpc/client/safe_json_rpc_client.d.ts.map +1 -0
  45. package/dest/json-rpc/client/safe_json_rpc_client.js +45 -0
  46. package/dest/json-rpc/convert.d.ts +11 -19
  47. package/dest/json-rpc/convert.d.ts.map +1 -1
  48. package/dest/json-rpc/convert.js +30 -123
  49. package/dest/json-rpc/fixtures/test_state.d.ts +45 -3
  50. package/dest/json-rpc/fixtures/test_state.d.ts.map +1 -1
  51. package/dest/json-rpc/fixtures/test_state.js +58 -2
  52. package/dest/json-rpc/index.d.ts +1 -2
  53. package/dest/json-rpc/index.d.ts.map +1 -1
  54. package/dest/json-rpc/index.js +2 -3
  55. package/dest/json-rpc/js_utils.d.ts.map +1 -1
  56. package/dest/json-rpc/js_utils.js +2 -1
  57. package/dest/json-rpc/server/index.d.ts +1 -2
  58. package/dest/json-rpc/server/index.d.ts.map +1 -1
  59. package/dest/json-rpc/server/index.js +2 -3
  60. package/dest/json-rpc/server/safe_json_rpc_server.d.ts +112 -0
  61. package/dest/json-rpc/server/safe_json_rpc_server.d.ts.map +1 -0
  62. package/dest/json-rpc/server/safe_json_rpc_server.js +275 -0
  63. package/dest/json-rpc/test/index.d.ts +2 -0
  64. package/dest/json-rpc/test/index.d.ts.map +1 -0
  65. package/dest/json-rpc/test/index.js +2 -0
  66. package/dest/json-rpc/test/integration.d.ts +13 -0
  67. package/dest/json-rpc/test/integration.d.ts.map +1 -0
  68. package/dest/json-rpc/test/integration.js +12 -0
  69. package/dest/log/logger.d.ts +10 -2
  70. package/dest/log/logger.d.ts.map +1 -1
  71. package/dest/log/logger.js +55 -12
  72. package/dest/schemas/api.d.ts +21 -0
  73. package/dest/schemas/api.d.ts.map +1 -0
  74. package/dest/schemas/api.js +8 -0
  75. package/dest/schemas/index.d.ts +6 -0
  76. package/dest/schemas/index.d.ts.map +1 -0
  77. package/dest/schemas/index.js +6 -0
  78. package/dest/schemas/parse.d.ts +9 -0
  79. package/dest/schemas/parse.d.ts.map +1 -0
  80. package/dest/schemas/parse.js +26 -0
  81. package/dest/schemas/schemas.d.ts +79 -0
  82. package/dest/schemas/schemas.d.ts.map +1 -0
  83. package/dest/schemas/schemas.js +87 -0
  84. package/dest/schemas/types.d.ts +3 -0
  85. package/dest/schemas/types.d.ts.map +1 -0
  86. package/dest/schemas/types.js +2 -0
  87. package/dest/schemas/utils.d.ts +40 -0
  88. package/dest/schemas/utils.d.ts.map +1 -0
  89. package/dest/schemas/utils.js +56 -0
  90. package/dest/string/index.d.ts +7 -0
  91. package/dest/string/index.d.ts.map +1 -0
  92. package/dest/string/index.js +13 -0
  93. package/dest/types/index.d.ts +2 -0
  94. package/dest/types/index.d.ts.map +1 -1
  95. package/dest/validation/index.d.ts +6 -0
  96. package/dest/validation/index.d.ts.map +1 -1
  97. package/dest/validation/index.js +11 -1
  98. package/dest/wasm/wasm_module.js +1 -1
  99. package/package.json +7 -4
  100. package/src/abi/abi.ts +203 -233
  101. package/src/abi/decoder.ts +9 -5
  102. package/src/abi/encoder.ts +2 -0
  103. package/src/abi/event_selector.ts +7 -0
  104. package/src/abi/utils.ts +28 -0
  105. package/src/aztec-address/index.ts +64 -18
  106. package/src/buffer/buffer32.ts +5 -0
  107. package/src/config/env_var.ts +22 -8
  108. package/src/crypto/index.ts +1 -0
  109. package/src/crypto/keys/index.ts +9 -0
  110. package/src/eth-address/index.ts +2 -6
  111. package/src/eth-signature/eth_signature.ts +8 -0
  112. package/src/fields/fields.ts +2 -3
  113. package/src/json-rpc/client/fetch.ts +81 -0
  114. package/src/json-rpc/client/index.ts +2 -1
  115. package/src/json-rpc/client/safe_json_rpc_client.ts +61 -0
  116. package/src/json-rpc/convert.ts +29 -142
  117. package/src/json-rpc/fixtures/test_state.ts +87 -3
  118. package/src/json-rpc/index.ts +1 -8
  119. package/src/json-rpc/js_utils.ts +1 -0
  120. package/src/json-rpc/server/index.ts +1 -2
  121. package/src/json-rpc/server/safe_json_rpc_server.ts +336 -0
  122. package/src/json-rpc/test/index.ts +1 -0
  123. package/src/json-rpc/test/integration.ts +24 -0
  124. package/src/log/logger.ts +59 -15
  125. package/src/schemas/api.ts +47 -0
  126. package/src/schemas/index.ts +5 -0
  127. package/src/schemas/parse.ts +29 -0
  128. package/src/schemas/schemas.ts +111 -0
  129. package/src/schemas/types.ts +3 -0
  130. package/src/schemas/utils.ts +85 -0
  131. package/src/string/index.ts +15 -0
  132. package/src/types/index.ts +3 -0
  133. package/src/validation/index.ts +11 -0
  134. package/src/wasm/wasm_module.ts +1 -1
  135. package/dest/json-rpc/class_converter.d.ts +0 -144
  136. package/dest/json-rpc/class_converter.d.ts.map +0 -1
  137. package/dest/json-rpc/class_converter.js +0 -102
  138. package/dest/json-rpc/client/json_rpc_client.d.ts +0 -35
  139. package/dest/json-rpc/client/json_rpc_client.d.ts.map +0 -1
  140. package/dest/json-rpc/client/json_rpc_client.js +0 -117
  141. package/dest/json-rpc/server/json_proxy.d.ts +0 -30
  142. package/dest/json-rpc/server/json_proxy.d.ts.map +0 -1
  143. package/dest/json-rpc/server/json_proxy.js +0 -46
  144. package/dest/json-rpc/server/json_rpc_server.d.ts +0 -98
  145. package/dest/json-rpc/server/json_rpc_server.d.ts.map +0 -1
  146. package/dest/json-rpc/server/json_rpc_server.js +0 -248
  147. package/src/json-rpc/class_converter.ts +0 -213
  148. package/src/json-rpc/client/json_rpc_client.ts +0 -148
  149. package/src/json-rpc/server/json_proxy.ts +0 -60
  150. package/src/json-rpc/server/json_rpc_server.ts +0 -300
@@ -1,213 +0,0 @@
1
- import { assert } from './js_utils.js';
2
-
3
- /**
4
- * Represents a class compatible with our class conversion system.
5
- * E.g. PublicKey here satisfies 'StringIOClass'.
6
- * ```
7
- * class PublicKey {
8
- * toString() {
9
- * return '...';
10
- * }
11
- * static fromString(str) {
12
- * return new PublicKey(...);
13
- * }
14
- * }
15
- * ```
16
- */
17
- interface StringIOClass {
18
- new (...args: any): any;
19
-
20
- // TODO(#4254): Ensure that toString method is checked for as well.
21
-
22
- /**
23
- * Creates an IOClass from a given string.
24
- */
25
- fromString: (str: string) => any;
26
- }
27
-
28
- /**
29
- * Represents a class compatible with our class conversion system.
30
- * E.g. PublicKey here satisfies 'ObjIOClass'.
31
- * ```
32
- * class PublicKey {
33
- * toJSON() {
34
- * return {...};
35
- * }
36
- * static fromJSON(obj) {
37
- * return new PublicKey({...});
38
- * }
39
- * }
40
- * ```
41
- */
42
- interface ObjIOClass {
43
- new (...args: any): any;
44
-
45
- // TODO(#4254): Ensure that toJSON method is checked for as well.
46
-
47
- /**
48
- * Creates an IOClass from a given JSON object.
49
- */
50
- fromJSON: (str: object) => any;
51
- }
52
-
53
- /**
54
- * Either a StringIOClass or ObjIOClass
55
- */
56
- type IOClass = ObjIOClass | StringIOClass;
57
-
58
- /**
59
- * Registered classes available for conversion.
60
- */
61
- export interface StringClassConverterInput {
62
- [className: string]: StringIOClass;
63
- }
64
-
65
- /**
66
- * Registered classes available for conversion.
67
- */
68
- export interface JsonClassConverterInput {
69
- [className: string]: ObjIOClass;
70
- }
71
-
72
- /**
73
- * Represents a class in a JSON-friendly encoding.
74
- */
75
- export interface StringEncodedClass {
76
- /**
77
- * The class type.
78
- */
79
- type: string;
80
- /**
81
- * The class data string.
82
- */
83
- data: string;
84
- }
85
-
86
- /**
87
- * Represents a class in a JSON-friendly encoding.
88
- */
89
- export interface JsonEncodedClass {
90
- /**
91
- * The class type.
92
- */
93
- type: string;
94
- /**
95
- * The class data string.
96
- */
97
- data: object;
98
- }
99
- /**
100
- * Whether a class is a complex object or simply represented by a string.
101
- */
102
- export type ClassEncoding = 'string' | 'object';
103
-
104
- /**
105
- * Handles mapping of classes to names, and calling toString and fromString to convert to and from JSON-friendly formats.
106
- * Takes a class map as input.
107
- */
108
- export class ClassConverter {
109
- private toClass = new Map<string, [IOClass, ClassEncoding]>();
110
- private toName = new Map<IOClass, [string, ClassEncoding]>();
111
-
112
- /**
113
- * Create a class converter from a table of classes.
114
- * @param stringClassMap - The class table of string encoded classes.
115
- * @param objectClassMap - The class table of complex object classes
116
- */
117
- constructor(stringClassMap?: StringClassConverterInput, objectClassMap?: JsonClassConverterInput) {
118
- if (stringClassMap) {
119
- for (const key of Object.keys(stringClassMap)) {
120
- this.register(key, stringClassMap[key], 'string');
121
- }
122
- }
123
- if (objectClassMap) {
124
- for (const key of Object.keys(objectClassMap)) {
125
- this.register(key, objectClassMap[key], 'object');
126
- }
127
- }
128
- }
129
-
130
- /**
131
- * Register a class with a certain name.
132
- * This name is used for conversion from and to this class.
133
- * @param type - The class name to use for serialization.
134
- * @param class_ - The class object.
135
- * @param encoding - Whether the class is a complex object or simply represented by a string.
136
- */
137
- register(type: string, class_: IOClass, encoding: ClassEncoding) {
138
- assert(type !== 'Buffer', "'Buffer' handling is hardcoded. Cannot use as name.");
139
- assert(
140
- class_.prototype['toString'] || class_.prototype['toJSON'],
141
- `Class ${type} must define a toString() OR toJSON() method.`,
142
- );
143
- assert(
144
- (class_ as StringIOClass)['fromString'] || (class_ as ObjIOClass)['fromJSON'],
145
- `Class ${type} must define a fromString() OR fromJSON() static method.`,
146
- );
147
- this.toName.set(class_, [type, encoding]);
148
- this.toClass.set(type, [class_, encoding]);
149
- }
150
-
151
- /**
152
- * Does this type name have a registered class?
153
- * @param type - The type name.
154
- * @returns If there's a registered class.
155
- */
156
- isRegisteredClassName(type: string) {
157
- return this.toClass.has(type);
158
- }
159
- /**
160
- * Is this class object registered?
161
- * @param obj - The class object.
162
- * @returns If it is a registered class.
163
- */
164
- isRegisteredClass(obj: any) {
165
- const name = obj.prototype.constructor.name;
166
- return this.toName.has(obj) || this.isRegisteredClassName(name);
167
- }
168
- /**
169
- * Convert a JSON-like object to a class object.
170
- * @param jsonObj - An object encoding a class.
171
- * @returns The class object.
172
- */
173
- toClassObj(jsonObj: JsonEncodedClass | StringEncodedClass): any {
174
- const result = this.toClass.get(jsonObj.type);
175
- assert(result, `Could not find type in lookup.`);
176
-
177
- const [class_, encoding] = result;
178
- if (encoding === 'string' && typeof jsonObj.data === 'string') {
179
- return (class_ as StringIOClass)!.fromString!(jsonObj.data);
180
- } else {
181
- return (class_ as ObjIOClass)!.fromJSON!(jsonObj.data as object);
182
- }
183
- }
184
- /**
185
- * Convert a class object to a JSON object.
186
- * @param classObj - A JSON encoding a class.
187
- * @returns The class object.
188
- */
189
- toJsonObj(classObj: any): JsonEncodedClass | StringEncodedClass {
190
- const { type, encoding } = this.lookupObject(classObj);
191
- const data = encoding === 'string' ? classObj.toString() : classObj.toJSON();
192
- return { type: type!, data };
193
- }
194
-
195
- /**
196
- * Loads the corresponding type for this class based on constructor first and constructor name if not found.
197
- * Constructor match works in the event of a minifier changing function names, and constructor name match
198
- * works in the event of duplicated instances of node modules being loaded (see #1826).
199
- * @param classObj - Object to lookup in the registered types.
200
- * @returns Registered type name and encoding.
201
- */
202
- private lookupObject(classObj: any) {
203
- const nameResult = this.toName.get(classObj.constructor);
204
- if (nameResult) {
205
- return { type: nameResult[0], encoding: nameResult[1] };
206
- }
207
- const classResult = this.toClass.get(classObj.constructor.name);
208
- if (classResult) {
209
- return { type: classObj.constructor.name, encoding: classResult[1] };
210
- }
211
- throw new Error(`Could not find class ${classObj.constructor.name} in lookup.`);
212
- }
213
- }
@@ -1,148 +0,0 @@
1
- // comlink:
2
- // Dev dependency just for the somewhat complex RemoteObject type
3
- // This takes a {foo(): T} and makes {foo(): Promise<T>}
4
- // while avoiding Promise of Promise.
5
- import { type RemoteObject } from 'comlink';
6
- import { format } from 'util';
7
-
8
- import { type DebugLogger, createDebugLogger } from '../../log/index.js';
9
- import { NoRetryError, makeBackoff, retry } from '../../retry/index.js';
10
- import { ClassConverter, type JsonClassConverterInput, type StringClassConverterInput } from '../class_converter.js';
11
- import { JsonStringify, convertFromJsonObj, convertToJsonObj } from '../convert.js';
12
-
13
- export { JsonStringify } from '../convert.js';
14
-
15
- const log = createDebugLogger('json-rpc:json_rpc_client');
16
- /**
17
- * A normal fetch function that does not retry.
18
- * Alternatives are a fetch function with retries, or a mocked fetch.
19
- * @param host - The host URL.
20
- * @param method - The RPC method name.
21
- * @param body - The RPC payload.
22
- * @param noRetry - Whether to throw a `NoRetryError` in case the response is a 5xx error and the body contains an error
23
- * message (see `retry` function for more details).
24
- * @returns The parsed JSON response, or throws an error.
25
- */
26
- export async function defaultFetch(
27
- host: string,
28
- rpcMethod: string,
29
- body: any,
30
- useApiEndpoints: boolean,
31
- noRetry = false,
32
- ) {
33
- log.debug(format(`JsonRpcClient.fetch`, host, rpcMethod, '->', body));
34
- let resp: Response;
35
- if (useApiEndpoints) {
36
- resp = await fetch(`${host}/${rpcMethod}`, {
37
- method: 'POST',
38
- body: JsonStringify(body),
39
- headers: { 'content-type': 'application/json' },
40
- });
41
- } else {
42
- resp = await fetch(host, {
43
- method: 'POST',
44
- body: JsonStringify({ ...body, method: rpcMethod }),
45
- headers: { 'content-type': 'application/json' },
46
- });
47
- }
48
-
49
- let responseJson;
50
- try {
51
- responseJson = await resp.json();
52
- } catch (err) {
53
- if (!resp.ok) {
54
- throw new Error(resp.statusText);
55
- }
56
- throw new Error(`Failed to parse body as JSON: ${resp.text()}`);
57
- }
58
- if (!resp.ok) {
59
- const errorMessage = `(JSON-RPC PROPAGATED) (host ${host}) (method ${rpcMethod}) (code ${resp.status}) ${responseJson.error.message}`;
60
- if (noRetry || (resp.status >= 400 && resp.status < 500)) {
61
- throw new NoRetryError(errorMessage);
62
- } else {
63
- throw new Error(errorMessage);
64
- }
65
- }
66
-
67
- return responseJson;
68
- }
69
-
70
- /**
71
- * Makes a fetch function that retries based on the given attempts.
72
- * @param retries - Sequence of intervals (in seconds) to retry.
73
- * @param noRetry - Whether to stop retries on server errors.
74
- * @param log - Optional logger for logging attempts.
75
- * @returns A fetch function.
76
- */
77
- export function makeFetch(retries: number[], noRetry: boolean, log?: DebugLogger) {
78
- return async (host: string, rpcMethod: string, body: any, useApiEndpoints: boolean) => {
79
- return await retry(
80
- () => defaultFetch(host, rpcMethod, body, useApiEndpoints, noRetry),
81
- `JsonRpcClient request ${rpcMethod} to ${host}`,
82
- makeBackoff(retries),
83
- log,
84
- false,
85
- );
86
- };
87
- }
88
-
89
- /**
90
- * Creates a Proxy object that delegates over RPC and satisfies RemoteObject<T>.
91
- * The server should have ran new JsonRpcServer().
92
- * @param host - The host URL.
93
- * @param stringClassMap - A map of class names to string representations.
94
- * @param objectClassMap - A map of class names to class constructors.
95
- * @param useApiEndpoints - Whether to use the API endpoints or the default RPC endpoint.
96
- * @param namespaceMethods - String value (or false/empty) to namespace all methods sent to the server. e.g. 'getInfo' -\> 'pxe_getInfo'
97
- * @param fetch - The fetch implementation to use.
98
- */
99
- export function createJsonRpcClient<T extends object>(
100
- host: string,
101
- stringClassMap: StringClassConverterInput,
102
- objectClassMap: JsonClassConverterInput,
103
- useApiEndpoints: boolean,
104
- namespaceMethods?: string | false,
105
- fetch = defaultFetch,
106
- ) {
107
- const classConverter = new ClassConverter(stringClassMap, objectClassMap);
108
- let id = 0;
109
- const request = async (method: string, params: any[]): Promise<any> => {
110
- const body = {
111
- jsonrpc: '2.0',
112
- id: id++,
113
- method,
114
- params: params.map(param => convertToJsonObj(classConverter, param)),
115
- };
116
- log.debug(format(`JsonRpcClient.request`, method, '<-', params));
117
- const res = await fetch(host, method, body, useApiEndpoints);
118
- log.debug(format(`JsonRpcClient.result`, method, '->', res));
119
- if (res.error) {
120
- throw res.error;
121
- }
122
- if ([null, undefined, 'null', 'undefined'].includes(res.result)) {
123
- return;
124
- }
125
- return convertFromJsonObj(classConverter, res.result);
126
- };
127
-
128
- // Intercept any RPC methods with a proxy
129
- // This wraps 'request' with a method-call syntax wrapper
130
- return new Proxy(
131
- {},
132
- {
133
- get: (target, method: string) => {
134
- let rpcMethod = method;
135
- if (namespaceMethods) {
136
- rpcMethod = `${namespaceMethods}_${method}`;
137
- }
138
- if (['then', 'catch'].includes(method)) {
139
- return Reflect.get(target, method);
140
- }
141
- return (...params: any[]) => {
142
- log.debug(format(`JsonRpcClient.constructor`, 'proxy', rpcMethod, '<-', params));
143
- return request(rpcMethod, params);
144
- };
145
- },
146
- },
147
- ) as RemoteObject<T>;
148
- }
@@ -1,60 +0,0 @@
1
- import { format } from 'util';
2
-
3
- import { createDebugLogger } from '../../log/index.js';
4
- import { ClassConverter, type JsonClassConverterInput, type StringClassConverterInput } from '../class_converter.js';
5
- import { convertFromJsonObj, convertToJsonObj } from '../convert.js';
6
- import { assert, hasOwnProperty } from '../js_utils.js';
7
-
8
- const log = createDebugLogger('json-rpc:json_proxy');
9
-
10
- /**
11
- * A map of class names to class constructors.
12
- */
13
- export type ClassMaps = {
14
- /** The String class map */
15
- stringClassMap: StringClassConverterInput;
16
- /** The object class map */
17
- objectClassMap: JsonClassConverterInput;
18
- };
19
-
20
- /**
21
- * Handles conversion of objects over the write.
22
- * Delegates to a ClassConverter object.
23
- */
24
- export class JsonProxy {
25
- classConverter: ClassConverter;
26
- constructor(
27
- private handler: object,
28
- private stringClassMap: StringClassConverterInput,
29
- private objectClassMap: JsonClassConverterInput,
30
- ) {
31
- this.classConverter = new ClassConverter(stringClassMap, objectClassMap);
32
- }
33
- /**
34
- * Call an RPC method.
35
- * @param methodName - The RPC method.
36
- * @param jsonParams - The RPG parameters.
37
- * @param skipConversion - Whether to skip conversion of the parameters.
38
- * @returns The remote result.
39
- */
40
- public async call(methodName: string, jsonParams: any[] = [], skipConversion = false) {
41
- log.debug(format(`JsonProxy:call`, methodName, jsonParams));
42
- // Get access to our class members
43
- const proto = Object.getPrototypeOf(this.handler);
44
- assert(hasOwnProperty(proto, methodName), `JsonProxy: Method ${methodName} not found!`);
45
- assert(Array.isArray(jsonParams), `JsonProxy: ${methodName} params not an array: ${jsonParams}`);
46
- // convert the params from json representation to classes
47
- let convertedParams = jsonParams;
48
- if (!skipConversion) {
49
- convertedParams = jsonParams.map(param => convertFromJsonObj(this.classConverter, param));
50
- }
51
- log.debug(format('JsonProxy:call', methodName, '<-', convertedParams));
52
- const rawRet = await (this.handler as any)[methodName](...convertedParams);
53
- let ret = rawRet;
54
- if (!skipConversion) {
55
- ret = convertToJsonObj(this.classConverter, rawRet);
56
- }
57
- log.debug(format('JsonProxy:call', methodName, '->', ret));
58
- return ret;
59
- }
60
- }