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
@@ -0,0 +1,3009 @@
1
+ /**
2
+ * NOTICE: This file was generated. Editing this file manually is not recommended.
3
+ */
4
+ /* eslint-disable no-use-before-define */
5
+ import BaseModel from '../../basemodel';
6
+ /**
7
+ * Account information at a given round.
8
+ * Definition:
9
+ * data/basics/userBalance.go : AccountData
10
+ */
11
+ export class Account extends BaseModel {
12
+ /**
13
+ * Creates a new `Account` object.
14
+ * @param address - the account public key
15
+ * @param amount - (algo) total number of MicroAlgos in the account
16
+ * @param amountWithoutPendingRewards - specifies the amount of MicroAlgos in the account, without the pending rewards.
17
+ * @param pendingRewards - amount of MicroAlgos of pending rewards in this account.
18
+ * @param rewards - (ern) total rewards of MicroAlgos the account has received, including pending
19
+ * rewards.
20
+ * @param round - The round for which this information is relevant.
21
+ * @param status - (onl) delegation status of the account's MicroAlgos
22
+ * * Offline - indicates that the associated account is delegated.
23
+ * * Online - indicates that the associated account used as part of the delegation
24
+ * pool.
25
+ * * NotParticipating - indicates that the associated account is neither a
26
+ * delegator nor a delegate.
27
+ * @param totalAppsOptedIn - The count of all applications that have been opted in, equivalent to the count
28
+ * of application local data (AppLocalState objects) stored in this account.
29
+ * @param totalAssetsOptedIn - The count of all assets that have been opted in, equivalent to the count of
30
+ * AssetHolding objects held by this account.
31
+ * @param totalBoxBytes - For app-accounts only. The total number of bytes allocated for the keys and
32
+ * values of boxes which belong to the associated application.
33
+ * @param totalBoxes - For app-accounts only. The total number of boxes which belong to the associated
34
+ * application.
35
+ * @param totalCreatedApps - The count of all apps (AppParams objects) created by this account.
36
+ * @param totalCreatedAssets - The count of all assets (AssetParams objects) created by this account.
37
+ * @param appsLocalState - (appl) applications local data stored in this account.
38
+ * Note the raw object uses `map[int] -> AppLocalState` for this type.
39
+ * @param appsTotalExtraPages - (teap) the sum of all extra application program pages for this account.
40
+ * @param appsTotalSchema - (tsch) stores the sum of all of the local schemas and global schemas in this
41
+ * account.
42
+ * Note: the raw account uses `StateSchema` for this type.
43
+ * @param assets - (asset) assets held by this account.
44
+ * Note the raw object uses `map[int] -> AssetHolding` for this type.
45
+ * @param authAddr - (spend) the address against which signing should be checked. If empty, the
46
+ * address of the current account is used. This field can be updated in any
47
+ * transaction by setting the RekeyTo field.
48
+ * @param closedAtRound - Round during which this account was most recently closed.
49
+ * @param createdApps - (appp) parameters of applications created by this account including app global
50
+ * data.
51
+ * Note: the raw account uses `map[int] -> AppParams` for this type.
52
+ * @param createdAssets - (apar) parameters of assets created by this account.
53
+ * Note: the raw account uses `map[int] -> Asset` for this type.
54
+ * @param createdAtRound - Round during which this account first appeared in a transaction.
55
+ * @param deleted - Whether or not this account is currently closed.
56
+ * @param participation - AccountParticipation describes the parameters used by this account in consensus
57
+ * protocol.
58
+ * @param rewardBase - (ebase) used as part of the rewards computation. Only applicable to accounts
59
+ * which are participating.
60
+ * @param sigType - Indicates what type of signature is used by this account, must be one of:
61
+ * * sig
62
+ * * msig
63
+ * * lsig
64
+ * * or null if unknown
65
+ */
66
+ constructor({ address, amount, amountWithoutPendingRewards, pendingRewards, rewards, round, status, totalAppsOptedIn, totalAssetsOptedIn, totalBoxBytes, totalBoxes, totalCreatedApps, totalCreatedAssets, appsLocalState, appsTotalExtraPages, appsTotalSchema, assets, authAddr, closedAtRound, createdApps, createdAssets, createdAtRound, deleted, participation, rewardBase, sigType, }) {
67
+ super();
68
+ this.address = address;
69
+ this.amount = amount;
70
+ this.amountWithoutPendingRewards = amountWithoutPendingRewards;
71
+ this.pendingRewards = pendingRewards;
72
+ this.rewards = rewards;
73
+ this.round = round;
74
+ this.status = status;
75
+ this.totalAppsOptedIn = totalAppsOptedIn;
76
+ this.totalAssetsOptedIn = totalAssetsOptedIn;
77
+ this.totalBoxBytes = totalBoxBytes;
78
+ this.totalBoxes = totalBoxes;
79
+ this.totalCreatedApps = totalCreatedApps;
80
+ this.totalCreatedAssets = totalCreatedAssets;
81
+ this.appsLocalState = appsLocalState;
82
+ this.appsTotalExtraPages = appsTotalExtraPages;
83
+ this.appsTotalSchema = appsTotalSchema;
84
+ this.assets = assets;
85
+ this.authAddr = authAddr;
86
+ this.closedAtRound = closedAtRound;
87
+ this.createdApps = createdApps;
88
+ this.createdAssets = createdAssets;
89
+ this.createdAtRound = createdAtRound;
90
+ this.deleted = deleted;
91
+ this.participation = participation;
92
+ this.rewardBase = rewardBase;
93
+ this.sigType = sigType;
94
+ this.attribute_map = {
95
+ address: 'address',
96
+ amount: 'amount',
97
+ amountWithoutPendingRewards: 'amount-without-pending-rewards',
98
+ pendingRewards: 'pending-rewards',
99
+ rewards: 'rewards',
100
+ round: 'round',
101
+ status: 'status',
102
+ totalAppsOptedIn: 'total-apps-opted-in',
103
+ totalAssetsOptedIn: 'total-assets-opted-in',
104
+ totalBoxBytes: 'total-box-bytes',
105
+ totalBoxes: 'total-boxes',
106
+ totalCreatedApps: 'total-created-apps',
107
+ totalCreatedAssets: 'total-created-assets',
108
+ appsLocalState: 'apps-local-state',
109
+ appsTotalExtraPages: 'apps-total-extra-pages',
110
+ appsTotalSchema: 'apps-total-schema',
111
+ assets: 'assets',
112
+ authAddr: 'auth-addr',
113
+ closedAtRound: 'closed-at-round',
114
+ createdApps: 'created-apps',
115
+ createdAssets: 'created-assets',
116
+ createdAtRound: 'created-at-round',
117
+ deleted: 'deleted',
118
+ participation: 'participation',
119
+ rewardBase: 'reward-base',
120
+ sigType: 'sig-type',
121
+ };
122
+ }
123
+ // eslint-disable-next-line camelcase
124
+ static from_obj_for_encoding(data) {
125
+ /* eslint-disable dot-notation */
126
+ if (typeof data['address'] === 'undefined')
127
+ throw new Error(`Response is missing required field 'address': ${data}`);
128
+ if (typeof data['amount'] === 'undefined')
129
+ throw new Error(`Response is missing required field 'amount': ${data}`);
130
+ if (typeof data['amount-without-pending-rewards'] === 'undefined')
131
+ throw new Error(`Response is missing required field 'amount-without-pending-rewards': ${data}`);
132
+ if (typeof data['pending-rewards'] === 'undefined')
133
+ throw new Error(`Response is missing required field 'pending-rewards': ${data}`);
134
+ if (typeof data['rewards'] === 'undefined')
135
+ throw new Error(`Response is missing required field 'rewards': ${data}`);
136
+ if (typeof data['round'] === 'undefined')
137
+ throw new Error(`Response is missing required field 'round': ${data}`);
138
+ if (typeof data['status'] === 'undefined')
139
+ throw new Error(`Response is missing required field 'status': ${data}`);
140
+ if (typeof data['total-apps-opted-in'] === 'undefined')
141
+ throw new Error(`Response is missing required field 'total-apps-opted-in': ${data}`);
142
+ if (typeof data['total-assets-opted-in'] === 'undefined')
143
+ throw new Error(`Response is missing required field 'total-assets-opted-in': ${data}`);
144
+ if (typeof data['total-box-bytes'] === 'undefined')
145
+ throw new Error(`Response is missing required field 'total-box-bytes': ${data}`);
146
+ if (typeof data['total-boxes'] === 'undefined')
147
+ throw new Error(`Response is missing required field 'total-boxes': ${data}`);
148
+ if (typeof data['total-created-apps'] === 'undefined')
149
+ throw new Error(`Response is missing required field 'total-created-apps': ${data}`);
150
+ if (typeof data['total-created-assets'] === 'undefined')
151
+ throw new Error(`Response is missing required field 'total-created-assets': ${data}`);
152
+ return new Account({
153
+ address: data['address'],
154
+ amount: data['amount'],
155
+ amountWithoutPendingRewards: data['amount-without-pending-rewards'],
156
+ pendingRewards: data['pending-rewards'],
157
+ rewards: data['rewards'],
158
+ round: data['round'],
159
+ status: data['status'],
160
+ totalAppsOptedIn: data['total-apps-opted-in'],
161
+ totalAssetsOptedIn: data['total-assets-opted-in'],
162
+ totalBoxBytes: data['total-box-bytes'],
163
+ totalBoxes: data['total-boxes'],
164
+ totalCreatedApps: data['total-created-apps'],
165
+ totalCreatedAssets: data['total-created-assets'],
166
+ appsLocalState: typeof data['apps-local-state'] !== 'undefined'
167
+ ? data['apps-local-state'].map(ApplicationLocalState.from_obj_for_encoding)
168
+ : undefined,
169
+ appsTotalExtraPages: data['apps-total-extra-pages'],
170
+ appsTotalSchema: typeof data['apps-total-schema'] !== 'undefined'
171
+ ? ApplicationStateSchema.from_obj_for_encoding(data['apps-total-schema'])
172
+ : undefined,
173
+ assets: typeof data['assets'] !== 'undefined'
174
+ ? data['assets'].map(AssetHolding.from_obj_for_encoding)
175
+ : undefined,
176
+ authAddr: data['auth-addr'],
177
+ closedAtRound: data['closed-at-round'],
178
+ createdApps: typeof data['created-apps'] !== 'undefined'
179
+ ? data['created-apps'].map(Application.from_obj_for_encoding)
180
+ : undefined,
181
+ createdAssets: typeof data['created-assets'] !== 'undefined'
182
+ ? data['created-assets'].map(Asset.from_obj_for_encoding)
183
+ : undefined,
184
+ createdAtRound: data['created-at-round'],
185
+ deleted: data['deleted'],
186
+ participation: typeof data['participation'] !== 'undefined'
187
+ ? AccountParticipation.from_obj_for_encoding(data['participation'])
188
+ : undefined,
189
+ rewardBase: data['reward-base'],
190
+ sigType: data['sig-type'],
191
+ });
192
+ /* eslint-enable dot-notation */
193
+ }
194
+ }
195
+ /**
196
+ * AccountParticipation describes the parameters used by this account in consensus
197
+ * protocol.
198
+ */
199
+ export class AccountParticipation extends BaseModel {
200
+ /**
201
+ * Creates a new `AccountParticipation` object.
202
+ * @param selectionParticipationKey - (sel) Selection public key (if any) currently registered for this round.
203
+ * @param voteFirstValid - (voteFst) First round for which this participation is valid.
204
+ * @param voteKeyDilution - (voteKD) Number of subkeys in each batch of participation keys.
205
+ * @param voteLastValid - (voteLst) Last round for which this participation is valid.
206
+ * @param voteParticipationKey - (vote) root participation public key (if any) currently registered for this
207
+ * round.
208
+ * @param stateProofKey - (stprf) Root of the state proof key (if any)
209
+ */
210
+ constructor({ selectionParticipationKey, voteFirstValid, voteKeyDilution, voteLastValid, voteParticipationKey, stateProofKey, }) {
211
+ super();
212
+ this.selectionParticipationKey =
213
+ typeof selectionParticipationKey === 'string'
214
+ ? new Uint8Array(Buffer.from(selectionParticipationKey, 'base64'))
215
+ : selectionParticipationKey;
216
+ this.voteFirstValid = voteFirstValid;
217
+ this.voteKeyDilution = voteKeyDilution;
218
+ this.voteLastValid = voteLastValid;
219
+ this.voteParticipationKey =
220
+ typeof voteParticipationKey === 'string'
221
+ ? new Uint8Array(Buffer.from(voteParticipationKey, 'base64'))
222
+ : voteParticipationKey;
223
+ this.stateProofKey =
224
+ typeof stateProofKey === 'string'
225
+ ? new Uint8Array(Buffer.from(stateProofKey, 'base64'))
226
+ : stateProofKey;
227
+ this.attribute_map = {
228
+ selectionParticipationKey: 'selection-participation-key',
229
+ voteFirstValid: 'vote-first-valid',
230
+ voteKeyDilution: 'vote-key-dilution',
231
+ voteLastValid: 'vote-last-valid',
232
+ voteParticipationKey: 'vote-participation-key',
233
+ stateProofKey: 'state-proof-key',
234
+ };
235
+ }
236
+ // eslint-disable-next-line camelcase
237
+ static from_obj_for_encoding(data) {
238
+ /* eslint-disable dot-notation */
239
+ if (typeof data['selection-participation-key'] === 'undefined')
240
+ throw new Error(`Response is missing required field 'selection-participation-key': ${data}`);
241
+ if (typeof data['vote-first-valid'] === 'undefined')
242
+ throw new Error(`Response is missing required field 'vote-first-valid': ${data}`);
243
+ if (typeof data['vote-key-dilution'] === 'undefined')
244
+ throw new Error(`Response is missing required field 'vote-key-dilution': ${data}`);
245
+ if (typeof data['vote-last-valid'] === 'undefined')
246
+ throw new Error(`Response is missing required field 'vote-last-valid': ${data}`);
247
+ if (typeof data['vote-participation-key'] === 'undefined')
248
+ throw new Error(`Response is missing required field 'vote-participation-key': ${data}`);
249
+ return new AccountParticipation({
250
+ selectionParticipationKey: data['selection-participation-key'],
251
+ voteFirstValid: data['vote-first-valid'],
252
+ voteKeyDilution: data['vote-key-dilution'],
253
+ voteLastValid: data['vote-last-valid'],
254
+ voteParticipationKey: data['vote-participation-key'],
255
+ stateProofKey: data['state-proof-key'],
256
+ });
257
+ /* eslint-enable dot-notation */
258
+ }
259
+ }
260
+ /**
261
+ *
262
+ */
263
+ export class AccountResponse extends BaseModel {
264
+ /**
265
+ * Creates a new `AccountResponse` object.
266
+ * @param account - Account information at a given round.
267
+ * Definition:
268
+ * data/basics/userBalance.go : AccountData
269
+ * @param currentRound - Round at which the results were computed.
270
+ */
271
+ constructor({ account, currentRound, }) {
272
+ super();
273
+ this.account = account;
274
+ this.currentRound = currentRound;
275
+ this.attribute_map = {
276
+ account: 'account',
277
+ currentRound: 'current-round',
278
+ };
279
+ }
280
+ // eslint-disable-next-line camelcase
281
+ static from_obj_for_encoding(data) {
282
+ /* eslint-disable dot-notation */
283
+ if (typeof data['account'] === 'undefined')
284
+ throw new Error(`Response is missing required field 'account': ${data}`);
285
+ if (typeof data['current-round'] === 'undefined')
286
+ throw new Error(`Response is missing required field 'current-round': ${data}`);
287
+ return new AccountResponse({
288
+ account: Account.from_obj_for_encoding(data['account']),
289
+ currentRound: data['current-round'],
290
+ });
291
+ /* eslint-enable dot-notation */
292
+ }
293
+ }
294
+ /**
295
+ * Application state delta.
296
+ */
297
+ export class AccountStateDelta extends BaseModel {
298
+ /**
299
+ * Creates a new `AccountStateDelta` object.
300
+ * @param address -
301
+ * @param delta - Application state delta.
302
+ */
303
+ constructor({ address, delta, }) {
304
+ super();
305
+ this.address = address;
306
+ this.delta = delta;
307
+ this.attribute_map = {
308
+ address: 'address',
309
+ delta: 'delta',
310
+ };
311
+ }
312
+ // eslint-disable-next-line camelcase
313
+ static from_obj_for_encoding(data) {
314
+ /* eslint-disable dot-notation */
315
+ if (typeof data['address'] === 'undefined')
316
+ throw new Error(`Response is missing required field 'address': ${data}`);
317
+ if (!Array.isArray(data['delta']))
318
+ throw new Error(`Response is missing required array field 'delta': ${data}`);
319
+ return new AccountStateDelta({
320
+ address: data['address'],
321
+ delta: data['delta'].map(EvalDeltaKeyValue.from_obj_for_encoding),
322
+ });
323
+ /* eslint-enable dot-notation */
324
+ }
325
+ }
326
+ /**
327
+ *
328
+ */
329
+ export class AccountsResponse extends BaseModel {
330
+ /**
331
+ * Creates a new `AccountsResponse` object.
332
+ * @param accounts -
333
+ * @param currentRound - Round at which the results were computed.
334
+ * @param nextToken - Used for pagination, when making another request provide this token with the
335
+ * next parameter.
336
+ */
337
+ constructor({ accounts, currentRound, nextToken, }) {
338
+ super();
339
+ this.accounts = accounts;
340
+ this.currentRound = currentRound;
341
+ this.nextToken = nextToken;
342
+ this.attribute_map = {
343
+ accounts: 'accounts',
344
+ currentRound: 'current-round',
345
+ nextToken: 'next-token',
346
+ };
347
+ }
348
+ // eslint-disable-next-line camelcase
349
+ static from_obj_for_encoding(data) {
350
+ /* eslint-disable dot-notation */
351
+ if (!Array.isArray(data['accounts']))
352
+ throw new Error(`Response is missing required array field 'accounts': ${data}`);
353
+ if (typeof data['current-round'] === 'undefined')
354
+ throw new Error(`Response is missing required field 'current-round': ${data}`);
355
+ return new AccountsResponse({
356
+ accounts: data['accounts'].map(Account.from_obj_for_encoding),
357
+ currentRound: data['current-round'],
358
+ nextToken: data['next-token'],
359
+ });
360
+ /* eslint-enable dot-notation */
361
+ }
362
+ }
363
+ /**
364
+ * Application index and its parameters
365
+ */
366
+ export class Application extends BaseModel {
367
+ /**
368
+ * Creates a new `Application` object.
369
+ * @param id - (appidx) application index.
370
+ * @param params - (appparams) application parameters.
371
+ * @param createdAtRound - Round when this application was created.
372
+ * @param deleted - Whether or not this application is currently deleted.
373
+ * @param deletedAtRound - Round when this application was deleted.
374
+ */
375
+ constructor({ id, params, createdAtRound, deleted, deletedAtRound, }) {
376
+ super();
377
+ this.id = id;
378
+ this.params = params;
379
+ this.createdAtRound = createdAtRound;
380
+ this.deleted = deleted;
381
+ this.deletedAtRound = deletedAtRound;
382
+ this.attribute_map = {
383
+ id: 'id',
384
+ params: 'params',
385
+ createdAtRound: 'created-at-round',
386
+ deleted: 'deleted',
387
+ deletedAtRound: 'deleted-at-round',
388
+ };
389
+ }
390
+ // eslint-disable-next-line camelcase
391
+ static from_obj_for_encoding(data) {
392
+ /* eslint-disable dot-notation */
393
+ if (typeof data['id'] === 'undefined')
394
+ throw new Error(`Response is missing required field 'id': ${data}`);
395
+ if (typeof data['params'] === 'undefined')
396
+ throw new Error(`Response is missing required field 'params': ${data}`);
397
+ return new Application({
398
+ id: data['id'],
399
+ params: ApplicationParams.from_obj_for_encoding(data['params']),
400
+ createdAtRound: data['created-at-round'],
401
+ deleted: data['deleted'],
402
+ deletedAtRound: data['deleted-at-round'],
403
+ });
404
+ /* eslint-enable dot-notation */
405
+ }
406
+ }
407
+ /**
408
+ * Stores local state associated with an application.
409
+ */
410
+ export class ApplicationLocalState extends BaseModel {
411
+ /**
412
+ * Creates a new `ApplicationLocalState` object.
413
+ * @param id - The application which this local state is for.
414
+ * @param schema - (hsch) schema.
415
+ * @param closedOutAtRound - Round when account closed out of the application.
416
+ * @param deleted - Whether or not the application local state is currently deleted from its
417
+ * account.
418
+ * @param keyValue - (tkv) storage.
419
+ * @param optedInAtRound - Round when the account opted into the application.
420
+ */
421
+ constructor({ id, schema, closedOutAtRound, deleted, keyValue, optedInAtRound, }) {
422
+ super();
423
+ this.id = id;
424
+ this.schema = schema;
425
+ this.closedOutAtRound = closedOutAtRound;
426
+ this.deleted = deleted;
427
+ this.keyValue = keyValue;
428
+ this.optedInAtRound = optedInAtRound;
429
+ this.attribute_map = {
430
+ id: 'id',
431
+ schema: 'schema',
432
+ closedOutAtRound: 'closed-out-at-round',
433
+ deleted: 'deleted',
434
+ keyValue: 'key-value',
435
+ optedInAtRound: 'opted-in-at-round',
436
+ };
437
+ }
438
+ // eslint-disable-next-line camelcase
439
+ static from_obj_for_encoding(data) {
440
+ /* eslint-disable dot-notation */
441
+ if (typeof data['id'] === 'undefined')
442
+ throw new Error(`Response is missing required field 'id': ${data}`);
443
+ if (typeof data['schema'] === 'undefined')
444
+ throw new Error(`Response is missing required field 'schema': ${data}`);
445
+ return new ApplicationLocalState({
446
+ id: data['id'],
447
+ schema: ApplicationStateSchema.from_obj_for_encoding(data['schema']),
448
+ closedOutAtRound: data['closed-out-at-round'],
449
+ deleted: data['deleted'],
450
+ keyValue: typeof data['key-value'] !== 'undefined'
451
+ ? data['key-value'].map(TealKeyValue.from_obj_for_encoding)
452
+ : undefined,
453
+ optedInAtRound: data['opted-in-at-round'],
454
+ });
455
+ /* eslint-enable dot-notation */
456
+ }
457
+ }
458
+ /**
459
+ *
460
+ */
461
+ export class ApplicationLocalStatesResponse extends BaseModel {
462
+ /**
463
+ * Creates a new `ApplicationLocalStatesResponse` object.
464
+ * @param appsLocalStates -
465
+ * @param currentRound - Round at which the results were computed.
466
+ * @param nextToken - Used for pagination, when making another request provide this token with the
467
+ * next parameter.
468
+ */
469
+ constructor({ appsLocalStates, currentRound, nextToken, }) {
470
+ super();
471
+ this.appsLocalStates = appsLocalStates;
472
+ this.currentRound = currentRound;
473
+ this.nextToken = nextToken;
474
+ this.attribute_map = {
475
+ appsLocalStates: 'apps-local-states',
476
+ currentRound: 'current-round',
477
+ nextToken: 'next-token',
478
+ };
479
+ }
480
+ // eslint-disable-next-line camelcase
481
+ static from_obj_for_encoding(data) {
482
+ /* eslint-disable dot-notation */
483
+ if (!Array.isArray(data['apps-local-states']))
484
+ throw new Error(`Response is missing required array field 'apps-local-states': ${data}`);
485
+ if (typeof data['current-round'] === 'undefined')
486
+ throw new Error(`Response is missing required field 'current-round': ${data}`);
487
+ return new ApplicationLocalStatesResponse({
488
+ appsLocalStates: data['apps-local-states'].map(ApplicationLocalState.from_obj_for_encoding),
489
+ currentRound: data['current-round'],
490
+ nextToken: data['next-token'],
491
+ });
492
+ /* eslint-enable dot-notation */
493
+ }
494
+ }
495
+ /**
496
+ * Stores the global information associated with an application.
497
+ */
498
+ export class ApplicationLogData extends BaseModel {
499
+ /**
500
+ * Creates a new `ApplicationLogData` object.
501
+ * @param logs - (lg) Logs for the application being executed by the transaction.
502
+ * @param txid - Transaction ID
503
+ */
504
+ constructor({ logs, txid }) {
505
+ super();
506
+ this.logs = logs;
507
+ this.txid = txid;
508
+ this.attribute_map = {
509
+ logs: 'logs',
510
+ txid: 'txid',
511
+ };
512
+ }
513
+ // eslint-disable-next-line camelcase
514
+ static from_obj_for_encoding(data) {
515
+ /* eslint-disable dot-notation */
516
+ if (!Array.isArray(data['logs']))
517
+ throw new Error(`Response is missing required array field 'logs': ${data}`);
518
+ if (typeof data['txid'] === 'undefined')
519
+ throw new Error(`Response is missing required field 'txid': ${data}`);
520
+ return new ApplicationLogData({
521
+ logs: data['logs'],
522
+ txid: data['txid'],
523
+ });
524
+ /* eslint-enable dot-notation */
525
+ }
526
+ }
527
+ /**
528
+ *
529
+ */
530
+ export class ApplicationLogsResponse extends BaseModel {
531
+ /**
532
+ * Creates a new `ApplicationLogsResponse` object.
533
+ * @param applicationId - (appidx) application index.
534
+ * @param currentRound - Round at which the results were computed.
535
+ * @param logData -
536
+ * @param nextToken - Used for pagination, when making another request provide this token with the
537
+ * next parameter.
538
+ */
539
+ constructor({ applicationId, currentRound, logData, nextToken, }) {
540
+ super();
541
+ this.applicationId = applicationId;
542
+ this.currentRound = currentRound;
543
+ this.logData = logData;
544
+ this.nextToken = nextToken;
545
+ this.attribute_map = {
546
+ applicationId: 'application-id',
547
+ currentRound: 'current-round',
548
+ logData: 'log-data',
549
+ nextToken: 'next-token',
550
+ };
551
+ }
552
+ // eslint-disable-next-line camelcase
553
+ static from_obj_for_encoding(data) {
554
+ /* eslint-disable dot-notation */
555
+ if (typeof data['application-id'] === 'undefined')
556
+ throw new Error(`Response is missing required field 'application-id': ${data}`);
557
+ if (typeof data['current-round'] === 'undefined')
558
+ throw new Error(`Response is missing required field 'current-round': ${data}`);
559
+ return new ApplicationLogsResponse({
560
+ applicationId: data['application-id'],
561
+ currentRound: data['current-round'],
562
+ logData: typeof data['log-data'] !== 'undefined'
563
+ ? data['log-data'].map(ApplicationLogData.from_obj_for_encoding)
564
+ : undefined,
565
+ nextToken: data['next-token'],
566
+ });
567
+ /* eslint-enable dot-notation */
568
+ }
569
+ }
570
+ /**
571
+ * Stores the global information associated with an application.
572
+ */
573
+ export class ApplicationParams extends BaseModel {
574
+ /**
575
+ * Creates a new `ApplicationParams` object.
576
+ * @param approvalProgram - (approv) approval program.
577
+ * @param clearStateProgram - (clearp) approval program.
578
+ * @param creator - The address that created this application. This is the address where the
579
+ * parameters and global state for this application can be found.
580
+ * @param extraProgramPages - (epp) the amount of extra program pages available to this app.
581
+ * @param globalState - [\gs) global schema
582
+ * @param globalStateSchema - [\gsch) global schema
583
+ * @param localStateSchema - [\lsch) local schema
584
+ */
585
+ constructor({ approvalProgram, clearStateProgram, creator, extraProgramPages, globalState, globalStateSchema, localStateSchema, }) {
586
+ super();
587
+ this.approvalProgram =
588
+ typeof approvalProgram === 'string'
589
+ ? new Uint8Array(Buffer.from(approvalProgram, 'base64'))
590
+ : approvalProgram;
591
+ this.clearStateProgram =
592
+ typeof clearStateProgram === 'string'
593
+ ? new Uint8Array(Buffer.from(clearStateProgram, 'base64'))
594
+ : clearStateProgram;
595
+ this.creator = creator;
596
+ this.extraProgramPages = extraProgramPages;
597
+ this.globalState = globalState;
598
+ this.globalStateSchema = globalStateSchema;
599
+ this.localStateSchema = localStateSchema;
600
+ this.attribute_map = {
601
+ approvalProgram: 'approval-program',
602
+ clearStateProgram: 'clear-state-program',
603
+ creator: 'creator',
604
+ extraProgramPages: 'extra-program-pages',
605
+ globalState: 'global-state',
606
+ globalStateSchema: 'global-state-schema',
607
+ localStateSchema: 'local-state-schema',
608
+ };
609
+ }
610
+ // eslint-disable-next-line camelcase
611
+ static from_obj_for_encoding(data) {
612
+ /* eslint-disable dot-notation */
613
+ if (typeof data['approval-program'] === 'undefined')
614
+ throw new Error(`Response is missing required field 'approval-program': ${data}`);
615
+ if (typeof data['clear-state-program'] === 'undefined')
616
+ throw new Error(`Response is missing required field 'clear-state-program': ${data}`);
617
+ return new ApplicationParams({
618
+ approvalProgram: data['approval-program'],
619
+ clearStateProgram: data['clear-state-program'],
620
+ creator: data['creator'],
621
+ extraProgramPages: data['extra-program-pages'],
622
+ globalState: typeof data['global-state'] !== 'undefined'
623
+ ? data['global-state'].map(TealKeyValue.from_obj_for_encoding)
624
+ : undefined,
625
+ globalStateSchema: typeof data['global-state-schema'] !== 'undefined'
626
+ ? ApplicationStateSchema.from_obj_for_encoding(data['global-state-schema'])
627
+ : undefined,
628
+ localStateSchema: typeof data['local-state-schema'] !== 'undefined'
629
+ ? ApplicationStateSchema.from_obj_for_encoding(data['local-state-schema'])
630
+ : undefined,
631
+ });
632
+ /* eslint-enable dot-notation */
633
+ }
634
+ }
635
+ /**
636
+ *
637
+ */
638
+ export class ApplicationResponse extends BaseModel {
639
+ /**
640
+ * Creates a new `ApplicationResponse` object.
641
+ * @param currentRound - Round at which the results were computed.
642
+ * @param application - Application index and its parameters
643
+ */
644
+ constructor({ currentRound, application, }) {
645
+ super();
646
+ this.currentRound = currentRound;
647
+ this.application = application;
648
+ this.attribute_map = {
649
+ currentRound: 'current-round',
650
+ application: 'application',
651
+ };
652
+ }
653
+ // eslint-disable-next-line camelcase
654
+ static from_obj_for_encoding(data) {
655
+ /* eslint-disable dot-notation */
656
+ if (typeof data['current-round'] === 'undefined')
657
+ throw new Error(`Response is missing required field 'current-round': ${data}`);
658
+ return new ApplicationResponse({
659
+ currentRound: data['current-round'],
660
+ application: typeof data['application'] !== 'undefined'
661
+ ? Application.from_obj_for_encoding(data['application'])
662
+ : undefined,
663
+ });
664
+ /* eslint-enable dot-notation */
665
+ }
666
+ }
667
+ /**
668
+ * Specifies maximums on the number of each type that may be stored.
669
+ */
670
+ export class ApplicationStateSchema extends BaseModel {
671
+ /**
672
+ * Creates a new `ApplicationStateSchema` object.
673
+ * @param numByteSlice - (nbs) num of byte slices.
674
+ * @param numUint - (nui) num of uints.
675
+ */
676
+ constructor({ numByteSlice, numUint, }) {
677
+ super();
678
+ this.numByteSlice = numByteSlice;
679
+ this.numUint = numUint;
680
+ this.attribute_map = {
681
+ numByteSlice: 'num-byte-slice',
682
+ numUint: 'num-uint',
683
+ };
684
+ }
685
+ // eslint-disable-next-line camelcase
686
+ static from_obj_for_encoding(data) {
687
+ /* eslint-disable dot-notation */
688
+ if (typeof data['num-byte-slice'] === 'undefined')
689
+ throw new Error(`Response is missing required field 'num-byte-slice': ${data}`);
690
+ if (typeof data['num-uint'] === 'undefined')
691
+ throw new Error(`Response is missing required field 'num-uint': ${data}`);
692
+ return new ApplicationStateSchema({
693
+ numByteSlice: data['num-byte-slice'],
694
+ numUint: data['num-uint'],
695
+ });
696
+ /* eslint-enable dot-notation */
697
+ }
698
+ }
699
+ /**
700
+ *
701
+ */
702
+ export class ApplicationsResponse extends BaseModel {
703
+ /**
704
+ * Creates a new `ApplicationsResponse` object.
705
+ * @param applications -
706
+ * @param currentRound - Round at which the results were computed.
707
+ * @param nextToken - Used for pagination, when making another request provide this token with the
708
+ * next parameter.
709
+ */
710
+ constructor({ applications, currentRound, nextToken, }) {
711
+ super();
712
+ this.applications = applications;
713
+ this.currentRound = currentRound;
714
+ this.nextToken = nextToken;
715
+ this.attribute_map = {
716
+ applications: 'applications',
717
+ currentRound: 'current-round',
718
+ nextToken: 'next-token',
719
+ };
720
+ }
721
+ // eslint-disable-next-line camelcase
722
+ static from_obj_for_encoding(data) {
723
+ /* eslint-disable dot-notation */
724
+ if (!Array.isArray(data['applications']))
725
+ throw new Error(`Response is missing required array field 'applications': ${data}`);
726
+ if (typeof data['current-round'] === 'undefined')
727
+ throw new Error(`Response is missing required field 'current-round': ${data}`);
728
+ return new ApplicationsResponse({
729
+ applications: data['applications'].map(Application.from_obj_for_encoding),
730
+ currentRound: data['current-round'],
731
+ nextToken: data['next-token'],
732
+ });
733
+ /* eslint-enable dot-notation */
734
+ }
735
+ }
736
+ /**
737
+ * Specifies both the unique identifier and the parameters for an asset
738
+ */
739
+ export class Asset extends BaseModel {
740
+ /**
741
+ * Creates a new `Asset` object.
742
+ * @param index - unique asset identifier
743
+ * @param params - AssetParams specifies the parameters for an asset.
744
+ * (apar) when part of an AssetConfig transaction.
745
+ * Definition:
746
+ * data/transactions/asset.go : AssetParams
747
+ * @param createdAtRound - Round during which this asset was created.
748
+ * @param deleted - Whether or not this asset is currently deleted.
749
+ * @param destroyedAtRound - Round during which this asset was destroyed.
750
+ */
751
+ constructor({ index, params, createdAtRound, deleted, destroyedAtRound, }) {
752
+ super();
753
+ this.index = index;
754
+ this.params = params;
755
+ this.createdAtRound = createdAtRound;
756
+ this.deleted = deleted;
757
+ this.destroyedAtRound = destroyedAtRound;
758
+ this.attribute_map = {
759
+ index: 'index',
760
+ params: 'params',
761
+ createdAtRound: 'created-at-round',
762
+ deleted: 'deleted',
763
+ destroyedAtRound: 'destroyed-at-round',
764
+ };
765
+ }
766
+ // eslint-disable-next-line camelcase
767
+ static from_obj_for_encoding(data) {
768
+ /* eslint-disable dot-notation */
769
+ if (typeof data['index'] === 'undefined')
770
+ throw new Error(`Response is missing required field 'index': ${data}`);
771
+ if (typeof data['params'] === 'undefined')
772
+ throw new Error(`Response is missing required field 'params': ${data}`);
773
+ return new Asset({
774
+ index: data['index'],
775
+ params: AssetParams.from_obj_for_encoding(data['params']),
776
+ createdAtRound: data['created-at-round'],
777
+ deleted: data['deleted'],
778
+ destroyedAtRound: data['destroyed-at-round'],
779
+ });
780
+ /* eslint-enable dot-notation */
781
+ }
782
+ }
783
+ /**
784
+ *
785
+ */
786
+ export class AssetBalancesResponse extends BaseModel {
787
+ /**
788
+ * Creates a new `AssetBalancesResponse` object.
789
+ * @param balances -
790
+ * @param currentRound - Round at which the results were computed.
791
+ * @param nextToken - Used for pagination, when making another request provide this token with the
792
+ * next parameter.
793
+ */
794
+ constructor({ balances, currentRound, nextToken, }) {
795
+ super();
796
+ this.balances = balances;
797
+ this.currentRound = currentRound;
798
+ this.nextToken = nextToken;
799
+ this.attribute_map = {
800
+ balances: 'balances',
801
+ currentRound: 'current-round',
802
+ nextToken: 'next-token',
803
+ };
804
+ }
805
+ // eslint-disable-next-line camelcase
806
+ static from_obj_for_encoding(data) {
807
+ /* eslint-disable dot-notation */
808
+ if (!Array.isArray(data['balances']))
809
+ throw new Error(`Response is missing required array field 'balances': ${data}`);
810
+ if (typeof data['current-round'] === 'undefined')
811
+ throw new Error(`Response is missing required field 'current-round': ${data}`);
812
+ return new AssetBalancesResponse({
813
+ balances: data['balances'].map(MiniAssetHolding.from_obj_for_encoding),
814
+ currentRound: data['current-round'],
815
+ nextToken: data['next-token'],
816
+ });
817
+ /* eslint-enable dot-notation */
818
+ }
819
+ }
820
+ /**
821
+ * Describes an asset held by an account.
822
+ * Definition:
823
+ * data/basics/userBalance.go : AssetHolding
824
+ */
825
+ export class AssetHolding extends BaseModel {
826
+ /**
827
+ * Creates a new `AssetHolding` object.
828
+ * @param amount - (a) number of units held.
829
+ * @param assetId - Asset ID of the holding.
830
+ * @param isFrozen - (f) whether or not the holding is frozen.
831
+ * @param deleted - Whether or not the asset holding is currently deleted from its account.
832
+ * @param optedInAtRound - Round during which the account opted into this asset holding.
833
+ * @param optedOutAtRound - Round during which the account opted out of this asset holding.
834
+ */
835
+ constructor({ amount, assetId, isFrozen, deleted, optedInAtRound, optedOutAtRound, }) {
836
+ super();
837
+ this.amount = amount;
838
+ this.assetId = assetId;
839
+ this.isFrozen = isFrozen;
840
+ this.deleted = deleted;
841
+ this.optedInAtRound = optedInAtRound;
842
+ this.optedOutAtRound = optedOutAtRound;
843
+ this.attribute_map = {
844
+ amount: 'amount',
845
+ assetId: 'asset-id',
846
+ isFrozen: 'is-frozen',
847
+ deleted: 'deleted',
848
+ optedInAtRound: 'opted-in-at-round',
849
+ optedOutAtRound: 'opted-out-at-round',
850
+ };
851
+ }
852
+ // eslint-disable-next-line camelcase
853
+ static from_obj_for_encoding(data) {
854
+ /* eslint-disable dot-notation */
855
+ if (typeof data['amount'] === 'undefined')
856
+ throw new Error(`Response is missing required field 'amount': ${data}`);
857
+ if (typeof data['asset-id'] === 'undefined')
858
+ throw new Error(`Response is missing required field 'asset-id': ${data}`);
859
+ if (typeof data['is-frozen'] === 'undefined')
860
+ throw new Error(`Response is missing required field 'is-frozen': ${data}`);
861
+ return new AssetHolding({
862
+ amount: data['amount'],
863
+ assetId: data['asset-id'],
864
+ isFrozen: data['is-frozen'],
865
+ deleted: data['deleted'],
866
+ optedInAtRound: data['opted-in-at-round'],
867
+ optedOutAtRound: data['opted-out-at-round'],
868
+ });
869
+ /* eslint-enable dot-notation */
870
+ }
871
+ }
872
+ /**
873
+ *
874
+ */
875
+ export class AssetHoldingsResponse extends BaseModel {
876
+ /**
877
+ * Creates a new `AssetHoldingsResponse` object.
878
+ * @param assets -
879
+ * @param currentRound - Round at which the results were computed.
880
+ * @param nextToken - Used for pagination, when making another request provide this token with the
881
+ * next parameter.
882
+ */
883
+ constructor({ assets, currentRound, nextToken, }) {
884
+ super();
885
+ this.assets = assets;
886
+ this.currentRound = currentRound;
887
+ this.nextToken = nextToken;
888
+ this.attribute_map = {
889
+ assets: 'assets',
890
+ currentRound: 'current-round',
891
+ nextToken: 'next-token',
892
+ };
893
+ }
894
+ // eslint-disable-next-line camelcase
895
+ static from_obj_for_encoding(data) {
896
+ /* eslint-disable dot-notation */
897
+ if (!Array.isArray(data['assets']))
898
+ throw new Error(`Response is missing required array field 'assets': ${data}`);
899
+ if (typeof data['current-round'] === 'undefined')
900
+ throw new Error(`Response is missing required field 'current-round': ${data}`);
901
+ return new AssetHoldingsResponse({
902
+ assets: data['assets'].map(AssetHolding.from_obj_for_encoding),
903
+ currentRound: data['current-round'],
904
+ nextToken: data['next-token'],
905
+ });
906
+ /* eslint-enable dot-notation */
907
+ }
908
+ }
909
+ /**
910
+ * AssetParams specifies the parameters for an asset.
911
+ * (apar) when part of an AssetConfig transaction.
912
+ * Definition:
913
+ * data/transactions/asset.go : AssetParams
914
+ */
915
+ export class AssetParams extends BaseModel {
916
+ /**
917
+ * Creates a new `AssetParams` object.
918
+ * @param creator - The address that created this asset. This is the address where the parameters
919
+ * for this asset can be found, and also the address where unwanted asset units can
920
+ * be sent in the worst case.
921
+ * @param decimals - (dc) The number of digits to use after the decimal point when displaying this
922
+ * asset. If 0, the asset is not divisible. If 1, the base unit of the asset is in
923
+ * tenths. If 2, the base unit of the asset is in hundredths, and so on. This value
924
+ * must be between 0 and 19 (inclusive).
925
+ * @param total - (t) The total number of units of this asset.
926
+ * @param clawback - (c) Address of account used to clawback holdings of this asset. If empty,
927
+ * clawback is not permitted.
928
+ * @param defaultFrozen - (df) Whether holdings of this asset are frozen by default.
929
+ * @param freeze - (f) Address of account used to freeze holdings of this asset. If empty, freezing
930
+ * is not permitted.
931
+ * @param manager - (m) Address of account used to manage the keys of this asset and to destroy it.
932
+ * @param metadataHash - (am) A commitment to some unspecified asset metadata. The format of this
933
+ * metadata is up to the application.
934
+ * @param name - (an) Name of this asset, as supplied by the creator. Included only when the
935
+ * asset name is composed of printable utf-8 characters.
936
+ * @param nameB64 - Base64 encoded name of this asset, as supplied by the creator.
937
+ * @param reserve - (r) Address of account holding reserve (non-minted) units of this asset.
938
+ * @param unitName - (un) Name of a unit of this asset, as supplied by the creator. Included only
939
+ * when the name of a unit of this asset is composed of printable utf-8 characters.
940
+ * @param unitNameB64 - Base64 encoded name of a unit of this asset, as supplied by the creator.
941
+ * @param url - (au) URL where more information about the asset can be retrieved. Included only
942
+ * when the URL is composed of printable utf-8 characters.
943
+ * @param urlB64 - Base64 encoded URL where more information about the asset can be retrieved.
944
+ */
945
+ constructor({ creator, decimals, total, clawback, defaultFrozen, freeze, manager, metadataHash, name, nameB64, reserve, unitName, unitNameB64, url, urlB64, }) {
946
+ super();
947
+ this.creator = creator;
948
+ this.decimals = decimals;
949
+ this.total = total;
950
+ this.clawback = clawback;
951
+ this.defaultFrozen = defaultFrozen;
952
+ this.freeze = freeze;
953
+ this.manager = manager;
954
+ this.metadataHash =
955
+ typeof metadataHash === 'string'
956
+ ? new Uint8Array(Buffer.from(metadataHash, 'base64'))
957
+ : metadataHash;
958
+ this.name = name;
959
+ this.nameB64 =
960
+ typeof nameB64 === 'string'
961
+ ? new Uint8Array(Buffer.from(nameB64, 'base64'))
962
+ : nameB64;
963
+ this.reserve = reserve;
964
+ this.unitName = unitName;
965
+ this.unitNameB64 =
966
+ typeof unitNameB64 === 'string'
967
+ ? new Uint8Array(Buffer.from(unitNameB64, 'base64'))
968
+ : unitNameB64;
969
+ this.url = url;
970
+ this.urlB64 =
971
+ typeof urlB64 === 'string'
972
+ ? new Uint8Array(Buffer.from(urlB64, 'base64'))
973
+ : urlB64;
974
+ this.attribute_map = {
975
+ creator: 'creator',
976
+ decimals: 'decimals',
977
+ total: 'total',
978
+ clawback: 'clawback',
979
+ defaultFrozen: 'default-frozen',
980
+ freeze: 'freeze',
981
+ manager: 'manager',
982
+ metadataHash: 'metadata-hash',
983
+ name: 'name',
984
+ nameB64: 'name-b64',
985
+ reserve: 'reserve',
986
+ unitName: 'unit-name',
987
+ unitNameB64: 'unit-name-b64',
988
+ url: 'url',
989
+ urlB64: 'url-b64',
990
+ };
991
+ }
992
+ // eslint-disable-next-line camelcase
993
+ static from_obj_for_encoding(data) {
994
+ /* eslint-disable dot-notation */
995
+ if (typeof data['creator'] === 'undefined')
996
+ throw new Error(`Response is missing required field 'creator': ${data}`);
997
+ if (typeof data['decimals'] === 'undefined')
998
+ throw new Error(`Response is missing required field 'decimals': ${data}`);
999
+ if (typeof data['total'] === 'undefined')
1000
+ throw new Error(`Response is missing required field 'total': ${data}`);
1001
+ return new AssetParams({
1002
+ creator: data['creator'],
1003
+ decimals: data['decimals'],
1004
+ total: data['total'],
1005
+ clawback: data['clawback'],
1006
+ defaultFrozen: data['default-frozen'],
1007
+ freeze: data['freeze'],
1008
+ manager: data['manager'],
1009
+ metadataHash: data['metadata-hash'],
1010
+ name: data['name'],
1011
+ nameB64: data['name-b64'],
1012
+ reserve: data['reserve'],
1013
+ unitName: data['unit-name'],
1014
+ unitNameB64: data['unit-name-b64'],
1015
+ url: data['url'],
1016
+ urlB64: data['url-b64'],
1017
+ });
1018
+ /* eslint-enable dot-notation */
1019
+ }
1020
+ }
1021
+ /**
1022
+ *
1023
+ */
1024
+ export class AssetResponse extends BaseModel {
1025
+ /**
1026
+ * Creates a new `AssetResponse` object.
1027
+ * @param asset - Specifies both the unique identifier and the parameters for an asset
1028
+ * @param currentRound - Round at which the results were computed.
1029
+ */
1030
+ constructor({ asset, currentRound, }) {
1031
+ super();
1032
+ this.asset = asset;
1033
+ this.currentRound = currentRound;
1034
+ this.attribute_map = {
1035
+ asset: 'asset',
1036
+ currentRound: 'current-round',
1037
+ };
1038
+ }
1039
+ // eslint-disable-next-line camelcase
1040
+ static from_obj_for_encoding(data) {
1041
+ /* eslint-disable dot-notation */
1042
+ if (typeof data['asset'] === 'undefined')
1043
+ throw new Error(`Response is missing required field 'asset': ${data}`);
1044
+ if (typeof data['current-round'] === 'undefined')
1045
+ throw new Error(`Response is missing required field 'current-round': ${data}`);
1046
+ return new AssetResponse({
1047
+ asset: Asset.from_obj_for_encoding(data['asset']),
1048
+ currentRound: data['current-round'],
1049
+ });
1050
+ /* eslint-enable dot-notation */
1051
+ }
1052
+ }
1053
+ /**
1054
+ *
1055
+ */
1056
+ export class AssetsResponse extends BaseModel {
1057
+ /**
1058
+ * Creates a new `AssetsResponse` object.
1059
+ * @param assets -
1060
+ * @param currentRound - Round at which the results were computed.
1061
+ * @param nextToken - Used for pagination, when making another request provide this token with the
1062
+ * next parameter.
1063
+ */
1064
+ constructor({ assets, currentRound, nextToken, }) {
1065
+ super();
1066
+ this.assets = assets;
1067
+ this.currentRound = currentRound;
1068
+ this.nextToken = nextToken;
1069
+ this.attribute_map = {
1070
+ assets: 'assets',
1071
+ currentRound: 'current-round',
1072
+ nextToken: 'next-token',
1073
+ };
1074
+ }
1075
+ // eslint-disable-next-line camelcase
1076
+ static from_obj_for_encoding(data) {
1077
+ /* eslint-disable dot-notation */
1078
+ if (!Array.isArray(data['assets']))
1079
+ throw new Error(`Response is missing required array field 'assets': ${data}`);
1080
+ if (typeof data['current-round'] === 'undefined')
1081
+ throw new Error(`Response is missing required field 'current-round': ${data}`);
1082
+ return new AssetsResponse({
1083
+ assets: data['assets'].map(Asset.from_obj_for_encoding),
1084
+ currentRound: data['current-round'],
1085
+ nextToken: data['next-token'],
1086
+ });
1087
+ /* eslint-enable dot-notation */
1088
+ }
1089
+ }
1090
+ /**
1091
+ * Block information.
1092
+ * Definition:
1093
+ * data/bookkeeping/block.go : Block
1094
+ */
1095
+ export class Block extends BaseModel {
1096
+ /**
1097
+ * Creates a new `Block` object.
1098
+ * @param genesisHash - (gh) hash to which this block belongs.
1099
+ * @param genesisId - (gen) ID to which this block belongs.
1100
+ * @param previousBlockHash - (prev) Previous block hash.
1101
+ * @param round - (rnd) Current round on which this block was appended to the chain.
1102
+ * @param seed - (seed) Sortition seed.
1103
+ * @param timestamp - (ts) Block creation timestamp in seconds since eposh
1104
+ * @param transactionsRoot - (txn) TransactionsRoot authenticates the set of transactions appearing in the
1105
+ * block. More specifically, it's the root of a merkle tree whose leaves are the
1106
+ * block's Txids, in lexicographic order. For the empty block, it's 0. Note that
1107
+ * the TxnRoot does not authenticate the signatures on the transactions, only the
1108
+ * transactions themselves. Two blocks with the same transactions but in a
1109
+ * different order and with different signatures will have the same TxnRoot.
1110
+ * @param transactionsRootSha256 - (txn256) TransactionsRootSHA256 is an auxiliary TransactionRoot, built using a
1111
+ * vector commitment instead of a merkle tree, and SHA256 hash function instead of
1112
+ * the default SHA512_256. This commitment can be used on environments where only
1113
+ * the SHA256 function exists.
1114
+ * @param participationUpdates - Participation account data that needs to be checked/acted on by the network.
1115
+ * @param rewards - Fields relating to rewards,
1116
+ * @param stateProofTracking - Tracks the status of state proofs.
1117
+ * @param transactions - (txns) list of transactions corresponding to a given round.
1118
+ * @param txnCounter - (tc) TxnCounter counts the number of transactions committed in the ledger, from
1119
+ * the time at which support for this feature was introduced.
1120
+ * Specifically, TxnCounter is the number of the next transaction that will be
1121
+ * committed after this block. It is 0 when no transactions have ever been
1122
+ * committed (since TxnCounter started being supported).
1123
+ * @param upgradeState - Fields relating to a protocol upgrade.
1124
+ * @param upgradeVote - Fields relating to voting for a protocol upgrade.
1125
+ */
1126
+ constructor({ genesisHash, genesisId, previousBlockHash, round, seed, timestamp, transactionsRoot, transactionsRootSha256, participationUpdates, rewards, stateProofTracking, transactions, txnCounter, upgradeState, upgradeVote, }) {
1127
+ super();
1128
+ this.genesisHash =
1129
+ typeof genesisHash === 'string'
1130
+ ? new Uint8Array(Buffer.from(genesisHash, 'base64'))
1131
+ : genesisHash;
1132
+ this.genesisId = genesisId;
1133
+ this.previousBlockHash =
1134
+ typeof previousBlockHash === 'string'
1135
+ ? new Uint8Array(Buffer.from(previousBlockHash, 'base64'))
1136
+ : previousBlockHash;
1137
+ this.round = round;
1138
+ this.seed =
1139
+ typeof seed === 'string'
1140
+ ? new Uint8Array(Buffer.from(seed, 'base64'))
1141
+ : seed;
1142
+ this.timestamp = timestamp;
1143
+ this.transactionsRoot =
1144
+ typeof transactionsRoot === 'string'
1145
+ ? new Uint8Array(Buffer.from(transactionsRoot, 'base64'))
1146
+ : transactionsRoot;
1147
+ this.transactionsRootSha256 =
1148
+ typeof transactionsRootSha256 === 'string'
1149
+ ? new Uint8Array(Buffer.from(transactionsRootSha256, 'base64'))
1150
+ : transactionsRootSha256;
1151
+ this.participationUpdates = participationUpdates;
1152
+ this.rewards = rewards;
1153
+ this.stateProofTracking = stateProofTracking;
1154
+ this.transactions = transactions;
1155
+ this.txnCounter = txnCounter;
1156
+ this.upgradeState = upgradeState;
1157
+ this.upgradeVote = upgradeVote;
1158
+ this.attribute_map = {
1159
+ genesisHash: 'genesis-hash',
1160
+ genesisId: 'genesis-id',
1161
+ previousBlockHash: 'previous-block-hash',
1162
+ round: 'round',
1163
+ seed: 'seed',
1164
+ timestamp: 'timestamp',
1165
+ transactionsRoot: 'transactions-root',
1166
+ transactionsRootSha256: 'transactions-root-sha256',
1167
+ participationUpdates: 'participation-updates',
1168
+ rewards: 'rewards',
1169
+ stateProofTracking: 'state-proof-tracking',
1170
+ transactions: 'transactions',
1171
+ txnCounter: 'txn-counter',
1172
+ upgradeState: 'upgrade-state',
1173
+ upgradeVote: 'upgrade-vote',
1174
+ };
1175
+ }
1176
+ // eslint-disable-next-line camelcase
1177
+ static from_obj_for_encoding(data) {
1178
+ /* eslint-disable dot-notation */
1179
+ if (typeof data['genesis-hash'] === 'undefined')
1180
+ throw new Error(`Response is missing required field 'genesis-hash': ${data}`);
1181
+ if (typeof data['genesis-id'] === 'undefined')
1182
+ throw new Error(`Response is missing required field 'genesis-id': ${data}`);
1183
+ if (typeof data['previous-block-hash'] === 'undefined')
1184
+ throw new Error(`Response is missing required field 'previous-block-hash': ${data}`);
1185
+ if (typeof data['round'] === 'undefined')
1186
+ throw new Error(`Response is missing required field 'round': ${data}`);
1187
+ if (typeof data['seed'] === 'undefined')
1188
+ throw new Error(`Response is missing required field 'seed': ${data}`);
1189
+ if (typeof data['timestamp'] === 'undefined')
1190
+ throw new Error(`Response is missing required field 'timestamp': ${data}`);
1191
+ if (typeof data['transactions-root'] === 'undefined')
1192
+ throw new Error(`Response is missing required field 'transactions-root': ${data}`);
1193
+ if (typeof data['transactions-root-sha256'] === 'undefined')
1194
+ throw new Error(`Response is missing required field 'transactions-root-sha256': ${data}`);
1195
+ return new Block({
1196
+ genesisHash: data['genesis-hash'],
1197
+ genesisId: data['genesis-id'],
1198
+ previousBlockHash: data['previous-block-hash'],
1199
+ round: data['round'],
1200
+ seed: data['seed'],
1201
+ timestamp: data['timestamp'],
1202
+ transactionsRoot: data['transactions-root'],
1203
+ transactionsRootSha256: data['transactions-root-sha256'],
1204
+ participationUpdates: typeof data['participation-updates'] !== 'undefined'
1205
+ ? ParticipationUpdates.from_obj_for_encoding(data['participation-updates'])
1206
+ : undefined,
1207
+ rewards: typeof data['rewards'] !== 'undefined'
1208
+ ? BlockRewards.from_obj_for_encoding(data['rewards'])
1209
+ : undefined,
1210
+ stateProofTracking: typeof data['state-proof-tracking'] !== 'undefined'
1211
+ ? data['state-proof-tracking'].map(StateProofTracking.from_obj_for_encoding)
1212
+ : undefined,
1213
+ transactions: typeof data['transactions'] !== 'undefined'
1214
+ ? data['transactions'].map(Transaction.from_obj_for_encoding)
1215
+ : undefined,
1216
+ txnCounter: data['txn-counter'],
1217
+ upgradeState: typeof data['upgrade-state'] !== 'undefined'
1218
+ ? BlockUpgradeState.from_obj_for_encoding(data['upgrade-state'])
1219
+ : undefined,
1220
+ upgradeVote: typeof data['upgrade-vote'] !== 'undefined'
1221
+ ? BlockUpgradeVote.from_obj_for_encoding(data['upgrade-vote'])
1222
+ : undefined,
1223
+ });
1224
+ /* eslint-enable dot-notation */
1225
+ }
1226
+ }
1227
+ /**
1228
+ * Fields relating to rewards,
1229
+ */
1230
+ export class BlockRewards extends BaseModel {
1231
+ /**
1232
+ * Creates a new `BlockRewards` object.
1233
+ * @param feeSink - (fees) accepts transaction fees, it can only spend to the incentive pool.
1234
+ * @param rewardsCalculationRound - (rwcalr) number of leftover MicroAlgos after the distribution of rewards-rate
1235
+ * MicroAlgos for every reward unit in the next round.
1236
+ * @param rewardsLevel - (earn) How many rewards, in MicroAlgos, have been distributed to each RewardUnit
1237
+ * of MicroAlgos since genesis.
1238
+ * @param rewardsPool - (rwd) accepts periodic injections from the fee-sink and continually
1239
+ * redistributes them as rewards.
1240
+ * @param rewardsRate - (rate) Number of new MicroAlgos added to the participation stake from rewards at
1241
+ * the next round.
1242
+ * @param rewardsResidue - (frac) Number of leftover MicroAlgos after the distribution of
1243
+ * RewardsRate/rewardUnits MicroAlgos for every reward unit in the next round.
1244
+ */
1245
+ constructor({ feeSink, rewardsCalculationRound, rewardsLevel, rewardsPool, rewardsRate, rewardsResidue, }) {
1246
+ super();
1247
+ this.feeSink = feeSink;
1248
+ this.rewardsCalculationRound = rewardsCalculationRound;
1249
+ this.rewardsLevel = rewardsLevel;
1250
+ this.rewardsPool = rewardsPool;
1251
+ this.rewardsRate = rewardsRate;
1252
+ this.rewardsResidue = rewardsResidue;
1253
+ this.attribute_map = {
1254
+ feeSink: 'fee-sink',
1255
+ rewardsCalculationRound: 'rewards-calculation-round',
1256
+ rewardsLevel: 'rewards-level',
1257
+ rewardsPool: 'rewards-pool',
1258
+ rewardsRate: 'rewards-rate',
1259
+ rewardsResidue: 'rewards-residue',
1260
+ };
1261
+ }
1262
+ // eslint-disable-next-line camelcase
1263
+ static from_obj_for_encoding(data) {
1264
+ /* eslint-disable dot-notation */
1265
+ if (typeof data['fee-sink'] === 'undefined')
1266
+ throw new Error(`Response is missing required field 'fee-sink': ${data}`);
1267
+ if (typeof data['rewards-calculation-round'] === 'undefined')
1268
+ throw new Error(`Response is missing required field 'rewards-calculation-round': ${data}`);
1269
+ if (typeof data['rewards-level'] === 'undefined')
1270
+ throw new Error(`Response is missing required field 'rewards-level': ${data}`);
1271
+ if (typeof data['rewards-pool'] === 'undefined')
1272
+ throw new Error(`Response is missing required field 'rewards-pool': ${data}`);
1273
+ if (typeof data['rewards-rate'] === 'undefined')
1274
+ throw new Error(`Response is missing required field 'rewards-rate': ${data}`);
1275
+ if (typeof data['rewards-residue'] === 'undefined')
1276
+ throw new Error(`Response is missing required field 'rewards-residue': ${data}`);
1277
+ return new BlockRewards({
1278
+ feeSink: data['fee-sink'],
1279
+ rewardsCalculationRound: data['rewards-calculation-round'],
1280
+ rewardsLevel: data['rewards-level'],
1281
+ rewardsPool: data['rewards-pool'],
1282
+ rewardsRate: data['rewards-rate'],
1283
+ rewardsResidue: data['rewards-residue'],
1284
+ });
1285
+ /* eslint-enable dot-notation */
1286
+ }
1287
+ }
1288
+ /**
1289
+ * Fields relating to a protocol upgrade.
1290
+ */
1291
+ export class BlockUpgradeState extends BaseModel {
1292
+ /**
1293
+ * Creates a new `BlockUpgradeState` object.
1294
+ * @param currentProtocol - (proto) The current protocol version.
1295
+ * @param nextProtocol - (nextproto) The next proposed protocol version.
1296
+ * @param nextProtocolApprovals - (nextyes) Number of blocks which approved the protocol upgrade.
1297
+ * @param nextProtocolSwitchOn - (nextswitch) Round on which the protocol upgrade will take effect.
1298
+ * @param nextProtocolVoteBefore - (nextbefore) Deadline round for this protocol upgrade (No votes will be consider
1299
+ * after this round).
1300
+ */
1301
+ constructor({ currentProtocol, nextProtocol, nextProtocolApprovals, nextProtocolSwitchOn, nextProtocolVoteBefore, }) {
1302
+ super();
1303
+ this.currentProtocol = currentProtocol;
1304
+ this.nextProtocol = nextProtocol;
1305
+ this.nextProtocolApprovals = nextProtocolApprovals;
1306
+ this.nextProtocolSwitchOn = nextProtocolSwitchOn;
1307
+ this.nextProtocolVoteBefore = nextProtocolVoteBefore;
1308
+ this.attribute_map = {
1309
+ currentProtocol: 'current-protocol',
1310
+ nextProtocol: 'next-protocol',
1311
+ nextProtocolApprovals: 'next-protocol-approvals',
1312
+ nextProtocolSwitchOn: 'next-protocol-switch-on',
1313
+ nextProtocolVoteBefore: 'next-protocol-vote-before',
1314
+ };
1315
+ }
1316
+ // eslint-disable-next-line camelcase
1317
+ static from_obj_for_encoding(data) {
1318
+ /* eslint-disable dot-notation */
1319
+ if (typeof data['current-protocol'] === 'undefined')
1320
+ throw new Error(`Response is missing required field 'current-protocol': ${data}`);
1321
+ return new BlockUpgradeState({
1322
+ currentProtocol: data['current-protocol'],
1323
+ nextProtocol: data['next-protocol'],
1324
+ nextProtocolApprovals: data['next-protocol-approvals'],
1325
+ nextProtocolSwitchOn: data['next-protocol-switch-on'],
1326
+ nextProtocolVoteBefore: data['next-protocol-vote-before'],
1327
+ });
1328
+ /* eslint-enable dot-notation */
1329
+ }
1330
+ }
1331
+ /**
1332
+ * Fields relating to voting for a protocol upgrade.
1333
+ */
1334
+ export class BlockUpgradeVote extends BaseModel {
1335
+ /**
1336
+ * Creates a new `BlockUpgradeVote` object.
1337
+ * @param upgradeApprove - (upgradeyes) Indicates a yes vote for the current proposal.
1338
+ * @param upgradeDelay - (upgradedelay) Indicates the time between acceptance and execution.
1339
+ * @param upgradePropose - (upgradeprop) Indicates a proposed upgrade.
1340
+ */
1341
+ constructor({ upgradeApprove, upgradeDelay, upgradePropose, }) {
1342
+ super();
1343
+ this.upgradeApprove = upgradeApprove;
1344
+ this.upgradeDelay = upgradeDelay;
1345
+ this.upgradePropose = upgradePropose;
1346
+ this.attribute_map = {
1347
+ upgradeApprove: 'upgrade-approve',
1348
+ upgradeDelay: 'upgrade-delay',
1349
+ upgradePropose: 'upgrade-propose',
1350
+ };
1351
+ }
1352
+ // eslint-disable-next-line camelcase
1353
+ static from_obj_for_encoding(data) {
1354
+ /* eslint-disable dot-notation */
1355
+ return new BlockUpgradeVote({
1356
+ upgradeApprove: data['upgrade-approve'],
1357
+ upgradeDelay: data['upgrade-delay'],
1358
+ upgradePropose: data['upgrade-propose'],
1359
+ });
1360
+ /* eslint-enable dot-notation */
1361
+ }
1362
+ }
1363
+ /**
1364
+ * Box name and its content.
1365
+ */
1366
+ export class Box extends BaseModel {
1367
+ /**
1368
+ * Creates a new `Box` object.
1369
+ * @param name - (name) box name, base64 encoded
1370
+ * @param value - (value) box value, base64 encoded.
1371
+ */
1372
+ constructor({ name, value, }) {
1373
+ super();
1374
+ this.name =
1375
+ typeof name === 'string'
1376
+ ? new Uint8Array(Buffer.from(name, 'base64'))
1377
+ : name;
1378
+ this.value =
1379
+ typeof value === 'string'
1380
+ ? new Uint8Array(Buffer.from(value, 'base64'))
1381
+ : value;
1382
+ this.attribute_map = {
1383
+ name: 'name',
1384
+ value: 'value',
1385
+ };
1386
+ }
1387
+ // eslint-disable-next-line camelcase
1388
+ static from_obj_for_encoding(data) {
1389
+ /* eslint-disable dot-notation */
1390
+ if (typeof data['name'] === 'undefined')
1391
+ throw new Error(`Response is missing required field 'name': ${data}`);
1392
+ if (typeof data['value'] === 'undefined')
1393
+ throw new Error(`Response is missing required field 'value': ${data}`);
1394
+ return new Box({
1395
+ name: data['name'],
1396
+ value: data['value'],
1397
+ });
1398
+ /* eslint-enable dot-notation */
1399
+ }
1400
+ }
1401
+ /**
1402
+ * Box descriptor describes an app box without a value.
1403
+ */
1404
+ export class BoxDescriptor extends BaseModel {
1405
+ /**
1406
+ * Creates a new `BoxDescriptor` object.
1407
+ * @param name - Base64 encoded box name
1408
+ */
1409
+ constructor({ name }) {
1410
+ super();
1411
+ this.name =
1412
+ typeof name === 'string'
1413
+ ? new Uint8Array(Buffer.from(name, 'base64'))
1414
+ : name;
1415
+ this.attribute_map = {
1416
+ name: 'name',
1417
+ };
1418
+ }
1419
+ // eslint-disable-next-line camelcase
1420
+ static from_obj_for_encoding(data) {
1421
+ /* eslint-disable dot-notation */
1422
+ if (typeof data['name'] === 'undefined')
1423
+ throw new Error(`Response is missing required field 'name': ${data}`);
1424
+ return new BoxDescriptor({
1425
+ name: data['name'],
1426
+ });
1427
+ /* eslint-enable dot-notation */
1428
+ }
1429
+ }
1430
+ /**
1431
+ * Box names of an application
1432
+ */
1433
+ export class BoxesResponse extends BaseModel {
1434
+ /**
1435
+ * Creates a new `BoxesResponse` object.
1436
+ * @param applicationId - (appidx) application index.
1437
+ * @param boxes -
1438
+ * @param nextToken - Used for pagination, when making another request provide this token with the
1439
+ * next parameter.
1440
+ */
1441
+ constructor({ applicationId, boxes, nextToken, }) {
1442
+ super();
1443
+ this.applicationId = applicationId;
1444
+ this.boxes = boxes;
1445
+ this.nextToken = nextToken;
1446
+ this.attribute_map = {
1447
+ applicationId: 'application-id',
1448
+ boxes: 'boxes',
1449
+ nextToken: 'next-token',
1450
+ };
1451
+ }
1452
+ // eslint-disable-next-line camelcase
1453
+ static from_obj_for_encoding(data) {
1454
+ /* eslint-disable dot-notation */
1455
+ if (typeof data['application-id'] === 'undefined')
1456
+ throw new Error(`Response is missing required field 'application-id': ${data}`);
1457
+ if (!Array.isArray(data['boxes']))
1458
+ throw new Error(`Response is missing required array field 'boxes': ${data}`);
1459
+ return new BoxesResponse({
1460
+ applicationId: data['application-id'],
1461
+ boxes: data['boxes'].map(BoxDescriptor.from_obj_for_encoding),
1462
+ nextToken: data['next-token'],
1463
+ });
1464
+ /* eslint-enable dot-notation */
1465
+ }
1466
+ }
1467
+ /**
1468
+ * Response for errors
1469
+ */
1470
+ export class ErrorResponse extends BaseModel {
1471
+ /**
1472
+ * Creates a new `ErrorResponse` object.
1473
+ * @param message -
1474
+ * @param data -
1475
+ */
1476
+ constructor({ message, data, }) {
1477
+ super();
1478
+ this.message = message;
1479
+ this.data = data;
1480
+ this.attribute_map = {
1481
+ message: 'message',
1482
+ data: 'data',
1483
+ };
1484
+ }
1485
+ // eslint-disable-next-line camelcase
1486
+ static from_obj_for_encoding(data) {
1487
+ /* eslint-disable dot-notation */
1488
+ if (typeof data['message'] === 'undefined')
1489
+ throw new Error(`Response is missing required field 'message': ${data}`);
1490
+ return new ErrorResponse({
1491
+ message: data['message'],
1492
+ data: data['data'],
1493
+ });
1494
+ /* eslint-enable dot-notation */
1495
+ }
1496
+ }
1497
+ /**
1498
+ * Represents a TEAL value delta.
1499
+ */
1500
+ export class EvalDelta extends BaseModel {
1501
+ /**
1502
+ * Creates a new `EvalDelta` object.
1503
+ * @param action - (at) delta action.
1504
+ * @param bytes - (bs) bytes value.
1505
+ * @param uint - (ui) uint value.
1506
+ */
1507
+ constructor({ action, bytes, uint, }) {
1508
+ super();
1509
+ this.action = action;
1510
+ this.bytes = bytes;
1511
+ this.uint = uint;
1512
+ this.attribute_map = {
1513
+ action: 'action',
1514
+ bytes: 'bytes',
1515
+ uint: 'uint',
1516
+ };
1517
+ }
1518
+ // eslint-disable-next-line camelcase
1519
+ static from_obj_for_encoding(data) {
1520
+ /* eslint-disable dot-notation */
1521
+ if (typeof data['action'] === 'undefined')
1522
+ throw new Error(`Response is missing required field 'action': ${data}`);
1523
+ return new EvalDelta({
1524
+ action: data['action'],
1525
+ bytes: data['bytes'],
1526
+ uint: data['uint'],
1527
+ });
1528
+ /* eslint-enable dot-notation */
1529
+ }
1530
+ }
1531
+ /**
1532
+ * Key-value pairs for StateDelta.
1533
+ */
1534
+ export class EvalDeltaKeyValue extends BaseModel {
1535
+ /**
1536
+ * Creates a new `EvalDeltaKeyValue` object.
1537
+ * @param key -
1538
+ * @param value - Represents a TEAL value delta.
1539
+ */
1540
+ constructor({ key, value }) {
1541
+ super();
1542
+ this.key = key;
1543
+ this.value = value;
1544
+ this.attribute_map = {
1545
+ key: 'key',
1546
+ value: 'value',
1547
+ };
1548
+ }
1549
+ // eslint-disable-next-line camelcase
1550
+ static from_obj_for_encoding(data) {
1551
+ /* eslint-disable dot-notation */
1552
+ if (typeof data['key'] === 'undefined')
1553
+ throw new Error(`Response is missing required field 'key': ${data}`);
1554
+ if (typeof data['value'] === 'undefined')
1555
+ throw new Error(`Response is missing required field 'value': ${data}`);
1556
+ return new EvalDeltaKeyValue({
1557
+ key: data['key'],
1558
+ value: EvalDelta.from_obj_for_encoding(data['value']),
1559
+ });
1560
+ /* eslint-enable dot-notation */
1561
+ }
1562
+ }
1563
+ export class HashFactory extends BaseModel {
1564
+ /**
1565
+ * Creates a new `HashFactory` object.
1566
+ * @param hashType - (t)
1567
+ */
1568
+ constructor({ hashType }) {
1569
+ super();
1570
+ this.hashType = hashType;
1571
+ this.attribute_map = {
1572
+ hashType: 'hash-type',
1573
+ };
1574
+ }
1575
+ // eslint-disable-next-line camelcase
1576
+ static from_obj_for_encoding(data) {
1577
+ /* eslint-disable dot-notation */
1578
+ return new HashFactory({
1579
+ hashType: data['hash-type'],
1580
+ });
1581
+ /* eslint-enable dot-notation */
1582
+ }
1583
+ }
1584
+ /**
1585
+ * A health check response.
1586
+ */
1587
+ export class HealthCheck extends BaseModel {
1588
+ /**
1589
+ * Creates a new `HealthCheck` object.
1590
+ * @param dbAvailable -
1591
+ * @param isMigrating -
1592
+ * @param message -
1593
+ * @param round -
1594
+ * @param version - Current version.
1595
+ * @param data -
1596
+ * @param errors -
1597
+ */
1598
+ constructor({ dbAvailable, isMigrating, message, round, version, data, errors, }) {
1599
+ super();
1600
+ this.dbAvailable = dbAvailable;
1601
+ this.isMigrating = isMigrating;
1602
+ this.message = message;
1603
+ this.round = round;
1604
+ this.version = version;
1605
+ this.data = data;
1606
+ this.errors = errors;
1607
+ this.attribute_map = {
1608
+ dbAvailable: 'db-available',
1609
+ isMigrating: 'is-migrating',
1610
+ message: 'message',
1611
+ round: 'round',
1612
+ version: 'version',
1613
+ data: 'data',
1614
+ errors: 'errors',
1615
+ };
1616
+ }
1617
+ // eslint-disable-next-line camelcase
1618
+ static from_obj_for_encoding(data) {
1619
+ /* eslint-disable dot-notation */
1620
+ if (typeof data['db-available'] === 'undefined')
1621
+ throw new Error(`Response is missing required field 'db-available': ${data}`);
1622
+ if (typeof data['is-migrating'] === 'undefined')
1623
+ throw new Error(`Response is missing required field 'is-migrating': ${data}`);
1624
+ if (typeof data['message'] === 'undefined')
1625
+ throw new Error(`Response is missing required field 'message': ${data}`);
1626
+ if (typeof data['round'] === 'undefined')
1627
+ throw new Error(`Response is missing required field 'round': ${data}`);
1628
+ if (typeof data['version'] === 'undefined')
1629
+ throw new Error(`Response is missing required field 'version': ${data}`);
1630
+ return new HealthCheck({
1631
+ dbAvailable: data['db-available'],
1632
+ isMigrating: data['is-migrating'],
1633
+ message: data['message'],
1634
+ round: data['round'],
1635
+ version: data['version'],
1636
+ data: data['data'],
1637
+ errors: data['errors'],
1638
+ });
1639
+ /* eslint-enable dot-notation */
1640
+ }
1641
+ }
1642
+ export class IndexerStateProofMessage extends BaseModel {
1643
+ /**
1644
+ * Creates a new `IndexerStateProofMessage` object.
1645
+ * @param blockHeadersCommitment - (b)
1646
+ * @param firstAttestedRound - (f)
1647
+ * @param latestAttestedRound - (l)
1648
+ * @param lnProvenWeight - (P)
1649
+ * @param votersCommitment - (v)
1650
+ */
1651
+ constructor({ blockHeadersCommitment, firstAttestedRound, latestAttestedRound, lnProvenWeight, votersCommitment, }) {
1652
+ super();
1653
+ this.blockHeadersCommitment =
1654
+ typeof blockHeadersCommitment === 'string'
1655
+ ? new Uint8Array(Buffer.from(blockHeadersCommitment, 'base64'))
1656
+ : blockHeadersCommitment;
1657
+ this.firstAttestedRound = firstAttestedRound;
1658
+ this.latestAttestedRound = latestAttestedRound;
1659
+ this.lnProvenWeight = lnProvenWeight;
1660
+ this.votersCommitment =
1661
+ typeof votersCommitment === 'string'
1662
+ ? new Uint8Array(Buffer.from(votersCommitment, 'base64'))
1663
+ : votersCommitment;
1664
+ this.attribute_map = {
1665
+ blockHeadersCommitment: 'block-headers-commitment',
1666
+ firstAttestedRound: 'first-attested-round',
1667
+ latestAttestedRound: 'latest-attested-round',
1668
+ lnProvenWeight: 'ln-proven-weight',
1669
+ votersCommitment: 'voters-commitment',
1670
+ };
1671
+ }
1672
+ // eslint-disable-next-line camelcase
1673
+ static from_obj_for_encoding(data) {
1674
+ /* eslint-disable dot-notation */
1675
+ return new IndexerStateProofMessage({
1676
+ blockHeadersCommitment: data['block-headers-commitment'],
1677
+ firstAttestedRound: data['first-attested-round'],
1678
+ latestAttestedRound: data['latest-attested-round'],
1679
+ lnProvenWeight: data['ln-proven-weight'],
1680
+ votersCommitment: data['voters-commitment'],
1681
+ });
1682
+ /* eslint-enable dot-notation */
1683
+ }
1684
+ }
1685
+ export class MerkleArrayProof extends BaseModel {
1686
+ /**
1687
+ * Creates a new `MerkleArrayProof` object.
1688
+ * @param hashFactory -
1689
+ * @param path - (pth)
1690
+ * @param treeDepth - (td)
1691
+ */
1692
+ constructor({ hashFactory, path, treeDepth, }) {
1693
+ super();
1694
+ this.hashFactory = hashFactory;
1695
+ this.path = path;
1696
+ this.treeDepth = treeDepth;
1697
+ this.attribute_map = {
1698
+ hashFactory: 'hash-factory',
1699
+ path: 'path',
1700
+ treeDepth: 'tree-depth',
1701
+ };
1702
+ }
1703
+ // eslint-disable-next-line camelcase
1704
+ static from_obj_for_encoding(data) {
1705
+ /* eslint-disable dot-notation */
1706
+ return new MerkleArrayProof({
1707
+ hashFactory: typeof data['hash-factory'] !== 'undefined'
1708
+ ? HashFactory.from_obj_for_encoding(data['hash-factory'])
1709
+ : undefined,
1710
+ path: data['path'],
1711
+ treeDepth: data['tree-depth'],
1712
+ });
1713
+ /* eslint-enable dot-notation */
1714
+ }
1715
+ }
1716
+ /**
1717
+ * A simplified version of AssetHolding
1718
+ */
1719
+ export class MiniAssetHolding extends BaseModel {
1720
+ /**
1721
+ * Creates a new `MiniAssetHolding` object.
1722
+ * @param address -
1723
+ * @param amount -
1724
+ * @param isFrozen -
1725
+ * @param deleted - Whether or not this asset holding is currently deleted from its account.
1726
+ * @param optedInAtRound - Round during which the account opted into the asset.
1727
+ * @param optedOutAtRound - Round during which the account opted out of the asset.
1728
+ */
1729
+ constructor({ address, amount, isFrozen, deleted, optedInAtRound, optedOutAtRound, }) {
1730
+ super();
1731
+ this.address = address;
1732
+ this.amount = amount;
1733
+ this.isFrozen = isFrozen;
1734
+ this.deleted = deleted;
1735
+ this.optedInAtRound = optedInAtRound;
1736
+ this.optedOutAtRound = optedOutAtRound;
1737
+ this.attribute_map = {
1738
+ address: 'address',
1739
+ amount: 'amount',
1740
+ isFrozen: 'is-frozen',
1741
+ deleted: 'deleted',
1742
+ optedInAtRound: 'opted-in-at-round',
1743
+ optedOutAtRound: 'opted-out-at-round',
1744
+ };
1745
+ }
1746
+ // eslint-disable-next-line camelcase
1747
+ static from_obj_for_encoding(data) {
1748
+ /* eslint-disable dot-notation */
1749
+ if (typeof data['address'] === 'undefined')
1750
+ throw new Error(`Response is missing required field 'address': ${data}`);
1751
+ if (typeof data['amount'] === 'undefined')
1752
+ throw new Error(`Response is missing required field 'amount': ${data}`);
1753
+ if (typeof data['is-frozen'] === 'undefined')
1754
+ throw new Error(`Response is missing required field 'is-frozen': ${data}`);
1755
+ return new MiniAssetHolding({
1756
+ address: data['address'],
1757
+ amount: data['amount'],
1758
+ isFrozen: data['is-frozen'],
1759
+ deleted: data['deleted'],
1760
+ optedInAtRound: data['opted-in-at-round'],
1761
+ optedOutAtRound: data['opted-out-at-round'],
1762
+ });
1763
+ /* eslint-enable dot-notation */
1764
+ }
1765
+ }
1766
+ /**
1767
+ * Participation account data that needs to be checked/acted on by the network.
1768
+ */
1769
+ export class ParticipationUpdates extends BaseModel {
1770
+ /**
1771
+ * Creates a new `ParticipationUpdates` object.
1772
+ * @param expiredParticipationAccounts - (partupdrmv) a list of online accounts that needs to be converted to offline
1773
+ * since their participation key expired.
1774
+ */
1775
+ constructor({ expiredParticipationAccounts, }) {
1776
+ super();
1777
+ this.expiredParticipationAccounts = expiredParticipationAccounts;
1778
+ this.attribute_map = {
1779
+ expiredParticipationAccounts: 'expired-participation-accounts',
1780
+ };
1781
+ }
1782
+ // eslint-disable-next-line camelcase
1783
+ static from_obj_for_encoding(data) {
1784
+ /* eslint-disable dot-notation */
1785
+ return new ParticipationUpdates({
1786
+ expiredParticipationAccounts: data['expired-participation-accounts'],
1787
+ });
1788
+ /* eslint-enable dot-notation */
1789
+ }
1790
+ }
1791
+ /**
1792
+ * (sp) represents a state proof.
1793
+ * Definition:
1794
+ * crypto/stateproof/structs.go : StateProof
1795
+ */
1796
+ export class StateProofFields extends BaseModel {
1797
+ /**
1798
+ * Creates a new `StateProofFields` object.
1799
+ * @param partProofs - (P)
1800
+ * @param positionsToReveal - (pr) Sequence of reveal positions.
1801
+ * @param reveals - (r) Note that this is actually stored as a map[uint64] - Reveal in the actual
1802
+ * msgp
1803
+ * @param saltVersion - (v) Salt version of the merkle signature.
1804
+ * @param sigCommit - (c)
1805
+ * @param sigProofs - (S)
1806
+ * @param signedWeight - (w)
1807
+ */
1808
+ constructor({ partProofs, positionsToReveal, reveals, saltVersion, sigCommit, sigProofs, signedWeight, }) {
1809
+ super();
1810
+ this.partProofs = partProofs;
1811
+ this.positionsToReveal = positionsToReveal;
1812
+ this.reveals = reveals;
1813
+ this.saltVersion = saltVersion;
1814
+ this.sigCommit =
1815
+ typeof sigCommit === 'string'
1816
+ ? new Uint8Array(Buffer.from(sigCommit, 'base64'))
1817
+ : sigCommit;
1818
+ this.sigProofs = sigProofs;
1819
+ this.signedWeight = signedWeight;
1820
+ this.attribute_map = {
1821
+ partProofs: 'part-proofs',
1822
+ positionsToReveal: 'positions-to-reveal',
1823
+ reveals: 'reveals',
1824
+ saltVersion: 'salt-version',
1825
+ sigCommit: 'sig-commit',
1826
+ sigProofs: 'sig-proofs',
1827
+ signedWeight: 'signed-weight',
1828
+ };
1829
+ }
1830
+ // eslint-disable-next-line camelcase
1831
+ static from_obj_for_encoding(data) {
1832
+ /* eslint-disable dot-notation */
1833
+ return new StateProofFields({
1834
+ partProofs: typeof data['part-proofs'] !== 'undefined'
1835
+ ? MerkleArrayProof.from_obj_for_encoding(data['part-proofs'])
1836
+ : undefined,
1837
+ positionsToReveal: data['positions-to-reveal'],
1838
+ reveals: typeof data['reveals'] !== 'undefined'
1839
+ ? data['reveals'].map(StateProofReveal.from_obj_for_encoding)
1840
+ : undefined,
1841
+ saltVersion: data['salt-version'],
1842
+ sigCommit: data['sig-commit'],
1843
+ sigProofs: typeof data['sig-proofs'] !== 'undefined'
1844
+ ? MerkleArrayProof.from_obj_for_encoding(data['sig-proofs'])
1845
+ : undefined,
1846
+ signedWeight: data['signed-weight'],
1847
+ });
1848
+ /* eslint-enable dot-notation */
1849
+ }
1850
+ }
1851
+ export class StateProofParticipant extends BaseModel {
1852
+ /**
1853
+ * Creates a new `StateProofParticipant` object.
1854
+ * @param verifier - (p)
1855
+ * @param weight - (w)
1856
+ */
1857
+ constructor({ verifier, weight, }) {
1858
+ super();
1859
+ this.verifier = verifier;
1860
+ this.weight = weight;
1861
+ this.attribute_map = {
1862
+ verifier: 'verifier',
1863
+ weight: 'weight',
1864
+ };
1865
+ }
1866
+ // eslint-disable-next-line camelcase
1867
+ static from_obj_for_encoding(data) {
1868
+ /* eslint-disable dot-notation */
1869
+ return new StateProofParticipant({
1870
+ verifier: typeof data['verifier'] !== 'undefined'
1871
+ ? StateProofVerifier.from_obj_for_encoding(data['verifier'])
1872
+ : undefined,
1873
+ weight: data['weight'],
1874
+ });
1875
+ /* eslint-enable dot-notation */
1876
+ }
1877
+ }
1878
+ export class StateProofReveal extends BaseModel {
1879
+ /**
1880
+ * Creates a new `StateProofReveal` object.
1881
+ * @param participant - (p)
1882
+ * @param position - The position in the signature and participants arrays corresponding to this
1883
+ * entry.
1884
+ * @param sigSlot - (s)
1885
+ */
1886
+ constructor({ participant, position, sigSlot, }) {
1887
+ super();
1888
+ this.participant = participant;
1889
+ this.position = position;
1890
+ this.sigSlot = sigSlot;
1891
+ this.attribute_map = {
1892
+ participant: 'participant',
1893
+ position: 'position',
1894
+ sigSlot: 'sig-slot',
1895
+ };
1896
+ }
1897
+ // eslint-disable-next-line camelcase
1898
+ static from_obj_for_encoding(data) {
1899
+ /* eslint-disable dot-notation */
1900
+ return new StateProofReveal({
1901
+ participant: typeof data['participant'] !== 'undefined'
1902
+ ? StateProofParticipant.from_obj_for_encoding(data['participant'])
1903
+ : undefined,
1904
+ position: data['position'],
1905
+ sigSlot: typeof data['sig-slot'] !== 'undefined'
1906
+ ? StateProofSigSlot.from_obj_for_encoding(data['sig-slot'])
1907
+ : undefined,
1908
+ });
1909
+ /* eslint-enable dot-notation */
1910
+ }
1911
+ }
1912
+ export class StateProofSigSlot extends BaseModel {
1913
+ /**
1914
+ * Creates a new `StateProofSigSlot` object.
1915
+ * @param lowerSigWeight - (l) The total weight of signatures in the lower-numbered slots.
1916
+ * @param signature -
1917
+ */
1918
+ constructor({ lowerSigWeight, signature, }) {
1919
+ super();
1920
+ this.lowerSigWeight = lowerSigWeight;
1921
+ this.signature = signature;
1922
+ this.attribute_map = {
1923
+ lowerSigWeight: 'lower-sig-weight',
1924
+ signature: 'signature',
1925
+ };
1926
+ }
1927
+ // eslint-disable-next-line camelcase
1928
+ static from_obj_for_encoding(data) {
1929
+ /* eslint-disable dot-notation */
1930
+ return new StateProofSigSlot({
1931
+ lowerSigWeight: data['lower-sig-weight'],
1932
+ signature: typeof data['signature'] !== 'undefined'
1933
+ ? StateProofSignature.from_obj_for_encoding(data['signature'])
1934
+ : undefined,
1935
+ });
1936
+ /* eslint-enable dot-notation */
1937
+ }
1938
+ }
1939
+ export class StateProofSignature extends BaseModel {
1940
+ /**
1941
+ * Creates a new `StateProofSignature` object.
1942
+ * @param falconSignature -
1943
+ * @param merkleArrayIndex -
1944
+ * @param proof -
1945
+ * @param verifyingKey - (vkey)
1946
+ */
1947
+ constructor({ falconSignature, merkleArrayIndex, proof, verifyingKey, }) {
1948
+ super();
1949
+ this.falconSignature =
1950
+ typeof falconSignature === 'string'
1951
+ ? new Uint8Array(Buffer.from(falconSignature, 'base64'))
1952
+ : falconSignature;
1953
+ this.merkleArrayIndex = merkleArrayIndex;
1954
+ this.proof = proof;
1955
+ this.verifyingKey =
1956
+ typeof verifyingKey === 'string'
1957
+ ? new Uint8Array(Buffer.from(verifyingKey, 'base64'))
1958
+ : verifyingKey;
1959
+ this.attribute_map = {
1960
+ falconSignature: 'falcon-signature',
1961
+ merkleArrayIndex: 'merkle-array-index',
1962
+ proof: 'proof',
1963
+ verifyingKey: 'verifying-key',
1964
+ };
1965
+ }
1966
+ // eslint-disable-next-line camelcase
1967
+ static from_obj_for_encoding(data) {
1968
+ /* eslint-disable dot-notation */
1969
+ return new StateProofSignature({
1970
+ falconSignature: data['falcon-signature'],
1971
+ merkleArrayIndex: data['merkle-array-index'],
1972
+ proof: typeof data['proof'] !== 'undefined'
1973
+ ? MerkleArrayProof.from_obj_for_encoding(data['proof'])
1974
+ : undefined,
1975
+ verifyingKey: data['verifying-key'],
1976
+ });
1977
+ /* eslint-enable dot-notation */
1978
+ }
1979
+ }
1980
+ export class StateProofTracking extends BaseModel {
1981
+ /**
1982
+ * Creates a new `StateProofTracking` object.
1983
+ * @param nextRound - (n) Next round for which we will accept a state proof transaction.
1984
+ * @param onlineTotalWeight - (t) The total number of microalgos held by the online accounts during the
1985
+ * StateProof round.
1986
+ * @param type - State Proof Type. Note the raw object uses map with this as key.
1987
+ * @param votersCommitment - (v) Root of a vector commitment containing online accounts that will help sign
1988
+ * the proof.
1989
+ */
1990
+ constructor({ nextRound, onlineTotalWeight, type, votersCommitment, }) {
1991
+ super();
1992
+ this.nextRound = nextRound;
1993
+ this.onlineTotalWeight = onlineTotalWeight;
1994
+ this.type = type;
1995
+ this.votersCommitment =
1996
+ typeof votersCommitment === 'string'
1997
+ ? new Uint8Array(Buffer.from(votersCommitment, 'base64'))
1998
+ : votersCommitment;
1999
+ this.attribute_map = {
2000
+ nextRound: 'next-round',
2001
+ onlineTotalWeight: 'online-total-weight',
2002
+ type: 'type',
2003
+ votersCommitment: 'voters-commitment',
2004
+ };
2005
+ }
2006
+ // eslint-disable-next-line camelcase
2007
+ static from_obj_for_encoding(data) {
2008
+ /* eslint-disable dot-notation */
2009
+ return new StateProofTracking({
2010
+ nextRound: data['next-round'],
2011
+ onlineTotalWeight: data['online-total-weight'],
2012
+ type: data['type'],
2013
+ votersCommitment: data['voters-commitment'],
2014
+ });
2015
+ /* eslint-enable dot-notation */
2016
+ }
2017
+ }
2018
+ export class StateProofVerifier extends BaseModel {
2019
+ /**
2020
+ * Creates a new `StateProofVerifier` object.
2021
+ * @param commitment - (cmt) Represents the root of the vector commitment tree.
2022
+ * @param keyLifetime - (lf) Key lifetime.
2023
+ */
2024
+ constructor({ commitment, keyLifetime, }) {
2025
+ super();
2026
+ this.commitment =
2027
+ typeof commitment === 'string'
2028
+ ? new Uint8Array(Buffer.from(commitment, 'base64'))
2029
+ : commitment;
2030
+ this.keyLifetime = keyLifetime;
2031
+ this.attribute_map = {
2032
+ commitment: 'commitment',
2033
+ keyLifetime: 'key-lifetime',
2034
+ };
2035
+ }
2036
+ // eslint-disable-next-line camelcase
2037
+ static from_obj_for_encoding(data) {
2038
+ /* eslint-disable dot-notation */
2039
+ return new StateProofVerifier({
2040
+ commitment: data['commitment'],
2041
+ keyLifetime: data['key-lifetime'],
2042
+ });
2043
+ /* eslint-enable dot-notation */
2044
+ }
2045
+ }
2046
+ /**
2047
+ * Represents a (apls) local-state or (apgs) global-state schema. These schemas
2048
+ * determine how much storage may be used in a local-state or global-state for an
2049
+ * application. The more space used, the larger minimum balance must be maintained
2050
+ * in the account holding the data.
2051
+ */
2052
+ export class StateSchema extends BaseModel {
2053
+ /**
2054
+ * Creates a new `StateSchema` object.
2055
+ * @param numByteSlice - Maximum number of TEAL byte slices that may be stored in the key/value store.
2056
+ * @param numUint - Maximum number of TEAL uints that may be stored in the key/value store.
2057
+ */
2058
+ constructor({ numByteSlice, numUint, }) {
2059
+ super();
2060
+ this.numByteSlice = numByteSlice;
2061
+ this.numUint = numUint;
2062
+ this.attribute_map = {
2063
+ numByteSlice: 'num-byte-slice',
2064
+ numUint: 'num-uint',
2065
+ };
2066
+ }
2067
+ // eslint-disable-next-line camelcase
2068
+ static from_obj_for_encoding(data) {
2069
+ /* eslint-disable dot-notation */
2070
+ if (typeof data['num-byte-slice'] === 'undefined')
2071
+ throw new Error(`Response is missing required field 'num-byte-slice': ${data}`);
2072
+ if (typeof data['num-uint'] === 'undefined')
2073
+ throw new Error(`Response is missing required field 'num-uint': ${data}`);
2074
+ return new StateSchema({
2075
+ numByteSlice: data['num-byte-slice'],
2076
+ numUint: data['num-uint'],
2077
+ });
2078
+ /* eslint-enable dot-notation */
2079
+ }
2080
+ }
2081
+ /**
2082
+ * Represents a key-value pair in an application store.
2083
+ */
2084
+ export class TealKeyValue extends BaseModel {
2085
+ /**
2086
+ * Creates a new `TealKeyValue` object.
2087
+ * @param key -
2088
+ * @param value - Represents a TEAL value.
2089
+ */
2090
+ constructor({ key, value }) {
2091
+ super();
2092
+ this.key = key;
2093
+ this.value = value;
2094
+ this.attribute_map = {
2095
+ key: 'key',
2096
+ value: 'value',
2097
+ };
2098
+ }
2099
+ // eslint-disable-next-line camelcase
2100
+ static from_obj_for_encoding(data) {
2101
+ /* eslint-disable dot-notation */
2102
+ if (typeof data['key'] === 'undefined')
2103
+ throw new Error(`Response is missing required field 'key': ${data}`);
2104
+ if (typeof data['value'] === 'undefined')
2105
+ throw new Error(`Response is missing required field 'value': ${data}`);
2106
+ return new TealKeyValue({
2107
+ key: data['key'],
2108
+ value: TealValue.from_obj_for_encoding(data['value']),
2109
+ });
2110
+ /* eslint-enable dot-notation */
2111
+ }
2112
+ }
2113
+ /**
2114
+ * Represents a TEAL value.
2115
+ */
2116
+ export class TealValue extends BaseModel {
2117
+ /**
2118
+ * Creates a new `TealValue` object.
2119
+ * @param bytes - (tb) bytes value.
2120
+ * @param type - (tt) value type. Value `1` refers to **bytes**, value `2` refers to **uint**
2121
+ * @param uint - (ui) uint value.
2122
+ */
2123
+ constructor({ bytes, type, uint, }) {
2124
+ super();
2125
+ this.bytes = bytes;
2126
+ this.type = type;
2127
+ this.uint = uint;
2128
+ this.attribute_map = {
2129
+ bytes: 'bytes',
2130
+ type: 'type',
2131
+ uint: 'uint',
2132
+ };
2133
+ }
2134
+ // eslint-disable-next-line camelcase
2135
+ static from_obj_for_encoding(data) {
2136
+ /* eslint-disable dot-notation */
2137
+ if (typeof data['bytes'] === 'undefined')
2138
+ throw new Error(`Response is missing required field 'bytes': ${data}`);
2139
+ if (typeof data['type'] === 'undefined')
2140
+ throw new Error(`Response is missing required field 'type': ${data}`);
2141
+ if (typeof data['uint'] === 'undefined')
2142
+ throw new Error(`Response is missing required field 'uint': ${data}`);
2143
+ return new TealValue({
2144
+ bytes: data['bytes'],
2145
+ type: data['type'],
2146
+ uint: data['uint'],
2147
+ });
2148
+ /* eslint-enable dot-notation */
2149
+ }
2150
+ }
2151
+ /**
2152
+ * Contains all fields common to all transactions and serves as an envelope to all
2153
+ * transactions type. Represents both regular and inner transactions.
2154
+ * Definition:
2155
+ * data/transactions/signedtxn.go : SignedTxn
2156
+ * data/transactions/transaction.go : Transaction
2157
+ */
2158
+ export class Transaction extends BaseModel {
2159
+ /**
2160
+ * Creates a new `Transaction` object.
2161
+ * @param fee - (fee) Transaction fee.
2162
+ * @param firstValid - (fv) First valid round for this transaction.
2163
+ * @param lastValid - (lv) Last valid round for this transaction.
2164
+ * @param sender - (snd) Sender's address.
2165
+ * @param applicationTransaction - Fields for application transactions.
2166
+ * Definition:
2167
+ * data/transactions/application.go : ApplicationCallTxnFields
2168
+ * @param assetConfigTransaction - Fields for asset allocation, re-configuration, and destruction.
2169
+ * A zero value for asset-id indicates asset creation.
2170
+ * A zero value for the params indicates asset destruction.
2171
+ * Definition:
2172
+ * data/transactions/asset.go : AssetConfigTxnFields
2173
+ * @param assetFreezeTransaction - Fields for an asset freeze transaction.
2174
+ * Definition:
2175
+ * data/transactions/asset.go : AssetFreezeTxnFields
2176
+ * @param assetTransferTransaction - Fields for an asset transfer transaction.
2177
+ * Definition:
2178
+ * data/transactions/asset.go : AssetTransferTxnFields
2179
+ * @param authAddr - (sgnr) this is included with signed transactions when the signing address does
2180
+ * not equal the sender. The backend can use this to ensure that auth addr is equal
2181
+ * to the accounts auth addr.
2182
+ * @param closeRewards - (rc) rewards applied to close-remainder-to account.
2183
+ * @param closingAmount - (ca) closing amount for transaction.
2184
+ * @param confirmedRound - Round when the transaction was confirmed.
2185
+ * @param createdApplicationIndex - Specifies an application index (ID) if an application was created with this
2186
+ * transaction.
2187
+ * @param createdAssetIndex - Specifies an asset index (ID) if an asset was created with this transaction.
2188
+ * @param genesisHash - (gh) Hash of genesis block.
2189
+ * @param genesisId - (gen) genesis block ID.
2190
+ * @param globalStateDelta - (gd) Global state key/value changes for the application being executed by this
2191
+ * transaction.
2192
+ * @param group - (grp) Base64 encoded byte array of a sha512/256 digest. When present indicates
2193
+ * that this transaction is part of a transaction group and the value is the
2194
+ * sha512/256 hash of the transactions in that group.
2195
+ * @param id - Transaction ID
2196
+ * @param innerTxns - Inner transactions produced by application execution.
2197
+ * @param intraRoundOffset - Offset into the round where this transaction was confirmed.
2198
+ * @param keyregTransaction - Fields for a keyreg transaction.
2199
+ * Definition:
2200
+ * data/transactions/keyreg.go : KeyregTxnFields
2201
+ * @param lease - (lx) Base64 encoded 32-byte array. Lease enforces mutual exclusion of
2202
+ * transactions. If this field is nonzero, then once the transaction is confirmed,
2203
+ * it acquires the lease identified by the (Sender, Lease) pair of the transaction
2204
+ * until the LastValid round passes. While this transaction possesses the lease, no
2205
+ * other transaction specifying this lease can be confirmed.
2206
+ * @param localStateDelta - (ld) Local state key/value changes for the application being executed by this
2207
+ * transaction.
2208
+ * @param logs - (lg) Logs for the application being executed by this transaction.
2209
+ * @param note - (note) Free form data.
2210
+ * @param paymentTransaction - Fields for a payment transaction.
2211
+ * Definition:
2212
+ * data/transactions/payment.go : PaymentTxnFields
2213
+ * @param receiverRewards - (rr) rewards applied to receiver account.
2214
+ * @param rekeyTo - (rekey) when included in a valid transaction, the accounts auth addr will be
2215
+ * updated with this value and future signatures must be signed with the key
2216
+ * represented by this address.
2217
+ * @param roundTime - Time when the block this transaction is in was confirmed.
2218
+ * @param senderRewards - (rs) rewards applied to sender account.
2219
+ * @param signature - Validation signature associated with some data. Only one of the signatures
2220
+ * should be provided.
2221
+ * @param stateProofTransaction - Fields for a state proof transaction.
2222
+ * Definition:
2223
+ * data/transactions/stateproof.go : StateProofTxnFields
2224
+ * @param txType - (type) Indicates what type of transaction this is. Different types have
2225
+ * different fields.
2226
+ * Valid types, and where their fields are stored:
2227
+ * * (pay) payment-transaction
2228
+ * * (keyreg) keyreg-transaction
2229
+ * * (acfg) asset-config-transaction
2230
+ * * (axfer) asset-transfer-transaction
2231
+ * * (afrz) asset-freeze-transaction
2232
+ * * (appl) application-transaction
2233
+ * * (stpf) state-proof-transaction
2234
+ */
2235
+ constructor({ fee, firstValid, lastValid, sender, applicationTransaction, assetConfigTransaction, assetFreezeTransaction, assetTransferTransaction, authAddr, closeRewards, closingAmount, confirmedRound, createdApplicationIndex, createdAssetIndex, genesisHash, genesisId, globalStateDelta, group, id, innerTxns, intraRoundOffset, keyregTransaction, lease, localStateDelta, logs, note, paymentTransaction, receiverRewards, rekeyTo, roundTime, senderRewards, signature, stateProofTransaction, txType, }) {
2236
+ super();
2237
+ this.fee = fee;
2238
+ this.firstValid = firstValid;
2239
+ this.lastValid = lastValid;
2240
+ this.sender = sender;
2241
+ this.applicationTransaction = applicationTransaction;
2242
+ this.assetConfigTransaction = assetConfigTransaction;
2243
+ this.assetFreezeTransaction = assetFreezeTransaction;
2244
+ this.assetTransferTransaction = assetTransferTransaction;
2245
+ this.authAddr = authAddr;
2246
+ this.closeRewards = closeRewards;
2247
+ this.closingAmount = closingAmount;
2248
+ this.confirmedRound = confirmedRound;
2249
+ this.createdApplicationIndex = createdApplicationIndex;
2250
+ this.createdAssetIndex = createdAssetIndex;
2251
+ this.genesisHash =
2252
+ typeof genesisHash === 'string'
2253
+ ? new Uint8Array(Buffer.from(genesisHash, 'base64'))
2254
+ : genesisHash;
2255
+ this.genesisId = genesisId;
2256
+ this.globalStateDelta = globalStateDelta;
2257
+ this.group =
2258
+ typeof group === 'string'
2259
+ ? new Uint8Array(Buffer.from(group, 'base64'))
2260
+ : group;
2261
+ this.id = id;
2262
+ this.innerTxns = innerTxns;
2263
+ this.intraRoundOffset = intraRoundOffset;
2264
+ this.keyregTransaction = keyregTransaction;
2265
+ this.lease =
2266
+ typeof lease === 'string'
2267
+ ? new Uint8Array(Buffer.from(lease, 'base64'))
2268
+ : lease;
2269
+ this.localStateDelta = localStateDelta;
2270
+ this.logs = logs;
2271
+ this.note =
2272
+ typeof note === 'string'
2273
+ ? new Uint8Array(Buffer.from(note, 'base64'))
2274
+ : note;
2275
+ this.paymentTransaction = paymentTransaction;
2276
+ this.receiverRewards = receiverRewards;
2277
+ this.rekeyTo = rekeyTo;
2278
+ this.roundTime = roundTime;
2279
+ this.senderRewards = senderRewards;
2280
+ this.signature = signature;
2281
+ this.stateProofTransaction = stateProofTransaction;
2282
+ this.txType = txType;
2283
+ this.attribute_map = {
2284
+ fee: 'fee',
2285
+ firstValid: 'first-valid',
2286
+ lastValid: 'last-valid',
2287
+ sender: 'sender',
2288
+ applicationTransaction: 'application-transaction',
2289
+ assetConfigTransaction: 'asset-config-transaction',
2290
+ assetFreezeTransaction: 'asset-freeze-transaction',
2291
+ assetTransferTransaction: 'asset-transfer-transaction',
2292
+ authAddr: 'auth-addr',
2293
+ closeRewards: 'close-rewards',
2294
+ closingAmount: 'closing-amount',
2295
+ confirmedRound: 'confirmed-round',
2296
+ createdApplicationIndex: 'created-application-index',
2297
+ createdAssetIndex: 'created-asset-index',
2298
+ genesisHash: 'genesis-hash',
2299
+ genesisId: 'genesis-id',
2300
+ globalStateDelta: 'global-state-delta',
2301
+ group: 'group',
2302
+ id: 'id',
2303
+ innerTxns: 'inner-txns',
2304
+ intraRoundOffset: 'intra-round-offset',
2305
+ keyregTransaction: 'keyreg-transaction',
2306
+ lease: 'lease',
2307
+ localStateDelta: 'local-state-delta',
2308
+ logs: 'logs',
2309
+ note: 'note',
2310
+ paymentTransaction: 'payment-transaction',
2311
+ receiverRewards: 'receiver-rewards',
2312
+ rekeyTo: 'rekey-to',
2313
+ roundTime: 'round-time',
2314
+ senderRewards: 'sender-rewards',
2315
+ signature: 'signature',
2316
+ stateProofTransaction: 'state-proof-transaction',
2317
+ txType: 'tx-type',
2318
+ };
2319
+ }
2320
+ // eslint-disable-next-line camelcase
2321
+ static from_obj_for_encoding(data) {
2322
+ /* eslint-disable dot-notation */
2323
+ if (typeof data['fee'] === 'undefined')
2324
+ throw new Error(`Response is missing required field 'fee': ${data}`);
2325
+ if (typeof data['first-valid'] === 'undefined')
2326
+ throw new Error(`Response is missing required field 'first-valid': ${data}`);
2327
+ if (typeof data['last-valid'] === 'undefined')
2328
+ throw new Error(`Response is missing required field 'last-valid': ${data}`);
2329
+ if (typeof data['sender'] === 'undefined')
2330
+ throw new Error(`Response is missing required field 'sender': ${data}`);
2331
+ return new Transaction({
2332
+ fee: data['fee'],
2333
+ firstValid: data['first-valid'],
2334
+ lastValid: data['last-valid'],
2335
+ sender: data['sender'],
2336
+ applicationTransaction: typeof data['application-transaction'] !== 'undefined'
2337
+ ? TransactionApplication.from_obj_for_encoding(data['application-transaction'])
2338
+ : undefined,
2339
+ assetConfigTransaction: typeof data['asset-config-transaction'] !== 'undefined'
2340
+ ? TransactionAssetConfig.from_obj_for_encoding(data['asset-config-transaction'])
2341
+ : undefined,
2342
+ assetFreezeTransaction: typeof data['asset-freeze-transaction'] !== 'undefined'
2343
+ ? TransactionAssetFreeze.from_obj_for_encoding(data['asset-freeze-transaction'])
2344
+ : undefined,
2345
+ assetTransferTransaction: typeof data['asset-transfer-transaction'] !== 'undefined'
2346
+ ? TransactionAssetTransfer.from_obj_for_encoding(data['asset-transfer-transaction'])
2347
+ : undefined,
2348
+ authAddr: data['auth-addr'],
2349
+ closeRewards: data['close-rewards'],
2350
+ closingAmount: data['closing-amount'],
2351
+ confirmedRound: data['confirmed-round'],
2352
+ createdApplicationIndex: data['created-application-index'],
2353
+ createdAssetIndex: data['created-asset-index'],
2354
+ genesisHash: data['genesis-hash'],
2355
+ genesisId: data['genesis-id'],
2356
+ globalStateDelta: typeof data['global-state-delta'] !== 'undefined'
2357
+ ? data['global-state-delta'].map(EvalDeltaKeyValue.from_obj_for_encoding)
2358
+ : undefined,
2359
+ group: data['group'],
2360
+ id: data['id'],
2361
+ innerTxns: typeof data['inner-txns'] !== 'undefined'
2362
+ ? data['inner-txns'].map(Transaction.from_obj_for_encoding)
2363
+ : undefined,
2364
+ intraRoundOffset: data['intra-round-offset'],
2365
+ keyregTransaction: typeof data['keyreg-transaction'] !== 'undefined'
2366
+ ? TransactionKeyreg.from_obj_for_encoding(data['keyreg-transaction'])
2367
+ : undefined,
2368
+ lease: data['lease'],
2369
+ localStateDelta: typeof data['local-state-delta'] !== 'undefined'
2370
+ ? data['local-state-delta'].map(AccountStateDelta.from_obj_for_encoding)
2371
+ : undefined,
2372
+ logs: data['logs'],
2373
+ note: data['note'],
2374
+ paymentTransaction: typeof data['payment-transaction'] !== 'undefined'
2375
+ ? TransactionPayment.from_obj_for_encoding(data['payment-transaction'])
2376
+ : undefined,
2377
+ receiverRewards: data['receiver-rewards'],
2378
+ rekeyTo: data['rekey-to'],
2379
+ roundTime: data['round-time'],
2380
+ senderRewards: data['sender-rewards'],
2381
+ signature: typeof data['signature'] !== 'undefined'
2382
+ ? TransactionSignature.from_obj_for_encoding(data['signature'])
2383
+ : undefined,
2384
+ stateProofTransaction: typeof data['state-proof-transaction'] !== 'undefined'
2385
+ ? TransactionStateProof.from_obj_for_encoding(data['state-proof-transaction'])
2386
+ : undefined,
2387
+ txType: data['tx-type'],
2388
+ });
2389
+ /* eslint-enable dot-notation */
2390
+ }
2391
+ }
2392
+ /**
2393
+ * Fields for application transactions.
2394
+ * Definition:
2395
+ * data/transactions/application.go : ApplicationCallTxnFields
2396
+ */
2397
+ export class TransactionApplication extends BaseModel {
2398
+ /**
2399
+ * Creates a new `TransactionApplication` object.
2400
+ * @param applicationId - (apid) ID of the application being configured or empty if creating.
2401
+ * @param accounts - (apat) List of accounts in addition to the sender that may be accessed from the
2402
+ * application's approval-program and clear-state-program.
2403
+ * @param applicationArgs - (apaa) transaction specific arguments accessed from the application's
2404
+ * approval-program and clear-state-program.
2405
+ * @param approvalProgram - (apap) Logic executed for every application transaction, except when
2406
+ * on-completion is set to "clear". It can read and write global state for the
2407
+ * application, as well as account-specific local state. Approval programs may
2408
+ * reject the transaction.
2409
+ * @param clearStateProgram - (apsu) Logic executed for application transactions with on-completion set to
2410
+ * "clear". It can read and write global state for the application, as well as
2411
+ * account-specific local state. Clear state programs cannot reject the
2412
+ * transaction.
2413
+ * @param extraProgramPages - (epp) specifies the additional app program len requested in pages.
2414
+ * @param foreignApps - (apfa) Lists the applications in addition to the application-id whose global
2415
+ * states may be accessed by this application's approval-program and
2416
+ * clear-state-program. The access is read-only.
2417
+ * @param foreignAssets - (apas) lists the assets whose parameters may be accessed by this application's
2418
+ * ApprovalProgram and ClearStateProgram. The access is read-only.
2419
+ * @param globalStateSchema - Represents a (apls) local-state or (apgs) global-state schema. These schemas
2420
+ * determine how much storage may be used in a local-state or global-state for an
2421
+ * application. The more space used, the larger minimum balance must be maintained
2422
+ * in the account holding the data.
2423
+ * @param localStateSchema - Represents a (apls) local-state or (apgs) global-state schema. These schemas
2424
+ * determine how much storage may be used in a local-state or global-state for an
2425
+ * application. The more space used, the larger minimum balance must be maintained
2426
+ * in the account holding the data.
2427
+ * @param onCompletion - (apan) defines the what additional actions occur with the transaction.
2428
+ * Valid types:
2429
+ * * noop
2430
+ * * optin
2431
+ * * closeout
2432
+ * * clear
2433
+ * * update
2434
+ * * update
2435
+ * * delete
2436
+ */
2437
+ constructor({ applicationId, accounts, applicationArgs, approvalProgram, clearStateProgram, extraProgramPages, foreignApps, foreignAssets, globalStateSchema, localStateSchema, onCompletion, }) {
2438
+ super();
2439
+ this.applicationId = applicationId;
2440
+ this.accounts = accounts;
2441
+ this.applicationArgs = applicationArgs;
2442
+ this.approvalProgram =
2443
+ typeof approvalProgram === 'string'
2444
+ ? new Uint8Array(Buffer.from(approvalProgram, 'base64'))
2445
+ : approvalProgram;
2446
+ this.clearStateProgram =
2447
+ typeof clearStateProgram === 'string'
2448
+ ? new Uint8Array(Buffer.from(clearStateProgram, 'base64'))
2449
+ : clearStateProgram;
2450
+ this.extraProgramPages = extraProgramPages;
2451
+ this.foreignApps = foreignApps;
2452
+ this.foreignAssets = foreignAssets;
2453
+ this.globalStateSchema = globalStateSchema;
2454
+ this.localStateSchema = localStateSchema;
2455
+ this.onCompletion = onCompletion;
2456
+ this.attribute_map = {
2457
+ applicationId: 'application-id',
2458
+ accounts: 'accounts',
2459
+ applicationArgs: 'application-args',
2460
+ approvalProgram: 'approval-program',
2461
+ clearStateProgram: 'clear-state-program',
2462
+ extraProgramPages: 'extra-program-pages',
2463
+ foreignApps: 'foreign-apps',
2464
+ foreignAssets: 'foreign-assets',
2465
+ globalStateSchema: 'global-state-schema',
2466
+ localStateSchema: 'local-state-schema',
2467
+ onCompletion: 'on-completion',
2468
+ };
2469
+ }
2470
+ // eslint-disable-next-line camelcase
2471
+ static from_obj_for_encoding(data) {
2472
+ /* eslint-disable dot-notation */
2473
+ if (typeof data['application-id'] === 'undefined')
2474
+ throw new Error(`Response is missing required field 'application-id': ${data}`);
2475
+ return new TransactionApplication({
2476
+ applicationId: data['application-id'],
2477
+ accounts: data['accounts'],
2478
+ applicationArgs: data['application-args'],
2479
+ approvalProgram: data['approval-program'],
2480
+ clearStateProgram: data['clear-state-program'],
2481
+ extraProgramPages: data['extra-program-pages'],
2482
+ foreignApps: data['foreign-apps'],
2483
+ foreignAssets: data['foreign-assets'],
2484
+ globalStateSchema: typeof data['global-state-schema'] !== 'undefined'
2485
+ ? StateSchema.from_obj_for_encoding(data['global-state-schema'])
2486
+ : undefined,
2487
+ localStateSchema: typeof data['local-state-schema'] !== 'undefined'
2488
+ ? StateSchema.from_obj_for_encoding(data['local-state-schema'])
2489
+ : undefined,
2490
+ onCompletion: data['on-completion'],
2491
+ });
2492
+ /* eslint-enable dot-notation */
2493
+ }
2494
+ }
2495
+ /**
2496
+ * Fields for asset allocation, re-configuration, and destruction.
2497
+ * A zero value for asset-id indicates asset creation.
2498
+ * A zero value for the params indicates asset destruction.
2499
+ * Definition:
2500
+ * data/transactions/asset.go : AssetConfigTxnFields
2501
+ */
2502
+ export class TransactionAssetConfig extends BaseModel {
2503
+ /**
2504
+ * Creates a new `TransactionAssetConfig` object.
2505
+ * @param assetId - (xaid) ID of the asset being configured or empty if creating.
2506
+ * @param params - AssetParams specifies the parameters for an asset.
2507
+ * (apar) when part of an AssetConfig transaction.
2508
+ * Definition:
2509
+ * data/transactions/asset.go : AssetParams
2510
+ */
2511
+ constructor({ assetId, params, }) {
2512
+ super();
2513
+ this.assetId = assetId;
2514
+ this.params = params;
2515
+ this.attribute_map = {
2516
+ assetId: 'asset-id',
2517
+ params: 'params',
2518
+ };
2519
+ }
2520
+ // eslint-disable-next-line camelcase
2521
+ static from_obj_for_encoding(data) {
2522
+ /* eslint-disable dot-notation */
2523
+ return new TransactionAssetConfig({
2524
+ assetId: data['asset-id'],
2525
+ params: typeof data['params'] !== 'undefined'
2526
+ ? AssetParams.from_obj_for_encoding(data['params'])
2527
+ : undefined,
2528
+ });
2529
+ /* eslint-enable dot-notation */
2530
+ }
2531
+ }
2532
+ /**
2533
+ * Fields for an asset freeze transaction.
2534
+ * Definition:
2535
+ * data/transactions/asset.go : AssetFreezeTxnFields
2536
+ */
2537
+ export class TransactionAssetFreeze extends BaseModel {
2538
+ /**
2539
+ * Creates a new `TransactionAssetFreeze` object.
2540
+ * @param address - (fadd) Address of the account whose asset is being frozen or thawed.
2541
+ * @param assetId - (faid) ID of the asset being frozen or thawed.
2542
+ * @param newFreezeStatus - (afrz) The new freeze status.
2543
+ */
2544
+ constructor({ address, assetId, newFreezeStatus, }) {
2545
+ super();
2546
+ this.address = address;
2547
+ this.assetId = assetId;
2548
+ this.newFreezeStatus = newFreezeStatus;
2549
+ this.attribute_map = {
2550
+ address: 'address',
2551
+ assetId: 'asset-id',
2552
+ newFreezeStatus: 'new-freeze-status',
2553
+ };
2554
+ }
2555
+ // eslint-disable-next-line camelcase
2556
+ static from_obj_for_encoding(data) {
2557
+ /* eslint-disable dot-notation */
2558
+ if (typeof data['address'] === 'undefined')
2559
+ throw new Error(`Response is missing required field 'address': ${data}`);
2560
+ if (typeof data['asset-id'] === 'undefined')
2561
+ throw new Error(`Response is missing required field 'asset-id': ${data}`);
2562
+ if (typeof data['new-freeze-status'] === 'undefined')
2563
+ throw new Error(`Response is missing required field 'new-freeze-status': ${data}`);
2564
+ return new TransactionAssetFreeze({
2565
+ address: data['address'],
2566
+ assetId: data['asset-id'],
2567
+ newFreezeStatus: data['new-freeze-status'],
2568
+ });
2569
+ /* eslint-enable dot-notation */
2570
+ }
2571
+ }
2572
+ /**
2573
+ * Fields for an asset transfer transaction.
2574
+ * Definition:
2575
+ * data/transactions/asset.go : AssetTransferTxnFields
2576
+ */
2577
+ export class TransactionAssetTransfer extends BaseModel {
2578
+ /**
2579
+ * Creates a new `TransactionAssetTransfer` object.
2580
+ * @param amount - (aamt) Amount of asset to transfer. A zero amount transferred to self allocates
2581
+ * that asset in the account's Assets map.
2582
+ * @param assetId - (xaid) ID of the asset being transferred.
2583
+ * @param receiver - (arcv) Recipient address of the transfer.
2584
+ * @param closeAmount - Number of assets transfered to the close-to account as part of the transaction.
2585
+ * @param closeTo - (aclose) Indicates that the asset should be removed from the account's Assets
2586
+ * map, and specifies where the remaining asset holdings should be transferred.
2587
+ * It's always valid to transfer remaining asset holdings to the creator account.
2588
+ * @param sender - (asnd) The effective sender during a clawback transactions. If this is not a
2589
+ * zero value, the real transaction sender must be the Clawback address from the
2590
+ * AssetParams.
2591
+ */
2592
+ constructor({ amount, assetId, receiver, closeAmount, closeTo, sender, }) {
2593
+ super();
2594
+ this.amount = amount;
2595
+ this.assetId = assetId;
2596
+ this.receiver = receiver;
2597
+ this.closeAmount = closeAmount;
2598
+ this.closeTo = closeTo;
2599
+ this.sender = sender;
2600
+ this.attribute_map = {
2601
+ amount: 'amount',
2602
+ assetId: 'asset-id',
2603
+ receiver: 'receiver',
2604
+ closeAmount: 'close-amount',
2605
+ closeTo: 'close-to',
2606
+ sender: 'sender',
2607
+ };
2608
+ }
2609
+ // eslint-disable-next-line camelcase
2610
+ static from_obj_for_encoding(data) {
2611
+ /* eslint-disable dot-notation */
2612
+ if (typeof data['amount'] === 'undefined')
2613
+ throw new Error(`Response is missing required field 'amount': ${data}`);
2614
+ if (typeof data['asset-id'] === 'undefined')
2615
+ throw new Error(`Response is missing required field 'asset-id': ${data}`);
2616
+ if (typeof data['receiver'] === 'undefined')
2617
+ throw new Error(`Response is missing required field 'receiver': ${data}`);
2618
+ return new TransactionAssetTransfer({
2619
+ amount: data['amount'],
2620
+ assetId: data['asset-id'],
2621
+ receiver: data['receiver'],
2622
+ closeAmount: data['close-amount'],
2623
+ closeTo: data['close-to'],
2624
+ sender: data['sender'],
2625
+ });
2626
+ /* eslint-enable dot-notation */
2627
+ }
2628
+ }
2629
+ /**
2630
+ * Fields for a keyreg transaction.
2631
+ * Definition:
2632
+ * data/transactions/keyreg.go : KeyregTxnFields
2633
+ */
2634
+ export class TransactionKeyreg extends BaseModel {
2635
+ /**
2636
+ * Creates a new `TransactionKeyreg` object.
2637
+ * @param nonParticipation - (nonpart) Mark the account as participating or non-participating.
2638
+ * @param selectionParticipationKey - (selkey) Public key used with the Verified Random Function (VRF) result during
2639
+ * committee selection.
2640
+ * @param stateProofKey - (sprfkey) State proof key used in key registration transactions.
2641
+ * @param voteFirstValid - (votefst) First round this participation key is valid.
2642
+ * @param voteKeyDilution - (votekd) Number of subkeys in each batch of participation keys.
2643
+ * @param voteLastValid - (votelst) Last round this participation key is valid.
2644
+ * @param voteParticipationKey - (votekey) Participation public key used in key registration transactions.
2645
+ */
2646
+ constructor({ nonParticipation, selectionParticipationKey, stateProofKey, voteFirstValid, voteKeyDilution, voteLastValid, voteParticipationKey, }) {
2647
+ super();
2648
+ this.nonParticipation = nonParticipation;
2649
+ this.selectionParticipationKey =
2650
+ typeof selectionParticipationKey === 'string'
2651
+ ? new Uint8Array(Buffer.from(selectionParticipationKey, 'base64'))
2652
+ : selectionParticipationKey;
2653
+ this.stateProofKey =
2654
+ typeof stateProofKey === 'string'
2655
+ ? new Uint8Array(Buffer.from(stateProofKey, 'base64'))
2656
+ : stateProofKey;
2657
+ this.voteFirstValid = voteFirstValid;
2658
+ this.voteKeyDilution = voteKeyDilution;
2659
+ this.voteLastValid = voteLastValid;
2660
+ this.voteParticipationKey =
2661
+ typeof voteParticipationKey === 'string'
2662
+ ? new Uint8Array(Buffer.from(voteParticipationKey, 'base64'))
2663
+ : voteParticipationKey;
2664
+ this.attribute_map = {
2665
+ nonParticipation: 'non-participation',
2666
+ selectionParticipationKey: 'selection-participation-key',
2667
+ stateProofKey: 'state-proof-key',
2668
+ voteFirstValid: 'vote-first-valid',
2669
+ voteKeyDilution: 'vote-key-dilution',
2670
+ voteLastValid: 'vote-last-valid',
2671
+ voteParticipationKey: 'vote-participation-key',
2672
+ };
2673
+ }
2674
+ // eslint-disable-next-line camelcase
2675
+ static from_obj_for_encoding(data) {
2676
+ /* eslint-disable dot-notation */
2677
+ return new TransactionKeyreg({
2678
+ nonParticipation: data['non-participation'],
2679
+ selectionParticipationKey: data['selection-participation-key'],
2680
+ stateProofKey: data['state-proof-key'],
2681
+ voteFirstValid: data['vote-first-valid'],
2682
+ voteKeyDilution: data['vote-key-dilution'],
2683
+ voteLastValid: data['vote-last-valid'],
2684
+ voteParticipationKey: data['vote-participation-key'],
2685
+ });
2686
+ /* eslint-enable dot-notation */
2687
+ }
2688
+ }
2689
+ /**
2690
+ * Fields for a payment transaction.
2691
+ * Definition:
2692
+ * data/transactions/payment.go : PaymentTxnFields
2693
+ */
2694
+ export class TransactionPayment extends BaseModel {
2695
+ /**
2696
+ * Creates a new `TransactionPayment` object.
2697
+ * @param amount - (amt) number of MicroAlgos intended to be transferred.
2698
+ * @param receiver - (rcv) receiver's address.
2699
+ * @param closeAmount - Number of MicroAlgos that were sent to the close-remainder-to address when
2700
+ * closing the sender account.
2701
+ * @param closeRemainderTo - (close) when set, indicates that the sending account should be closed and all
2702
+ * remaining funds be transferred to this address.
2703
+ */
2704
+ constructor({ amount, receiver, closeAmount, closeRemainderTo, }) {
2705
+ super();
2706
+ this.amount = amount;
2707
+ this.receiver = receiver;
2708
+ this.closeAmount = closeAmount;
2709
+ this.closeRemainderTo = closeRemainderTo;
2710
+ this.attribute_map = {
2711
+ amount: 'amount',
2712
+ receiver: 'receiver',
2713
+ closeAmount: 'close-amount',
2714
+ closeRemainderTo: 'close-remainder-to',
2715
+ };
2716
+ }
2717
+ // eslint-disable-next-line camelcase
2718
+ static from_obj_for_encoding(data) {
2719
+ /* eslint-disable dot-notation */
2720
+ if (typeof data['amount'] === 'undefined')
2721
+ throw new Error(`Response is missing required field 'amount': ${data}`);
2722
+ if (typeof data['receiver'] === 'undefined')
2723
+ throw new Error(`Response is missing required field 'receiver': ${data}`);
2724
+ return new TransactionPayment({
2725
+ amount: data['amount'],
2726
+ receiver: data['receiver'],
2727
+ closeAmount: data['close-amount'],
2728
+ closeRemainderTo: data['close-remainder-to'],
2729
+ });
2730
+ /* eslint-enable dot-notation */
2731
+ }
2732
+ }
2733
+ /**
2734
+ *
2735
+ */
2736
+ export class TransactionResponse extends BaseModel {
2737
+ /**
2738
+ * Creates a new `TransactionResponse` object.
2739
+ * @param currentRound - Round at which the results were computed.
2740
+ * @param transaction - Contains all fields common to all transactions and serves as an envelope to all
2741
+ * transactions type. Represents both regular and inner transactions.
2742
+ * Definition:
2743
+ * data/transactions/signedtxn.go : SignedTxn
2744
+ * data/transactions/transaction.go : Transaction
2745
+ */
2746
+ constructor({ currentRound, transaction, }) {
2747
+ super();
2748
+ this.currentRound = currentRound;
2749
+ this.transaction = transaction;
2750
+ this.attribute_map = {
2751
+ currentRound: 'current-round',
2752
+ transaction: 'transaction',
2753
+ };
2754
+ }
2755
+ // eslint-disable-next-line camelcase
2756
+ static from_obj_for_encoding(data) {
2757
+ /* eslint-disable dot-notation */
2758
+ if (typeof data['current-round'] === 'undefined')
2759
+ throw new Error(`Response is missing required field 'current-round': ${data}`);
2760
+ if (typeof data['transaction'] === 'undefined')
2761
+ throw new Error(`Response is missing required field 'transaction': ${data}`);
2762
+ return new TransactionResponse({
2763
+ currentRound: data['current-round'],
2764
+ transaction: Transaction.from_obj_for_encoding(data['transaction']),
2765
+ });
2766
+ /* eslint-enable dot-notation */
2767
+ }
2768
+ }
2769
+ /**
2770
+ * Validation signature associated with some data. Only one of the signatures
2771
+ * should be provided.
2772
+ */
2773
+ export class TransactionSignature extends BaseModel {
2774
+ /**
2775
+ * Creates a new `TransactionSignature` object.
2776
+ * @param logicsig - (lsig) Programatic transaction signature.
2777
+ * Definition:
2778
+ * data/transactions/logicsig.go
2779
+ * @param multisig - (msig) structure holding multiple subsignatures.
2780
+ * Definition:
2781
+ * crypto/multisig.go : MultisigSig
2782
+ * @param sig - (sig) Standard ed25519 signature.
2783
+ */
2784
+ constructor({ logicsig, multisig, sig, }) {
2785
+ super();
2786
+ this.logicsig = logicsig;
2787
+ this.multisig = multisig;
2788
+ this.sig =
2789
+ typeof sig === 'string'
2790
+ ? new Uint8Array(Buffer.from(sig, 'base64'))
2791
+ : sig;
2792
+ this.attribute_map = {
2793
+ logicsig: 'logicsig',
2794
+ multisig: 'multisig',
2795
+ sig: 'sig',
2796
+ };
2797
+ }
2798
+ // eslint-disable-next-line camelcase
2799
+ static from_obj_for_encoding(data) {
2800
+ /* eslint-disable dot-notation */
2801
+ return new TransactionSignature({
2802
+ logicsig: typeof data['logicsig'] !== 'undefined'
2803
+ ? TransactionSignatureLogicsig.from_obj_for_encoding(data['logicsig'])
2804
+ : undefined,
2805
+ multisig: typeof data['multisig'] !== 'undefined'
2806
+ ? TransactionSignatureMultisig.from_obj_for_encoding(data['multisig'])
2807
+ : undefined,
2808
+ sig: data['sig'],
2809
+ });
2810
+ /* eslint-enable dot-notation */
2811
+ }
2812
+ }
2813
+ /**
2814
+ * (lsig) Programatic transaction signature.
2815
+ * Definition:
2816
+ * data/transactions/logicsig.go
2817
+ */
2818
+ export class TransactionSignatureLogicsig extends BaseModel {
2819
+ /**
2820
+ * Creates a new `TransactionSignatureLogicsig` object.
2821
+ * @param logic - (l) Program signed by a signature or multi signature, or hashed to be the
2822
+ * address of ana ccount. Base64 encoded TEAL program.
2823
+ * @param args - (arg) Logic arguments, base64 encoded.
2824
+ * @param multisigSignature - (msig) structure holding multiple subsignatures.
2825
+ * Definition:
2826
+ * crypto/multisig.go : MultisigSig
2827
+ * @param signature - (sig) ed25519 signature.
2828
+ */
2829
+ constructor({ logic, args, multisigSignature, signature, }) {
2830
+ super();
2831
+ this.logic =
2832
+ typeof logic === 'string'
2833
+ ? new Uint8Array(Buffer.from(logic, 'base64'))
2834
+ : logic;
2835
+ this.args = args;
2836
+ this.multisigSignature = multisigSignature;
2837
+ this.signature =
2838
+ typeof signature === 'string'
2839
+ ? new Uint8Array(Buffer.from(signature, 'base64'))
2840
+ : signature;
2841
+ this.attribute_map = {
2842
+ logic: 'logic',
2843
+ args: 'args',
2844
+ multisigSignature: 'multisig-signature',
2845
+ signature: 'signature',
2846
+ };
2847
+ }
2848
+ // eslint-disable-next-line camelcase
2849
+ static from_obj_for_encoding(data) {
2850
+ /* eslint-disable dot-notation */
2851
+ if (typeof data['logic'] === 'undefined')
2852
+ throw new Error(`Response is missing required field 'logic': ${data}`);
2853
+ return new TransactionSignatureLogicsig({
2854
+ logic: data['logic'],
2855
+ args: data['args'],
2856
+ multisigSignature: typeof data['multisig-signature'] !== 'undefined'
2857
+ ? TransactionSignatureMultisig.from_obj_for_encoding(data['multisig-signature'])
2858
+ : undefined,
2859
+ signature: data['signature'],
2860
+ });
2861
+ /* eslint-enable dot-notation */
2862
+ }
2863
+ }
2864
+ /**
2865
+ * (msig) structure holding multiple subsignatures.
2866
+ * Definition:
2867
+ * crypto/multisig.go : MultisigSig
2868
+ */
2869
+ export class TransactionSignatureMultisig extends BaseModel {
2870
+ /**
2871
+ * Creates a new `TransactionSignatureMultisig` object.
2872
+ * @param subsignature - (subsig) holds pairs of public key and signatures.
2873
+ * @param threshold - (thr)
2874
+ * @param version - (v)
2875
+ */
2876
+ constructor({ subsignature, threshold, version, }) {
2877
+ super();
2878
+ this.subsignature = subsignature;
2879
+ this.threshold = threshold;
2880
+ this.version = version;
2881
+ this.attribute_map = {
2882
+ subsignature: 'subsignature',
2883
+ threshold: 'threshold',
2884
+ version: 'version',
2885
+ };
2886
+ }
2887
+ // eslint-disable-next-line camelcase
2888
+ static from_obj_for_encoding(data) {
2889
+ /* eslint-disable dot-notation */
2890
+ return new TransactionSignatureMultisig({
2891
+ subsignature: typeof data['subsignature'] !== 'undefined'
2892
+ ? data['subsignature'].map(TransactionSignatureMultisigSubsignature.from_obj_for_encoding)
2893
+ : undefined,
2894
+ threshold: data['threshold'],
2895
+ version: data['version'],
2896
+ });
2897
+ /* eslint-enable dot-notation */
2898
+ }
2899
+ }
2900
+ export class TransactionSignatureMultisigSubsignature extends BaseModel {
2901
+ /**
2902
+ * Creates a new `TransactionSignatureMultisigSubsignature` object.
2903
+ * @param publicKey - (pk)
2904
+ * @param signature - (s)
2905
+ */
2906
+ constructor({ publicKey, signature, }) {
2907
+ super();
2908
+ this.publicKey =
2909
+ typeof publicKey === 'string'
2910
+ ? new Uint8Array(Buffer.from(publicKey, 'base64'))
2911
+ : publicKey;
2912
+ this.signature =
2913
+ typeof signature === 'string'
2914
+ ? new Uint8Array(Buffer.from(signature, 'base64'))
2915
+ : signature;
2916
+ this.attribute_map = {
2917
+ publicKey: 'public-key',
2918
+ signature: 'signature',
2919
+ };
2920
+ }
2921
+ // eslint-disable-next-line camelcase
2922
+ static from_obj_for_encoding(data) {
2923
+ /* eslint-disable dot-notation */
2924
+ return new TransactionSignatureMultisigSubsignature({
2925
+ publicKey: data['public-key'],
2926
+ signature: data['signature'],
2927
+ });
2928
+ /* eslint-enable dot-notation */
2929
+ }
2930
+ }
2931
+ /**
2932
+ * Fields for a state proof transaction.
2933
+ * Definition:
2934
+ * data/transactions/stateproof.go : StateProofTxnFields
2935
+ */
2936
+ export class TransactionStateProof extends BaseModel {
2937
+ /**
2938
+ * Creates a new `TransactionStateProof` object.
2939
+ * @param message - (spmsg)
2940
+ * @param stateProof - (sp) represents a state proof.
2941
+ * Definition:
2942
+ * crypto/stateproof/structs.go : StateProof
2943
+ * @param stateProofType - (sptype) Type of the state proof. Integer representing an entry defined in
2944
+ * protocol/stateproof.go
2945
+ */
2946
+ constructor({ message, stateProof, stateProofType, }) {
2947
+ super();
2948
+ this.message = message;
2949
+ this.stateProof = stateProof;
2950
+ this.stateProofType = stateProofType;
2951
+ this.attribute_map = {
2952
+ message: 'message',
2953
+ stateProof: 'state-proof',
2954
+ stateProofType: 'state-proof-type',
2955
+ };
2956
+ }
2957
+ // eslint-disable-next-line camelcase
2958
+ static from_obj_for_encoding(data) {
2959
+ /* eslint-disable dot-notation */
2960
+ return new TransactionStateProof({
2961
+ message: typeof data['message'] !== 'undefined'
2962
+ ? IndexerStateProofMessage.from_obj_for_encoding(data['message'])
2963
+ : undefined,
2964
+ stateProof: typeof data['state-proof'] !== 'undefined'
2965
+ ? StateProofFields.from_obj_for_encoding(data['state-proof'])
2966
+ : undefined,
2967
+ stateProofType: data['state-proof-type'],
2968
+ });
2969
+ /* eslint-enable dot-notation */
2970
+ }
2971
+ }
2972
+ /**
2973
+ *
2974
+ */
2975
+ export class TransactionsResponse extends BaseModel {
2976
+ /**
2977
+ * Creates a new `TransactionsResponse` object.
2978
+ * @param currentRound - Round at which the results were computed.
2979
+ * @param transactions -
2980
+ * @param nextToken - Used for pagination, when making another request provide this token with the
2981
+ * next parameter.
2982
+ */
2983
+ constructor({ currentRound, transactions, nextToken, }) {
2984
+ super();
2985
+ this.currentRound = currentRound;
2986
+ this.transactions = transactions;
2987
+ this.nextToken = nextToken;
2988
+ this.attribute_map = {
2989
+ currentRound: 'current-round',
2990
+ transactions: 'transactions',
2991
+ nextToken: 'next-token',
2992
+ };
2993
+ }
2994
+ // eslint-disable-next-line camelcase
2995
+ static from_obj_for_encoding(data) {
2996
+ /* eslint-disable dot-notation */
2997
+ if (typeof data['current-round'] === 'undefined')
2998
+ throw new Error(`Response is missing required field 'current-round': ${data}`);
2999
+ if (!Array.isArray(data['transactions']))
3000
+ throw new Error(`Response is missing required array field 'transactions': ${data}`);
3001
+ return new TransactionsResponse({
3002
+ currentRound: data['current-round'],
3003
+ transactions: data['transactions'].map(Transaction.from_obj_for_encoding),
3004
+ nextToken: data['next-token'],
3005
+ });
3006
+ /* eslint-enable dot-notation */
3007
+ }
3008
+ }
3009
+ //# sourceMappingURL=types.js.map