From 9c0cde6f151bc692f6a27c8706af280f2612fd85 Mon Sep 17 00:00:00 2001 From: "Rob Moore (MakerX)" Date: Sun, 29 Sep 2024 23:01:25 +0800 Subject: [PATCH] fix: tests --- docs/code/modules/index.md | 14 +++++++------- src/transaction/transaction.ts | 9 ++++++--- .../app-factory-and-client.spec.ts.snap | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/docs/code/modules/index.md b/docs/code/modules/index.md index ced08440..36068400 100644 --- a/docs/code/modules/index.md +++ b/docs/code/modules/index.md @@ -542,7 +542,7 @@ the estimated rate. #### Defined in -[src/transaction/transaction.ts:841](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/transaction/transaction.ts#L841) +[src/transaction/transaction.ts:844](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/transaction/transaction.ts#L844) ___ @@ -606,7 +606,7 @@ Allows for control of fees on a `Transaction` or `SuggestedParams` object #### Defined in -[src/transaction/transaction.ts:866](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/transaction/transaction.ts#L866) +[src/transaction/transaction.ts:869](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/transaction/transaction.ts#L869) ___ @@ -1893,7 +1893,7 @@ Returns the array of transactions currently present in the given `AtomicTransact #### Defined in -[src/transaction/transaction.ts:902](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/transaction/transaction.ts#L902) +[src/transaction/transaction.ts:905](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/transaction/transaction.ts#L905) ___ @@ -2280,7 +2280,7 @@ Returns suggested transaction parameters from algod unless some are already prov #### Defined in -[src/transaction/transaction.ts:891](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/transaction/transaction.ts#L891) +[src/transaction/transaction.ts:894](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/transaction/transaction.ts#L894) ___ @@ -2597,7 +2597,7 @@ Performs a dry run of the transactions loaded into the given AtomicTransactionCo #### Defined in -[src/transaction/transaction.ts:717](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/transaction/transaction.ts#L717) +[src/transaction/transaction.ts:720](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/transaction/transaction.ts#L720) ___ @@ -2919,7 +2919,7 @@ Signs and sends a group of [up to 16](https://developer.algorand.org/docs/get-de #### Defined in -[src/transaction/transaction.ts:737](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/transaction/transaction.ts#L737) +[src/transaction/transaction.ts:740](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/transaction/transaction.ts#L740) ___ @@ -3192,4 +3192,4 @@ Throws an error if the transaction is not confirmed or rejected in the next `tim #### Defined in -[src/transaction/transaction.ts:782](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/transaction/transaction.ts#L782) +[src/transaction/transaction.ts:785](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/transaction/transaction.ts#L785) diff --git a/src/transaction/transaction.ts b/src/transaction/transaction.ts index 8cf2729d..26ef08c4 100644 --- a/src/transaction/transaction.ts +++ b/src/transaction/transaction.ts @@ -670,10 +670,13 @@ export const sendAtomicTransactionComposer = async function (atcSend: AtomicTran // Create a new error object so the stack trace is correct (algosdk throws an error with a more limited stack trace) // eslint-disable-next-line @typescript-eslint/no-explicit-any const err = new Error(typeof e === 'object' ? e?.message : 'Received error executing Atomic Transaction Composer') as any as any - // Remove headers as it doesn't have anything useful. - delete e.response?.headers - err.response = e.response err.cause = e + if (typeof e === 'object') { + // Remove headers as it doesn't have anything useful. + delete e.response?.headers + err.response = e.response + err.name = e.name + } if (Config.debug && typeof e === 'object') { err.traces = [] diff --git a/src/types/__snapshots__/app-factory-and-client.spec.ts.snap b/src/types/__snapshots__/app-factory-and-client.spec.ts.snap index ae570521..2142a3a3 100644 --- a/src/types/__snapshots__/app-factory-and-client.spec.ts.snap +++ b/src/types/__snapshots__/app-factory-and-client.spec.ts.snap @@ -5,5 +5,5 @@ exports[`ARC32: app-factory-and-app-client Errors Display nice error messages wh INFO: App TestingApp not found in apps created by ACCOUNT_1; deploying app with version 1.0. VERBOSE: Sent transaction ID TXID_1 appl from ACCOUNT_1 DEBUG: App created by ACCOUNT_1 with ID APP_1 via transaction TXID_1 -ERROR: Received error executing Atomic Transaction Composer and debug flag enabled; attempting simulation to get more information | [{"response":{"body":{"data":{"app-index":APP_1,"eval-states":[{"stack":[0]}],"group-index":0,"pc":885},"message":"TransactionPool.Remember: transaction TXID_2: logic eval error: assert failed pc=885. Details: app=APP_1, pc=885, opcodes=proto 0 0; intc_0 // 0; assert"},"status":400,"text":"{\\"data\\":{\\"app-index\\":APP_1,\\"eval-states\\":[{\\"stack\\":[0]}],\\"group-index\\":0,\\"pc\\":885},\\"message\\":\\"TransactionPool.Remember: transaction TXID_2: logic eval error: assert failed pc=885. Details: app=APP_1, pc=885, opcodes=proto 0 0; intc_0 // 0; assert\\"}\\n","ok":false},"name":"URLTokenBaseHTTPError","status":400,"traces":[]}]" +ERROR: Received error executing Atomic Transaction Composer and debug flag enabled; attempting simulation to get more information | [{"cause":{"response":{"body":{"data":{"app-index":APP_1,"eval-states":[{"stack":[0]}],"group-index":0,"pc":885},"message":"TransactionPool.Remember: transaction TXID_2: logic eval error: assert failed pc=885. Details: app=APP_1, pc=885, opcodes=proto 0 0; intc_0 // 0; assert"},"status":400,"text":"{\\"data\\":{\\"app-index\\":APP_1,\\"eval-states\\":[{\\"stack\\":[0]}],\\"group-index\\":0,\\"pc\\":885},\\"message\\":\\"TransactionPool.Remember: transaction TXID_2: logic eval error: assert failed pc=885. Details: app=APP_1, pc=885, opcodes=proto 0 0; intc_0 // 0; assert\\"}\\n","ok":false},"name":"URLTokenBaseHTTPError","status":400},"response":{"body":{"data":{"app-index":APP_1,"eval-states":[{"stack":[0]}],"group-index":0,"pc":885},"message":"TransactionPool.Remember: transaction TXID_2: logic eval error: assert failed pc=885. Details: app=APP_1, pc=885, opcodes=proto 0 0; intc_0 // 0; assert"},"status":400,"text":"{\\"data\\":{\\"app-index\\":APP_1,\\"eval-states\\":[{\\"stack\\":[0]}],\\"group-index\\":0,\\"pc\\":885},\\"message\\":\\"TransactionPool.Remember: transaction TXID_2: logic eval error: assert failed pc=885. Details: app=APP_1, pc=885, opcodes=proto 0 0; intc_0 // 0; assert\\"}\\n","ok":false},"name":"URLTokenBaseHTTPError","traces":[]}]" `;