@trustbaseai/protocol 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +348 -0
- package/dist/bundle-hash.d.ts +54 -0
- package/dist/bundle-hash.d.ts.map +1 -0
- package/dist/bundle-hash.js +105 -0
- package/dist/bundle-hash.js.map +1 -0
- package/dist/canonical.d.ts +65 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +215 -0
- package/dist/canonical.js.map +1 -0
- package/dist/constants.d.ts +200 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +216 -0
- package/dist/constants.js.map +1 -0
- package/dist/endpoint-protocol.d.ts +143 -0
- package/dist/endpoint-protocol.d.ts.map +1 -0
- package/dist/endpoint-protocol.js +236 -0
- package/dist/endpoint-protocol.js.map +1 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +21 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +121 -0
- package/dist/index.js.map +1 -0
- package/dist/registry.d.ts +116 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +637 -0
- package/dist/registry.js.map +1 -0
- package/dist/sp-framework.d.ts +686 -0
- package/dist/sp-framework.d.ts.map +1 -0
- package/dist/sp-framework.js +187 -0
- package/dist/sp-framework.js.map +1 -0
- package/dist/validation.d.ts +37 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +85 -0
- package/dist/validation.js.map +1 -0
- package/dist/ws-protocol.d.ts +242 -0
- package/dist/ws-protocol.d.ts.map +1 -0
- package/dist/ws-protocol.js +289 -0
- package/dist/ws-protocol.js.map +1 -0
- package/package.json +34 -0
package/dist/registry.js
ADDED
|
@@ -0,0 +1,637 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* 链消息类型注册表 —— 跨侧唯一事实来源。
|
|
4
|
+
*
|
|
5
|
+
* ## 这个文件为什么必须"较真"
|
|
6
|
+
*
|
|
7
|
+
* CosmJS 把 `@type` 字符串(type URL)直接当注册表键查。写错的症状是:
|
|
8
|
+
*
|
|
9
|
+
* ```
|
|
10
|
+
* unable to resolve type URL /trustchain.order.v1.MsgCreateOrder
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* 或者更糟 —— **不报错,但语义错位**(比如把 `MsgConfirmPayment` 的 `authority`
|
|
14
|
+
* 写成签名账户,链上按 `params.payment_authority` 校验后拒绝,
|
|
15
|
+
* 报错信息看起来像"权限不足",实际是字段填错)。这类"静默失败"是本项目真机上
|
|
16
|
+
* 踩过的坑,所以注册表**逐条从 proto 核对**,并标注 `文件:行号`。
|
|
17
|
+
*
|
|
18
|
+
* ## 出处与快照
|
|
19
|
+
*
|
|
20
|
+
* - proto 目录:`trustchain-relmerge/proto/trustchain/<模块>/v1/tx.proto`
|
|
21
|
+
* - 快照:`trustchain-relmerge@40d16543fe604e39009c8dbf72a54bcb81419e52`(2026-09-22)
|
|
22
|
+
* ⚠️ 其中 `proto/trustchain/endpoint/`、`x/endpoint/`、`indexer/src/core/ws-query-provider.ts`
|
|
23
|
+
* 在该提交里**尚未提交**(工作区未跟踪/已修改),出自 2026-09-22 的工作区状态。
|
|
24
|
+
* - **2026-09-23 追加核对**(D2 争议申诉 + D3 保险索赔,均为该日工作区改动,尚未 commit):
|
|
25
|
+
* `order/v1/tx.proto`(CreateOrder/CancelOrder signer → seller;ConfirmOrder/DisputeOrder
|
|
26
|
+
* signer → submitter 且新增字段 `submitter = 5`)、`order/v1/params.proto`(新增
|
|
27
|
+
* `dispute_authority = 6`)、`insurance/v1/tx.proto`(`MsgSubmitClaim.order_id = 6` 必填)、
|
|
28
|
+
* `insurance/v1/query.proto`(`Claim.order_id = 12` / `Claim.beneficiary = 13`)。
|
|
29
|
+
* - 已跑通参考:`trustbase-seller-backend/core/chain-signer.js:22-46`(`CUSTOM_TYPE_URLS`,
|
|
30
|
+
* 真机联调过的 type URL 清单)、`routes/chain-writes*.js`、`routes/onboard.js`
|
|
31
|
+
*
|
|
32
|
+
* ⚠️ `provenBy` 引用的两个外部仓库(seller-backend / indexer)**都有人在改**,
|
|
33
|
+
* 行号会漂移;它们只是"去这里看真机怎么发的"的线索,不是机器校验的引用。
|
|
34
|
+
* proto 的 `source` 行号才是硬引用(有工具校验)。
|
|
35
|
+
*
|
|
36
|
+
* **出处不是手抄的**:`tools/check-proto-citations.cjs` 会拿真实 proto 逐条核对
|
|
37
|
+
* message 名、字段名、字段类型、signer 注解,并做**反向完整性检查**(proto 有而注册表漏 = 失败)。
|
|
38
|
+
* 有链码 checkout 的人跑:
|
|
39
|
+
*
|
|
40
|
+
* ```bash
|
|
41
|
+
* npm run build
|
|
42
|
+
* node tools/check-proto-citations.cjs /path/to/trustchain-relmerge # 校验
|
|
43
|
+
* node tools/check-proto-citations.cjs /path/to/trustchain-relmerge --fix # 顺手收紧行号
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* ## 收录口径
|
|
47
|
+
*
|
|
48
|
+
* 收录**业务方(卖家/买家/服务商)实际要发的消息**,加 gov/authority-only 的划转类。
|
|
49
|
+
* 不收录 `MsgUpdateParams`(纯治理,SDK 用户不会发)。
|
|
50
|
+
*
|
|
51
|
+
* `kind` 与 proto 标量的对应:
|
|
52
|
+
* - `uint64` / `int64` → wire JSON 里是**字符串**(proto3 JSON 规范)
|
|
53
|
+
* - `bytes` → wire JSON 里是 **base64**(不是 hex!本仓库真机踩过:
|
|
54
|
+
* `routes/chain-writes-products.js:205` 把 hex 的 content_hash 转成 base64 再发链)
|
|
55
|
+
* - `enum` → wire JSON 里是枚举**名字符串**(如 `PRODUCT_TYPE_PHYSICAL`)
|
|
56
|
+
*/
|
|
57
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
+
exports.MSG_TYPE_URLS = exports.MSG_TYPES = exports.LICENSE_TYPE = exports.PRODUCT_TYPE = void 0;
|
|
59
|
+
exports.getMsgType = getMsgType;
|
|
60
|
+
exports.isKnownMsgType = isKnownMsgType;
|
|
61
|
+
exports.getMsgTypeByProtoMessage = getMsgTypeByProtoMessage;
|
|
62
|
+
/** 出处:`proto/trustchain/marketplace/v1/product.proto:7-13` */
|
|
63
|
+
exports.PRODUCT_TYPE = {
|
|
64
|
+
PRODUCT_TYPE_UNSPECIFIED: 0,
|
|
65
|
+
PRODUCT_TYPE_PHYSICAL: 1,
|
|
66
|
+
PRODUCT_TYPE_DIGITAL: 2,
|
|
67
|
+
PRODUCT_TYPE_SAAS: 3,
|
|
68
|
+
PRODUCT_TYPE_SERVICE: 4,
|
|
69
|
+
};
|
|
70
|
+
/** 出处:`proto/trustchain/marketplace/v1/product.proto:16-21` */
|
|
71
|
+
exports.LICENSE_TYPE = {
|
|
72
|
+
LICENSE_TYPE_UNSPECIFIED: 0,
|
|
73
|
+
LICENSE_TYPE_PERPETUAL: 1,
|
|
74
|
+
LICENSE_TYPE_SUBSCRIPTION: 2,
|
|
75
|
+
LICENSE_TYPE_TRIAL: 3,
|
|
76
|
+
};
|
|
77
|
+
const ORDER = 'proto/trustchain/order/v1/tx.proto';
|
|
78
|
+
const MARKETPLACE = 'proto/trustchain/marketplace/v1/tx.proto';
|
|
79
|
+
const VERIFICATION = 'proto/trustchain/verification/v1/tx.proto';
|
|
80
|
+
const SERVICEPROVIDER = 'proto/trustchain/serviceprovider/v1/tx.proto';
|
|
81
|
+
const INSURANCE = 'proto/trustchain/insurance/v1/tx.proto';
|
|
82
|
+
const REWARD = 'proto/trustchain/reward/v1/tx.proto';
|
|
83
|
+
const ENDPOINT = 'proto/trustchain/endpoint/v1/tx.proto';
|
|
84
|
+
const SUBCHAIN = 'proto/trustchain/subchain/v1/tx.proto';
|
|
85
|
+
const ECONOMY = 'proto/trustchain/economy/v1/tx.proto';
|
|
86
|
+
exports.MSG_TYPES = [
|
|
87
|
+
// -------------------------------------------------------------------------
|
|
88
|
+
// x/order —— 下单 / 支付 / 履约 / 结算
|
|
89
|
+
// -------------------------------------------------------------------------
|
|
90
|
+
{
|
|
91
|
+
typeUrl: '/trustchain.order.v1.MsgCreateOrder',
|
|
92
|
+
protoMessage: 'trustchain.order.v1.MsgCreateOrder',
|
|
93
|
+
// 2026-09-22 方案 A(xiaomu 拍板,见 prd-docs 入口文档 §8.3.1):signer 由 buyer 改为 seller。
|
|
94
|
+
// 原因:买家不装节点、浏览器侧不持私钥 → 买家无签名能力;订单的收益与信誉一律以
|
|
95
|
+
// MsgConfirmPaymentFact(真实支付事实)为准,卖家自造订单拿不到好处。
|
|
96
|
+
// ⚠️ 这条随 v3.9.4 升级生效;升级前链上仍是 buyer。且必须与卖家后端同批上线
|
|
97
|
+
// (升级后 buyer == seller 会被链上拒,而升级前后端正是这么发的)。
|
|
98
|
+
signer: 'seller',
|
|
99
|
+
summary: '下单(signer=seller,卖家代建单;v9 起支持 payment_method=""/"tct"/"fiat")',
|
|
100
|
+
fields: [
|
|
101
|
+
{ name: 'buyer', kind: 'string', required: true, note: '买家 tct1 地址(**不是签名者**);必须合法 bech32、非空、≠ seller,且已注册 trustcoin 账户(否则退款无处可退)' },
|
|
102
|
+
{ name: 'seller', kind: 'string', required: true, note: '卖家 tct1 地址;**签名者必须是它**;链上要求双方都已注册 trustcoin 账户' },
|
|
103
|
+
{ name: 'sku_id', kind: 'string', required: true },
|
|
104
|
+
{ name: 'quantity', kind: 'uint64', required: true },
|
|
105
|
+
{ name: 'price_per_unit', kind: 'string', required: true, note: 'microTCT 整数串(不是 TCT!)' },
|
|
106
|
+
{ name: 'shipping_address_hash', kind: 'string', required: false, note: '加密后的收货地址哈希' },
|
|
107
|
+
{ name: 'source_chain', kind: 'string', required: false, note: '多链预留;空串 = 当前链' },
|
|
108
|
+
{ name: 'payment_method', kind: 'string', required: false, note: '"" / "tct" / "fiat";空 = tct。fiat 不锁 escrow' },
|
|
109
|
+
{ name: 'referrer', kind: 'string', required: false, note: '引荐入口店地址;空 = 无引荐' },
|
|
110
|
+
],
|
|
111
|
+
// 买家知情证据走 tx memo(不是字段):以 `tb-auth:` 开头时必须跟 64 位小写 hex(sha256);
|
|
112
|
+
// 原文(时间/商品/金额/买家标识)由卖家节点本地保存,争议时出示。
|
|
113
|
+
source: `${ORDER}:45-63`,
|
|
114
|
+
provenBy: 'trustbase-seller-backend/routes/chain-writes.js:416(/orders 路由;行号会漂移)',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
typeUrl: '/trustchain.order.v1.MsgConfirmPayment',
|
|
118
|
+
protoMessage: 'trustchain.order.v1.MsgConfirmPayment',
|
|
119
|
+
signer: 'authority',
|
|
120
|
+
aminoName: 'trustchain/x/order/MsgConfirmPayment',
|
|
121
|
+
summary: '支付事实确认(预言机回调):PENDING → PAID,库存在此步扣减',
|
|
122
|
+
fields: [
|
|
123
|
+
{ name: 'authority', kind: 'string', required: true, note: '= params.payment_authority(Phase A 卖家 / Phase B 平台支付服务);空参回落模块 authority(gov)' },
|
|
124
|
+
{ name: 'order_id', kind: 'uint64', required: true },
|
|
125
|
+
{ name: 'psp_payment_id', kind: 'string', required: true, note: '支付凭证号,幂等键;重复回调直接拒' },
|
|
126
|
+
],
|
|
127
|
+
source: `${ORDER}:145-152`,
|
|
128
|
+
provenBy: 'trustbase-seller-backend/routes/chain-writes.js:500(/payments 回调;行号会漂移)',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
typeUrl: '/trustchain.order.v1.MsgSettleOrder',
|
|
132
|
+
protoMessage: 'trustchain.order.v1.MsgSettleOrder',
|
|
133
|
+
signer: 'caller',
|
|
134
|
+
aminoName: 'trustchain/x/order/MsgSettleOrder',
|
|
135
|
+
summary: '结算 crank(permissionless):确认收货 + 争议窗口过后任何人可触发',
|
|
136
|
+
fields: [
|
|
137
|
+
{ name: 'caller', kind: 'string', required: true, note: '任何人,无权限要求' },
|
|
138
|
+
{ name: 'order_id', kind: 'uint64', required: true },
|
|
139
|
+
],
|
|
140
|
+
source: `${ORDER}:157-163`,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
typeUrl: '/trustchain.order.v1.MsgTransferCredits',
|
|
144
|
+
protoMessage: 'trustchain.order.v1.MsgTransferCredits',
|
|
145
|
+
signer: 'caller',
|
|
146
|
+
aminoName: 'trustchain/x/order/MsgTransferCredits',
|
|
147
|
+
summary: '引荐佣金结算 crank(permissionless):卖家经营科目 → referrer 经营科目',
|
|
148
|
+
fields: [
|
|
149
|
+
{ name: 'caller', kind: 'string', required: true, note: '任何人,无权限' },
|
|
150
|
+
{ name: 'order_id', kind: 'uint64', required: true, note: '同一 order_id 只结一次;卖家经营不足时 skip' },
|
|
151
|
+
],
|
|
152
|
+
source: `${ORDER}:170-176`,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
typeUrl: '/trustchain.order.v1.MsgShipOrder',
|
|
156
|
+
protoMessage: 'trustchain.order.v1.MsgShipOrder',
|
|
157
|
+
signer: 'seller',
|
|
158
|
+
summary: '卖家发货',
|
|
159
|
+
fields: [
|
|
160
|
+
{ name: 'seller', kind: 'string', required: true },
|
|
161
|
+
{ name: 'order_id', kind: 'uint64', required: true },
|
|
162
|
+
{ name: 'tracking_info', kind: 'string', required: true, note: '加密后的物流信息' },
|
|
163
|
+
],
|
|
164
|
+
source: `${ORDER}:69-74`,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
typeUrl: '/trustchain.order.v1.MsgConfirmOrder',
|
|
168
|
+
protoMessage: 'trustchain.order.v1.MsgConfirmOrder',
|
|
169
|
+
// 2026-09-23 D2 —— signer 是 **submitter**。注意三点:
|
|
170
|
+
// 1. `buyer` 字段只是「实际发起方」的记录(keeper 校验它 = 订单买家),**不是签名者**;
|
|
171
|
+
// 2. `signer: 'submitter'` 只说明"签名写在这个字段里",**不代表签名者身份是卖家**;
|
|
172
|
+
// 3. 真正的白名单判定在 keeper:`x/order/keeper/order_submit_auth.go` 的
|
|
173
|
+
// `authorizeOrderSubmit()` —— 三条路径任一命中即放行:
|
|
174
|
+
// a. `seller` — 订单卖家本人代买家确认收货(方案 A 基线路径);
|
|
175
|
+
// b. `dispute_authority` — params.dispute_authority(平台服务商/客服运营),
|
|
176
|
+
// 治理可调、空串 = 关闭该路径
|
|
177
|
+
// (proto/trustchain/order/v1/params.proto:36-39);
|
|
178
|
+
// c. `timeout_fallback` — 订单 SHIPPED 且 now > shipped_at + params.auto_confirm_timeout
|
|
179
|
+
// → **任何账户**都可提交(卖家与平台双双不作为时的硬兜底)。
|
|
180
|
+
// 其余账户一律拒(否则任何账户都能替买家提前放款 + 吃掉争议窗口)。
|
|
181
|
+
// 路径值也会写进事件(`submit_path`,见 order_submit_auth.go:13-19),索引器按它分类。
|
|
182
|
+
// ⚠️ v3.9.4/D2 生效,必须与卖家后端同批上线。
|
|
183
|
+
signer: 'submitter',
|
|
184
|
+
summary: '确认收货 + 评价(签名者 = submitter:订单卖家 / dispute_authority / 超时兜底任意账户)',
|
|
185
|
+
fields: [
|
|
186
|
+
{ name: 'buyer', kind: 'string', required: true, note: '实际买家地址(keeper 校验其合法性),**不是签名者**' },
|
|
187
|
+
{ name: 'order_id', kind: 'uint64', required: true },
|
|
188
|
+
{ name: 'rating', kind: 'uint64', required: true, note: '1-5 星' },
|
|
189
|
+
{ name: 'review', kind: 'string', required: false },
|
|
190
|
+
{ name: 'submitter', kind: 'string', required: true, note: '**签名者**;白名单三条路径见上方注释(判定在 keeper,不在消息本身)' },
|
|
191
|
+
],
|
|
192
|
+
source: `${ORDER}:90-98`,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
typeUrl: '/trustchain.order.v1.MsgCancelOrder',
|
|
196
|
+
protoMessage: 'trustchain.order.v1.MsgCancelOrder',
|
|
197
|
+
// 2026-09-22 方案 A 延伸(v3.9.4 生效)—— signer 由 canceller 改为 **seller**。
|
|
198
|
+
// 与 ConfirmOrder/DisputeOrder 不同:这条**只有一条路径**(订单卖家本人),
|
|
199
|
+
// keeper 新增校验 `seller` 必须 = 订单卖家 —— 否则任何账户都能取消别人的订单。
|
|
200
|
+
// `canceller` 字段降级为「实际发起方」的记录(buyer 或 seller,keeper 校验其合法性)。
|
|
201
|
+
signer: 'seller',
|
|
202
|
+
summary: '取消订单(仅 PENDING;签名者 = 订单卖家;canceller 记实际发起方)',
|
|
203
|
+
fields: [
|
|
204
|
+
{ name: 'canceller', kind: 'string', required: true, note: '实际发起方记录(buyer 或 seller;**不是签名者**)' },
|
|
205
|
+
{ name: 'order_id', kind: 'uint64', required: true },
|
|
206
|
+
{ name: 'seller', kind: 'string', required: true, note: '**签名者**;链上校验必须 = 订单卖家' },
|
|
207
|
+
],
|
|
208
|
+
source: `${ORDER}:125-131`,
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
typeUrl: '/trustchain.order.v1.MsgDisputeOrder',
|
|
212
|
+
protoMessage: 'trustchain.order.v1.MsgDisputeOrder',
|
|
213
|
+
// 2026-09-23 D2 —— signer 是 **submitter**,白名单与 MsgConfirmOrder **完全一致**
|
|
214
|
+
//(见上方 MsgConfirmOrder 的注释:seller / params.dispute_authority / timeout_fallback 三条路径)。
|
|
215
|
+
// `disputer` 字段只是「实际发起方」的记录(buyer 或 seller,keeper 校验),**不是签名者**。
|
|
216
|
+
// D2 口径的意义:买家不持私钥,争议**必须有人能发起** —— 卖家与平台服务商是两条入口,
|
|
217
|
+
// 超时兜底保证"两边都不作为"时订单不会永久卡死(escrow 锁死 + 买家无法申诉)。
|
|
218
|
+
signer: 'submitter',
|
|
219
|
+
summary: '发起争议(签名者 = submitter:订单卖家 / dispute_authority / 超时兜底任意账户)',
|
|
220
|
+
fields: [
|
|
221
|
+
{ name: 'disputer', kind: 'string', required: true, note: '实际发起方记录(buyer 或 seller;**不是签名者**)' },
|
|
222
|
+
{ name: 'order_id', kind: 'uint64', required: true },
|
|
223
|
+
{ name: 'reason', kind: 'string', required: true },
|
|
224
|
+
{ name: 'evidence_hash', kind: 'string', required: false, note: '证据材料哈希(hex)' },
|
|
225
|
+
{ name: 'submitter', kind: 'string', required: true, note: '**签名者**;白名单三条路径同 MsgConfirmOrder(判定在 keeper)' },
|
|
226
|
+
],
|
|
227
|
+
source: `${ORDER}:109-117`,
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
typeUrl: '/trustchain.order.v1.MsgResolveDispute',
|
|
231
|
+
protoMessage: 'trustchain.order.v1.MsgResolveDispute',
|
|
232
|
+
signer: 'resolver',
|
|
233
|
+
summary: '裁决争议(keeper 内另有 authority 校验,实际为治理/仲裁路径)',
|
|
234
|
+
fields: [
|
|
235
|
+
{ name: 'resolver', kind: 'string', required: true },
|
|
236
|
+
{ name: 'order_id', kind: 'uint64', required: true },
|
|
237
|
+
{ name: 'refund_percent', kind: 'uint32', required: true, note: '0-100,退给买家的百分比' },
|
|
238
|
+
{ name: 'resolution_note', kind: 'string', required: false },
|
|
239
|
+
],
|
|
240
|
+
source: `${ORDER}:134-140`,
|
|
241
|
+
},
|
|
242
|
+
// -------------------------------------------------------------------------
|
|
243
|
+
// x/marketplace —— 上架 / 库存 / 下架
|
|
244
|
+
// -------------------------------------------------------------------------
|
|
245
|
+
{
|
|
246
|
+
typeUrl: '/trustchain.marketplace.v1.MsgListSKU',
|
|
247
|
+
protoMessage: 'trustchain.marketplace.v1.MsgListSKU',
|
|
248
|
+
signer: 'seller',
|
|
249
|
+
aminoName: 'trustchain/x/marketplace/MsgListSKU',
|
|
250
|
+
summary: '上架 SKU(同一 ACTIVE sku_id 重复上架会被拒 → 应转 MsgAddStock)',
|
|
251
|
+
fields: [
|
|
252
|
+
{ name: 'seller', kind: 'string', required: true },
|
|
253
|
+
{ name: 'sku_id', kind: 'string', required: true },
|
|
254
|
+
{ name: 'content_hash', kind: 'bytes', required: true, note: 'base64!线协议里常见 hex,发链前必须转 base64(chain-writes-products.js:205)' },
|
|
255
|
+
{ name: 'stock', kind: 'uint64', required: true },
|
|
256
|
+
{ name: 'stake_per_unit', kind: 'string', required: true, note: 'microTCT 串;链上 params.min_stake_per_unit 默认 1000000 (1 TCT),写 0 会被拒' },
|
|
257
|
+
{ name: 'cdn_url', kind: 'string', required: false },
|
|
258
|
+
{ name: 'p2p_endpoint', kind: 'string', required: false, note: '形如 "[2001:db8::1]:9527"(IPv6:端口)' },
|
|
259
|
+
{ name: 'product_type', kind: 'enum', required: false, enumType: 'trustchain.marketplace.v1.ProductType', note: '默认 PRODUCT_TYPE_UNSPECIFIED(0) = 实体物品' },
|
|
260
|
+
{ name: 'download_url', kind: 'string', required: false, note: '数字产品专有' },
|
|
261
|
+
{ name: 'license_type', kind: 'enum', required: false, enumType: 'trustchain.marketplace.v1.LicenseType' },
|
|
262
|
+
{ name: 'version', kind: 'string', required: false, note: '数字产品专有' },
|
|
263
|
+
{ name: 'api_endpoint', kind: 'string', required: false, note: 'SaaS 专有' },
|
|
264
|
+
{ name: 'subscription_duration', kind: 'uint64', required: false, note: 'SaaS 专有(秒)' },
|
|
265
|
+
{ name: 'service_duration', kind: 'uint64', required: false, note: '服务类专有(秒)' },
|
|
266
|
+
{ name: 'service_provider', kind: 'string', required: false, note: '服务类专有' },
|
|
267
|
+
],
|
|
268
|
+
source: `${MARKETPLACE}:34-60`,
|
|
269
|
+
provenBy: 'trustbase-seller-backend/routes/chain-writes-products.js:222-235',
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
typeUrl: '/trustchain.marketplace.v1.MsgAddStock',
|
|
273
|
+
protoMessage: 'trustchain.marketplace.v1.MsgAddStock',
|
|
274
|
+
signer: 'seller',
|
|
275
|
+
aminoName: 'trustchain/x/marketplace/MsgAddStock',
|
|
276
|
+
summary: '补库存(按 slot_index,不是 sku_id)',
|
|
277
|
+
fields: [
|
|
278
|
+
{ name: 'seller', kind: 'string', required: true },
|
|
279
|
+
{ name: 'slot_index', kind: 'uint64', required: true, note: '来自 MsgListSKUResponse.slot_index 或查询接口' },
|
|
280
|
+
{ name: 'quantity', kind: 'uint64', required: true },
|
|
281
|
+
],
|
|
282
|
+
source: `${MARKETPLACE}:89-95`,
|
|
283
|
+
provenBy: 'trustbase-seller-backend/routes/chain-writes-products.js:247-255',
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
typeUrl: '/trustchain.marketplace.v1.MsgReduceStock',
|
|
287
|
+
protoMessage: 'trustchain.marketplace.v1.MsgReduceStock',
|
|
288
|
+
signer: 'seller',
|
|
289
|
+
aminoName: 'trustchain/x/marketplace/MsgReduceStock',
|
|
290
|
+
summary: '减库存',
|
|
291
|
+
fields: [
|
|
292
|
+
{ name: 'seller', kind: 'string', required: true },
|
|
293
|
+
{ name: 'slot_index', kind: 'uint64', required: true },
|
|
294
|
+
{ name: 'quantity', kind: 'uint64', required: true },
|
|
295
|
+
],
|
|
296
|
+
source: `${MARKETPLACE}:98-104`,
|
|
297
|
+
provenBy: 'trustbase-seller-backend/routes/chain-writes-products.js:330-338',
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
typeUrl: '/trustchain.marketplace.v1.MsgUpdateSKU',
|
|
301
|
+
protoMessage: 'trustchain.marketplace.v1.MsgUpdateSKU',
|
|
302
|
+
signer: 'seller',
|
|
303
|
+
aminoName: 'trustchain/x/marketplace/MsgUpdateSKU',
|
|
304
|
+
summary: '改单件质押(只此一个可变字段)',
|
|
305
|
+
fields: [
|
|
306
|
+
{ name: 'seller', kind: 'string', required: true },
|
|
307
|
+
{ name: 'slot_index', kind: 'uint64', required: true },
|
|
308
|
+
{ name: 'stake_per_unit', kind: 'string', required: true, note: 'microTCT 串' },
|
|
309
|
+
],
|
|
310
|
+
source: `${MARKETPLACE}:107-113`,
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
typeUrl: '/trustchain.marketplace.v1.MsgPauseSKU',
|
|
314
|
+
protoMessage: 'trustchain.marketplace.v1.MsgPauseSKU',
|
|
315
|
+
signer: 'seller',
|
|
316
|
+
aminoName: 'trustchain/x/marketplace/MsgPauseSKU',
|
|
317
|
+
summary: '暂停售卖(可恢复)',
|
|
318
|
+
fields: [
|
|
319
|
+
{ name: 'seller', kind: 'string', required: true },
|
|
320
|
+
{ name: 'slot_index', kind: 'uint64', required: true },
|
|
321
|
+
],
|
|
322
|
+
source: `${MARKETPLACE}:65-70`,
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
typeUrl: '/trustchain.marketplace.v1.MsgResumeSKU',
|
|
326
|
+
protoMessage: 'trustchain.marketplace.v1.MsgResumeSKU',
|
|
327
|
+
signer: 'seller',
|
|
328
|
+
aminoName: 'trustchain/x/marketplace/MsgResumeSKU',
|
|
329
|
+
summary: '恢复售卖',
|
|
330
|
+
fields: [
|
|
331
|
+
{ name: 'seller', kind: 'string', required: true },
|
|
332
|
+
{ name: 'slot_index', kind: 'uint64', required: true },
|
|
333
|
+
],
|
|
334
|
+
source: `${MARKETPLACE}:73-78`,
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
typeUrl: '/trustchain.marketplace.v1.MsgDelistSKU',
|
|
338
|
+
protoMessage: 'trustchain.marketplace.v1.MsgDelistSKU',
|
|
339
|
+
signer: 'seller',
|
|
340
|
+
aminoName: 'trustchain/x/marketplace/MsgDelistSKU',
|
|
341
|
+
summary: '下架(终态)',
|
|
342
|
+
fields: [
|
|
343
|
+
{ name: 'seller', kind: 'string', required: true },
|
|
344
|
+
{ name: 'slot_index', kind: 'uint64', required: true },
|
|
345
|
+
],
|
|
346
|
+
source: `${MARKETPLACE}:81-86`,
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
typeUrl: '/trustchain.marketplace.v1.MsgConfiscateStake',
|
|
350
|
+
protoMessage: 'trustchain.marketplace.v1.MsgConfiscateStake',
|
|
351
|
+
signer: 'authority',
|
|
352
|
+
aminoName: 'trustchain/x/marketplace/MsgConfiscateStake',
|
|
353
|
+
summary: 'WASH 判定后全额没收卖家质押(→ x/subchain 池);同时 slot 置 DELISTED',
|
|
354
|
+
fields: [
|
|
355
|
+
{ name: 'authority', kind: 'string', required: true, note: 'gov 或 emergencyAuthority' },
|
|
356
|
+
{ name: 'seller', kind: 'string', required: true },
|
|
357
|
+
{ name: 'sku_id', kind: 'string', required: true },
|
|
358
|
+
{ name: 'reason', kind: 'string', required: true },
|
|
359
|
+
],
|
|
360
|
+
// ⚠️ proto 里有 message,但 `service Msg` 没有对应 rpc(生成的 MsgServer 接口也没有该方法),
|
|
361
|
+
// 而 keeper 已实现 handler(x/marketplace/keeper/confiscate.go:81)—— 即**发不出去**,
|
|
362
|
+
// 只能模块内部调用。详见 packages/protocol/README.md §9 第 4 条。
|
|
363
|
+
source: `${MARKETPLACE}:119-126`,
|
|
364
|
+
},
|
|
365
|
+
// -------------------------------------------------------------------------
|
|
366
|
+
// x/verification —— 实名 / 资质提交与审批
|
|
367
|
+
// -------------------------------------------------------------------------
|
|
368
|
+
{
|
|
369
|
+
typeUrl: '/trustchain.verification.v1.MsgSubmitVerification',
|
|
370
|
+
protoMessage: 'trustchain.verification.v1.MsgSubmitVerification',
|
|
371
|
+
signer: 'owner',
|
|
372
|
+
aminoName: 'trustchain/x/verification/MsgSubmitVerification',
|
|
373
|
+
summary: '提交实名/资质核验申请',
|
|
374
|
+
fields: [
|
|
375
|
+
{ name: 'owner', kind: 'string', required: true, note: '被核验主体地址' },
|
|
376
|
+
{ name: 'entity_type', kind: 'string', required: true, note: '"identity" | "brand" | "device" | "shop" | "product"' },
|
|
377
|
+
{ name: 'entity_id', kind: 'string', required: true, note: '实名场景 = owner 地址本身' },
|
|
378
|
+
{ name: 'credential_hash', kind: 'string', required: true, note: '材料 SHA-256(本仓库实现用 hex)' },
|
|
379
|
+
{ name: 'method', kind: 'string', required: true, note: '"governance" | "kyc" | "oracle" | "manual"' },
|
|
380
|
+
{ name: 'metadata', kind: 'string', required: false, note: 'JSON 字符串' },
|
|
381
|
+
{ name: 'kyc_provider', kind: 'string', required: false, note: 'method="kyc" 时填' },
|
|
382
|
+
],
|
|
383
|
+
source: `${VERIFICATION}:50-73`,
|
|
384
|
+
provenBy: 'trustbase-seller-backend/routes/onboard.js:167-176',
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
typeUrl: '/trustchain.verification.v1.MsgApproveVerification',
|
|
388
|
+
protoMessage: 'trustchain.verification.v1.MsgApproveVerification',
|
|
389
|
+
signer: 'approver',
|
|
390
|
+
aminoName: 'trustchain/x/verification/MsgApproveVerification',
|
|
391
|
+
summary: '审批通过(authority / oracle / kyc 方)',
|
|
392
|
+
fields: [
|
|
393
|
+
{ name: 'approver', kind: 'string', required: true, note: '必须落在允许审批人集合内(params/oracle),否则链上拒' },
|
|
394
|
+
{ name: 'verification_id', kind: 'string', required: true, note: 'keeper 规则:`ENTITY_TYPE_IDENTITY-<address>` 形式(onboard.js:166 生成同款 id)' },
|
|
395
|
+
{ name: 'expires_at', kind: 'int64', required: false, note: '0 = 用默认有效期' },
|
|
396
|
+
],
|
|
397
|
+
source: `${VERIFICATION}:80-89`,
|
|
398
|
+
// 审批方(oracle / 服务商侧)的实现不在 seller-backend 里,故无 provenBy。
|
|
399
|
+
// seller-backend 只发提交(MsgSubmitVerification),对"已通过"只做幂等识别
|
|
400
|
+
// (routes/onboard.js:187 匹配 already approved 视为成功)。
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
typeUrl: '/trustchain.verification.v1.MsgRejectVerification',
|
|
404
|
+
protoMessage: 'trustchain.verification.v1.MsgRejectVerification',
|
|
405
|
+
signer: 'rejector',
|
|
406
|
+
aminoName: 'trustchain/x/verification/MsgRejectVerification',
|
|
407
|
+
summary: '审批驳回',
|
|
408
|
+
fields: [
|
|
409
|
+
{ name: 'rejector', kind: 'string', required: true },
|
|
410
|
+
{ name: 'verification_id', kind: 'string', required: true },
|
|
411
|
+
{ name: 'reason', kind: 'string', required: true },
|
|
412
|
+
],
|
|
413
|
+
source: `${VERIFICATION}:94-101`,
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
typeUrl: '/trustchain.verification.v1.MsgRevokeVerification',
|
|
417
|
+
protoMessage: 'trustchain.verification.v1.MsgRevokeVerification',
|
|
418
|
+
signer: 'revoker',
|
|
419
|
+
aminoName: 'trustchain/x/verification/MsgRevokeVerification',
|
|
420
|
+
summary: '撤销已通过的核验',
|
|
421
|
+
fields: [
|
|
422
|
+
{ name: 'revoker', kind: 'string', required: true },
|
|
423
|
+
{ name: 'verification_id', kind: 'string', required: true },
|
|
424
|
+
{ name: 'reason', kind: 'string', required: true },
|
|
425
|
+
],
|
|
426
|
+
source: `${VERIFICATION}:106-113`,
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
typeUrl: '/trustchain.verification.v1.MsgVerifyByGovernance',
|
|
430
|
+
protoMessage: 'trustchain.verification.v1.MsgVerifyByGovernance',
|
|
431
|
+
signer: 'authority',
|
|
432
|
+
aminoName: 'trustchain/x/verification/MsgVerifyByGovernance',
|
|
433
|
+
summary: '治理提案方式通过核验(authority only)',
|
|
434
|
+
fields: [
|
|
435
|
+
{ name: 'authority', kind: 'string', required: true },
|
|
436
|
+
{ name: 'verification_id', kind: 'string', required: true },
|
|
437
|
+
],
|
|
438
|
+
source: `${VERIFICATION}:118-124`,
|
|
439
|
+
},
|
|
440
|
+
// -------------------------------------------------------------------------
|
|
441
|
+
// x/serviceprovider —— 服务商注册 / 支付事实 / 贡献奖励
|
|
442
|
+
// -------------------------------------------------------------------------
|
|
443
|
+
{
|
|
444
|
+
typeUrl: '/trustchain.serviceprovider.v1.MsgRegisterServiceProvider',
|
|
445
|
+
protoMessage: 'trustchain.serviceprovider.v1.MsgRegisterServiceProvider',
|
|
446
|
+
signer: 'provider',
|
|
447
|
+
summary: '服务商注册(含质押;微信服务商商户号唯一)',
|
|
448
|
+
fields: [
|
|
449
|
+
{ name: 'provider', kind: 'string', required: true, note: '服务商链上地址;签名者必须等于它' },
|
|
450
|
+
{ name: 'name', kind: 'string', required: true },
|
|
451
|
+
{ name: 'wechat_mchid', kind: 'string', required: true, note: '微信服务商商户号,链上唯一' },
|
|
452
|
+
{ name: 'stake', kind: 'string', required: true, note: '质押 utct 串,必须 > 0' },
|
|
453
|
+
],
|
|
454
|
+
source: `${SERVICEPROVIDER}:34-40`,
|
|
455
|
+
provenBy: 'trustbase-seller-backend/routes/agent-serviceprovider.js:107-112',
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
typeUrl: '/trustchain.serviceprovider.v1.MsgSubmitPaymentFact',
|
|
459
|
+
protoMessage: 'trustchain.serviceprovider.v1.MsgSubmitPaymentFact',
|
|
460
|
+
signer: 'provider',
|
|
461
|
+
summary: '提交支付事实(仅已注册 ACTIVE 服务商)',
|
|
462
|
+
fields: [
|
|
463
|
+
{ name: 'provider', kind: 'string', required: true },
|
|
464
|
+
{ name: 'order_ref', kind: 'string', required: true },
|
|
465
|
+
{ name: 'psp_txn_id', kind: 'string', required: true, note: '微信支付交易号' },
|
|
466
|
+
{ name: 'amount', kind: 'string', required: true, note: 'utct 串' },
|
|
467
|
+
{ name: 'evidence_hash', kind: 'string', required: true, note: '回调数据 sha256(本仓库实现用 hex lowercase)' },
|
|
468
|
+
],
|
|
469
|
+
source: `${SERVICEPROVIDER}:47-54`,
|
|
470
|
+
provenBy: 'trustbase-seller-backend/routes/agent-serviceprovider.js:162-168',
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
typeUrl: '/trustchain.serviceprovider.v1.MsgConfirmPaymentFact',
|
|
474
|
+
protoMessage: 'trustchain.serviceprovider.v1.MsgConfirmPaymentFact',
|
|
475
|
+
signer: 'authority',
|
|
476
|
+
summary: 'C5 确认支付事实(authority 或 params.confirmers 白名单)→ 贡献分 +1',
|
|
477
|
+
fields: [
|
|
478
|
+
{ name: 'authority', kind: 'string', required: true, note: '= 模块 authority 或确认人白名单成员' },
|
|
479
|
+
{ name: 'provider', kind: 'string', required: true },
|
|
480
|
+
{ name: 'order_ref', kind: 'string', required: true },
|
|
481
|
+
],
|
|
482
|
+
source: `${SERVICEPROVIDER}:96-101`,
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
typeUrl: '/trustchain.serviceprovider.v1.MsgClaimProviderReward',
|
|
486
|
+
protoMessage: 'trustchain.serviceprovider.v1.MsgClaimProviderReward',
|
|
487
|
+
signer: 'provider',
|
|
488
|
+
summary: '服务商领取累计贡献奖励',
|
|
489
|
+
fields: [{ name: 'provider', kind: 'string', required: true }],
|
|
490
|
+
source: `${SERVICEPROVIDER}:86-89`,
|
|
491
|
+
},
|
|
492
|
+
// -------------------------------------------------------------------------
|
|
493
|
+
// x/insurance —— 理赔申请(D3 修复:索赔绑定订单 + 赔付对象固定)
|
|
494
|
+
//
|
|
495
|
+
// ⚠️ 覆盖范围:本注册表**只收录 x/insurance 的 MsgSubmitClaim**(D3 修复点)。
|
|
496
|
+
// 同模块其余 9 条消息(MsgRequestInsurance / MsgConfirmInsurance /
|
|
497
|
+
// MsgCancelInsuranceApplication / MsgResolveClaim / MsgDepositInsuranceStake /
|
|
498
|
+
// MsgWithdrawInsuranceStake / MsgDeclareSKU / MsgRevokeInsurance /
|
|
499
|
+
// MsgUpdateParams)尚未收录 —— 需要时再补,别当它们"不存在"。
|
|
500
|
+
// -------------------------------------------------------------------------
|
|
501
|
+
{
|
|
502
|
+
typeUrl: '/trustchain.insurance.v1.MsgSubmitClaim',
|
|
503
|
+
protoMessage: 'trustchain.insurance.v1.MsgSubmitClaim',
|
|
504
|
+
signer: 'claimant',
|
|
505
|
+
aminoName: 'trustchain/x/insurance/MsgSubmitClaim',
|
|
506
|
+
// 2026-09-23 D3 修复 —— `order_id` 由"没有"变成**必填**(必须 > 0)。链上用它做三件事:
|
|
507
|
+
// ① 证明索赔人是本单利益相关方(订单买家 **或** 保单投保人);
|
|
508
|
+
// ② 证明本单确实在保(order.is_insured + 卖家/SKU 与保单一致);
|
|
509
|
+
// ③ 固定**赔付对象** = 订单买家(`Claim.beneficiary`,insurance/v1/query.proto:34),
|
|
510
|
+
// 而不是"谁提交就打给谁"。
|
|
511
|
+
// ⚠️ 老客户端(不带 order_id)现在必被链上拒 —— 这是**破坏性**行为变更,不是兼容新增。
|
|
512
|
+
// ⚠️ Claim 是**查询侧状态类型**(在 insurance/v1/query.proto 里,不在 tx.proto),
|
|
513
|
+
// 本注册表只收 Msg* 交易消息,故未登记 Claim 本身 —— 见 README §9。
|
|
514
|
+
summary: '理赔申请(签名者 = claimant;D3 起必须绑定 order_id)',
|
|
515
|
+
fields: [
|
|
516
|
+
{ name: 'claimant', kind: 'string', required: true, note: '**签名者**;必须与本单利益相关(订单买家或保单投保人)' },
|
|
517
|
+
{ name: 'application_id', kind: 'string', required: true, note: '保单申请 id' },
|
|
518
|
+
{ name: 'claim_reason', kind: 'string', required: true, note: '理赔原因' },
|
|
519
|
+
{ name: 'evidence_hash', kind: 'string', required: true, note: '证据文件哈希' },
|
|
520
|
+
{ name: 'claim_amount', kind: 'string', required: true, note: '理赔金额(microTCT 纯数字串)' },
|
|
521
|
+
{ name: 'order_id', kind: 'uint64', required: true, note: '**D3 新增必填**(> 0);绑定订单,并决定赔付对象 = 订单买家' },
|
|
522
|
+
],
|
|
523
|
+
source: `${INSURANCE}:77-90`,
|
|
524
|
+
},
|
|
525
|
+
// -------------------------------------------------------------------------
|
|
526
|
+
// x/reward —— 奖励池划转
|
|
527
|
+
// -------------------------------------------------------------------------
|
|
528
|
+
{
|
|
529
|
+
typeUrl: '/trustchain.reward.v1.MsgRewardPoolTransfer',
|
|
530
|
+
protoMessage: 'trustchain.reward.v1.MsgRewardPoolTransfer',
|
|
531
|
+
signer: 'authority',
|
|
532
|
+
aminoName: 'trustchain/x/reward/MsgRewardPoolTransfer',
|
|
533
|
+
summary: '奖励池定向划转(authority/emergency 双轨;池间调拨,如奖励池 → 引导金池)',
|
|
534
|
+
fields: [
|
|
535
|
+
{ name: 'authority', kind: 'string', required: true, note: 'gov 模块地址或应急密钥' },
|
|
536
|
+
{ name: 'recipient', kind: 'string', required: true, note: '普通账户或目标模块账户' },
|
|
537
|
+
{ name: 'amount', kind: 'string', required: true, note: 'utct 串' },
|
|
538
|
+
],
|
|
539
|
+
source: `${REWARD}:24-36`,
|
|
540
|
+
},
|
|
541
|
+
// -------------------------------------------------------------------------
|
|
542
|
+
// x/endpoint —— 端点指针轮换 + 见证投票(P2P 端点发现的地基)
|
|
543
|
+
// -------------------------------------------------------------------------
|
|
544
|
+
{
|
|
545
|
+
typeUrl: '/trustchain.endpoint.v1.MsgUpdateEndpointPointer',
|
|
546
|
+
protoMessage: 'trustchain.endpoint.v1.MsgUpdateEndpointPointer',
|
|
547
|
+
signer: 'seller',
|
|
548
|
+
aminoName: 'trustchain/x/endpoint/MsgUpdateEndpointPointer',
|
|
549
|
+
summary: '卖家轮换端点指针(端点内容不上链,只上 bundle_hash);副作用:旧见证全部标记过期',
|
|
550
|
+
fields: [
|
|
551
|
+
{ name: 'seller', kind: 'string', required: true, note: '必须等于签名者' },
|
|
552
|
+
{ name: 'pointer_version', kind: 'uint64', required: true, note: '**严格递增**;回退/重放被拒' },
|
|
553
|
+
{ name: 'bundle_hash', kind: 'bytes', required: true, note: '32 字节 sha256;hex 先转字节再编码(base64 是 wire 形态)' },
|
|
554
|
+
{ name: 'ttl_blocks', kind: 'uint64', required: true, note: '∈ (0, params.max_pointer_ttl_blocks],默认上限 8640 ≈ 12h @5s' },
|
|
555
|
+
{ name: 'region_hint', kind: 'string', required: false, note: '粗粒度地域(如 "cn-js"),默认 ≤16 字节' },
|
|
556
|
+
],
|
|
557
|
+
source: `${ENDPOINT}:27-45`,
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
typeUrl: '/trustchain.endpoint.v1.MsgAttestEndpoint',
|
|
561
|
+
protoMessage: 'trustchain.endpoint.v1.MsgAttestEndpoint',
|
|
562
|
+
signer: 'witness',
|
|
563
|
+
aminoName: 'trustchain/x/endpoint/MsgAttestEndpoint',
|
|
564
|
+
summary: '任一账户对当前端点包投见证票(第三方背书,与卖家自述分开计权)',
|
|
565
|
+
fields: [
|
|
566
|
+
{ name: 'witness', kind: 'string', required: true, note: '**不允许等于 seller**(自投票被拒:ErrSelfAttestation)' },
|
|
567
|
+
{ name: 'seller', kind: 'string', required: true },
|
|
568
|
+
{ name: 'bundle_hash', kind: 'bytes', required: true, note: '32 字节;**必须等于当前指针的哈希**,给旧/伪造包背书一律拒' },
|
|
569
|
+
{ name: 'ok', kind: 'bool', required: true, note: 'false = 负票(判 UNUSABLE 的唯一依据)' },
|
|
570
|
+
{ name: 'latency_ms', kind: 'uint64', required: true, note: `≤ ${3_600_000}(MaxLatencyMs,编译期常量,x/endpoint/types/keys.go:44)` },
|
|
571
|
+
],
|
|
572
|
+
source: `${ENDPOINT}:59-77`,
|
|
573
|
+
},
|
|
574
|
+
// -------------------------------------------------------------------------
|
|
575
|
+
// x/subchain —— 引导金(入驻流程依赖)
|
|
576
|
+
// -------------------------------------------------------------------------
|
|
577
|
+
{
|
|
578
|
+
typeUrl: '/trustchain.subchain.v1.MsgFundBootstrap',
|
|
579
|
+
protoMessage: 'trustchain.subchain.v1.MsgFundBootstrap',
|
|
580
|
+
signer: 'authority',
|
|
581
|
+
aminoName: 'trustchain/subchain/MsgFundBootstrap',
|
|
582
|
+
summary: '引导金池注资(authority → subchain 模块账户)',
|
|
583
|
+
fields: [
|
|
584
|
+
{ name: 'authority', kind: 'string', required: true },
|
|
585
|
+
{ name: 'amount', kind: 'string', required: true, note: 'utct 串' },
|
|
586
|
+
],
|
|
587
|
+
source: `${SUBCHAIN}:135-141`,
|
|
588
|
+
provenBy: 'trustbase-seller-backend/core/chain-signer.js:43(CUSTOM_TYPE_URLS)',
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
typeUrl: '/trustchain.subchain.v1.MsgDisburseBootstrap',
|
|
592
|
+
protoMessage: 'trustchain.subchain.v1.MsgDisburseBootstrap',
|
|
593
|
+
signer: 'authority',
|
|
594
|
+
aminoName: 'trustchain/subchain/MsgDisburseBootstrap',
|
|
595
|
+
summary: '引导金发放(subchain 模块账户 → 卖家);按 credential_hash 幂等',
|
|
596
|
+
fields: [
|
|
597
|
+
{ name: 'authority', kind: 'string', required: true },
|
|
598
|
+
{ name: 'recipient', kind: 'string', required: true, note: '卖家地址' },
|
|
599
|
+
{ name: 'credential_hash', kind: 'string', required: true, note: 'sha256(merchant_id);一商户一次(防女巫)' },
|
|
600
|
+
],
|
|
601
|
+
source: `${SUBCHAIN}:147-154`,
|
|
602
|
+
provenBy: 'trustbase-seller-backend/core/chain-signer.js:42(CUSTOM_TYPE_URLS)',
|
|
603
|
+
},
|
|
604
|
+
// -------------------------------------------------------------------------
|
|
605
|
+
// x/economy —— 积分(非链上币)
|
|
606
|
+
// -------------------------------------------------------------------------
|
|
607
|
+
{
|
|
608
|
+
typeUrl: '/trustchain.economy.v1.MsgGrantCredits',
|
|
609
|
+
protoMessage: 'trustchain.economy.v1.MsgGrantCredits',
|
|
610
|
+
signer: 'issuer',
|
|
611
|
+
summary: '发放积分(issuer 必须 = economy authority)',
|
|
612
|
+
fields: [
|
|
613
|
+
{ name: 'issuer', kind: 'string', required: true, note: '必须等于 economy authority' },
|
|
614
|
+
{ name: 'recipient', kind: 'string', required: true },
|
|
615
|
+
{ name: 'amount', kind: 'string', required: true, note: '积分数(整数串,如 "20")' },
|
|
616
|
+
{ name: 'reason_kind', kind: 'string', required: true, note: '∈ {bind, first_order, ten_orders, confirm, referral}' },
|
|
617
|
+
{ name: 'ref_id', kind: 'string', required: true, note: '幂等引用(order id / binding id)' },
|
|
618
|
+
],
|
|
619
|
+
source: `${ECONOMY}:47-64`,
|
|
620
|
+
provenBy: 'trustbase-seller-backend/core/chain-signer.js:46(CUSTOM_TYPE_URLS 末条)',
|
|
621
|
+
},
|
|
622
|
+
];
|
|
623
|
+
/** 全部 type URL(保持注册顺序) */
|
|
624
|
+
exports.MSG_TYPE_URLS = exports.MSG_TYPES.map((spec) => spec.typeUrl);
|
|
625
|
+
const BY_TYPE_URL = new Map(exports.MSG_TYPES.map((spec) => [spec.typeUrl, spec]));
|
|
626
|
+
/** 按 type URL 取注册项;未注册返回 undefined(调用方应把它翻成"模块未上线/拼错"提示) */
|
|
627
|
+
function getMsgType(typeUrl) {
|
|
628
|
+
return BY_TYPE_URL.get(typeUrl);
|
|
629
|
+
}
|
|
630
|
+
function isKnownMsgType(typeUrl) {
|
|
631
|
+
return typeof typeUrl === 'string' && BY_TYPE_URL.has(typeUrl);
|
|
632
|
+
}
|
|
633
|
+
/** 按 proto message 全名反查(`trustchain.order.v1.MsgCreateOrder`) */
|
|
634
|
+
function getMsgTypeByProtoMessage(protoMessage) {
|
|
635
|
+
return exports.MSG_TYPES.find((spec) => spec.protoMessage === protoMessage);
|
|
636
|
+
}
|
|
637
|
+
//# sourceMappingURL=registry.js.map
|