Skip to content

Commit

Permalink
Bump demo apps to 0.13.0 (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
franciszekjob authored Sep 24, 2024
1 parent 1307731 commit e6ae316
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion androiddemo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dependencies {
implementation("com.google.android.material:material:1.9.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
// Make sure you are using the AAR and not a JAR and include transitive dependencies
implementation("com.swmansion.starknet:starknet:0.12.1@aar"){
implementation("com.swmansion.starknet:starknet:0.13.0@aar"){
isTransitive = true
}
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ class MainActivity : AppCompatActivity() {
signer = signer,
provider = provider,
chainId = chainId,
cairoVersion = Felt.ONE,
)

// Details of the transfer transaction
Expand Down
2 changes: 1 addition & 1 deletion javademo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

dependencies {
implementation("com.swmansion.starknet:starknet:0.12.1")
implementation("com.swmansion.starknet:starknet:0.13.0")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.0")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.0")
}
Expand Down
6 changes: 3 additions & 3 deletions javademo/src/main/java/com/example/javademo/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static void main(String[] args) throws Exception {
Felt privateKey = Felt.fromHex(DemoConfig.accountPrivateKey);
// Make sure to check Cairo version of account contract
StarknetChainId chainId = provider.getChainId().send();
Account account = new StandardAccount(address, privateKey, provider, chainId, Felt.ONE);
Account account = new StandardAccount(address, privateKey, provider, chainId);

// Invoke a contract (Transfer ETH)
Felt recipientAccountAddress = Felt.fromHex("0x987654321");
Expand Down Expand Up @@ -177,15 +177,15 @@ private static DeclareResponse declareCairo1Contract(Account account, Provider p
Felt nonce = account.getNonce().send();

// Estimate fee for declaring a contract
DeclareTransactionV3Payload declareTransactionPayloadForFeeEstimate = account.signDeclareV3(contractDefinition, casmContractDefinition, new DeclareParamsV3(nonce, ResourceBounds.ZERO), true);
DeclareTransactionV3 declareTransactionPayloadForFeeEstimate = account.signDeclareV3(contractDefinition, casmContractDefinition, new DeclareParamsV3(nonce, ResourceBounds.ZERO), true);
Request<EstimateFeeResponseList> feeEstimateRequest = provider.getEstimateFee(List.of(declareTransactionPayloadForFeeEstimate));
EstimateFeeResponse feeEstimate = feeEstimateRequest.send().getValues().get(0);
// Make sure to prefund the account with enough funds to cover the fee for declare transaction

// Declare a contract
ResourceBounds l1ResourceBounds = feeEstimate.toResourceBounds(1.5, 1.5).getL1Gas();
DeclareParamsV3 params = new DeclareParamsV3(nonce, l1ResourceBounds);
DeclareTransactionV3Payload declareTransactionPayload = account.signDeclareV3(contractDefinition, casmContractDefinition, params, false);
DeclareTransactionV3 declareTransactionPayload = account.signDeclareV3(contractDefinition, casmContractDefinition, params, false);

Request<DeclareResponse> request = provider.declareContract(declareTransactionPayload);

Expand Down

0 comments on commit e6ae316

Please sign in to comment.