|
1 | 1 | import { bytes, Contract, internal, TransactionType, uint64 } from '@algorandfoundation/algorand-typescript' |
2 | | -import algosdk from 'algosdk' |
3 | 2 | import { AbiMetadata, getContractMethodAbiMetadata } from '../abi-metadata' |
| 3 | +import { TRANSACTION_GROUP_MAX_SIZE } from '../constants' |
4 | 4 | import { lazyContext } from '../context-helpers/internal-context' |
5 | 5 | import { DecodedLogs, decodeLogs, LogDecoding } from '../decode-logs' |
6 | 6 | import { testInvariant } from '../errors' |
@@ -180,10 +180,8 @@ export class TransactionGroup { |
180 | 180 |
|
181 | 181 | constructor(transactions: Transaction[], activeTransactionIndex?: number) { |
182 | 182 | this.latestTimestamp = Date.now() |
183 | | - if (transactions.length > algosdk.AtomicTransactionComposer.MAX_GROUP_SIZE) { |
184 | | - internal.errors.internalError( |
185 | | - `Transaction group can have at most ${algosdk.AtomicTransactionComposer.MAX_GROUP_SIZE} transactions, as per AVM limits.`, |
186 | | - ) |
| 183 | + if (transactions.length > TRANSACTION_GROUP_MAX_SIZE) { |
| 184 | + internal.errors.internalError(`Transaction group can have at most ${TRANSACTION_GROUP_MAX_SIZE} transactions, as per AVM limits.`) |
187 | 185 | } |
188 | 186 | transactions.forEach((txn, index) => Object.assign(txn, { groupIndex: asUint64(index) })) |
189 | 187 | this.activeTransactionIndex = activeTransactionIndex === undefined ? transactions.length - 1 : activeTransactionIndex |
@@ -245,8 +243,8 @@ export class TransactionGroup { |
245 | 243 | if (!this.constructingItxnGroup.length) { |
246 | 244 | internal.errors.internalError('itxn submit without itxn begin') |
247 | 245 | } |
248 | | - if (this.constructingItxnGroup.length > algosdk.AtomicTransactionComposer.MAX_GROUP_SIZE) { |
249 | | - internal.errors.internalError('Cannot submit more than 16 inner transactions at once') |
| 246 | + if (this.constructingItxnGroup.length > TRANSACTION_GROUP_MAX_SIZE) { |
| 247 | + internal.errors.internalError(`Cannot submit more than ${TRANSACTION_GROUP_MAX_SIZE} inner transactions at once`) |
250 | 248 | } |
251 | 249 | const itxns = this.constructingItxnGroup.map((t) => createInnerTxn(t)) |
252 | 250 | itxns.forEach((itxn, index) => Object.assign(itxn, { groupIndex: asUint64(index) })) |
|
0 commit comments