Skip to content

Syn-McJ/aa-swift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AA-Swift

Implementation of ERC-4337: Account Abstraction in Swift

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

Installation

Swift Package Manager

In Package.swift:

dependencies: [
    .package(url: "https://github.com/syn-mcj/aa-swift.git", .upToNextMajor(from: "0.1.3"))
]

In Xcode:

  • Navigate to Project -> Package Dependencies -> Add.
  • Enter https://github.com/syn-mcj/aa-kotlin.git in the Search bar.
  • Add package.

Getting started

Send User Operation with Alchemy provider:

let provider = try AlchemyProvider(
    ...
).withAlchemyGasManager(
    config: ...
)

let account = try LightSmartContractAccount(...)
provider.connect(account: account)

let encodedFn = ABIFunctionEncoder("mint") // contract function name
try await encodedFn.encode(provider.getAddress()) // function parameters
        
try await provider.sendUserOperation(
    data: UserOperationCallData(
        target: contractAddress,
        data: encodedFn.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 Swift

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages