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
@@ -3,8 +3,8 @@
3
3
  * NOTICE: This file was generated. Editing this file manually is not recommended.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Transaction = exports.TealValue = exports.TealKeyValue = exports.StateSchema = exports.StateProofVerifier = exports.StateProofTracking = exports.StateProofSignature = exports.StateProofSigSlot = exports.StateProofReveal = exports.StateProofParticipant = exports.StateProofFields = exports.ParticipationUpdates = exports.MiniAssetHolding = exports.MerkleArrayProof = exports.IndexerStateProofMessage = exports.HealthCheck = exports.HbProofFields = exports.HashFactory = exports.EvalDeltaKeyValue = exports.EvalDelta = exports.ErrorResponse = exports.BoxesResponse = exports.BoxDescriptor = exports.Box = exports.BlockUpgradeVote = exports.BlockUpgradeState = exports.BlockRewards = exports.BlockHeadersResponse = exports.Block = exports.AssetsResponse = exports.AssetResponse = exports.AssetParams = exports.AssetHoldingsResponse = exports.AssetHolding = exports.AssetBalancesResponse = exports.Asset = exports.ApplicationsResponse = exports.ApplicationStateSchema = exports.ApplicationResponse = exports.ApplicationParams = exports.ApplicationLogsResponse = exports.ApplicationLogData = exports.ApplicationLocalStatesResponse = exports.ApplicationLocalState = exports.Application = exports.AccountsResponse = exports.AccountStateDelta = exports.AccountResponse = exports.AccountParticipation = exports.Account = void 0;
7
- exports.TransactionsResponse = exports.TransactionStateProof = exports.TransactionSignatureMultisigSubsignature = exports.TransactionSignatureMultisig = exports.TransactionSignatureLogicsig = exports.TransactionSignature = exports.TransactionResponse = exports.TransactionPayment = exports.TransactionKeyreg = exports.TransactionHeartbeat = exports.TransactionAssetTransfer = exports.TransactionAssetFreeze = exports.TransactionAssetConfig = exports.TransactionApplication = void 0;
6
+ exports.StateProofVerifier = exports.StateProofTracking = exports.StateProofSignature = exports.StateProofSigSlot = exports.StateProofReveal = exports.StateProofParticipant = exports.StateProofFields = exports.ResourceRef = exports.ParticipationUpdates = exports.MiniAssetHolding = exports.MerkleArrayProof = exports.LocalsRef = exports.IndexerStateProofMessage = exports.HoldingRef = exports.HealthCheck = exports.HbProofFields = exports.HashFactory = exports.EvalDeltaKeyValue = exports.EvalDelta = exports.ErrorResponse = exports.BoxesResponse = exports.BoxReference = exports.BoxDescriptor = exports.Box = exports.BlockUpgradeVote = exports.BlockUpgradeState = exports.BlockRewards = exports.BlockHeadersResponse = exports.Block = exports.AssetsResponse = exports.AssetResponse = exports.AssetParams = exports.AssetHoldingsResponse = exports.AssetHolding = exports.AssetBalancesResponse = exports.Asset = exports.ApplicationsResponse = exports.ApplicationStateSchema = exports.ApplicationResponse = exports.ApplicationParams = exports.ApplicationLogsResponse = exports.ApplicationLogData = exports.ApplicationLocalStatesResponse = exports.ApplicationLocalState = exports.Application = exports.AccountsResponse = exports.AccountStateDelta = exports.AccountResponse = exports.AccountParticipation = exports.Account = void 0;
7
+ exports.TransactionsResponse = exports.TransactionStateProof = exports.TransactionSignatureMultisigSubsignature = exports.TransactionSignatureMultisig = exports.TransactionSignatureLogicsig = exports.TransactionSignature = exports.TransactionResponse = exports.TransactionPayment = exports.TransactionKeyreg = exports.TransactionHeartbeat = exports.TransactionAssetTransfer = exports.TransactionAssetFreeze = exports.TransactionAssetConfig = exports.TransactionApplication = exports.Transaction = exports.TealValue = exports.TealKeyValue = exports.StateSchema = void 0;
8
8
  /* eslint-disable no-use-before-define */
9
9
  const utils_js_1 = require("../../../../utils/utils.js");
10
10
  const index_js_1 = require("../../../../encoding/schema/index.js");
@@ -1826,6 +1826,10 @@ class Block {
1826
1826
  key: 'participation-updates',
1827
1827
  valueSchema: new index_js_1.OptionalSchema(ParticipationUpdates.encodingSchema),
1828
1828
  omitEmpty: true,
1829
+ }, {
1830
+ key: 'previous-block-hash-512',
1831
+ valueSchema: new index_js_1.OptionalSchema(new index_js_1.ByteArraySchema()),
1832
+ omitEmpty: true,
1829
1833
  }, {
1830
1834
  key: 'proposer',
1831
1835
  valueSchema: new index_js_1.OptionalSchema(new index_js_1.StringSchema()),
@@ -1846,6 +1850,10 @@ class Block {
1846
1850
  key: 'transactions',
1847
1851
  valueSchema: new index_js_1.OptionalSchema(new index_js_1.ArraySchema(Transaction.encodingSchema)),
1848
1852
  omitEmpty: true,
1853
+ }, {
1854
+ key: 'transactions-root-sha512',
1855
+ valueSchema: new index_js_1.OptionalSchema(new index_js_1.ByteArraySchema()),
1856
+ omitEmpty: true,
1849
1857
  }, {
1850
1858
  key: 'txn-counter',
1851
1859
  valueSchema: new index_js_1.OptionalSchema(new index_js_1.Uint64Schema()),
@@ -1883,11 +1891,15 @@ class Block {
1883
1891
  * @param bonus - the potential bonus payout for this block.
1884
1892
  * @param feesCollected - the sum of all fees paid by transactions in this block.
1885
1893
  * @param participationUpdates - Participation account data that needs to be checked/acted on by the network.
1894
+ * @param previousBlockHash512 - (prev512) Previous block hash, using SHA-512.
1886
1895
  * @param proposer - the proposer of this block.
1887
1896
  * @param proposerPayout - the actual amount transferred to the proposer from the fee sink.
1888
1897
  * @param rewards - Fields relating to rewards,
1889
1898
  * @param stateProofTracking - Tracks the status of state proofs.
1890
1899
  * @param transactions - (txns) list of transactions corresponding to a given round.
1900
+ * @param transactionsRootSha512 - (txn512) TransactionsRootSHA512 is an auxiliary TransactionRoot, built using a
1901
+ * vector commitment instead of a merkle tree, and SHA512 hash function instead of
1902
+ * the default SHA512_256.
1891
1903
  * @param txnCounter - (tc) TxnCounter counts the number of transactions committed in the ledger, from
1892
1904
  * the time at which support for this feature was introduced.
1893
1905
  * Specifically, TxnCounter is the number of the next transaction that will be
@@ -1896,7 +1908,7 @@ class Block {
1896
1908
  * @param upgradeState - Fields relating to a protocol upgrade.
1897
1909
  * @param upgradeVote - Fields relating to voting for a protocol upgrade.
1898
1910
  */
1899
- constructor({ genesisHash, genesisId, previousBlockHash, round, seed, timestamp, transactionsRoot, transactionsRootSha256, bonus, feesCollected, participationUpdates, proposer, proposerPayout, rewards, stateProofTracking, transactions, txnCounter, upgradeState, upgradeVote, }) {
1911
+ constructor({ genesisHash, genesisId, previousBlockHash, round, seed, timestamp, transactionsRoot, transactionsRootSha256, bonus, feesCollected, participationUpdates, previousBlockHash512, proposer, proposerPayout, rewards, stateProofTracking, transactions, transactionsRootSha512, txnCounter, upgradeState, upgradeVote, }) {
1900
1912
  this.genesisHash =
1901
1913
  typeof genesisHash === 'string'
1902
1914
  ? (0, binarydata_js_1.base64ToBytes)(genesisHash)
@@ -1924,6 +1936,10 @@ class Block {
1924
1936
  ? undefined
1925
1937
  : (0, utils_js_1.ensureSafeInteger)(feesCollected);
1926
1938
  this.participationUpdates = participationUpdates;
1939
+ this.previousBlockHash512 =
1940
+ typeof previousBlockHash512 === 'string'
1941
+ ? (0, binarydata_js_1.base64ToBytes)(previousBlockHash512)
1942
+ : previousBlockHash512;
1927
1943
  this.proposer =
1928
1944
  typeof proposer === 'string' ? address_js_1.Address.fromString(proposer) : proposer;
1929
1945
  this.proposerPayout =
@@ -1933,6 +1949,10 @@ class Block {
1933
1949
  this.rewards = rewards;
1934
1950
  this.stateProofTracking = stateProofTracking;
1935
1951
  this.transactions = transactions;
1952
+ this.transactionsRootSha512 =
1953
+ typeof transactionsRootSha512 === 'string'
1954
+ ? (0, binarydata_js_1.base64ToBytes)(transactionsRootSha512)
1955
+ : transactionsRootSha512;
1936
1956
  this.txnCounter =
1937
1957
  typeof txnCounter === 'undefined'
1938
1958
  ? undefined
@@ -1962,6 +1982,7 @@ class Block {
1962
1982
  ? this.participationUpdates.toEncodingData()
1963
1983
  : undefined,
1964
1984
  ],
1985
+ ['previous-block-hash-512', this.previousBlockHash512],
1965
1986
  [
1966
1987
  'proposer',
1967
1988
  typeof this.proposer !== 'undefined'
@@ -1987,6 +2008,7 @@ class Block {
1987
2008
  ? this.transactions.map((v) => v.toEncodingData())
1988
2009
  : undefined,
1989
2010
  ],
2011
+ ['transactions-root-sha512', this.transactionsRootSha512],
1990
2012
  ['txn-counter', this.txnCounter],
1991
2013
  [
1992
2014
  'upgrade-state',
@@ -2020,6 +2042,7 @@ class Block {
2020
2042
  participationUpdates: typeof data.get('participation-updates') !== 'undefined'
2021
2043
  ? ParticipationUpdates.fromEncodingData(data.get('participation-updates'))
2022
2044
  : undefined,
2045
+ previousBlockHash512: data.get('previous-block-hash-512'),
2023
2046
  proposer: data.get('proposer'),
2024
2047
  proposerPayout: data.get('proposer-payout'),
2025
2048
  rewards: typeof data.get('rewards') !== 'undefined'
@@ -2035,6 +2058,7 @@ class Block {
2035
2058
  .get('transactions')
2036
2059
  .map((v) => Transaction.fromEncodingData(v))
2037
2060
  : undefined,
2061
+ transactionsRootSha512: data.get('transactions-root-sha512'),
2038
2062
  txnCounter: data.get('txn-counter'),
2039
2063
  upgradeState: typeof data.get('upgrade-state') !== 'undefined'
2040
2064
  ? BlockUpgradeState.fromEncodingData(data.get('upgrade-state'))
@@ -2413,6 +2437,48 @@ class BoxDescriptor {
2413
2437
  }
2414
2438
  }
2415
2439
  exports.BoxDescriptor = BoxDescriptor;
2440
+ /**
2441
+ * BoxReference names a box by its name and the application ID it belongs to.
2442
+ */
2443
+ class BoxReference {
2444
+ static get encodingSchema() {
2445
+ if (!this.encodingSchemaValue) {
2446
+ this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
2447
+ this.encodingSchemaValue.pushEntries({ key: 'app', valueSchema: new index_js_1.Uint64Schema(), omitEmpty: true }, { key: 'name', valueSchema: new index_js_1.ByteArraySchema(), omitEmpty: true });
2448
+ }
2449
+ return this.encodingSchemaValue;
2450
+ }
2451
+ /**
2452
+ * Creates a new `BoxReference` object.
2453
+ * @param app - Application ID to which the box belongs, or zero if referring to the called
2454
+ * application.
2455
+ * @param name - Base64 encoded box name
2456
+ */
2457
+ constructor({ app, name, }) {
2458
+ this.app = (0, utils_js_1.ensureSafeInteger)(app);
2459
+ this.name = typeof name === 'string' ? (0, binarydata_js_1.base64ToBytes)(name) : name;
2460
+ }
2461
+ // eslint-disable-next-line class-methods-use-this
2462
+ getEncodingSchema() {
2463
+ return BoxReference.encodingSchema;
2464
+ }
2465
+ toEncodingData() {
2466
+ return new Map([
2467
+ ['app', this.app],
2468
+ ['name', this.name],
2469
+ ]);
2470
+ }
2471
+ static fromEncodingData(data) {
2472
+ if (!(data instanceof Map)) {
2473
+ throw new Error(`Invalid decoded BoxReference: ${data}`);
2474
+ }
2475
+ return new BoxReference({
2476
+ app: data.get('app'),
2477
+ name: data.get('name'),
2478
+ });
2479
+ }
2480
+ }
2481
+ exports.BoxReference = BoxReference;
2416
2482
  /**
2417
2483
  * Box names of an application
2418
2484
  */
@@ -2816,6 +2882,48 @@ class HealthCheck {
2816
2882
  }
2817
2883
  }
2818
2884
  exports.HealthCheck = HealthCheck;
2885
+ /**
2886
+ * HoldingRef names a holding by referring to an Address and Asset it belongs to.
2887
+ */
2888
+ class HoldingRef {
2889
+ static get encodingSchema() {
2890
+ if (!this.encodingSchemaValue) {
2891
+ this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
2892
+ this.encodingSchemaValue.pushEntries({ key: 'address', valueSchema: new index_js_1.StringSchema(), omitEmpty: true }, { key: 'asset', valueSchema: new index_js_1.Uint64Schema(), omitEmpty: true });
2893
+ }
2894
+ return this.encodingSchemaValue;
2895
+ }
2896
+ /**
2897
+ * Creates a new `HoldingRef` object.
2898
+ * @param address - (d) Address in access list, or the sender of the transaction.
2899
+ * @param asset - (s) Asset ID for asset in access list.
2900
+ */
2901
+ constructor({ address, asset, }) {
2902
+ this.address =
2903
+ typeof address === 'string' ? address_js_1.Address.fromString(address) : address;
2904
+ this.asset = (0, utils_js_1.ensureSafeInteger)(asset);
2905
+ }
2906
+ // eslint-disable-next-line class-methods-use-this
2907
+ getEncodingSchema() {
2908
+ return HoldingRef.encodingSchema;
2909
+ }
2910
+ toEncodingData() {
2911
+ return new Map([
2912
+ ['address', this.address.toString()],
2913
+ ['asset', this.asset],
2914
+ ]);
2915
+ }
2916
+ static fromEncodingData(data) {
2917
+ if (!(data instanceof Map)) {
2918
+ throw new Error(`Invalid decoded HoldingRef: ${data}`);
2919
+ }
2920
+ return new HoldingRef({
2921
+ address: data.get('address'),
2922
+ asset: data.get('asset'),
2923
+ });
2924
+ }
2925
+ }
2926
+ exports.HoldingRef = HoldingRef;
2819
2927
  class IndexerStateProofMessage {
2820
2928
  static get encodingSchema() {
2821
2929
  if (!this.encodingSchemaValue) {
@@ -2901,6 +3009,49 @@ class IndexerStateProofMessage {
2901
3009
  }
2902
3010
  }
2903
3011
  exports.IndexerStateProofMessage = IndexerStateProofMessage;
3012
+ /**
3013
+ * LocalsRef names a local state by referring to an Address and App it belongs to.
3014
+ */
3015
+ class LocalsRef {
3016
+ static get encodingSchema() {
3017
+ if (!this.encodingSchemaValue) {
3018
+ this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
3019
+ this.encodingSchemaValue.pushEntries({ key: 'address', valueSchema: new index_js_1.StringSchema(), omitEmpty: true }, { key: 'app', valueSchema: new index_js_1.Uint64Schema(), omitEmpty: true });
3020
+ }
3021
+ return this.encodingSchemaValue;
3022
+ }
3023
+ /**
3024
+ * Creates a new `LocalsRef` object.
3025
+ * @param address - (d) Address in access list, or the sender of the transaction.
3026
+ * @param app - (p) Application ID for app in access list, or zero if referring to the called
3027
+ * application.
3028
+ */
3029
+ constructor({ address, app, }) {
3030
+ this.address =
3031
+ typeof address === 'string' ? address_js_1.Address.fromString(address) : address;
3032
+ this.app = (0, utils_js_1.ensureSafeInteger)(app);
3033
+ }
3034
+ // eslint-disable-next-line class-methods-use-this
3035
+ getEncodingSchema() {
3036
+ return LocalsRef.encodingSchema;
3037
+ }
3038
+ toEncodingData() {
3039
+ return new Map([
3040
+ ['address', this.address.toString()],
3041
+ ['app', this.app],
3042
+ ]);
3043
+ }
3044
+ static fromEncodingData(data) {
3045
+ if (!(data instanceof Map)) {
3046
+ throw new Error(`Invalid decoded LocalsRef: ${data}`);
3047
+ }
3048
+ return new LocalsRef({
3049
+ address: data.get('address'),
3050
+ app: data.get('app'),
3051
+ });
3052
+ }
3053
+ }
3054
+ exports.LocalsRef = LocalsRef;
2904
3055
  class MerkleArrayProof {
2905
3056
  static get encodingSchema() {
2906
3057
  if (!this.encodingSchemaValue) {
@@ -3090,6 +3241,119 @@ class ParticipationUpdates {
3090
3241
  }
3091
3242
  }
3092
3243
  exports.ParticipationUpdates = ParticipationUpdates;
3244
+ /**
3245
+ * ResourceRef names a single resource. Only one of the fields should be set.
3246
+ */
3247
+ class ResourceRef {
3248
+ static get encodingSchema() {
3249
+ if (!this.encodingSchemaValue) {
3250
+ this.encodingSchemaValue = new index_js_1.NamedMapSchema([]);
3251
+ this.encodingSchemaValue.pushEntries({
3252
+ key: 'address',
3253
+ valueSchema: new index_js_1.OptionalSchema(new index_js_1.StringSchema()),
3254
+ omitEmpty: true,
3255
+ }, {
3256
+ key: 'application-id',
3257
+ valueSchema: new index_js_1.OptionalSchema(new index_js_1.Uint64Schema()),
3258
+ omitEmpty: true,
3259
+ }, {
3260
+ key: 'asset-id',
3261
+ valueSchema: new index_js_1.OptionalSchema(new index_js_1.Uint64Schema()),
3262
+ omitEmpty: true,
3263
+ }, {
3264
+ key: 'box',
3265
+ valueSchema: new index_js_1.OptionalSchema(BoxReference.encodingSchema),
3266
+ omitEmpty: true,
3267
+ }, {
3268
+ key: 'holding',
3269
+ valueSchema: new index_js_1.OptionalSchema(HoldingRef.encodingSchema),
3270
+ omitEmpty: true,
3271
+ }, {
3272
+ key: 'local',
3273
+ valueSchema: new index_js_1.OptionalSchema(LocalsRef.encodingSchema),
3274
+ omitEmpty: true,
3275
+ });
3276
+ }
3277
+ return this.encodingSchemaValue;
3278
+ }
3279
+ /**
3280
+ * Creates a new `ResourceRef` object.
3281
+ * @param address - (d) Account whose balance record is accessible by the executing ApprovalProgram
3282
+ * or ClearStateProgram.
3283
+ * @param applicationId - (p) Application id whose GlobalState may be read by the executing
3284
+ * ApprovalProgram or ClearStateProgram.
3285
+ * @param assetId - (s) Asset whose AssetParams may be read by the executing
3286
+ * ApprovalProgram or ClearStateProgram.
3287
+ * @param box - BoxReference names a box by its name and the application ID it belongs to.
3288
+ * @param holding - HoldingRef names a holding by referring to an Address and Asset it belongs to.
3289
+ * @param local - LocalsRef names a local state by referring to an Address and App it belongs to.
3290
+ */
3291
+ constructor({ address, applicationId, assetId, box, holding, local, }) {
3292
+ this.address =
3293
+ typeof address === 'string' ? address_js_1.Address.fromString(address) : address;
3294
+ this.applicationId =
3295
+ typeof applicationId === 'undefined'
3296
+ ? undefined
3297
+ : (0, utils_js_1.ensureSafeInteger)(applicationId);
3298
+ this.assetId =
3299
+ typeof assetId === 'undefined' ? undefined : (0, utils_js_1.ensureSafeInteger)(assetId);
3300
+ this.box = box;
3301
+ this.holding = holding;
3302
+ this.local = local;
3303
+ }
3304
+ // eslint-disable-next-line class-methods-use-this
3305
+ getEncodingSchema() {
3306
+ return ResourceRef.encodingSchema;
3307
+ }
3308
+ toEncodingData() {
3309
+ return new Map([
3310
+ [
3311
+ 'address',
3312
+ typeof this.address !== 'undefined'
3313
+ ? this.address.toString()
3314
+ : undefined,
3315
+ ],
3316
+ ['application-id', this.applicationId],
3317
+ ['asset-id', this.assetId],
3318
+ [
3319
+ 'box',
3320
+ typeof this.box !== 'undefined' ? this.box.toEncodingData() : undefined,
3321
+ ],
3322
+ [
3323
+ 'holding',
3324
+ typeof this.holding !== 'undefined'
3325
+ ? this.holding.toEncodingData()
3326
+ : undefined,
3327
+ ],
3328
+ [
3329
+ 'local',
3330
+ typeof this.local !== 'undefined'
3331
+ ? this.local.toEncodingData()
3332
+ : undefined,
3333
+ ],
3334
+ ]);
3335
+ }
3336
+ static fromEncodingData(data) {
3337
+ if (!(data instanceof Map)) {
3338
+ throw new Error(`Invalid decoded ResourceRef: ${data}`);
3339
+ }
3340
+ return new ResourceRef({
3341
+ address: data.get('address'),
3342
+ applicationId: data.get('application-id'),
3343
+ assetId: data.get('asset-id'),
3344
+ box: typeof data.get('box') !== 'undefined'
3345
+ ? BoxReference.fromEncodingData(data.get('box'))
3346
+ : undefined,
3347
+ holding: typeof data.get('holding') !== 'undefined'
3348
+ ? HoldingRef.fromEncodingData(data.get('holding'))
3349
+ : undefined,
3350
+ local: typeof data.get('local') !== 'undefined'
3351
+ ? LocalsRef.fromEncodingData(data.get('local'))
3352
+ : undefined,
3353
+ });
3354
+ }
3355
+ }
3356
+ exports.ResourceRef = ResourceRef;
3093
3357
  /**
3094
3358
  * (sp) represents a state proof.
3095
3359
  * Definition:
@@ -4221,6 +4485,10 @@ class TransactionApplication {
4221
4485
  key: 'application-id',
4222
4486
  valueSchema: new index_js_1.Uint64Schema(),
4223
4487
  omitEmpty: true,
4488
+ }, {
4489
+ key: 'access',
4490
+ valueSchema: new index_js_1.OptionalSchema(new index_js_1.ArraySchema(ResourceRef.encodingSchema)),
4491
+ omitEmpty: true,
4224
4492
  }, {
4225
4493
  key: 'accounts',
4226
4494
  valueSchema: new index_js_1.OptionalSchema(new index_js_1.ArraySchema(new index_js_1.StringSchema())),
@@ -4233,6 +4501,10 @@ class TransactionApplication {
4233
4501
  key: 'approval-program',
4234
4502
  valueSchema: new index_js_1.OptionalSchema(new index_js_1.ByteArraySchema()),
4235
4503
  omitEmpty: true,
4504
+ }, {
4505
+ key: 'box-references',
4506
+ valueSchema: new index_js_1.OptionalSchema(new index_js_1.ArraySchema(BoxReference.encodingSchema)),
4507
+ omitEmpty: true,
4236
4508
  }, {
4237
4509
  key: 'clear-state-program',
4238
4510
  valueSchema: new index_js_1.OptionalSchema(new index_js_1.ByteArraySchema()),
@@ -4261,6 +4533,10 @@ class TransactionApplication {
4261
4533
  key: 'on-completion',
4262
4534
  valueSchema: new index_js_1.OptionalSchema(new index_js_1.StringSchema()),
4263
4535
  omitEmpty: true,
4536
+ }, {
4537
+ key: 'reject-version',
4538
+ valueSchema: new index_js_1.OptionalSchema(new index_js_1.Uint64Schema()),
4539
+ omitEmpty: true,
4264
4540
  });
4265
4541
  }
4266
4542
  return this.encodingSchemaValue;
@@ -4268,6 +4544,9 @@ class TransactionApplication {
4268
4544
  /**
4269
4545
  * Creates a new `TransactionApplication` object.
4270
4546
  * @param applicationId - (apid) ID of the application being configured or empty if creating.
4547
+ * @param access - (al) Access unifies `accounts`, `foreign-apps`, `foreign-assets`, and
4548
+ * `box-references` under a single list. If access is non-empty, these lists must
4549
+ * be empty. If access is empty, those lists may be non-empty.
4271
4550
  * @param accounts - (apat) List of accounts in addition to the sender that may be accessed from the
4272
4551
  * application's approval-program and clear-state-program.
4273
4552
  * @param applicationArgs - (apaa) transaction specific arguments accessed from the application's
@@ -4276,6 +4555,8 @@ class TransactionApplication {
4276
4555
  * on-completion is set to "clear". It can read and write global state for the
4277
4556
  * application, as well as account-specific local state. Approval programs may
4278
4557
  * reject the transaction.
4558
+ * @param boxReferences - (apbx) the boxes that can be accessed by this transaction (and others in the
4559
+ * same group).
4279
4560
  * @param clearStateProgram - (apsu) Logic executed for application transactions with on-completion set to
4280
4561
  * "clear". It can read and write global state for the application, as well as
4281
4562
  * account-specific local state. Clear state programs cannot reject the
@@ -4303,9 +4584,12 @@ class TransactionApplication {
4303
4584
  * * update
4304
4585
  * * update
4305
4586
  * * delete
4587
+ * @param rejectVersion - (aprv) the lowest application version for which this transaction should
4588
+ * immediately fail. 0 indicates that no version check should be performed.
4306
4589
  */
4307
- constructor({ applicationId, accounts, applicationArgs, approvalProgram, clearStateProgram, extraProgramPages, foreignApps, foreignAssets, globalStateSchema, localStateSchema, onCompletion, }) {
4590
+ constructor({ applicationId, access, accounts, applicationArgs, approvalProgram, boxReferences, clearStateProgram, extraProgramPages, foreignApps, foreignAssets, globalStateSchema, localStateSchema, onCompletion, rejectVersion, }) {
4308
4591
  this.applicationId = (0, utils_js_1.ensureBigInt)(applicationId);
4592
+ this.access = access;
4309
4593
  this.accounts =
4310
4594
  typeof accounts !== 'undefined'
4311
4595
  ? accounts.map((addr) => typeof addr === 'string' ? address_js_1.Address.fromString(addr) : addr)
@@ -4315,6 +4599,7 @@ class TransactionApplication {
4315
4599
  typeof approvalProgram === 'string'
4316
4600
  ? (0, binarydata_js_1.base64ToBytes)(approvalProgram)
4317
4601
  : approvalProgram;
4602
+ this.boxReferences = boxReferences;
4318
4603
  this.clearStateProgram =
4319
4604
  typeof clearStateProgram === 'string'
4320
4605
  ? (0, binarydata_js_1.base64ToBytes)(clearStateProgram)
@@ -4334,6 +4619,10 @@ class TransactionApplication {
4334
4619
  this.globalStateSchema = globalStateSchema;
4335
4620
  this.localStateSchema = localStateSchema;
4336
4621
  this.onCompletion = onCompletion;
4622
+ this.rejectVersion =
4623
+ typeof rejectVersion === 'undefined'
4624
+ ? undefined
4625
+ : (0, utils_js_1.ensureSafeInteger)(rejectVersion);
4337
4626
  }
4338
4627
  // eslint-disable-next-line class-methods-use-this
4339
4628
  getEncodingSchema() {
@@ -4342,6 +4631,12 @@ class TransactionApplication {
4342
4631
  toEncodingData() {
4343
4632
  return new Map([
4344
4633
  ['application-id', this.applicationId],
4634
+ [
4635
+ 'access',
4636
+ typeof this.access !== 'undefined'
4637
+ ? this.access.map((v) => v.toEncodingData())
4638
+ : undefined,
4639
+ ],
4345
4640
  [
4346
4641
  'accounts',
4347
4642
  typeof this.accounts !== 'undefined'
@@ -4350,6 +4645,12 @@ class TransactionApplication {
4350
4645
  ],
4351
4646
  ['application-args', this.applicationArgs],
4352
4647
  ['approval-program', this.approvalProgram],
4648
+ [
4649
+ 'box-references',
4650
+ typeof this.boxReferences !== 'undefined'
4651
+ ? this.boxReferences.map((v) => v.toEncodingData())
4652
+ : undefined,
4653
+ ],
4353
4654
  ['clear-state-program', this.clearStateProgram],
4354
4655
  ['extra-program-pages', this.extraProgramPages],
4355
4656
  ['foreign-apps', this.foreignApps],
@@ -4367,6 +4668,7 @@ class TransactionApplication {
4367
4668
  : undefined,
4368
4669
  ],
4369
4670
  ['on-completion', this.onCompletion],
4671
+ ['reject-version', this.rejectVersion],
4370
4672
  ]);
4371
4673
  }
4372
4674
  static fromEncodingData(data) {
@@ -4375,9 +4677,19 @@ class TransactionApplication {
4375
4677
  }
4376
4678
  return new TransactionApplication({
4377
4679
  applicationId: data.get('application-id'),
4680
+ access: typeof data.get('access') !== 'undefined'
4681
+ ? data
4682
+ .get('access')
4683
+ .map((v) => ResourceRef.fromEncodingData(v))
4684
+ : undefined,
4378
4685
  accounts: data.get('accounts'),
4379
4686
  applicationArgs: data.get('application-args'),
4380
4687
  approvalProgram: data.get('approval-program'),
4688
+ boxReferences: typeof data.get('box-references') !== 'undefined'
4689
+ ? data
4690
+ .get('box-references')
4691
+ .map((v) => BoxReference.fromEncodingData(v))
4692
+ : undefined,
4381
4693
  clearStateProgram: data.get('clear-state-program'),
4382
4694
  extraProgramPages: data.get('extra-program-pages'),
4383
4695
  foreignApps: data.get('foreign-apps'),
@@ -4389,6 +4701,7 @@ class TransactionApplication {
4389
4701
  ? StateSchema.fromEncodingData(data.get('local-state-schema'))
4390
4702
  : undefined,
4391
4703
  onCompletion: data.get('on-completion'),
4704
+ rejectVersion: data.get('reject-version'),
4392
4705
  });
4393
4706
  }
4394
4707
  }
@@ -4913,7 +5226,7 @@ class TransactionSignature {
4913
5226
  * @param logicsig - (lsig) Programatic transaction signature.
4914
5227
  * Definition:
4915
5228
  * data/transactions/logicsig.go
4916
- * @param multisig - (msig) structure holding multiple subsignatures.
5229
+ * @param multisig - structure holding multiple subsignatures.
4917
5230
  * Definition:
4918
5231
  * crypto/multisig.go : MultisigSig
4919
5232
  * @param sig - (sig) Standard ed25519 signature.
@@ -4973,6 +5286,10 @@ class TransactionSignatureLogicsig {
4973
5286
  key: 'args',
4974
5287
  valueSchema: new index_js_1.OptionalSchema(new index_js_1.ArraySchema(new index_js_1.ByteArraySchema())),
4975
5288
  omitEmpty: true,
5289
+ }, {
5290
+ key: 'logic-multisig-signature',
5291
+ valueSchema: new index_js_1.OptionalSchema(TransactionSignatureMultisig.encodingSchema),
5292
+ omitEmpty: true,
4976
5293
  }, {
4977
5294
  key: 'multisig-signature',
4978
5295
  valueSchema: new index_js_1.OptionalSchema(TransactionSignatureMultisig.encodingSchema),
@@ -4990,14 +5307,18 @@ class TransactionSignatureLogicsig {
4990
5307
  * @param logic - (l) Program signed by a signature or multi signature, or hashed to be the
4991
5308
  * address of ana ccount. Base64 encoded TEAL program.
4992
5309
  * @param args - (arg) Logic arguments, base64 encoded.
4993
- * @param multisigSignature - (msig) structure holding multiple subsignatures.
5310
+ * @param logicMultisigSignature - structure holding multiple subsignatures.
5311
+ * Definition:
5312
+ * crypto/multisig.go : MultisigSig
5313
+ * @param multisigSignature - structure holding multiple subsignatures.
4994
5314
  * Definition:
4995
5315
  * crypto/multisig.go : MultisigSig
4996
5316
  * @param signature - (sig) ed25519 signature.
4997
5317
  */
4998
- constructor({ logic, args, multisigSignature, signature, }) {
5318
+ constructor({ logic, args, logicMultisigSignature, multisigSignature, signature, }) {
4999
5319
  this.logic = typeof logic === 'string' ? (0, binarydata_js_1.base64ToBytes)(logic) : logic;
5000
5320
  this.args = args;
5321
+ this.logicMultisigSignature = logicMultisigSignature;
5001
5322
  this.multisigSignature = multisigSignature;
5002
5323
  this.signature =
5003
5324
  typeof signature === 'string' ? (0, binarydata_js_1.base64ToBytes)(signature) : signature;
@@ -5010,6 +5331,12 @@ class TransactionSignatureLogicsig {
5010
5331
  return new Map([
5011
5332
  ['logic', this.logic],
5012
5333
  ['args', this.args],
5334
+ [
5335
+ 'logic-multisig-signature',
5336
+ typeof this.logicMultisigSignature !== 'undefined'
5337
+ ? this.logicMultisigSignature.toEncodingData()
5338
+ : undefined,
5339
+ ],
5013
5340
  [
5014
5341
  'multisig-signature',
5015
5342
  typeof this.multisigSignature !== 'undefined'
@@ -5026,6 +5353,9 @@ class TransactionSignatureLogicsig {
5026
5353
  return new TransactionSignatureLogicsig({
5027
5354
  logic: data.get('logic'),
5028
5355
  args: data.get('args'),
5356
+ logicMultisigSignature: typeof data.get('logic-multisig-signature') !== 'undefined'
5357
+ ? TransactionSignatureMultisig.fromEncodingData(data.get('logic-multisig-signature'))
5358
+ : undefined,
5029
5359
  multisigSignature: typeof data.get('multisig-signature') !== 'undefined'
5030
5360
  ? TransactionSignatureMultisig.fromEncodingData(data.get('multisig-signature'))
5031
5361
  : undefined,
@@ -5035,7 +5365,7 @@ class TransactionSignatureLogicsig {
5035
5365
  }
5036
5366
  exports.TransactionSignatureLogicsig = TransactionSignatureLogicsig;
5037
5367
  /**
5038
- * (msig) structure holding multiple subsignatures.
5368
+ * structure holding multiple subsignatures.
5039
5369
  * Definition:
5040
5370
  * crypto/multisig.go : MultisigSig
5041
5371
  */