@ixo/action-protocol 0.9.0 → 0.9.2
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/CHANGELOG.md +29 -0
- package/README.md +13 -0
- package/package.json +1 -1
- package/src/index.d.ts +16 -1
- package/src/index.js +43 -5
- package/src/operation-schema.js +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.2
|
|
4
|
+
|
|
5
|
+
- Add an owner-only `surveyReview` to the browser review view for mainnet Youth Voice collection 13530.
|
|
6
|
+
- Keep claim operations, their payloads, capability levels, and runtime receipts unchanged.
|
|
7
|
+
- A private review contains only questions, answers, and response states. An unavailable review cannot permit approval.
|
|
8
|
+
- Existing runtimes keep their current operation contract. Deploy the new browser parser with the Hub view extension.
|
|
9
|
+
|
|
10
|
+
## 0.9.1
|
|
11
|
+
|
|
12
|
+
A patch release: two inputs are widened, nothing is narrowed, and the wire
|
|
13
|
+
level stays 7 (no new type, field or code).
|
|
14
|
+
|
|
15
|
+
- **Recipients may be contracts.** `cosmos.bank.send` `toAddress` and
|
|
16
|
+
`ixo.token.transfer` `recipient` (top level and inside a group proposal's
|
|
17
|
+
`actions`) accept a 32-byte `ixo1…` contract address (58 characters after
|
|
18
|
+
`ixo1`, e.g. a group's treasury) as well as a 20-byte account address
|
|
19
|
+
(`chainTxIssue`, `parseChainTxOperation`, the JSON schema). Signer and
|
|
20
|
+
identity fields (`signer`, `adminAddress`, `agentAddress`,
|
|
21
|
+
`granteeAddress`, DIDs) still take 20-byte accounts only. The Hub checks
|
|
22
|
+
the checksum. A Hub on 0.9.0 refuses such an address with the field
|
|
23
|
+
reason (`invalid_message: messages[i].toAddress`); a runtime should send
|
|
24
|
+
one only once it knows the Hub is on 0.9.1.
|
|
25
|
+
- **A vote's review step may list the proposal's actions** (`actions`,
|
|
26
|
+
optional on `daodao.proposal.vote`; the carry-out rules: at most 10, each
|
|
27
|
+
of a level-6 type or `type: null` for one the page cannot explain, the
|
|
28
|
+
step's `riskLevel` at least each action's). Display only: only the Hub's
|
|
29
|
+
own review page parses the view, and a vote step without `actions` (a
|
|
30
|
+
0.9.0 Hub) still parses.
|
|
31
|
+
|
|
3
32
|
## 0.9.0
|
|
4
33
|
|
|
5
34
|
Four `ixo.chain.tx.v1` message types for groups (DAO DAO v2.0.3 groups with
|
package/README.md
CHANGED
|
@@ -39,6 +39,19 @@ Callers declare the envelope version they parse with `?version=2` on
|
|
|
39
39
|
|
|
40
40
|
## Applications and claims (`ixo.bid.submit.v1`, `ixo.claim.submit.v1`, 0.7.0)
|
|
41
41
|
|
|
42
|
+
### Private Youth Voice review (0.9.2)
|
|
43
|
+
|
|
44
|
+
The owner's authenticated browser view may include `surveyReview: {status, rows}` for mainnet collection 13530.
|
|
45
|
+
Each row contains `question`, `answer`, and the recorded response `status`.
|
|
46
|
+
The Hub reads the private VFS capture as the owner and verifies the oracle signature, current issuer key, capture commitment, and source hashes.
|
|
47
|
+
An unavailable review has no rows and cannot permit approval. The Hub repeats the verification before admission.
|
|
48
|
+
The browser shows this review instead of the attestation summary, including after submission. It never falls back to technical fields.
|
|
49
|
+
The operation, its summary/data equality rule, wire level, submitted claim, and runtime receipts remain unchanged.
|
|
50
|
+
The private review carries no salt, capability, or storage locator. It is not a second claim payload.
|
|
51
|
+
Deploy the browser parser with this view extension; existing runtime polling responses do not receive the new field.
|
|
52
|
+
|
|
53
|
+
### Submission fields
|
|
54
|
+
|
|
42
55
|
- `summary`: one row per answer of `data`, `{field, label, value}`. `field`
|
|
43
56
|
is the answer's path (object keys and array indices joined with `.`, e.g.
|
|
44
57
|
`shops.1.name`); `value` is exactly `submissionDisplayValue(answer)`: a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ixo/action-protocol",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Shared wire contract between IXO Auth Hub, oracle runtimes and channel gateways for reviewed action cards (operations, capabilities, outcomes, receipts).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
package/src/index.d.ts
CHANGED
|
@@ -248,7 +248,15 @@ export type ActionReviewView = {
|
|
|
248
248
|
* with `operation.collectionId`.
|
|
249
249
|
*/
|
|
250
250
|
collectionName?: string | null;
|
|
251
|
+
/** Private, owner-authenticated review only. Never part of the submitted claim. */
|
|
252
|
+
surveyReview?: SurveyReview | null;
|
|
251
253
|
};
|
|
254
|
+
export type SurveyReview = {
|
|
255
|
+
status: 'ready' | 'unavailable';
|
|
256
|
+
rows: { question: string; answer: string; status: string }[];
|
|
257
|
+
};
|
|
258
|
+
/** The reserved mainnet Youth Voice collection, including malformed claims that must fail closed. */
|
|
259
|
+
export function isYouthSurveyClaim(operation: ActionOperationV1): boolean;
|
|
252
260
|
export type TransferDisplay = {
|
|
253
261
|
denom: string;
|
|
254
262
|
symbol: string;
|
|
@@ -473,6 +481,10 @@ export type ChainTxIidRemoveId = string;
|
|
|
473
481
|
export type ChainTxLevel6Message =
|
|
474
482
|
| {
|
|
475
483
|
type: "cosmos.bank.send";
|
|
484
|
+
/**
|
|
485
|
+
* A 20-byte `ixo1…` account or (0.9.1) a 32-byte `ixo1…` contract
|
|
486
|
+
* address, e.g. a group's treasury; the Hub checks the checksum.
|
|
487
|
+
*/
|
|
476
488
|
toAddress: string;
|
|
477
489
|
/** ^[1-9][0-9]*$ */
|
|
478
490
|
amountBaseUnits: string;
|
|
@@ -520,6 +532,7 @@ export type ChainTxLevel6Message =
|
|
|
520
532
|
}
|
|
521
533
|
| {
|
|
522
534
|
type: "ixo.token.transfer";
|
|
535
|
+
/** A 20-byte account or (0.9.1) a 32-byte contract address, as `toAddress`. */
|
|
523
536
|
recipient: string;
|
|
524
537
|
/** 1..32 lines; id 1..128 of ^[A-Za-z0-9:._/-]+$, amount ^[1-9][0-9]*$ */
|
|
525
538
|
tokens: Array<{ id: string; amount: string }>;
|
|
@@ -925,7 +938,9 @@ export type ChainTxStep = {
|
|
|
925
938
|
/**
|
|
926
939
|
* 0.9.0 D13: required on `daodao.proposal.create` (its 0..4 actions, in
|
|
927
940
|
* order) and `daodao.proposal.execute` (the passed proposal's actions, at
|
|
928
|
-
* most 10 shown); `[]` for none.
|
|
941
|
+
* most 10 shown); `[]` for none. 0.9.1: optional on
|
|
942
|
+
* `daodao.proposal.vote` (the proposal's stored actions, as on carry-out),
|
|
943
|
+
* so voters see what it would do. Absent on every other step. The step's
|
|
929
944
|
* `riskLevel` is at least each action's.
|
|
930
945
|
*/
|
|
931
946
|
actions?: ChainTxGroupActionDisplay[];
|
package/src/index.js
CHANGED
|
@@ -462,6 +462,11 @@ export function parseReceipt(input) {
|
|
|
462
462
|
return fail("receipt.kind");
|
|
463
463
|
}
|
|
464
464
|
|
|
465
|
+
export function isYouthSurveyClaim(operation) {
|
|
466
|
+
return operation?.kind === 'ixo.claim.submit.v1' &&
|
|
467
|
+
operation.network === 'ixo mainnet' && operation.collectionId === '13530';
|
|
468
|
+
}
|
|
469
|
+
|
|
465
470
|
export function parseReviewView(input) {
|
|
466
471
|
const view = object(input, "view");
|
|
467
472
|
exact(
|
|
@@ -486,11 +491,31 @@ export function parseReviewView(input) {
|
|
|
486
491
|
"chainTx",
|
|
487
492
|
"networkFee",
|
|
488
493
|
"collectionName",
|
|
494
|
+
"surveyReview",
|
|
489
495
|
],
|
|
490
496
|
"view",
|
|
491
497
|
);
|
|
492
498
|
parseReference(view.reference);
|
|
493
499
|
parseOperation(view.operation);
|
|
500
|
+
if (view.surveyReview !== undefined && view.surveyReview !== null) {
|
|
501
|
+
if (!isYouthSurveyClaim(view.operation)) fail('view.surveyReview');
|
|
502
|
+
const review = object(view.surveyReview, 'view.surveyReview');
|
|
503
|
+
exact(review, ['status', 'rows'], 'view.surveyReview');
|
|
504
|
+
if (!['ready', 'unavailable'].includes(review.status) ||
|
|
505
|
+
!Array.isArray(review.rows) || review.rows.length > 100 ||
|
|
506
|
+
(review.status === 'ready' ? review.rows.length === 0 : review.rows.length !== 0))
|
|
507
|
+
fail('view.surveyReview');
|
|
508
|
+
for (const row of review.rows) {
|
|
509
|
+
object(row, 'view.surveyReview.row');
|
|
510
|
+
exact(row, ['question', 'answer', 'status'], 'view.surveyReview.row');
|
|
511
|
+
str(row.question, 'view.surveyReview.question', 1, 25000);
|
|
512
|
+
str(row.answer, 'view.surveyReview.answer', 0, 12000);
|
|
513
|
+
if (!['answered', 'explicitly_skipped', 'declined', 'dont_know', 'ambiguous',
|
|
514
|
+
'contradictory', 'interrupted', 'unintelligible', 'redacted'].includes(row.status))
|
|
515
|
+
fail('view.surveyReview.status');
|
|
516
|
+
}
|
|
517
|
+
if (review.status !== 'ready' && view.canApprove) fail('view.surveyReview.canApprove');
|
|
518
|
+
}
|
|
494
519
|
// 0.6.0: the Hub-computed chain transaction display (chain tx cards only).
|
|
495
520
|
if (view.chainTx !== undefined && view.chainTx !== null) {
|
|
496
521
|
if (view.operation?.kind !== CHAIN_TX_KIND) fail("view.chainTx");
|
|
@@ -2020,6 +2045,12 @@ const ANY_DID = new RegExp(`^did:[a-z0-9]+:${DID_TAIL}$`);
|
|
|
2020
2045
|
// The Hub's isIxoAddress: canonical lowercase bech32 with exactly 20 data
|
|
2021
2046
|
// bytes (32 payload + 6 checksum characters). The Hub also checks the checksum.
|
|
2022
2047
|
const ACCOUNT_ADDRESS = /^ixo1[023456789acdefghjklmnpqrstuvwxyz]{38}$/;
|
|
2048
|
+
// 0.9.1: who receives coins or impact tokens (`cosmos.bank.send` toAddress,
|
|
2049
|
+
// `ixo.token.transfer` recipient, also inside a group's actions): a 20-byte
|
|
2050
|
+
// account or a 32-byte contract address (a group's treasury, an app). Never
|
|
2051
|
+
// a signer or identity field. The Hub also checks the checksum.
|
|
2052
|
+
const RECIPIENT_ADDRESS =
|
|
2053
|
+
/^ixo1(?:[023456789acdefghjklmnpqrstuvwxyz]{38}|[023456789acdefghjklmnpqrstuvwxyz]{58})$/;
|
|
2023
2054
|
const BASE_UNITS = /^[1-9][0-9]{0,77}$/;
|
|
2024
2055
|
// A uint64 without leading zeros (checked against UINT64_MAX below).
|
|
2025
2056
|
const COLLECTION_ID = /^(0|[1-9][0-9]{0,19})$/;
|
|
@@ -2731,7 +2762,7 @@ function chainTxMessageField(m) {
|
|
|
2731
2762
|
if (Object.hasOwn(CHAIN_TX_GROUP_FIELDS, m.type))
|
|
2732
2763
|
return CHAIN_TX_GROUP_FIELDS[m.type](m);
|
|
2733
2764
|
if (m.type === "cosmos.bank.send") {
|
|
2734
|
-
if (!isMatch(m.toAddress,
|
|
2765
|
+
if (!isMatch(m.toAddress, RECIPIENT_ADDRESS, 62)) return "toAddress";
|
|
2735
2766
|
if (!isMatch(m.amountBaseUnits, BASE_UNITS, 78)) return "amountBaseUnits";
|
|
2736
2767
|
if (m.denom !== undefined && !isMatch(m.denom, DENOM, 128)) return "denom";
|
|
2737
2768
|
return null;
|
|
@@ -2764,7 +2795,7 @@ function chainTxMessageField(m) {
|
|
|
2764
2795
|
return null;
|
|
2765
2796
|
}
|
|
2766
2797
|
// ixo.token.transfer
|
|
2767
|
-
if (!isMatch(m.recipient,
|
|
2798
|
+
if (!isMatch(m.recipient, RECIPIENT_ADDRESS, 62)) return "recipient";
|
|
2768
2799
|
return tokenLinesField(m.tokens);
|
|
2769
2800
|
}
|
|
2770
2801
|
|
|
@@ -2957,12 +2988,19 @@ function parseChainTxFact(fact) {
|
|
|
2957
2988
|
* 0.9.0 D13: what the group's own account would do, on create (its 0..4
|
|
2958
2989
|
* actions, in order) and carry-out (the passed proposal's stored actions,
|
|
2959
2990
|
* at most 10 shown; `type: null` for one the page cannot explain). Required
|
|
2960
|
-
* on those two step types (`[]` for none)
|
|
2961
|
-
*
|
|
2991
|
+
* on those two step types (`[]` for none). 0.9.1: optional on a vote (the
|
|
2992
|
+
* proposal's stored actions, as on carry-out), so voters see what it would
|
|
2993
|
+
* do; refused on every other step. The step's risk is at least each
|
|
2994
|
+
* action's.
|
|
2962
2995
|
*/
|
|
2963
2996
|
function parseGroupActionsDisplay(step, stepRisk) {
|
|
2964
2997
|
const create = step.type === "daodao.proposal.create";
|
|
2965
|
-
if (
|
|
2998
|
+
if (step.type === "daodao.proposal.vote" && step.actions === undefined) return;
|
|
2999
|
+
if (
|
|
3000
|
+
!create &&
|
|
3001
|
+
step.type !== "daodao.proposal.execute" &&
|
|
3002
|
+
step.type !== "daodao.proposal.vote"
|
|
3003
|
+
) {
|
|
2966
3004
|
if (step.actions !== undefined) fail("view.chainTx.step.actions");
|
|
2967
3005
|
return;
|
|
2968
3006
|
}
|
package/src/operation-schema.js
CHANGED
|
@@ -87,6 +87,12 @@ const anyDid = { ...string(7, 200), pattern: `^did:[a-z0-9]+:${didTail}$` };
|
|
|
87
87
|
const collectionId = { ...string(1, 20), pattern: "^(0|[1-9][0-9]{0,19})$" };
|
|
88
88
|
// A 20-byte ixo account address (the Hub also checks the bech32 checksum).
|
|
89
89
|
const account = { ...string(42, 42), pattern: "^ixo1[023456789acdefghjklmnpqrstuvwxyz]{38}$" };
|
|
90
|
+
// 0.9.1: who receives coins or impact tokens: a 20-byte account or a 32-byte
|
|
91
|
+
// contract address (a group's treasury, an app); never a signer or identity.
|
|
92
|
+
const recipient = {
|
|
93
|
+
...string(42, 62),
|
|
94
|
+
pattern: "^ixo1(?:[023456789acdefghjklmnpqrstuvwxyz]{38}|[023456789acdefghjklmnpqrstuvwxyz]{58})$",
|
|
95
|
+
};
|
|
90
96
|
// Claim ids, impact token ids and verification proofs.
|
|
91
97
|
const chainText = (min, max) => ({
|
|
92
98
|
...string(min, max),
|
|
@@ -186,7 +192,7 @@ const level6Messages = {
|
|
|
186
192
|
anyOf: [
|
|
187
193
|
object({
|
|
188
194
|
type: { const: "cosmos.bank.send" },
|
|
189
|
-
toAddress:
|
|
195
|
+
toAddress: recipient,
|
|
190
196
|
amountBaseUnits: baseUnits,
|
|
191
197
|
denom: optional({ ...string(3, 128), pattern: "^[a-zA-Z][a-zA-Z0-9/:._-]{2,127}$" }),
|
|
192
198
|
}),
|
|
@@ -215,7 +221,7 @@ const level6Messages = {
|
|
|
215
221
|
}),
|
|
216
222
|
object({
|
|
217
223
|
type: { const: "ixo.token.transfer" },
|
|
218
|
-
recipient
|
|
224
|
+
recipient,
|
|
219
225
|
tokens: {
|
|
220
226
|
type: "array",
|
|
221
227
|
items: object({ id: chainText(1, 128), amount: baseUnits }),
|