Skip to content

Commit 8e68168

Browse files
committed
Modify AnyType.js to handle primitive types, which fixes handling of top-level TransactionResult output
1 parent f230c2f commit 8e68168

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

client/src/model/AnyType.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ class AnyType {
2222
/**
2323
* Constructs a new <code>AnyType</code>.
2424
* @alias module:model/AnyType
25-
* @param target_value {Number}
26-
* @param type {module:model/AnyType.TypeEnum}
25+
* @param target_value {Number}
26+
* @param type {module:model/AnyType.TypeEnum}
2727
*/
28-
constructor(target_value, type) {
29-
28+
constructor(target_value, type) {
29+
3030
AnyType.initialize(this, target_value, type);
3131
}
3232

@@ -35,7 +35,7 @@ class AnyType {
3535
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
3636
* Only for internal use.
3737
*/
38-
static initialize(obj, target_value, type) {
38+
static initialize(obj, target_value, type) {
3939
obj['target_value'] = target_value || null;
4040
obj['type'] = type || 'AnyType';
4141
}
@@ -48,7 +48,7 @@ class AnyType {
4848
* @return {module:model/AnyType} The populated <code>AnyType</code> instance.
4949
*/
5050
static constructFromObject(data, obj) {
51-
if (data) {
51+
if (data && typeof data === 'object') {
5252
obj = obj || new AnyType();
5353

5454
if (data.hasOwnProperty('target_value')) {
@@ -57,11 +57,14 @@ class AnyType {
5757
if (data.hasOwnProperty('type')) {
5858
obj['type'] = ApiClient.convertToType(data['type'], 'String');
5959
}
60+
61+
return obj;
62+
}
63+
else {
64+
return data;
6065
}
61-
return obj;
6266
}
6367

64-
6568
}
6669

6770
/**

client/src/sdk/LocalConnection.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,6 @@ class LocalConnection extends Connection {
251251

252252
this.runAction(action, txnParams)
253253
.then(res => {
254-
// TODO(PR): remove
255-
// Compare the raw response.text with the OpenAPI-deserialized
256-
// TransactionResult to look at the top-level output. The expected
257-
// values appear correct in the response, but we run into AnyType
258-
// types in the TransactionResult top-level output.
259-
//console.dir(JSON.parse(res.response.text));
260-
//console.dir(res.transactionResult);
261-
262254
const tr = res.transactionResult;
263255
const txnOutput = tr.output;
264256
const resultOutput = tr.actions[0].result.output;

0 commit comments

Comments
 (0)