@verana-labs/verana-types 0.10.1-dev.2 → 0.10.1-dev.21

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.
Files changed (140) hide show
  1. package/README.md +1 -1
  2. package/dist/amino-converter/co.d.ts +3 -0
  3. package/dist/amino-converter/co.js +164 -0
  4. package/dist/amino-converter/cs.d.ts +7 -0
  5. package/dist/amino-converter/cs.js +169 -0
  6. package/dist/amino-converter/de.d.ts +3 -0
  7. package/dist/amino-converter/de.js +51 -0
  8. package/dist/amino-converter/di.d.ts +2 -0
  9. package/dist/amino-converter/di.js +23 -0
  10. package/dist/amino-converter/ec.d.ts +4 -0
  11. package/dist/amino-converter/ec.js +63 -0
  12. package/dist/amino-converter/gf.d.ts +3 -0
  13. package/dist/amino-converter/gf.js +48 -0
  14. package/dist/amino-converter/group.d.ts +3 -0
  15. package/dist/amino-converter/group.js +91 -0
  16. package/dist/amino-converter/pp.d.ts +13 -0
  17. package/dist/amino-converter/pp.js +347 -0
  18. package/dist/amino-converter/td.d.ts +4 -0
  19. package/dist/amino-converter/td.js +46 -0
  20. package/dist/amino-converter/util/helpers.d.ts +30 -0
  21. package/dist/amino-converter/util/helpers.js +88 -0
  22. package/dist/amino-converter/xr.d.ts +6 -0
  23. package/dist/amino-converter/xr.js +106 -0
  24. package/dist/codec/cosmos/base/v1beta1/coin.d.ts +1 -1
  25. package/dist/codec/google/protobuf/any.d.ts +143 -0
  26. package/dist/codec/{verana/dd/v1/params.js → google/protobuf/any.js} +46 -39
  27. package/dist/codec/google/protobuf/descriptor.d.ts +5 -0
  28. package/dist/codec/google/protobuf/descriptor.js +16 -2
  29. package/dist/codec/google/protobuf/timestamp.d.ts +3 -3
  30. package/dist/codec/verana/{perm/module → co/module/v1}/module.d.ts +5 -2
  31. package/dist/codec/verana/{perm/module → co/module/v1}/module.js +2 -2
  32. package/dist/codec/verana/co/v1/genesis.d.ts +28 -0
  33. package/dist/codec/verana/{dd → co}/v1/genesis.js +11 -11
  34. package/dist/codec/verana/co/v1/params.d.ts +29 -0
  35. package/dist/codec/verana/co/v1/params.js +81 -0
  36. package/dist/codec/verana/co/v1/query.d.ts +111 -0
  37. package/dist/codec/verana/{dd → co}/v1/query.js +151 -117
  38. package/dist/codec/verana/co/v1/tx.d.ts +172 -0
  39. package/dist/codec/verana/co/v1/tx.js +639 -0
  40. package/dist/codec/verana/co/v1/types.d.ts +60 -0
  41. package/dist/codec/verana/co/v1/types.js +384 -0
  42. package/dist/codec/verana/cs/v1/query.d.ts +57 -5
  43. package/dist/codec/verana/cs/v1/query.js +297 -38
  44. package/dist/codec/verana/cs/v1/tx.d.ts +107 -12
  45. package/dist/codec/verana/cs/v1/tx.js +548 -64
  46. package/dist/codec/verana/cs/v1/types.d.ts +75 -16
  47. package/dist/codec/verana/cs/v1/types.js +419 -82
  48. package/dist/codec/verana/de/v1/genesis.d.ts +7 -0
  49. package/dist/codec/verana/de/v1/genesis.js +57 -2
  50. package/dist/codec/verana/de/v1/query.d.ts +109 -3
  51. package/dist/codec/verana/de/v1/query.js +396 -10
  52. package/dist/codec/verana/de/v1/tx.d.ts +22 -10
  53. package/dist/codec/verana/de/v1/tx.js +16 -16
  54. package/dist/codec/verana/de/v1/types.d.ts +104 -21
  55. package/dist/codec/verana/de/v1/types.js +313 -83
  56. package/dist/codec/verana/di/module/v1/module.d.ts +29 -0
  57. package/dist/codec/verana/di/module/v1/module.js +98 -0
  58. package/dist/codec/verana/{dd → di}/v1/genesis.d.ts +5 -4
  59. package/dist/codec/verana/di/v1/genesis.js +119 -0
  60. package/dist/codec/verana/di/v1/params.d.ts +24 -0
  61. package/dist/codec/verana/di/v1/params.js +81 -0
  62. package/dist/codec/verana/di/v1/query.d.ts +99 -0
  63. package/dist/codec/verana/di/v1/query.js +349 -0
  64. package/dist/codec/verana/di/v1/tx.d.ts +120 -0
  65. package/dist/codec/verana/di/v1/tx.js +409 -0
  66. package/dist/codec/verana/{dd → ec}/module/module.d.ts +1 -1
  67. package/dist/codec/verana/{dd → ec}/module/module.js +2 -2
  68. package/dist/codec/verana/{tr → ec}/v1/genesis.d.ts +10 -12
  69. package/dist/codec/verana/{tr → ec}/v1/genesis.js +16 -56
  70. package/dist/codec/verana/{tr → ec}/v1/params.d.ts +1 -1
  71. package/dist/codec/verana/{tr → ec}/v1/params.js +2 -2
  72. package/dist/codec/verana/ec/v1/query.d.ts +109 -0
  73. package/dist/codec/verana/{tr → ec}/v1/query.js +69 -71
  74. package/dist/codec/verana/ec/v1/tx.d.ts +152 -0
  75. package/dist/codec/verana/{dd → ec}/v1/tx.js +218 -216
  76. package/dist/codec/verana/ec/v1/types.d.ts +67 -0
  77. package/dist/codec/verana/ec/v1/types.js +422 -0
  78. package/dist/codec/verana/gf/module/v1/module.d.ts +29 -0
  79. package/dist/codec/verana/gf/module/v1/module.js +98 -0
  80. package/dist/codec/verana/gf/v1/genesis.d.ts +29 -0
  81. package/dist/codec/verana/gf/v1/genesis.js +137 -0
  82. package/dist/codec/verana/gf/v1/params.d.ts +28 -0
  83. package/dist/codec/verana/gf/v1/params.js +81 -0
  84. package/dist/codec/verana/gf/v1/query.d.ts +108 -0
  85. package/dist/codec/verana/gf/v1/query.js +462 -0
  86. package/dist/codec/verana/gf/v1/tx.d.ts +142 -0
  87. package/dist/codec/verana/gf/v1/tx.js +486 -0
  88. package/dist/codec/verana/{tr → gf}/v1/types.d.ts +18 -51
  89. package/dist/codec/verana/gf/v1/types.js +477 -0
  90. package/dist/codec/verana/{tr → pp}/module/module.d.ts +1 -1
  91. package/dist/codec/verana/{tr → pp}/module/module.js +2 -2
  92. package/dist/codec/verana/{perm → pp}/v1/genesis.d.ts +9 -9
  93. package/dist/codec/verana/{perm → pp}/v1/genesis.js +26 -26
  94. package/dist/codec/verana/{perm → pp}/v1/params.d.ts +1 -1
  95. package/dist/codec/verana/{perm → pp}/v1/params.js +2 -2
  96. package/dist/codec/verana/pp/v1/query.d.ts +220 -0
  97. package/dist/codec/verana/{perm → pp}/v1/query.js +305 -166
  98. package/dist/codec/verana/pp/v1/tx.d.ts +479 -0
  99. package/dist/codec/verana/pp/v1/tx.js +2574 -0
  100. package/dist/codec/verana/pp/v1/types.d.ts +137 -0
  101. package/dist/codec/verana/{perm → pp}/v1/types.js +312 -354
  102. package/dist/codec/verana/td/v1/genesis.d.ts +13 -3
  103. package/dist/codec/verana/td/v1/genesis.js +151 -35
  104. package/dist/codec/verana/td/v1/params.d.ts +2 -0
  105. package/dist/codec/verana/td/v1/params.js +18 -1
  106. package/dist/codec/verana/td/v1/query.d.ts +1 -1
  107. package/dist/codec/verana/td/v1/query.js +24 -10
  108. package/dist/codec/verana/td/v1/tx.d.ts +26 -40
  109. package/dist/codec/verana/td/v1/tx.js +80 -190
  110. package/dist/codec/verana/td/v1/types.d.ts +8 -8
  111. package/dist/codec/verana/td/v1/types.js +54 -69
  112. package/dist/codec/verana/xr/module/v1/module.d.ts +29 -0
  113. package/dist/codec/verana/xr/module/v1/module.js +98 -0
  114. package/dist/codec/verana/xr/v1/genesis.d.ts +34 -0
  115. package/dist/codec/verana/xr/v1/genesis.js +166 -0
  116. package/dist/codec/verana/{dd → xr}/v1/params.d.ts +4 -3
  117. package/dist/codec/verana/xr/v1/params.js +104 -0
  118. package/dist/codec/verana/xr/v1/query.d.ts +166 -0
  119. package/dist/codec/verana/xr/v1/query.js +817 -0
  120. package/dist/codec/verana/xr/v1/tx.d.ts +284 -0
  121. package/dist/codec/verana/xr/v1/tx.js +1298 -0
  122. package/dist/helpers/aminoConverters.d.ts +10 -32
  123. package/dist/helpers/aminoConverters.js +23 -589
  124. package/dist/index.d.ts +11 -1
  125. package/dist/index.js +11 -1
  126. package/dist/signing.d.ts +75 -0
  127. package/dist/signing.js +147 -0
  128. package/package.json +32 -6
  129. package/dist/codec/verana/dd/v1/query.d.ts +0 -108
  130. package/dist/codec/verana/dd/v1/tx.d.ts +0 -173
  131. package/dist/codec/verana/dd/v1/types.d.ts +0 -30
  132. package/dist/codec/verana/dd/v1/types.js +0 -206
  133. package/dist/codec/verana/perm/v1/query.d.ts +0 -209
  134. package/dist/codec/verana/perm/v1/tx.d.ts +0 -395
  135. package/dist/codec/verana/perm/v1/tx.js +0 -1995
  136. package/dist/codec/verana/perm/v1/types.d.ts +0 -134
  137. package/dist/codec/verana/tr/v1/query.d.ts +0 -118
  138. package/dist/codec/verana/tr/v1/tx.d.ts +0 -255
  139. package/dist/codec/verana/tr/v1/tx.js +0 -956
  140. package/dist/codec/verana/tr/v1/types.js +0 -839
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createGroupAminoConverters = createGroupAminoConverters;
4
+ const tx_1 = require("cosmjs-types/cosmos/group/v1/tx");
5
+ const helpers_1 = require("./util/helpers");
6
+ // Amino converters for cosmos x/group messages (MsgSubmitProposal, MsgVote).
7
+ //
8
+ // CosmJS 0.32.x ships createGroupAminoConverters() as an empty {} because
9
+ // MsgSubmitProposal.messages is an Any[] that requires recursive amino
10
+ // encoding — the converter needs the AminoTypes registry to transcode each
11
+ // inner message. This factory receives that registry via closure at
12
+ // construction time (see createVeranaAminoTypes in signing.ts).
13
+ //
14
+ // Amino type names from cosmos-sdk x/group codec.go:
15
+ // MsgSubmitProposal → "cosmos-sdk/group/MsgSubmitProposal"
16
+ // MsgVote → "cosmos-sdk/group/MsgVote"
17
+ //
18
+ // Field encoding notes (verified with go amino.MarshalJSON):
19
+ // - exec: integer; absent when 0 (EXEC_UNSPECIFIED)
20
+ // - option: integer (VoteOption enum)
21
+ // - proposal_id: string (uint64 → string)
22
+ // - messages[].type: amino type of the inner message
23
+ // - messages[].value: amino fields of the inner message (recursively encoded)
24
+ function createGroupAminoConverters(getAminoTypes, registry) {
25
+ const encodeInner = (any) => {
26
+ const genType = registry.lookupType(any.typeUrl);
27
+ const decoded = genType ? genType.decode(any.value) : any;
28
+ return getAminoTypes().toAmino({ typeUrl: any.typeUrl, value: decoded });
29
+ };
30
+ const decodeInner = (aminoMsg) => {
31
+ const protoMsg = getAminoTypes().fromAmino(aminoMsg);
32
+ const genType = registry.lookupType(protoMsg.typeUrl);
33
+ const encoded = genType
34
+ ? genType.encode(protoMsg.value).finish()
35
+ : new Uint8Array();
36
+ return { typeUrl: protoMsg.typeUrl, value: encoded };
37
+ };
38
+ return {
39
+ "/cosmos.group.v1.MsgSubmitProposal": {
40
+ aminoType: "cosmos-sdk/group/MsgSubmitProposal",
41
+ toAmino: (msg) => {
42
+ var _a, _b;
43
+ return (0, helpers_1.clean)({
44
+ group_policy_address: msg.groupPolicyAddress || undefined,
45
+ proposers: ((_a = msg.proposers) === null || _a === void 0 ? void 0 : _a.length) ? msg.proposers : undefined,
46
+ metadata: msg.metadata || undefined,
47
+ title: msg.title || undefined,
48
+ summary: msg.summary || undefined,
49
+ messages: ((_b = msg.messages) === null || _b === void 0 ? void 0 : _b.length)
50
+ ? msg.messages.map(encodeInner)
51
+ : undefined,
52
+ exec: msg.exec || undefined,
53
+ });
54
+ },
55
+ fromAmino: (value) => {
56
+ var _a, _b, _c, _d, _e;
57
+ return tx_1.MsgSubmitProposal.fromPartial({
58
+ groupPolicyAddress: (_a = value.group_policy_address) !== null && _a !== void 0 ? _a : "",
59
+ proposers: Array.isArray(value.proposers) ? value.proposers : [],
60
+ metadata: (_b = value.metadata) !== null && _b !== void 0 ? _b : "",
61
+ title: (_c = value.title) !== null && _c !== void 0 ? _c : "",
62
+ summary: (_d = value.summary) !== null && _d !== void 0 ? _d : "",
63
+ messages: Array.isArray(value.messages)
64
+ ? value.messages.map(decodeInner)
65
+ : [],
66
+ exec: (_e = value.exec) !== null && _e !== void 0 ? _e : 0,
67
+ });
68
+ },
69
+ },
70
+ "/cosmos.group.v1.MsgVote": {
71
+ aminoType: "cosmos-sdk/group/MsgVote",
72
+ toAmino: (msg) => (0, helpers_1.clean)({
73
+ proposal_id: msg.proposalId !== undefined ? String(msg.proposalId) : undefined,
74
+ voter: msg.voter || undefined,
75
+ option: msg.option || undefined,
76
+ metadata: msg.metadata || undefined,
77
+ exec: msg.exec || undefined,
78
+ }),
79
+ fromAmino: (value) => {
80
+ var _a, _b, _c, _d;
81
+ return tx_1.MsgVote.fromPartial({
82
+ proposalId: value.proposal_id != null ? BigInt(value.proposal_id) : BigInt(0),
83
+ voter: (_a = value.voter) !== null && _a !== void 0 ? _a : "",
84
+ option: (_b = value.option) !== null && _b !== void 0 ? _b : 0,
85
+ metadata: (_c = value.metadata) !== null && _c !== void 0 ? _c : "",
86
+ exec: (_d = value.exec) !== null && _d !== void 0 ? _d : 0,
87
+ });
88
+ },
89
+ },
90
+ };
91
+ }
@@ -0,0 +1,13 @@
1
+ import type { AminoConverter } from "@cosmjs/stargate";
2
+ export declare const MsgCreateRootParticipantAminoConverter: AminoConverter;
3
+ export declare const MsgSetParticipantEffectiveUntilAminoConverter: AminoConverter;
4
+ export declare const MsgRevokeParticipantAminoConverter: AminoConverter;
5
+ export declare const MsgStartParticipantOPAminoConverter: AminoConverter;
6
+ export declare const MsgRenewParticipantOPAminoConverter: AminoConverter;
7
+ export declare const MsgSetParticipantOPToValidatedAminoConverter: AminoConverter;
8
+ export declare const MsgCancelParticipantOPLastRequestAminoConverter: AminoConverter;
9
+ export declare const MsgCreateOrUpdateParticipantSessionAminoConverter: AminoConverter;
10
+ export declare const MsgSlashParticipantTrustDepositAminoConverter: AminoConverter;
11
+ export declare const MsgRepayParticipantSlashedTrustDepositAminoConverter: AminoConverter;
12
+ export declare const MsgSelfCreateParticipantAminoConverter: AminoConverter;
13
+ export declare const MsgTriggerResolverAminoConverter: AminoConverter;
@@ -0,0 +1,347 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MsgTriggerResolverAminoConverter = exports.MsgSelfCreateParticipantAminoConverter = exports.MsgRepayParticipantSlashedTrustDepositAminoConverter = exports.MsgSlashParticipantTrustDepositAminoConverter = exports.MsgCreateOrUpdateParticipantSessionAminoConverter = exports.MsgCancelParticipantOPLastRequestAminoConverter = exports.MsgSetParticipantOPToValidatedAminoConverter = exports.MsgRenewParticipantOPAminoConverter = exports.MsgStartParticipantOPAminoConverter = exports.MsgRevokeParticipantAminoConverter = exports.MsgSetParticipantEffectiveUntilAminoConverter = exports.MsgCreateRootParticipantAminoConverter = void 0;
4
+ const tx_1 = require("../codec/verana/pp/v1/tx");
5
+ const types_1 = require("../codec/verana/pp/v1/types");
6
+ const helpers_1 = require("./util/helpers");
7
+ exports.MsgCreateRootParticipantAminoConverter = {
8
+ aminoType: "verana/x/pp/MsgCreateRootParticipant",
9
+ // [MOD-PP-MSG-7-3] spec v4 draft 13: perm.role is hardcoded to ECOSYSTEM.
10
+ toAmino: (m) => {
11
+ var _a, _b, _c, _d, _e, _f;
12
+ return (0, helpers_1.clean)({
13
+ corporation: (_a = m.corporation) !== null && _a !== void 0 ? _a : "",
14
+ operator: (_b = m.operator) !== null && _b !== void 0 ? _b : "",
15
+ schema_id: (0, helpers_1.u64ToStr)(m.schemaId),
16
+ did: (_c = m.did) !== null && _c !== void 0 ? _c : "",
17
+ effective_from: (0, helpers_1.dateToIsoAmino)(m.effectiveFrom),
18
+ effective_until: (0, helpers_1.dateToIsoAmino)(m.effectiveUntil),
19
+ validation_fees: (0, helpers_1.u64ToStr)(m.validationFees),
20
+ issuance_fees: (0, helpers_1.u64ToStr)(m.issuanceFees),
21
+ verification_fees: (0, helpers_1.u64ToStr)(m.verificationFees),
22
+ // VSOA params (proto fields 10-15). The chain's aminojson encodes empty
23
+ // dont_omitempty Coin arrays as `null` (NOT []) and omits empty plain
24
+ // repeated/scalar fields. The sign bytes must match exactly.
25
+ vs_operator: m.vsOperator || undefined,
26
+ vs_operator_authz_msg_types: ((_d = m.vsOperatorAuthzMsgTypes) === null || _d === void 0 ? void 0 : _d.length) ? m.vsOperatorAuthzMsgTypes : undefined,
27
+ vs_operator_authz_spend_limit: ((_e = m.vsOperatorAuthzSpendLimit) === null || _e === void 0 ? void 0 : _e.length) ? m.vsOperatorAuthzSpendLimit : null,
28
+ vs_operator_authz_with_feegrant: m.vsOperatorAuthzWithFeegrant || undefined,
29
+ vs_operator_authz_fee_spend_limit: ((_f = m.vsOperatorAuthzFeeSpendLimit) === null || _f === void 0 ? void 0 : _f.length) ? m.vsOperatorAuthzFeeSpendLimit : null,
30
+ vs_operator_authz_period: (0, helpers_1.durationToAmino)(m.vsOperatorAuthzPeriod),
31
+ });
32
+ },
33
+ fromAmino: (a) => {
34
+ var _a, _b, _c, _d, _e, _f, _g, _h;
35
+ return tx_1.MsgCreateRootParticipant.fromPartial({
36
+ corporation: (_a = a.corporation) !== null && _a !== void 0 ? _a : "",
37
+ operator: (_b = a.operator) !== null && _b !== void 0 ? _b : "",
38
+ schemaId: (0, helpers_1.strToU64)(a.schema_id) != null ? Number((0, helpers_1.strToU64)(a.schema_id).toString()) : 0,
39
+ did: (_c = a.did) !== null && _c !== void 0 ? _c : "",
40
+ effectiveFrom: (0, helpers_1.isoToDate)(a.effective_from),
41
+ effectiveUntil: (0, helpers_1.isoToDate)(a.effective_until),
42
+ validationFees: (0, helpers_1.strToU64)(a.validation_fees) != null ? Number((0, helpers_1.strToU64)(a.validation_fees).toString()) : 0,
43
+ issuanceFees: (0, helpers_1.strToU64)(a.issuance_fees) != null ? Number((0, helpers_1.strToU64)(a.issuance_fees).toString()) : 0,
44
+ verificationFees: (0, helpers_1.strToU64)(a.verification_fees) != null ? Number((0, helpers_1.strToU64)(a.verification_fees).toString()) : 0,
45
+ vsOperator: (_d = a.vs_operator) !== null && _d !== void 0 ? _d : "",
46
+ vsOperatorAuthzMsgTypes: (_e = a.vs_operator_authz_msg_types) !== null && _e !== void 0 ? _e : [],
47
+ vsOperatorAuthzSpendLimit: (_f = a.vs_operator_authz_spend_limit) !== null && _f !== void 0 ? _f : [],
48
+ vsOperatorAuthzWithFeegrant: (_g = a.vs_operator_authz_with_feegrant) !== null && _g !== void 0 ? _g : false,
49
+ vsOperatorAuthzFeeSpendLimit: (_h = a.vs_operator_authz_fee_spend_limit) !== null && _h !== void 0 ? _h : [],
50
+ vsOperatorAuthzPeriod: (0, helpers_1.aminoToDuration)(a.vs_operator_authz_period),
51
+ });
52
+ },
53
+ };
54
+ exports.MsgSetParticipantEffectiveUntilAminoConverter = {
55
+ aminoType: "verana/x/pp/MsgSetPartEffectiveUntil",
56
+ toAmino: (m) => {
57
+ var _a, _b;
58
+ return (0, helpers_1.clean)({
59
+ corporation: (_a = m.corporation) !== null && _a !== void 0 ? _a : "",
60
+ operator: (_b = m.operator) !== null && _b !== void 0 ? _b : "",
61
+ id: (0, helpers_1.u64ToStr)(m.id),
62
+ effective_until: (0, helpers_1.dateToIsoAmino)(m.effectiveUntil),
63
+ });
64
+ },
65
+ fromAmino: (a) => {
66
+ var _a, _b;
67
+ return tx_1.MsgSetParticipantEffectiveUntil.fromPartial({
68
+ corporation: (_a = a.corporation) !== null && _a !== void 0 ? _a : "",
69
+ operator: (_b = a.operator) !== null && _b !== void 0 ? _b : "",
70
+ id: (0, helpers_1.strToU64)(a.id) != null ? Number((0, helpers_1.strToU64)(a.id).toString()) : 0,
71
+ effectiveUntil: (0, helpers_1.isoToDate)(a.effective_until),
72
+ });
73
+ },
74
+ };
75
+ exports.MsgRevokeParticipantAminoConverter = {
76
+ aminoType: "verana/x/pp/MsgRevokeParticipant",
77
+ toAmino: (m) => {
78
+ var _a, _b;
79
+ return (0, helpers_1.clean)({
80
+ corporation: (_a = m.corporation) !== null && _a !== void 0 ? _a : "",
81
+ operator: (_b = m.operator) !== null && _b !== void 0 ? _b : "",
82
+ id: (0, helpers_1.u64ToStr)(m.id),
83
+ });
84
+ },
85
+ fromAmino: (a) => {
86
+ var _a, _b;
87
+ return tx_1.MsgRevokeParticipant.fromPartial({
88
+ corporation: (_a = a.corporation) !== null && _a !== void 0 ? _a : "",
89
+ operator: (_b = a.operator) !== null && _b !== void 0 ? _b : "",
90
+ id: (0, helpers_1.strToU64)(a.id) != null ? Number((0, helpers_1.strToU64)(a.id).toString()) : 0,
91
+ });
92
+ },
93
+ };
94
+ exports.MsgStartParticipantOPAminoConverter = {
95
+ aminoType: "verana/x/pp/MsgStartParticipantOP",
96
+ toAmino: (m) => {
97
+ var _a, _b, _c, _d, _e, _f, _g;
98
+ return (0, helpers_1.clean)({
99
+ corporation: (_a = m.corporation) !== null && _a !== void 0 ? _a : "",
100
+ operator: (_b = m.operator) !== null && _b !== void 0 ? _b : "",
101
+ role: (_c = m.role) !== null && _c !== void 0 ? _c : types_1.ParticipantRole.UNSPECIFIED,
102
+ validator_participant_id: (0, helpers_1.u64ToStr)(m.validatorParticipantId),
103
+ did: (_d = m.did) !== null && _d !== void 0 ? _d : "",
104
+ validation_fees: m.validationFees ? { value: (0, helpers_1.u64ToStr)(m.validationFees.value) } : undefined,
105
+ issuance_fees: m.issuanceFees ? { value: (0, helpers_1.u64ToStr)(m.issuanceFees.value) } : undefined,
106
+ verification_fees: m.verificationFees ? { value: (0, helpers_1.u64ToStr)(m.verificationFees.value) } : undefined,
107
+ vs_operator: m.vsOperator || undefined,
108
+ vs_operator_authz_msg_types: ((_e = m.vsOperatorAuthzMsgTypes) === null || _e === void 0 ? void 0 : _e.length) ? m.vsOperatorAuthzMsgTypes : undefined,
109
+ vs_operator_authz_spend_limit: ((_f = m.vsOperatorAuthzSpendLimit) === null || _f === void 0 ? void 0 : _f.length) ? m.vsOperatorAuthzSpendLimit : null,
110
+ vs_operator_authz_with_feegrant: m.vsOperatorAuthzWithFeegrant || undefined,
111
+ vs_operator_authz_fee_spend_limit: ((_g = m.vsOperatorAuthzFeeSpendLimit) === null || _g === void 0 ? void 0 : _g.length) ? m.vsOperatorAuthzFeeSpendLimit : null,
112
+ vs_operator_authz_period: (0, helpers_1.durationToAmino)(m.vsOperatorAuthzPeriod),
113
+ });
114
+ },
115
+ fromAmino: (a) => {
116
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
117
+ return tx_1.MsgStartParticipantOP.fromPartial({
118
+ corporation: (_a = a.corporation) !== null && _a !== void 0 ? _a : "",
119
+ operator: (_b = a.operator) !== null && _b !== void 0 ? _b : "",
120
+ role: (_c = a.role) !== null && _c !== void 0 ? _c : types_1.ParticipantRole.UNSPECIFIED,
121
+ validatorParticipantId: (0, helpers_1.strToU64)(a.validator_participant_id) != null ? Number((0, helpers_1.strToU64)(a.validator_participant_id).toString()) : 0,
122
+ did: (_d = a.did) !== null && _d !== void 0 ? _d : "",
123
+ validationFees: a.validation_fees ? { value: Number((_e = a.validation_fees.value) !== null && _e !== void 0 ? _e : a.validation_fees) } : undefined,
124
+ issuanceFees: a.issuance_fees ? { value: Number((_f = a.issuance_fees.value) !== null && _f !== void 0 ? _f : a.issuance_fees) } : undefined,
125
+ verificationFees: a.verification_fees ? { value: Number((_g = a.verification_fees.value) !== null && _g !== void 0 ? _g : a.verification_fees) } : undefined,
126
+ vsOperator: (_h = a.vs_operator) !== null && _h !== void 0 ? _h : "",
127
+ vsOperatorAuthzMsgTypes: (_j = a.vs_operator_authz_msg_types) !== null && _j !== void 0 ? _j : [],
128
+ vsOperatorAuthzSpendLimit: (_k = a.vs_operator_authz_spend_limit) !== null && _k !== void 0 ? _k : [],
129
+ vsOperatorAuthzWithFeegrant: (_l = a.vs_operator_authz_with_feegrant) !== null && _l !== void 0 ? _l : false,
130
+ vsOperatorAuthzFeeSpendLimit: (_m = a.vs_operator_authz_fee_spend_limit) !== null && _m !== void 0 ? _m : [],
131
+ vsOperatorAuthzPeriod: (0, helpers_1.aminoToDuration)(a.vs_operator_authz_period),
132
+ });
133
+ },
134
+ };
135
+ exports.MsgRenewParticipantOPAminoConverter = {
136
+ aminoType: "verana/x/pp/MsgRenewParticipantOP",
137
+ // [MOD-PP-MSG-2-1] spec v4 draft 13 parameters: corporation, operator, id.
138
+ toAmino: (m) => {
139
+ var _a, _b;
140
+ return (0, helpers_1.clean)({
141
+ corporation: (_a = m.corporation) !== null && _a !== void 0 ? _a : "",
142
+ operator: (_b = m.operator) !== null && _b !== void 0 ? _b : "",
143
+ id: (0, helpers_1.u64ToStr)(m.id),
144
+ });
145
+ },
146
+ fromAmino: (a) => {
147
+ var _a, _b;
148
+ return tx_1.MsgRenewParticipantOP.fromPartial({
149
+ corporation: (_a = a.corporation) !== null && _a !== void 0 ? _a : "",
150
+ operator: (_b = a.operator) !== null && _b !== void 0 ? _b : "",
151
+ id: (0, helpers_1.strToU64)(a.id) != null ? Number((0, helpers_1.strToU64)(a.id).toString()) : 0,
152
+ });
153
+ },
154
+ };
155
+ exports.MsgSetParticipantOPToValidatedAminoConverter = {
156
+ aminoType: "verana/x/pp/MsgSetPartOPValidated",
157
+ toAmino: (m) => {
158
+ var _a, _b, _c;
159
+ return (0, helpers_1.clean)({
160
+ corporation: (_a = m.corporation) !== null && _a !== void 0 ? _a : "",
161
+ operator: (_b = m.operator) !== null && _b !== void 0 ? _b : "",
162
+ id: (0, helpers_1.u64ToStr)(m.id),
163
+ effective_until: (0, helpers_1.dateToIsoAmino)(m.effectiveUntil),
164
+ validation_fees: (0, helpers_1.u64ToStr)(m.validationFees),
165
+ issuance_fees: (0, helpers_1.u64ToStr)(m.issuanceFees),
166
+ verification_fees: (0, helpers_1.u64ToStr)(m.verificationFees),
167
+ op_summary_digest: (_c = m.opSummaryDigest) !== null && _c !== void 0 ? _c : "",
168
+ issuance_fee_discount: (0, helpers_1.u64ToStrIfNonZero)(m.issuanceFeeDiscount),
169
+ verification_fee_discount: (0, helpers_1.u64ToStrIfNonZero)(m.verificationFeeDiscount),
170
+ });
171
+ },
172
+ fromAmino: (a) => {
173
+ var _a, _b, _c;
174
+ return tx_1.MsgSetParticipantOPToValidated.fromPartial({
175
+ corporation: (_a = a.corporation) !== null && _a !== void 0 ? _a : "",
176
+ operator: (_b = a.operator) !== null && _b !== void 0 ? _b : "",
177
+ id: (0, helpers_1.strToU64)(a.id) != null ? Number((0, helpers_1.strToU64)(a.id).toString()) : 0,
178
+ effectiveUntil: (0, helpers_1.isoToDate)(a.effective_until),
179
+ validationFees: (0, helpers_1.strToU64)(a.validation_fees) != null ? Number((0, helpers_1.strToU64)(a.validation_fees).toString()) : 0,
180
+ issuanceFees: (0, helpers_1.strToU64)(a.issuance_fees) != null ? Number((0, helpers_1.strToU64)(a.issuance_fees).toString()) : 0,
181
+ verificationFees: (0, helpers_1.strToU64)(a.verification_fees) != null ? Number((0, helpers_1.strToU64)(a.verification_fees).toString()) : 0,
182
+ opSummaryDigest: (_c = a.op_summary_digest) !== null && _c !== void 0 ? _c : "",
183
+ issuanceFeeDiscount: (0, helpers_1.strToU64)(a.issuance_fee_discount) != null
184
+ ? Number((0, helpers_1.strToU64)(a.issuance_fee_discount).toString())
185
+ : 0,
186
+ verificationFeeDiscount: (0, helpers_1.strToU64)(a.verification_fee_discount) != null
187
+ ? Number((0, helpers_1.strToU64)(a.verification_fee_discount).toString())
188
+ : 0,
189
+ });
190
+ },
191
+ };
192
+ exports.MsgCancelParticipantOPLastRequestAminoConverter = {
193
+ aminoType: "verana/x/pp/MsgCancelPartOPLastReq",
194
+ toAmino: (m) => {
195
+ var _a, _b;
196
+ return (0, helpers_1.clean)({
197
+ corporation: (_a = m.corporation) !== null && _a !== void 0 ? _a : "",
198
+ operator: (_b = m.operator) !== null && _b !== void 0 ? _b : "",
199
+ id: (0, helpers_1.u64ToStr)(m.id),
200
+ });
201
+ },
202
+ fromAmino: (a) => {
203
+ var _a, _b;
204
+ return tx_1.MsgCancelParticipantOPLastRequest.fromPartial({
205
+ corporation: (_a = a.corporation) !== null && _a !== void 0 ? _a : "",
206
+ operator: (_b = a.operator) !== null && _b !== void 0 ? _b : "",
207
+ id: (0, helpers_1.strToU64)(a.id) != null ? Number((0, helpers_1.strToU64)(a.id).toString()) : 0,
208
+ });
209
+ },
210
+ };
211
+ exports.MsgCreateOrUpdateParticipantSessionAminoConverter = {
212
+ aminoType: "verana/x/pp/MsgCreateOrUpdatePartSess",
213
+ toAmino: (m) => {
214
+ var _a, _b, _c;
215
+ return (0, helpers_1.clean)({
216
+ corporation: (_a = m.corporation) !== null && _a !== void 0 ? _a : "",
217
+ operator: (_b = m.operator) !== null && _b !== void 0 ? _b : "",
218
+ id: (_c = m.id) !== null && _c !== void 0 ? _c : "",
219
+ issuer_participant_id: (0, helpers_1.u64ToStrIfNonZero)(m.issuerParticipantId),
220
+ verifier_participant_id: (0, helpers_1.u64ToStrIfNonZero)(m.verifierParticipantId),
221
+ agent_participant_id: (0, helpers_1.u64ToStr)(m.agentParticipantId),
222
+ wallet_agent_participant_id: (0, helpers_1.u64ToStr)(m.walletAgentParticipantId),
223
+ digest: m.digest || undefined,
224
+ });
225
+ },
226
+ fromAmino: (a) => {
227
+ var _a, _b, _c, _d;
228
+ return tx_1.MsgCreateOrUpdateParticipantSession.fromPartial({
229
+ corporation: (_a = a.corporation) !== null && _a !== void 0 ? _a : "",
230
+ operator: (_b = a.operator) !== null && _b !== void 0 ? _b : "",
231
+ id: (_c = a.id) !== null && _c !== void 0 ? _c : "",
232
+ issuerParticipantId: (0, helpers_1.strToU64)(a.issuer_participant_id) != null ? Number((0, helpers_1.strToU64)(a.issuer_participant_id).toString()) : 0,
233
+ verifierParticipantId: (0, helpers_1.strToU64)(a.verifier_participant_id) != null ? Number((0, helpers_1.strToU64)(a.verifier_participant_id).toString()) : 0,
234
+ agentParticipantId: (0, helpers_1.strToU64)(a.agent_participant_id) != null ? Number((0, helpers_1.strToU64)(a.agent_participant_id).toString()) : 0,
235
+ walletAgentParticipantId: (0, helpers_1.strToU64)(a.wallet_agent_participant_id) != null
236
+ ? Number((0, helpers_1.strToU64)(a.wallet_agent_participant_id).toString())
237
+ : 0,
238
+ digest: (_d = a.digest) !== null && _d !== void 0 ? _d : "",
239
+ });
240
+ },
241
+ };
242
+ exports.MsgSlashParticipantTrustDepositAminoConverter = {
243
+ aminoType: "verana/x/pp/MsgSlashParticipantTD",
244
+ // [MOD-PP-MSG-12-1] spec v4 draft 13 adds mandatory reason.
245
+ toAmino: (m) => {
246
+ var _a, _b, _c;
247
+ return (0, helpers_1.clean)({
248
+ corporation: (_a = m.corporation) !== null && _a !== void 0 ? _a : "",
249
+ operator: (_b = m.operator) !== null && _b !== void 0 ? _b : "",
250
+ id: (0, helpers_1.u64ToStr)(m.id),
251
+ amount: (0, helpers_1.u64ToStr)(m.amount),
252
+ reason: (_c = m.reason) !== null && _c !== void 0 ? _c : "",
253
+ });
254
+ },
255
+ fromAmino: (a) => {
256
+ var _a, _b, _c;
257
+ return tx_1.MsgSlashParticipantTrustDeposit.fromPartial({
258
+ corporation: (_a = a.corporation) !== null && _a !== void 0 ? _a : "",
259
+ operator: (_b = a.operator) !== null && _b !== void 0 ? _b : "",
260
+ id: (0, helpers_1.strToU64)(a.id) != null ? Number((0, helpers_1.strToU64)(a.id).toString()) : 0,
261
+ amount: (0, helpers_1.strToU64)(a.amount) != null ? Number((0, helpers_1.strToU64)(a.amount).toString()) : 0,
262
+ reason: (_c = a.reason) !== null && _c !== void 0 ? _c : "",
263
+ });
264
+ },
265
+ };
266
+ exports.MsgRepayParticipantSlashedTrustDepositAminoConverter = {
267
+ aminoType: "verana/x/pp/MsgRepayPartSlashedTD",
268
+ toAmino: (m) => {
269
+ var _a, _b;
270
+ return (0, helpers_1.clean)({
271
+ corporation: (_a = m.corporation) !== null && _a !== void 0 ? _a : "",
272
+ operator: (_b = m.operator) !== null && _b !== void 0 ? _b : "",
273
+ id: (0, helpers_1.u64ToStr)(m.id),
274
+ });
275
+ },
276
+ fromAmino: (a) => {
277
+ var _a, _b;
278
+ return tx_1.MsgRepayParticipantSlashedTrustDeposit.fromPartial({
279
+ corporation: (_a = a.corporation) !== null && _a !== void 0 ? _a : "",
280
+ operator: (_b = a.operator) !== null && _b !== void 0 ? _b : "",
281
+ id: (0, helpers_1.strToU64)(a.id) != null ? Number((0, helpers_1.strToU64)(a.id).toString()) : 0,
282
+ });
283
+ },
284
+ };
285
+ exports.MsgSelfCreateParticipantAminoConverter = {
286
+ aminoType: "verana/x/pp/MsgSelfCreateParticipant",
287
+ toAmino: (m) => {
288
+ var _a, _b, _c, _d, _e, _f, _g;
289
+ return (0, helpers_1.clean)({
290
+ corporation: (_a = m.corporation) !== null && _a !== void 0 ? _a : "",
291
+ operator: (_b = m.operator) !== null && _b !== void 0 ? _b : "",
292
+ role: (_c = m.role) !== null && _c !== void 0 ? _c : 0,
293
+ validator_participant_id: (0, helpers_1.u64ToStr)(m.validatorParticipantId),
294
+ did: (_d = m.did) !== null && _d !== void 0 ? _d : "",
295
+ effective_from: (0, helpers_1.dateToIsoAmino)(m.effectiveFrom),
296
+ effective_until: (0, helpers_1.dateToIsoAmino)(m.effectiveUntil),
297
+ verification_fees: (0, helpers_1.u64ToStrIfNonZero)(m.verificationFees),
298
+ validation_fees: (0, helpers_1.u64ToStrIfNonZero)(m.validationFees),
299
+ vs_operator: m.vsOperator || undefined,
300
+ vs_operator_authz_msg_types: ((_e = m.vsOperatorAuthzMsgTypes) === null || _e === void 0 ? void 0 : _e.length) ? m.vsOperatorAuthzMsgTypes : undefined,
301
+ vs_operator_authz_spend_limit: ((_f = m.vsOperatorAuthzSpendLimit) === null || _f === void 0 ? void 0 : _f.length) ? m.vsOperatorAuthzSpendLimit : null,
302
+ vs_operator_authz_with_feegrant: m.vsOperatorAuthzWithFeegrant || undefined,
303
+ vs_operator_authz_fee_spend_limit: ((_g = m.vsOperatorAuthzFeeSpendLimit) === null || _g === void 0 ? void 0 : _g.length) ? m.vsOperatorAuthzFeeSpendLimit : null,
304
+ vs_operator_authz_period: (0, helpers_1.durationToAmino)(m.vsOperatorAuthzPeriod),
305
+ });
306
+ },
307
+ fromAmino: (a) => {
308
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
309
+ return tx_1.MsgSelfCreateParticipant.fromPartial({
310
+ corporation: (_a = a.corporation) !== null && _a !== void 0 ? _a : "",
311
+ operator: (_b = a.operator) !== null && _b !== void 0 ? _b : "",
312
+ role: (_c = a.role) !== null && _c !== void 0 ? _c : 0,
313
+ validatorParticipantId: (0, helpers_1.strToU64)(a.validator_participant_id) != null ? Number((0, helpers_1.strToU64)(a.validator_participant_id).toString()) : 0,
314
+ did: (_d = a.did) !== null && _d !== void 0 ? _d : "",
315
+ effectiveFrom: (0, helpers_1.isoToDate)(a.effective_from),
316
+ effectiveUntil: (0, helpers_1.isoToDate)(a.effective_until),
317
+ verificationFees: (0, helpers_1.strToU64)(a.verification_fees) != null ? Number((0, helpers_1.strToU64)(a.verification_fees).toString()) : 0,
318
+ validationFees: (0, helpers_1.strToU64)(a.validation_fees) != null ? Number((0, helpers_1.strToU64)(a.validation_fees).toString()) : 0,
319
+ vsOperator: (_e = a.vs_operator) !== null && _e !== void 0 ? _e : "",
320
+ vsOperatorAuthzMsgTypes: (_f = a.vs_operator_authz_msg_types) !== null && _f !== void 0 ? _f : [],
321
+ vsOperatorAuthzSpendLimit: (_g = a.vs_operator_authz_spend_limit) !== null && _g !== void 0 ? _g : [],
322
+ vsOperatorAuthzWithFeegrant: (_h = a.vs_operator_authz_with_feegrant) !== null && _h !== void 0 ? _h : false,
323
+ vsOperatorAuthzFeeSpendLimit: (_j = a.vs_operator_authz_fee_spend_limit) !== null && _j !== void 0 ? _j : [],
324
+ vsOperatorAuthzPeriod: (0, helpers_1.aminoToDuration)(a.vs_operator_authz_period),
325
+ });
326
+ },
327
+ };
328
+ exports.MsgTriggerResolverAminoConverter = {
329
+ aminoType: "verana/x/pp/MsgTriggerResolver",
330
+ // [MOD-PP-MSG-15] parameters: corporation, operator, id.
331
+ toAmino: (m) => {
332
+ var _a, _b;
333
+ return (0, helpers_1.clean)({
334
+ corporation: (_a = m.corporation) !== null && _a !== void 0 ? _a : "",
335
+ operator: (_b = m.operator) !== null && _b !== void 0 ? _b : "",
336
+ id: (0, helpers_1.u64ToStr)(m.id),
337
+ });
338
+ },
339
+ fromAmino: (a) => {
340
+ var _a, _b;
341
+ return tx_1.MsgTriggerResolver.fromPartial({
342
+ corporation: (_a = a.corporation) !== null && _a !== void 0 ? _a : "",
343
+ operator: (_b = a.operator) !== null && _b !== void 0 ? _b : "",
344
+ id: (0, helpers_1.strToU64)(a.id) != null ? Number((0, helpers_1.strToU64)(a.id).toString()) : 0,
345
+ });
346
+ },
347
+ };
@@ -0,0 +1,4 @@
1
+ import type { AminoConverter } from "@cosmjs/stargate";
2
+ export declare const MsgReclaimTrustDepositYieldAminoConverter: AminoConverter;
3
+ export declare const MsgRepaySlashedTrustDepositAminoConverter: AminoConverter;
4
+ export declare const MsgSlashTrustDepositAminoConverter: AminoConverter;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MsgSlashTrustDepositAminoConverter = exports.MsgRepaySlashedTrustDepositAminoConverter = exports.MsgReclaimTrustDepositYieldAminoConverter = void 0;
4
+ const tx_1 = require("../codec/verana/td/v1/tx");
5
+ const helpers_1 = require("./util/helpers");
6
+ exports.MsgReclaimTrustDepositYieldAminoConverter = {
7
+ aminoType: "verana/x/td/MsgReclaimTrustDepositYield",
8
+ // [MOD-TD-MSG-2-1] Spec v4 draft 13: parameters are corporation + operator only.
9
+ toAmino: ({ corporation, operator }) => ({
10
+ corporation,
11
+ operator,
12
+ }),
13
+ fromAmino: (value) => tx_1.MsgReclaimTrustDepositYield.fromPartial({
14
+ corporation: value.corporation,
15
+ operator: value.operator,
16
+ }),
17
+ };
18
+ exports.MsgRepaySlashedTrustDepositAminoConverter = {
19
+ aminoType: "verana/x/td/MsgRepaySlashedTrustDeposit",
20
+ toAmino: ({ corporation, operator, deposit }) => ({
21
+ corporation,
22
+ operator,
23
+ deposit: deposit != null ? deposit.toString() : undefined,
24
+ }),
25
+ fromAmino: (value) => tx_1.MsgRepaySlashedTrustDeposit.fromPartial({
26
+ corporation: value.corporation,
27
+ operator: value.operator,
28
+ deposit: value.deposit != null ? Number(value.deposit) : 0,
29
+ }),
30
+ };
31
+ exports.MsgSlashTrustDepositAminoConverter = {
32
+ aminoType: "verana/x/td/MsgSlashTrustDeposit",
33
+ // [MOD-TD-MSG-5] v4-rc3: target corporation_id (uint64); reason mandatory.
34
+ toAmino: ({ authority, corporationId, deposit, reason }) => ({
35
+ authority,
36
+ corporation_id: (0, helpers_1.u64ToStrIfNonZero)(corporationId),
37
+ deposit,
38
+ reason,
39
+ }),
40
+ fromAmino: (value) => tx_1.MsgSlashTrustDeposit.fromPartial({
41
+ authority: value.authority,
42
+ corporationId: (0, helpers_1.strToU64)(value.corporation_id) != null ? Number((0, helpers_1.strToU64)(value.corporation_id).toString()) : 0,
43
+ deposit: value.deposit,
44
+ reason: value.reason,
45
+ }),
46
+ };
@@ -0,0 +1,30 @@
1
+ import Long from "long";
2
+ import type { Duration } from "../../codec/google/protobuf/duration";
3
+ import type { OptionalUInt32 } from "../../codec/verana/cs/v1/tx";
4
+ export declare const clean: <T extends Record<string, any>>(o: T) => T;
5
+ export declare const u64ToStr: (v?: Long | string | number | null) => string | undefined;
6
+ export declare const u64ToStrIfNonZero: (v?: Long | string | number | null) => string | undefined;
7
+ export declare const strToU64: (s?: string | null) => Long | undefined;
8
+ export declare const u32ToAmino: (n?: number | null) => number | undefined;
9
+ export declare const pickOptionalUInt32: (v: any) => OptionalUInt32 | undefined;
10
+ export declare const pickU32: (v: any) => OptionalUInt32 | undefined;
11
+ export declare const toOptU32Amino: (m?: {
12
+ value: number;
13
+ } | undefined) => {
14
+ value?: undefined;
15
+ } | {
16
+ value: number;
17
+ } | undefined;
18
+ export declare const fromOptU32Amino: (x: any) => OptionalUInt32 | undefined;
19
+ export declare const dateToIsoAmino: (d?: Date | null) => string | undefined;
20
+ export declare const isoToDate: (s?: string | null) => Date | undefined;
21
+ export declare const dateToAmino: (d?: Date | null) => string | undefined;
22
+ export declare const dateFromAmino: (s?: string | null) => Date | undefined;
23
+ export declare const durationToAmino: (d?: Duration | null) => {
24
+ seconds: string;
25
+ nanos: number | undefined;
26
+ } | undefined;
27
+ export declare const aminoToDuration: (d?: {
28
+ seconds?: string | number | null;
29
+ nanos?: string | number | null;
30
+ } | null) => Duration | undefined;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.aminoToDuration = exports.durationToAmino = exports.dateFromAmino = exports.dateToAmino = exports.isoToDate = exports.dateToIsoAmino = exports.fromOptU32Amino = exports.toOptU32Amino = exports.pickU32 = exports.pickOptionalUInt32 = exports.u32ToAmino = exports.strToU64 = exports.u64ToStrIfNonZero = exports.u64ToStr = exports.clean = void 0;
7
+ const long_1 = __importDefault(require("long"));
8
+ const clean = (o) => {
9
+ Object.keys(o).forEach((k) => o[k] === undefined && delete o[k]);
10
+ return o;
11
+ };
12
+ exports.clean = clean;
13
+ const u64ToStr = (v) => v != null ? long_1.default.fromValue(v).toString() : undefined;
14
+ exports.u64ToStr = u64ToStr;
15
+ const u64ToStrIfNonZero = (v) => {
16
+ if (v == null)
17
+ return undefined;
18
+ const value = long_1.default.fromValue(v);
19
+ return value.isZero() ? undefined : value.toString();
20
+ };
21
+ exports.u64ToStrIfNonZero = u64ToStrIfNonZero;
22
+ const strToU64 = (s) => s != null ? long_1.default.fromString(s) : undefined;
23
+ exports.strToU64 = strToU64;
24
+ const u32ToAmino = (n) => n == null ? undefined : (((n >>> 0) === 0) ? undefined : (n >>> 0));
25
+ exports.u32ToAmino = u32ToAmino;
26
+ const pickOptionalUInt32 = (v) => {
27
+ if (v === undefined || v === null)
28
+ return undefined;
29
+ if (typeof v === "string" && v.trim() === "")
30
+ return undefined;
31
+ const n = Number(v);
32
+ if (!Number.isFinite(n))
33
+ return undefined;
34
+ return { value: n >>> 0 };
35
+ };
36
+ exports.pickOptionalUInt32 = pickOptionalUInt32;
37
+ exports.pickU32 = exports.pickOptionalUInt32;
38
+ const toOptU32Amino = (m) => {
39
+ if (!m)
40
+ return undefined;
41
+ const value = Number(m.value) >>> 0;
42
+ return value === 0 ? {} : { value };
43
+ };
44
+ exports.toOptU32Amino = toOptU32Amino;
45
+ const fromOptU32Amino = (x) => {
46
+ if (x == null)
47
+ return undefined;
48
+ if (typeof x === "object" && x.value == null)
49
+ return { value: 0 };
50
+ const n = typeof x === "object" ? x.value : x;
51
+ if (n === undefined || n === null)
52
+ return undefined;
53
+ if (typeof n === "string" && n.trim() === "")
54
+ return undefined;
55
+ return { value: Number(n) >>> 0 };
56
+ };
57
+ exports.fromOptU32Amino = fromOptU32Amino;
58
+ const dateToIsoAmino = (d) => {
59
+ if (d == null)
60
+ return undefined;
61
+ return d
62
+ .toISOString()
63
+ .replace(/\.000Z$/, "Z")
64
+ .replace(/(\.\d*?[1-9])0+Z$/, "$1Z");
65
+ };
66
+ exports.dateToIsoAmino = dateToIsoAmino;
67
+ const isoToDate = (s) => s != null ? new Date(s) : undefined;
68
+ exports.isoToDate = isoToDate;
69
+ exports.dateToAmino = exports.dateToIsoAmino;
70
+ exports.dateFromAmino = exports.isoToDate;
71
+ const durationToAmino = (d) => {
72
+ if (!d)
73
+ return undefined;
74
+ return (0, exports.clean)({
75
+ seconds: long_1.default.fromValue(d.seconds).toString(),
76
+ nanos: d.nanos === 0 ? undefined : d.nanos,
77
+ });
78
+ };
79
+ exports.durationToAmino = durationToAmino;
80
+ const aminoToDuration = (d) => {
81
+ if (!d)
82
+ return undefined;
83
+ return {
84
+ seconds: d.seconds == null ? 0 : Number(d.seconds),
85
+ nanos: d.nanos == null ? 0 : Number(d.nanos),
86
+ };
87
+ };
88
+ exports.aminoToDuration = aminoToDuration;
@@ -0,0 +1,6 @@
1
+ import type { AminoConverter } from "@cosmjs/stargate";
2
+ export declare const MsgCreateExchangeRateAminoConverter: AminoConverter;
3
+ export declare const MsgUpdateExchangeRateAminoConverter: AminoConverter;
4
+ export declare const MsgSetExchangeRateStateAminoConverter: AminoConverter;
5
+ export declare const MsgGrantExchangeRateAuthorizationAminoConverter: AminoConverter;
6
+ export declare const MsgRevokeExchangeRateAuthorizationAminoConverter: AminoConverter;