deployPendingCredential

suspend fun deployPendingCredential(credentialId: String, autoSubmit: Boolean = true, autoFund: Boolean = false, nativeTokenContract: String? = null, forceMethod: SubmissionMethod? = null): DeployPendingResult

Deploys a wallet from a previously created pending credential.

Use this method to retry a failed deployment or to submit a wallet that was created with createWallet using autoSubmit = false. The credential must exist in local storage with a valid publicKey and contractId.

This method sets the connected state on the kit (same as createWallet) so the kit is ready to use immediately after a successful deployment.

Flow:

  1. Look up credential from storage (throws CredentialException if not found or invalid)

  2. Set connected state and emit SmartAccountEvent.WalletConnected

  3. Build and sign the deploy transaction

  4. If autoSubmit: submit via relayer or RPC, poll for confirmation

  5. If autoFund: fund wallet via native token contract

  6. Delete credential from storage on successful deployment

  7. Return DeployPendingResult with the contract address, signed XDR, and optional hash

Return

DeployPendingResult with contractId, signedTransactionXdr, and optional transactionHash

Parameters

credentialId

The credential ID (Base64URL-encoded, no padding) to deploy

autoSubmit

Whether to automatically submit the deploy transaction (default: true)

autoFund

Whether to automatically fund the wallet after deployment (default: false)

nativeTokenContract

Contract address for the native token (required if autoFund is true)

forceMethod

Optional override to force relayer or RPC submission (default: auto-detect)

See also

for initial wallet creation with deferred deployment

Throws

if the credential is not found or missing required fields

if autoFund is true but nativeTokenContract is null

if building, simulating, or submitting the deploy transaction fails

Example (retry a failed deployment with auto-submit):

val result = walletOps.deployPendingCredential(
credentialId = "abc123...",
autoSubmit = true
)
println("Deployed at tx: ${result.transactionHash}")

Example (build the XDR without submitting, for external submission):

val result = walletOps.deployPendingCredential(
credentialId = "abc123...",
autoSubmit = false
)
println("Signed XDR: ${result.signedTransactionXdr}")
// Submit externally or store for later