@verana-labs/verana-types 0.10.1-dev.7 → 0.10.1-dev.8

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.
@@ -1,654 +1,24 @@
1
1
  "use strict";
2
- /**
3
- * Amino Converters for Verana Message Types
4
- *
5
- * These converters match the frontend implementation to ensure compatibility.
6
- * They convert between Proto messages and Amino JSON format.
7
- */
8
- var __importDefault = (this && this.__importDefault) || function (mod) {
9
- return (mod && mod.__esModule) ? mod : { "default": mod };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
10
15
  };
11
16
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.MsgRevokeOperatorAuthorizationAminoConverter = exports.MsgGrantOperatorAuthorizationAminoConverter = exports.MsgCreatePermissionAminoConverter = exports.MsgRepayPermissionSlashedTrustDepositAminoConverter = exports.MsgSlashPermissionTrustDepositAminoConverter = exports.MsgCreateOrUpdatePermissionSessionAminoConverter = exports.MsgCancelPermissionVPLastRequestAminoConverter = exports.MsgSetPermissionVPToValidatedAminoConverter = exports.MsgRenewPermissionVPAminoConverter = exports.MsgStartPermissionVPAminoConverter = exports.MsgRevokePermissionAminoConverter = exports.MsgAdjustPermissionAminoConverter = exports.MsgCreateRootPermissionAminoConverter = exports.MsgSlashTrustDepositAminoConverter = exports.MsgRepaySlashedTrustDepositAminoConverter = exports.MsgReclaimTrustDepositYieldAminoConverter = exports.MsgReclaimTrustDepositAminoConverter = exports.MsgArchiveCredentialSchemaAminoConverter = exports.MsgUpdateCredentialSchemaAminoConverter = exports.MsgCreateCredentialSchemaAminoConverter = exports.MsgIncreaseActiveGovernanceFrameworkVersionAminoConverter = exports.MsgAddGovernanceFrameworkDocumentAminoConverter = exports.MsgArchiveTrustRegistryAminoConverter = exports.MsgUpdateTrustRegistryAminoConverter = exports.MsgCreateTrustRegistryAminoConverter = void 0;
13
- const long_1 = __importDefault(require("long"));
14
- const tx_1 = require("../codec/verana/tr/v1/tx");
15
- const tx_2 = require("../codec/verana/de/v1/tx");
16
- const tx_3 = require("../codec/verana/cs/v1/tx");
17
- const tx_4 = require("../codec/verana/td/v1/tx");
18
- const tx_5 = require("../codec/verana/perm/v1/tx");
19
- const types_1 = require("../codec/verana/perm/v1/types");
20
- // Helper functions for Amino conversion (matching frontend)
21
- const u64ToStr = (v) => v != null ? long_1.default.fromValue(v).toString() : undefined;
22
- const u64ToStrIfNonZero = (v) => {
23
- if (v == null)
24
- return undefined;
25
- const value = long_1.default.fromValue(v);
26
- return value.isZero() ? undefined : value.toString();
27
- };
28
- const strToU64 = (s) => s != null ? long_1.default.fromString(s) : undefined;
29
- const u32ToAmino = (n) => n == null ? undefined : (((n >>> 0) === 0) ? 0 : (n >>> 0));
30
- const pickU32 = (v) => v == null ? undefined : (Number(v) >>> 0);
31
- // Helper for OptionalUInt32: 0 => {} (omitempty), >0 => {value:n}
32
- const toOptU32Amino = (m) => {
33
- if (!m)
34
- return undefined;
35
- const value = (Number(m.value) >>> 0);
36
- return value === 0 ? {} : { value };
37
- };
38
- // Helper for OptionalUInt32: {} (=> 0), {value:n} => OptionalUInt32
39
- const fromOptU32Amino = (x) => {
40
- if (x == null)
41
- return undefined;
42
- // {} => wrapper, value default 0
43
- if (typeof x === "object" && x.value == null)
44
- return { value: 0 };
45
- const n = typeof x === "object" ? x.value : x;
46
- if (n === undefined || n === null)
47
- return undefined;
48
- if (typeof n === "string" && n.trim() === "")
49
- return undefined;
50
- const u = (Number(n) >>> 0);
51
- return { value: u };
52
- };
53
- const clean = (o) => {
54
- Object.keys(o).forEach((k) => o[k] === undefined && delete o[k]);
55
- return o;
56
- };
57
- // Helper for Date/Timestamp: Date -> RFC3339Nano-like string, ISO string -> Date
58
- // Go's legacy Amino JSON trims trailing zeros in fractional seconds (e.g. .830Z -> .83Z).
59
- // Matching this avoids intermittent sign-byte mismatches on LEGACY_AMINO_JSON signatures.
60
- const dateToAmino = (d) => {
61
- if (d == null)
62
- return undefined;
63
- return d
64
- .toISOString()
65
- .replace(/\.000Z$/, "Z")
66
- .replace(/(\.\d*?[1-9])0+Z$/, "$1Z");
67
- };
68
- const dateFromAmino = (s) => s != null ? new Date(s) : undefined;
69
- // ============================================================================
70
- // Trust Registry (TR) Module Converters
71
- // ============================================================================
72
- exports.MsgCreateTrustRegistryAminoConverter = {
73
- aminoType: '/verana.tr.v1.MsgCreateTrustRegistry',
74
- toAmino: ({ authority, operator, did, aka, language, docUrl, docDigestSri, }) => ({
75
- authority,
76
- operator,
77
- did,
78
- aka,
79
- language,
80
- doc_url: docUrl,
81
- doc_digest_sri: docDigestSri,
82
- }),
83
- fromAmino: (value) => tx_1.MsgCreateTrustRegistry.fromPartial({
84
- authority: value.authority,
85
- operator: value.operator,
86
- did: value.did,
87
- aka: value.aka,
88
- language: value.language,
89
- docUrl: value.doc_url,
90
- docDigestSri: value.doc_digest_sri,
91
- }),
92
- };
93
- exports.MsgUpdateTrustRegistryAminoConverter = {
94
- aminoType: '/verana.tr.v1.MsgUpdateTrustRegistry',
95
- toAmino: ({ authority, operator, id, did, aka }) => ({
96
- authority,
97
- operator,
98
- id: id != null ? id.toString() : undefined,
99
- did,
100
- aka,
101
- }),
102
- fromAmino: (value) => tx_1.MsgUpdateTrustRegistry.fromPartial({
103
- authority: value.authority,
104
- operator: value.operator,
105
- id: value.id != null ? Number(value.id) : 0,
106
- did: value.did,
107
- aka: value.aka,
108
- }),
109
- };
110
- exports.MsgArchiveTrustRegistryAminoConverter = {
111
- aminoType: '/verana.tr.v1.MsgArchiveTrustRegistry',
112
- toAmino: ({ authority, operator, id, archive }) => ({
113
- authority,
114
- operator,
115
- id: id != null ? id.toString() : undefined,
116
- archive,
117
- }),
118
- fromAmino: (value) => tx_1.MsgArchiveTrustRegistry.fromPartial({
119
- authority: value.authority,
120
- operator: value.operator,
121
- id: value.id != null ? Number(value.id) : 0,
122
- archive: value.archive,
123
- }),
124
- };
125
- exports.MsgAddGovernanceFrameworkDocumentAminoConverter = {
126
- aminoType: '/verana.tr.v1.MsgAddGovernanceFrameworkDocument',
127
- toAmino: ({ authority, operator, id, docLanguage, docUrl, docDigestSri, version, }) => ({
128
- authority,
129
- operator,
130
- id: id != null ? id.toString() : undefined,
131
- doc_language: docLanguage,
132
- doc_url: docUrl,
133
- doc_digest_sri: docDigestSri,
134
- version,
135
- }),
136
- fromAmino: (value) => tx_1.MsgAddGovernanceFrameworkDocument.fromPartial({
137
- authority: value.authority,
138
- operator: value.operator,
139
- id: value.id != null ? Number(value.id) : 0,
140
- docLanguage: value.doc_language,
141
- docUrl: value.doc_url,
142
- docDigestSri: value.doc_digest_sri,
143
- version: value.version,
144
- }),
145
- };
146
- exports.MsgIncreaseActiveGovernanceFrameworkVersionAminoConverter = {
147
- aminoType: '/verana.tr.v1.MsgIncreaseActiveGovernanceFrameworkVersion',
148
- toAmino: ({ authority, operator, id }) => ({
149
- authority,
150
- operator,
151
- id: id != null ? id.toString() : undefined,
152
- }),
153
- fromAmino: (value) => tx_1.MsgIncreaseActiveGovernanceFrameworkVersion.fromPartial({
154
- authority: value.authority,
155
- operator: value.operator,
156
- id: value.id != null ? Number(value.id) : 0,
157
- }),
158
- };
159
- // ============================================================================
160
- // Credential Schema (CS) Module Converters
161
- // ============================================================================
162
- exports.MsgCreateCredentialSchemaAminoConverter = {
163
- aminoType: '/verana.cs.v1.MsgCreateCredentialSchema',
164
- toAmino: (m) => {
165
- var _a, _b, _c, _d, _e, _f;
166
- return clean({
167
- authority: (_a = m.authority) !== null && _a !== void 0 ? _a : '',
168
- operator: (_b = m.operator) !== null && _b !== void 0 ? _b : '',
169
- tr_id: u64ToStr(m.trId), // Use u64ToStr to match frontend (handles number/Long)
170
- json_schema: (_c = m.jsonSchema) !== null && _c !== void 0 ? _c : '',
171
- issuer_grantor_validation_validity_period: toOptU32Amino(m.issuerGrantorValidationValidityPeriod),
172
- verifier_grantor_validation_validity_period: toOptU32Amino(m.verifierGrantorValidationValidityPeriod),
173
- issuer_validation_validity_period: toOptU32Amino(m.issuerValidationValidityPeriod),
174
- verifier_validation_validity_period: toOptU32Amino(m.verifierValidationValidityPeriod),
175
- holder_validation_validity_period: toOptU32Amino(m.holderValidationValidityPeriod),
176
- issuer_perm_management_mode: u32ToAmino(m.issuerPermManagementMode),
177
- verifier_perm_management_mode: u32ToAmino(m.verifierPermManagementMode),
178
- pricing_asset_type: (_d = m.pricingAssetType) !== null && _d !== void 0 ? _d : 0,
179
- pricing_asset: (_e = m.pricingAsset) !== null && _e !== void 0 ? _e : '',
180
- digest_algorithm: (_f = m.digestAlgorithm) !== null && _f !== void 0 ? _f : '',
181
- });
182
- },
183
- fromAmino: (a) => {
184
- var _a, _b, _c, _d, _e, _f, _g, _h;
185
- return tx_3.MsgCreateCredentialSchema.fromPartial({
186
- authority: (_a = a.authority) !== null && _a !== void 0 ? _a : '',
187
- operator: (_b = a.operator) !== null && _b !== void 0 ? _b : '',
188
- trId: strToU64(a.tr_id) != null ? Number(strToU64(a.tr_id).toString()) : 0, // Convert Long to number
189
- jsonSchema: (_c = a.json_schema) !== null && _c !== void 0 ? _c : '',
190
- issuerGrantorValidationValidityPeriod: fromOptU32Amino(a.issuer_grantor_validation_validity_period),
191
- verifierGrantorValidationValidityPeriod: fromOptU32Amino(a.verifier_grantor_validation_validity_period),
192
- issuerValidationValidityPeriod: fromOptU32Amino(a.issuer_validation_validity_period),
193
- verifierValidationValidityPeriod: fromOptU32Amino(a.verifier_validation_validity_period),
194
- holderValidationValidityPeriod: fromOptU32Amino(a.holder_validation_validity_period),
195
- issuerPermManagementMode: (_d = a.issuer_perm_management_mode) !== null && _d !== void 0 ? _d : 0,
196
- verifierPermManagementMode: (_e = a.verifier_perm_management_mode) !== null && _e !== void 0 ? _e : 0,
197
- pricingAssetType: (_f = a.pricing_asset_type) !== null && _f !== void 0 ? _f : 0,
198
- pricingAsset: (_g = a.pricing_asset) !== null && _g !== void 0 ? _g : '',
199
- digestAlgorithm: (_h = a.digest_algorithm) !== null && _h !== void 0 ? _h : '',
200
- });
201
- },
202
- };
203
- exports.MsgUpdateCredentialSchemaAminoConverter = {
204
- aminoType: '/verana.cs.v1.MsgUpdateCredentialSchema',
205
- toAmino: (m) => {
206
- var _a, _b;
207
- return clean({
208
- authority: (_a = m.authority) !== null && _a !== void 0 ? _a : '',
209
- operator: (_b = m.operator) !== null && _b !== void 0 ? _b : '',
210
- id: u64ToStr(m.id), // Use u64ToStr to match frontend
211
- issuer_grantor_validation_validity_period: toOptU32Amino(m.issuerGrantorValidationValidityPeriod),
212
- verifier_grantor_validation_validity_period: toOptU32Amino(m.verifierGrantorValidationValidityPeriod),
213
- issuer_validation_validity_period: toOptU32Amino(m.issuerValidationValidityPeriod),
214
- verifier_validation_validity_period: toOptU32Amino(m.verifierValidationValidityPeriod),
215
- holder_validation_validity_period: toOptU32Amino(m.holderValidationValidityPeriod),
216
- });
217
- },
218
- fromAmino: (a) => {
219
- var _a, _b;
220
- return tx_3.MsgUpdateCredentialSchema.fromPartial({
221
- authority: (_a = a.authority) !== null && _a !== void 0 ? _a : '',
222
- operator: (_b = a.operator) !== null && _b !== void 0 ? _b : '',
223
- id: strToU64(a.id) != null ? Number(strToU64(a.id).toString()) : 0, // Convert Long to number
224
- issuerGrantorValidationValidityPeriod: fromOptU32Amino(a.issuer_grantor_validation_validity_period),
225
- verifierGrantorValidationValidityPeriod: fromOptU32Amino(a.verifier_grantor_validation_validity_period),
226
- issuerValidationValidityPeriod: fromOptU32Amino(a.issuer_validation_validity_period),
227
- verifierValidationValidityPeriod: fromOptU32Amino(a.verifier_validation_validity_period),
228
- holderValidationValidityPeriod: fromOptU32Amino(a.holder_validation_validity_period),
229
- });
230
- },
231
- };
232
- exports.MsgArchiveCredentialSchemaAminoConverter = {
233
- aminoType: '/verana.cs.v1.MsgArchiveCredentialSchema',
234
- toAmino: (m) => {
235
- var _a, _b, _c;
236
- return ({
237
- authority: (_a = m.authority) !== null && _a !== void 0 ? _a : '',
238
- operator: (_b = m.operator) !== null && _b !== void 0 ? _b : '',
239
- id: u64ToStr(m.id), // Use u64ToStr to match frontend
240
- archive: (_c = m.archive) !== null && _c !== void 0 ? _c : false,
241
- });
242
- },
243
- fromAmino: (a) => {
244
- var _a;
245
- return tx_3.MsgArchiveCredentialSchema.fromPartial({
246
- authority: a.authority,
247
- operator: a.operator,
248
- id: strToU64(a.id) != null ? Number(strToU64(a.id).toString()) : 0, // Convert Long to number
249
- archive: (_a = a.archive) !== null && _a !== void 0 ? _a : false,
250
- });
251
- },
252
- };
253
- // ============================================================================
254
- // Trust Deposit (TD) Module Converters
255
- // ============================================================================
256
- exports.MsgReclaimTrustDepositAminoConverter = {
257
- aminoType: '/verana.td.v1.MsgReclaimTrustDeposit',
258
- toAmino: ({ creator, claimed }) => ({
259
- creator,
260
- claimed: claimed != null ? claimed.toString() : undefined,
261
- }),
262
- fromAmino: (value) => tx_4.MsgReclaimTrustDeposit.fromPartial({
263
- creator: value.creator,
264
- claimed: value.claimed != null ? Number(value.claimed) : 0,
265
- }),
266
- };
267
- exports.MsgReclaimTrustDepositYieldAminoConverter = {
268
- aminoType: '/verana.td.v1.MsgReclaimTrustDepositYield',
269
- toAmino: ({ authority, operator }) => ({
270
- authority,
271
- operator,
272
- }),
273
- fromAmino: (value) => tx_4.MsgReclaimTrustDepositYield.fromPartial({
274
- authority: value.authority,
275
- operator: value.operator,
276
- }),
277
- };
278
- exports.MsgRepaySlashedTrustDepositAminoConverter = {
279
- aminoType: '/verana.td.v1.MsgRepaySlashedTrustDeposit',
280
- toAmino: ({ authority, operator, amount }) => ({
281
- authority,
282
- operator,
283
- amount: amount != null ? amount.toString() : undefined,
284
- }),
285
- fromAmino: (value) => tx_4.MsgRepaySlashedTrustDeposit.fromPartial({
286
- authority: value.authority,
287
- operator: value.operator,
288
- amount: value.amount != null ? Number(value.amount) : 0,
289
- }),
290
- };
291
- exports.MsgSlashTrustDepositAminoConverter = {
292
- aminoType: '/verana.td.v1.MsgSlashTrustDeposit',
293
- toAmino: ({ authority, account, amount }) => ({
294
- authority,
295
- account,
296
- amount,
297
- }),
298
- fromAmino: (value) => tx_4.MsgSlashTrustDeposit.fromPartial({
299
- authority: value.authority,
300
- account: value.account,
301
- amount: value.amount,
302
- }),
303
- };
304
- // ============================================================================
305
- // Permission (PERM) Module Converters
306
- // ============================================================================
307
- exports.MsgCreateRootPermissionAminoConverter = {
308
- aminoType: '/verana.perm.v1.MsgCreateRootPermission',
309
- toAmino: (m) => {
310
- var _a, _b, _c;
311
- return clean({
312
- authority: (_a = m.authority) !== null && _a !== void 0 ? _a : '',
313
- operator: (_b = m.operator) !== null && _b !== void 0 ? _b : '',
314
- schema_id: u64ToStr(m.schemaId),
315
- did: (_c = m.did) !== null && _c !== void 0 ? _c : '',
316
- effective_from: dateToAmino(m.effectiveFrom),
317
- effective_until: dateToAmino(m.effectiveUntil),
318
- validation_fees: u64ToStr(m.validationFees),
319
- issuance_fees: u64ToStr(m.issuanceFees),
320
- verification_fees: u64ToStr(m.verificationFees),
321
- });
322
- },
323
- fromAmino: (a) => {
324
- var _a, _b, _c;
325
- return tx_5.MsgCreateRootPermission.fromPartial({
326
- authority: (_a = a.authority) !== null && _a !== void 0 ? _a : '',
327
- operator: (_b = a.operator) !== null && _b !== void 0 ? _b : '',
328
- schemaId: strToU64(a.schema_id) != null ? Number(strToU64(a.schema_id).toString()) : 0,
329
- did: (_c = a.did) !== null && _c !== void 0 ? _c : '',
330
- effectiveFrom: dateFromAmino(a.effective_from),
331
- effectiveUntil: dateFromAmino(a.effective_until),
332
- validationFees: strToU64(a.validation_fees) != null ? Number(strToU64(a.validation_fees).toString()) : 0,
333
- issuanceFees: strToU64(a.issuance_fees) != null ? Number(strToU64(a.issuance_fees).toString()) : 0,
334
- verificationFees: strToU64(a.verification_fees) != null ? Number(strToU64(a.verification_fees).toString()) : 0,
335
- });
336
- },
337
- };
338
- exports.MsgAdjustPermissionAminoConverter = {
339
- aminoType: '/verana.perm.v1.MsgAdjustPermission',
340
- toAmino: (m) => {
341
- var _a, _b;
342
- return clean({
343
- authority: (_a = m.authority) !== null && _a !== void 0 ? _a : '',
344
- operator: (_b = m.operator) !== null && _b !== void 0 ? _b : '',
345
- id: u64ToStr(m.id),
346
- effective_until: dateToAmino(m.effectiveUntil),
347
- });
348
- },
349
- fromAmino: (a) => {
350
- var _a, _b;
351
- return tx_5.MsgAdjustPermission.fromPartial({
352
- authority: (_a = a.authority) !== null && _a !== void 0 ? _a : '',
353
- operator: (_b = a.operator) !== null && _b !== void 0 ? _b : '',
354
- id: strToU64(a.id) != null ? Number(strToU64(a.id).toString()) : 0,
355
- effectiveUntil: dateFromAmino(a.effective_until),
356
- });
357
- },
358
- };
359
- exports.MsgRevokePermissionAminoConverter = {
360
- aminoType: '/verana.perm.v1.MsgRevokePermission',
361
- toAmino: (m) => {
362
- var _a, _b;
363
- return clean({
364
- authority: (_a = m.authority) !== null && _a !== void 0 ? _a : '',
365
- operator: (_b = m.operator) !== null && _b !== void 0 ? _b : '',
366
- id: u64ToStr(m.id),
367
- });
368
- },
369
- fromAmino: (a) => {
370
- var _a, _b;
371
- return tx_5.MsgRevokePermission.fromPartial({
372
- authority: (_a = a.authority) !== null && _a !== void 0 ? _a : '',
373
- operator: (_b = a.operator) !== null && _b !== void 0 ? _b : '',
374
- id: strToU64(a.id) != null ? Number(strToU64(a.id).toString()) : 0,
375
- });
376
- },
377
- };
378
- exports.MsgStartPermissionVPAminoConverter = {
379
- aminoType: '/verana.perm.v1.MsgStartPermissionVP',
380
- toAmino: (m) => {
381
- var _a, _b, _c, _d, _e, _f, _g;
382
- return clean({
383
- authority: (_a = m.authority) !== null && _a !== void 0 ? _a : '',
384
- operator: (_b = m.operator) !== null && _b !== void 0 ? _b : '',
385
- type: (_c = m.type) !== null && _c !== void 0 ? _c : types_1.PermissionType.UNSPECIFIED,
386
- validator_perm_id: u64ToStr(m.validatorPermId),
387
- did: (_d = m.did) !== null && _d !== void 0 ? _d : '',
388
- validation_fees: m.validationFees ? { value: u64ToStr(m.validationFees.value) } : undefined,
389
- issuance_fees: m.issuanceFees ? { value: u64ToStr(m.issuanceFees.value) } : undefined,
390
- verification_fees: m.verificationFees ? { value: u64ToStr(m.verificationFees.value) } : undefined,
391
- vs_operator: m.vsOperator || undefined,
392
- vs_operator_authz_enabled: m.vsOperatorAuthzEnabled || undefined,
393
- vs_operator_authz_spend_limit: (_e = m.vsOperatorAuthzSpendLimit) !== null && _e !== void 0 ? _e : [],
394
- vs_operator_authz_with_feegrant: m.vsOperatorAuthzWithFeegrant || undefined,
395
- vs_operator_authz_fee_spend_limit: (_f = m.vsOperatorAuthzFeeSpendLimit) !== null && _f !== void 0 ? _f : [],
396
- vs_operator_authz_spend_period: (_g = m.vsOperatorAuthzSpendPeriod) !== null && _g !== void 0 ? _g : undefined,
397
- });
398
- },
399
- fromAmino: (a) => {
400
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
401
- return tx_5.MsgStartPermissionVP.fromPartial({
402
- authority: (_a = a.authority) !== null && _a !== void 0 ? _a : '',
403
- operator: (_b = a.operator) !== null && _b !== void 0 ? _b : '',
404
- type: (_c = a.type) !== null && _c !== void 0 ? _c : types_1.PermissionType.UNSPECIFIED,
405
- validatorPermId: strToU64(a.validator_perm_id) != null ? Number(strToU64(a.validator_perm_id).toString()) : 0,
406
- did: (_d = a.did) !== null && _d !== void 0 ? _d : '',
407
- validationFees: a.validation_fees ? { value: Number(a.validation_fees.value) } : undefined,
408
- issuanceFees: a.issuance_fees ? { value: Number(a.issuance_fees.value) } : undefined,
409
- verificationFees: a.verification_fees ? { value: Number(a.verification_fees.value) } : undefined,
410
- vsOperator: (_e = a.vs_operator) !== null && _e !== void 0 ? _e : '',
411
- vsOperatorAuthzEnabled: (_f = a.vs_operator_authz_enabled) !== null && _f !== void 0 ? _f : false,
412
- vsOperatorAuthzSpendLimit: (_g = a.vs_operator_authz_spend_limit) !== null && _g !== void 0 ? _g : [],
413
- vsOperatorAuthzWithFeegrant: (_h = a.vs_operator_authz_with_feegrant) !== null && _h !== void 0 ? _h : false,
414
- vsOperatorAuthzFeeSpendLimit: (_j = a.vs_operator_authz_fee_spend_limit) !== null && _j !== void 0 ? _j : [],
415
- vsOperatorAuthzSpendPeriod: (_k = a.vs_operator_authz_spend_period) !== null && _k !== void 0 ? _k : undefined,
416
- });
417
- },
418
- };
419
- exports.MsgRenewPermissionVPAminoConverter = {
420
- aminoType: '/verana.perm.v1.MsgRenewPermissionVP',
421
- toAmino: (m) => {
422
- var _a, _b;
423
- return clean({
424
- authority: (_a = m.authority) !== null && _a !== void 0 ? _a : '',
425
- operator: (_b = m.operator) !== null && _b !== void 0 ? _b : '',
426
- id: u64ToStr(m.id),
427
- });
428
- },
429
- fromAmino: (a) => {
430
- var _a, _b;
431
- return tx_5.MsgRenewPermissionVP.fromPartial({
432
- authority: (_a = a.authority) !== null && _a !== void 0 ? _a : '',
433
- operator: (_b = a.operator) !== null && _b !== void 0 ? _b : '',
434
- id: strToU64(a.id) != null ? Number(strToU64(a.id).toString()) : 0,
435
- });
436
- },
437
- };
438
- exports.MsgSetPermissionVPToValidatedAminoConverter = {
439
- aminoType: '/verana.perm.v1.MsgSetPermissionVPToValidated',
440
- toAmino: (m) => {
441
- var _a, _b, _c;
442
- return clean({
443
- authority: (_a = m.authority) !== null && _a !== void 0 ? _a : '',
444
- operator: (_b = m.operator) !== null && _b !== void 0 ? _b : '',
445
- id: u64ToStr(m.id),
446
- effective_until: dateToAmino(m.effectiveUntil),
447
- validation_fees: u64ToStr(m.validationFees),
448
- issuance_fees: u64ToStr(m.issuanceFees),
449
- verification_fees: u64ToStr(m.verificationFees),
450
- vp_summary_digest_sri: (_c = m.vpSummaryDigestSri) !== null && _c !== void 0 ? _c : '',
451
- issuance_fee_discount: u64ToStr(m.issuanceFeeDiscount),
452
- verification_fee_discount: u64ToStr(m.verificationFeeDiscount),
453
- });
454
- },
455
- fromAmino: (a) => {
456
- var _a, _b, _c;
457
- return tx_5.MsgSetPermissionVPToValidated.fromPartial({
458
- authority: (_a = a.authority) !== null && _a !== void 0 ? _a : '',
459
- operator: (_b = a.operator) !== null && _b !== void 0 ? _b : '',
460
- id: strToU64(a.id) != null ? Number(strToU64(a.id).toString()) : 0,
461
- effectiveUntil: dateFromAmino(a.effective_until),
462
- validationFees: strToU64(a.validation_fees) != null ? Number(strToU64(a.validation_fees).toString()) : 0,
463
- issuanceFees: strToU64(a.issuance_fees) != null ? Number(strToU64(a.issuance_fees).toString()) : 0,
464
- verificationFees: strToU64(a.verification_fees) != null ? Number(strToU64(a.verification_fees).toString()) : 0,
465
- vpSummaryDigestSri: (_c = a.vp_summary_digest_sri) !== null && _c !== void 0 ? _c : '',
466
- issuanceFeeDiscount: strToU64(a.issuance_fee_discount) != null ? Number(strToU64(a.issuance_fee_discount).toString()) : 0,
467
- verificationFeeDiscount: strToU64(a.verification_fee_discount) != null ? Number(strToU64(a.verification_fee_discount).toString()) : 0,
468
- });
469
- },
470
- };
471
- exports.MsgCancelPermissionVPLastRequestAminoConverter = {
472
- aminoType: '/verana.perm.v1.MsgCancelPermissionVPLastRequest',
473
- toAmino: (m) => {
474
- var _a, _b;
475
- return clean({
476
- authority: (_a = m.authority) !== null && _a !== void 0 ? _a : '',
477
- operator: (_b = m.operator) !== null && _b !== void 0 ? _b : '',
478
- id: u64ToStr(m.id),
479
- });
480
- },
481
- fromAmino: (a) => {
482
- var _a, _b;
483
- return tx_5.MsgCancelPermissionVPLastRequest.fromPartial({
484
- authority: (_a = a.authority) !== null && _a !== void 0 ? _a : '',
485
- operator: (_b = a.operator) !== null && _b !== void 0 ? _b : '',
486
- id: strToU64(a.id) != null ? Number(strToU64(a.id).toString()) : 0,
487
- });
488
- },
489
- };
490
- exports.MsgCreateOrUpdatePermissionSessionAminoConverter = {
491
- aminoType: '/verana.perm.v1.MsgCreateOrUpdatePermissionSession',
492
- toAmino: (m) => {
493
- var _a, _b, _c, _d;
494
- return clean({
495
- authority: (_a = m.authority) !== null && _a !== void 0 ? _a : '',
496
- operator: (_b = m.operator) !== null && _b !== void 0 ? _b : '',
497
- id: (_c = m.id) !== null && _c !== void 0 ? _c : '',
498
- issuer_perm_id: u64ToStr(m.issuerPermId),
499
- verifier_perm_id: u64ToStr(m.verifierPermId),
500
- agent_perm_id: u64ToStr(m.agentPermId),
501
- wallet_agent_perm_id: u64ToStr(m.walletAgentPermId),
502
- digest: (_d = m.digest) !== null && _d !== void 0 ? _d : undefined,
503
- });
504
- },
505
- fromAmino: (a) => {
506
- var _a, _b, _c, _d;
507
- return tx_5.MsgCreateOrUpdatePermissionSession.fromPartial({
508
- authority: (_a = a.authority) !== null && _a !== void 0 ? _a : '',
509
- operator: (_b = a.operator) !== null && _b !== void 0 ? _b : '',
510
- id: (_c = a.id) !== null && _c !== void 0 ? _c : '',
511
- issuerPermId: strToU64(a.issuer_perm_id) != null ? Number(strToU64(a.issuer_perm_id).toString()) : 0,
512
- verifierPermId: strToU64(a.verifier_perm_id) != null ? Number(strToU64(a.verifier_perm_id).toString()) : 0,
513
- agentPermId: strToU64(a.agent_perm_id) != null ? Number(strToU64(a.agent_perm_id).toString()) : 0,
514
- walletAgentPermId: strToU64(a.wallet_agent_perm_id) != null ? Number(strToU64(a.wallet_agent_perm_id).toString()) : 0,
515
- digest: (_d = a.digest) !== null && _d !== void 0 ? _d : '',
516
- });
517
- },
518
- };
519
- exports.MsgSlashPermissionTrustDepositAminoConverter = {
520
- aminoType: '/verana.perm.v1.MsgSlashPermissionTrustDeposit',
521
- toAmino: (m) => {
522
- var _a, _b;
523
- return clean({
524
- authority: (_a = m.authority) !== null && _a !== void 0 ? _a : '',
525
- operator: (_b = m.operator) !== null && _b !== void 0 ? _b : '',
526
- id: u64ToStr(m.id),
527
- amount: u64ToStr(m.amount),
528
- });
529
- },
530
- fromAmino: (a) => {
531
- var _a, _b;
532
- return tx_5.MsgSlashPermissionTrustDeposit.fromPartial({
533
- authority: (_a = a.authority) !== null && _a !== void 0 ? _a : '',
534
- operator: (_b = a.operator) !== null && _b !== void 0 ? _b : '',
535
- id: strToU64(a.id) != null ? Number(strToU64(a.id).toString()) : 0,
536
- amount: strToU64(a.amount) != null ? Number(strToU64(a.amount).toString()) : 0,
537
- });
538
- },
539
- };
540
- exports.MsgRepayPermissionSlashedTrustDepositAminoConverter = {
541
- aminoType: '/verana.perm.v1.MsgRepayPermissionSlashedTrustDeposit',
542
- toAmino: (m) => {
543
- var _a, _b;
544
- return clean({
545
- authority: (_a = m.authority) !== null && _a !== void 0 ? _a : '',
546
- operator: (_b = m.operator) !== null && _b !== void 0 ? _b : '',
547
- id: u64ToStr(m.id),
548
- });
549
- },
550
- fromAmino: (a) => {
551
- var _a, _b;
552
- return tx_5.MsgRepayPermissionSlashedTrustDeposit.fromPartial({
553
- authority: (_a = a.authority) !== null && _a !== void 0 ? _a : '',
554
- operator: (_b = a.operator) !== null && _b !== void 0 ? _b : '',
555
- id: strToU64(a.id) != null ? Number(strToU64(a.id).toString()) : 0,
556
- });
557
- },
558
- };
559
- exports.MsgCreatePermissionAminoConverter = {
560
- aminoType: '/verana.perm.v1.MsgCreatePermission',
561
- toAmino: (m) => {
562
- var _a, _b, _c, _d, _e, _f, _g;
563
- return clean({
564
- authority: (_a = m.authority) !== null && _a !== void 0 ? _a : '',
565
- operator: (_b = m.operator) !== null && _b !== void 0 ? _b : '',
566
- type: (_c = m.type) !== null && _c !== void 0 ? _c : 0,
567
- validator_perm_id: u64ToStr(m.validatorPermId),
568
- did: (_d = m.did) !== null && _d !== void 0 ? _d : '',
569
- effective_from: dateToAmino(m.effectiveFrom),
570
- effective_until: dateToAmino(m.effectiveUntil),
571
- verification_fees: u64ToStrIfNonZero(m.verificationFees),
572
- validation_fees: u64ToStrIfNonZero(m.validationFees),
573
- vs_operator: m.vsOperator || undefined,
574
- vs_operator_authz_enabled: m.vsOperatorAuthzEnabled || undefined,
575
- vs_operator_authz_spend_limit: (_e = m.vsOperatorAuthzSpendLimit) !== null && _e !== void 0 ? _e : [],
576
- vs_operator_authz_with_feegrant: m.vsOperatorAuthzWithFeegrant || undefined,
577
- vs_operator_authz_fee_spend_limit: (_f = m.vsOperatorAuthzFeeSpendLimit) !== null && _f !== void 0 ? _f : [],
578
- vs_operator_authz_spend_period: (_g = m.vsOperatorAuthzSpendPeriod) !== null && _g !== void 0 ? _g : undefined,
579
- });
580
- },
581
- fromAmino: (a) => {
582
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
583
- return tx_5.MsgCreatePermission.fromPartial({
584
- authority: (_a = a.authority) !== null && _a !== void 0 ? _a : '',
585
- operator: (_b = a.operator) !== null && _b !== void 0 ? _b : '',
586
- type: (_c = a.type) !== null && _c !== void 0 ? _c : 0,
587
- validatorPermId: strToU64(a.validator_perm_id) != null ? Number(strToU64(a.validator_perm_id).toString()) : 0,
588
- did: (_d = a.did) !== null && _d !== void 0 ? _d : '',
589
- effectiveFrom: dateFromAmino(a.effective_from),
590
- effectiveUntil: dateFromAmino(a.effective_until),
591
- verificationFees: strToU64(a.verification_fees) != null ? Number(strToU64(a.verification_fees).toString()) : 0,
592
- validationFees: strToU64(a.validation_fees) != null ? Number(strToU64(a.validation_fees).toString()) : 0,
593
- vsOperator: (_e = a.vs_operator) !== null && _e !== void 0 ? _e : '',
594
- vsOperatorAuthzEnabled: (_f = a.vs_operator_authz_enabled) !== null && _f !== void 0 ? _f : false,
595
- vsOperatorAuthzSpendLimit: (_g = a.vs_operator_authz_spend_limit) !== null && _g !== void 0 ? _g : [],
596
- vsOperatorAuthzWithFeegrant: (_h = a.vs_operator_authz_with_feegrant) !== null && _h !== void 0 ? _h : false,
597
- vsOperatorAuthzFeeSpendLimit: (_j = a.vs_operator_authz_fee_spend_limit) !== null && _j !== void 0 ? _j : [],
598
- vsOperatorAuthzSpendPeriod: (_k = a.vs_operator_authz_spend_period) !== null && _k !== void 0 ? _k : undefined,
599
- });
600
- },
601
- };
602
- // ============================================================================
603
- // Delegation Engine (DE) Module Converters
604
- // ============================================================================
605
- exports.MsgGrantOperatorAuthorizationAminoConverter = {
606
- aminoType: '/verana.de.v1.MsgGrantOperatorAuthorization',
607
- toAmino: (m) => {
608
- var _a, _b, _c, _d, _e;
609
- return clean({
610
- authority: m.authority || undefined,
611
- operator: m.operator || undefined,
612
- grantee: m.grantee || undefined,
613
- msg_types: ((_a = m.msgTypes) === null || _a === void 0 ? void 0 : _a.length) ? m.msgTypes : undefined,
614
- expiration: dateToAmino(m.expiration),
615
- authz_spend_limit: ((_b = m.authzSpendLimit) === null || _b === void 0 ? void 0 : _b.length) ? m.authzSpendLimit : undefined,
616
- authz_spend_limit_period: m.authzSpendLimitPeriod ? {
617
- seconds: (_c = m.authzSpendLimitPeriod.seconds) === null || _c === void 0 ? void 0 : _c.toString(),
618
- nanos: m.authzSpendLimitPeriod.nanos,
619
- } : undefined,
620
- with_feegrant: m.withFeegrant || undefined,
621
- feegrant_spend_limit: ((_d = m.feegrantSpendLimit) === null || _d === void 0 ? void 0 : _d.length) ? m.feegrantSpendLimit : undefined,
622
- feegrant_spend_limit_period: m.feegrantSpendLimitPeriod ? {
623
- seconds: (_e = m.feegrantSpendLimitPeriod.seconds) === null || _e === void 0 ? void 0 : _e.toString(),
624
- nanos: m.feegrantSpendLimitPeriod.nanos,
625
- } : undefined,
626
- });
627
- },
628
- fromAmino: (a) => {
629
- var _a, _b, _c, _d, _e, _f, _g;
630
- return tx_2.MsgGrantOperatorAuthorization.fromPartial({
631
- authority: (_a = a.authority) !== null && _a !== void 0 ? _a : '',
632
- operator: (_b = a.operator) !== null && _b !== void 0 ? _b : '',
633
- grantee: (_c = a.grantee) !== null && _c !== void 0 ? _c : '',
634
- msgTypes: (_d = a.msg_types) !== null && _d !== void 0 ? _d : [],
635
- expiration: dateFromAmino(a.expiration),
636
- authzSpendLimit: (_e = a.authz_spend_limit) !== null && _e !== void 0 ? _e : [],
637
- withFeegrant: (_f = a.with_feegrant) !== null && _f !== void 0 ? _f : false,
638
- feegrantSpendLimit: (_g = a.feegrant_spend_limit) !== null && _g !== void 0 ? _g : [],
639
- });
640
- },
641
- };
642
- exports.MsgRevokeOperatorAuthorizationAminoConverter = {
643
- aminoType: '/verana.de.v1.MsgRevokeOperatorAuthorization',
644
- toAmino: ({ authority, operator, grantee }) => clean({
645
- authority: authority || undefined,
646
- operator: operator || undefined,
647
- grantee: grantee || undefined,
648
- }),
649
- fromAmino: (value) => tx_2.MsgRevokeOperatorAuthorization.fromPartial({
650
- authority: value.authority,
651
- operator: value.operator,
652
- grantee: value.grantee,
653
- }),
654
- };
17
+ __exportStar(require("../amino-converter/tr"), exports);
18
+ __exportStar(require("../amino-converter/cs"), exports);
19
+ __exportStar(require("../amino-converter/td"), exports);
20
+ __exportStar(require("../amino-converter/perm"), exports);
21
+ __exportStar(require("../amino-converter/de"), exports);
22
+ __exportStar(require("../amino-converter/di"), exports);
23
+ __exportStar(require("../amino-converter/xr"), exports);
24
+ __exportStar(require("../amino-converter/util/helpers"), exports);