@ixo/action-protocol 0.6.0 → 0.8.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/CHANGELOG.md +311 -0
- package/README.md +50 -3
- package/package.json +1 -1
- package/src/index.d.ts +706 -3
- package/src/index.js +1090 -20
- package/src/operation-schema.js +356 -0
package/src/index.d.ts
CHANGED
|
@@ -6,9 +6,54 @@ export type FormField = {
|
|
|
6
6
|
value: string;
|
|
7
7
|
source: "user" | "record" | "suggestion";
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* 0.7.0: one row an application or claim card shows: one answer of `data`.
|
|
11
|
+
* `field` is the answer's path in `data` (a key, or a dot path into objects
|
|
12
|
+
* and dynamic panels, e.g. "shops.3.name"); `value` must be exactly
|
|
13
|
+
* `submissionDisplayValue` of the answer there. Every answer of `data` has
|
|
14
|
+
* exactly one row (see `submissionSummaryIssue`).
|
|
15
|
+
*/
|
|
16
|
+
export type SubmissionSummaryRow = { field: string; label: string; value: string };
|
|
17
|
+
/** 0.7.0: a file the person sent on the channel, uploaded by the Hub as claim evidence. */
|
|
18
|
+
export type ClaimEvidence = {
|
|
19
|
+
/** SurveyJS question name (a dot path for panel items, e.g. "shops.3.photo"). */
|
|
20
|
+
field: string;
|
|
21
|
+
/** https link the gateway serves the bytes from. */
|
|
22
|
+
url: string;
|
|
23
|
+
filename: string;
|
|
24
|
+
mimetype: string;
|
|
25
|
+
size: number;
|
|
26
|
+
/** Lowercase hex SHA-256 of the bytes. */
|
|
27
|
+
sha256: string;
|
|
28
|
+
};
|
|
29
|
+
export type SubmissionNetwork = "ixo mainnet" | "ixo testnet" | "ixo devnet";
|
|
30
|
+
/** 0.7.0: send an application (the collection's #bco answers) to the bids bot as the person. */
|
|
31
|
+
export type BidSubmitOperation = {
|
|
32
|
+
kind: "ixo.bid.submit.v1";
|
|
33
|
+
network: SubmissionNetwork;
|
|
34
|
+
collectionId: string;
|
|
35
|
+
title: string;
|
|
36
|
+
role: "SA";
|
|
37
|
+
summary: SubmissionSummaryRow[];
|
|
38
|
+
/** JSON object: the SurveyJS answers. */
|
|
39
|
+
data: string;
|
|
40
|
+
};
|
|
41
|
+
/** 0.7.0: submit a claim (the collection's #vct answers plus evidence) as the person. */
|
|
42
|
+
export type ClaimSubmitOperation = {
|
|
43
|
+
kind: "ixo.claim.submit.v1";
|
|
44
|
+
network: SubmissionNetwork;
|
|
45
|
+
collectionId: string;
|
|
46
|
+
title: string;
|
|
47
|
+
summary: SubmissionSummaryRow[];
|
|
48
|
+
/** JSON object: the SurveyJS answers, file questions left out. */
|
|
49
|
+
data: string;
|
|
50
|
+
evidence: ClaimEvidence[];
|
|
51
|
+
};
|
|
9
52
|
export type ActionOperationV1 =
|
|
10
53
|
| P2Operation
|
|
11
54
|
| ChainTxOperation
|
|
55
|
+
| BidSubmitOperation
|
|
56
|
+
| ClaimSubmitOperation
|
|
12
57
|
| {
|
|
13
58
|
kind: "form.submit.v1";
|
|
14
59
|
formId: string;
|
|
@@ -52,6 +97,52 @@ export type ActionReferenceV1 = {
|
|
|
52
97
|
export type ActionReceiptV1 =
|
|
53
98
|
| P2Receipt
|
|
54
99
|
| ChainTxReceipt
|
|
100
|
+
| {
|
|
101
|
+
kind: "ixo.bid.submission.v1";
|
|
102
|
+
actionId: string;
|
|
103
|
+
revision: number;
|
|
104
|
+
digest: string;
|
|
105
|
+
collectionId: string;
|
|
106
|
+
/** The bids bot's id for the bid, when it gave one. */
|
|
107
|
+
bidId: string | null;
|
|
108
|
+
submittedAt: number;
|
|
109
|
+
}
|
|
110
|
+
| {
|
|
111
|
+
kind: "ixo.claim.submission.v1";
|
|
112
|
+
actionId: string;
|
|
113
|
+
revision: number;
|
|
114
|
+
digest: string;
|
|
115
|
+
collectionId: string;
|
|
116
|
+
/** The claim's CID from the claims bot. */
|
|
117
|
+
claimId: string;
|
|
118
|
+
/** Lowercase hex: the MsgExec(MsgSubmitClaim) transaction. */
|
|
119
|
+
transactionHash: string;
|
|
120
|
+
/** The block that transaction was included in. */
|
|
121
|
+
height: number;
|
|
122
|
+
submittedAt: number;
|
|
123
|
+
}
|
|
124
|
+
| {
|
|
125
|
+
/** 0.7.0: an application or claim submission that stopped before it finished. */
|
|
126
|
+
kind: "ixo.submission.failed.v1";
|
|
127
|
+
actionId: string;
|
|
128
|
+
revision: number;
|
|
129
|
+
digest: string;
|
|
130
|
+
step: SubmissionFailureStep;
|
|
131
|
+
/**
|
|
132
|
+
* Plain words the Hub chose from the step and a known cause, always with
|
|
133
|
+
* a next step (at most 500, sanitized). The only text a gateway or
|
|
134
|
+
* runtime may show or relay.
|
|
135
|
+
*/
|
|
136
|
+
message: string;
|
|
137
|
+
/**
|
|
138
|
+
* Optional technical text (a service's or the network's answer),
|
|
139
|
+
* sanitized: no control, zero-width or bidi characters, nothing
|
|
140
|
+
* link-like, whitespace collapsed, at most 500. For the review page's
|
|
141
|
+
* closed "technical details" disclosure only; never relay it.
|
|
142
|
+
*/
|
|
143
|
+
detail?: string;
|
|
144
|
+
failedAt: number;
|
|
145
|
+
}
|
|
55
146
|
| {
|
|
56
147
|
kind: "form.submission.v1";
|
|
57
148
|
actionId: string;
|
|
@@ -143,6 +234,20 @@ export type ActionReviewView = {
|
|
|
143
234
|
transfer?: TransferDisplay | null;
|
|
144
235
|
/** 0.6.0: Hub-computed chain transaction display (chain tx cards only). */
|
|
145
236
|
chainTx?: ChainTxDisplay | null;
|
|
237
|
+
/**
|
|
238
|
+
* 0.7.0 (claim cards only): who pays the claim's network fee, read once
|
|
239
|
+
* when the card was made (no amount: the transaction is built later).
|
|
240
|
+
* `covered`: a usable fee grant allows it; `balance`: the person's IXO
|
|
241
|
+
* pays it (also when the grants could not be read).
|
|
242
|
+
*/
|
|
243
|
+
networkFee?: SubmissionNetworkFee | null;
|
|
244
|
+
/**
|
|
245
|
+
* 0.7.0 (application and claim cards): the collection's readable name
|
|
246
|
+
* (its protocol entity's Profile `name`, sanitized, at most 120) as the Hub
|
|
247
|
+
* read it when the card was made; null when none could be read. Show it
|
|
248
|
+
* with `operation.collectionId`.
|
|
249
|
+
*/
|
|
250
|
+
collectionName?: string | null;
|
|
146
251
|
};
|
|
147
252
|
export type TransferDisplay = {
|
|
148
253
|
denom: string;
|
|
@@ -191,12 +296,136 @@ export type ActionCapabilitiesV1 = {
|
|
|
191
296
|
chainTx?: ChainTxCapabilities | null;
|
|
192
297
|
};
|
|
193
298
|
|
|
194
|
-
/** 0.6.0:
|
|
195
|
-
export type
|
|
299
|
+
/** 0.6.0: the message types wire levels 4 and 5 may see. */
|
|
300
|
+
export type ChainTxLevel4MessageType =
|
|
196
301
|
| "cosmos.bank.send"
|
|
197
302
|
| "ixo.claims.submit"
|
|
198
303
|
| "ixo.claims.evaluate"
|
|
199
304
|
| "ixo.token.transfer";
|
|
305
|
+
/** 0.8.0: the 29 types wire level 6 adds. */
|
|
306
|
+
export type ChainTxLevel6MessageType =
|
|
307
|
+
| "ixo.token.retire"
|
|
308
|
+
| "cosmos.staking.delegate"
|
|
309
|
+
| "cosmos.staking.undelegate"
|
|
310
|
+
| "cosmos.staking.redelegate"
|
|
311
|
+
| "cosmos.distribution.withdraw-rewards"
|
|
312
|
+
| "cosmos.gov.vote"
|
|
313
|
+
| "ixo.claims.claim-intent"
|
|
314
|
+
| "ixo.claims.dispute"
|
|
315
|
+
| "ixo.claims.update-collection-state"
|
|
316
|
+
| "ixo.claims.update-collection-dates"
|
|
317
|
+
| "ixo.claims.update-collection-quota"
|
|
318
|
+
| "ixo.claims.create-claim-authorization"
|
|
319
|
+
| "ixo.claims.update-collection-payments"
|
|
320
|
+
| "ixo.claims.create-collection"
|
|
321
|
+
| "ixo.entity.create-account"
|
|
322
|
+
| "ixo.entity.update"
|
|
323
|
+
| "ixo.entity.revoke-account-authz"
|
|
324
|
+
| "ixo.entity.grant-account-authz"
|
|
325
|
+
| "ixo.entity.create"
|
|
326
|
+
| "ixo.iid.add-service"
|
|
327
|
+
| "ixo.iid.delete-service"
|
|
328
|
+
| "ixo.iid.add-linked-resource"
|
|
329
|
+
| "ixo.iid.delete-linked-resource"
|
|
330
|
+
| "ixo.iid.add-linked-claim"
|
|
331
|
+
| "ixo.iid.delete-linked-claim"
|
|
332
|
+
| "ixo.iid.add-linked-entity"
|
|
333
|
+
| "ixo.iid.delete-linked-entity"
|
|
334
|
+
| "ixo.iid.add-context"
|
|
335
|
+
| "ixo.iid.delete-context";
|
|
336
|
+
/** 0.6.0: one card kind for every chain transaction (0.8.0: 33 types). */
|
|
337
|
+
export type ChainTxMessageType =
|
|
338
|
+
| ChainTxLevel4MessageType
|
|
339
|
+
| ChainTxLevel6MessageType;
|
|
340
|
+
/*
|
|
341
|
+
* 0.8.0 shared rules (`chainTxIssue` names the first bad field, nested
|
|
342
|
+
* fields by path, e.g. `messages[0].payments.approval.amount[1].denom`):
|
|
343
|
+
* - VALOPER: `ixovaloper1` + 38 bech32 characters (the Hub checks the checksum);
|
|
344
|
+
* - ENTITY_DID: `did:ixo:entity:` + 32 lowercase hex;
|
|
345
|
+
* - INSTANT: RFC 3339 with `Z` or an offset, at most milliseconds, a real
|
|
346
|
+
* calendar date, and in UTC between 1970-01-01T00:00:00Z and the end of 9999;
|
|
347
|
+
* - UINT64_TEXT: a uint64 in decimal without leading zeros;
|
|
348
|
+
* - PLAIN_TEXT(n): 1..n characters, not blank, no control, zero-width or
|
|
349
|
+
* bidi characters;
|
|
350
|
+
* - SHOWN_AS_IS: free text published on chain (a retirement `reason`, a
|
|
351
|
+
* linked resource's or claim's `description` and `right`) must be exactly
|
|
352
|
+
* what the review page shows: `sanitizePublishedText(value) === value`
|
|
353
|
+
* (no control or invisible characters, no real link, single spaces, no
|
|
354
|
+
* space at either end; a file name such as "Annual Report.pdf" is fine);
|
|
355
|
+
* - links: `https://` with a host and no user info (or `ipfs://<CID>` where
|
|
356
|
+
* allowed), ≤ 300, no whitespace or backslashes.
|
|
357
|
+
* Signer-derived chain fields (owner, delegator, voter, signer, agent or
|
|
358
|
+
* creator address, controller/owner address) are never wire keys: the Hub
|
|
359
|
+
* fills them from `signer`.
|
|
360
|
+
*/
|
|
361
|
+
export type ChainTxVoteOption = "yes" | "no" | "abstain" | "no_with_veto";
|
|
362
|
+
export type ChainTxDisputeReason =
|
|
363
|
+
| "not_as_asked"
|
|
364
|
+
| "not_delivered"
|
|
365
|
+
| "check_wrong"
|
|
366
|
+
| "other";
|
|
367
|
+
export type ChainTxCollectionState = "open" | "paused" | "closed";
|
|
368
|
+
export type ChainTxReservationMode = "allow" | "deny" | "required";
|
|
369
|
+
export type ChainTxClaimRole = "file-claims" | "check-claims";
|
|
370
|
+
export type ChainTxEntityPermission =
|
|
371
|
+
| "change-collection-state"
|
|
372
|
+
| "change-collection-dates"
|
|
373
|
+
| "change-collection-quota"
|
|
374
|
+
| "change-collection-payments"
|
|
375
|
+
| "authorize-claim-agents"
|
|
376
|
+
| ChainTxClaimRole;
|
|
377
|
+
export type ChainTxPaymentLegName =
|
|
378
|
+
| "submission"
|
|
379
|
+
| "evaluation"
|
|
380
|
+
| "approval"
|
|
381
|
+
| "rejection";
|
|
382
|
+
/** A coin in base units; `denom` matches `DENOM`. */
|
|
383
|
+
export type ChainTxCoin = { denom: string; amountBaseUnits: string };
|
|
384
|
+
export type ChainTxPaymentLeg = {
|
|
385
|
+
/** 0..4 coins, distinct denoms; [] = no payment. */
|
|
386
|
+
amount: ChainTxCoin[];
|
|
387
|
+
/** 0..31536000; 0 or absent pays at once, > 0 lets the recipient collect it after that many seconds. */
|
|
388
|
+
payAfterSeconds?: number;
|
|
389
|
+
};
|
|
390
|
+
/**
|
|
391
|
+
* Collection payments. The Hub fills each leg's paying account (an entity
|
|
392
|
+
* account); CW20/CW1155 payments are not offered.
|
|
393
|
+
* - `ixo.claims.create-collection`: a missing leg pays nothing.
|
|
394
|
+
* - `ixo.claims.update-collection-payments`: a missing leg keeps exactly
|
|
395
|
+
* what it pays now (amounts, delay, paying account, any CW20/CW1155
|
|
396
|
+
* payments); `{amount: []}` makes a leg pay nothing. A listed leg replaces
|
|
397
|
+
* that leg, and the Hub refuses to replace a leg that pays CW20/CW1155
|
|
398
|
+
* tokens (`token_payments_present`), which a card cannot show or keep.
|
|
399
|
+
*/
|
|
400
|
+
export type ChainTxPayments = {
|
|
401
|
+
/** Paid to the filer when a claim is filed. */
|
|
402
|
+
submission?: ChainTxPaymentLeg;
|
|
403
|
+
/** Paid to the checker for each check. */
|
|
404
|
+
evaluation?: ChainTxPaymentLeg;
|
|
405
|
+
/** Paid to the filer on approval; `networkSplit` shares it with the network and the oracle (absent on an update = keep the current value). */
|
|
406
|
+
approval?: ChainTxPaymentLeg & { networkSplit?: boolean };
|
|
407
|
+
/** Paid to the filer on rejection. */
|
|
408
|
+
rejection?: ChainTxPaymentLeg;
|
|
409
|
+
};
|
|
410
|
+
/** A token line of `ixo.token.transfer` / `ixo.token.retire`. */
|
|
411
|
+
export type ChainTxTokenLine = {
|
|
412
|
+
/** 1..128 of ^[A-Za-z0-9:._/-]+$ */
|
|
413
|
+
id: string;
|
|
414
|
+
/** ^[1-9][0-9]*$ (≤ 78 digits) */
|
|
415
|
+
amount: string;
|
|
416
|
+
};
|
|
417
|
+
/**
|
|
418
|
+
* An x/iid item id to add: `{id}#name` (Portal's literal form) or
|
|
419
|
+
* `did:ixo:<1..160 of [A-Za-z0-9._:%-]>#name`, name 1..64 of [A-Za-z0-9._~:-].
|
|
420
|
+
*/
|
|
421
|
+
export type ChainTxIidItemId = string;
|
|
422
|
+
/**
|
|
423
|
+
* The id of an x/iid item to remove, exactly as the document holds it
|
|
424
|
+
* (`#api`, `{id}#ixo1…`, ids without `#`): 1..300 characters, no whitespace,
|
|
425
|
+
* control, zero-width or bidi characters. The Hub reads the document and
|
|
426
|
+
* refuses an id that is not there.
|
|
427
|
+
*/
|
|
428
|
+
export type ChainTxIidRemoveId = string;
|
|
200
429
|
/**
|
|
201
430
|
* Field rules (`chainTxIssue` names the first bad field):
|
|
202
431
|
* - addresses: a 20-byte ixo account address, `ixo1` + 38 bech32 characters
|
|
@@ -259,7 +488,302 @@ export type ChainTxMessage =
|
|
|
259
488
|
recipient: string;
|
|
260
489
|
/** 1..32 lines; id 1..128 of ^[A-Za-z0-9:._/-]+$, amount ^[1-9][0-9]*$ */
|
|
261
490
|
tokens: Array<{ id: string; amount: string }>;
|
|
262
|
-
}
|
|
491
|
+
}
|
|
492
|
+
// ---- 0.8.0 (wire level 6) ----
|
|
493
|
+
| {
|
|
494
|
+
/** Burns impact tokens the signer holds, for good (MsgRetireToken). */
|
|
495
|
+
type: "ixo.token.retire";
|
|
496
|
+
/** 1..32 lines, all of one token class (the chain refuses mixed classes). */
|
|
497
|
+
tokens: ChainTxTokenLine[];
|
|
498
|
+
/** `Global`, or `CC[-SUB[ POSTAL]]`: ^[A-Z]{2}(?:-[A-Za-z0-9]{1,3}(?: [A-Za-z0-9]{1,64})?)?$ */
|
|
499
|
+
jurisdiction: string;
|
|
500
|
+
/** PLAIN_TEXT(200) and SHOWN_AS_IS, e.g. `offset`. */
|
|
501
|
+
reason: string;
|
|
502
|
+
}
|
|
503
|
+
| {
|
|
504
|
+
/** Stakes IXO with a validator (MsgDelegate); denom is always uixo. */
|
|
505
|
+
type: "cosmos.staking.delegate";
|
|
506
|
+
/** VALOPER */
|
|
507
|
+
validatorAddress: string;
|
|
508
|
+
/** uixo, ^[1-9][0-9]*$ */
|
|
509
|
+
amountBaseUnits: string;
|
|
510
|
+
}
|
|
511
|
+
| {
|
|
512
|
+
/** Starts unstaking (MsgUndelegate); back after the unbonding period. */
|
|
513
|
+
type: "cosmos.staking.undelegate";
|
|
514
|
+
validatorAddress: string;
|
|
515
|
+
amountBaseUnits: string;
|
|
516
|
+
}
|
|
517
|
+
| {
|
|
518
|
+
/** Moves stake between validators at once (MsgBeginRedelegate). */
|
|
519
|
+
type: "cosmos.staking.redelegate";
|
|
520
|
+
fromValidatorAddress: string;
|
|
521
|
+
/** VALOPER, different from `fromValidatorAddress`. */
|
|
522
|
+
toValidatorAddress: string;
|
|
523
|
+
amountBaseUnits: string;
|
|
524
|
+
}
|
|
525
|
+
| {
|
|
526
|
+
/** Claims the staking rewards earned with one validator. */
|
|
527
|
+
type: "cosmos.distribution.withdraw-rewards";
|
|
528
|
+
validatorAddress: string;
|
|
529
|
+
}
|
|
530
|
+
| {
|
|
531
|
+
/** Votes on a governance proposal (gov v1 MsgVote; a later vote replaces it). */
|
|
532
|
+
type: "cosmos.gov.vote";
|
|
533
|
+
/** UINT64_TEXT ≥ 1 */
|
|
534
|
+
proposalId: string;
|
|
535
|
+
option: ChainTxVoteOption;
|
|
536
|
+
}
|
|
537
|
+
| {
|
|
538
|
+
/** Reserves a collection's payment before filing a claim (MsgClaimIntent). */
|
|
539
|
+
type: "ixo.claims.claim-intent";
|
|
540
|
+
collectionId: string;
|
|
541
|
+
/** The signer's own DID (Hub policy). */
|
|
542
|
+
agentDid: string;
|
|
543
|
+
}
|
|
544
|
+
| {
|
|
545
|
+
/** Opens a dispute about a claim (MsgDisputeClaim); may take the collection's deposit. */
|
|
546
|
+
type: "ixo.claims.dispute";
|
|
547
|
+
/** 1..256 of ^[A-Za-z0-9:._/-]+$ */
|
|
548
|
+
claimId: string;
|
|
549
|
+
/** The claim's collection (the Hub checks it). */
|
|
550
|
+
collectionId: string;
|
|
551
|
+
/** The signer's own DID (Hub policy). */
|
|
552
|
+
agentDid: string;
|
|
553
|
+
/** dispute_type 1..4; `check_wrong` targets the checker, the rest the filer. */
|
|
554
|
+
reason: ChainTxDisputeReason;
|
|
555
|
+
/** An already stored statement. */
|
|
556
|
+
evidence: {
|
|
557
|
+
/** https:// or ipfs:// link, ≤ 300 */
|
|
558
|
+
uri: string;
|
|
559
|
+
/** ^[A-Za-z0-9][A-Za-z0-9.+/_-]{0,99}$, e.g. `eval-engine/v1` */
|
|
560
|
+
type: string;
|
|
561
|
+
/** 1..300 of ^[A-Za-z0-9:._/-]+$ */
|
|
562
|
+
proof: string;
|
|
563
|
+
encrypted?: boolean;
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
| {
|
|
567
|
+
/** Opens, pauses or closes a collection (MsgExec under the admin's grant). */
|
|
568
|
+
type: "ixo.claims.update-collection-state";
|
|
569
|
+
collectionId: string;
|
|
570
|
+
/** The collection's admin account; the Hub checks it against the collection (D3). */
|
|
571
|
+
adminAddress: string;
|
|
572
|
+
state: ChainTxCollectionState;
|
|
573
|
+
}
|
|
574
|
+
| {
|
|
575
|
+
/** Changes when a collection takes claims (MsgExec). At least one date. */
|
|
576
|
+
type: "ixo.claims.update-collection-dates";
|
|
577
|
+
collectionId: string;
|
|
578
|
+
adminAddress: string;
|
|
579
|
+
/** INSTANT; absent = keep the current start. */
|
|
580
|
+
startDate?: string;
|
|
581
|
+
/** INSTANT, or null = no end date; absent = keep. After a given start. */
|
|
582
|
+
endDate?: string | null;
|
|
583
|
+
}
|
|
584
|
+
| {
|
|
585
|
+
/** Changes how many claims a collection takes in total (MsgExec). */
|
|
586
|
+
type: "ixo.claims.update-collection-quota";
|
|
587
|
+
collectionId: string;
|
|
588
|
+
adminAddress: string;
|
|
589
|
+
/** UINT64_TEXT; "0" = no limit. */
|
|
590
|
+
maxClaims: string;
|
|
591
|
+
}
|
|
592
|
+
| ({
|
|
593
|
+
/** Lets an account file or check claims in a collection (MsgExec). */
|
|
594
|
+
type: "ixo.claims.create-claim-authorization";
|
|
595
|
+
collectionId: string;
|
|
596
|
+
adminAddress: string;
|
|
597
|
+
granteeAddress: string;
|
|
598
|
+
/** "1".."1000000000" */
|
|
599
|
+
maxClaims: string;
|
|
600
|
+
/** INSTANT; absent = keep the existing grant's expiry, else none (Hub rule). */
|
|
601
|
+
expiresAt?: string;
|
|
602
|
+
/** The signer's own DID (Hub policy). */
|
|
603
|
+
creatorDid: string;
|
|
604
|
+
} & (
|
|
605
|
+
| { role: "file-claims"; reservationSeconds?: number; decideBefore?: never }
|
|
606
|
+
| { role: "check-claims"; decideBefore?: string; reservationSeconds?: never }
|
|
607
|
+
))
|
|
608
|
+
| {
|
|
609
|
+
/** Changes what a collection pays (MsgExec); legs left out keep what they pay. */
|
|
610
|
+
type: "ixo.claims.update-collection-payments";
|
|
611
|
+
collectionId: string;
|
|
612
|
+
adminAddress: string;
|
|
613
|
+
payments: ChainTxPayments;
|
|
614
|
+
}
|
|
615
|
+
| {
|
|
616
|
+
/** Creates a claim collection for an entity the signer owns. */
|
|
617
|
+
type: "ixo.claims.create-collection";
|
|
618
|
+
/** ENTITY_DID */
|
|
619
|
+
entityId: string;
|
|
620
|
+
/** The protocol (kind of claim) DID. */
|
|
621
|
+
protocolId: string;
|
|
622
|
+
/** INSTANT */
|
|
623
|
+
startDate: string;
|
|
624
|
+
/** INSTANT after `startDate`, or null = no end date (the key is required). */
|
|
625
|
+
endDate: string | null;
|
|
626
|
+
/** UINT64_TEXT; "0" = no limit. */
|
|
627
|
+
maxClaims: string;
|
|
628
|
+
state: ChainTxCollectionState;
|
|
629
|
+
reservations: ChainTxReservationMode;
|
|
630
|
+
payments: ChainTxPayments;
|
|
631
|
+
}
|
|
632
|
+
| {
|
|
633
|
+
/** Adds a named account to an entity the signer owns. */
|
|
634
|
+
type: "ixo.entity.create-account";
|
|
635
|
+
entityId: string;
|
|
636
|
+
/** ^[A-Za-z0-9](?:[A-Za-z0-9 _-]{0,62}[A-Za-z0-9])?$, not `admin` (any case). */
|
|
637
|
+
name: string;
|
|
638
|
+
}
|
|
639
|
+
| {
|
|
640
|
+
/**
|
|
641
|
+
* Changes an entity's start and/or end date (MsgUpdateEntity; status
|
|
642
|
+
* and credentials are kept by the Hub). At least one date.
|
|
643
|
+
*/
|
|
644
|
+
type: "ixo.entity.update";
|
|
645
|
+
entityId: string;
|
|
646
|
+
startDate?: string;
|
|
647
|
+
/** INSTANT, or null = clear it. After a given start. */
|
|
648
|
+
endDate?: string | null;
|
|
649
|
+
/** The signer's own DID (Hub policy). */
|
|
650
|
+
controllerDid: string;
|
|
651
|
+
}
|
|
652
|
+
| {
|
|
653
|
+
/** Removes a permission the entity's admin account gave (the whole grant for that type). */
|
|
654
|
+
type: "ixo.entity.revoke-account-authz";
|
|
655
|
+
entityId: string;
|
|
656
|
+
granteeAddress: string;
|
|
657
|
+
permission: ChainTxEntityPermission;
|
|
658
|
+
}
|
|
659
|
+
| ({
|
|
660
|
+
/** Gives a permission from the entity's admin account. */
|
|
661
|
+
type: "ixo.entity.grant-account-authz";
|
|
662
|
+
entityId: string;
|
|
663
|
+
granteeAddress: string;
|
|
664
|
+
/** INSTANT; absent = keep the existing grant's expiry, else none (Hub rule). */
|
|
665
|
+
expiresAt?: string;
|
|
666
|
+
} & (
|
|
667
|
+
| {
|
|
668
|
+
permission: "file-claims";
|
|
669
|
+
collectionId: string;
|
|
670
|
+
/** "1".."1000000000" */
|
|
671
|
+
maxClaims: string;
|
|
672
|
+
reservationSeconds?: number;
|
|
673
|
+
decideBefore?: never;
|
|
674
|
+
}
|
|
675
|
+
| {
|
|
676
|
+
permission: "check-claims";
|
|
677
|
+
collectionId: string;
|
|
678
|
+
maxClaims: string;
|
|
679
|
+
decideBefore?: string;
|
|
680
|
+
reservationSeconds?: never;
|
|
681
|
+
}
|
|
682
|
+
| {
|
|
683
|
+
permission: Exclude<ChainTxEntityPermission, ChainTxClaimRole>;
|
|
684
|
+
collectionId?: never;
|
|
685
|
+
maxClaims?: never;
|
|
686
|
+
reservationSeconds?: never;
|
|
687
|
+
decideBefore?: never;
|
|
688
|
+
}
|
|
689
|
+
))
|
|
690
|
+
| {
|
|
691
|
+
/** Creates an entity the signer owns (MsgCreateEntity). */
|
|
692
|
+
type: "ixo.entity.create";
|
|
693
|
+
/** ^[a-z][a-z0-9_-]{0,31}(?:/[a-z][a-z0-9_-]{0,31})?$ */
|
|
694
|
+
entityType: string;
|
|
695
|
+
/** An already stored Profile document: https link ≤ 300 and its proof. */
|
|
696
|
+
profile?: { serviceEndpoint: string; proof: string };
|
|
697
|
+
protocolId?: string;
|
|
698
|
+
startDate?: string;
|
|
699
|
+
/** INSTANT after a given start (no null here). */
|
|
700
|
+
endDate?: string;
|
|
701
|
+
/** The signer's own DID (Hub policy). */
|
|
702
|
+
ownerDid: string;
|
|
703
|
+
}
|
|
704
|
+
| {
|
|
705
|
+
type: "ixo.iid.add-service";
|
|
706
|
+
/** The identity document changed (did:ixo:…). */
|
|
707
|
+
did: string;
|
|
708
|
+
service: {
|
|
709
|
+
id: ChainTxIidItemId;
|
|
710
|
+
/** ^[A-Za-z][A-Za-z0-9._:/-]{0,63}$ */
|
|
711
|
+
type: string;
|
|
712
|
+
/** https:// or ipfs:// link */
|
|
713
|
+
serviceEndpoint: string;
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
| { type: "ixo.iid.delete-service"; did: string; serviceId: ChainTxIidRemoveId }
|
|
717
|
+
| {
|
|
718
|
+
type: "ixo.iid.add-linked-resource";
|
|
719
|
+
did: string;
|
|
720
|
+
resource: {
|
|
721
|
+
id: ChainTxIidItemId;
|
|
722
|
+
/** ^[A-Za-z][A-Za-z0-9._:/+-]{0,63}$ */
|
|
723
|
+
type: string;
|
|
724
|
+
/** 0..300 characters, SHOWN_AS_IS ("" allowed). */
|
|
725
|
+
description: string;
|
|
726
|
+
/** ^[a-z]+/[A-Za-z0-9.+-]{1,90}$, ≤ 128 */
|
|
727
|
+
mediaType: string;
|
|
728
|
+
serviceEndpoint: string;
|
|
729
|
+
/** "" or 1..300 of ^[A-Za-z0-9:._/-]+$ */
|
|
730
|
+
proof: string;
|
|
731
|
+
encrypted: boolean;
|
|
732
|
+
/** "" or PLAIN_TEXT(300), SHOWN_AS_IS */
|
|
733
|
+
right?: string;
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
| {
|
|
737
|
+
type: "ixo.iid.delete-linked-resource";
|
|
738
|
+
did: string;
|
|
739
|
+
resourceId: ChainTxIidRemoveId;
|
|
740
|
+
}
|
|
741
|
+
| {
|
|
742
|
+
type: "ixo.iid.add-linked-claim";
|
|
743
|
+
did: string;
|
|
744
|
+
claim: {
|
|
745
|
+
/** 1..256 of ^[A-Za-z0-9:._/-]+$ */
|
|
746
|
+
id: string;
|
|
747
|
+
type: string;
|
|
748
|
+
/** As a linked resource's: "" allowed, ≤ 300, SHOWN_AS_IS. */
|
|
749
|
+
description: string;
|
|
750
|
+
serviceEndpoint: string;
|
|
751
|
+
/** "" or 1..300 of ^[A-Za-z0-9:._/-]+$ */
|
|
752
|
+
proof: string;
|
|
753
|
+
encrypted: boolean;
|
|
754
|
+
/** "" or PLAIN_TEXT(300), SHOWN_AS_IS */
|
|
755
|
+
right?: string;
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
| { type: "ixo.iid.delete-linked-claim"; did: string; claimId: ChainTxIidRemoveId }
|
|
759
|
+
| {
|
|
760
|
+
type: "ixo.iid.add-linked-entity";
|
|
761
|
+
did: string;
|
|
762
|
+
entity: {
|
|
763
|
+
/**
|
|
764
|
+
* did:ixo:…, an ixo account (20-byte) or contract (32-byte) address,
|
|
765
|
+
* or Portal's `{id}#<address>` (the Hub checks the checksum).
|
|
766
|
+
*/
|
|
767
|
+
id: string;
|
|
768
|
+
type: string;
|
|
769
|
+
/** ^[A-Za-z][A-Za-z0-9_-]{0,63}$, e.g. `member`, `Governs` */
|
|
770
|
+
relationship: string;
|
|
771
|
+
/** "" (none), a service name or a reference to one: ^(?:(?:\{id\}|did:ixo:…)#)?[A-Za-z0-9._~:-]{1,64}$ */
|
|
772
|
+
service?: string;
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
| { type: "ixo.iid.delete-linked-entity"; did: string; entityId: ChainTxIidRemoveId }
|
|
776
|
+
| {
|
|
777
|
+
type: "ixo.iid.add-context";
|
|
778
|
+
did: string;
|
|
779
|
+
context: {
|
|
780
|
+
/** ^[A-Za-z][A-Za-z0-9_-]{0,63}$ */
|
|
781
|
+
key: string;
|
|
782
|
+
/** An https link or a did:ixo DID, ≤ 300. */
|
|
783
|
+
val: string;
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
| { type: "ixo.iid.delete-context"; did: string; key: ChainTxIidRemoveId };
|
|
263
787
|
export type ChainTxOperation = {
|
|
264
788
|
kind: "ixo.chain.tx.v1";
|
|
265
789
|
/** Must equal the Hub RPC's chain id at prepare. */
|
|
@@ -340,12 +864,136 @@ export type ChainTxCapabilities = {
|
|
|
340
864
|
maxMessages: number;
|
|
341
865
|
};
|
|
342
866
|
export declare const CHAIN_TX_KIND: "ixo.chain.tx.v1";
|
|
867
|
+
/** 0.8.0: exactly the four 0.6.0 types (what levels 4 and 5 may see), frozen. */
|
|
868
|
+
export declare const CHAIN_TX_LEVEL4_MESSAGE_TYPES: readonly [
|
|
869
|
+
"cosmos.bank.send",
|
|
870
|
+
"ixo.claims.submit",
|
|
871
|
+
"ixo.claims.evaluate",
|
|
872
|
+
"ixo.token.transfer",
|
|
873
|
+
];
|
|
874
|
+
/**
|
|
875
|
+
* Every type this package parses (the four, then the 29 of 0.8.0), frozen.
|
|
876
|
+
* What a caller may see or create: `chainTxMessageTypesForLevel(level)`.
|
|
877
|
+
*/
|
|
343
878
|
export declare const CHAIN_TX_MESSAGE_TYPES: readonly [
|
|
344
879
|
"cosmos.bank.send",
|
|
345
880
|
"ixo.claims.submit",
|
|
346
881
|
"ixo.claims.evaluate",
|
|
347
882
|
"ixo.token.transfer",
|
|
883
|
+
"ixo.token.retire",
|
|
884
|
+
"cosmos.staking.delegate",
|
|
885
|
+
"cosmos.staking.undelegate",
|
|
886
|
+
"cosmos.staking.redelegate",
|
|
887
|
+
"cosmos.distribution.withdraw-rewards",
|
|
888
|
+
"cosmos.gov.vote",
|
|
889
|
+
"ixo.claims.claim-intent",
|
|
890
|
+
"ixo.claims.dispute",
|
|
891
|
+
"ixo.claims.update-collection-state",
|
|
892
|
+
"ixo.claims.update-collection-dates",
|
|
893
|
+
"ixo.claims.update-collection-quota",
|
|
894
|
+
"ixo.claims.create-claim-authorization",
|
|
895
|
+
"ixo.claims.update-collection-payments",
|
|
896
|
+
"ixo.claims.create-collection",
|
|
897
|
+
"ixo.entity.create-account",
|
|
898
|
+
"ixo.entity.update",
|
|
899
|
+
"ixo.entity.revoke-account-authz",
|
|
900
|
+
"ixo.entity.grant-account-authz",
|
|
901
|
+
"ixo.entity.create",
|
|
902
|
+
"ixo.iid.add-service",
|
|
903
|
+
"ixo.iid.delete-service",
|
|
904
|
+
"ixo.iid.add-linked-resource",
|
|
905
|
+
"ixo.iid.delete-linked-resource",
|
|
906
|
+
"ixo.iid.add-linked-claim",
|
|
907
|
+
"ixo.iid.delete-linked-claim",
|
|
908
|
+
"ixo.iid.add-linked-entity",
|
|
909
|
+
"ixo.iid.delete-linked-entity",
|
|
910
|
+
"ixo.iid.add-context",
|
|
911
|
+
"ixo.iid.delete-context",
|
|
348
912
|
];
|
|
913
|
+
/** The wire level that adds the 29 types of 0.8.0. */
|
|
914
|
+
export declare const CHAIN_TX_LEVEL6: 6;
|
|
915
|
+
/**
|
|
916
|
+
* The chain tx message types a caller at wire `level` (a positive integer)
|
|
917
|
+
* may see and create: none below 4, `CHAIN_TX_LEVEL4_MESSAGE_TYPES` at 4
|
|
918
|
+
* and 5, `CHAIN_TX_MESSAGE_TYPES` from 6. Throws `TypeError` on a
|
|
919
|
+
* non-integer or a level below 1.
|
|
920
|
+
*/
|
|
921
|
+
export declare function chainTxMessageTypesForLevel(
|
|
922
|
+
level: number,
|
|
923
|
+
): readonly ChainTxMessageType[];
|
|
924
|
+
export declare const CHAIN_TX_VOTE_OPTIONS: readonly ChainTxVoteOption[];
|
|
925
|
+
export declare const CHAIN_TX_DISPUTE_REASONS: readonly ChainTxDisputeReason[];
|
|
926
|
+
export declare const CHAIN_TX_COLLECTION_STATES: readonly ChainTxCollectionState[];
|
|
927
|
+
export declare const CHAIN_TX_RESERVATION_MODES: readonly ChainTxReservationMode[];
|
|
928
|
+
export declare const CHAIN_TX_CLAIM_ROLES: readonly ChainTxClaimRole[];
|
|
929
|
+
export declare const CHAIN_TX_ENTITY_PERMISSIONS: readonly ChainTxEntityPermission[];
|
|
930
|
+
export declare const CHAIN_TX_PAYMENT_LEGS: readonly ChainTxPaymentLegName[];
|
|
931
|
+
export declare const CHAIN_TX_MAX_PAYMENT_COINS: 4;
|
|
932
|
+
export declare const CHAIN_TX_MAX_SECONDS: 31536000;
|
|
933
|
+
export declare const CHAIN_TX_MAX_CLAIM_PERMISSION: 1000000000;
|
|
934
|
+
/**
|
|
935
|
+
* 0.8.0: why the Hub would not make a chain tx card from what it read on
|
|
936
|
+
* chain or what the node's simulation said about one message. The 400's
|
|
937
|
+
* `reason` is then `invalid_message: messages[<i>].<field>: <code>`
|
|
938
|
+
* (`error` is `operation_not_registered` for a Hub read, `simulation_failed`
|
|
939
|
+
* for the node's simulation). A reason without `: <code>` is a shape the
|
|
940
|
+
* parser refused, as in 0.6.0. Map codes to your own words; treat an
|
|
941
|
+
* unknown code like none.
|
|
942
|
+
*/
|
|
943
|
+
export type ChainTxRefusalCode =
|
|
944
|
+
| "validator_not_found"
|
|
945
|
+
| "no_stake"
|
|
946
|
+
| "stake_too_small"
|
|
947
|
+
| "same_validator"
|
|
948
|
+
| "invalid_amount"
|
|
949
|
+
| "nothing_to_collect"
|
|
950
|
+
| "proposal_not_found"
|
|
951
|
+
| "proposal_not_open"
|
|
952
|
+
| "invalid_vote_option"
|
|
953
|
+
| "token_not_found"
|
|
954
|
+
| "collection_not_found"
|
|
955
|
+
| "reservations_off"
|
|
956
|
+
| "reservation_exists"
|
|
957
|
+
| "claim_not_found"
|
|
958
|
+
| "claim_in_other_collection"
|
|
959
|
+
| "wrong_admin"
|
|
960
|
+
| "already_in_state"
|
|
961
|
+
| "start_date_missing"
|
|
962
|
+
| "end_before_start"
|
|
963
|
+
| "quota_below_count"
|
|
964
|
+
| "token_payments_present"
|
|
965
|
+
| "ends_too_soon"
|
|
966
|
+
| "deadline_too_soon"
|
|
967
|
+
| "current_permission_ends_too_soon"
|
|
968
|
+
| "unlimited_permission_exists"
|
|
969
|
+
| "other_permission_exists"
|
|
970
|
+
| "too_many_constraints"
|
|
971
|
+
| "no_such_permission"
|
|
972
|
+
| "collection_of_other_entity"
|
|
973
|
+
| "entity_not_found"
|
|
974
|
+
| "account_name_taken"
|
|
975
|
+
| "document_not_found"
|
|
976
|
+
| "nothing_to_remove"
|
|
977
|
+
| "already_exists"
|
|
978
|
+
| "invalid_did"
|
|
979
|
+
| "not_available"
|
|
980
|
+
| "chain_data_too_large";
|
|
981
|
+
export declare const CHAIN_TX_REFUSAL_CODES: readonly ChainTxRefusalCode[];
|
|
982
|
+
export type ChainTxRefusal = {
|
|
983
|
+
/** The message index (0..7). */
|
|
984
|
+
index: number;
|
|
985
|
+
/** The field or path, e.g. `validatorAddress`, `payments.approval`. */
|
|
986
|
+
field: string;
|
|
987
|
+
/** Null when the reason has no code, or one this package does not know. */
|
|
988
|
+
code: ChainTxRefusalCode | null;
|
|
989
|
+
};
|
|
990
|
+
/**
|
|
991
|
+
* 0.8.0: a chain tx refusal `reason` as `{index, field, code}`, or null when
|
|
992
|
+
* it does not name a message field.
|
|
993
|
+
*/
|
|
994
|
+
export declare function parseChainTxRefusal(
|
|
995
|
+
reason: string | null | undefined,
|
|
996
|
+
): ChainTxRefusal | null;
|
|
349
997
|
export declare const CHAIN_TX_MAX_MESSAGES: 8;
|
|
350
998
|
export declare const CHAIN_TX_MAX_TOKEN_LINES: 32;
|
|
351
999
|
export declare const CHAIN_TX_FAILURE_REASONS: readonly [
|
|
@@ -746,3 +1394,58 @@ export declare function publicKeyFromDidDocument(
|
|
|
746
1394
|
): Uint8Array;
|
|
747
1395
|
/** The exact 0.1.0 receipt shape for v1 callers (drops the 0.3.0 bank fields). */
|
|
748
1396
|
export declare function v1Receipt<T extends ActionReceiptV1 | null>(receipt: T): T;
|
|
1397
|
+
|
|
1398
|
+
/** 0.7.0 */
|
|
1399
|
+
export type SubmissionFailureStep =
|
|
1400
|
+
| "collection"
|
|
1401
|
+
| "evidence"
|
|
1402
|
+
| "key"
|
|
1403
|
+
| "bid_bot"
|
|
1404
|
+
| "claim_bot"
|
|
1405
|
+
| "chain";
|
|
1406
|
+
export declare const SUBMISSION_FAILURE_STEPS: readonly SubmissionFailureStep[];
|
|
1407
|
+
/**
|
|
1408
|
+
* 0.7.0: how one answer is shown on the card: a string as it is; a number or
|
|
1409
|
+
* boolean as String(value); null as ""; an array of strings, numbers and
|
|
1410
|
+
* booleans as its items' display forms joined with ", " ("" when empty).
|
|
1411
|
+
* Anything else (an object, a nested or mixed array) has no display form:
|
|
1412
|
+
* undefined. Objects and arrays of objects are not answers but containers
|
|
1413
|
+
* (their answers are the rows below them).
|
|
1414
|
+
*/
|
|
1415
|
+
export declare function submissionDisplayValue(value: unknown): string | undefined;
|
|
1416
|
+
/**
|
|
1417
|
+
* 0.7.0: why an application or claim card's `summary` does not show exactly
|
|
1418
|
+
* its `data`, as the Hub's 400 `reason`, or null. The answers of `data` are
|
|
1419
|
+
* its leaves: walking objects key by key and arrays of objects index by
|
|
1420
|
+
* index (path segments joined with "."), every other value is an answer at
|
|
1421
|
+
* its path. Every answer needs exactly one row with that `field` and its
|
|
1422
|
+
* display form as `value`; no row may name anything else; a key may not be
|
|
1423
|
+
* empty or contain "."; a claim's evidence `field` must not already hold an
|
|
1424
|
+
* answer (a file is shown as a file, not a row).
|
|
1425
|
+
*/
|
|
1426
|
+
export declare function submissionSummaryIssue(
|
|
1427
|
+
operation: BidSubmitOperation | ClaimSubmitOperation,
|
|
1428
|
+
): string | null;
|
|
1429
|
+
export type SubmissionNetworkFee = "covered" | "balance";
|
|
1430
|
+
export declare const SUBMISSION_NETWORK_FEES: readonly SubmissionNetworkFee[];
|
|
1431
|
+
/** 0.7.0: the longest failure `message` or `detail` (UTF-16 units). */
|
|
1432
|
+
export declare const SUBMISSION_TEXT_MAX: 500;
|
|
1433
|
+
/**
|
|
1434
|
+
* 0.7.0: plain text safe to show: control characters become spaces,
|
|
1435
|
+
* invisible and bidi characters are dropped, link-like text becomes
|
|
1436
|
+
* `[link]`, whitespace is collapsed, cut to SUBMISSION_TEXT_MAX. Idempotent.
|
|
1437
|
+
*/
|
|
1438
|
+
export declare function sanitizeSubmissionText(text: string): string;
|
|
1439
|
+
/**
|
|
1440
|
+
* 0.8.0: a raw value (id, address, type URL) for a technical fact: control
|
|
1441
|
+
* characters become spaces and invisible or bidi characters are dropped
|
|
1442
|
+
* (the sanitizer's sets); nothing link-like is replaced, nothing is cut.
|
|
1443
|
+
*/
|
|
1444
|
+
export declare function stripHiddenCharacters(text: string): string;
|
|
1445
|
+
/**
|
|
1446
|
+
* 0.8.0: free text published on chain as the review page shows it
|
|
1447
|
+
* (SHOWN_AS_IS): as sanitizeSubmissionText, but only real links (a scheme,
|
|
1448
|
+
* www., an email address, a host followed by a path) become `[link]`, so a
|
|
1449
|
+
* file name such as "Annual Report.pdf" stays. Idempotent.
|
|
1450
|
+
*/
|
|
1451
|
+
export declare function sanitizePublishedText(text: string): string;
|