@ixo/action-protocol 0.7.0 → 0.9.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/src/index.d.ts CHANGED
@@ -296,12 +296,171 @@ export type ActionCapabilitiesV1 = {
296
296
  chainTx?: ChainTxCapabilities | null;
297
297
  };
298
298
 
299
- /** 0.6.0: one card kind for every chain transaction. */
300
- export type ChainTxMessageType =
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.9.0: the four DAO DAO group types wire level 7 adds. */
337
+ export type ChainTxGroupMessageType =
338
+ | "daodao.proposal.vote"
339
+ | "daodao.proposal.execute"
340
+ | "daodao.proposal.close"
341
+ | "daodao.proposal.create";
342
+ /** 0.6.0: one card kind for every chain transaction (0.8.0: 33 types; 0.9.0: 37). */
343
+ export type ChainTxMessageType =
344
+ | ChainTxLevel4MessageType
345
+ | ChainTxLevel6MessageType
346
+ | ChainTxGroupMessageType;
347
+ /**
348
+ * 0.9.0 D11: what a group's own account may do in a proposal
349
+ * (`CHAIN_TX_GROUP_ACTION_TYPES`).
350
+ */
351
+ export type ChainTxGroupActionType =
352
+ | "cosmos.bank.send"
353
+ | "ixo.token.transfer"
354
+ | "ixo.token.retire"
355
+ | "cosmos.staking.delegate"
356
+ | "cosmos.staking.undelegate"
357
+ | "cosmos.staking.redelegate"
358
+ | "cosmos.distribution.withdraw-rewards"
359
+ | "cosmos.gov.vote"
360
+ | "ixo.claims.update-collection-state"
361
+ | "ixo.claims.update-collection-dates"
362
+ | "ixo.claims.update-collection-quota"
363
+ | "ixo.claims.create-collection"
364
+ | "ixo.entity.create-account"
365
+ | "ixo.entity.revoke-account-authz";
366
+ /** `daodao.proposal.vote` `vote` (single choice). */
367
+ export type ChainTxGroupVoteOption = "yes" | "no" | "abstain";
368
+ /** Receipt `groupActions` of a carry-out. */
369
+ /**
370
+ * `"unknown"`: the transaction succeeded but the Hub found no proof either
371
+ * way in its events (the proposal list's own `action=execute` event for
372
+ * this proposal); never read as done.
373
+ */
374
+ export type ChainTxGroupActionResult = "done" | "failed" | "unknown";
375
+ /*
376
+ * 0.8.0 shared rules (`chainTxIssue` names the first bad field, nested
377
+ * fields by path, e.g. `messages[0].payments.approval.amount[1].denom`):
378
+ * - VALOPER: `ixovaloper1` + 38 bech32 characters (the Hub checks the checksum);
379
+ * - ENTITY_DID: `did:ixo:entity:` + 32 lowercase hex;
380
+ * - INSTANT: RFC 3339 with `Z` or an offset, at most milliseconds, a real
381
+ * calendar date, and in UTC between 1970-01-01T00:00:00Z and the end of 9999;
382
+ * - UINT64_TEXT: a uint64 in decimal without leading zeros;
383
+ * - PLAIN_TEXT(n): 1..n characters, not blank, no control, zero-width or
384
+ * bidi characters;
385
+ * - SHOWN_AS_IS: free text published on chain (a retirement `reason`, a
386
+ * linked resource's or claim's `description` and `right`) must be exactly
387
+ * what the review page shows: `sanitizePublishedText(value) === value`
388
+ * (no control or invisible characters, no real link, single spaces, no
389
+ * space at either end; a file name such as "Annual Report.pdf" is fine);
390
+ * - links: `https://` with a host and no user info (or `ipfs://<CID>` where
391
+ * allowed), ≤ 300, no whitespace or backslashes.
392
+ * Signer-derived chain fields (owner, delegator, voter, signer, agent or
393
+ * creator address, controller/owner address) are never wire keys: the Hub
394
+ * fills them from `signer`.
395
+ */
396
+ export type ChainTxVoteOption = "yes" | "no" | "abstain" | "no_with_veto";
397
+ export type ChainTxDisputeReason =
398
+ | "not_as_asked"
399
+ | "not_delivered"
400
+ | "check_wrong"
401
+ | "other";
402
+ export type ChainTxCollectionState = "open" | "paused" | "closed";
403
+ export type ChainTxReservationMode = "allow" | "deny" | "required";
404
+ export type ChainTxClaimRole = "file-claims" | "check-claims";
405
+ export type ChainTxEntityPermission =
406
+ | "change-collection-state"
407
+ | "change-collection-dates"
408
+ | "change-collection-quota"
409
+ | "change-collection-payments"
410
+ | "authorize-claim-agents"
411
+ | ChainTxClaimRole;
412
+ export type ChainTxPaymentLegName =
413
+ | "submission"
414
+ | "evaluation"
415
+ | "approval"
416
+ | "rejection";
417
+ /** A coin in base units; `denom` matches `DENOM`. */
418
+ export type ChainTxCoin = { denom: string; amountBaseUnits: string };
419
+ export type ChainTxPaymentLeg = {
420
+ /** 0..4 coins, distinct denoms; [] = no payment. */
421
+ amount: ChainTxCoin[];
422
+ /** 0..31536000; 0 or absent pays at once, > 0 lets the recipient collect it after that many seconds. */
423
+ payAfterSeconds?: number;
424
+ };
425
+ /**
426
+ * Collection payments. The Hub fills each leg's paying account (an entity
427
+ * account); CW20/CW1155 payments are not offered.
428
+ * - `ixo.claims.create-collection`: a missing leg pays nothing.
429
+ * - `ixo.claims.update-collection-payments`: a missing leg keeps exactly
430
+ * what it pays now (amounts, delay, paying account, any CW20/CW1155
431
+ * payments); `{amount: []}` makes a leg pay nothing. A listed leg replaces
432
+ * that leg, and the Hub refuses to replace a leg that pays CW20/CW1155
433
+ * tokens (`token_payments_present`), which a card cannot show or keep.
434
+ */
435
+ export type ChainTxPayments = {
436
+ /** Paid to the filer when a claim is filed. */
437
+ submission?: ChainTxPaymentLeg;
438
+ /** Paid to the checker for each check. */
439
+ evaluation?: ChainTxPaymentLeg;
440
+ /** Paid to the filer on approval; `networkSplit` shares it with the network and the oracle (absent on an update = keep the current value). */
441
+ approval?: ChainTxPaymentLeg & { networkSplit?: boolean };
442
+ /** Paid to the filer on rejection. */
443
+ rejection?: ChainTxPaymentLeg;
444
+ };
445
+ /** A token line of `ixo.token.transfer` / `ixo.token.retire`. */
446
+ export type ChainTxTokenLine = {
447
+ /** 1..128 of ^[A-Za-z0-9:._/-]+$ */
448
+ id: string;
449
+ /** ^[1-9][0-9]*$ (≤ 78 digits) */
450
+ amount: string;
451
+ };
452
+ /**
453
+ * An x/iid item id to add: `{id}#name` (Portal's literal form) or
454
+ * `did:ixo:<1..160 of [A-Za-z0-9._:%-]>#name`, name 1..64 of [A-Za-z0-9._~:-].
455
+ */
456
+ export type ChainTxIidItemId = string;
457
+ /**
458
+ * The id of an x/iid item to remove, exactly as the document holds it
459
+ * (`#api`, `{id}#ixo1…`, ids without `#`): 1..300 characters, no whitespace,
460
+ * control, zero-width or bidi characters. The Hub reads the document and
461
+ * refuses an id that is not there.
462
+ */
463
+ export type ChainTxIidRemoveId = string;
305
464
  /**
306
465
  * Field rules (`chainTxIssue` names the first bad field):
307
466
  * - addresses: a 20-byte ixo account address, `ixo1` + 38 bech32 characters
@@ -311,7 +470,7 @@ export type ChainTxMessageType =
311
470
  * - claim ids, token ids and verification proofs: ^[A-Za-z0-9:._/-]+$;
312
471
  * - collectionId: a uint64 without leading zeros.
313
472
  */
314
- export type ChainTxMessage =
473
+ export type ChainTxLevel6Message =
315
474
  | {
316
475
  type: "cosmos.bank.send";
317
476
  toAddress: string;
@@ -364,7 +523,373 @@ export type ChainTxMessage =
364
523
  recipient: string;
365
524
  /** 1..32 lines; id 1..128 of ^[A-Za-z0-9:._/-]+$, amount ^[1-9][0-9]*$ */
366
525
  tokens: Array<{ id: string; amount: string }>;
526
+ }
527
+ // ---- 0.8.0 (wire level 6) ----
528
+ | {
529
+ /** Burns impact tokens the signer holds, for good (MsgRetireToken). */
530
+ type: "ixo.token.retire";
531
+ /** 1..32 lines, all of one token class (the chain refuses mixed classes). */
532
+ tokens: ChainTxTokenLine[];
533
+ /** `Global`, or `CC[-SUB[ POSTAL]]`: ^[A-Z]{2}(?:-[A-Za-z0-9]{1,3}(?: [A-Za-z0-9]{1,64})?)?$ */
534
+ jurisdiction: string;
535
+ /** PLAIN_TEXT(200) and SHOWN_AS_IS, e.g. `offset`. */
536
+ reason: string;
537
+ }
538
+ | {
539
+ /** Stakes IXO with a validator (MsgDelegate); denom is always uixo. */
540
+ type: "cosmos.staking.delegate";
541
+ /** VALOPER */
542
+ validatorAddress: string;
543
+ /** uixo, ^[1-9][0-9]*$ */
544
+ amountBaseUnits: string;
545
+ }
546
+ | {
547
+ /** Starts unstaking (MsgUndelegate); back after the unbonding period. */
548
+ type: "cosmos.staking.undelegate";
549
+ validatorAddress: string;
550
+ amountBaseUnits: string;
551
+ }
552
+ | {
553
+ /** Moves stake between validators at once (MsgBeginRedelegate). */
554
+ type: "cosmos.staking.redelegate";
555
+ fromValidatorAddress: string;
556
+ /** VALOPER, different from `fromValidatorAddress`. */
557
+ toValidatorAddress: string;
558
+ amountBaseUnits: string;
559
+ }
560
+ | {
561
+ /** Claims the staking rewards earned with one validator. */
562
+ type: "cosmos.distribution.withdraw-rewards";
563
+ validatorAddress: string;
564
+ }
565
+ | {
566
+ /** Votes on a governance proposal (gov v1 MsgVote; a later vote replaces it). */
567
+ type: "cosmos.gov.vote";
568
+ /** UINT64_TEXT ≥ 1 */
569
+ proposalId: string;
570
+ option: ChainTxVoteOption;
571
+ }
572
+ | {
573
+ /** Reserves a collection's payment before filing a claim (MsgClaimIntent). */
574
+ type: "ixo.claims.claim-intent";
575
+ collectionId: string;
576
+ /** The signer's own DID (Hub policy). */
577
+ agentDid: string;
578
+ }
579
+ | {
580
+ /** Opens a dispute about a claim (MsgDisputeClaim); may take the collection's deposit. */
581
+ type: "ixo.claims.dispute";
582
+ /** 1..256 of ^[A-Za-z0-9:._/-]+$ */
583
+ claimId: string;
584
+ /** The claim's collection (the Hub checks it). */
585
+ collectionId: string;
586
+ /** The signer's own DID (Hub policy). */
587
+ agentDid: string;
588
+ /** dispute_type 1..4; `check_wrong` targets the checker, the rest the filer. */
589
+ reason: ChainTxDisputeReason;
590
+ /** An already stored statement. */
591
+ evidence: {
592
+ /** https:// or ipfs:// link, ≤ 300 */
593
+ uri: string;
594
+ /** ^[A-Za-z0-9][A-Za-z0-9.+/_-]{0,99}$, e.g. `eval-engine/v1` */
595
+ type: string;
596
+ /** 1..300 of ^[A-Za-z0-9:._/-]+$ */
597
+ proof: string;
598
+ encrypted?: boolean;
599
+ };
600
+ }
601
+ | {
602
+ /** Opens, pauses or closes a collection (MsgExec under the admin's grant). */
603
+ type: "ixo.claims.update-collection-state";
604
+ collectionId: string;
605
+ /** The collection's admin account; the Hub checks it against the collection (D3). */
606
+ adminAddress: string;
607
+ state: ChainTxCollectionState;
608
+ }
609
+ | {
610
+ /** Changes when a collection takes claims (MsgExec). At least one date. */
611
+ type: "ixo.claims.update-collection-dates";
612
+ collectionId: string;
613
+ adminAddress: string;
614
+ /** INSTANT; absent = keep the current start. */
615
+ startDate?: string;
616
+ /** INSTANT, or null = no end date; absent = keep. After a given start. */
617
+ endDate?: string | null;
618
+ }
619
+ | {
620
+ /** Changes how many claims a collection takes in total (MsgExec). */
621
+ type: "ixo.claims.update-collection-quota";
622
+ collectionId: string;
623
+ adminAddress: string;
624
+ /** UINT64_TEXT; "0" = no limit. */
625
+ maxClaims: string;
626
+ }
627
+ | ({
628
+ /** Lets an account file or check claims in a collection (MsgExec). */
629
+ type: "ixo.claims.create-claim-authorization";
630
+ collectionId: string;
631
+ adminAddress: string;
632
+ granteeAddress: string;
633
+ /** "1".."1000000000" */
634
+ maxClaims: string;
635
+ /** INSTANT; absent = keep the existing grant's expiry, else none (Hub rule). */
636
+ expiresAt?: string;
637
+ /** The signer's own DID (Hub policy). */
638
+ creatorDid: string;
639
+ } & (
640
+ | { role: "file-claims"; reservationSeconds?: number; decideBefore?: never }
641
+ | { role: "check-claims"; decideBefore?: string; reservationSeconds?: never }
642
+ ))
643
+ | {
644
+ /** Changes what a collection pays (MsgExec); legs left out keep what they pay. */
645
+ type: "ixo.claims.update-collection-payments";
646
+ collectionId: string;
647
+ adminAddress: string;
648
+ payments: ChainTxPayments;
649
+ }
650
+ | {
651
+ /** Creates a claim collection for an entity the signer owns. */
652
+ type: "ixo.claims.create-collection";
653
+ /** ENTITY_DID */
654
+ entityId: string;
655
+ /** The protocol (kind of claim) DID. */
656
+ protocolId: string;
657
+ /** INSTANT */
658
+ startDate: string;
659
+ /** INSTANT after `startDate`, or null = no end date (the key is required). */
660
+ endDate: string | null;
661
+ /** UINT64_TEXT; "0" = no limit. */
662
+ maxClaims: string;
663
+ state: ChainTxCollectionState;
664
+ reservations: ChainTxReservationMode;
665
+ payments: ChainTxPayments;
666
+ }
667
+ | {
668
+ /** Adds a named account to an entity the signer owns. */
669
+ type: "ixo.entity.create-account";
670
+ entityId: string;
671
+ /** ^[A-Za-z0-9](?:[A-Za-z0-9 _-]{0,62}[A-Za-z0-9])?$, not `admin` (any case). */
672
+ name: string;
673
+ }
674
+ | {
675
+ /**
676
+ * Changes an entity's start and/or end date (MsgUpdateEntity; status
677
+ * and credentials are kept by the Hub). At least one date.
678
+ */
679
+ type: "ixo.entity.update";
680
+ entityId: string;
681
+ startDate?: string;
682
+ /** INSTANT, or null = clear it. After a given start. */
683
+ endDate?: string | null;
684
+ /** The signer's own DID (Hub policy). */
685
+ controllerDid: string;
686
+ }
687
+ | {
688
+ /** Removes a permission the entity's admin account gave (the whole grant for that type). */
689
+ type: "ixo.entity.revoke-account-authz";
690
+ entityId: string;
691
+ granteeAddress: string;
692
+ permission: ChainTxEntityPermission;
693
+ }
694
+ | ({
695
+ /** Gives a permission from the entity's admin account. */
696
+ type: "ixo.entity.grant-account-authz";
697
+ entityId: string;
698
+ granteeAddress: string;
699
+ /** INSTANT; absent = keep the existing grant's expiry, else none (Hub rule). */
700
+ expiresAt?: string;
701
+ } & (
702
+ | {
703
+ permission: "file-claims";
704
+ collectionId: string;
705
+ /** "1".."1000000000" */
706
+ maxClaims: string;
707
+ reservationSeconds?: number;
708
+ decideBefore?: never;
709
+ }
710
+ | {
711
+ permission: "check-claims";
712
+ collectionId: string;
713
+ maxClaims: string;
714
+ decideBefore?: string;
715
+ reservationSeconds?: never;
716
+ }
717
+ | {
718
+ permission: Exclude<ChainTxEntityPermission, ChainTxClaimRole>;
719
+ collectionId?: never;
720
+ maxClaims?: never;
721
+ reservationSeconds?: never;
722
+ decideBefore?: never;
723
+ }
724
+ ))
725
+ | {
726
+ /** Creates an entity the signer owns (MsgCreateEntity). */
727
+ type: "ixo.entity.create";
728
+ /** ^[a-z][a-z0-9_-]{0,31}(?:/[a-z][a-z0-9_-]{0,31})?$ */
729
+ entityType: string;
730
+ /** An already stored Profile document: https link ≤ 300 and its proof. */
731
+ profile?: { serviceEndpoint: string; proof: string };
732
+ protocolId?: string;
733
+ startDate?: string;
734
+ /** INSTANT after a given start (no null here). */
735
+ endDate?: string;
736
+ /** The signer's own DID (Hub policy). */
737
+ ownerDid: string;
738
+ }
739
+ | {
740
+ type: "ixo.iid.add-service";
741
+ /** The identity document changed (did:ixo:…). */
742
+ did: string;
743
+ service: {
744
+ id: ChainTxIidItemId;
745
+ /** ^[A-Za-z][A-Za-z0-9._:/-]{0,63}$ */
746
+ type: string;
747
+ /** https:// or ipfs:// link */
748
+ serviceEndpoint: string;
749
+ };
750
+ }
751
+ | { type: "ixo.iid.delete-service"; did: string; serviceId: ChainTxIidRemoveId }
752
+ | {
753
+ type: "ixo.iid.add-linked-resource";
754
+ did: string;
755
+ resource: {
756
+ id: ChainTxIidItemId;
757
+ /** ^[A-Za-z][A-Za-z0-9._:/+-]{0,63}$ */
758
+ type: string;
759
+ /** 0..300 characters, SHOWN_AS_IS ("" allowed). */
760
+ description: string;
761
+ /** ^[a-z]+/[A-Za-z0-9.+-]{1,90}$, ≤ 128 */
762
+ mediaType: string;
763
+ serviceEndpoint: string;
764
+ /** "" or 1..300 of ^[A-Za-z0-9:._/-]+$ */
765
+ proof: string;
766
+ encrypted: boolean;
767
+ /** "" or PLAIN_TEXT(300), SHOWN_AS_IS */
768
+ right?: string;
769
+ };
770
+ }
771
+ | {
772
+ type: "ixo.iid.delete-linked-resource";
773
+ did: string;
774
+ resourceId: ChainTxIidRemoveId;
775
+ }
776
+ | {
777
+ type: "ixo.iid.add-linked-claim";
778
+ did: string;
779
+ claim: {
780
+ /** 1..256 of ^[A-Za-z0-9:._/-]+$ */
781
+ id: string;
782
+ type: string;
783
+ /** As a linked resource's: "" allowed, ≤ 300, SHOWN_AS_IS. */
784
+ description: string;
785
+ serviceEndpoint: string;
786
+ /** "" or 1..300 of ^[A-Za-z0-9:._/-]+$ */
787
+ proof: string;
788
+ encrypted: boolean;
789
+ /** "" or PLAIN_TEXT(300), SHOWN_AS_IS */
790
+ right?: string;
791
+ };
792
+ }
793
+ | { type: "ixo.iid.delete-linked-claim"; did: string; claimId: ChainTxIidRemoveId }
794
+ | {
795
+ type: "ixo.iid.add-linked-entity";
796
+ did: string;
797
+ entity: {
798
+ /**
799
+ * did:ixo:…, an ixo account (20-byte) or contract (32-byte) address,
800
+ * or Portal's `{id}#<address>` (the Hub checks the checksum).
801
+ */
802
+ id: string;
803
+ type: string;
804
+ /** ^[A-Za-z][A-Za-z0-9_-]{0,63}$, e.g. `member`, `Governs` */
805
+ relationship: string;
806
+ /** "" (none), a service name or a reference to one: ^(?:(?:\{id\}|did:ixo:…)#)?[A-Za-z0-9._~:-]{1,64}$ */
807
+ service?: string;
808
+ };
809
+ }
810
+ | { type: "ixo.iid.delete-linked-entity"; did: string; entityId: ChainTxIidRemoveId }
811
+ | {
812
+ type: "ixo.iid.add-context";
813
+ did: string;
814
+ context: {
815
+ /** ^[A-Za-z][A-Za-z0-9_-]{0,63}$ */
816
+ key: string;
817
+ /** An https link or a did:ixo DID, ≤ 300. */
818
+ val: string;
819
+ };
820
+ }
821
+ | { type: "ixo.iid.delete-context"; did: string; key: ChainTxIidRemoveId };
822
+ /**
823
+ * 0.9.0 D11: one action a group's own account does if a proposal passes:
824
+ * exactly a top-level message of a `ChainTxGroupActionType` (same keys and
825
+ * rules; none names the person, and the Hub sets every signer field to the
826
+ * group). A collection dates change names both dates (`endDate` may be
827
+ * null), because a date left out would be read when the card is made and be
828
+ * stale when the group carries it out.
829
+ */
830
+ export type ChainTxGroupAction =
831
+ | Exclude<
832
+ Extract<ChainTxLevel6Message, { type: ChainTxGroupActionType }>,
833
+ { type: "ixo.claims.update-collection-dates" }
834
+ >
835
+ | {
836
+ type: "ixo.claims.update-collection-dates";
837
+ collectionId: string;
838
+ adminAddress: string;
839
+ /** INSTANT */
840
+ startDate: string;
841
+ /** INSTANT after `startDate`, or null = no end date. */
842
+ endDate: string | null;
367
843
  };
844
+ /*
845
+ * 0.9.0 (wire level 7) group rules, DAO DAO v2.0.3 single-choice proposals:
846
+ * - CONTRACT_ADDRESS (`dao`, `proposalModule`): a 32-byte contract address,
847
+ * `ixo1` + 58 bech32 characters (the Hub checks the checksum); `dao` is the
848
+ * group's core contract, `proposalModule` one of its proposal lists (a
849
+ * different contract). The Hub derives the proposal intake from it (D17).
850
+ * - PROPOSAL_ID: decimal text without leading zeros, 1..9007199254740991
851
+ * (the Hub writes it as a JSON number, D16).
852
+ * - Text (`title` ≤ 100, `description` ≤ 300, `rationale` ≤ 300):
853
+ * PLAIN_TEXT and SHOWN_AS_IS (published on chain, shown whole).
854
+ * - A card with a group step holds exactly that one message (D5), else
855
+ * `invalid_operation: messages`.
856
+ */
857
+ export type ChainTxGroupMessage =
858
+ | {
859
+ /** Casts the person's vote on a group proposal. */
860
+ type: "daodao.proposal.vote";
861
+ dao: string;
862
+ proposalModule: string;
863
+ proposalId: string;
864
+ vote: ChainTxGroupVoteOption;
865
+ /** Published with the vote. */
866
+ rationale?: string;
867
+ }
868
+ | {
869
+ /** Carries out a passed proposal: the group's own account does its actions. */
870
+ type: "daodao.proposal.execute";
871
+ dao: string;
872
+ proposalModule: string;
873
+ proposalId: string;
874
+ }
875
+ | {
876
+ /** Closes a proposal that did not pass. */
877
+ type: "daodao.proposal.close";
878
+ dao: string;
879
+ proposalModule: string;
880
+ proposalId: string;
881
+ }
882
+ | {
883
+ /** Asks the group to vote on a new proposal (the Hub adds any deposit). */
884
+ type: "daodao.proposal.create";
885
+ dao: string;
886
+ proposalModule: string;
887
+ title: string;
888
+ description: string;
889
+ /** 0..4 (`CHAIN_TX_MAX_GROUP_ACTIONS`); [] = a text-only proposal. */
890
+ actions: ChainTxGroupAction[];
891
+ };
892
+ export type ChainTxMessage = ChainTxLevel6Message | ChainTxGroupMessage;
368
893
  export type ChainTxOperation = {
369
894
  kind: "ixo.chain.tx.v1";
370
895
  /** Must equal the Hub RPC's chain id at prepare. */
@@ -397,6 +922,36 @@ export type ChainTxStep = {
397
922
  cannotUndo: boolean;
398
923
  /** cosmos.bank.send steps: the bank-send display (verified/unverified token rules). */
399
924
  transfer?: TransferDisplay;
925
+ /**
926
+ * 0.9.0 D13: required on `daodao.proposal.create` (its 0..4 actions, in
927
+ * order) and `daodao.proposal.execute` (the passed proposal's actions, at
928
+ * most 10 shown); `[]` for none. Absent on every other step. The step's
929
+ * `riskLevel` is at least each action's.
930
+ */
931
+ actions?: ChainTxGroupActionDisplay[];
932
+ /**
933
+ * 0.9.0, `daodao.proposal.create` only: the proposal list's prefix (1-4
934
+ * capital letters), so the result names the new proposal as the cards do
935
+ * ("proposal A4" from the receipt's `proposalId` "4"). Absent when the
936
+ * list has none (the plain number is the label).
937
+ */
938
+ proposalPrefix?: string;
939
+ };
940
+ /** 0.9.0: one action the group's own account would do, in plain words. */
941
+ export type ChainTxGroupActionDisplay = {
942
+ /**
943
+ * create: the wire action's type (a `ChainTxGroupActionType`); execute:
944
+ * a level-6 type, or null for an action the page cannot explain.
945
+ */
946
+ type: ChainTxLevel4MessageType | ChainTxLevel6MessageType | null;
947
+ /** ≤ 60, plain words. */
948
+ title: string;
949
+ /** One sentence, ≤ 160. */
950
+ whatItDoes: string;
951
+ /** ≤ 12. */
952
+ facts: ChainTxFact[];
953
+ riskLevel: ChainTxRiskLevel;
954
+ cannotUndo: boolean;
400
955
  };
401
956
  export type ChainTxDisplay = {
402
957
  /** The highest step risk. */
@@ -438,19 +993,257 @@ export type ChainTxReceipt = {
438
993
  /** ≤ 240, plain words for the person; only with a `reason`. */
439
994
  message?: string;
440
995
  /** The approved messages' types, in order. */
441
- steps: Array<{ type: ChainTxMessageType }>;
996
+ steps: ChainTxReceiptStep[];
442
997
  };
998
+ /**
999
+ * 0.9.0: on a succeeded receipt (included, code 0) a `daodao.proposal.create`
1000
+ * step has `proposalId` (PROPOSAL_ID, or null when the Hub could not read
1001
+ * it; never guessed) and a `daodao.proposal.execute` step has `groupActions`
1002
+ * (whether the group's actions ran: tx code 0 alone does not say so). Both
1003
+ * are absent on every other receipt.
1004
+ */
1005
+ export type ChainTxReceiptStep =
1006
+ | {
1007
+ type: Exclude<
1008
+ ChainTxMessageType,
1009
+ "daodao.proposal.create" | "daodao.proposal.execute"
1010
+ >;
1011
+ }
1012
+ | { type: "daodao.proposal.create"; proposalId?: string | null }
1013
+ | { type: "daodao.proposal.execute"; groupActions?: ChainTxGroupActionResult };
443
1014
  export type ChainTxCapabilities = {
444
1015
  messageTypes: ChainTxMessageType[];
445
1016
  maxMessages: number;
446
1017
  };
447
1018
  export declare const CHAIN_TX_KIND: "ixo.chain.tx.v1";
1019
+ /** 0.8.0: exactly the four 0.6.0 types (what levels 4 and 5 may see), frozen. */
1020
+ export declare const CHAIN_TX_LEVEL4_MESSAGE_TYPES: readonly [
1021
+ "cosmos.bank.send",
1022
+ "ixo.claims.submit",
1023
+ "ixo.claims.evaluate",
1024
+ "ixo.token.transfer",
1025
+ ];
1026
+ /** 0.9.0: the 33 types of wire level 6 (the four, then the 29 of 0.8.0), frozen. */
1027
+ export declare const CHAIN_TX_LEVEL6_MESSAGE_TYPES: readonly [
1028
+ "cosmos.bank.send",
1029
+ "ixo.claims.submit",
1030
+ "ixo.claims.evaluate",
1031
+ "ixo.token.transfer",
1032
+ "ixo.token.retire",
1033
+ "cosmos.staking.delegate",
1034
+ "cosmos.staking.undelegate",
1035
+ "cosmos.staking.redelegate",
1036
+ "cosmos.distribution.withdraw-rewards",
1037
+ "cosmos.gov.vote",
1038
+ "ixo.claims.claim-intent",
1039
+ "ixo.claims.dispute",
1040
+ "ixo.claims.update-collection-state",
1041
+ "ixo.claims.update-collection-dates",
1042
+ "ixo.claims.update-collection-quota",
1043
+ "ixo.claims.create-claim-authorization",
1044
+ "ixo.claims.update-collection-payments",
1045
+ "ixo.claims.create-collection",
1046
+ "ixo.entity.create-account",
1047
+ "ixo.entity.update",
1048
+ "ixo.entity.revoke-account-authz",
1049
+ "ixo.entity.grant-account-authz",
1050
+ "ixo.entity.create",
1051
+ "ixo.iid.add-service",
1052
+ "ixo.iid.delete-service",
1053
+ "ixo.iid.add-linked-resource",
1054
+ "ixo.iid.delete-linked-resource",
1055
+ "ixo.iid.add-linked-claim",
1056
+ "ixo.iid.delete-linked-claim",
1057
+ "ixo.iid.add-linked-entity",
1058
+ "ixo.iid.delete-linked-entity",
1059
+ "ixo.iid.add-context",
1060
+ "ixo.iid.delete-context",
1061
+ ];
1062
+ /** 0.9.0: the four group types of wire level 7, frozen. */
1063
+ export declare const CHAIN_TX_GROUP_MESSAGE_TYPES: readonly [
1064
+ "daodao.proposal.vote",
1065
+ "daodao.proposal.execute",
1066
+ "daodao.proposal.close",
1067
+ "daodao.proposal.create",
1068
+ ];
1069
+ /**
1070
+ * Every type this package parses (the 33 of level 6, then the four group
1071
+ * types of 0.9.0), frozen. What a caller may see or create:
1072
+ * `chainTxMessageTypesForLevel(level)`.
1073
+ */
448
1074
  export declare const CHAIN_TX_MESSAGE_TYPES: readonly [
449
1075
  "cosmos.bank.send",
450
1076
  "ixo.claims.submit",
451
1077
  "ixo.claims.evaluate",
452
1078
  "ixo.token.transfer",
1079
+ "ixo.token.retire",
1080
+ "cosmos.staking.delegate",
1081
+ "cosmos.staking.undelegate",
1082
+ "cosmos.staking.redelegate",
1083
+ "cosmos.distribution.withdraw-rewards",
1084
+ "cosmos.gov.vote",
1085
+ "ixo.claims.claim-intent",
1086
+ "ixo.claims.dispute",
1087
+ "ixo.claims.update-collection-state",
1088
+ "ixo.claims.update-collection-dates",
1089
+ "ixo.claims.update-collection-quota",
1090
+ "ixo.claims.create-claim-authorization",
1091
+ "ixo.claims.update-collection-payments",
1092
+ "ixo.claims.create-collection",
1093
+ "ixo.entity.create-account",
1094
+ "ixo.entity.update",
1095
+ "ixo.entity.revoke-account-authz",
1096
+ "ixo.entity.grant-account-authz",
1097
+ "ixo.entity.create",
1098
+ "ixo.iid.add-service",
1099
+ "ixo.iid.delete-service",
1100
+ "ixo.iid.add-linked-resource",
1101
+ "ixo.iid.delete-linked-resource",
1102
+ "ixo.iid.add-linked-claim",
1103
+ "ixo.iid.delete-linked-claim",
1104
+ "ixo.iid.add-linked-entity",
1105
+ "ixo.iid.delete-linked-entity",
1106
+ "ixo.iid.add-context",
1107
+ "ixo.iid.delete-context",
1108
+ "daodao.proposal.vote",
1109
+ "daodao.proposal.execute",
1110
+ "daodao.proposal.close",
1111
+ "daodao.proposal.create",
453
1112
  ];
1113
+ /** The wire level that adds the 29 types of 0.8.0. */
1114
+ export declare const CHAIN_TX_LEVEL6: 6;
1115
+ /** The wire level that adds the four group types of 0.9.0. */
1116
+ export declare const CHAIN_TX_LEVEL7: 7;
1117
+ /**
1118
+ * The chain tx message types a caller at wire `level` (a positive integer)
1119
+ * may see and create: none below 4, `CHAIN_TX_LEVEL4_MESSAGE_TYPES` at 4
1120
+ * and 5, `CHAIN_TX_LEVEL6_MESSAGE_TYPES` at 6, `CHAIN_TX_MESSAGE_TYPES`
1121
+ * from 7. Throws `TypeError` on a non-integer or a level below 1.
1122
+ */
1123
+ export declare function chainTxMessageTypesForLevel(
1124
+ level: number,
1125
+ ): readonly ChainTxMessageType[];
1126
+ /** 0.9.0 D11: the action types a group proposal may hold, frozen. */
1127
+ export declare const CHAIN_TX_GROUP_ACTION_TYPES: readonly ChainTxGroupActionType[];
1128
+ /** 0.9.0 D12: actions per new proposal. */
1129
+ export declare const CHAIN_TX_MAX_GROUP_ACTIONS: 4;
1130
+ /** 0.9.0: actions shown on a carry-out step. */
1131
+ export declare const CHAIN_TX_MAX_SHOWN_GROUP_ACTIONS: 10;
1132
+ export declare const CHAIN_TX_GROUP_VOTE_OPTIONS: readonly ChainTxGroupVoteOption[];
1133
+ export declare const CHAIN_TX_GROUP_ACTION_RESULTS: readonly ChainTxGroupActionResult[];
1134
+ export declare const CHAIN_TX_VOTE_OPTIONS: readonly ChainTxVoteOption[];
1135
+ export declare const CHAIN_TX_DISPUTE_REASONS: readonly ChainTxDisputeReason[];
1136
+ export declare const CHAIN_TX_COLLECTION_STATES: readonly ChainTxCollectionState[];
1137
+ export declare const CHAIN_TX_RESERVATION_MODES: readonly ChainTxReservationMode[];
1138
+ export declare const CHAIN_TX_CLAIM_ROLES: readonly ChainTxClaimRole[];
1139
+ export declare const CHAIN_TX_ENTITY_PERMISSIONS: readonly ChainTxEntityPermission[];
1140
+ export declare const CHAIN_TX_PAYMENT_LEGS: readonly ChainTxPaymentLegName[];
1141
+ export declare const CHAIN_TX_MAX_PAYMENT_COINS: 4;
1142
+ export declare const CHAIN_TX_MAX_SECONDS: 31536000;
1143
+ export declare const CHAIN_TX_MAX_CLAIM_PERMISSION: 1000000000;
1144
+ /**
1145
+ * 0.8.0: why the Hub would not make a chain tx card from what it read on
1146
+ * chain or what the node's simulation said about one message. The 400's
1147
+ * `reason` is then `invalid_message: messages[<i>].<field>: <code>`
1148
+ * (`error` is `operation_not_registered` for a Hub read, `simulation_failed`
1149
+ * for the node's simulation). A reason without `: <code>` is a shape the
1150
+ * parser refused, as in 0.6.0. Map codes to your own words; treat an
1151
+ * unknown code like none.
1152
+ */
1153
+ export type ChainTxRefusalCode =
1154
+ | "validator_not_found"
1155
+ | "no_stake"
1156
+ | "stake_too_small"
1157
+ | "same_validator"
1158
+ | "invalid_amount"
1159
+ | "nothing_to_collect"
1160
+ | "proposal_not_found"
1161
+ | "proposal_not_open"
1162
+ | "invalid_vote_option"
1163
+ | "token_not_found"
1164
+ | "collection_not_found"
1165
+ | "reservations_off"
1166
+ | "reservation_exists"
1167
+ | "claim_not_found"
1168
+ | "claim_in_other_collection"
1169
+ | "wrong_admin"
1170
+ | "already_in_state"
1171
+ | "start_date_missing"
1172
+ | "end_before_start"
1173
+ | "quota_below_count"
1174
+ | "token_payments_present"
1175
+ | "ends_too_soon"
1176
+ | "deadline_too_soon"
1177
+ | "current_permission_ends_too_soon"
1178
+ | "unlimited_permission_exists"
1179
+ | "other_permission_exists"
1180
+ | "too_many_constraints"
1181
+ | "no_such_permission"
1182
+ | "collection_of_other_entity"
1183
+ | "entity_not_found"
1184
+ | "account_name_taken"
1185
+ | "document_not_found"
1186
+ | "nothing_to_remove"
1187
+ | "already_exists"
1188
+ | "invalid_did"
1189
+ | "not_available"
1190
+ | "chain_data_too_large"
1191
+ // 0.9.0 groups (nested proposal actions use their own codes under
1192
+ // `actions[<j>]`, e.g. `actions[1].validatorAddress: validator_not_found`).
1193
+ /** `dao`/`proposalModule`: another contract version, multiple choice, an approval step. */
1194
+ | "group_not_supported"
1195
+ /** `proposalModule`: not an enabled proposal list of this group. */
1196
+ | "not_in_group"
1197
+ /** `dao`: the group is paused (carrying out a proposal with actions). */
1198
+ | "group_paused"
1199
+ /** `proposalId`: the person had no vote when the proposal started. */
1200
+ | "no_voting_power"
1201
+ /** `proposalId`: already voted, and the group doesn't allow changing votes. */
1202
+ | "already_voted"
1203
+ /** `vote`: already voted this way. */
1204
+ | "same_vote"
1205
+ /** `proposalId` (carry out) / `dao` (create): members only. */
1206
+ | "not_a_member"
1207
+ /** `proposalId`: it hasn't passed (yet, or at all). */
1208
+ | "proposal_not_passed"
1209
+ /** `proposalId`: only proposals that did not pass can be closed. */
1210
+ | "proposal_not_rejected"
1211
+ /** `proposalId`: run now, the group's actions would fail and the proposal be marked failed for good. */
1212
+ | "group_actions_would_fail"
1213
+ /** `dao`: the deposit is in a token a card can't pay. */
1214
+ | "deposit_not_supported"
1215
+ /** `description`: over the group's proposal size limit. */
1216
+ | "proposal_too_large"
1217
+ /** `actions[<j>].type`: the group can't do this kind of action through a card. */
1218
+ | "not_for_groups"
1219
+ /** `actions[<j>].entityId`: the group doesn't own this entity. */
1220
+ | "not_group_owned"
1221
+ /** `dao`/`proposalModule`: no contract there, or another kind of group contract (e.g. the two swapped). */
1222
+ | "group_not_found"
1223
+ /** `proposalModule`: the group has switched this proposal list off (nothing in it can be carried out). */
1224
+ | "list_disabled"
1225
+ /** `proposalId`: voting closes before the card could be signed. */
1226
+ | "closes_too_soon"
1227
+ /** `dao`: the group is not taking new proposals right now. */
1228
+ | "group_inactive"
1229
+ /** `dao`: the group's deposit changed while the card was being made. */
1230
+ | "deposit_changed";
1231
+ export declare const CHAIN_TX_REFUSAL_CODES: readonly ChainTxRefusalCode[];
1232
+ export type ChainTxRefusal = {
1233
+ /** The message index (0..7). */
1234
+ index: number;
1235
+ /** The field or path, e.g. `validatorAddress`, `payments.approval`, `actions[1].toAddress`. */
1236
+ field: string;
1237
+ /** Null when the reason has no code, or one this package does not know. */
1238
+ code: ChainTxRefusalCode | null;
1239
+ };
1240
+ /**
1241
+ * 0.8.0: a chain tx refusal `reason` as `{index, field, code}`, or null when
1242
+ * it does not name a message field.
1243
+ */
1244
+ export declare function parseChainTxRefusal(
1245
+ reason: string | null | undefined,
1246
+ ): ChainTxRefusal | null;
454
1247
  export declare const CHAIN_TX_MAX_MESSAGES: 8;
455
1248
  export declare const CHAIN_TX_MAX_TOKEN_LINES: 32;
456
1249
  export declare const CHAIN_TX_FAILURE_REASONS: readonly [
@@ -893,3 +1686,16 @@ export declare const SUBMISSION_TEXT_MAX: 500;
893
1686
  * `[link]`, whitespace is collapsed, cut to SUBMISSION_TEXT_MAX. Idempotent.
894
1687
  */
895
1688
  export declare function sanitizeSubmissionText(text: string): string;
1689
+ /**
1690
+ * 0.8.0: a raw value (id, address, type URL) for a technical fact: control
1691
+ * characters become spaces and invisible or bidi characters are dropped
1692
+ * (the sanitizer's sets); nothing link-like is replaced, nothing is cut.
1693
+ */
1694
+ export declare function stripHiddenCharacters(text: string): string;
1695
+ /**
1696
+ * 0.8.0: free text published on chain as the review page shows it
1697
+ * (SHOWN_AS_IS): as sanitizeSubmissionText, but only real links (a scheme,
1698
+ * www., an email address, a host followed by a path) become `[link]`, so a
1699
+ * file name such as "Annual Report.pdf" stays. Idempotent.
1700
+ */
1701
+ export declare function sanitizePublishedText(text: string): string;