buildSourceAccountAuthPayloadHash

suspend fun buildSourceAccountAuthPayloadHash(entry: SorobanAuthorizationEntryXdr, nonce: Int64Xdr, expirationLedger: UInt, networkPassphrase: String): ByteArray

Builds the authorization payload hash for source_account credentials.

This is used when converting source_account credentials to Address credentials, typically for relayer fee sponsoring. The payload is constructed similarly to buildAuthPayloadHash but uses the provided nonce and expiration since there are no existing credentials yet.

The payload is constructed as:

HashIdPreimage::SorobanAuthorization {
networkId: SHA256(networkPassphrase as UTF-8),
nonce: provided nonce,
signatureExpirationLedger: expirationLedger,
invocation: entry.rootInvocation
}
hash = SHA256(XDR_encode(payload))

Return

The 32-byte SHA-256 hash of the authorization payload

Parameters

entry

The authorization entry with source_account credentials

nonce

The nonce to use for the new Address credentials

expirationLedger

The ledger number at which the signature expires

networkPassphrase

The network passphrase

Throws