toSdkAsset

Converts a Horizon API Asset to an SDK Asset.

This extension function converts assets from Horizon responses (which use separate fields for type, code, and issuer) into SDK Asset objects (AssetTypeNative, AssetTypeCreditAlphaNum4, or AssetTypeCreditAlphaNum12).

Return

SDK Asset instance

Throws

if the asset type is unknown

if code or issuer is missing for credit assets