algosdk 1.22.0 → 1.23.2

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 (106) hide show
  1. package/README.md +4 -4
  2. package/dist/browser/algosdk.min.js +1 -1
  3. package/dist/browser/algosdk.min.js.map +1 -1
  4. package/dist/cjs/src/boxStorage.js +33 -0
  5. package/dist/cjs/src/boxStorage.js.map +1 -0
  6. package/dist/cjs/src/client/client.js +11 -9
  7. package/dist/cjs/src/client/client.js.map +1 -1
  8. package/dist/cjs/src/client/urlTokenBaseHTTPClient.js +93 -96
  9. package/dist/cjs/src/client/urlTokenBaseHTTPClient.js.map +1 -1
  10. package/dist/cjs/src/client/v2/algod/algod.js +38 -1
  11. package/dist/cjs/src/client/v2/algod/algod.js.map +1 -1
  12. package/dist/cjs/src/client/v2/algod/getApplicationBoxByName.js +44 -0
  13. package/dist/cjs/src/client/v2/algod/getApplicationBoxByName.js.map +1 -0
  14. package/dist/cjs/src/client/v2/algod/getApplicationBoxes.js +60 -0
  15. package/dist/cjs/src/client/v2/algod/getApplicationBoxes.js.map +1 -0
  16. package/dist/cjs/src/client/v2/algod/models/types.js +815 -42
  17. package/dist/cjs/src/client/v2/algod/models/types.js.map +1 -1
  18. package/dist/cjs/src/client/v2/{algod/models/base.js → basemodel.js} +1 -1
  19. package/dist/cjs/src/client/v2/basemodel.js.map +1 -0
  20. package/dist/cjs/src/client/v2/indexer/indexer.js +50 -0
  21. package/dist/cjs/src/client/v2/indexer/indexer.js.map +1 -1
  22. package/dist/cjs/src/client/v2/indexer/lookupApplicationBoxByIDandName.js +45 -0
  23. package/dist/cjs/src/client/v2/indexer/lookupApplicationBoxByIDandName.js.map +1 -0
  24. package/dist/cjs/src/client/v2/indexer/models/types.js +3077 -0
  25. package/dist/cjs/src/client/v2/indexer/models/types.js.map +1 -0
  26. package/dist/cjs/src/client/v2/indexer/searchForApplicationBoxes.js +99 -0
  27. package/dist/cjs/src/client/v2/indexer/searchForApplicationBoxes.js.map +1 -0
  28. package/dist/cjs/src/client/v2/jsonrequest.js +11 -1
  29. package/dist/cjs/src/client/v2/jsonrequest.js.map +1 -1
  30. package/dist/cjs/src/composer.js +4 -1
  31. package/dist/cjs/src/composer.js.map +1 -1
  32. package/dist/cjs/src/dryrun.js +1 -1
  33. package/dist/cjs/src/dryrun.js.map +1 -1
  34. package/dist/cjs/src/main.js +3 -2
  35. package/dist/cjs/src/main.js.map +1 -1
  36. package/dist/cjs/src/makeTxn.js +29 -14
  37. package/dist/cjs/src/makeTxn.js.map +1 -1
  38. package/dist/cjs/src/multisig.js +15 -25
  39. package/dist/cjs/src/multisig.js.map +1 -1
  40. package/dist/cjs/src/transaction.js +30 -0
  41. package/dist/cjs/src/transaction.js.map +1 -1
  42. package/dist/cjs/src/types/transactions/index.js.map +1 -1
  43. package/dist/esm/src/boxStorage.js +29 -0
  44. package/dist/esm/src/boxStorage.js.map +1 -0
  45. package/dist/esm/src/client/client.js +11 -9
  46. package/dist/esm/src/client/client.js.map +1 -1
  47. package/dist/esm/src/client/urlTokenBaseHTTPClient.js +93 -73
  48. package/dist/esm/src/client/urlTokenBaseHTTPClient.js.map +1 -1
  49. package/dist/esm/src/client/v2/algod/algod.js +38 -1
  50. package/dist/esm/src/client/v2/algod/algod.js.map +1 -1
  51. package/dist/esm/src/client/v2/algod/getApplicationBoxByName.js +38 -0
  52. package/dist/esm/src/client/v2/algod/getApplicationBoxByName.js.map +1 -0
  53. package/dist/esm/src/client/v2/algod/getApplicationBoxes.js +54 -0
  54. package/dist/esm/src/client/v2/algod/getApplicationBoxes.js.map +1 -0
  55. package/dist/esm/src/client/v2/algod/models/types.js +771 -2
  56. package/dist/esm/src/client/v2/algod/models/types.js.map +1 -1
  57. package/dist/esm/src/client/v2/{algod/models/base.js → basemodel.js} +1 -1
  58. package/dist/esm/src/client/v2/basemodel.js.map +1 -0
  59. package/dist/esm/src/client/v2/indexer/indexer.js +50 -0
  60. package/dist/esm/src/client/v2/indexer/indexer.js.map +1 -1
  61. package/dist/esm/src/client/v2/indexer/lookupApplicationBoxByIDandName.js +39 -0
  62. package/dist/esm/src/client/v2/indexer/lookupApplicationBoxByIDandName.js.map +1 -0
  63. package/dist/esm/src/client/v2/indexer/models/types.js +3009 -0
  64. package/dist/esm/src/client/v2/indexer/models/types.js.map +1 -0
  65. package/dist/esm/src/client/v2/indexer/searchForApplicationBoxes.js +93 -0
  66. package/dist/esm/src/client/v2/indexer/searchForApplicationBoxes.js.map +1 -0
  67. package/dist/esm/src/client/v2/jsonrequest.js +11 -1
  68. package/dist/esm/src/client/v2/jsonrequest.js.map +1 -1
  69. package/dist/esm/src/composer.js +4 -1
  70. package/dist/esm/src/composer.js.map +1 -1
  71. package/dist/esm/src/dryrun.js +1 -1
  72. package/dist/esm/src/dryrun.js.map +1 -1
  73. package/dist/esm/src/main.js +2 -0
  74. package/dist/esm/src/main.js.map +1 -1
  75. package/dist/esm/src/makeTxn.js +29 -14
  76. package/dist/esm/src/makeTxn.js.map +1 -1
  77. package/dist/esm/src/multisig.js +15 -25
  78. package/dist/esm/src/multisig.js.map +1 -1
  79. package/dist/esm/src/transaction.js +30 -0
  80. package/dist/esm/src/transaction.js.map +1 -1
  81. package/dist/esm/src/types/transactions/index.js +1 -1
  82. package/dist/esm/src/types/transactions/index.js.map +1 -1
  83. package/dist/types/src/boxStorage.d.ts +7 -0
  84. package/dist/types/src/client/client.d.ts +5 -3
  85. package/dist/types/src/client/urlTokenBaseHTTPClient.d.ts +8 -12
  86. package/dist/types/src/client/v2/algod/algod.d.ts +34 -1
  87. package/dist/types/src/client/v2/algod/getApplicationBoxByName.d.ts +28 -0
  88. package/dist/types/src/client/v2/algod/getApplicationBoxes.d.ts +43 -0
  89. package/dist/types/src/client/v2/algod/models/types.d.ts +117 -2
  90. package/dist/types/src/client/v2/{algod/models/base.d.ts → basemodel.d.ts} +0 -0
  91. package/dist/types/src/client/v2/indexer/indexer.d.ts +46 -0
  92. package/dist/types/src/client/v2/indexer/lookupApplicationBoxByIDandName.d.ts +29 -0
  93. package/dist/types/src/client/v2/indexer/models/types.d.ts +2689 -0
  94. package/dist/types/src/client/v2/indexer/searchForApplicationBoxes.d.ts +80 -0
  95. package/dist/types/src/client/v2/jsonrequest.d.ts +8 -1
  96. package/dist/types/src/composer.d.ts +4 -2
  97. package/dist/types/src/main.d.ts +1 -0
  98. package/dist/types/src/makeTxn.d.ts +22 -15
  99. package/dist/types/src/transaction.d.ts +3 -1
  100. package/dist/types/src/types/transactions/application.d.ts +3 -3
  101. package/dist/types/src/types/transactions/base.d.ts +15 -1
  102. package/dist/types/src/types/transactions/encoded.d.ts +12 -1
  103. package/dist/types/src/types/transactions/index.d.ts +1 -1
  104. package/package.json +6 -7
  105. package/dist/cjs/src/client/v2/algod/models/base.js.map +0 -1
  106. package/dist/esm/src/client/v2/algod/models/base.js.map +0 -1
@@ -2,7 +2,7 @@
2
2
  * NOTICE: This file was generated. Editing this file manually is not recommended.
3
3
  */
4
4
  /* eslint-disable no-use-before-define */
5
- import BaseModel from './base';
5
+ import BaseModel from '../../basemodel';
6
6
  /**
7
7
  * Account information at a given round.
8
8
  * Definition:
@@ -56,8 +56,11 @@ export class Account extends BaseModel {
56
56
  * * sig
57
57
  * * msig
58
58
  * * lsig
59
+ * @param totalBoxBytes - (tbxb) The total number of bytes used by this account's app's box keys and
60
+ * values.
61
+ * @param totalBoxes - (tbx) The number of existing boxes created by this account's app.
59
62
  */
60
- constructor({ address, amount, amountWithoutPendingRewards, minBalance, pendingRewards, rewards, round, status, totalAppsOptedIn, totalAssetsOptedIn, totalCreatedApps, totalCreatedAssets, appsLocalState, appsTotalExtraPages, appsTotalSchema, assets, authAddr, createdApps, createdAssets, participation, rewardBase, sigType, }) {
63
+ constructor({ address, amount, amountWithoutPendingRewards, minBalance, pendingRewards, rewards, round, status, totalAppsOptedIn, totalAssetsOptedIn, totalCreatedApps, totalCreatedAssets, appsLocalState, appsTotalExtraPages, appsTotalSchema, assets, authAddr, createdApps, createdAssets, participation, rewardBase, sigType, totalBoxBytes, totalBoxes, }) {
61
64
  super();
62
65
  this.address = address;
63
66
  this.amount = amount;
@@ -81,6 +84,8 @@ export class Account extends BaseModel {
81
84
  this.participation = participation;
82
85
  this.rewardBase = rewardBase;
83
86
  this.sigType = sigType;
87
+ this.totalBoxBytes = totalBoxBytes;
88
+ this.totalBoxes = totalBoxes;
84
89
  this.attribute_map = {
85
90
  address: 'address',
86
91
  amount: 'amount',
@@ -104,8 +109,77 @@ export class Account extends BaseModel {
104
109
  participation: 'participation',
105
110
  rewardBase: 'reward-base',
106
111
  sigType: 'sig-type',
112
+ totalBoxBytes: 'total-box-bytes',
113
+ totalBoxes: 'total-boxes',
107
114
  };
108
115
  }
116
+ // eslint-disable-next-line camelcase
117
+ static from_obj_for_encoding(data) {
118
+ /* eslint-disable dot-notation */
119
+ if (typeof data['address'] === 'undefined')
120
+ throw new Error(`Response is missing required field 'address': ${data}`);
121
+ if (typeof data['amount'] === 'undefined')
122
+ throw new Error(`Response is missing required field 'amount': ${data}`);
123
+ if (typeof data['amount-without-pending-rewards'] === 'undefined')
124
+ throw new Error(`Response is missing required field 'amount-without-pending-rewards': ${data}`);
125
+ if (typeof data['min-balance'] === 'undefined')
126
+ throw new Error(`Response is missing required field 'min-balance': ${data}`);
127
+ if (typeof data['pending-rewards'] === 'undefined')
128
+ throw new Error(`Response is missing required field 'pending-rewards': ${data}`);
129
+ if (typeof data['rewards'] === 'undefined')
130
+ throw new Error(`Response is missing required field 'rewards': ${data}`);
131
+ if (typeof data['round'] === 'undefined')
132
+ throw new Error(`Response is missing required field 'round': ${data}`);
133
+ if (typeof data['status'] === 'undefined')
134
+ throw new Error(`Response is missing required field 'status': ${data}`);
135
+ if (typeof data['total-apps-opted-in'] === 'undefined')
136
+ throw new Error(`Response is missing required field 'total-apps-opted-in': ${data}`);
137
+ if (typeof data['total-assets-opted-in'] === 'undefined')
138
+ throw new Error(`Response is missing required field 'total-assets-opted-in': ${data}`);
139
+ if (typeof data['total-created-apps'] === 'undefined')
140
+ throw new Error(`Response is missing required field 'total-created-apps': ${data}`);
141
+ if (typeof data['total-created-assets'] === 'undefined')
142
+ throw new Error(`Response is missing required field 'total-created-assets': ${data}`);
143
+ return new Account({
144
+ address: data['address'],
145
+ amount: data['amount'],
146
+ amountWithoutPendingRewards: data['amount-without-pending-rewards'],
147
+ minBalance: data['min-balance'],
148
+ pendingRewards: data['pending-rewards'],
149
+ rewards: data['rewards'],
150
+ round: data['round'],
151
+ status: data['status'],
152
+ totalAppsOptedIn: data['total-apps-opted-in'],
153
+ totalAssetsOptedIn: data['total-assets-opted-in'],
154
+ totalCreatedApps: data['total-created-apps'],
155
+ totalCreatedAssets: data['total-created-assets'],
156
+ appsLocalState: typeof data['apps-local-state'] !== 'undefined'
157
+ ? data['apps-local-state'].map(ApplicationLocalState.from_obj_for_encoding)
158
+ : undefined,
159
+ appsTotalExtraPages: data['apps-total-extra-pages'],
160
+ appsTotalSchema: typeof data['apps-total-schema'] !== 'undefined'
161
+ ? ApplicationStateSchema.from_obj_for_encoding(data['apps-total-schema'])
162
+ : undefined,
163
+ assets: typeof data['assets'] !== 'undefined'
164
+ ? data['assets'].map(AssetHolding.from_obj_for_encoding)
165
+ : undefined,
166
+ authAddr: data['auth-addr'],
167
+ createdApps: typeof data['created-apps'] !== 'undefined'
168
+ ? data['created-apps'].map(Application.from_obj_for_encoding)
169
+ : undefined,
170
+ createdAssets: typeof data['created-assets'] !== 'undefined'
171
+ ? data['created-assets'].map(Asset.from_obj_for_encoding)
172
+ : undefined,
173
+ participation: typeof data['participation'] !== 'undefined'
174
+ ? AccountParticipation.from_obj_for_encoding(data['participation'])
175
+ : undefined,
176
+ rewardBase: data['reward-base'],
177
+ sigType: data['sig-type'],
178
+ totalBoxBytes: data['total-box-bytes'],
179
+ totalBoxes: data['total-boxes'],
180
+ });
181
+ /* eslint-enable dot-notation */
182
+ }
109
183
  }
110
184
  /**
111
185
  * AccountApplicationResponse describes the account's application local state and
@@ -134,6 +208,18 @@ export class AccountApplicationResponse extends BaseModel {
134
208
  createdApp: 'created-app',
135
209
  };
136
210
  }
211
+ // eslint-disable-next-line camelcase
212
+ static from_obj_for_encoding(data) {
213
+ /* eslint-disable dot-notation */
214
+ if (typeof data['round'] === 'undefined')
215
+ throw new Error(`Response is missing required field 'round': ${data}`);
216
+ return new AccountApplicationResponse(data['round'], typeof data['app-local-state'] !== 'undefined'
217
+ ? ApplicationLocalState.from_obj_for_encoding(data['app-local-state'])
218
+ : undefined, typeof data['created-app'] !== 'undefined'
219
+ ? ApplicationParams.from_obj_for_encoding(data['created-app'])
220
+ : undefined);
221
+ /* eslint-enable dot-notation */
222
+ }
137
223
  }
138
224
  /**
139
225
  * AccountAssetResponse describes the account's asset holding and asset parameters
@@ -160,6 +246,18 @@ export class AccountAssetResponse extends BaseModel {
160
246
  createdAsset: 'created-asset',
161
247
  };
162
248
  }
249
+ // eslint-disable-next-line camelcase
250
+ static from_obj_for_encoding(data) {
251
+ /* eslint-disable dot-notation */
252
+ if (typeof data['round'] === 'undefined')
253
+ throw new Error(`Response is missing required field 'round': ${data}`);
254
+ return new AccountAssetResponse(data['round'], typeof data['asset-holding'] !== 'undefined'
255
+ ? AssetHolding.from_obj_for_encoding(data['asset-holding'])
256
+ : undefined, typeof data['created-asset'] !== 'undefined'
257
+ ? AssetParams.from_obj_for_encoding(data['created-asset'])
258
+ : undefined);
259
+ /* eslint-enable dot-notation */
260
+ }
163
261
  }
164
262
  /**
165
263
  * AccountParticipation describes the parameters used by this account in consensus
@@ -202,6 +300,29 @@ export class AccountParticipation extends BaseModel {
202
300
  stateProofKey: 'state-proof-key',
203
301
  };
204
302
  }
303
+ // eslint-disable-next-line camelcase
304
+ static from_obj_for_encoding(data) {
305
+ /* eslint-disable dot-notation */
306
+ if (typeof data['selection-participation-key'] === 'undefined')
307
+ throw new Error(`Response is missing required field 'selection-participation-key': ${data}`);
308
+ if (typeof data['vote-first-valid'] === 'undefined')
309
+ throw new Error(`Response is missing required field 'vote-first-valid': ${data}`);
310
+ if (typeof data['vote-key-dilution'] === 'undefined')
311
+ throw new Error(`Response is missing required field 'vote-key-dilution': ${data}`);
312
+ if (typeof data['vote-last-valid'] === 'undefined')
313
+ throw new Error(`Response is missing required field 'vote-last-valid': ${data}`);
314
+ if (typeof data['vote-participation-key'] === 'undefined')
315
+ throw new Error(`Response is missing required field 'vote-participation-key': ${data}`);
316
+ return new AccountParticipation({
317
+ selectionParticipationKey: data['selection-participation-key'],
318
+ voteFirstValid: data['vote-first-valid'],
319
+ voteKeyDilution: data['vote-key-dilution'],
320
+ voteLastValid: data['vote-last-valid'],
321
+ voteParticipationKey: data['vote-participation-key'],
322
+ stateProofKey: data['state-proof-key'],
323
+ });
324
+ /* eslint-enable dot-notation */
325
+ }
205
326
  }
206
327
  /**
207
328
  * Application state delta.
@@ -221,6 +342,16 @@ export class AccountStateDelta extends BaseModel {
221
342
  delta: 'delta',
222
343
  };
223
344
  }
345
+ // eslint-disable-next-line camelcase
346
+ static from_obj_for_encoding(data) {
347
+ /* eslint-disable dot-notation */
348
+ if (typeof data['address'] === 'undefined')
349
+ throw new Error(`Response is missing required field 'address': ${data}`);
350
+ if (!Array.isArray(data['delta']))
351
+ throw new Error(`Response is missing required array field 'delta': ${data}`);
352
+ return new AccountStateDelta(data['address'], data['delta'].map(EvalDeltaKeyValue.from_obj_for_encoding));
353
+ /* eslint-enable dot-notation */
354
+ }
224
355
  }
225
356
  /**
226
357
  * Application index and its parameters
@@ -240,6 +371,16 @@ export class Application extends BaseModel {
240
371
  params: 'params',
241
372
  };
242
373
  }
374
+ // eslint-disable-next-line camelcase
375
+ static from_obj_for_encoding(data) {
376
+ /* eslint-disable dot-notation */
377
+ if (typeof data['id'] === 'undefined')
378
+ throw new Error(`Response is missing required field 'id': ${data}`);
379
+ if (typeof data['params'] === 'undefined')
380
+ throw new Error(`Response is missing required field 'params': ${data}`);
381
+ return new Application(data['id'], ApplicationParams.from_obj_for_encoding(data['params']));
382
+ /* eslint-enable dot-notation */
383
+ }
243
384
  }
244
385
  /**
245
386
  * Stores local state associated with an application.
@@ -262,6 +403,18 @@ export class ApplicationLocalState extends BaseModel {
262
403
  keyValue: 'key-value',
263
404
  };
264
405
  }
406
+ // eslint-disable-next-line camelcase
407
+ static from_obj_for_encoding(data) {
408
+ /* eslint-disable dot-notation */
409
+ if (typeof data['id'] === 'undefined')
410
+ throw new Error(`Response is missing required field 'id': ${data}`);
411
+ if (typeof data['schema'] === 'undefined')
412
+ throw new Error(`Response is missing required field 'schema': ${data}`);
413
+ return new ApplicationLocalState(data['id'], ApplicationStateSchema.from_obj_for_encoding(data['schema']), typeof data['key-value'] !== 'undefined'
414
+ ? data['key-value'].map(TealKeyValue.from_obj_for_encoding)
415
+ : undefined);
416
+ /* eslint-enable dot-notation */
417
+ }
265
418
  }
266
419
  /**
267
420
  * Stores the global information associated with an application.
@@ -303,6 +456,32 @@ export class ApplicationParams extends BaseModel {
303
456
  localStateSchema: 'local-state-schema',
304
457
  };
305
458
  }
459
+ // eslint-disable-next-line camelcase
460
+ static from_obj_for_encoding(data) {
461
+ /* eslint-disable dot-notation */
462
+ if (typeof data['approval-program'] === 'undefined')
463
+ throw new Error(`Response is missing required field 'approval-program': ${data}`);
464
+ if (typeof data['clear-state-program'] === 'undefined')
465
+ throw new Error(`Response is missing required field 'clear-state-program': ${data}`);
466
+ if (typeof data['creator'] === 'undefined')
467
+ throw new Error(`Response is missing required field 'creator': ${data}`);
468
+ return new ApplicationParams({
469
+ approvalProgram: data['approval-program'],
470
+ clearStateProgram: data['clear-state-program'],
471
+ creator: data['creator'],
472
+ extraProgramPages: data['extra-program-pages'],
473
+ globalState: typeof data['global-state'] !== 'undefined'
474
+ ? data['global-state'].map(TealKeyValue.from_obj_for_encoding)
475
+ : undefined,
476
+ globalStateSchema: typeof data['global-state-schema'] !== 'undefined'
477
+ ? ApplicationStateSchema.from_obj_for_encoding(data['global-state-schema'])
478
+ : undefined,
479
+ localStateSchema: typeof data['local-state-schema'] !== 'undefined'
480
+ ? ApplicationStateSchema.from_obj_for_encoding(data['local-state-schema'])
481
+ : undefined,
482
+ });
483
+ /* eslint-enable dot-notation */
484
+ }
306
485
  }
307
486
  /**
308
487
  * Specifies maximums on the number of each type that may be stored.
@@ -322,6 +501,16 @@ export class ApplicationStateSchema extends BaseModel {
322
501
  numByteSlice: 'num-byte-slice',
323
502
  };
324
503
  }
504
+ // eslint-disable-next-line camelcase
505
+ static from_obj_for_encoding(data) {
506
+ /* eslint-disable dot-notation */
507
+ if (typeof data['num-uint'] === 'undefined')
508
+ throw new Error(`Response is missing required field 'num-uint': ${data}`);
509
+ if (typeof data['num-byte-slice'] === 'undefined')
510
+ throw new Error(`Response is missing required field 'num-byte-slice': ${data}`);
511
+ return new ApplicationStateSchema(data['num-uint'], data['num-byte-slice']);
512
+ /* eslint-enable dot-notation */
513
+ }
325
514
  }
326
515
  /**
327
516
  * Specifies both the unique identifier and the parameters for an asset
@@ -344,6 +533,16 @@ export class Asset extends BaseModel {
344
533
  params: 'params',
345
534
  };
346
535
  }
536
+ // eslint-disable-next-line camelcase
537
+ static from_obj_for_encoding(data) {
538
+ /* eslint-disable dot-notation */
539
+ if (typeof data['index'] === 'undefined')
540
+ throw new Error(`Response is missing required field 'index': ${data}`);
541
+ if (typeof data['params'] === 'undefined')
542
+ throw new Error(`Response is missing required field 'params': ${data}`);
543
+ return new Asset(data['index'], AssetParams.from_obj_for_encoding(data['params']));
544
+ /* eslint-enable dot-notation */
545
+ }
347
546
  }
348
547
  /**
349
548
  * Describes an asset held by an account.
@@ -368,6 +567,18 @@ export class AssetHolding extends BaseModel {
368
567
  isFrozen: 'is-frozen',
369
568
  };
370
569
  }
570
+ // eslint-disable-next-line camelcase
571
+ static from_obj_for_encoding(data) {
572
+ /* eslint-disable dot-notation */
573
+ if (typeof data['amount'] === 'undefined')
574
+ throw new Error(`Response is missing required field 'amount': ${data}`);
575
+ if (typeof data['asset-id'] === 'undefined')
576
+ throw new Error(`Response is missing required field 'asset-id': ${data}`);
577
+ if (typeof data['is-frozen'] === 'undefined')
578
+ throw new Error(`Response is missing required field 'is-frozen': ${data}`);
579
+ return new AssetHolding(data['amount'], data['asset-id'], data['is-frozen']);
580
+ /* eslint-enable dot-notation */
581
+ }
371
582
  }
372
583
  /**
373
584
  * AssetParams specifies the parameters for an asset.
@@ -452,6 +663,58 @@ export class AssetParams extends BaseModel {
452
663
  urlB64: 'url-b64',
453
664
  };
454
665
  }
666
+ // eslint-disable-next-line camelcase
667
+ static from_obj_for_encoding(data) {
668
+ /* eslint-disable dot-notation */
669
+ if (typeof data['creator'] === 'undefined')
670
+ throw new Error(`Response is missing required field 'creator': ${data}`);
671
+ if (typeof data['decimals'] === 'undefined')
672
+ throw new Error(`Response is missing required field 'decimals': ${data}`);
673
+ if (typeof data['total'] === 'undefined')
674
+ throw new Error(`Response is missing required field 'total': ${data}`);
675
+ return new AssetParams({
676
+ creator: data['creator'],
677
+ decimals: data['decimals'],
678
+ total: data['total'],
679
+ clawback: data['clawback'],
680
+ defaultFrozen: data['default-frozen'],
681
+ freeze: data['freeze'],
682
+ manager: data['manager'],
683
+ metadataHash: data['metadata-hash'],
684
+ name: data['name'],
685
+ nameB64: data['name-b64'],
686
+ reserve: data['reserve'],
687
+ unitName: data['unit-name'],
688
+ unitNameB64: data['unit-name-b64'],
689
+ url: data['url'],
690
+ urlB64: data['url-b64'],
691
+ });
692
+ /* eslint-enable dot-notation */
693
+ }
694
+ }
695
+ /**
696
+ * Hash of a block header.
697
+ */
698
+ export class BlockHashResponse extends BaseModel {
699
+ /**
700
+ * Creates a new `BlockHashResponse` object.
701
+ * @param blockhash - Block header hash.
702
+ */
703
+ constructor(blockhash) {
704
+ super();
705
+ this.blockhash = blockhash;
706
+ this.attribute_map = {
707
+ blockhash: 'blockHash',
708
+ };
709
+ }
710
+ // eslint-disable-next-line camelcase
711
+ static from_obj_for_encoding(data) {
712
+ /* eslint-disable dot-notation */
713
+ if (typeof data['blockHash'] === 'undefined')
714
+ throw new Error(`Response is missing required field 'blockHash': ${data}`);
715
+ return new BlockHashResponse(data['blockHash']);
716
+ /* eslint-enable dot-notation */
717
+ }
455
718
  }
456
719
  /**
457
720
  * Encoded block object.
@@ -472,6 +735,100 @@ export class BlockResponse extends BaseModel {
472
735
  cert: 'cert',
473
736
  };
474
737
  }
738
+ // eslint-disable-next-line camelcase
739
+ static from_obj_for_encoding(data) {
740
+ /* eslint-disable dot-notation */
741
+ if (typeof data['block'] === 'undefined')
742
+ throw new Error(`Response is missing required field 'block': ${data}`);
743
+ return new BlockResponse(data['block'], data['cert']);
744
+ /* eslint-enable dot-notation */
745
+ }
746
+ }
747
+ /**
748
+ * Box name and its content.
749
+ */
750
+ export class Box extends BaseModel {
751
+ /**
752
+ * Creates a new `Box` object.
753
+ * @param name - (name) box name, base64 encoded
754
+ * @param value - (value) box value, base64 encoded.
755
+ */
756
+ constructor(name, value) {
757
+ super();
758
+ this.name =
759
+ typeof name === 'string'
760
+ ? new Uint8Array(Buffer.from(name, 'base64'))
761
+ : name;
762
+ this.value =
763
+ typeof value === 'string'
764
+ ? new Uint8Array(Buffer.from(value, 'base64'))
765
+ : value;
766
+ this.attribute_map = {
767
+ name: 'name',
768
+ value: 'value',
769
+ };
770
+ }
771
+ // eslint-disable-next-line camelcase
772
+ static from_obj_for_encoding(data) {
773
+ /* eslint-disable dot-notation */
774
+ if (typeof data['name'] === 'undefined')
775
+ throw new Error(`Response is missing required field 'name': ${data}`);
776
+ if (typeof data['value'] === 'undefined')
777
+ throw new Error(`Response is missing required field 'value': ${data}`);
778
+ return new Box(data['name'], data['value']);
779
+ /* eslint-enable dot-notation */
780
+ }
781
+ }
782
+ /**
783
+ * Box descriptor describes a Box.
784
+ */
785
+ export class BoxDescriptor extends BaseModel {
786
+ /**
787
+ * Creates a new `BoxDescriptor` object.
788
+ * @param name - Base64 encoded box name
789
+ */
790
+ constructor(name) {
791
+ super();
792
+ this.name =
793
+ typeof name === 'string'
794
+ ? new Uint8Array(Buffer.from(name, 'base64'))
795
+ : name;
796
+ this.attribute_map = {
797
+ name: 'name',
798
+ };
799
+ }
800
+ // eslint-disable-next-line camelcase
801
+ static from_obj_for_encoding(data) {
802
+ /* eslint-disable dot-notation */
803
+ if (typeof data['name'] === 'undefined')
804
+ throw new Error(`Response is missing required field 'name': ${data}`);
805
+ return new BoxDescriptor(data['name']);
806
+ /* eslint-enable dot-notation */
807
+ }
808
+ }
809
+ /**
810
+ * Box names of an application
811
+ */
812
+ export class BoxesResponse extends BaseModel {
813
+ /**
814
+ * Creates a new `BoxesResponse` object.
815
+ * @param boxes -
816
+ */
817
+ constructor(boxes) {
818
+ super();
819
+ this.boxes = boxes;
820
+ this.attribute_map = {
821
+ boxes: 'boxes',
822
+ };
823
+ }
824
+ // eslint-disable-next-line camelcase
825
+ static from_obj_for_encoding(data) {
826
+ /* eslint-disable dot-notation */
827
+ if (!Array.isArray(data['boxes']))
828
+ throw new Error(`Response is missing required array field 'boxes': ${data}`);
829
+ return new BoxesResponse(data['boxes'].map(BoxDescriptor.from_obj_for_encoding));
830
+ /* eslint-enable dot-notation */
831
+ }
475
832
  }
476
833
  export class BuildVersion extends BaseModel {
477
834
  /**
@@ -500,6 +857,31 @@ export class BuildVersion extends BaseModel {
500
857
  minor: 'minor',
501
858
  };
502
859
  }
860
+ // eslint-disable-next-line camelcase
861
+ static from_obj_for_encoding(data) {
862
+ /* eslint-disable dot-notation */
863
+ if (typeof data['branch'] === 'undefined')
864
+ throw new Error(`Response is missing required field 'branch': ${data}`);
865
+ if (typeof data['build_number'] === 'undefined')
866
+ throw new Error(`Response is missing required field 'build_number': ${data}`);
867
+ if (typeof data['channel'] === 'undefined')
868
+ throw new Error(`Response is missing required field 'channel': ${data}`);
869
+ if (typeof data['commit_hash'] === 'undefined')
870
+ throw new Error(`Response is missing required field 'commit_hash': ${data}`);
871
+ if (typeof data['major'] === 'undefined')
872
+ throw new Error(`Response is missing required field 'major': ${data}`);
873
+ if (typeof data['minor'] === 'undefined')
874
+ throw new Error(`Response is missing required field 'minor': ${data}`);
875
+ return new BuildVersion({
876
+ branch: data['branch'],
877
+ buildNumber: data['build_number'],
878
+ channel: data['channel'],
879
+ commitHash: data['commit_hash'],
880
+ major: data['major'],
881
+ minor: data['minor'],
882
+ });
883
+ /* eslint-enable dot-notation */
884
+ }
503
885
  }
504
886
  /**
505
887
  *
@@ -516,6 +898,14 @@ export class CatchpointAbortResponse extends BaseModel {
516
898
  catchupMessage: 'catchup-message',
517
899
  };
518
900
  }
901
+ // eslint-disable-next-line camelcase
902
+ static from_obj_for_encoding(data) {
903
+ /* eslint-disable dot-notation */
904
+ if (typeof data['catchup-message'] === 'undefined')
905
+ throw new Error(`Response is missing required field 'catchup-message': ${data}`);
906
+ return new CatchpointAbortResponse(data['catchup-message']);
907
+ /* eslint-enable dot-notation */
908
+ }
519
909
  }
520
910
  /**
521
911
  *
@@ -532,6 +922,14 @@ export class CatchpointStartResponse extends BaseModel {
532
922
  catchupMessage: 'catchup-message',
533
923
  };
534
924
  }
925
+ // eslint-disable-next-line camelcase
926
+ static from_obj_for_encoding(data) {
927
+ /* eslint-disable dot-notation */
928
+ if (typeof data['catchup-message'] === 'undefined')
929
+ throw new Error(`Response is missing required field 'catchup-message': ${data}`);
930
+ return new CatchpointStartResponse(data['catchup-message']);
931
+ /* eslint-enable dot-notation */
932
+ }
535
933
  }
536
934
  /**
537
935
  * Teal compile Result
@@ -554,6 +952,16 @@ export class CompileResponse extends BaseModel {
554
952
  sourcemap: 'sourcemap',
555
953
  };
556
954
  }
955
+ // eslint-disable-next-line camelcase
956
+ static from_obj_for_encoding(data) {
957
+ /* eslint-disable dot-notation */
958
+ if (typeof data['hash'] === 'undefined')
959
+ throw new Error(`Response is missing required field 'hash': ${data}`);
960
+ if (typeof data['result'] === 'undefined')
961
+ throw new Error(`Response is missing required field 'result': ${data}`);
962
+ return new CompileResponse(data['hash'], data['result'], data['sourcemap']);
963
+ /* eslint-enable dot-notation */
964
+ }
557
965
  }
558
966
  /**
559
967
  * Teal disassembly Result
@@ -570,6 +978,14 @@ export class DisassembleResponse extends BaseModel {
570
978
  result: 'result',
571
979
  };
572
980
  }
981
+ // eslint-disable-next-line camelcase
982
+ static from_obj_for_encoding(data) {
983
+ /* eslint-disable dot-notation */
984
+ if (typeof data['result'] === 'undefined')
985
+ throw new Error(`Response is missing required field 'result': ${data}`);
986
+ return new DisassembleResponse(data['result']);
987
+ /* eslint-enable dot-notation */
988
+ }
573
989
  }
574
990
  /**
575
991
  * Request data type for dryrun endpoint. Given the Transactions and simulated
@@ -608,6 +1024,34 @@ export class DryrunRequest extends BaseModel {
608
1024
  txns: 'txns',
609
1025
  };
610
1026
  }
1027
+ // eslint-disable-next-line camelcase
1028
+ static from_obj_for_encoding(data) {
1029
+ /* eslint-disable dot-notation */
1030
+ if (!Array.isArray(data['accounts']))
1031
+ throw new Error(`Response is missing required array field 'accounts': ${data}`);
1032
+ if (!Array.isArray(data['apps']))
1033
+ throw new Error(`Response is missing required array field 'apps': ${data}`);
1034
+ if (typeof data['latest-timestamp'] === 'undefined')
1035
+ throw new Error(`Response is missing required field 'latest-timestamp': ${data}`);
1036
+ if (typeof data['protocol-version'] === 'undefined')
1037
+ throw new Error(`Response is missing required field 'protocol-version': ${data}`);
1038
+ if (typeof data['round'] === 'undefined')
1039
+ throw new Error(`Response is missing required field 'round': ${data}`);
1040
+ if (!Array.isArray(data['sources']))
1041
+ throw new Error(`Response is missing required array field 'sources': ${data}`);
1042
+ if (!Array.isArray(data['txns']))
1043
+ throw new Error(`Response is missing required array field 'txns': ${data}`);
1044
+ return new DryrunRequest({
1045
+ accounts: data['accounts'].map(Account.from_obj_for_encoding),
1046
+ apps: data['apps'].map(Application.from_obj_for_encoding),
1047
+ latestTimestamp: data['latest-timestamp'],
1048
+ protocolVersion: data['protocol-version'],
1049
+ round: data['round'],
1050
+ sources: data['sources'].map(DryrunSource.from_obj_for_encoding),
1051
+ txns: data['txns'],
1052
+ });
1053
+ /* eslint-enable dot-notation */
1054
+ }
611
1055
  }
612
1056
  /**
613
1057
  * DryrunResponse contains per-txn debug information from a dryrun.
@@ -630,6 +1074,18 @@ export class DryrunResponse extends BaseModel {
630
1074
  txns: 'txns',
631
1075
  };
632
1076
  }
1077
+ // eslint-disable-next-line camelcase
1078
+ static from_obj_for_encoding(data) {
1079
+ /* eslint-disable dot-notation */
1080
+ if (typeof data['error'] === 'undefined')
1081
+ throw new Error(`Response is missing required field 'error': ${data}`);
1082
+ if (typeof data['protocol-version'] === 'undefined')
1083
+ throw new Error(`Response is missing required field 'protocol-version': ${data}`);
1084
+ if (!Array.isArray(data['txns']))
1085
+ throw new Error(`Response is missing required array field 'txns': ${data}`);
1086
+ return new DryrunResponse(data['error'], data['protocol-version'], data['txns'].map(DryrunTxnResult.from_obj_for_encoding));
1087
+ /* eslint-enable dot-notation */
1088
+ }
633
1089
  }
634
1090
  /**
635
1091
  * DryrunSource is TEAL source text that gets uploaded, compiled, and inserted into
@@ -658,6 +1114,20 @@ export class DryrunSource extends BaseModel {
658
1114
  appIndex: 'app-index',
659
1115
  };
660
1116
  }
1117
+ // eslint-disable-next-line camelcase
1118
+ static from_obj_for_encoding(data) {
1119
+ /* eslint-disable dot-notation */
1120
+ if (typeof data['field-name'] === 'undefined')
1121
+ throw new Error(`Response is missing required field 'field-name': ${data}`);
1122
+ if (typeof data['source'] === 'undefined')
1123
+ throw new Error(`Response is missing required field 'source': ${data}`);
1124
+ if (typeof data['txn-index'] === 'undefined')
1125
+ throw new Error(`Response is missing required field 'txn-index': ${data}`);
1126
+ if (typeof data['app-index'] === 'undefined')
1127
+ throw new Error(`Response is missing required field 'app-index': ${data}`);
1128
+ return new DryrunSource(data['field-name'], data['source'], data['txn-index'], data['app-index']);
1129
+ /* eslint-enable dot-notation */
1130
+ }
661
1131
  }
662
1132
  /**
663
1133
  * Stores the TEAL eval step data
@@ -686,6 +1156,26 @@ export class DryrunState extends BaseModel {
686
1156
  scratch: 'scratch',
687
1157
  };
688
1158
  }
1159
+ // eslint-disable-next-line camelcase
1160
+ static from_obj_for_encoding(data) {
1161
+ /* eslint-disable dot-notation */
1162
+ if (typeof data['line'] === 'undefined')
1163
+ throw new Error(`Response is missing required field 'line': ${data}`);
1164
+ if (typeof data['pc'] === 'undefined')
1165
+ throw new Error(`Response is missing required field 'pc': ${data}`);
1166
+ if (!Array.isArray(data['stack']))
1167
+ throw new Error(`Response is missing required array field 'stack': ${data}`);
1168
+ return new DryrunState({
1169
+ line: data['line'],
1170
+ pc: data['pc'],
1171
+ stack: data['stack'].map(TealValue.from_obj_for_encoding),
1172
+ error: data['error'],
1173
+ scratch: typeof data['scratch'] !== 'undefined'
1174
+ ? data['scratch'].map(TealValue.from_obj_for_encoding)
1175
+ : undefined,
1176
+ });
1177
+ /* eslint-enable dot-notation */
1178
+ }
689
1179
  }
690
1180
  /**
691
1181
  * DryrunTxnResult contains any LogicSig or ApplicationCall program debug
@@ -737,6 +1227,35 @@ export class DryrunTxnResult extends BaseModel {
737
1227
  logs: 'logs',
738
1228
  };
739
1229
  }
1230
+ // eslint-disable-next-line camelcase
1231
+ static from_obj_for_encoding(data) {
1232
+ /* eslint-disable dot-notation */
1233
+ if (!Array.isArray(data['disassembly']))
1234
+ throw new Error(`Response is missing required array field 'disassembly': ${data}`);
1235
+ return new DryrunTxnResult({
1236
+ disassembly: data['disassembly'],
1237
+ appCallMessages: data['app-call-messages'],
1238
+ appCallTrace: typeof data['app-call-trace'] !== 'undefined'
1239
+ ? data['app-call-trace'].map(DryrunState.from_obj_for_encoding)
1240
+ : undefined,
1241
+ budgetAdded: data['budget-added'],
1242
+ budgetConsumed: data['budget-consumed'],
1243
+ cost: data['cost'],
1244
+ globalDelta: typeof data['global-delta'] !== 'undefined'
1245
+ ? data['global-delta'].map(EvalDeltaKeyValue.from_obj_for_encoding)
1246
+ : undefined,
1247
+ localDeltas: typeof data['local-deltas'] !== 'undefined'
1248
+ ? data['local-deltas'].map(AccountStateDelta.from_obj_for_encoding)
1249
+ : undefined,
1250
+ logicSigDisassembly: data['logic-sig-disassembly'],
1251
+ logicSigMessages: data['logic-sig-messages'],
1252
+ logicSigTrace: typeof data['logic-sig-trace'] !== 'undefined'
1253
+ ? data['logic-sig-trace'].map(DryrunState.from_obj_for_encoding)
1254
+ : undefined,
1255
+ logs: data['logs'],
1256
+ });
1257
+ /* eslint-enable dot-notation */
1258
+ }
740
1259
  }
741
1260
  /**
742
1261
  * An error response with optional data field.
@@ -756,6 +1275,14 @@ export class ErrorResponse extends BaseModel {
756
1275
  data: 'data',
757
1276
  };
758
1277
  }
1278
+ // eslint-disable-next-line camelcase
1279
+ static from_obj_for_encoding(data) {
1280
+ /* eslint-disable dot-notation */
1281
+ if (typeof data['message'] === 'undefined')
1282
+ throw new Error(`Response is missing required field 'message': ${data}`);
1283
+ return new ErrorResponse(data['message'], data['data']);
1284
+ /* eslint-enable dot-notation */
1285
+ }
759
1286
  }
760
1287
  /**
761
1288
  * Represents a TEAL value delta.
@@ -778,6 +1305,14 @@ export class EvalDelta extends BaseModel {
778
1305
  uint: 'uint',
779
1306
  };
780
1307
  }
1308
+ // eslint-disable-next-line camelcase
1309
+ static from_obj_for_encoding(data) {
1310
+ /* eslint-disable dot-notation */
1311
+ if (typeof data['action'] === 'undefined')
1312
+ throw new Error(`Response is missing required field 'action': ${data}`);
1313
+ return new EvalDelta(data['action'], data['bytes'], data['uint']);
1314
+ /* eslint-enable dot-notation */
1315
+ }
781
1316
  }
782
1317
  /**
783
1318
  * Key-value pairs for StateDelta.
@@ -797,6 +1332,16 @@ export class EvalDeltaKeyValue extends BaseModel {
797
1332
  value: 'value',
798
1333
  };
799
1334
  }
1335
+ // eslint-disable-next-line camelcase
1336
+ static from_obj_for_encoding(data) {
1337
+ /* eslint-disable dot-notation */
1338
+ if (typeof data['key'] === 'undefined')
1339
+ throw new Error(`Response is missing required field 'key': ${data}`);
1340
+ if (typeof data['value'] === 'undefined')
1341
+ throw new Error(`Response is missing required field 'value': ${data}`);
1342
+ return new EvalDeltaKeyValue(data['key'], EvalDelta.from_obj_for_encoding(data['value']));
1343
+ /* eslint-enable dot-notation */
1344
+ }
800
1345
  }
801
1346
  /**
802
1347
  * Proof of membership and position of a light block header.
@@ -823,6 +1368,18 @@ export class LightBlockHeaderProof extends BaseModel {
823
1368
  treedepth: 'treedepth',
824
1369
  };
825
1370
  }
1371
+ // eslint-disable-next-line camelcase
1372
+ static from_obj_for_encoding(data) {
1373
+ /* eslint-disable dot-notation */
1374
+ if (typeof data['index'] === 'undefined')
1375
+ throw new Error(`Response is missing required field 'index': ${data}`);
1376
+ if (typeof data['proof'] === 'undefined')
1377
+ throw new Error(`Response is missing required field 'proof': ${data}`);
1378
+ if (typeof data['treedepth'] === 'undefined')
1379
+ throw new Error(`Response is missing required field 'treedepth': ${data}`);
1380
+ return new LightBlockHeaderProof(data['index'], data['proof'], data['treedepth']);
1381
+ /* eslint-enable dot-notation */
1382
+ }
826
1383
  }
827
1384
  /**
828
1385
  *
@@ -887,6 +1444,44 @@ export class NodeStatusResponse extends BaseModel {
887
1444
  lastCatchpoint: 'last-catchpoint',
888
1445
  };
889
1446
  }
1447
+ // eslint-disable-next-line camelcase
1448
+ static from_obj_for_encoding(data) {
1449
+ /* eslint-disable dot-notation */
1450
+ if (typeof data['catchup-time'] === 'undefined')
1451
+ throw new Error(`Response is missing required field 'catchup-time': ${data}`);
1452
+ if (typeof data['last-round'] === 'undefined')
1453
+ throw new Error(`Response is missing required field 'last-round': ${data}`);
1454
+ if (typeof data['last-version'] === 'undefined')
1455
+ throw new Error(`Response is missing required field 'last-version': ${data}`);
1456
+ if (typeof data['next-version'] === 'undefined')
1457
+ throw new Error(`Response is missing required field 'next-version': ${data}`);
1458
+ if (typeof data['next-version-round'] === 'undefined')
1459
+ throw new Error(`Response is missing required field 'next-version-round': ${data}`);
1460
+ if (typeof data['next-version-supported'] === 'undefined')
1461
+ throw new Error(`Response is missing required field 'next-version-supported': ${data}`);
1462
+ if (typeof data['stopped-at-unsupported-round'] === 'undefined')
1463
+ throw new Error(`Response is missing required field 'stopped-at-unsupported-round': ${data}`);
1464
+ if (typeof data['time-since-last-round'] === 'undefined')
1465
+ throw new Error(`Response is missing required field 'time-since-last-round': ${data}`);
1466
+ return new NodeStatusResponse({
1467
+ catchupTime: data['catchup-time'],
1468
+ lastRound: data['last-round'],
1469
+ lastVersion: data['last-version'],
1470
+ nextVersion: data['next-version'],
1471
+ nextVersionRound: data['next-version-round'],
1472
+ nextVersionSupported: data['next-version-supported'],
1473
+ stoppedAtUnsupportedRound: data['stopped-at-unsupported-round'],
1474
+ timeSinceLastRound: data['time-since-last-round'],
1475
+ catchpoint: data['catchpoint'],
1476
+ catchpointAcquiredBlocks: data['catchpoint-acquired-blocks'],
1477
+ catchpointProcessedAccounts: data['catchpoint-processed-accounts'],
1478
+ catchpointTotalAccounts: data['catchpoint-total-accounts'],
1479
+ catchpointTotalBlocks: data['catchpoint-total-blocks'],
1480
+ catchpointVerifiedAccounts: data['catchpoint-verified-accounts'],
1481
+ lastCatchpoint: data['last-catchpoint'],
1482
+ });
1483
+ /* eslint-enable dot-notation */
1484
+ }
890
1485
  }
891
1486
  /**
892
1487
  * Details about a pending transaction. If the transaction was recently confirmed,
@@ -948,6 +1543,37 @@ export class PendingTransactionResponse extends BaseModel {
948
1543
  senderRewards: 'sender-rewards',
949
1544
  };
950
1545
  }
1546
+ // eslint-disable-next-line camelcase
1547
+ static from_obj_for_encoding(data) {
1548
+ /* eslint-disable dot-notation */
1549
+ if (typeof data['pool-error'] === 'undefined')
1550
+ throw new Error(`Response is missing required field 'pool-error': ${data}`);
1551
+ if (typeof data['txn'] === 'undefined')
1552
+ throw new Error(`Response is missing required field 'txn': ${data}`);
1553
+ return new PendingTransactionResponse({
1554
+ poolError: data['pool-error'],
1555
+ txn: data['txn'],
1556
+ applicationIndex: data['application-index'],
1557
+ assetClosingAmount: data['asset-closing-amount'],
1558
+ assetIndex: data['asset-index'],
1559
+ closeRewards: data['close-rewards'],
1560
+ closingAmount: data['closing-amount'],
1561
+ confirmedRound: data['confirmed-round'],
1562
+ globalStateDelta: typeof data['global-state-delta'] !== 'undefined'
1563
+ ? data['global-state-delta'].map(EvalDeltaKeyValue.from_obj_for_encoding)
1564
+ : undefined,
1565
+ innerTxns: typeof data['inner-txns'] !== 'undefined'
1566
+ ? data['inner-txns'].map(PendingTransactionResponse.from_obj_for_encoding)
1567
+ : undefined,
1568
+ localStateDelta: typeof data['local-state-delta'] !== 'undefined'
1569
+ ? data['local-state-delta'].map(AccountStateDelta.from_obj_for_encoding)
1570
+ : undefined,
1571
+ logs: data['logs'],
1572
+ receiverRewards: data['receiver-rewards'],
1573
+ senderRewards: data['sender-rewards'],
1574
+ });
1575
+ /* eslint-enable dot-notation */
1576
+ }
951
1577
  }
952
1578
  /**
953
1579
  * A potentially truncated list of transactions currently in the node's transaction
@@ -969,6 +1595,16 @@ export class PendingTransactionsResponse extends BaseModel {
969
1595
  totalTransactions: 'total-transactions',
970
1596
  };
971
1597
  }
1598
+ // eslint-disable-next-line camelcase
1599
+ static from_obj_for_encoding(data) {
1600
+ /* eslint-disable dot-notation */
1601
+ if (!Array.isArray(data['top-transactions']))
1602
+ throw new Error(`Response is missing required array field 'top-transactions': ${data}`);
1603
+ if (typeof data['total-transactions'] === 'undefined')
1604
+ throw new Error(`Response is missing required field 'total-transactions': ${data}`);
1605
+ return new PendingTransactionsResponse(data['top-transactions'], data['total-transactions']);
1606
+ /* eslint-enable dot-notation */
1607
+ }
972
1608
  }
973
1609
  /**
974
1610
  * Transaction ID of the submission.
@@ -985,6 +1621,14 @@ export class PostTransactionsResponse extends BaseModel {
985
1621
  txid: 'txId',
986
1622
  };
987
1623
  }
1624
+ // eslint-disable-next-line camelcase
1625
+ static from_obj_for_encoding(data) {
1626
+ /* eslint-disable dot-notation */
1627
+ if (typeof data['txId'] === 'undefined')
1628
+ throw new Error(`Response is missing required field 'txId': ${data}`);
1629
+ return new PostTransactionsResponse(data['txId']);
1630
+ /* eslint-enable dot-notation */
1631
+ }
988
1632
  }
989
1633
  /**
990
1634
  * Represents a state proof and its corresponding message
@@ -1007,6 +1651,16 @@ export class StateProof extends BaseModel {
1007
1651
  stateproof: 'StateProof',
1008
1652
  };
1009
1653
  }
1654
+ // eslint-disable-next-line camelcase
1655
+ static from_obj_for_encoding(data) {
1656
+ /* eslint-disable dot-notation */
1657
+ if (typeof data['Message'] === 'undefined')
1658
+ throw new Error(`Response is missing required field 'Message': ${data}`);
1659
+ if (typeof data['StateProof'] === 'undefined')
1660
+ throw new Error(`Response is missing required field 'StateProof': ${data}`);
1661
+ return new StateProof(StateProofMessage.from_obj_for_encoding(data['Message']), data['StateProof']);
1662
+ /* eslint-enable dot-notation */
1663
+ }
1010
1664
  }
1011
1665
  /**
1012
1666
  * Represents the message that the state proofs are attesting to.
@@ -1043,6 +1697,28 @@ export class StateProofMessage extends BaseModel {
1043
1697
  voterscommitment: 'VotersCommitment',
1044
1698
  };
1045
1699
  }
1700
+ // eslint-disable-next-line camelcase
1701
+ static from_obj_for_encoding(data) {
1702
+ /* eslint-disable dot-notation */
1703
+ if (typeof data['BlockHeadersCommitment'] === 'undefined')
1704
+ throw new Error(`Response is missing required field 'BlockHeadersCommitment': ${data}`);
1705
+ if (typeof data['FirstAttestedRound'] === 'undefined')
1706
+ throw new Error(`Response is missing required field 'FirstAttestedRound': ${data}`);
1707
+ if (typeof data['LastAttestedRound'] === 'undefined')
1708
+ throw new Error(`Response is missing required field 'LastAttestedRound': ${data}`);
1709
+ if (typeof data['LnProvenWeight'] === 'undefined')
1710
+ throw new Error(`Response is missing required field 'LnProvenWeight': ${data}`);
1711
+ if (typeof data['VotersCommitment'] === 'undefined')
1712
+ throw new Error(`Response is missing required field 'VotersCommitment': ${data}`);
1713
+ return new StateProofMessage({
1714
+ blockheaderscommitment: data['BlockHeadersCommitment'],
1715
+ firstattestedround: data['FirstAttestedRound'],
1716
+ lastattestedround: data['LastAttestedRound'],
1717
+ lnprovenweight: data['LnProvenWeight'],
1718
+ voterscommitment: data['VotersCommitment'],
1719
+ });
1720
+ /* eslint-enable dot-notation */
1721
+ }
1046
1722
  }
1047
1723
  /**
1048
1724
  * Supply represents the current supply of MicroAlgos in the system.
@@ -1065,6 +1741,18 @@ export class SupplyResponse extends BaseModel {
1065
1741
  totalMoney: 'total-money',
1066
1742
  };
1067
1743
  }
1744
+ // eslint-disable-next-line camelcase
1745
+ static from_obj_for_encoding(data) {
1746
+ /* eslint-disable dot-notation */
1747
+ if (typeof data['current_round'] === 'undefined')
1748
+ throw new Error(`Response is missing required field 'current_round': ${data}`);
1749
+ if (typeof data['online-money'] === 'undefined')
1750
+ throw new Error(`Response is missing required field 'online-money': ${data}`);
1751
+ if (typeof data['total-money'] === 'undefined')
1752
+ throw new Error(`Response is missing required field 'total-money': ${data}`);
1753
+ return new SupplyResponse(data['current_round'], data['online-money'], data['total-money']);
1754
+ /* eslint-enable dot-notation */
1755
+ }
1068
1756
  }
1069
1757
  /**
1070
1758
  * Represents a key-value pair in an application store.
@@ -1084,6 +1772,16 @@ export class TealKeyValue extends BaseModel {
1084
1772
  value: 'value',
1085
1773
  };
1086
1774
  }
1775
+ // eslint-disable-next-line camelcase
1776
+ static from_obj_for_encoding(data) {
1777
+ /* eslint-disable dot-notation */
1778
+ if (typeof data['key'] === 'undefined')
1779
+ throw new Error(`Response is missing required field 'key': ${data}`);
1780
+ if (typeof data['value'] === 'undefined')
1781
+ throw new Error(`Response is missing required field 'value': ${data}`);
1782
+ return new TealKeyValue(data['key'], TealValue.from_obj_for_encoding(data['value']));
1783
+ /* eslint-enable dot-notation */
1784
+ }
1087
1785
  }
1088
1786
  /**
1089
1787
  * Represents a TEAL value.
@@ -1106,6 +1804,18 @@ export class TealValue extends BaseModel {
1106
1804
  uint: 'uint',
1107
1805
  };
1108
1806
  }
1807
+ // eslint-disable-next-line camelcase
1808
+ static from_obj_for_encoding(data) {
1809
+ /* eslint-disable dot-notation */
1810
+ if (typeof data['type'] === 'undefined')
1811
+ throw new Error(`Response is missing required field 'type': ${data}`);
1812
+ if (typeof data['bytes'] === 'undefined')
1813
+ throw new Error(`Response is missing required field 'bytes': ${data}`);
1814
+ if (typeof data['uint'] === 'undefined')
1815
+ throw new Error(`Response is missing required field 'uint': ${data}`);
1816
+ return new TealValue(data['type'], data['bytes'], data['uint']);
1817
+ /* eslint-enable dot-notation */
1818
+ }
1109
1819
  }
1110
1820
  /**
1111
1821
  * TransactionParams contains the parameters that help a client construct a new
@@ -1146,6 +1856,31 @@ export class TransactionParametersResponse extends BaseModel {
1146
1856
  minFee: 'min-fee',
1147
1857
  };
1148
1858
  }
1859
+ // eslint-disable-next-line camelcase
1860
+ static from_obj_for_encoding(data) {
1861
+ /* eslint-disable dot-notation */
1862
+ if (typeof data['consensus-version'] === 'undefined')
1863
+ throw new Error(`Response is missing required field 'consensus-version': ${data}`);
1864
+ if (typeof data['fee'] === 'undefined')
1865
+ throw new Error(`Response is missing required field 'fee': ${data}`);
1866
+ if (typeof data['genesis-hash'] === 'undefined')
1867
+ throw new Error(`Response is missing required field 'genesis-hash': ${data}`);
1868
+ if (typeof data['genesis-id'] === 'undefined')
1869
+ throw new Error(`Response is missing required field 'genesis-id': ${data}`);
1870
+ if (typeof data['last-round'] === 'undefined')
1871
+ throw new Error(`Response is missing required field 'last-round': ${data}`);
1872
+ if (typeof data['min-fee'] === 'undefined')
1873
+ throw new Error(`Response is missing required field 'min-fee': ${data}`);
1874
+ return new TransactionParametersResponse({
1875
+ consensusVersion: data['consensus-version'],
1876
+ fee: data['fee'],
1877
+ genesisHash: data['genesis-hash'],
1878
+ genesisId: data['genesis-id'],
1879
+ lastRound: data['last-round'],
1880
+ minFee: data['min-fee'],
1881
+ });
1882
+ /* eslint-enable dot-notation */
1883
+ }
1149
1884
  }
1150
1885
  /**
1151
1886
  * Proof of transaction in a block.
@@ -1183,6 +1918,26 @@ export class TransactionProofResponse extends BaseModel {
1183
1918
  hashtype: 'hashtype',
1184
1919
  };
1185
1920
  }
1921
+ // eslint-disable-next-line camelcase
1922
+ static from_obj_for_encoding(data) {
1923
+ /* eslint-disable dot-notation */
1924
+ if (typeof data['idx'] === 'undefined')
1925
+ throw new Error(`Response is missing required field 'idx': ${data}`);
1926
+ if (typeof data['proof'] === 'undefined')
1927
+ throw new Error(`Response is missing required field 'proof': ${data}`);
1928
+ if (typeof data['stibhash'] === 'undefined')
1929
+ throw new Error(`Response is missing required field 'stibhash': ${data}`);
1930
+ if (typeof data['treedepth'] === 'undefined')
1931
+ throw new Error(`Response is missing required field 'treedepth': ${data}`);
1932
+ return new TransactionProofResponse({
1933
+ idx: data['idx'],
1934
+ proof: data['proof'],
1935
+ stibhash: data['stibhash'],
1936
+ treedepth: data['treedepth'],
1937
+ hashtype: data['hashtype'],
1938
+ });
1939
+ /* eslint-enable dot-notation */
1940
+ }
1186
1941
  }
1187
1942
  /**
1188
1943
  * algod version information.
@@ -1211,5 +1966,19 @@ export class Version extends BaseModel {
1211
1966
  versions: 'versions',
1212
1967
  };
1213
1968
  }
1969
+ // eslint-disable-next-line camelcase
1970
+ static from_obj_for_encoding(data) {
1971
+ /* eslint-disable dot-notation */
1972
+ if (typeof data['build'] === 'undefined')
1973
+ throw new Error(`Response is missing required field 'build': ${data}`);
1974
+ if (typeof data['genesis_hash_b64'] === 'undefined')
1975
+ throw new Error(`Response is missing required field 'genesis_hash_b64': ${data}`);
1976
+ if (typeof data['genesis_id'] === 'undefined')
1977
+ throw new Error(`Response is missing required field 'genesis_id': ${data}`);
1978
+ if (!Array.isArray(data['versions']))
1979
+ throw new Error(`Response is missing required array field 'versions': ${data}`);
1980
+ return new Version(BuildVersion.from_obj_for_encoding(data['build']), data['genesis_hash_b64'], data['genesis_id'], data['versions']);
1981
+ /* eslint-enable dot-notation */
1982
+ }
1214
1983
  }
1215
1984
  //# sourceMappingURL=types.js.map