-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Update android SDK #2295
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
base: main
Are you sure you want to change the base?
Update android SDK #2295
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- [ ] Dependencies updated to v10.x | ||
- [ ] Imports updated with new package references | ||
- [ ] `Web3AuthOptions` configuration updated | ||
- [ ] `login()` calls replaced with `connectTo()` | ||
- [ ] Private key method names updated | ||
- [ ] Wallet services methods updated | ||
- [ ] Dashboard chain configuration verified | ||
- [ ] Testing completed for all authentication flows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, this doesn't display as a checklist in the rendered markdown: https://metamask-docs-mq9lyhz8p-consensys-ddffed67.vercel.app/embedded-wallets/sdk/android/migration-guides/android-v9-to-v10/#migration-checklist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
After instantiating Web3Auth, the next step is to initialize it using the `initialize` method. This method is essential for setting up the SDK, checking for any active sessions, and fetching the whitelabel configuration from your dashboard. | ||
|
||
Once the `initialize` method executes successfully, you can use the `getPrivKey` or `getEd25519PrivKey` methods to verify if an active session exists. If there is no active session, these methods will return an empty string; otherwise, they will return the respective private key. | ||
Once the `initialize` method executes successfully, you can use the `getPrivateKey` or `getEd25519PrivateKey` methods to verify if an active session exists. If there is no active session, these methods will return an empty string; otherwise, they will return the respective private key. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is changed, the initialize
method will throw an error that needs to be swallowed if the session is not present.
initialize
method can fail if the session is not present, or if there is an network issue to get the dashboard configuration, or session validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added extra context
| `web3AuthNetwork` | Defines the Web3Auth Network. It's a mandatory field of type `Web3AuthNetwork`. | | ||
| `redirectUrl` | URL that Web3Auth will redirect API responses upon successful authentication from browser. It's a mandatory field of type `String`. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are lot of new parameters added. Top of my head, missing default chain id, account abstraction config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
var buildEnv: BuildEnv? = BuildEnv.PRODUCTION, | ||
@Transient var redirectUrl: Uri, | ||
var sdkUrl: String = getSdkUrl(buildEnv), | ||
val web3AuthNetwork: Web3AuthNetwork, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing few, can't see account abstraction config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
| `ui_locales?` | The space separated list of language tags, ordered by preference. For instance `fr-CA fr en`. | | ||
| `id_token_hint?` | It denotes the previously issued ID token. It takes `String` as a value. | | ||
| `id_token?` | JWT (ID Token) to be passed for login. | | ||
| `login_hint?` | Used to specify the user's email address or phone number for Email/SMS Passwordless login flows. Takes a `String` value. For the SMS, the format should be: `+{country_code}-{phone_number}` (e.g. `+1-1234567890`) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, now we have LoginParams.loginHint which we use for email/sms passwordless, instead of using extra login options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
import TabItem from '@theme/TabItem' | ||
import Tabs from '@theme/Tabs' | ||
|
||
The `showWalletUI` method launches a WebView which allows you to use the templated wallet UI services. The method automatically uses the chain configuration from your project settings and no longer requires manual `ChainConfig` parameter. Wallet Services is currently only available for EVM chains. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing AccountAbstraction information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
| `appState?` | It can be used to keep track of the app state. Default is `null`, and accepts `String` as a value. | | ||
|
||
:::warning | ||
|
||
The chain configuration is now automatically retrieved from your project settings in the Web3Auth Dashboard. The request will use the appropriate chain based on your project configuration. | ||
|
||
::: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing account abstraction feature via request to sign user operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
// ... | ||
// focus-next-line | ||
implementation 'com.github.web3auth:web3auth-android-sdk:7.4.0' | ||
implementation 'com.github.web3auth:web3auth-android-sdk:10.0.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Page needs revamp, the tutorial is outdated. Lot of breaking changes from 7.4.0, to 10.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left few comments, also missing account abstraction page.
|
||
// focus-next-line | ||
factory<EthereumUseCase> { EthereumUseCaseImpl(Web3j.build(HttpService(chainConfigList.first().rpcTarget))) } | ||
factory<EthereumUseCase> { EthereumUseCaseImpl(Web3j.build(HttpService(chainsList.first().rpcTarget))) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Variable Reference Error and Naming Confusion
The chainsList
variable is referenced at line 454 before its definition at line 466, which would cause a reference error. This also means the tutorial's code snippets are out of order. Additionally, some comments and text still refer to the old chainConfigList
name, which could be confusing.
Additional Locations (1)
// Returns the Ed25519 private key for Solana and other chains. | ||
override fun getEd25519PrivateKey(): String { | ||
return web3Auth.getEd25519PrivateKey() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tutorial is about EVM, we don't need this.
// Shows the Wallet UI with smart account support | ||
override suspend fun showWalletUI(): CompletableFuture<Void> { | ||
return web3Auth.showWalletUI() | ||
} | ||
|
||
// Makes a blockchain request | ||
override suspend fun request(method: String, params: JsonArray): CompletableFuture<SignResponse> { | ||
return web3Auth.request(method, params) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you updated the UI, and example to match this? This was not added.
## Advanced Features | ||
|
||
### Smart Accounts (ERC-4337) | ||
|
||
Web3Auth Android SDK v10.x includes built-in support for smart accounts. When enabled in your dashboard, users automatically get smart contract wallets with advanced features: | ||
|
||
```kotlin | ||
// Check if smart accounts are enabled | ||
val userInfo = web3AuthHelper.getUserInfo() | ||
if (userInfo.isSmartAccountEnabled) { | ||
val smartAccountAddress = userInfo.smartAccountAddress | ||
Log.d("Smart Account", "Address: $smartAccountAddress") | ||
|
||
// Use smart account for gasless transactions | ||
val userOp = buildUserOperation(smartAccountAddress, transaction) | ||
web3AuthHelper.request("eth_sendUserOperation", userOp) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole section is not correct, and using Web3Auth Wallet Services as well. Please check the example, also there's no function/method such as buildUserOperation.
Update android sdk to v10
Note
Migrates Android docs to SDK v10 with new auth flow (
connectTo
), renamed enums/methods, SFA and smart accounts support, wallet UI updates, and sidebar/version changes.web3auth-android-sdk:10.0.0
; bump displayed Android PnP version to10.0.x
.sdk/android/migration-guides/android-v9-to-v10.mdx
.login()
→connectTo()
;Provider
/TypeOfLogin
→AuthConnection
;LoginConfigItem
→AuthConnectionConfig
;loginConfig
→authConnectionConfig
.network
→web3AuthNetwork
(useWeb3AuthNetwork
);redirectUrl
nowString
.getPrivKey
/getEd25519PrivKey
→getPrivateKey
/getEd25519PrivateKey
.launchWalletServices()
→showWalletUI()
;request()
no longer needsChainConfig
and adds smart account methods.idToken
inLoginParams
.Web3AuthOptions
(chains, defaultChainId, walletServicesConfig, enableLogging, useSFAKey).usage/connectTo
,usage/getPrivateKey
,usage/showWalletUI
; remove legacylogin
,getPrivKey
,launchWalletServices
pages.verifier*
→authConnection*
,verifierId
→userId
).ew-sidebar.js
to reflect new usage pages and addsdk/android/advanced/smart-accounts
entry.Written by Cursor Bugbot for commit ba28ca9. This will update automatically on new commits. Configure here.