Skip to content

Commit

Permalink
updated return parameters and other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
maxslimb committed Dec 24, 2024
1 parent bc7c1a5 commit 13da72b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ class MainActivity : AppCompatActivity() {

val starknetClient = StarknetClient(BuildConfig.RPC_URL)
lifecycleScope.launch(Dispatchers.IO) {

//Deploy account
//val (privateKey, accountAddress) = deployAccount()

//GetBalance
//val balance = getBalance(accountAddress)
val addressUser = BuildConfig.publicAddress.toFelt
val privateKey = BuildConfig.privateKey.toFelt

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class StarknetClient(rpcUrl: String) {
private val tag = "StarknetClient"
private lateinit var keystore: Keystore

fun deployAccount(): String {
fun deployAccount(): Pair<String, String> {
// Predefined values for account creation
keystore = Keystore()
val randomPrivateKey = StandardAccount.generatePrivateKey()
Expand Down Expand Up @@ -60,18 +60,9 @@ class StarknetClient(rpcUrl: String) {
chainId = StarknetChainId.SEPOLIA,
)

// val payloadForFeeEstimation = account.signDeployAccountV1(
// classHash = accountContractClassHash,
// calldata = calldata,
// salt = salt,
// maxFee = Felt.ZERO,
// nonce = Felt.ZERO,
// forFeeEstimate = true,
// )
// val feePayload = provider.getEstimateFee(listOf(payloadForFeeEstimation)).send()

// Fund address first
// how to approach this, we need the user to fund the address
// Fund address first with Eth
// how to approach this, we need the user to fund the address with eth

val payload = account.signDeployAccountV1(
classHash = accountContractClassHash,
Expand All @@ -84,8 +75,8 @@ class StarknetClient(rpcUrl: String) {
val res: DeployAccountResponse = provider.deployAccount(payload).send()
Log.d(tag, "Account deployed successfully: $res")

return res.address?.hexString() ?: ""

val deployedAddress = res.address?.hexString() ?: ""
return Pair(privateKey.hexString(), deployedAddress)
}

suspend fun getBalance(accountAddress: Felt): String {
Expand Down

This file was deleted.

0 comments on commit 13da72b

Please sign in to comment.