Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to 1.0.0-alpha0 #9

Merged
merged 2 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions android_test/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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")
}
Expand All @@ -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")
}
Expand All @@ -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"
Expand All @@ -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()
Expand All @@ -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"
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -245,25 +243,25 @@ 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)))
.signature(Scv.toVoid())
.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))
Expand All @@ -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/bgwukIBxWWXvsDGLdQtE87lkrGijAPiyBEy3n1lDxDu4uwNpGnMXEaTAN"
"AAAAAgAAAAAiAUrcystOYnsfzPObpWvFcH8d63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fEoy7XAajhtXZNIhhOXwAAABUAAAAAIgFK3MrLTmJ7H8zzm6VrxXB/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)
Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,7 +31,7 @@ repositories {
}

dependencies {
implementation("network.lightsail:stellar-sdk:0.44.0")
implementation("network.lightsail:stellar-sdk:1.0.0-alpha0")
}

tasks {
Expand Down