Skip to content

Commit

Permalink
adding method to abi result object (#334)
Browse files Browse the repository at this point in the history
* adding method to abi result object
  • Loading branch information
barnjamin authored Jun 6, 2022
1 parent 5af199c commit faaa8c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ public ExecuteResult execute(AlgodClient client, int waitRounds) throws Exceptio
signedTxns.get(i).transactionID,
null,
null,
this.methodMap.get(i),
new Exception(resp.message()),
null
));
Expand All @@ -290,6 +291,7 @@ public ExecuteResult execute(AlgodClient client, int waitRounds) throws Exceptio
currentTxInfo.txn.transactionID,
null,
null,
this.methodMap.get(i),
null,
currentTxInfo
));
Expand All @@ -315,6 +317,7 @@ public ExecuteResult execute(AlgodClient client, int waitRounds) throws Exceptio
currentTxInfo.txn.transactionID,
abiEncoded,
decoded,
this.methodMap.get(i),
parseError,
currentTxInfo
));
Expand Down Expand Up @@ -349,14 +352,16 @@ public static class ReturnValue {
public String txID;
public byte[] rawValue;
public Object value;
public Method method;
public Exception parseError;
public PendingTransactionResponse txInfo;

public ReturnValue(String txID, byte[] rawValue, Object value,
public ReturnValue(String txID, byte[] rawValue, Object value, Method method,
Exception parseError, PendingTransactionResponse txInfo) {
this.txID = txID;
this.rawValue = rawValue;
this.value = value;
this.method = method;
this.parseError = parseError;
this.txInfo = txInfo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public class AtomicTxnComposer {
AtomicTransactionComposer.ExecuteResult execRes;
SplitAndProcessMethodArgs abiArgProcessor;
Long appID;
List<Method> composerMethods;
String nonce;

public AtomicTxnComposer(Stepdefs stepdefs, Applications apps, TransactionSteps steps) {
Expand Down Expand Up @@ -79,7 +78,6 @@ public void an_application_id(Integer int1) {
@Given("a new AtomicTransactionComposer")
public void a_new_atomic_transaction_composer() {
this.atc = new AtomicTransactionComposer();
composerMethods = new ArrayList<>();
}

@When("I make a transaction signer for the transient account.")
Expand Down Expand Up @@ -139,11 +137,10 @@ public void i_execute_the_current_transaction_group_with_the_composer() throws E
public void the_app_should_have_returned(String string) {
String[] splitEncoding = string.split(",");
assertThat(execRes.methodResults.size()).isEqualTo(splitEncoding.length);
assertThat(execRes.methodResults.size()).isEqualTo(composerMethods.size());

for (int i = 0; i < splitEncoding.length; i++) {
AtomicTransactionComposer.ReturnValue execRetVal = execRes.methodResults.get(i);
Method currMethod = composerMethods.get(i);
Method currMethod = execRetVal.method;
assertThat(execRetVal.parseError).isNull();

if (splitEncoding[i].isEmpty()) {
Expand Down Expand Up @@ -324,7 +321,6 @@ public void the_composer_should_have_a_status_of(String string) {
@When("I add a method call with the transient account, the current application, suggested params, on complete {string}, current transaction signer, current method arguments.")
public void i_add_a_method_call_with_the_signing_account_the_current_application_suggested_params_on_complete_current_transaction_signer_current_method_arguments(String onComplete) {
Address senderAddress = applications.transientAccount.transientAccount.getAddress();
composerMethods.add(method);

optionBuilder
.onComplete(Transaction.OnCompletion.String(onComplete))
Expand All @@ -345,7 +341,6 @@ public void i_add_a_method_call_with_the_signing_account_the_current_application
@When("I add a nonced method call with the transient account, the current application, suggested params, on complete {string}, current transaction signer, current method arguments.")
public void i_add_a_nonced_method_call_with_the_transient_account_the_current_application_suggested_params_on_complete_current_transaction_signer_current_method_arguments(String onComplete) {
Address senderAddress = applications.transientAccount.transientAccount.getAddress();
composerMethods.add(method);

optionBuilder
.onComplete(Transaction.OnCompletion.String(onComplete))
Expand Down Expand Up @@ -373,7 +368,6 @@ public void i_add_a_method_call_with_the_transient_account_the_current_applicati
} catch (Exception e) {
throw new IllegalArgumentException("cannot read resource from specified TEAL files");
}
composerMethods.add(method);

Address senderAddress = applications.transientAccount.transientAccount.getAddress();

Expand Down Expand Up @@ -410,7 +404,6 @@ public void i_add_a_method_call_with_the_transient_account_the_current_applicati
} catch (Exception e) {
throw new IllegalArgumentException("cannot read resource from specified TEAL files");
}
composerMethods.add(method);

Address senderAddress = applications.transientAccount.transientAccount.getAddress();

Expand Down

0 comments on commit faaa8c3

Please sign in to comment.