Paymaster SDK
Installation
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}dependencies {
implementation("com.github.EthereumPhone:PaymasterSDK:0.1.0")
}Quick Start
// 1. Create the SDK instance
val paymasterSDK = PaymasterSDK(
context = applicationContext,
bundlerApiKey = "your-pimlico-api-key"
)
// 2. Initialize (connects to the on-device PaymasterProxy service)
withContext(Dispatchers.IO) {
val available = paymasterSDK.initialize()
if (available) {
// 3. Read the cached balance
val balance = paymasterSDK.getBalance() // e.g. "12.50"
// 4. Trigger a fresh balance sync from the backend
paymasterSDK.queryBalanceUpdate()
// 5. Listen for balance changes
paymasterSDK.registerBalanceObserver { newBalance ->
// update your UI
}
// 6. Initiate a top-up (returns a Daimo checkout URL)
val topUp = paymasterSDK.initiateTopUp(
userId = "0xYourWalletAddress",
amount = "10"
)
topUp?.let {
// open it.checkoutUrl in a browser / WebView
}
// 7. Estimate gas for a UserOperation
val gasEstimation = paymasterSDK.estimateGas(userOp, chainId = 8453)
// 8. Fetch token prices for sponsorship
val prices = paymasterSDK.fetchSponsorshipPrices(
listOf("0xTokenAddress1", "0xTokenAddress2")
)
}
}
// 9. Clean up when done (e.g. in onDestroy)
paymasterSDK.cleanup()Permissions
Permission
Purpose
API
Parameter
Description
Method
Return Type
Description
Constant
Value
Description
Property
Type
Description
Property
Type
Description
Property
Type
Description
Property
Type
Description
Scenario
Behavior
Requirements
GitHub Repo
Last updated