@algorandfoundation/algokit-utils 7.0.0-beta.20 → 7.0.0-beta.22
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/app-deploy.js +1 -9
- package/app-deploy.js.map +1 -1
- package/app-deploy.mjs +1 -9
- package/app-deploy.mjs.map +1 -1
- package/package.json +1 -1
- package/types/app-arc56.d.ts +11 -10
- package/types/app-arc56.js.map +1 -1
- package/types/app-arc56.mjs.map +1 -1
- package/types/app-client.d.ts +6 -0
- package/types/app-client.js +21 -12
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +21 -12
- package/types/app-client.mjs.map +1 -1
- package/types/app-factory.js +0 -2
- package/types/app-factory.js.map +1 -1
- package/types/app-factory.mjs +0 -2
- package/types/app-factory.mjs.map +1 -1
- package/types/app-manager.js +103 -10
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +103 -10
- package/types/app-manager.mjs.map +1 -1
- package/types/app-spec.js +8 -2
- package/types/app-spec.js.map +1 -1
- package/types/app-spec.mjs +8 -2
- package/types/app-spec.mjs.map +1 -1
package/types/app-client.mjs
CHANGED
|
@@ -123,6 +123,12 @@ class AppClient {
|
|
|
123
123
|
bare: this.getBareSendMethods(),
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Clone this app client with different params
|
|
128
|
+
*
|
|
129
|
+
* @param params The params to use for the the cloned app client. Omit a param to keep the original value. Set a param to override the original value. Setting to undefined will clear the original value.
|
|
130
|
+
* @returns A new app client with the altered params
|
|
131
|
+
*/
|
|
126
132
|
clone(params) {
|
|
127
133
|
return new AppClient({
|
|
128
134
|
appId: this._appId,
|
|
@@ -547,19 +553,22 @@ class AppClient {
|
|
|
547
553
|
if (defaultValue) {
|
|
548
554
|
switch (defaultValue.source) {
|
|
549
555
|
case 'literal':
|
|
550
|
-
if (typeof defaultValue.data === 'number')
|
|
551
|
-
return defaultValue.data;
|
|
552
556
|
return getABIDecodedValue(Buffer.from(defaultValue.data, 'base64'), m.method.args[i].defaultValue?.type ?? m.method.args[i].type, this._appSpec.structs);
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
557
|
+
case 'method': {
|
|
558
|
+
const method = this.getABIMethod(defaultValue.data);
|
|
559
|
+
const result = await this.send.call({
|
|
560
|
+
method: defaultValue.data,
|
|
561
|
+
args: method.args.map(() => undefined),
|
|
562
|
+
sender,
|
|
563
|
+
});
|
|
564
|
+
if (result.return === undefined) {
|
|
565
|
+
throw new Error('Default value method call did not return a value');
|
|
566
|
+
}
|
|
567
|
+
if (typeof result.return === 'object' && !(result.return instanceof Uint8Array) && !Array.isArray(result.return)) {
|
|
568
|
+
return getABITupleFromABIStruct(result.return, this._appSpec.structs[method.returns.struct], this._appSpec.structs);
|
|
569
|
+
}
|
|
570
|
+
return result.return;
|
|
571
|
+
}
|
|
563
572
|
case 'local':
|
|
564
573
|
case 'global': {
|
|
565
574
|
const state = defaultValue.source === 'global' ? await this.getGlobalState() : await this.getLocalState(sender);
|