Users sign in once after upgrading
Version 0.4.0 discards sessions saved by 0.3 on load, so each user signs in once after the upgrade.Read the active wallet
omsWallet.wallet.walletAddress was removed. Read omsWallet.wallet.activeWallet, a Wallet or null when signed out, and branch on its type before passing the address to family-specific code.
WalletActivationResult and CompleteAuthResult.WalletSelected no longer have walletAddress; use result.wallet.address. Code that creates or destructures them positionally must drop the removed first component.
Check session for null
omsWallet.wallet.session is now OMSWalletSession? (renamed from OMSWalletSessionState). In 0.3 it was an object whose fields were null when signed out. session is non-null exactly when activeWallet is, and its expiresAt and auth are non-null.
Replace onSessionExpired with onSessionChange
onSessionChange reports every change of the active wallet or session as an OMSWalletSessionChangeEvent: SignedIn, WalletChanged, ExpiryUpdated, SignedOut, or Expired. Expired carries the ended session as expiredSession.
Renamed parameters and types
Positional arguments moved in three places:
sendTransaction(network, to, value, …)gainedmodebeforewaitForStatus. NamewaitForStatusif you passed it fourth.signInWithOidcIdTokentakeswalletTypebeforewalletSelection.startOidcRedirectAuthwith a custom provider takesloginHintbeforeauthorizeParams.
WalletType gained Tron, WalletImportPrivateKey gained Tron and TronBytes, and OMSWalletOperation and OMSWalletErrorCode gained cases. Exhaustive when expressions over them need the new branches.
The isValid…Signature methods gained an optional trailing walletAddress to verify any wallet, even while signed out. Existing calls are unchanged and still verify against the active wallet.
Importing a key whose address is already imported now throws OMSWalletErrorCode.WalletAddressAlreadyImported instead of RequestFailed.
Behavior changes
These need no code change to compile, but can change what your application sees:- Session expiry extends with use.
session.expiresAtis the current expiry, not a fixed end time. An idle session ends about 10 days after its last use, and never after the requested lifetime. The default lifetime is now 180 days instead of 7; passsessionLifetimeSecondsfor a hard limit. Listen forExpiryUpdatedinstead of caching the sign-in expiry. - The expiry is checked when it passes. When
expiresAtpasses, a session past its requested lifetime ends at once. Otherwise the SDK asks the wallet API, once the app is in the foreground, and reportsExpiredonly if the session ended. - Signed requests time out after 30 seconds with
OMS_REQUEST_FAILED, counting the time spent waiting behind other signed requests, which are now sent one at a time. A transaction that times out after it was sent still fails withOMS_TRANSACTION_EXECUTION_UNCONFIRMED: check its status before sending it again. - Refused transactions fail as request errors. A transaction the wallet API refuses before submitting it, for example because simulation shows it would revert, throws
OMS_REQUEST_FAILED(orOMS_SESSION_EXPIREDwhen the session has ended) instead ofOMS_TRANSACTION_EXECUTION_UNCONFIRMED. It was never submitted, so there is nothing to check. callContracttakes a bare method name. Pass"transfer", not"transfer(address,uint256)". A full signature now throwsOMSWalletValidationExceptionbefore any request.- Sign-in claims a claimable wallet. With automatic selection, a user with no wallet of the requested type but a claimable one gets that wallet instead of a new one.
- Instances of one project share one session. Every
OMSWalletfor the same project and environment in the process shares the active wallet, sign-out, expiry, and listeners.