@aws-sdk/client-managedblockchain-query 3.378.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 (107) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +262 -0
  3. package/dist-cjs/ManagedBlockchainQuery.js +23 -0
  4. package/dist-cjs/ManagedBlockchainQueryClient.js +41 -0
  5. package/dist-cjs/commands/BatchGetTokenBalanceCommand.js +46 -0
  6. package/dist-cjs/commands/GetTokenBalanceCommand.js +46 -0
  7. package/dist-cjs/commands/GetTransactionCommand.js +46 -0
  8. package/dist-cjs/commands/ListTokenBalancesCommand.js +46 -0
  9. package/dist-cjs/commands/ListTransactionEventsCommand.js +46 -0
  10. package/dist-cjs/commands/ListTransactionsCommand.js +46 -0
  11. package/dist-cjs/commands/index.js +9 -0
  12. package/dist-cjs/endpoint/EndpointParameters.js +12 -0
  13. package/dist-cjs/endpoint/endpointResolver.js +12 -0
  14. package/dist-cjs/endpoint/ruleset.js +7 -0
  15. package/dist-cjs/index.js +11 -0
  16. package/dist-cjs/models/ManagedBlockchainQueryServiceException.js +12 -0
  17. package/dist-cjs/models/index.js +4 -0
  18. package/dist-cjs/models/models_0.js +139 -0
  19. package/dist-cjs/pagination/Interfaces.js +2 -0
  20. package/dist-cjs/pagination/ListTokenBalancesPaginator.js +29 -0
  21. package/dist-cjs/pagination/ListTransactionEventsPaginator.js +29 -0
  22. package/dist-cjs/pagination/ListTransactionsPaginator.js +29 -0
  23. package/dist-cjs/pagination/index.js +7 -0
  24. package/dist-cjs/protocols/Aws_restJson1.js +706 -0
  25. package/dist-cjs/runtimeConfig.browser.js +39 -0
  26. package/dist-cjs/runtimeConfig.js +48 -0
  27. package/dist-cjs/runtimeConfig.native.js +15 -0
  28. package/dist-cjs/runtimeConfig.shared.js +21 -0
  29. package/dist-es/ManagedBlockchainQuery.js +19 -0
  30. package/dist-es/ManagedBlockchainQueryClient.js +37 -0
  31. package/dist-es/commands/BatchGetTokenBalanceCommand.js +42 -0
  32. package/dist-es/commands/GetTokenBalanceCommand.js +42 -0
  33. package/dist-es/commands/GetTransactionCommand.js +42 -0
  34. package/dist-es/commands/ListTokenBalancesCommand.js +42 -0
  35. package/dist-es/commands/ListTransactionEventsCommand.js +42 -0
  36. package/dist-es/commands/ListTransactionsCommand.js +42 -0
  37. package/dist-es/commands/index.js +6 -0
  38. package/dist-es/endpoint/EndpointParameters.js +8 -0
  39. package/dist-es/endpoint/endpointResolver.js +8 -0
  40. package/dist-es/endpoint/ruleset.js +4 -0
  41. package/dist-es/index.js +6 -0
  42. package/dist-es/models/ManagedBlockchainQueryServiceException.js +8 -0
  43. package/dist-es/models/index.js +1 -0
  44. package/dist-es/models/models_0.js +130 -0
  45. package/dist-es/pagination/Interfaces.js +1 -0
  46. package/dist-es/pagination/ListTokenBalancesPaginator.js +25 -0
  47. package/dist-es/pagination/ListTransactionEventsPaginator.js +25 -0
  48. package/dist-es/pagination/ListTransactionsPaginator.js +25 -0
  49. package/dist-es/pagination/index.js +4 -0
  50. package/dist-es/protocols/Aws_restJson1.js +691 -0
  51. package/dist-es/runtimeConfig.browser.js +34 -0
  52. package/dist-es/runtimeConfig.js +43 -0
  53. package/dist-es/runtimeConfig.native.js +11 -0
  54. package/dist-es/runtimeConfig.shared.js +17 -0
  55. package/dist-types/ManagedBlockchainQuery.d.ts +58 -0
  56. package/dist-types/ManagedBlockchainQueryClient.d.ts +174 -0
  57. package/dist-types/commands/BatchGetTokenBalanceCommand.d.ts +149 -0
  58. package/dist-types/commands/GetTokenBalanceCommand.d.ts +122 -0
  59. package/dist-types/commands/GetTransactionCommand.d.ts +115 -0
  60. package/dist-types/commands/ListTokenBalancesCommand.d.ts +135 -0
  61. package/dist-types/commands/ListTransactionEventsCommand.d.ts +109 -0
  62. package/dist-types/commands/ListTransactionsCommand.d.ts +111 -0
  63. package/dist-types/commands/index.d.ts +6 -0
  64. package/dist-types/endpoint/EndpointParameters.d.ts +19 -0
  65. package/dist-types/endpoint/endpointResolver.d.ts +5 -0
  66. package/dist-types/endpoint/ruleset.d.ts +2 -0
  67. package/dist-types/index.d.ts +17 -0
  68. package/dist-types/models/ManagedBlockchainQueryServiceException.d.ts +13 -0
  69. package/dist-types/models/index.d.ts +1 -0
  70. package/dist-types/models/models_0.d.ts +917 -0
  71. package/dist-types/pagination/Interfaces.d.ts +8 -0
  72. package/dist-types/pagination/ListTokenBalancesPaginator.d.ts +7 -0
  73. package/dist-types/pagination/ListTransactionEventsPaginator.d.ts +7 -0
  74. package/dist-types/pagination/ListTransactionsPaginator.d.ts +7 -0
  75. package/dist-types/pagination/index.d.ts +4 -0
  76. package/dist-types/protocols/Aws_restJson1.d.ts +56 -0
  77. package/dist-types/runtimeConfig.browser.d.ts +42 -0
  78. package/dist-types/runtimeConfig.d.ts +42 -0
  79. package/dist-types/runtimeConfig.native.d.ts +41 -0
  80. package/dist-types/runtimeConfig.shared.d.ts +18 -0
  81. package/dist-types/ts3.4/ManagedBlockchainQuery.d.ts +109 -0
  82. package/dist-types/ts3.4/ManagedBlockchainQueryClient.d.ts +149 -0
  83. package/dist-types/ts3.4/commands/BatchGetTokenBalanceCommand.d.ts +42 -0
  84. package/dist-types/ts3.4/commands/GetTokenBalanceCommand.d.ts +38 -0
  85. package/dist-types/ts3.4/commands/GetTransactionCommand.d.ts +35 -0
  86. package/dist-types/ts3.4/commands/ListTokenBalancesCommand.d.ts +38 -0
  87. package/dist-types/ts3.4/commands/ListTransactionEventsCommand.d.ts +42 -0
  88. package/dist-types/ts3.4/commands/ListTransactionsCommand.d.ts +38 -0
  89. package/dist-types/ts3.4/commands/index.d.ts +6 -0
  90. package/dist-types/ts3.4/endpoint/EndpointParameters.d.ts +33 -0
  91. package/dist-types/ts3.4/endpoint/endpointResolver.d.ts +8 -0
  92. package/dist-types/ts3.4/endpoint/ruleset.d.ts +2 -0
  93. package/dist-types/ts3.4/index.d.ts +6 -0
  94. package/dist-types/ts3.4/models/ManagedBlockchainQueryServiceException.d.ts +8 -0
  95. package/dist-types/ts3.4/models/index.d.ts +1 -0
  96. package/dist-types/ts3.4/models/models_0.d.ts +264 -0
  97. package/dist-types/ts3.4/pagination/Interfaces.d.ts +6 -0
  98. package/dist-types/ts3.4/pagination/ListTokenBalancesPaginator.d.ts +11 -0
  99. package/dist-types/ts3.4/pagination/ListTransactionEventsPaginator.d.ts +11 -0
  100. package/dist-types/ts3.4/pagination/ListTransactionsPaginator.d.ts +11 -0
  101. package/dist-types/ts3.4/pagination/index.d.ts +4 -0
  102. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +77 -0
  103. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +91 -0
  104. package/dist-types/ts3.4/runtimeConfig.d.ts +91 -0
  105. package/dist-types/ts3.4/runtimeConfig.native.d.ts +82 -0
  106. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +20 -0
  107. package/package.json +99 -0
@@ -0,0 +1,691 @@
1
+ import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
2
+ import { _json, collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map, parseEpochTimestamp as __parseEpochTimestamp, strictParseInt32 as __strictParseInt32, take, withBaseException, } from "@smithy/smithy-client";
3
+ import { ManagedBlockchainQueryServiceException as __BaseException } from "../models/ManagedBlockchainQueryServiceException";
4
+ import { AccessDeniedException, InternalServerException, ResourceNotFoundException, ServiceQuotaExceededException, ThrottlingException, ValidationException, } from "../models/models_0";
5
+ export const se_BatchGetTokenBalanceCommand = async (input, context) => {
6
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
7
+ const headers = {
8
+ "content-type": "application/json",
9
+ };
10
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/batch-get-token-balance";
11
+ let body;
12
+ body = JSON.stringify(take(input, {
13
+ getTokenBalanceInputs: (_) => se_GetTokenBalanceInputList(_, context),
14
+ }));
15
+ return new __HttpRequest({
16
+ protocol,
17
+ hostname,
18
+ port,
19
+ method: "POST",
20
+ headers,
21
+ path: resolvedPath,
22
+ body,
23
+ });
24
+ };
25
+ export const se_GetTokenBalanceCommand = async (input, context) => {
26
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
27
+ const headers = {
28
+ "content-type": "application/json",
29
+ };
30
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/get-token-balance";
31
+ let body;
32
+ body = JSON.stringify(take(input, {
33
+ atBlockchainInstant: (_) => se_BlockchainInstant(_, context),
34
+ ownerIdentifier: (_) => _json(_),
35
+ tokenIdentifier: (_) => _json(_),
36
+ }));
37
+ return new __HttpRequest({
38
+ protocol,
39
+ hostname,
40
+ port,
41
+ method: "POST",
42
+ headers,
43
+ path: resolvedPath,
44
+ body,
45
+ });
46
+ };
47
+ export const se_GetTransactionCommand = async (input, context) => {
48
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
49
+ const headers = {
50
+ "content-type": "application/json",
51
+ };
52
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/get-transaction";
53
+ let body;
54
+ body = JSON.stringify(take(input, {
55
+ network: [],
56
+ transactionHash: [],
57
+ }));
58
+ return new __HttpRequest({
59
+ protocol,
60
+ hostname,
61
+ port,
62
+ method: "POST",
63
+ headers,
64
+ path: resolvedPath,
65
+ body,
66
+ });
67
+ };
68
+ export const se_ListTokenBalancesCommand = async (input, context) => {
69
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
70
+ const headers = {
71
+ "content-type": "application/json",
72
+ };
73
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/list-token-balances";
74
+ let body;
75
+ body = JSON.stringify(take(input, {
76
+ maxResults: [],
77
+ nextToken: [],
78
+ ownerFilter: (_) => _json(_),
79
+ tokenFilter: (_) => _json(_),
80
+ }));
81
+ return new __HttpRequest({
82
+ protocol,
83
+ hostname,
84
+ port,
85
+ method: "POST",
86
+ headers,
87
+ path: resolvedPath,
88
+ body,
89
+ });
90
+ };
91
+ export const se_ListTransactionEventsCommand = async (input, context) => {
92
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
93
+ const headers = {
94
+ "content-type": "application/json",
95
+ };
96
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/list-transaction-events";
97
+ let body;
98
+ body = JSON.stringify(take(input, {
99
+ maxResults: [],
100
+ network: [],
101
+ nextToken: [],
102
+ transactionHash: [],
103
+ }));
104
+ return new __HttpRequest({
105
+ protocol,
106
+ hostname,
107
+ port,
108
+ method: "POST",
109
+ headers,
110
+ path: resolvedPath,
111
+ body,
112
+ });
113
+ };
114
+ export const se_ListTransactionsCommand = async (input, context) => {
115
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
116
+ const headers = {
117
+ "content-type": "application/json",
118
+ };
119
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/list-transactions";
120
+ let body;
121
+ body = JSON.stringify(take(input, {
122
+ address: [],
123
+ fromBlockchainInstant: (_) => se_BlockchainInstant(_, context),
124
+ maxResults: [],
125
+ network: [],
126
+ nextToken: [],
127
+ sort: (_) => _json(_),
128
+ toBlockchainInstant: (_) => se_BlockchainInstant(_, context),
129
+ }));
130
+ return new __HttpRequest({
131
+ protocol,
132
+ hostname,
133
+ port,
134
+ method: "POST",
135
+ headers,
136
+ path: resolvedPath,
137
+ body,
138
+ });
139
+ };
140
+ export const de_BatchGetTokenBalanceCommand = async (output, context) => {
141
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
142
+ return de_BatchGetTokenBalanceCommandError(output, context);
143
+ }
144
+ const contents = map({
145
+ $metadata: deserializeMetadata(output),
146
+ });
147
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
148
+ const doc = take(data, {
149
+ errors: (_) => de_BatchGetTokenBalanceErrors(_, context),
150
+ tokenBalances: (_) => de_BatchGetTokenBalanceOutputList(_, context),
151
+ });
152
+ Object.assign(contents, doc);
153
+ return contents;
154
+ };
155
+ const de_BatchGetTokenBalanceCommandError = async (output, context) => {
156
+ const parsedOutput = {
157
+ ...output,
158
+ body: await parseErrorBody(output.body, context),
159
+ };
160
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
161
+ switch (errorCode) {
162
+ case "AccessDeniedException":
163
+ case "com.amazonaws.managedblockchainquery#AccessDeniedException":
164
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
165
+ case "InternalServerException":
166
+ case "com.amazonaws.managedblockchainquery#InternalServerException":
167
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
168
+ case "ResourceNotFoundException":
169
+ case "com.amazonaws.managedblockchainquery#ResourceNotFoundException":
170
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
171
+ case "ServiceQuotaExceededException":
172
+ case "com.amazonaws.managedblockchainquery#ServiceQuotaExceededException":
173
+ throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
174
+ case "ThrottlingException":
175
+ case "com.amazonaws.managedblockchainquery#ThrottlingException":
176
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
177
+ case "ValidationException":
178
+ case "com.amazonaws.managedblockchainquery#ValidationException":
179
+ throw await de_ValidationExceptionRes(parsedOutput, context);
180
+ default:
181
+ const parsedBody = parsedOutput.body;
182
+ return throwDefaultError({
183
+ output,
184
+ parsedBody,
185
+ errorCode,
186
+ });
187
+ }
188
+ };
189
+ export const de_GetTokenBalanceCommand = async (output, context) => {
190
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
191
+ return de_GetTokenBalanceCommandError(output, context);
192
+ }
193
+ const contents = map({
194
+ $metadata: deserializeMetadata(output),
195
+ });
196
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
197
+ const doc = take(data, {
198
+ atBlockchainInstant: (_) => de_BlockchainInstant(_, context),
199
+ balance: __expectString,
200
+ lastUpdatedTime: (_) => de_BlockchainInstant(_, context),
201
+ ownerIdentifier: _json,
202
+ tokenIdentifier: _json,
203
+ });
204
+ Object.assign(contents, doc);
205
+ return contents;
206
+ };
207
+ const de_GetTokenBalanceCommandError = async (output, context) => {
208
+ const parsedOutput = {
209
+ ...output,
210
+ body: await parseErrorBody(output.body, context),
211
+ };
212
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
213
+ switch (errorCode) {
214
+ case "AccessDeniedException":
215
+ case "com.amazonaws.managedblockchainquery#AccessDeniedException":
216
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
217
+ case "InternalServerException":
218
+ case "com.amazonaws.managedblockchainquery#InternalServerException":
219
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
220
+ case "ResourceNotFoundException":
221
+ case "com.amazonaws.managedblockchainquery#ResourceNotFoundException":
222
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
223
+ case "ServiceQuotaExceededException":
224
+ case "com.amazonaws.managedblockchainquery#ServiceQuotaExceededException":
225
+ throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
226
+ case "ThrottlingException":
227
+ case "com.amazonaws.managedblockchainquery#ThrottlingException":
228
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
229
+ case "ValidationException":
230
+ case "com.amazonaws.managedblockchainquery#ValidationException":
231
+ throw await de_ValidationExceptionRes(parsedOutput, context);
232
+ default:
233
+ const parsedBody = parsedOutput.body;
234
+ return throwDefaultError({
235
+ output,
236
+ parsedBody,
237
+ errorCode,
238
+ });
239
+ }
240
+ };
241
+ export const de_GetTransactionCommand = async (output, context) => {
242
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
243
+ return de_GetTransactionCommandError(output, context);
244
+ }
245
+ const contents = map({
246
+ $metadata: deserializeMetadata(output),
247
+ });
248
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
249
+ const doc = take(data, {
250
+ transaction: (_) => de_Transaction(_, context),
251
+ });
252
+ Object.assign(contents, doc);
253
+ return contents;
254
+ };
255
+ const de_GetTransactionCommandError = async (output, context) => {
256
+ const parsedOutput = {
257
+ ...output,
258
+ body: await parseErrorBody(output.body, context),
259
+ };
260
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
261
+ switch (errorCode) {
262
+ case "AccessDeniedException":
263
+ case "com.amazonaws.managedblockchainquery#AccessDeniedException":
264
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
265
+ case "InternalServerException":
266
+ case "com.amazonaws.managedblockchainquery#InternalServerException":
267
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
268
+ case "ResourceNotFoundException":
269
+ case "com.amazonaws.managedblockchainquery#ResourceNotFoundException":
270
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
271
+ case "ServiceQuotaExceededException":
272
+ case "com.amazonaws.managedblockchainquery#ServiceQuotaExceededException":
273
+ throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
274
+ case "ThrottlingException":
275
+ case "com.amazonaws.managedblockchainquery#ThrottlingException":
276
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
277
+ case "ValidationException":
278
+ case "com.amazonaws.managedblockchainquery#ValidationException":
279
+ throw await de_ValidationExceptionRes(parsedOutput, context);
280
+ default:
281
+ const parsedBody = parsedOutput.body;
282
+ return throwDefaultError({
283
+ output,
284
+ parsedBody,
285
+ errorCode,
286
+ });
287
+ }
288
+ };
289
+ export const de_ListTokenBalancesCommand = async (output, context) => {
290
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
291
+ return de_ListTokenBalancesCommandError(output, context);
292
+ }
293
+ const contents = map({
294
+ $metadata: deserializeMetadata(output),
295
+ });
296
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
297
+ const doc = take(data, {
298
+ nextToken: __expectString,
299
+ tokenBalances: (_) => de_TokenBalanceList(_, context),
300
+ });
301
+ Object.assign(contents, doc);
302
+ return contents;
303
+ };
304
+ const de_ListTokenBalancesCommandError = async (output, context) => {
305
+ const parsedOutput = {
306
+ ...output,
307
+ body: await parseErrorBody(output.body, context),
308
+ };
309
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
310
+ switch (errorCode) {
311
+ case "AccessDeniedException":
312
+ case "com.amazonaws.managedblockchainquery#AccessDeniedException":
313
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
314
+ case "InternalServerException":
315
+ case "com.amazonaws.managedblockchainquery#InternalServerException":
316
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
317
+ case "ServiceQuotaExceededException":
318
+ case "com.amazonaws.managedblockchainquery#ServiceQuotaExceededException":
319
+ throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
320
+ case "ThrottlingException":
321
+ case "com.amazonaws.managedblockchainquery#ThrottlingException":
322
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
323
+ case "ValidationException":
324
+ case "com.amazonaws.managedblockchainquery#ValidationException":
325
+ throw await de_ValidationExceptionRes(parsedOutput, context);
326
+ default:
327
+ const parsedBody = parsedOutput.body;
328
+ return throwDefaultError({
329
+ output,
330
+ parsedBody,
331
+ errorCode,
332
+ });
333
+ }
334
+ };
335
+ export const de_ListTransactionEventsCommand = async (output, context) => {
336
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
337
+ return de_ListTransactionEventsCommandError(output, context);
338
+ }
339
+ const contents = map({
340
+ $metadata: deserializeMetadata(output),
341
+ });
342
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
343
+ const doc = take(data, {
344
+ events: _json,
345
+ nextToken: __expectString,
346
+ });
347
+ Object.assign(contents, doc);
348
+ return contents;
349
+ };
350
+ const de_ListTransactionEventsCommandError = async (output, context) => {
351
+ const parsedOutput = {
352
+ ...output,
353
+ body: await parseErrorBody(output.body, context),
354
+ };
355
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
356
+ switch (errorCode) {
357
+ case "AccessDeniedException":
358
+ case "com.amazonaws.managedblockchainquery#AccessDeniedException":
359
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
360
+ case "InternalServerException":
361
+ case "com.amazonaws.managedblockchainquery#InternalServerException":
362
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
363
+ case "ServiceQuotaExceededException":
364
+ case "com.amazonaws.managedblockchainquery#ServiceQuotaExceededException":
365
+ throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
366
+ case "ThrottlingException":
367
+ case "com.amazonaws.managedblockchainquery#ThrottlingException":
368
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
369
+ case "ValidationException":
370
+ case "com.amazonaws.managedblockchainquery#ValidationException":
371
+ throw await de_ValidationExceptionRes(parsedOutput, context);
372
+ default:
373
+ const parsedBody = parsedOutput.body;
374
+ return throwDefaultError({
375
+ output,
376
+ parsedBody,
377
+ errorCode,
378
+ });
379
+ }
380
+ };
381
+ export const de_ListTransactionsCommand = async (output, context) => {
382
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
383
+ return de_ListTransactionsCommandError(output, context);
384
+ }
385
+ const contents = map({
386
+ $metadata: deserializeMetadata(output),
387
+ });
388
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
389
+ const doc = take(data, {
390
+ nextToken: __expectString,
391
+ transactions: (_) => de_TransactionOutputList(_, context),
392
+ });
393
+ Object.assign(contents, doc);
394
+ return contents;
395
+ };
396
+ const de_ListTransactionsCommandError = async (output, context) => {
397
+ const parsedOutput = {
398
+ ...output,
399
+ body: await parseErrorBody(output.body, context),
400
+ };
401
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
402
+ switch (errorCode) {
403
+ case "AccessDeniedException":
404
+ case "com.amazonaws.managedblockchainquery#AccessDeniedException":
405
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
406
+ case "InternalServerException":
407
+ case "com.amazonaws.managedblockchainquery#InternalServerException":
408
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
409
+ case "ServiceQuotaExceededException":
410
+ case "com.amazonaws.managedblockchainquery#ServiceQuotaExceededException":
411
+ throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
412
+ case "ThrottlingException":
413
+ case "com.amazonaws.managedblockchainquery#ThrottlingException":
414
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
415
+ case "ValidationException":
416
+ case "com.amazonaws.managedblockchainquery#ValidationException":
417
+ throw await de_ValidationExceptionRes(parsedOutput, context);
418
+ default:
419
+ const parsedBody = parsedOutput.body;
420
+ return throwDefaultError({
421
+ output,
422
+ parsedBody,
423
+ errorCode,
424
+ });
425
+ }
426
+ };
427
+ const throwDefaultError = withBaseException(__BaseException);
428
+ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
429
+ const contents = map({});
430
+ const data = parsedOutput.body;
431
+ const doc = take(data, {
432
+ message: __expectString,
433
+ });
434
+ Object.assign(contents, doc);
435
+ const exception = new AccessDeniedException({
436
+ $metadata: deserializeMetadata(parsedOutput),
437
+ ...contents,
438
+ });
439
+ return __decorateServiceException(exception, parsedOutput.body);
440
+ };
441
+ const de_InternalServerExceptionRes = async (parsedOutput, context) => {
442
+ const contents = map({
443
+ retryAfterSeconds: [
444
+ () => void 0 !== parsedOutput.headers["retry-after"],
445
+ () => __strictParseInt32(parsedOutput.headers["retry-after"]),
446
+ ],
447
+ });
448
+ const data = parsedOutput.body;
449
+ const doc = take(data, {
450
+ message: __expectString,
451
+ });
452
+ Object.assign(contents, doc);
453
+ const exception = new InternalServerException({
454
+ $metadata: deserializeMetadata(parsedOutput),
455
+ ...contents,
456
+ });
457
+ return __decorateServiceException(exception, parsedOutput.body);
458
+ };
459
+ const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
460
+ const contents = map({});
461
+ const data = parsedOutput.body;
462
+ const doc = take(data, {
463
+ message: __expectString,
464
+ resourceId: __expectString,
465
+ resourceType: __expectString,
466
+ });
467
+ Object.assign(contents, doc);
468
+ const exception = new ResourceNotFoundException({
469
+ $metadata: deserializeMetadata(parsedOutput),
470
+ ...contents,
471
+ });
472
+ return __decorateServiceException(exception, parsedOutput.body);
473
+ };
474
+ const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
475
+ const contents = map({});
476
+ const data = parsedOutput.body;
477
+ const doc = take(data, {
478
+ message: __expectString,
479
+ quotaCode: __expectString,
480
+ resourceId: __expectString,
481
+ resourceType: __expectString,
482
+ serviceCode: __expectString,
483
+ });
484
+ Object.assign(contents, doc);
485
+ const exception = new ServiceQuotaExceededException({
486
+ $metadata: deserializeMetadata(parsedOutput),
487
+ ...contents,
488
+ });
489
+ return __decorateServiceException(exception, parsedOutput.body);
490
+ };
491
+ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
492
+ const contents = map({
493
+ retryAfterSeconds: [
494
+ () => void 0 !== parsedOutput.headers["retry-after"],
495
+ () => __strictParseInt32(parsedOutput.headers["retry-after"]),
496
+ ],
497
+ });
498
+ const data = parsedOutput.body;
499
+ const doc = take(data, {
500
+ message: __expectString,
501
+ quotaCode: __expectString,
502
+ serviceCode: __expectString,
503
+ });
504
+ Object.assign(contents, doc);
505
+ const exception = new ThrottlingException({
506
+ $metadata: deserializeMetadata(parsedOutput),
507
+ ...contents,
508
+ });
509
+ return __decorateServiceException(exception, parsedOutput.body);
510
+ };
511
+ const de_ValidationExceptionRes = async (parsedOutput, context) => {
512
+ const contents = map({});
513
+ const data = parsedOutput.body;
514
+ const doc = take(data, {
515
+ fieldList: _json,
516
+ message: __expectString,
517
+ reason: __expectString,
518
+ });
519
+ Object.assign(contents, doc);
520
+ const exception = new ValidationException({
521
+ $metadata: deserializeMetadata(parsedOutput),
522
+ ...contents,
523
+ });
524
+ return __decorateServiceException(exception, parsedOutput.body);
525
+ };
526
+ const se_BatchGetTokenBalanceInputItem = (input, context) => {
527
+ return take(input, {
528
+ atBlockchainInstant: (_) => se_BlockchainInstant(_, context),
529
+ ownerIdentifier: _json,
530
+ tokenIdentifier: _json,
531
+ });
532
+ };
533
+ const se_BlockchainInstant = (input, context) => {
534
+ return take(input, {
535
+ time: (_) => Math.round(_.getTime() / 1000),
536
+ });
537
+ };
538
+ const se_GetTokenBalanceInputList = (input, context) => {
539
+ return input
540
+ .filter((e) => e != null)
541
+ .map((entry) => {
542
+ return se_BatchGetTokenBalanceInputItem(entry, context);
543
+ });
544
+ };
545
+ const de_BatchGetTokenBalanceErrorItem = (output, context) => {
546
+ return take(output, {
547
+ atBlockchainInstant: (_) => de_BlockchainInstant(_, context),
548
+ errorCode: __expectString,
549
+ errorMessage: __expectString,
550
+ errorType: __expectString,
551
+ ownerIdentifier: _json,
552
+ tokenIdentifier: _json,
553
+ });
554
+ };
555
+ const de_BatchGetTokenBalanceErrors = (output, context) => {
556
+ const retVal = (output || [])
557
+ .filter((e) => e != null)
558
+ .map((entry) => {
559
+ return de_BatchGetTokenBalanceErrorItem(entry, context);
560
+ });
561
+ return retVal;
562
+ };
563
+ const de_BatchGetTokenBalanceOutputItem = (output, context) => {
564
+ return take(output, {
565
+ atBlockchainInstant: (_) => de_BlockchainInstant(_, context),
566
+ balance: __expectString,
567
+ lastUpdatedTime: (_) => de_BlockchainInstant(_, context),
568
+ ownerIdentifier: _json,
569
+ tokenIdentifier: _json,
570
+ });
571
+ };
572
+ const de_BatchGetTokenBalanceOutputList = (output, context) => {
573
+ const retVal = (output || [])
574
+ .filter((e) => e != null)
575
+ .map((entry) => {
576
+ return de_BatchGetTokenBalanceOutputItem(entry, context);
577
+ });
578
+ return retVal;
579
+ };
580
+ const de_BlockchainInstant = (output, context) => {
581
+ return take(output, {
582
+ time: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
583
+ });
584
+ };
585
+ const de_TokenBalance = (output, context) => {
586
+ return take(output, {
587
+ atBlockchainInstant: (_) => de_BlockchainInstant(_, context),
588
+ balance: __expectString,
589
+ lastUpdatedTime: (_) => de_BlockchainInstant(_, context),
590
+ ownerIdentifier: _json,
591
+ tokenIdentifier: _json,
592
+ });
593
+ };
594
+ const de_TokenBalanceList = (output, context) => {
595
+ const retVal = (output || [])
596
+ .filter((e) => e != null)
597
+ .map((entry) => {
598
+ return de_TokenBalance(entry, context);
599
+ });
600
+ return retVal;
601
+ };
602
+ const de_Transaction = (output, context) => {
603
+ return take(output, {
604
+ blockHash: __expectString,
605
+ blockNumber: __expectString,
606
+ contractAddress: __expectString,
607
+ cumulativeGasUsed: __expectString,
608
+ effectiveGasPrice: __expectString,
609
+ from: __expectString,
610
+ gasUsed: __expectString,
611
+ network: __expectString,
612
+ numberOfTransactions: __expectLong,
613
+ signatureR: __expectString,
614
+ signatureS: __expectString,
615
+ signatureV: __expectInt32,
616
+ status: __expectString,
617
+ to: __expectString,
618
+ transactionFee: __expectString,
619
+ transactionHash: __expectString,
620
+ transactionId: __expectString,
621
+ transactionIndex: __expectLong,
622
+ transactionTimestamp: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
623
+ });
624
+ };
625
+ const de_TransactionOutputItem = (output, context) => {
626
+ return take(output, {
627
+ network: __expectString,
628
+ transactionHash: __expectString,
629
+ transactionTimestamp: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
630
+ });
631
+ };
632
+ const de_TransactionOutputList = (output, context) => {
633
+ const retVal = (output || [])
634
+ .filter((e) => e != null)
635
+ .map((entry) => {
636
+ return de_TransactionOutputItem(entry, context);
637
+ });
638
+ return retVal;
639
+ };
640
+ const deserializeMetadata = (output) => ({
641
+ httpStatusCode: output.statusCode,
642
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
643
+ extendedRequestId: output.headers["x-amz-id-2"],
644
+ cfId: output.headers["x-amz-cf-id"],
645
+ });
646
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
647
+ const isSerializableHeaderValue = (value) => value !== undefined &&
648
+ value !== null &&
649
+ value !== "" &&
650
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
651
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
652
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
653
+ if (encoded.length) {
654
+ return JSON.parse(encoded);
655
+ }
656
+ return {};
657
+ });
658
+ const parseErrorBody = async (errorBody, context) => {
659
+ const value = await parseBody(errorBody, context);
660
+ value.message = value.message ?? value.Message;
661
+ return value;
662
+ };
663
+ const loadRestJsonErrorCode = (output, data) => {
664
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
665
+ const sanitizeErrorCode = (rawValue) => {
666
+ let cleanValue = rawValue;
667
+ if (typeof cleanValue === "number") {
668
+ cleanValue = cleanValue.toString();
669
+ }
670
+ if (cleanValue.indexOf(",") >= 0) {
671
+ cleanValue = cleanValue.split(",")[0];
672
+ }
673
+ if (cleanValue.indexOf(":") >= 0) {
674
+ cleanValue = cleanValue.split(":")[0];
675
+ }
676
+ if (cleanValue.indexOf("#") >= 0) {
677
+ cleanValue = cleanValue.split("#")[1];
678
+ }
679
+ return cleanValue;
680
+ };
681
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
682
+ if (headerKey !== undefined) {
683
+ return sanitizeErrorCode(output.headers[headerKey]);
684
+ }
685
+ if (data.code !== undefined) {
686
+ return sanitizeErrorCode(data.code);
687
+ }
688
+ if (data["__type"] !== undefined) {
689
+ return sanitizeErrorCode(data["__type"]);
690
+ }
691
+ };