背景
本文档说明了 Skip Go 中用于获取标准化费用信息的功能,这些信息涵盖用户在兑换或转账时可能产生的各类费用。常见费用包括:- 联盟费用(例如你在前端向用户收取的兑换费用)
- 跨桥和中继服务费用
- Smart Relayer 费用
- Gas 费用
跨桥费用的应用方式
跨桥费用的收取方式取决于转账的源链:- EVM 源链转账:当跨桥转账发起自 EVM 链(例如 Ethereum),并且费用以该链的原生代币支付(例如 ETH)时,这笔费用通常会作为转账金额之外的额外收费收取。底层跨桥提供方普遍采用这种方式,我们也保留了这一行为,以确保所有 EVM 源链转账在体验上保持一致,无论转移的是 ERC20 代币还是原生资产。
- Cosmos 源链转账:对于发起自 Cosmos 链的转账,跨桥费用会从转移资产金额中直接扣除。因此,目标链上的实际到账金额将体现这部分扣减。
理解来自所有来源的已产生费用:estimated_fees
/route 和 /msgs_direct 的响应中的 estimated_fees 提供了一个 Fee 数组,其中每个条目都包含某一项具体费用的信息。
数组中的每个 Fee 对象都包含以下属性:
fee_type:枚举值,表示费用类型:SMART_RELAY、SWAP、BRIDGE、RELAY、GASbridge_id:如果该费用是中继服务费(RELAY)或跨桥费(BRIDGE),该字段表示收取该费用的桥 ID(或中继服务所依附的桥)amount:费用金额(以实际收取该费用的代币表示)usd_amount:该费用的预估美元价值origin_asset:一个Asset对象,包含用于展示和识别该费用计价代币的有用元数据chain_id:收取该费用的链 IDdenom:该费用计价代币的 denomtx_index:用户产生该费用的交易的零基索引标识符(对于多交易路径,费用可能会在第一笔交易之后产生)operation_index:用户产生该费用的 operations 数组条目的零基索引
有问题或反馈?欢迎帮助我们做得更好!加入我们的 Discord,并选择 “Skip Go Developer” 身份组,分享你的问题和反馈。
Background
This doc describes functionality in Skip Go for accessing standardized information about the various fees that a user can incur while swapping or transferring. Common fees include:- Affiliate fees (e.g. fees you charge the user for swapping on your frontend)
- Bridge and relayer fees
- Smart Relayer fees
- Gas fees
How Bridging Fees Are Applied
The method for applying bridging fees depends on the source chain of the transfer:- EVM-Source Transfers: When a bridge transfer originates from an EVM-based chain (e.g., Ethereum), and the fee is paid in the native token of that chain (like ETH), the fee is typically an additional charge on top of the amount being transferred. This approach is common among underlying bridge providers, and we maintain this behavior for consistency across all EVM-source transfers, whether for ERC20 tokens or native assets.
- Cosmos-Source Transfers: For transfers originating from Cosmos-based chains, bridging fees are deducted directly from the transferred asset amount. Consequently, the amount received on the destination chain will reflect this deduction.
Understanding incurred fees from all sources: estimated_fees
estimated_fees in the response of /route and /msgs_direct provides a Fee array where each entry gives information about a particular fee.
Each Fee object in the array will have the following attributes:
fee_type: Enum giving the kind of fee —SMART_RELAY,SWAP,BRIDGE,RELAY,GASbridge_id: If the fee is a relayer fee (RELAY) or a bridge fee (BRIDGE), this gives the ID of the bridge charging the fee (or the bridge where the relayer is providing a service)amount: The amount of the fee (expressed in the token the fee will be charged in)usd_amount: Estimated USD value of the feeorigin_asset: AnAssetobject containing useful metadata for displaying and identifying the token in which the fee is denominatedchain_id: Chain ID where the fee will be collecteddenom: Denom of the token in which the fee is denominatedtx_index: The zero-indexed identifier of the transaction where the user will incur this fee (For multi-transaction routes, fees may be incurred after the first transaction)operation_index: The zero-indexed entry in the operations array where the user will incur this fee
Have questions or feedback? Help us get better!Join our Discord and select the “Skip Go Developer” role to share your questions and feedback.