canonicalForm method

String canonicalForm (
  1. Asset asset
)

Implementation

static String canonicalForm(Asset asset) {
  if (asset is AssetTypeNative) {
    return 'native';
  } else if (asset is AssetTypeCreditAlphaNum) {
    AssetTypeCreditAlphaNum creditAsset = asset;
    return creditAsset.code + ":" + creditAsset.issuerId;
  } else {
    throw Exception("unsupported asset " + asset.type);
  }
}