进阶:自定义费率
获取市场的计算链绑定
返回某个市场在每种用途(deposit、sale 和 withdraw)下所适用的计算链修订。
GET /website-calculation-chain-bindings
返回某个市场在每种用途(deposit、sale 和 withdraw)下所适用的计算链修订。
- 对于每种用途,你自己的绑定优先于平台默认绑定;
source表明你得到的是哪一种。两者都没有的用途为null。 - 每个槽位都注明所绑定的
calculation_chain_revision(其名称和步骤数均取自该修订)、槽位sequence(你的),以及该绑定能否应用(available、reason)。 - 市场代码未知时返回 404。
[!note] 市场的官方费率也可以通过
GET /websites/{code}/fee-schedule无需认证获取。
用量
| 名称 | 说明 |
|---|---|
| 认证 | 需要 API 密钥 |
| 点数费用 | 免费 |
参数
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
website | query | string | 是 | 要返回其绑定的市场代码。 |
响应
| 状态 | 说明 | 结构 |
|---|---|---|
200 | 请求成功 | Envelope_WebsiteCalculationChainBindingsOut_ |
401 | 缺少认证信息或认证无效 | ErrorEnvelope |
403 | 凭证有效,但无权调用此操作 | ErrorEnvelope |
404 | 请求的资源不存在 | ErrorEnvelope |
422 | 参数或请求体无效 | ErrorEnvelope |
429 | 对此端点的请求过多;请稍后重试 | ErrorEnvelope |
503 | 服务暂时不可用;请稍后重试 | ErrorEnvelope |
模型
CreditMeta
计费请求的点数结算信息。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
cost | integer | 是 | 本次请求花费的点数。 |
remaining | integer | 是 | 本次请求后的预估剩余点数。仅作参考而非账目:并发请求可能导致其略有偏差。 |
Envelope_WebsiteCalculationChainBindingsOut_
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
data | WebsiteCalculationChainBindingsOut | 是 | 端点返回的数据。 |
meta | Meta | 是 | 请求元数据。 |
ErrorBody
失败请求的详细信息。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | string | 是 | 稳定的机器可读错误代码。请根据此值进行分支处理,而不是 message。 |
message | string | 是 | 面向人类阅读的说明。措辞可能变化。 |
details | object 或 null | 否 | 可选的结构化上下文,例如校验错误列表;对于 credit_insufficient,则为所需点数和剩余点数。 |
ErrorEnvelope
错误响应:error 中为错误信息,meta 中为请求元数据。
Meta
每个带信封的响应中都包含的请求元数据。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
request_id | string | 是 | 本次请求的唯一标识符,与响应头 X-Request-ID 相同。联系支持时请提供。 |
billable | boolean 或 null | 否 | 该请求是否以点数计费。仅出现在计量端点上;false 表示该请求免费,例如因为它本身不收费,或已被你的订阅覆盖。 |
credit | CreditMeta 或 null | 否 | 本次请求的费用和你的预估剩余余额。仅在 billable 为 true 时出现。 |
page | PageMeta 或 null | 否 | 分页状态。仅出现在按页列出结果的响应中。 |
PageMeta
本页之后分页列表的进度。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
limit | integer | 是 | 本次请求实际采用的每页条数。 |
has_next | boolean | 是 | 是否还有下一页。 |
next_cursor | string 或 null | 是 | 将其原样作为 cursor 传回即可获取下一页;列表已全部返回时为 null。 |
WebsiteCalculationChainBindingSlotOut
某个市场在某一用途下所适用的计算链。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
purpose | string | 是 | 用途:deposit、sale 或 withdraw。可选值:deposit, sale, withdraw。 |
calculation_chain_id | integer | 是 | 所绑定计算链的 ID。 |
calculation_chain_revision | integer | 是 | 所绑定的计算链修订:即生效的那个修订。 |
calculation_chain_name | string 或 null | 是 | 所绑定计算链在该修订中的显示名称(如已设置)。 |
source | string | 是 | user 表示这是你自己的绑定,platform 表示这是平台默认绑定。可选值:user, platform。 |
calculation_chain_is_official | boolean | 是 | 所绑定的计算链是否为官方计算链。 |
calculation_chain_is_searchable | boolean | 是 | 所绑定的计算链是否已被其所有者共享。 |
calculation_chain_owner_user_id | string 或 null | 是 | 所绑定计算链的所有者 ID;平台计算链为 null。 |
is_deprecated | boolean | 是 | 所绑定的计算链是否已弃用。只有在弃用成为终态之前建立的绑定才可能显示 true;这样的槽位为 available: false。 |
ref_count | integer | 是 | 所绑定的计算链被绑定或被 Fork 的次数。 |
step_count | integer | 是 | 所绑定计算链修订中的步骤数。 |
sequence | integer | 是 | 你的槽位 sequence:作为 expected_sequence 传回。 |
available | boolean | 是 | 该绑定能否应用;见 reason。 |
reason | string 或 null | 是 | 绑定无法应用的原因:deprecated(计算链已弃用)或 missing(计算链已不存在);available 时为 null。可选值:deprecated, missing。 |
WebsiteCalculationChainBindingsOut
某个市场在每种用途下实际生效的计算链。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
deposit | WebsiteCalculationChainBindingSlotOut 或 null | 是 | 用于充值的计算链;未绑定时为 null。 |
sale | WebsiteCalculationChainBindingSlotOut 或 null | 是 | 用于出售的计算链;未绑定时为 null。 |
withdraw | WebsiteCalculationChainBindingSlotOut 或 null | 是 | 用于提现的计算链;未绑定时为 null。 |