@algorandfoundation/algokit-utils 9.1.0 → 9.1.1-beta.1
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.
- package/package.json +1 -1
- package/transaction/transaction.js +2 -0
- package/transaction/transaction.js.map +1 -1
- package/transaction/transaction.mjs +2 -0
- package/transaction/transaction.mjs.map +1 -1
- package/types/app-client.d.ts +1 -0
- package/types/app-client.js +32 -4
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +32 -4
- package/types/app-client.mjs.map +1 -1
- package/types/app-factory.js +4 -1
- package/types/app-factory.js.map +1 -1
- package/types/app-factory.mjs +4 -1
- package/types/app-factory.mjs.map +1 -1
package/types/app-client.mjs
CHANGED
|
@@ -109,10 +109,35 @@ class AppClient {
|
|
|
109
109
|
constructor(params) {
|
|
110
110
|
/** Make the given call and catch any errors, augmenting with debugging information before re-throwing. */
|
|
111
111
|
this.handleCallErrors = async (e) => {
|
|
112
|
-
//
|
|
113
|
-
|
|
114
|
-
if (
|
|
115
|
-
|
|
112
|
+
// We can't use the app ID in an error to identify new apps, so instead we check the programs
|
|
113
|
+
// to identify if this is the correct app
|
|
114
|
+
if (this.appId === 0n) {
|
|
115
|
+
if (e.sentTransactions === undefined)
|
|
116
|
+
return e;
|
|
117
|
+
const txns = e.sentTransactions;
|
|
118
|
+
const txn = txns.find((t) => e.message.includes(t.txID()));
|
|
119
|
+
const programsDefinedAndEqual = (a, b) => {
|
|
120
|
+
if (a === undefined || b === undefined)
|
|
121
|
+
return false;
|
|
122
|
+
if (a.length !== b.length)
|
|
123
|
+
return false;
|
|
124
|
+
for (let i = 0; i < a.length; i++) {
|
|
125
|
+
if (a[i] !== b[i])
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
};
|
|
130
|
+
if (!programsDefinedAndEqual(txn?.applicationCall?.clearProgram, this._lastCompiled.clear) ||
|
|
131
|
+
!programsDefinedAndEqual(txn?.applicationCall?.approvalProgram, this._lastCompiled?.approval)) {
|
|
132
|
+
return e;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
// Only handle errors for this app.
|
|
137
|
+
const appIdString = `app=${this._appId.toString()}`;
|
|
138
|
+
if (!e.message.includes(appIdString))
|
|
139
|
+
return e;
|
|
140
|
+
}
|
|
116
141
|
const logicError = await this.exposeLogicError(e);
|
|
117
142
|
if (logicError instanceof LogicError) {
|
|
118
143
|
let currentLine = logicError.teal_line - logicError.lines - 1;
|
|
@@ -132,6 +157,7 @@ class AppClient {
|
|
|
132
157
|
this._algorand.registerErrorTransformer(this.handleCallErrors);
|
|
133
158
|
this._defaultSender = typeof params.defaultSender === 'string' ? Address.fromString(params.defaultSender) : params.defaultSender;
|
|
134
159
|
this._defaultSigner = params.defaultSigner;
|
|
160
|
+
this._lastCompiled = {};
|
|
135
161
|
this._approvalSourceMap = params.approvalSourceMap;
|
|
136
162
|
this._clearSourceMap = params.clearSourceMap;
|
|
137
163
|
this._localStateMethods = (address) => this.getStateMethods(() => this.getLocalState(address), () => this._appSpec.state.keys.local, () => this._appSpec.state.maps.local);
|
|
@@ -507,9 +533,11 @@ class AppClient {
|
|
|
507
533
|
const result = await AppClient.compile(this._appSpec, this._algorand.app, compilation);
|
|
508
534
|
if (result.compiledApproval) {
|
|
509
535
|
this._approvalSourceMap = result.compiledApproval.sourceMap;
|
|
536
|
+
this._lastCompiled.approval = result.compiledApproval.compiledBase64ToBytes;
|
|
510
537
|
}
|
|
511
538
|
if (result.compiledClear) {
|
|
512
539
|
this._clearSourceMap = result.compiledClear.sourceMap;
|
|
540
|
+
this._lastCompiled.clear = result.compiledClear.compiledBase64ToBytes;
|
|
513
541
|
}
|
|
514
542
|
return result;
|
|
515
543
|
}
|