@verana-labs/verana-types 0.10.1-dev.12 → 0.10.1-dev.14
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/dist/amino-converter/co.d.ts +3 -0
- package/dist/amino-converter/co.js +164 -0
- package/dist/amino-converter/cs.js +2 -2
- package/dist/amino-converter/ec.d.ts +4 -0
- package/dist/amino-converter/ec.js +63 -0
- package/dist/amino-converter/{tr.d.ts → gf.d.ts} +0 -3
- package/dist/amino-converter/gf.js +48 -0
- package/dist/amino-converter/group.d.ts +3 -0
- package/dist/amino-converter/group.js +91 -0
- package/dist/amino-converter/pp.d.ts +12 -0
- package/dist/amino-converter/{perm.js → pp.js} +95 -79
- package/dist/codec/verana/cs/v1/query.d.ts +2 -2
- package/dist/codec/verana/cs/v1/query.js +21 -21
- package/dist/codec/verana/cs/v1/tx.d.ts +1 -1
- package/dist/codec/verana/cs/v1/tx.js +22 -22
- package/dist/codec/verana/cs/v1/types.d.ts +6 -2
- package/dist/codec/verana/cs/v1/types.js +30 -30
- package/dist/codec/verana/de/v1/query.d.ts +72 -4
- package/dist/codec/verana/de/v1/query.js +261 -19
- package/dist/codec/verana/de/v1/types.d.ts +124 -34
- package/dist/codec/verana/de/v1/types.js +361 -109
- package/dist/codec/verana/{tr → ec}/module/module.d.ts +1 -1
- package/dist/codec/verana/{tr → ec}/module/module.js +2 -2
- package/dist/codec/verana/{tr → ec}/v1/genesis.d.ts +10 -12
- package/dist/codec/verana/{tr → ec}/v1/genesis.js +16 -56
- package/dist/codec/verana/{tr → ec}/v1/params.d.ts +1 -1
- package/dist/codec/verana/{tr → ec}/v1/params.js +2 -2
- package/dist/codec/verana/ec/v1/query.d.ts +109 -0
- package/dist/codec/verana/{tr → ec}/v1/query.js +69 -71
- package/dist/codec/verana/ec/v1/tx.d.ts +152 -0
- package/dist/codec/verana/{tr → ec}/v1/tx.js +85 -403
- package/dist/codec/verana/ec/v1/types.d.ts +67 -0
- package/dist/codec/verana/ec/v1/types.js +422 -0
- package/dist/codec/verana/{perm → pp}/module/module.d.ts +1 -1
- package/dist/codec/verana/{perm → pp}/module/module.js +2 -2
- package/dist/codec/verana/{perm → pp}/v1/genesis.d.ts +9 -9
- package/dist/codec/verana/{perm → pp}/v1/genesis.js +26 -26
- package/dist/codec/verana/{perm → pp}/v1/params.d.ts +1 -1
- package/dist/codec/verana/{perm → pp}/v1/params.js +2 -2
- package/dist/codec/verana/pp/v1/query.d.ts +208 -0
- package/dist/codec/verana/{perm → pp}/v1/query.js +148 -148
- package/dist/codec/verana/pp/v1/tx.d.ts +447 -0
- package/dist/codec/verana/{perm → pp}/v1/tx.js +412 -302
- package/dist/codec/verana/pp/v1/types.d.ts +137 -0
- package/dist/codec/verana/{perm → pp}/v1/types.js +270 -345
- package/dist/helpers/aminoConverters.d.ts +6 -4
- package/dist/helpers/aminoConverters.js +6 -4
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/signing.d.ts +36 -32
- package/dist/signing.js +85 -68
- package/package.json +1 -1
- package/dist/amino-converter/perm.d.ts +0 -12
- package/dist/amino-converter/tr.js +0 -107
- package/dist/codec/verana/perm/v1/query.d.ts +0 -208
- package/dist/codec/verana/perm/v1/tx.d.ts +0 -441
- package/dist/codec/verana/perm/v1/types.d.ts +0 -134
- package/dist/codec/verana/tr/v1/query.d.ts +0 -117
- package/dist/codec/verana/tr/v1/tx.d.ts +0 -255
- package/dist/codec/verana/tr/v1/types.d.ts +0 -105
- package/dist/codec/verana/tr/v1/types.js +0 -809
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MsgUpdateCorporationAminoConverter = exports.MsgCreateCorporationAminoConverter = void 0;
|
|
4
|
+
const any_1 = require("../codec/google/protobuf/any");
|
|
5
|
+
const tx_1 = require("../codec/verana/co/v1/tx");
|
|
6
|
+
const types_1 = require("cosmjs-types/cosmos/group/v1/types");
|
|
7
|
+
const helpers_1 = require("./util/helpers");
|
|
8
|
+
// Members serialize as plain objects in amino.
|
|
9
|
+
function memberToAmino(m) {
|
|
10
|
+
return (0, helpers_1.clean)({
|
|
11
|
+
address: m.address || undefined,
|
|
12
|
+
weight: m.weight || undefined,
|
|
13
|
+
metadata: m.metadata || undefined,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function memberFromAmino(a) {
|
|
17
|
+
var _a, _b, _c;
|
|
18
|
+
return tx_1.Member.fromPartial({
|
|
19
|
+
address: (_a = a.address) !== null && _a !== void 0 ? _a : "",
|
|
20
|
+
weight: (_b = a.weight) !== null && _b !== void 0 ? _b : "",
|
|
21
|
+
metadata: (_c = a.metadata) !== null && _c !== void 0 ? _c : "",
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
// Convert a proto Duration ({ seconds: bigint, nanos: number }) to the amino
|
|
25
|
+
// nanosecond integer string that Go amino produces for time.Duration fields.
|
|
26
|
+
function durationToNanosStr(d) {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
if (!d)
|
|
29
|
+
return "0";
|
|
30
|
+
const secs = (_a = d.seconds) !== null && _a !== void 0 ? _a : BigInt(0);
|
|
31
|
+
const nanos = (_b = d.nanos) !== null && _b !== void 0 ? _b : 0;
|
|
32
|
+
return String(secs * BigInt(1000000000) + BigInt(nanos));
|
|
33
|
+
}
|
|
34
|
+
function nanosStrToDuration(ns) {
|
|
35
|
+
const n = BigInt(ns !== null && ns !== void 0 ? ns : "0");
|
|
36
|
+
return { seconds: n / BigInt(1000000000), nanos: Number(n % BigInt(1000000000)) };
|
|
37
|
+
}
|
|
38
|
+
// decision_policy is a google.protobuf.Any wrapping a cosmos x/group decision
|
|
39
|
+
// policy. The Go amino codec encodes it as:
|
|
40
|
+
// {"type": "cosmos-sdk/ThresholdDecisionPolicy", "value": { ... amino fields ... }}
|
|
41
|
+
// where Duration fields are encoded as nanosecond integer strings.
|
|
42
|
+
function anyToAmino(a) {
|
|
43
|
+
if (!a)
|
|
44
|
+
return undefined;
|
|
45
|
+
if (a.typeUrl === "/cosmos.group.v1.ThresholdDecisionPolicy") {
|
|
46
|
+
const dp = types_1.ThresholdDecisionPolicy.decode(a.value);
|
|
47
|
+
return (0, helpers_1.clean)({
|
|
48
|
+
type: "cosmos-sdk/ThresholdDecisionPolicy",
|
|
49
|
+
value: (0, helpers_1.clean)({
|
|
50
|
+
threshold: dp.threshold || undefined,
|
|
51
|
+
windows: dp.windows
|
|
52
|
+
? {
|
|
53
|
+
voting_period: durationToNanosStr(dp.windows.votingPeriod),
|
|
54
|
+
min_execution_period: durationToNanosStr(dp.windows.minExecutionPeriod),
|
|
55
|
+
}
|
|
56
|
+
: undefined,
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (a.typeUrl === "/cosmos.group.v1.PercentageDecisionPolicy") {
|
|
61
|
+
const dp = types_1.PercentageDecisionPolicy.decode(a.value);
|
|
62
|
+
return (0, helpers_1.clean)({
|
|
63
|
+
type: "cosmos-sdk/PercentageDecisionPolicy",
|
|
64
|
+
value: (0, helpers_1.clean)({
|
|
65
|
+
percentage: dp.percentage || undefined,
|
|
66
|
+
windows: dp.windows
|
|
67
|
+
? {
|
|
68
|
+
voting_period: durationToNanosStr(dp.windows.votingPeriod),
|
|
69
|
+
min_execution_period: durationToNanosStr(dp.windows.minExecutionPeriod),
|
|
70
|
+
}
|
|
71
|
+
: undefined,
|
|
72
|
+
}),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
// Fallback for unknown Any types.
|
|
76
|
+
return (0, helpers_1.clean)({
|
|
77
|
+
type: a.typeUrl || undefined,
|
|
78
|
+
value: a.value && a.value.length > 0 ? Buffer.from(a.value).toString("base64") : undefined,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function anyFromAmino(v) {
|
|
82
|
+
var _a, _b, _c, _d, _e;
|
|
83
|
+
if (!v)
|
|
84
|
+
return any_1.Any.fromPartial({ typeUrl: "", value: new Uint8Array() });
|
|
85
|
+
if (v.type === "cosmos-sdk/ThresholdDecisionPolicy") {
|
|
86
|
+
const val = (_a = v.value) !== null && _a !== void 0 ? _a : {};
|
|
87
|
+
const dp = types_1.ThresholdDecisionPolicy.fromPartial({
|
|
88
|
+
threshold: (_b = val.threshold) !== null && _b !== void 0 ? _b : "",
|
|
89
|
+
windows: val.windows
|
|
90
|
+
? {
|
|
91
|
+
votingPeriod: nanosStrToDuration(val.windows.voting_period),
|
|
92
|
+
minExecutionPeriod: nanosStrToDuration(val.windows.min_execution_period),
|
|
93
|
+
}
|
|
94
|
+
: undefined,
|
|
95
|
+
});
|
|
96
|
+
return any_1.Any.fromPartial({
|
|
97
|
+
typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy",
|
|
98
|
+
value: types_1.ThresholdDecisionPolicy.encode(dp).finish(),
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (v.type === "cosmos-sdk/PercentageDecisionPolicy") {
|
|
102
|
+
const val = (_c = v.value) !== null && _c !== void 0 ? _c : {};
|
|
103
|
+
const dp = types_1.PercentageDecisionPolicy.fromPartial({
|
|
104
|
+
percentage: (_d = val.percentage) !== null && _d !== void 0 ? _d : "",
|
|
105
|
+
windows: val.windows
|
|
106
|
+
? {
|
|
107
|
+
votingPeriod: nanosStrToDuration(val.windows.voting_period),
|
|
108
|
+
minExecutionPeriod: nanosStrToDuration(val.windows.min_execution_period),
|
|
109
|
+
}
|
|
110
|
+
: undefined,
|
|
111
|
+
});
|
|
112
|
+
return any_1.Any.fromPartial({
|
|
113
|
+
typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy",
|
|
114
|
+
value: types_1.PercentageDecisionPolicy.encode(dp).finish(),
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
// Fallback: treat value as base64-encoded proto bytes.
|
|
118
|
+
const bytes = v.value ? new Uint8Array(Buffer.from(v.value, "base64")) : new Uint8Array();
|
|
119
|
+
return any_1.Any.fromPartial({ typeUrl: (_e = v.type) !== null && _e !== void 0 ? _e : "", value: bytes });
|
|
120
|
+
}
|
|
121
|
+
exports.MsgCreateCorporationAminoConverter = {
|
|
122
|
+
aminoType: "verana/x/co/MsgCreateCorporation",
|
|
123
|
+
toAmino: (m) => (0, helpers_1.clean)({
|
|
124
|
+
signer: m.signer || undefined,
|
|
125
|
+
members: m.members && m.members.length > 0 ? m.members.map(memberToAmino) : undefined,
|
|
126
|
+
group_metadata: m.groupMetadata || undefined,
|
|
127
|
+
group_policy_metadata: m.groupPolicyMetadata || undefined,
|
|
128
|
+
decision_policy: anyToAmino(m.decisionPolicy),
|
|
129
|
+
did: m.did || undefined,
|
|
130
|
+
language: m.language || undefined,
|
|
131
|
+
doc_url: m.docUrl || undefined,
|
|
132
|
+
doc_digest_sri: m.docDigestSri || undefined,
|
|
133
|
+
}),
|
|
134
|
+
fromAmino: (a) => {
|
|
135
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
136
|
+
return tx_1.MsgCreateCorporation.fromPartial({
|
|
137
|
+
signer: (_a = a.signer) !== null && _a !== void 0 ? _a : "",
|
|
138
|
+
members: Array.isArray(a.members) ? a.members.map(memberFromAmino) : [],
|
|
139
|
+
groupMetadata: (_b = a.group_metadata) !== null && _b !== void 0 ? _b : "",
|
|
140
|
+
groupPolicyMetadata: (_c = a.group_policy_metadata) !== null && _c !== void 0 ? _c : "",
|
|
141
|
+
decisionPolicy: anyFromAmino(a.decision_policy),
|
|
142
|
+
did: (_d = a.did) !== null && _d !== void 0 ? _d : "",
|
|
143
|
+
language: (_e = a.language) !== null && _e !== void 0 ? _e : "",
|
|
144
|
+
docUrl: (_f = a.doc_url) !== null && _f !== void 0 ? _f : "",
|
|
145
|
+
docDigestSri: (_g = a.doc_digest_sri) !== null && _g !== void 0 ? _g : "",
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
exports.MsgUpdateCorporationAminoConverter = {
|
|
150
|
+
aminoType: "verana/x/co/MsgUpdateCorporation",
|
|
151
|
+
toAmino: ({ corporation, operator, did }) => (0, helpers_1.clean)({
|
|
152
|
+
corporation: corporation || undefined,
|
|
153
|
+
operator: operator || undefined,
|
|
154
|
+
did: did || undefined,
|
|
155
|
+
}),
|
|
156
|
+
fromAmino: (value) => {
|
|
157
|
+
var _a, _b, _c;
|
|
158
|
+
return tx_1.MsgUpdateCorporation.fromPartial({
|
|
159
|
+
corporation: (_a = value.corporation) !== null && _a !== void 0 ? _a : "",
|
|
160
|
+
operator: (_b = value.operator) !== null && _b !== void 0 ? _b : "",
|
|
161
|
+
did: (_c = value.did) !== null && _c !== void 0 ? _c : "",
|
|
162
|
+
});
|
|
163
|
+
},
|
|
164
|
+
};
|
|
@@ -10,7 +10,7 @@ exports.MsgCreateCredentialSchemaAminoConverter = {
|
|
|
10
10
|
return (0, helpers_1.clean)({
|
|
11
11
|
corporation: (_a = m.corporation) !== null && _a !== void 0 ? _a : "",
|
|
12
12
|
operator: (_b = m.operator) !== null && _b !== void 0 ? _b : "",
|
|
13
|
-
|
|
13
|
+
ecosystem_id: (0, helpers_1.u64ToStr)(m.ecosystemId),
|
|
14
14
|
json_schema: (_c = m.jsonSchema) !== null && _c !== void 0 ? _c : "",
|
|
15
15
|
issuer_grantor_validation_validity_period: (0, helpers_1.toOptU32Amino)(m.issuerGrantorValidationValidityPeriod),
|
|
16
16
|
verifier_grantor_validation_validity_period: (0, helpers_1.toOptU32Amino)(m.verifierGrantorValidationValidityPeriod),
|
|
@@ -30,7 +30,7 @@ exports.MsgCreateCredentialSchemaAminoConverter = {
|
|
|
30
30
|
return tx_1.MsgCreateCredentialSchema.fromPartial({
|
|
31
31
|
corporation: (_a = a.corporation) !== null && _a !== void 0 ? _a : "",
|
|
32
32
|
operator: (_b = a.operator) !== null && _b !== void 0 ? _b : "",
|
|
33
|
-
|
|
33
|
+
ecosystemId: (0, helpers_1.strToU64)(a.ecosystem_id) != null ? Number((0, helpers_1.strToU64)(a.ecosystem_id).toString()) : 0,
|
|
34
34
|
jsonSchema: (_c = a.json_schema) !== null && _c !== void 0 ? _c : "",
|
|
35
35
|
issuerGrantorValidationValidityPeriod: (0, helpers_1.fromOptU32Amino)(a.issuer_grantor_validation_validity_period),
|
|
36
36
|
verifierGrantorValidationValidityPeriod: (0, helpers_1.fromOptU32Amino)(a.verifier_grantor_validation_validity_period),
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AminoConverter } from "@cosmjs/stargate";
|
|
2
|
+
export declare const MsgCreateEcosystemAminoConverter: AminoConverter;
|
|
3
|
+
export declare const MsgUpdateEcosystemAminoConverter: AminoConverter;
|
|
4
|
+
export declare const MsgArchiveEcosystemAminoConverter: AminoConverter;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MsgArchiveEcosystemAminoConverter = exports.MsgUpdateEcosystemAminoConverter = exports.MsgCreateEcosystemAminoConverter = void 0;
|
|
4
|
+
const tx_1 = require("../codec/verana/ec/v1/tx");
|
|
5
|
+
const helpers_1 = require("./util/helpers");
|
|
6
|
+
exports.MsgCreateEcosystemAminoConverter = {
|
|
7
|
+
aminoType: "verana/x/ec/MsgCreateEcosystem",
|
|
8
|
+
toAmino: ({ corporation, operator, did, language, docUrl, docDigestSri }) => (0, helpers_1.clean)({
|
|
9
|
+
corporation: corporation || undefined,
|
|
10
|
+
operator: operator || undefined,
|
|
11
|
+
did: did || undefined,
|
|
12
|
+
language: language || undefined,
|
|
13
|
+
doc_url: docUrl || undefined,
|
|
14
|
+
doc_digest_sri: docDigestSri || undefined,
|
|
15
|
+
}),
|
|
16
|
+
fromAmino: (value) => {
|
|
17
|
+
var _a, _b, _c, _d, _e, _f;
|
|
18
|
+
return tx_1.MsgCreateEcosystem.fromPartial({
|
|
19
|
+
corporation: (_a = value.corporation) !== null && _a !== void 0 ? _a : "",
|
|
20
|
+
operator: (_b = value.operator) !== null && _b !== void 0 ? _b : "",
|
|
21
|
+
did: (_c = value.did) !== null && _c !== void 0 ? _c : "",
|
|
22
|
+
language: (_d = value.language) !== null && _d !== void 0 ? _d : "",
|
|
23
|
+
docUrl: (_e = value.doc_url) !== null && _e !== void 0 ? _e : "",
|
|
24
|
+
docDigestSri: (_f = value.doc_digest_sri) !== null && _f !== void 0 ? _f : "",
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
exports.MsgUpdateEcosystemAminoConverter = {
|
|
29
|
+
aminoType: "verana/x/ec/MsgUpdateEcosystem",
|
|
30
|
+
toAmino: ({ corporation, operator, id, did }) => (0, helpers_1.clean)({
|
|
31
|
+
corporation: corporation || undefined,
|
|
32
|
+
operator: operator || undefined,
|
|
33
|
+
id: (0, helpers_1.u64ToStr)(id),
|
|
34
|
+
did: did || undefined,
|
|
35
|
+
}),
|
|
36
|
+
fromAmino: (value) => {
|
|
37
|
+
var _a, _b, _c;
|
|
38
|
+
return tx_1.MsgUpdateEcosystem.fromPartial({
|
|
39
|
+
corporation: (_a = value.corporation) !== null && _a !== void 0 ? _a : "",
|
|
40
|
+
operator: (_b = value.operator) !== null && _b !== void 0 ? _b : "",
|
|
41
|
+
id: value.id != null ? Number(value.id) : 0,
|
|
42
|
+
did: (_c = value.did) !== null && _c !== void 0 ? _c : "",
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
exports.MsgArchiveEcosystemAminoConverter = {
|
|
47
|
+
aminoType: "verana/x/ec/MsgArchiveEcosystem",
|
|
48
|
+
toAmino: ({ corporation, operator, id, archive }) => (0, helpers_1.clean)({
|
|
49
|
+
corporation: corporation || undefined,
|
|
50
|
+
operator: operator || undefined,
|
|
51
|
+
id: (0, helpers_1.u64ToStr)(id),
|
|
52
|
+
archive: archive,
|
|
53
|
+
}),
|
|
54
|
+
fromAmino: (value) => {
|
|
55
|
+
var _a, _b, _c;
|
|
56
|
+
return tx_1.MsgArchiveEcosystem.fromPartial({
|
|
57
|
+
corporation: (_a = value.corporation) !== null && _a !== void 0 ? _a : "",
|
|
58
|
+
operator: (_b = value.operator) !== null && _b !== void 0 ? _b : "",
|
|
59
|
+
id: value.id != null ? Number(value.id) : 0,
|
|
60
|
+
archive: (_c = value.archive) !== null && _c !== void 0 ? _c : false,
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import type { AminoConverter } from "@cosmjs/stargate";
|
|
2
|
-
export declare const MsgCreateTrustRegistryAminoConverter: AminoConverter;
|
|
3
|
-
export declare const MsgUpdateTrustRegistryAminoConverter: AminoConverter;
|
|
4
|
-
export declare const MsgArchiveTrustRegistryAminoConverter: AminoConverter;
|
|
5
2
|
export declare const MsgAddGovernanceFrameworkDocumentAminoConverter: AminoConverter;
|
|
6
3
|
export declare const MsgIncreaseActiveGovernanceFrameworkVersionAminoConverter: AminoConverter;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MsgIncreaseActiveGovernanceFrameworkVersionAminoConverter = exports.MsgAddGovernanceFrameworkDocumentAminoConverter = void 0;
|
|
4
|
+
const tx_1 = require("../codec/verana/gf/v1/tx");
|
|
5
|
+
const helpers_1 = require("./util/helpers");
|
|
6
|
+
// MOD-GF Msgs extracted from x/tr in v4-rc2. ecosystem_id is the optional
|
|
7
|
+
// polymorphic subject discriminator: when zero/absent, the target is the
|
|
8
|
+
// signing corporation's own CGF; when set, the target is that Ecosystem.
|
|
9
|
+
exports.MsgAddGovernanceFrameworkDocumentAminoConverter = {
|
|
10
|
+
aminoType: "verana/x/gf/MsgAddGovernanceFrameworkDocument",
|
|
11
|
+
toAmino: ({ corporation, operator, ecosystemId, docLanguage, docUrl, docDigestSri, version, }) => (0, helpers_1.clean)({
|
|
12
|
+
corporation: corporation || undefined,
|
|
13
|
+
operator: operator || undefined,
|
|
14
|
+
ecosystem_id: (0, helpers_1.u64ToStr)(ecosystemId),
|
|
15
|
+
doc_language: docLanguage || undefined,
|
|
16
|
+
doc_url: docUrl || undefined,
|
|
17
|
+
doc_digest_sri: docDigestSri || undefined,
|
|
18
|
+
version: version || undefined,
|
|
19
|
+
}),
|
|
20
|
+
fromAmino: (value) => {
|
|
21
|
+
var _a, _b, _c, _d, _e, _f;
|
|
22
|
+
return tx_1.MsgAddGovernanceFrameworkDocument.fromPartial({
|
|
23
|
+
corporation: (_a = value.corporation) !== null && _a !== void 0 ? _a : "",
|
|
24
|
+
operator: (_b = value.operator) !== null && _b !== void 0 ? _b : "",
|
|
25
|
+
ecosystemId: value.ecosystem_id != null ? Number(value.ecosystem_id) : 0,
|
|
26
|
+
docLanguage: (_c = value.doc_language) !== null && _c !== void 0 ? _c : "",
|
|
27
|
+
docUrl: (_d = value.doc_url) !== null && _d !== void 0 ? _d : "",
|
|
28
|
+
docDigestSri: (_e = value.doc_digest_sri) !== null && _e !== void 0 ? _e : "",
|
|
29
|
+
version: (_f = value.version) !== null && _f !== void 0 ? _f : 0,
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
exports.MsgIncreaseActiveGovernanceFrameworkVersionAminoConverter = {
|
|
34
|
+
aminoType: "verana/x/gf/MsgIncreaseActiveGovernanceFrameworkVersion",
|
|
35
|
+
toAmino: ({ corporation, operator, ecosystemId }) => (0, helpers_1.clean)({
|
|
36
|
+
corporation: corporation || undefined,
|
|
37
|
+
operator: operator || undefined,
|
|
38
|
+
ecosystem_id: (0, helpers_1.u64ToStr)(ecosystemId),
|
|
39
|
+
}),
|
|
40
|
+
fromAmino: (value) => {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
return tx_1.MsgIncreaseActiveGovernanceFrameworkVersion.fromPartial({
|
|
43
|
+
corporation: (_a = value.corporation) !== null && _a !== void 0 ? _a : "",
|
|
44
|
+
operator: (_b = value.operator) !== null && _b !== void 0 ? _b : "",
|
|
45
|
+
ecosystemId: value.ecosystem_id != null ? Number(value.ecosystem_id) : 0,
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -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,12 @@
|
|
|
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;
|