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