Skip to content

Syn-McJ/aa-kotlin

Repository files navigation

AA-Kotlin

Implementation of ERC-4337: Account Abstraction in Kotlin

For a high-level overview, read this blog post.
For Swift library, see this.

Installation

implementation("org.aakotlin:core:0.1.3")
implementation("org.aakotlin:alchemy:0.1.3")

Getting started

Send User Operation with Alchemy provider:

val provider = AlchemyProvider(
    ...
).withAlchemyGasManager(
    ...
)

val account = LightSmartContractAccount(...)
provider.connect(account)

val function = Function(
    "mint", // contract function name
    listOf(
        org.web3j.abi.datatypes.Address(provider.getAddress().address), // function parameters
    ),
    listOf()
)

val encoded = FunctionEncoder.encode(function)
provider.sendUserOperation(
    UserOperationCallData(
        contractAddress,
        Numeric.hexStringToByteArray(encoded),
    )
)


Check the Example app for the full code:

Example gif

Documentation

This repository is based on Alchemy's aa-sdk. Going through their Account Kit documentation will give you a good idea of the structure of this library.

Contributing

Contributions are welcome. Just open a well-structured issue or a PR.

About

Account Abstraction for mobile with Kotlin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages