Repository: algorand/js-algorand-sdk
Pull request #499 (2022-01-17 12:19:02)

Add app creator to dryrun request
When doing an appGlobalGetEx the values are extracted from the balance record of the app creator.  If the app creator is not in the balance records passed in dryrun request the eval will report  the application is not found


Patch:
diff --git a/src/dryrun.ts b/src/dryrun.ts
index a3feab3..5b25975 100644
--- a/src/dryrun.ts
+++ b/src/dryrun.ts
@@ -16,6 +16,7 @@ const defaultAppId = 1380011588;
 interface AppParamsWithPrograms {
   ['approval-program']: string | Uint8Array;
   ['clear-state-program']: string | Uint8Array;
+  ['creator']: string;
 }
 
 interface AppWithAppParams {
@@ -131,9 +132,11 @@ export async function createDryrun({
         .then((appInfo) => {
           const ai = decodePrograms(appInfo as AppWithAppParams);
           appInfos.push(ai);
+          accts.push(ai.params.creator);
         })
     );
   }
+  await Promise.all(appPromises);
 
   const acctPromises = [];
   for (const acct of [...new Set(accts)]) {
@@ -152,7 +155,7 @@ export async function createDryrun({
         })
     );
   }
-  await Promise.all([...appPromises, ...acctPromises]);
+  await Promise.all(acctPromises);
 
   return new DryrunRequest({
     txns: txns.map((st) => ({ ...st, txn: st.txn.get_obj_for_encoding() })),
diff --git a/src/transaction.ts b/src/transaction.ts
index 55e4f16..37035a3 100644
--- a/src/transaction.ts
+++ b/src/transaction.ts
@@ -251,7 +251,9 @@ export class Transaction implements TransactionStorageStructure {
       ) ||
         txn.amount < 0)
     )
-      throw Error('Amount must be a positive number and smaller than 2^64-1');
+      throw Error(
+        'Amount must be a positive number and smaller than 2^64-1. If the number is larger than 2^53-1, use bigint.'
+      );
     if (!Number.isSafeInteger(txn.fee) || txn.fee < 0)
       throw Error('fee must be a positive number and smaller than 2^53-1');
     if (!Number.isSafeInteger(txn.firstRound) || txn.firstRound < 0)
@@ -275,7 +277,7 @@ export class Transaction implements TransactionStorageStructure {
         txn.assetTotal < 0)
     )
       throw Error(
-        'Total asset issuance must be a positive number and smaller than 2^64-1'
+        'Total asset issuance must be a positive number and smaller than 2^64-1. If the number is larger than 2^53-1, use bigint.'
       );
     if (
       txn.assetDecimals !== undefined &&


Test patch:
diff --git a/tests/5.Transaction.js b/tests/5.Transaction.js
index 48ceecb..710d16e 100644
--- a/tests/5.Transaction.js
+++ b/tests/5.Transaction.js
@@ -785,7 +785,9 @@ describe('Sign', () => {
       };
       assert.throws(
         () => new algosdk.Transaction(o),
-        new Error('Amount must be a positive number and smaller than 2^64-1')
+        new Error(
+          'Amount must be a positive number and smaller than 2^64-1. If the number is larger than 2^53-1, use bigint.'
+        )
       );
     });
 
@@ -1152,7 +1154,7 @@ describe('Sign', () => {
       assert.throws(
         () => new algosdk.Transaction(o),
         new Error(
-          'Total asset issuance must be a positive number and smaller than 2^64-1'
+          'Total asset issuance must be a positive number and smaller than 2^64-1. If the number is larger than 2^53-1, use bigint.'
         )
       );
     });