Skip to content

Commit

Permalink
#149 #150 remove deprecated functions and update default values
Browse files Browse the repository at this point in the history
  • Loading branch information
marc0olo committed Apr 9, 2021
1 parent bb8a502 commit 4c8e1fe
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import io.vertx.ext.unit.junit.VertxUnitRunner;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Supplier;
import javax.naming.ConfigurationException;
Expand Down Expand Up @@ -257,10 +258,14 @@ protected void waitForBlockHeight(BigInteger blockHeight, Long timeoutMilli) thr
}

protected String encodeCalldata(
String contractSourceCode, String contractFunction, List<String> contractFunctionParams) {
String contractSourceCode,
String contractFunction,
List<String> contractFunctionParams,
Map<String, String> fileSystem) {
return this.aeternityServiceNative
.compiler
.blockingEncodeCalldata(contractSourceCode, contractFunction, contractFunctionParams)
.blockingEncodeCalldata(
contractSourceCode, contractFunction, contractFunctionParams, fileSystem)
.getResult();
}

Expand All @@ -273,7 +278,7 @@ protected JsonObject decodeCalldata(String encodedValue, String sophiaReturnType
protected ObjectResultWrapper decodeCallResult(
String source, String function, String callResult, String callValue) {
return this.aeternityServiceNative.compiler.blockingDecodeCallResult(
source, function, callResult, callValue);
source, function, callResult, callValue, null);
}

protected <T> T callMethodAndAwaitException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ public void a_deployPaymentSplitterTest(TestContext context) throws Throwable {
context.assertEquals("ok", dryRunResult.getResult());

contractCreate =
contractCreate
.toBuilder()
contractCreate.toBuilder()
.gas(dryRunResult.getContractCallObject().getGasUsed())
.gasPrice(dryRunResult.getContractCallObject().getGasPrice())
.build();
Expand Down Expand Up @@ -291,7 +290,8 @@ public void c_callGetTotalAmountSplitted(TestContext context) throws Throwable {
String calldata =
aeternityServiceNative
.compiler
.blockingEncodeCalldata(paymentSplitterSource, "getTotalAmountSplitted", null)
.blockingEncodeCalldata(
paymentSplitterSource, "getTotalAmountSplitted", null, null)
.getResult();
_logger.info("Contract ID: " + localDeployedContractId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public interface TestConstants {

String testnetURL = "https://sdk-testnet.aepps.com";
String testnetURL = "https://testnet.aeternity.io";

String testContractSourceCode = "contract Identity =\n entrypoint main(z : int) = z";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ public void staticCallContractOnLocalNode(TestContext context) {
encodeCalldata(
TestConstants.testContractSourceCode,
TestConstants.testContractFunction,
TestConstants.testContractFunctionParams);
TestConstants.testContractFunctionParams,
null);

DryRunTransactionResults results =
this.aeternityServiceNative.transactions.blockingDryRunTransactions(
Expand Down Expand Up @@ -164,7 +165,8 @@ public void staticCallContractFailOnLocalNode(TestContext context) {
encodeCalldata(
TestConstants.testContractSourceCode,
TestConstants.testContractFunction,
TestConstants.testContractFunctionParams);
TestConstants.testContractFunctionParams,
null);

DryRunTransactionResults results =
this.aeternityServiceNative.transactions.blockingDryRunTransactions(
Expand Down Expand Up @@ -195,7 +197,8 @@ public void callContractAfterDryRunOnLocalNode(TestContext context) throws Throw
encodeCalldata(
TestConstants.testContractSourceCode,
TestConstants.testContractFunction,
TestConstants.testContractFunctionParams);
TestConstants.testContractFunctionParams,
null);

DryRunTransactionResults results =
this.aeternityServiceNative.transactions.blockingDryRunTransactions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ public void testGaBlindAuthContract(TestContext context) {
encodeCalldata(
TestConstants.testGABlindAuthContract,
"authorize",
Arrays.asList(String.valueOf(new Random().nextInt())));
Arrays.asList(String.valueOf(new Random().nextInt())),
null);

GeneralizedAccountsMetaTransactionModel gaMetaTx =
GeneralizedAccountsMetaTransactionModel.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public interface BaseConstants {
String VERTX_BASE_PATH = "basePath";

// the default testnet url
String DEFAULT_TESTNET_URL = "https://sdk-testnet.aepps.com";
String DEFAULT_TESTNET_URL = "https://testnet.aeternity.io";

// the default testnet compiler url
String DEFAULT_TESTNET_COMPILER_URL = "https://compiler.aepps.com";
String DEFAULT_TESTNET_COMPILER_URL = "https://compiler.aeternity.io";

// the default testnet indaex url
String DEFAULT_TESTNET_INDAEX_URL = "https://testnet.aeternal.io/mdw";
String DEFAULT_TESTNET_INDAEX_URL = "https://testnet.aeternity.io/mdw";
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,6 @@

public interface CompilerService {

/**
* asynchronously gets the encoded calldata for this contractCode
*
* @deprecated use {@link CompilerService#asyncEncodeCalldata(String, String, List, Map)} instead.
* this method will be removed in future releases
* @param contractCode the sourcecode of the contract
* @param function the name of the function to call
* @param arguments the params that should be passed to the function
* @return asynchronous result handler (RxJava Single) for encoded calldata
*/
@Deprecated
Single<StringResultWrapper> asyncEncodeCalldata(
String contractCode, String function, List<String> arguments);

/**
* asynchronously gets the encoded calldata for this contractCode
*
Expand All @@ -35,20 +21,6 @@ Single<StringResultWrapper> asyncEncodeCalldata(
Single<StringResultWrapper> asyncEncodeCalldata(
String contractCode, String function, List<String> arguments, Map<String, String> fileSystem);

/**
* synchronously gets the encoded calldata for this contractCode
*
* @deprecated use {@link CompilerService#blockingEncodeCalldata(String, String, List, Map)}
* instead. this method will be removed in future releases
* @param contractCode the sourcecode of the contract
* @param function the name of the function to call
* @param arguments the params that should be passed to the function
* @return encoded calldata
*/
@Deprecated
StringResultWrapper blockingEncodeCalldata(
String contractCode, String function, List<String> arguments);

/**
* synchronously gets the encoded calldata for this contractCode
*
Expand Down Expand Up @@ -99,21 +71,6 @@ StringResultWrapper blockingEncodeCalldata(
*/
ObjectResultWrapper blockingDecodeCalldata(String calldata, String sophiaType);

/**
* asynchronously decodes callresult of contract-calls
*
* @deprecated use {@link CompilerService#asyncDecodeCallResult(String, String, String, String,
* Map)} instead. this method will be removed in future releases
* @param source the contract source
* @param function the called function
* @param callResult the received resultType (ok | error | revert)
* @param callValue the received value
* @return the decoded sophia call result
*/
@Deprecated
Single<ObjectResultWrapper> asyncDecodeCallResult(
String source, String function, String callResult, String callValue);

/**
* asynchronously decodes callresult of contract-calls
*
Expand All @@ -131,21 +88,6 @@ Single<ObjectResultWrapper> asyncDecodeCallResult(
String callValue,
Map<String, String> fileSystem);

/**
* synchronously decodes callresult of contract-calls
*
* @deprecated use {@link CompilerService#blockingDecodeCallResult(String, String, String, String,
* Map)} instead. this method will be removed in future releases
* @param source the contract source
* @param function the called function
* @param callResult the received resultType (ok | error | revert)
* @param callValue the received value
* @return the decoded sophia call result
*/
@Deprecated
ObjectResultWrapper blockingDecodeCallResult(
String source, String function, String callResult, String callValue);

/**
* synchronously decodes callresult of contract-calls
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ public final class SophiaCompilerServiceImpl implements CompilerService {

@NonNull private DefaultApi compilerApi;

@Override
public Single<StringResultWrapper> asyncEncodeCalldata(
String sourceCode, String function, List<String> arguments) {
return this.asyncEncodeCalldata(sourceCode, function, arguments, null);
}

@Override
public Single<StringResultWrapper> asyncEncodeCalldata(
String sourceCode, String function, List<String> arguments, Map<String, String> fileSystem) {
Expand All @@ -45,12 +39,6 @@ public Single<StringResultWrapper> asyncEncodeCalldata(
.map(calldata -> calldata.getCalldata()));
}

@Override
public StringResultWrapper blockingEncodeCalldata(
String sourceCode, String function, List<String> arguments) {
return this.blockingEncodeCalldata(sourceCode, function, arguments, null);
}

@Override
public StringResultWrapper blockingEncodeCalldata(
String sourceCode, String function, List<String> arguments, Map<String, String> fileSystem) {
Expand Down Expand Up @@ -104,12 +92,6 @@ public ObjectResultWrapper blockingDecodeCalldata(String calldata, String sophia
Optional.ofNullable(decodeResult).orElse(new SophiaJsonData()).getData()));
}

@Override
public Single<ObjectResultWrapper> asyncDecodeCallResult(
String source, String function, String callResult, String callValue) {
return this.asyncDecodeCallResult(source, function, callResult, callValue, null);
}

@Override
public Single<ObjectResultWrapper> asyncDecodeCallResult(
String source,
Expand All @@ -126,12 +108,6 @@ public Single<ObjectResultWrapper> asyncDecodeCallResult(
.map(decodeResult -> Optional.ofNullable(decodeResult).orElse("")));
}

@Override
public ObjectResultWrapper blockingDecodeCallResult(
String source, String function, String callResult, String callValue) {
return this.blockingDecodeCallResult(source, function, callResult, callValue, null);
}

@Override
public ObjectResultWrapper blockingDecodeCallResult(
String source,
Expand Down

0 comments on commit 4c8e1fe

Please sign in to comment.