Skip to content

Add asset identifier for totalReceiveAmount in AssetTransferInstructions #187

@lucasrosa90

Description

@lucasrosa90

Problem

AssetTransferInstructions includes totalReceiveAmount (the amount the recipient will receive after fees), but there is no field indicating which asset that amount is denominated in.

For same-asset transfers (e.g., USDC -> USDC), this is implicitly understood. However, for cross-asset transfers (e.g., USDC -> USDT, BRL -> USDC), the consumer has no way to know which asset totalReceiveAmount refers to.

Existing pattern

AssetFeeBreakdown already solves this problem for fees:

{
  "assetFee": {
    "lineItems": [{ "value": "2000", "purpose": "VALUE_VARIABLE", "asset": "$USDC" }],
    "totalPricedIn": "$USDC",
    "total": "2000"
  }
}

total is the amount, and totalPricedIn identifies the asset.

Proposal

Add a companion field to totalReceiveAmount that identifies the asset, following the same pattern as fees. For example:

// In AssetTransferInstructions (common.ts L586-602)
{
  assetFee: string | AssetFeeBreakdown;
  totalReceiveAmount?: string;
  totalReceiveAmountAsset?: MovableAssetSearchCanonical; // <-- new field
}

Naming options

Option Pros Cons
totalReceiveAmountAsset Explicit, directly pairs with totalReceiveAmount Verbose
receiveIn Concise, mirrors totalPricedIn concept Less explicit about what it pairs with
totalReceiveAmountPricedIn Consistent with totalPricedIn naming Very verbose

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions