sync
Syncs a credential with on-chain state.
Checks whether the smart account contract for this credential exists on-chain by querying the contract instance via Soroban RPC. If the contract exists, the credential is deleted from storage (deployment is confirmed) and the method returns true. If the contract does not exist, or if the on-chain check fails (e.g., network error, storage deletion failure), the method returns false.
This is essential for the pending credentials workflow: when a deployment transaction is submitted but the app closes before confirmation, sync() allows the app to discover on next launch whether the deployment actually succeeded.
Return
true if the contract exists on-chain (credential was deployed), false otherwise
Parameters
The ID of the credential to sync
Throws
if the credential does not exist in storage
if reading the credential fails
Example:
val isDeployed = manager.sync(credentialId = "abc123")
if (isDeployed) {
println("Contract is deployed on-chain, credential removed from storage")
} else {
println("Contract not yet deployed, credential still pending")
}