From 0a9930c8741eca36d472168df0ef3832a2a63414 Mon Sep 17 00:00:00 2001 From: Jun Luo <4catcode@gmail.com> Date: Sun, 11 Aug 2024 20:20:10 +0800 Subject: [PATCH] Bump to 1.0.0-alpha0 (#9) --- CHANGELOG.md | 3 + android_test/app/build.gradle.kts | 4 +- .../javastellarsdkdemoapp/MainActivity.kt | 55 +++++++++---------- build.gradle.kts | 6 +- 4 files changed, 33 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39e4f91..dea62d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 1.0.0-alpha0 +* Bump `java-stellar-sdk` from 0.44.0 to 1.0.0-alpha0 + ## 0.44.0 * Bump `java-stellar-sdk` from 0.43.2 to 0.44.0 diff --git a/android_test/app/build.gradle.kts b/android_test/app/build.gradle.kts index cdd3a9f..024399b 100644 --- a/android_test/app/build.gradle.kts +++ b/android_test/app/build.gradle.kts @@ -66,8 +66,8 @@ dependencies { implementation("androidx.compose.ui:ui-graphics") implementation("androidx.compose.ui:ui-tooling-preview") implementation("androidx.compose.material3:material3") - implementation(files("libs/stellar-sdk-android-spi-0.44.0.jar")) - implementation("network.lightsail:stellar-sdk:0.44.0") + implementation(files("libs/stellar-sdk-android-spi-1.0.0-alpha0.jar")) + implementation("network.lightsail:stellar-sdk:1.0.0-alpha0") testImplementation("junit:junit:4.13.2") androidTestImplementation("androidx.test.uiautomator:uiautomator:2.3.0-alpha03") androidTestImplementation("androidx.test.ext:junit:1.1.5") diff --git a/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/MainActivity.kt b/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/MainActivity.kt index bb3947d..1061eb6 100644 --- a/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/MainActivity.kt +++ b/android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/MainActivity.kt @@ -28,10 +28,9 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import org.stellar.javastellarsdkdemoapp.ui.theme.JavaStellarSDKDemoAppTheme import org.stellar.sdk.Account -import org.stellar.sdk.AccountConverter import org.stellar.sdk.Address import org.stellar.sdk.Auth -import org.stellar.sdk.InvokeHostFunctionOperation +import org.stellar.sdk.operations.InvokeHostFunctionOperation import org.stellar.sdk.KeyPair import org.stellar.sdk.Network import org.stellar.sdk.Server @@ -40,7 +39,7 @@ import org.stellar.sdk.TimeBounds import org.stellar.sdk.Transaction import org.stellar.sdk.TransactionBuilder import org.stellar.sdk.TransactionPreconditions -import org.stellar.sdk.federation.FederationServer +import org.stellar.sdk.federation.Federation import org.stellar.sdk.scval.Scv import org.stellar.sdk.xdr.ContractExecutable import org.stellar.sdk.xdr.ContractExecutableType @@ -140,7 +139,7 @@ private fun testSDK(): String { return try { // send request to horizon server val server = Server("https://horizon.stellar.org") - val horizonResp = server.root() + val horizonResp = server.root().execute() if (horizonResp == null || horizonResp.networkPassphrase != Network.PUBLIC.networkPassphrase) { throw Exception("Query Horizon failed") } @@ -152,8 +151,7 @@ private fun testSDK(): String { } // Test Federation - val fedResp = - FederationServer.createForDomain("lobstr.co").resolveAddress("example*lobstr.co") + val fedResp = Federation().resolveAddress("example*lobstr.co") if (fedResp == null || fedResp.accountId == null) { throw Exception("Query Federation failed") } @@ -162,10 +160,10 @@ private fun testSDK(): String { val source: KeyPair = KeyPair.fromSecretSeed("SCH27VUZZ6UAKB67BDNF6FA42YMBMQCBKXWGMFD5TZ6S5ZZCZFLRXKHS") - val ledgerKey = LedgerKey.Builder() + val ledgerKey = LedgerKey.builder() .discriminant(LedgerEntryType.ACCOUNT) .account( - LedgerKeyAccount.Builder() + LedgerKeyAccount.builder() .accountID( KeyPair.fromAccountId( "GB7TAYRUZGE6TVT7NHP5SMIZRNQA6PLM423EYISAOAP3MKYIQMVYP2JO" @@ -175,11 +173,11 @@ private fun testSDK(): String { .build() ) .build() - val sorobanData = SorobanTransactionData.Builder() + val sorobanData = SorobanTransactionData.builder() .resources( - SorobanResources.Builder() + SorobanResources.builder() .footprint( - LedgerFootprint.Builder() + LedgerFootprint.builder() .readOnly(arrayOf(ledgerKey)) .readWrite(arrayOf()) .build() @@ -190,16 +188,16 @@ private fun testSDK(): String { .build() ) .resourceFee(Int64(100L)) - .ext(ExtensionPoint.Builder().discriminant(0).build()) + .ext(ExtensionPoint.builder().discriminant(0).build()) .build() val sorobanDataString = sorobanData.toXdrBase64() - val createContractArgs = CreateContractArgs.Builder() + val createContractArgs = CreateContractArgs.builder() .contractIDPreimage( - ContractIDPreimage.Builder() + ContractIDPreimage.builder() .discriminant(ContractIDPreimageType.CONTRACT_ID_PREIMAGE_FROM_ADDRESS) .fromAddress( - ContractIDPreimageFromAddress.Builder() + ContractIDPreimageFromAddress.builder() .address( Address( "GB7TAYRUZGE6TVT7NHP5SMIZRNQA6PLM423EYISAOAP3MKYIQMVYP2JO" @@ -212,12 +210,12 @@ private fun testSDK(): String { .build() ) .executable( - ContractExecutable.Builder() + ContractExecutable.builder() .discriminant(ContractExecutableType.CONTRACT_EXECUTABLE_STELLAR_ASSET) .build() ) .build() - val hostFunction = HostFunction.Builder() + val hostFunction = HostFunction.builder() .discriminant(HostFunctionType.HOST_FUNCTION_TYPE_CREATE_CONTRACT) .createContract(createContractArgs) .build() @@ -227,7 +225,7 @@ private fun testSDK(): String { val sequenceNumber = 2908908335136768L val account = Account(source.accountId, sequenceNumber) val transaction: Transaction = - TransactionBuilder(AccountConverter.enableMuxed(), account, Network.TESTNET) + TransactionBuilder(account, Network.TESTNET) .addOperation(invokeHostFunctionOperation) .addPreconditions( TransactionPreconditions.builder().timeBounds(TimeBounds(0, 0)).build() @@ -245,10 +243,10 @@ private fun testSDK(): String { val validUntilLedgerSeq = 654656L val network = Network.TESTNET - val credentials = SorobanCredentials.Builder() + val credentials = SorobanCredentials.builder() .discriminant(SorobanCredentialsType.SOROBAN_CREDENTIALS_ADDRESS) .address( - SorobanAddressCredentials.Builder() + SorobanAddressCredentials.builder() .address(Address(signer.accountId).toSCAddress()) .nonce(Int64(123456789L)) .signatureExpirationLedger(Uint32(XdrUnsignedInteger(0L))) @@ -256,14 +254,14 @@ private fun testSDK(): String { .build() ) .build() - val invocation = SorobanAuthorizedInvocation.Builder() + val invocation = SorobanAuthorizedInvocation.builder() .function( - SorobanAuthorizedFunction.Builder() + SorobanAuthorizedFunction.builder() .discriminant( SorobanAuthorizedFunctionType.SOROBAN_AUTHORIZED_FUNCTION_TYPE_CONTRACT_FN ) .contractFn( - InvokeContractArgs.Builder() + InvokeContractArgs.builder() .contractAddress(Address(contractId).toSCAddress()) .functionName(Scv.toSymbol("increment").sym) .args(arrayOfNulls(0)) @@ -273,22 +271,19 @@ private fun testSDK(): String { ) .subInvocations(arrayOfNulls(0)) .build() - val entry = SorobanAuthorizationEntry.Builder() + val entry = SorobanAuthorizationEntry.builder() .credentials(credentials) .rootInvocation(invocation) .build() Auth.authorizeEntry(entry.toXdrBase64(), signer, validUntilLedgerSeq, network) // send real transaction - // https://horizon.stellar.org/transactions/fe833c504ca8b329c1e00adec7da79f61a55e28dc705e22a6515494427cc456a + // https://horizon.stellar.org/transactions/f622288e5f9720d59599f433942710c038b9a621a9d64d5c0e444262bedd0765 val xdr = - "AAAAAgAAAAAcBaQEwcGuB3ErX1lnwKcP/pe84KcAabwB0GNk6SNvnwAAnQgCwi0TAAgJjwAAAAEAAAAAAAAAAAAAAABlD7HrAAAAAAAAAAIAAAAAAAAADAAAAAAAAAACZUJvbmQAAAAAAAAAAAAAAN80PsIQ9ohJQb1yLu4XaURrKURt5rbLoC7FfOM4vSZQAAAH0oBPrQsAAABFAB6EgAAAAABRAwlNAAAAAAAAAAwAAAAAAAAAAmVCb25kAAAAAAAAAAAAAADfND7CEPaISUG9ci7uF2lEaylEbea2y6AuxXzjOL0mUAAAByOt/5PHAAAAvQBMS0AAAAAAUQMJTgAAAAAAAAAB6SNvnwAAAEDR4cJo3zzZfCFusnM0sECT4xmhLW/bgwukIBxWWXvsDGLd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qpd/P/MxKvpqOKLlV6a5HU+12p0I5zCjGhwAAAAEAAAACAAAAAQAAAADSsJCVMR4eamKRC8rg8lwyk2fEoy7XAajhtXZNIhhOXwAAABUAAAAAIgFK3MrLTmJ7H8zzm6VrxXB/HetxO3c4AZ7tdqyR84IAAAABRVRIAAAAAADSsJCVMR4eamKRC8rg8lwyk2fEoy7XAajhtXZNIhhOXwAAAAEAAAACAAAAAAAAAAKskfOCAAAAQEwgfY//YH+4a6e+4Tuk1r/xo9hvMCFlkHUOfNnmQgnO0AFHUdEv69+jNo2T07kCPkWKo8P1TWGzg+fdeeTWrwwVAdizAAAAQCHEwd7+YJu0rrww7F9W/KvCIo7NPGwCJcFWLfvQ9OYsdFDZC2nj1ghly7MJsvD9j/VmO6W/39TljzTbjsmC9wM=" val tx: Transaction = Transaction.fromEnvelopeXdr(xdr, Network.PUBLIC) as Transaction val resp = server.submitTransaction(tx) - if (!resp.isSuccess) { - throw Exception("Submit transaction failed") - } - + Log.d("MainActivity", "testSDK resp: $resp") "SUCCESS" } catch (e: Exception) { Log.e("MainActivity", "testSDK ERROR", e) diff --git a/build.gradle.kts b/build.gradle.kts index 2e7b864..9bd30c2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,11 +5,11 @@ plugins { id("project-report") id("com.diffplug.spotless") version "6.21.0" id("com.github.ben-manes.versions") version "0.48.0" - id("com.gradleup.nmcp") version "0.0.4" + id("com.gradleup.nmcp") version "0.0.9" } group = "network.lightsail" -version = "0.44.0" +version = "1.0.0-alpha0" java { sourceCompatibility = JavaVersion.VERSION_1_8 @@ -31,7 +31,7 @@ repositories { } dependencies { - implementation("network.lightsail:stellar-sdk:0.44.0") + implementation("network.lightsail:stellar-sdk:1.0.0-alpha0") } tasks {