@ixo/action-protocol 0.7.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 +269 -0
- package/README.md +18 -3
- package/package.json +1 -1
- package/src/index.d.ts +559 -3
- package/src/index.js +816 -29
- package/src/operation-schema.js +311 -0
package/src/index.d.ts
CHANGED
|
@@ -296,12 +296,136 @@ export type ActionCapabilitiesV1 = {
|
|
|
296
296
|
chainTx?: ChainTxCapabilities | null;
|
|
297
297
|
};
|
|
298
298
|
|
|
299
|
-
/** 0.6.0:
|
|
300
|
-
export type
|
|
299
|
+
/** 0.6.0: the message types wire levels 4 and 5 may see. */
|
|
300
|
+
export type ChainTxLevel4MessageType =
|
|
301
301
|
| "cosmos.bank.send"
|
|
302
302
|
| "ixo.claims.submit"
|
|
303
303
|
| "ixo.claims.evaluate"
|
|
304
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;
|
|
305
429
|
/**
|
|
306
430
|
* Field rules (`chainTxIssue` names the first bad field):
|
|
307
431
|
* - addresses: a 20-byte ixo account address, `ixo1` + 38 bech32 characters
|
|
@@ -364,7 +488,302 @@ export type ChainTxMessage =
|
|
|
364
488
|
recipient: string;
|
|
365
489
|
/** 1..32 lines; id 1..128 of ^[A-Za-z0-9:._/-]+$, amount ^[1-9][0-9]*$ */
|
|
366
490
|
tokens: Array<{ id: string; amount: string }>;
|
|
367
|
-
}
|
|
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 };
|
|
368
787
|
export type ChainTxOperation = {
|
|
369
788
|
kind: "ixo.chain.tx.v1";
|
|
370
789
|
/** Must equal the Hub RPC's chain id at prepare. */
|
|
@@ -445,12 +864,136 @@ export type ChainTxCapabilities = {
|
|
|
445
864
|
maxMessages: number;
|
|
446
865
|
};
|
|
447
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
|
+
*/
|
|
448
878
|
export declare const CHAIN_TX_MESSAGE_TYPES: readonly [
|
|
449
879
|
"cosmos.bank.send",
|
|
450
880
|
"ixo.claims.submit",
|
|
451
881
|
"ixo.claims.evaluate",
|
|
452
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",
|
|
453
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;
|
|
454
997
|
export declare const CHAIN_TX_MAX_MESSAGES: 8;
|
|
455
998
|
export declare const CHAIN_TX_MAX_TOKEN_LINES: 32;
|
|
456
999
|
export declare const CHAIN_TX_FAILURE_REASONS: readonly [
|
|
@@ -893,3 +1436,16 @@ export declare const SUBMISSION_TEXT_MAX: 500;
|
|
|
893
1436
|
* `[link]`, whitespace is collapsed, cut to SUBMISSION_TEXT_MAX. Idempotent.
|
|
894
1437
|
*/
|
|
895
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;
|