algosdk 3.3.1 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +5 -5
  2. package/dist/browser/algosdk.min.js +1 -1
  3. package/dist/browser/algosdk.min.js.map +1 -1
  4. package/dist/cjs/appAccess.js +261 -0
  5. package/dist/cjs/appAccess.js.map +1 -0
  6. package/dist/cjs/client/v2/algod/getTransactionProof.js +1 -1
  7. package/dist/cjs/client/v2/algod/getTransactionProof.js.map +1 -1
  8. package/dist/cjs/client/v2/algod/models/types.js +8 -8
  9. package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
  10. package/dist/cjs/client/v2/indexer/models/types.js +338 -8
  11. package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
  12. package/dist/cjs/client/v2/indexer/searchForTransactions.js +19 -0
  13. package/dist/cjs/client/v2/indexer/searchForTransactions.js.map +1 -1
  14. package/dist/cjs/encoding/schema/bytearray.js +3 -0
  15. package/dist/cjs/encoding/schema/bytearray.js.map +1 -1
  16. package/dist/cjs/logicsig.js +54 -17
  17. package/dist/cjs/logicsig.js.map +1 -1
  18. package/dist/cjs/makeTxn.js +66 -12
  19. package/dist/cjs/makeTxn.js.map +1 -1
  20. package/dist/cjs/signing.js +4 -4
  21. package/dist/cjs/signing.js.map +1 -1
  22. package/dist/cjs/transaction.js +107 -0
  23. package/dist/cjs/transaction.js.map +1 -1
  24. package/dist/esm/appAccess.js +255 -0
  25. package/dist/esm/appAccess.js.map +1 -0
  26. package/dist/esm/client/v2/algod/getTransactionProof.js +2 -2
  27. package/dist/esm/client/v2/algod/getTransactionProof.js.map +1 -1
  28. package/dist/esm/client/v2/algod/models/types.js +6 -6
  29. package/dist/esm/client/v2/algod/models/types.js.map +1 -1
  30. package/dist/esm/client/v2/indexer/models/types.js +332 -6
  31. package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
  32. package/dist/esm/client/v2/indexer/searchForTransactions.js +19 -0
  33. package/dist/esm/client/v2/indexer/searchForTransactions.js.map +1 -1
  34. package/dist/esm/encoding/schema/bytearray.js +3 -0
  35. package/dist/esm/encoding/schema/bytearray.js.map +1 -1
  36. package/dist/esm/logicsig.js +54 -17
  37. package/dist/esm/logicsig.js.map +1 -1
  38. package/dist/esm/makeTxn.js +66 -12
  39. package/dist/esm/makeTxn.js.map +1 -1
  40. package/dist/esm/signing.js +4 -4
  41. package/dist/esm/signing.js.map +1 -1
  42. package/dist/esm/transaction.js +107 -0
  43. package/dist/esm/transaction.js.map +1 -1
  44. package/dist/types/appAccess.d.ts +28 -0
  45. package/dist/types/client/v2/algod/getTransactionProof.d.ts +3 -3
  46. package/dist/types/client/v2/algod/models/types.d.ts +4 -4
  47. package/dist/types/client/v2/indexer/models/types.d.ts +202 -8
  48. package/dist/types/client/v2/indexer/searchForTransactions.d.ts +16 -0
  49. package/dist/types/logicsig.d.ts +2 -0
  50. package/dist/types/makeTxn.d.ts +9 -9
  51. package/dist/types/transaction.d.ts +17 -0
  52. package/dist/types/types/transactions/base.d.ts +71 -0
  53. package/package.json +2 -2
  54. package/src/appAccess.ts +298 -0
  55. package/src/client/v2/algod/getTransactionProof.ts +4 -4
  56. package/src/client/v2/algod/models/types.ts +7 -7
  57. package/src/client/v2/indexer/models/types.ts +542 -5
  58. package/src/client/v2/indexer/searchForTransactions.ts +20 -0
  59. package/src/encoding/schema/bytearray.ts +3 -0
  60. package/src/logicsig.ts +68 -17
  61. package/src/makeTxn.ts +110 -12
  62. package/src/signing.ts +4 -4
  63. package/src/transaction.ts +162 -0
  64. package/src/types/transactions/base.ts +85 -0
@@ -3036,6 +3036,11 @@ export class Block implements Encodable {
3036
3036
  valueSchema: new OptionalSchema(ParticipationUpdates.encodingSchema),
3037
3037
  omitEmpty: true,
3038
3038
  },
3039
+ {
3040
+ key: 'previous-block-hash-512',
3041
+ valueSchema: new OptionalSchema(new ByteArraySchema()),
3042
+ omitEmpty: true,
3043
+ },
3039
3044
  {
3040
3045
  key: 'proposer',
3041
3046
  valueSchema: new OptionalSchema(new StringSchema()),
@@ -3065,6 +3070,11 @@ export class Block implements Encodable {
3065
3070
  ),
3066
3071
  omitEmpty: true,
3067
3072
  },
3073
+ {
3074
+ key: 'transactions-root-sha512',
3075
+ valueSchema: new OptionalSchema(new ByteArraySchema()),
3076
+ omitEmpty: true,
3077
+ },
3068
3078
  {
3069
3079
  key: 'txn-counter',
3070
3080
  valueSchema: new OptionalSchema(new Uint64Schema()),
@@ -3148,6 +3158,11 @@ export class Block implements Encodable {
3148
3158
  */
3149
3159
  public participationUpdates?: ParticipationUpdates;
3150
3160
 
3161
+ /**
3162
+ * (prev512) Previous block hash, using SHA-512.
3163
+ */
3164
+ public previousBlockHash512?: Uint8Array;
3165
+
3151
3166
  /**
3152
3167
  * the proposer of this block.
3153
3168
  */
@@ -3173,6 +3188,13 @@ export class Block implements Encodable {
3173
3188
  */
3174
3189
  public transactions?: Transaction[];
3175
3190
 
3191
+ /**
3192
+ * (txn512) TransactionsRootSHA512 is an auxiliary TransactionRoot, built using a
3193
+ * vector commitment instead of a merkle tree, and SHA512 hash function instead of
3194
+ * the default SHA512_256.
3195
+ */
3196
+ public transactionsRootSha512?: Uint8Array;
3197
+
3176
3198
  /**
3177
3199
  * (tc) TxnCounter counts the number of transactions committed in the ledger, from
3178
3200
  * the time at which support for this feature was introduced.
@@ -3213,11 +3235,15 @@ export class Block implements Encodable {
3213
3235
  * @param bonus - the potential bonus payout for this block.
3214
3236
  * @param feesCollected - the sum of all fees paid by transactions in this block.
3215
3237
  * @param participationUpdates - Participation account data that needs to be checked/acted on by the network.
3238
+ * @param previousBlockHash512 - (prev512) Previous block hash, using SHA-512.
3216
3239
  * @param proposer - the proposer of this block.
3217
3240
  * @param proposerPayout - the actual amount transferred to the proposer from the fee sink.
3218
3241
  * @param rewards - Fields relating to rewards,
3219
3242
  * @param stateProofTracking - Tracks the status of state proofs.
3220
3243
  * @param transactions - (txns) list of transactions corresponding to a given round.
3244
+ * @param transactionsRootSha512 - (txn512) TransactionsRootSHA512 is an auxiliary TransactionRoot, built using a
3245
+ * vector commitment instead of a merkle tree, and SHA512 hash function instead of
3246
+ * the default SHA512_256.
3221
3247
  * @param txnCounter - (tc) TxnCounter counts the number of transactions committed in the ledger, from
3222
3248
  * the time at which support for this feature was introduced.
3223
3249
  * Specifically, TxnCounter is the number of the next transaction that will be
@@ -3238,11 +3264,13 @@ export class Block implements Encodable {
3238
3264
  bonus,
3239
3265
  feesCollected,
3240
3266
  participationUpdates,
3267
+ previousBlockHash512,
3241
3268
  proposer,
3242
3269
  proposerPayout,
3243
3270
  rewards,
3244
3271
  stateProofTracking,
3245
3272
  transactions,
3273
+ transactionsRootSha512,
3246
3274
  txnCounter,
3247
3275
  upgradeState,
3248
3276
  upgradeVote,
@@ -3258,11 +3286,13 @@ export class Block implements Encodable {
3258
3286
  bonus?: number | bigint;
3259
3287
  feesCollected?: number | bigint;
3260
3288
  participationUpdates?: ParticipationUpdates;
3289
+ previousBlockHash512?: string | Uint8Array;
3261
3290
  proposer?: Address | string;
3262
3291
  proposerPayout?: number | bigint;
3263
3292
  rewards?: BlockRewards;
3264
3293
  stateProofTracking?: StateProofTracking[];
3265
3294
  transactions?: Transaction[];
3295
+ transactionsRootSha512?: string | Uint8Array;
3266
3296
  txnCounter?: number | bigint;
3267
3297
  upgradeState?: BlockUpgradeState;
3268
3298
  upgradeVote?: BlockUpgradeVote;
@@ -3294,6 +3324,10 @@ export class Block implements Encodable {
3294
3324
  ? undefined
3295
3325
  : ensureSafeInteger(feesCollected);
3296
3326
  this.participationUpdates = participationUpdates;
3327
+ this.previousBlockHash512 =
3328
+ typeof previousBlockHash512 === 'string'
3329
+ ? base64ToBytes(previousBlockHash512)
3330
+ : previousBlockHash512;
3297
3331
  this.proposer =
3298
3332
  typeof proposer === 'string' ? Address.fromString(proposer) : proposer;
3299
3333
  this.proposerPayout =
@@ -3303,6 +3337,10 @@ export class Block implements Encodable {
3303
3337
  this.rewards = rewards;
3304
3338
  this.stateProofTracking = stateProofTracking;
3305
3339
  this.transactions = transactions;
3340
+ this.transactionsRootSha512 =
3341
+ typeof transactionsRootSha512 === 'string'
3342
+ ? base64ToBytes(transactionsRootSha512)
3343
+ : transactionsRootSha512;
3306
3344
  this.txnCounter =
3307
3345
  typeof txnCounter === 'undefined'
3308
3346
  ? undefined
@@ -3334,6 +3372,7 @@ export class Block implements Encodable {
3334
3372
  ? this.participationUpdates.toEncodingData()
3335
3373
  : undefined,
3336
3374
  ],
3375
+ ['previous-block-hash-512', this.previousBlockHash512],
3337
3376
  [
3338
3377
  'proposer',
3339
3378
  typeof this.proposer !== 'undefined'
@@ -3359,6 +3398,7 @@ export class Block implements Encodable {
3359
3398
  ? this.transactions.map((v) => v.toEncodingData())
3360
3399
  : undefined,
3361
3400
  ],
3401
+ ['transactions-root-sha512', this.transactionsRootSha512],
3362
3402
  ['txn-counter', this.txnCounter],
3363
3403
  [
3364
3404
  'upgrade-state',
@@ -3396,6 +3436,7 @@ export class Block implements Encodable {
3396
3436
  data.get('participation-updates')
3397
3437
  )
3398
3438
  : undefined,
3439
+ previousBlockHash512: data.get('previous-block-hash-512'),
3399
3440
  proposer: data.get('proposer'),
3400
3441
  proposerPayout: data.get('proposer-payout'),
3401
3442
  rewards:
@@ -3414,6 +3455,7 @@ export class Block implements Encodable {
3414
3455
  .get('transactions')
3415
3456
  .map((v: unknown) => Transaction.fromEncodingData(v))
3416
3457
  : undefined,
3458
+ transactionsRootSha512: data.get('transactions-root-sha512'),
3417
3459
  txnCounter: data.get('txn-counter'),
3418
3460
  upgradeState:
3419
3461
  typeof data.get('upgrade-state') !== 'undefined'
@@ -4016,6 +4058,74 @@ export class BoxDescriptor implements Encodable {
4016
4058
  }
4017
4059
  }
4018
4060
 
4061
+ /**
4062
+ * BoxReference names a box by its name and the application ID it belongs to.
4063
+ */
4064
+ export class BoxReference implements Encodable {
4065
+ private static encodingSchemaValue: Schema | undefined;
4066
+
4067
+ static get encodingSchema(): Schema {
4068
+ if (!this.encodingSchemaValue) {
4069
+ this.encodingSchemaValue = new NamedMapSchema([]);
4070
+ (this.encodingSchemaValue as NamedMapSchema).pushEntries(
4071
+ { key: 'app', valueSchema: new Uint64Schema(), omitEmpty: true },
4072
+ { key: 'name', valueSchema: new ByteArraySchema(), omitEmpty: true }
4073
+ );
4074
+ }
4075
+ return this.encodingSchemaValue;
4076
+ }
4077
+
4078
+ /**
4079
+ * Application ID to which the box belongs, or zero if referring to the called
4080
+ * application.
4081
+ */
4082
+ public app: number;
4083
+
4084
+ /**
4085
+ * Base64 encoded box name
4086
+ */
4087
+ public name: Uint8Array;
4088
+
4089
+ /**
4090
+ * Creates a new `BoxReference` object.
4091
+ * @param app - Application ID to which the box belongs, or zero if referring to the called
4092
+ * application.
4093
+ * @param name - Base64 encoded box name
4094
+ */
4095
+ constructor({
4096
+ app,
4097
+ name,
4098
+ }: {
4099
+ app: number | bigint;
4100
+ name: string | Uint8Array;
4101
+ }) {
4102
+ this.app = ensureSafeInteger(app);
4103
+ this.name = typeof name === 'string' ? base64ToBytes(name) : name;
4104
+ }
4105
+
4106
+ // eslint-disable-next-line class-methods-use-this
4107
+ getEncodingSchema(): Schema {
4108
+ return BoxReference.encodingSchema;
4109
+ }
4110
+
4111
+ toEncodingData(): Map<string, unknown> {
4112
+ return new Map<string, unknown>([
4113
+ ['app', this.app],
4114
+ ['name', this.name],
4115
+ ]);
4116
+ }
4117
+
4118
+ static fromEncodingData(data: unknown): BoxReference {
4119
+ if (!(data instanceof Map)) {
4120
+ throw new Error(`Invalid decoded BoxReference: ${data}`);
4121
+ }
4122
+ return new BoxReference({
4123
+ app: data.get('app'),
4124
+ name: data.get('name'),
4125
+ });
4126
+ }
4127
+ }
4128
+
4019
4129
  /**
4020
4130
  * Box names of an application
4021
4131
  */
@@ -4625,6 +4735,73 @@ export class HealthCheck implements Encodable {
4625
4735
  }
4626
4736
  }
4627
4737
 
4738
+ /**
4739
+ * HoldingRef names a holding by referring to an Address and Asset it belongs to.
4740
+ */
4741
+ export class HoldingRef implements Encodable {
4742
+ private static encodingSchemaValue: Schema | undefined;
4743
+
4744
+ static get encodingSchema(): Schema {
4745
+ if (!this.encodingSchemaValue) {
4746
+ this.encodingSchemaValue = new NamedMapSchema([]);
4747
+ (this.encodingSchemaValue as NamedMapSchema).pushEntries(
4748
+ { key: 'address', valueSchema: new StringSchema(), omitEmpty: true },
4749
+ { key: 'asset', valueSchema: new Uint64Schema(), omitEmpty: true }
4750
+ );
4751
+ }
4752
+ return this.encodingSchemaValue;
4753
+ }
4754
+
4755
+ /**
4756
+ * (d) Address in access list, or the sender of the transaction.
4757
+ */
4758
+ public address: Address;
4759
+
4760
+ /**
4761
+ * (s) Asset ID for asset in access list.
4762
+ */
4763
+ public asset: number;
4764
+
4765
+ /**
4766
+ * Creates a new `HoldingRef` object.
4767
+ * @param address - (d) Address in access list, or the sender of the transaction.
4768
+ * @param asset - (s) Asset ID for asset in access list.
4769
+ */
4770
+ constructor({
4771
+ address,
4772
+ asset,
4773
+ }: {
4774
+ address: Address | string;
4775
+ asset: number | bigint;
4776
+ }) {
4777
+ this.address =
4778
+ typeof address === 'string' ? Address.fromString(address) : address;
4779
+ this.asset = ensureSafeInteger(asset);
4780
+ }
4781
+
4782
+ // eslint-disable-next-line class-methods-use-this
4783
+ getEncodingSchema(): Schema {
4784
+ return HoldingRef.encodingSchema;
4785
+ }
4786
+
4787
+ toEncodingData(): Map<string, unknown> {
4788
+ return new Map<string, unknown>([
4789
+ ['address', this.address.toString()],
4790
+ ['asset', this.asset],
4791
+ ]);
4792
+ }
4793
+
4794
+ static fromEncodingData(data: unknown): HoldingRef {
4795
+ if (!(data instanceof Map)) {
4796
+ throw new Error(`Invalid decoded HoldingRef: ${data}`);
4797
+ }
4798
+ return new HoldingRef({
4799
+ address: data.get('address'),
4800
+ asset: data.get('asset'),
4801
+ });
4802
+ }
4803
+ }
4804
+
4628
4805
  export class IndexerStateProofMessage implements Encodable {
4629
4806
  private static encodingSchemaValue: Schema | undefined;
4630
4807
 
@@ -4759,6 +4936,75 @@ export class IndexerStateProofMessage implements Encodable {
4759
4936
  }
4760
4937
  }
4761
4938
 
4939
+ /**
4940
+ * LocalsRef names a local state by referring to an Address and App it belongs to.
4941
+ */
4942
+ export class LocalsRef implements Encodable {
4943
+ private static encodingSchemaValue: Schema | undefined;
4944
+
4945
+ static get encodingSchema(): Schema {
4946
+ if (!this.encodingSchemaValue) {
4947
+ this.encodingSchemaValue = new NamedMapSchema([]);
4948
+ (this.encodingSchemaValue as NamedMapSchema).pushEntries(
4949
+ { key: 'address', valueSchema: new StringSchema(), omitEmpty: true },
4950
+ { key: 'app', valueSchema: new Uint64Schema(), omitEmpty: true }
4951
+ );
4952
+ }
4953
+ return this.encodingSchemaValue;
4954
+ }
4955
+
4956
+ /**
4957
+ * (d) Address in access list, or the sender of the transaction.
4958
+ */
4959
+ public address: Address;
4960
+
4961
+ /**
4962
+ * (p) Application ID for app in access list, or zero if referring to the called
4963
+ * application.
4964
+ */
4965
+ public app: number;
4966
+
4967
+ /**
4968
+ * Creates a new `LocalsRef` object.
4969
+ * @param address - (d) Address in access list, or the sender of the transaction.
4970
+ * @param app - (p) Application ID for app in access list, or zero if referring to the called
4971
+ * application.
4972
+ */
4973
+ constructor({
4974
+ address,
4975
+ app,
4976
+ }: {
4977
+ address: Address | string;
4978
+ app: number | bigint;
4979
+ }) {
4980
+ this.address =
4981
+ typeof address === 'string' ? Address.fromString(address) : address;
4982
+ this.app = ensureSafeInteger(app);
4983
+ }
4984
+
4985
+ // eslint-disable-next-line class-methods-use-this
4986
+ getEncodingSchema(): Schema {
4987
+ return LocalsRef.encodingSchema;
4988
+ }
4989
+
4990
+ toEncodingData(): Map<string, unknown> {
4991
+ return new Map<string, unknown>([
4992
+ ['address', this.address.toString()],
4993
+ ['app', this.app],
4994
+ ]);
4995
+ }
4996
+
4997
+ static fromEncodingData(data: unknown): LocalsRef {
4998
+ if (!(data instanceof Map)) {
4999
+ throw new Error(`Invalid decoded LocalsRef: ${data}`);
5000
+ }
5001
+ return new LocalsRef({
5002
+ address: data.get('address'),
5003
+ app: data.get('app'),
5004
+ });
5005
+ }
5006
+ }
5007
+
4762
5008
  export class MerkleArrayProof implements Encodable {
4763
5009
  private static encodingSchemaValue: Schema | undefined;
4764
5010
 
@@ -5055,6 +5301,182 @@ export class ParticipationUpdates implements Encodable {
5055
5301
  }
5056
5302
  }
5057
5303
 
5304
+ /**
5305
+ * ResourceRef names a single resource. Only one of the fields should be set.
5306
+ */
5307
+ export class ResourceRef implements Encodable {
5308
+ private static encodingSchemaValue: Schema | undefined;
5309
+
5310
+ static get encodingSchema(): Schema {
5311
+ if (!this.encodingSchemaValue) {
5312
+ this.encodingSchemaValue = new NamedMapSchema([]);
5313
+ (this.encodingSchemaValue as NamedMapSchema).pushEntries(
5314
+ {
5315
+ key: 'address',
5316
+ valueSchema: new OptionalSchema(new StringSchema()),
5317
+ omitEmpty: true,
5318
+ },
5319
+ {
5320
+ key: 'application-id',
5321
+ valueSchema: new OptionalSchema(new Uint64Schema()),
5322
+ omitEmpty: true,
5323
+ },
5324
+ {
5325
+ key: 'asset-id',
5326
+ valueSchema: new OptionalSchema(new Uint64Schema()),
5327
+ omitEmpty: true,
5328
+ },
5329
+ {
5330
+ key: 'box',
5331
+ valueSchema: new OptionalSchema(BoxReference.encodingSchema),
5332
+ omitEmpty: true,
5333
+ },
5334
+ {
5335
+ key: 'holding',
5336
+ valueSchema: new OptionalSchema(HoldingRef.encodingSchema),
5337
+ omitEmpty: true,
5338
+ },
5339
+ {
5340
+ key: 'local',
5341
+ valueSchema: new OptionalSchema(LocalsRef.encodingSchema),
5342
+ omitEmpty: true,
5343
+ }
5344
+ );
5345
+ }
5346
+ return this.encodingSchemaValue;
5347
+ }
5348
+
5349
+ /**
5350
+ * (d) Account whose balance record is accessible by the executing ApprovalProgram
5351
+ * or ClearStateProgram.
5352
+ */
5353
+ public address?: Address;
5354
+
5355
+ /**
5356
+ * (p) Application id whose GlobalState may be read by the executing
5357
+ * ApprovalProgram or ClearStateProgram.
5358
+ */
5359
+ public applicationId?: number;
5360
+
5361
+ /**
5362
+ * (s) Asset whose AssetParams may be read by the executing
5363
+ * ApprovalProgram or ClearStateProgram.
5364
+ */
5365
+ public assetId?: number;
5366
+
5367
+ /**
5368
+ * BoxReference names a box by its name and the application ID it belongs to.
5369
+ */
5370
+ public box?: BoxReference;
5371
+
5372
+ /**
5373
+ * HoldingRef names a holding by referring to an Address and Asset it belongs to.
5374
+ */
5375
+ public holding?: HoldingRef;
5376
+
5377
+ /**
5378
+ * LocalsRef names a local state by referring to an Address and App it belongs to.
5379
+ */
5380
+ public local?: LocalsRef;
5381
+
5382
+ /**
5383
+ * Creates a new `ResourceRef` object.
5384
+ * @param address - (d) Account whose balance record is accessible by the executing ApprovalProgram
5385
+ * or ClearStateProgram.
5386
+ * @param applicationId - (p) Application id whose GlobalState may be read by the executing
5387
+ * ApprovalProgram or ClearStateProgram.
5388
+ * @param assetId - (s) Asset whose AssetParams may be read by the executing
5389
+ * ApprovalProgram or ClearStateProgram.
5390
+ * @param box - BoxReference names a box by its name and the application ID it belongs to.
5391
+ * @param holding - HoldingRef names a holding by referring to an Address and Asset it belongs to.
5392
+ * @param local - LocalsRef names a local state by referring to an Address and App it belongs to.
5393
+ */
5394
+ constructor({
5395
+ address,
5396
+ applicationId,
5397
+ assetId,
5398
+ box,
5399
+ holding,
5400
+ local,
5401
+ }: {
5402
+ address?: Address | string;
5403
+ applicationId?: number | bigint;
5404
+ assetId?: number | bigint;
5405
+ box?: BoxReference;
5406
+ holding?: HoldingRef;
5407
+ local?: LocalsRef;
5408
+ }) {
5409
+ this.address =
5410
+ typeof address === 'string' ? Address.fromString(address) : address;
5411
+ this.applicationId =
5412
+ typeof applicationId === 'undefined'
5413
+ ? undefined
5414
+ : ensureSafeInteger(applicationId);
5415
+ this.assetId =
5416
+ typeof assetId === 'undefined' ? undefined : ensureSafeInteger(assetId);
5417
+ this.box = box;
5418
+ this.holding = holding;
5419
+ this.local = local;
5420
+ }
5421
+
5422
+ // eslint-disable-next-line class-methods-use-this
5423
+ getEncodingSchema(): Schema {
5424
+ return ResourceRef.encodingSchema;
5425
+ }
5426
+
5427
+ toEncodingData(): Map<string, unknown> {
5428
+ return new Map<string, unknown>([
5429
+ [
5430
+ 'address',
5431
+ typeof this.address !== 'undefined'
5432
+ ? this.address.toString()
5433
+ : undefined,
5434
+ ],
5435
+ ['application-id', this.applicationId],
5436
+ ['asset-id', this.assetId],
5437
+ [
5438
+ 'box',
5439
+ typeof this.box !== 'undefined' ? this.box.toEncodingData() : undefined,
5440
+ ],
5441
+ [
5442
+ 'holding',
5443
+ typeof this.holding !== 'undefined'
5444
+ ? this.holding.toEncodingData()
5445
+ : undefined,
5446
+ ],
5447
+ [
5448
+ 'local',
5449
+ typeof this.local !== 'undefined'
5450
+ ? this.local.toEncodingData()
5451
+ : undefined,
5452
+ ],
5453
+ ]);
5454
+ }
5455
+
5456
+ static fromEncodingData(data: unknown): ResourceRef {
5457
+ if (!(data instanceof Map)) {
5458
+ throw new Error(`Invalid decoded ResourceRef: ${data}`);
5459
+ }
5460
+ return new ResourceRef({
5461
+ address: data.get('address'),
5462
+ applicationId: data.get('application-id'),
5463
+ assetId: data.get('asset-id'),
5464
+ box:
5465
+ typeof data.get('box') !== 'undefined'
5466
+ ? BoxReference.fromEncodingData(data.get('box'))
5467
+ : undefined,
5468
+ holding:
5469
+ typeof data.get('holding') !== 'undefined'
5470
+ ? HoldingRef.fromEncodingData(data.get('holding'))
5471
+ : undefined,
5472
+ local:
5473
+ typeof data.get('local') !== 'undefined'
5474
+ ? LocalsRef.fromEncodingData(data.get('local'))
5475
+ : undefined,
5476
+ });
5477
+ }
5478
+ }
5479
+
5058
5480
  /**
5059
5481
  * (sp) represents a state proof.
5060
5482
  * Definition:
@@ -6892,6 +7314,13 @@ export class TransactionApplication implements Encodable {
6892
7314
  valueSchema: new Uint64Schema(),
6893
7315
  omitEmpty: true,
6894
7316
  },
7317
+ {
7318
+ key: 'access',
7319
+ valueSchema: new OptionalSchema(
7320
+ new ArraySchema(ResourceRef.encodingSchema)
7321
+ ),
7322
+ omitEmpty: true,
7323
+ },
6895
7324
  {
6896
7325
  key: 'accounts',
6897
7326
  valueSchema: new OptionalSchema(new ArraySchema(new StringSchema())),
@@ -6909,6 +7338,13 @@ export class TransactionApplication implements Encodable {
6909
7338
  valueSchema: new OptionalSchema(new ByteArraySchema()),
6910
7339
  omitEmpty: true,
6911
7340
  },
7341
+ {
7342
+ key: 'box-references',
7343
+ valueSchema: new OptionalSchema(
7344
+ new ArraySchema(BoxReference.encodingSchema)
7345
+ ),
7346
+ omitEmpty: true,
7347
+ },
6912
7348
  {
6913
7349
  key: 'clear-state-program',
6914
7350
  valueSchema: new OptionalSchema(new ByteArraySchema()),
@@ -6943,6 +7379,11 @@ export class TransactionApplication implements Encodable {
6943
7379
  key: 'on-completion',
6944
7380
  valueSchema: new OptionalSchema(new StringSchema()),
6945
7381
  omitEmpty: true,
7382
+ },
7383
+ {
7384
+ key: 'reject-version',
7385
+ valueSchema: new OptionalSchema(new Uint64Schema()),
7386
+ omitEmpty: true,
6946
7387
  }
6947
7388
  );
6948
7389
  }
@@ -6954,6 +7395,13 @@ export class TransactionApplication implements Encodable {
6954
7395
  */
6955
7396
  public applicationId: bigint;
6956
7397
 
7398
+ /**
7399
+ * (al) Access unifies `accounts`, `foreign-apps`, `foreign-assets`, and
7400
+ * `box-references` under a single list. If access is non-empty, these lists must
7401
+ * be empty. If access is empty, those lists may be non-empty.
7402
+ */
7403
+ public access?: ResourceRef[];
7404
+
6957
7405
  /**
6958
7406
  * (apat) List of accounts in addition to the sender that may be accessed from the
6959
7407
  * application's approval-program and clear-state-program.
@@ -6974,6 +7422,12 @@ export class TransactionApplication implements Encodable {
6974
7422
  */
6975
7423
  public approvalProgram?: Uint8Array;
6976
7424
 
7425
+ /**
7426
+ * (apbx) the boxes that can be accessed by this transaction (and others in the
7427
+ * same group).
7428
+ */
7429
+ public boxReferences?: BoxReference[];
7430
+
6977
7431
  /**
6978
7432
  * (apsu) Logic executed for application transactions with on-completion set to
6979
7433
  * "clear". It can read and write global state for the application, as well as
@@ -7029,9 +7483,18 @@ export class TransactionApplication implements Encodable {
7029
7483
  */
7030
7484
  public onCompletion?: string;
7031
7485
 
7486
+ /**
7487
+ * (aprv) the lowest application version for which this transaction should
7488
+ * immediately fail. 0 indicates that no version check should be performed.
7489
+ */
7490
+ public rejectVersion?: number;
7491
+
7032
7492
  /**
7033
7493
  * Creates a new `TransactionApplication` object.
7034
7494
  * @param applicationId - (apid) ID of the application being configured or empty if creating.
7495
+ * @param access - (al) Access unifies `accounts`, `foreign-apps`, `foreign-assets`, and
7496
+ * `box-references` under a single list. If access is non-empty, these lists must
7497
+ * be empty. If access is empty, those lists may be non-empty.
7035
7498
  * @param accounts - (apat) List of accounts in addition to the sender that may be accessed from the
7036
7499
  * application's approval-program and clear-state-program.
7037
7500
  * @param applicationArgs - (apaa) transaction specific arguments accessed from the application's
@@ -7040,6 +7503,8 @@ export class TransactionApplication implements Encodable {
7040
7503
  * on-completion is set to "clear". It can read and write global state for the
7041
7504
  * application, as well as account-specific local state. Approval programs may
7042
7505
  * reject the transaction.
7506
+ * @param boxReferences - (apbx) the boxes that can be accessed by this transaction (and others in the
7507
+ * same group).
7043
7508
  * @param clearStateProgram - (apsu) Logic executed for application transactions with on-completion set to
7044
7509
  * "clear". It can read and write global state for the application, as well as
7045
7510
  * account-specific local state. Clear state programs cannot reject the
@@ -7067,12 +7532,16 @@ export class TransactionApplication implements Encodable {
7067
7532
  * * update
7068
7533
  * * update
7069
7534
  * * delete
7535
+ * @param rejectVersion - (aprv) the lowest application version for which this transaction should
7536
+ * immediately fail. 0 indicates that no version check should be performed.
7070
7537
  */
7071
7538
  constructor({
7072
7539
  applicationId,
7540
+ access,
7073
7541
  accounts,
7074
7542
  applicationArgs,
7075
7543
  approvalProgram,
7544
+ boxReferences,
7076
7545
  clearStateProgram,
7077
7546
  extraProgramPages,
7078
7547
  foreignApps,
@@ -7080,11 +7549,14 @@ export class TransactionApplication implements Encodable {
7080
7549
  globalStateSchema,
7081
7550
  localStateSchema,
7082
7551
  onCompletion,
7552
+ rejectVersion,
7083
7553
  }: {
7084
7554
  applicationId: number | bigint;
7555
+ access?: ResourceRef[];
7085
7556
  accounts?: (Address | string)[];
7086
7557
  applicationArgs?: Uint8Array[];
7087
7558
  approvalProgram?: string | Uint8Array;
7559
+ boxReferences?: BoxReference[];
7088
7560
  clearStateProgram?: string | Uint8Array;
7089
7561
  extraProgramPages?: number | bigint;
7090
7562
  foreignApps?: (number | bigint)[];
@@ -7092,8 +7564,10 @@ export class TransactionApplication implements Encodable {
7092
7564
  globalStateSchema?: StateSchema;
7093
7565
  localStateSchema?: StateSchema;
7094
7566
  onCompletion?: string;
7567
+ rejectVersion?: number | bigint;
7095
7568
  }) {
7096
7569
  this.applicationId = ensureBigInt(applicationId);
7570
+ this.access = access;
7097
7571
  this.accounts =
7098
7572
  typeof accounts !== 'undefined'
7099
7573
  ? accounts.map((addr) =>
@@ -7105,6 +7579,7 @@ export class TransactionApplication implements Encodable {
7105
7579
  typeof approvalProgram === 'string'
7106
7580
  ? base64ToBytes(approvalProgram)
7107
7581
  : approvalProgram;
7582
+ this.boxReferences = boxReferences;
7108
7583
  this.clearStateProgram =
7109
7584
  typeof clearStateProgram === 'string'
7110
7585
  ? base64ToBytes(clearStateProgram)
@@ -7124,6 +7599,10 @@ export class TransactionApplication implements Encodable {
7124
7599
  this.globalStateSchema = globalStateSchema;
7125
7600
  this.localStateSchema = localStateSchema;
7126
7601
  this.onCompletion = onCompletion;
7602
+ this.rejectVersion =
7603
+ typeof rejectVersion === 'undefined'
7604
+ ? undefined
7605
+ : ensureSafeInteger(rejectVersion);
7127
7606
  }
7128
7607
 
7129
7608
  // eslint-disable-next-line class-methods-use-this
@@ -7134,6 +7613,12 @@ export class TransactionApplication implements Encodable {
7134
7613
  toEncodingData(): Map<string, unknown> {
7135
7614
  return new Map<string, unknown>([
7136
7615
  ['application-id', this.applicationId],
7616
+ [
7617
+ 'access',
7618
+ typeof this.access !== 'undefined'
7619
+ ? this.access.map((v) => v.toEncodingData())
7620
+ : undefined,
7621
+ ],
7137
7622
  [
7138
7623
  'accounts',
7139
7624
  typeof this.accounts !== 'undefined'
@@ -7142,6 +7627,12 @@ export class TransactionApplication implements Encodable {
7142
7627
  ],
7143
7628
  ['application-args', this.applicationArgs],
7144
7629
  ['approval-program', this.approvalProgram],
7630
+ [
7631
+ 'box-references',
7632
+ typeof this.boxReferences !== 'undefined'
7633
+ ? this.boxReferences.map((v) => v.toEncodingData())
7634
+ : undefined,
7635
+ ],
7145
7636
  ['clear-state-program', this.clearStateProgram],
7146
7637
  ['extra-program-pages', this.extraProgramPages],
7147
7638
  ['foreign-apps', this.foreignApps],
@@ -7159,6 +7650,7 @@ export class TransactionApplication implements Encodable {
7159
7650
  : undefined,
7160
7651
  ],
7161
7652
  ['on-completion', this.onCompletion],
7653
+ ['reject-version', this.rejectVersion],
7162
7654
  ]);
7163
7655
  }
7164
7656
 
@@ -7168,9 +7660,21 @@ export class TransactionApplication implements Encodable {
7168
7660
  }
7169
7661
  return new TransactionApplication({
7170
7662
  applicationId: data.get('application-id'),
7663
+ access:
7664
+ typeof data.get('access') !== 'undefined'
7665
+ ? data
7666
+ .get('access')
7667
+ .map((v: unknown) => ResourceRef.fromEncodingData(v))
7668
+ : undefined,
7171
7669
  accounts: data.get('accounts'),
7172
7670
  applicationArgs: data.get('application-args'),
7173
7671
  approvalProgram: data.get('approval-program'),
7672
+ boxReferences:
7673
+ typeof data.get('box-references') !== 'undefined'
7674
+ ? data
7675
+ .get('box-references')
7676
+ .map((v: unknown) => BoxReference.fromEncodingData(v))
7677
+ : undefined,
7174
7678
  clearStateProgram: data.get('clear-state-program'),
7175
7679
  extraProgramPages: data.get('extra-program-pages'),
7176
7680
  foreignApps: data.get('foreign-apps'),
@@ -7184,6 +7688,7 @@ export class TransactionApplication implements Encodable {
7184
7688
  ? StateSchema.fromEncodingData(data.get('local-state-schema'))
7185
7689
  : undefined,
7186
7690
  onCompletion: data.get('on-completion'),
7691
+ rejectVersion: data.get('reject-version'),
7187
7692
  });
7188
7693
  }
7189
7694
  }
@@ -8039,7 +8544,7 @@ export class TransactionSignature implements Encodable {
8039
8544
  public logicsig?: TransactionSignatureLogicsig;
8040
8545
 
8041
8546
  /**
8042
- * (msig) structure holding multiple subsignatures.
8547
+ * structure holding multiple subsignatures.
8043
8548
  * Definition:
8044
8549
  * crypto/multisig.go : MultisigSig
8045
8550
  */
@@ -8055,7 +8560,7 @@ export class TransactionSignature implements Encodable {
8055
8560
  * @param logicsig - (lsig) Programatic transaction signature.
8056
8561
  * Definition:
8057
8562
  * data/transactions/logicsig.go
8058
- * @param multisig - (msig) structure holding multiple subsignatures.
8563
+ * @param multisig - structure holding multiple subsignatures.
8059
8564
  * Definition:
8060
8565
  * crypto/multisig.go : MultisigSig
8061
8566
  * @param sig - (sig) Standard ed25519 signature.
@@ -8135,6 +8640,13 @@ export class TransactionSignatureLogicsig implements Encodable {
8135
8640
  ),
8136
8641
  omitEmpty: true,
8137
8642
  },
8643
+ {
8644
+ key: 'logic-multisig-signature',
8645
+ valueSchema: new OptionalSchema(
8646
+ TransactionSignatureMultisig.encodingSchema
8647
+ ),
8648
+ omitEmpty: true,
8649
+ },
8138
8650
  {
8139
8651
  key: 'multisig-signature',
8140
8652
  valueSchema: new OptionalSchema(
@@ -8164,7 +8676,14 @@ export class TransactionSignatureLogicsig implements Encodable {
8164
8676
  public args?: Uint8Array[];
8165
8677
 
8166
8678
  /**
8167
- * (msig) structure holding multiple subsignatures.
8679
+ * structure holding multiple subsignatures.
8680
+ * Definition:
8681
+ * crypto/multisig.go : MultisigSig
8682
+ */
8683
+ public logicMultisigSignature?: TransactionSignatureMultisig;
8684
+
8685
+ /**
8686
+ * structure holding multiple subsignatures.
8168
8687
  * Definition:
8169
8688
  * crypto/multisig.go : MultisigSig
8170
8689
  */
@@ -8180,7 +8699,10 @@ export class TransactionSignatureLogicsig implements Encodable {
8180
8699
  * @param logic - (l) Program signed by a signature or multi signature, or hashed to be the
8181
8700
  * address of ana ccount. Base64 encoded TEAL program.
8182
8701
  * @param args - (arg) Logic arguments, base64 encoded.
8183
- * @param multisigSignature - (msig) structure holding multiple subsignatures.
8702
+ * @param logicMultisigSignature - structure holding multiple subsignatures.
8703
+ * Definition:
8704
+ * crypto/multisig.go : MultisigSig
8705
+ * @param multisigSignature - structure holding multiple subsignatures.
8184
8706
  * Definition:
8185
8707
  * crypto/multisig.go : MultisigSig
8186
8708
  * @param signature - (sig) ed25519 signature.
@@ -8188,16 +8710,19 @@ export class TransactionSignatureLogicsig implements Encodable {
8188
8710
  constructor({
8189
8711
  logic,
8190
8712
  args,
8713
+ logicMultisigSignature,
8191
8714
  multisigSignature,
8192
8715
  signature,
8193
8716
  }: {
8194
8717
  logic: string | Uint8Array;
8195
8718
  args?: Uint8Array[];
8719
+ logicMultisigSignature?: TransactionSignatureMultisig;
8196
8720
  multisigSignature?: TransactionSignatureMultisig;
8197
8721
  signature?: string | Uint8Array;
8198
8722
  }) {
8199
8723
  this.logic = typeof logic === 'string' ? base64ToBytes(logic) : logic;
8200
8724
  this.args = args;
8725
+ this.logicMultisigSignature = logicMultisigSignature;
8201
8726
  this.multisigSignature = multisigSignature;
8202
8727
  this.signature =
8203
8728
  typeof signature === 'string' ? base64ToBytes(signature) : signature;
@@ -8212,6 +8737,12 @@ export class TransactionSignatureLogicsig implements Encodable {
8212
8737
  return new Map<string, unknown>([
8213
8738
  ['logic', this.logic],
8214
8739
  ['args', this.args],
8740
+ [
8741
+ 'logic-multisig-signature',
8742
+ typeof this.logicMultisigSignature !== 'undefined'
8743
+ ? this.logicMultisigSignature.toEncodingData()
8744
+ : undefined,
8745
+ ],
8215
8746
  [
8216
8747
  'multisig-signature',
8217
8748
  typeof this.multisigSignature !== 'undefined'
@@ -8229,6 +8760,12 @@ export class TransactionSignatureLogicsig implements Encodable {
8229
8760
  return new TransactionSignatureLogicsig({
8230
8761
  logic: data.get('logic'),
8231
8762
  args: data.get('args'),
8763
+ logicMultisigSignature:
8764
+ typeof data.get('logic-multisig-signature') !== 'undefined'
8765
+ ? TransactionSignatureMultisig.fromEncodingData(
8766
+ data.get('logic-multisig-signature')
8767
+ )
8768
+ : undefined,
8232
8769
  multisigSignature:
8233
8770
  typeof data.get('multisig-signature') !== 'undefined'
8234
8771
  ? TransactionSignatureMultisig.fromEncodingData(
@@ -8241,7 +8778,7 @@ export class TransactionSignatureLogicsig implements Encodable {
8241
8778
  }
8242
8779
 
8243
8780
  /**
8244
- * (msig) structure holding multiple subsignatures.
8781
+ * structure holding multiple subsignatures.
8245
8782
  * Definition:
8246
8783
  * crypto/multisig.go : MultisigSig
8247
8784
  */