@sparkdreamnft/sparkdreamjs 0.0.12 → 0.0.13
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/esm/nested-amino.js +52 -0
- package/esm/sparkdream/commons/v1/tx.amino.js +68 -29
- package/esm/sparkdream/session/v1/tx.amino.js +30 -8
- package/nested-amino.d.ts +76 -0
- package/nested-amino.js +57 -0
- package/package.json +1 -1
- package/sparkdream/bundle.d.ts +8 -6
- package/sparkdream/client.d.ts +6 -6
- package/sparkdream/commons/v1/tx.amino.d.ts +6 -5
- package/sparkdream/commons/v1/tx.amino.js +70 -30
- package/sparkdream/session/v1/tx.amino.d.ts +3 -3
- package/sparkdream/session/v1/tx.amino.js +30 -8
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//@ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Shared registry + helpers for amino-converting messages that embed a
|
|
4
|
+
* `repeated google.protobuf.Any` field (`MsgSubmitProposal`,
|
|
5
|
+
* `MsgSubmitAnonymousProposal`, `MsgExecSession`).
|
|
6
|
+
*
|
|
7
|
+
* The Telescope-generated `Any.toAmino` just emits `{type, value: Uint8Array}`,
|
|
8
|
+
* which JSON.stringify turns into `{"0":N,"1":N,…}` — numeric keys that aren't
|
|
9
|
+
* lexicographically sorted, breaking Ledger's strict amino-JSON validator and
|
|
10
|
+
* leaving the chain unable to reconstruct identical sign bytes.
|
|
11
|
+
*
|
|
12
|
+
* Consumers must call `configureNestedAminoConverter({registry, aminoTypes})`
|
|
13
|
+
* once after they've built both their proto Registry and their stargate
|
|
14
|
+
* AminoTypes. The patched converters below then look up each inner Any's
|
|
15
|
+
* proto codec (to decode bytes back to a typed message) and its registered
|
|
16
|
+
* amino converter (to render the proper amino JSON) — symmetric to what
|
|
17
|
+
* `cosmossdk.io/x/tx/signing/aminojson` does on the chain side.
|
|
18
|
+
*/
|
|
19
|
+
let cfg = null;
|
|
20
|
+
export function configureNestedAminoConverter(next) {
|
|
21
|
+
cfg = next;
|
|
22
|
+
}
|
|
23
|
+
function requireCfg() {
|
|
24
|
+
if (!cfg) {
|
|
25
|
+
throw new Error("@sparkdreamnft/sparkdreamjs: configureNestedAminoConverter({registry, aminoTypes}) " +
|
|
26
|
+
"must be called before amino-signing a tx with MsgSubmitProposal / " +
|
|
27
|
+
"MsgSubmitAnonymousProposal / MsgExecSession (their `messages` / `msgs` " +
|
|
28
|
+
"field needs recursive Any conversion that Telescope can't generate).");
|
|
29
|
+
}
|
|
30
|
+
return cfg;
|
|
31
|
+
}
|
|
32
|
+
/** Convert one proto-encoded Any to its amino representation. */
|
|
33
|
+
export function anyToAmino(any) {
|
|
34
|
+
const { registry, aminoTypes } = requireCfg();
|
|
35
|
+
const codec = registry.lookupType(any.typeUrl);
|
|
36
|
+
if (!codec) {
|
|
37
|
+
throw new Error(`No proto codec registered for inner type ${any.typeUrl}. ` +
|
|
38
|
+
`Ensure the corresponding module's load() has been called on your Registry.`);
|
|
39
|
+
}
|
|
40
|
+
const decoded = codec.decode(any.value);
|
|
41
|
+
return aminoTypes.toAmino({ typeUrl: any.typeUrl, value: decoded });
|
|
42
|
+
}
|
|
43
|
+
/** Convert one amino-typed entry back to a proto-encoded Any. */
|
|
44
|
+
export function aminoToAny(entry) {
|
|
45
|
+
const { registry, aminoTypes } = requireCfg();
|
|
46
|
+
const decoded = aminoTypes.fromAmino(entry);
|
|
47
|
+
const codec = registry.lookupType(decoded.typeUrl);
|
|
48
|
+
if (!codec) {
|
|
49
|
+
throw new Error(`No proto codec registered for inner type ${decoded.typeUrl}.`);
|
|
50
|
+
}
|
|
51
|
+
return { typeUrl: decoded.typeUrl, value: codec.encode(codec.fromPartial(decoded.value)).finish() };
|
|
52
|
+
}
|
|
@@ -1,99 +1,138 @@
|
|
|
1
1
|
//@ts-nocheck
|
|
2
|
-
|
|
2
|
+
// HAND-WRITTEN OVERRIDE — overlaid on top of the Telescope-generated tx.amino.ts
|
|
3
|
+
// by scripts/codegen.ts after each codegen run. Do not let codegen wipe this.
|
|
4
|
+
//
|
|
5
|
+
// Why: Telescope emits a flat AminoConverter that hands each entry's toAmino
|
|
6
|
+
// straight through to the message's auto-generated toAmino. For
|
|
7
|
+
// MsgSubmitProposal and MsgSubmitAnonymousProposal (both have
|
|
8
|
+
// `repeated google.protobuf.Any messages`), the auto-generated toAmino calls
|
|
9
|
+
// Any.toAmino which just attaches the raw Uint8Array bytes — Ledger rejects
|
|
10
|
+
// the resulting JSON ("Dictionaries are not sorted") and the chain produces
|
|
11
|
+
// different sign bytes ("signature verification failed").
|
|
12
|
+
//
|
|
13
|
+
// This override delegates the inner Any conversion to a consumer-supplied
|
|
14
|
+
// proto registry + AminoTypes via `configureNestedAminoConverter`. The rest of
|
|
15
|
+
// the converters are unchanged.
|
|
16
|
+
import { MsgUpdateParams, MsgSpendFromCommons, MsgEmergencyCancelGovProposal, MsgCreatePolicyPermissions, MsgUpdatePolicyPermissions, MsgDeletePolicyPermissions, MsgRegisterGroup, MsgRenewGroup, MsgUpdateGroupMembers, MsgUpdateGroupConfig, MsgForceUpgrade, MsgDeleteGroup, MsgVetoGroupProposals, MsgVoteProposal, MsgExecuteProposal, MsgAnonymousVoteProposal, MsgCreateCategory, } from "./tx";
|
|
17
|
+
import { anyToAmino, aminoToAny } from "../../../nested-amino";
|
|
18
|
+
export { configureNestedAminoConverter } from "../../../nested-amino";
|
|
19
|
+
// Both proposal-submission messages share the same shape, so they share a
|
|
20
|
+
// converter factory.
|
|
21
|
+
function buildProposalConverter(aminoType) {
|
|
22
|
+
return {
|
|
23
|
+
aminoType,
|
|
24
|
+
toAmino(message) {
|
|
25
|
+
const obj = {};
|
|
26
|
+
obj.proposer = message.proposer === "" ? undefined : message.proposer;
|
|
27
|
+
obj.policy_address = message.policyAddress === "" ? undefined : message.policyAddress;
|
|
28
|
+
// Mirror cosmossdk.io/x/tx/signing/aminojson's omitempty default for
|
|
29
|
+
// repeated fields: omit when empty rather than emitting `[]`. Otherwise
|
|
30
|
+
// the JS side signs `"messages":[]` and the chain reconstructs without
|
|
31
|
+
// the key, causing signature verification to fail.
|
|
32
|
+
obj.messages = (message.messages?.length ?? 0) > 0
|
|
33
|
+
? message.messages.map((a) => anyToAmino(a))
|
|
34
|
+
: undefined;
|
|
35
|
+
obj.metadata = message.metadata === "" ? undefined : message.metadata;
|
|
36
|
+
return obj;
|
|
37
|
+
},
|
|
38
|
+
fromAmino(object) {
|
|
39
|
+
return {
|
|
40
|
+
proposer: object.proposer ?? "",
|
|
41
|
+
policyAddress: object.policy_address ?? "",
|
|
42
|
+
messages: (object.messages ?? []).map((e) => aminoToAny(e)),
|
|
43
|
+
metadata: object.metadata ?? "",
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
3
48
|
export const AminoConverter = {
|
|
4
49
|
"/sparkdream.commons.v1.MsgUpdateParams": {
|
|
5
50
|
aminoType: "sparkdream/x/commons/MsgUpdateParams",
|
|
6
51
|
toAmino: MsgUpdateParams.toAmino,
|
|
7
|
-
fromAmino: MsgUpdateParams.fromAmino
|
|
52
|
+
fromAmino: MsgUpdateParams.fromAmino,
|
|
8
53
|
},
|
|
9
54
|
"/sparkdream.commons.v1.MsgSpendFromCommons": {
|
|
10
55
|
aminoType: "sparkdream/x/commons/MsgSpendFromCommons",
|
|
11
56
|
toAmino: MsgSpendFromCommons.toAmino,
|
|
12
|
-
fromAmino: MsgSpendFromCommons.fromAmino
|
|
57
|
+
fromAmino: MsgSpendFromCommons.fromAmino,
|
|
13
58
|
},
|
|
14
59
|
"/sparkdream.commons.v1.MsgEmergencyCancelGovProposal": {
|
|
15
60
|
aminoType: "sparkdream/x/commons/MsgEmergencyCancelGovProposal",
|
|
16
61
|
toAmino: MsgEmergencyCancelGovProposal.toAmino,
|
|
17
|
-
fromAmino: MsgEmergencyCancelGovProposal.fromAmino
|
|
62
|
+
fromAmino: MsgEmergencyCancelGovProposal.fromAmino,
|
|
18
63
|
},
|
|
19
64
|
"/sparkdream.commons.v1.MsgCreatePolicyPermissions": {
|
|
20
65
|
aminoType: "sparkdream/x/commons/MsgCreatePolicyPermissions",
|
|
21
66
|
toAmino: MsgCreatePolicyPermissions.toAmino,
|
|
22
|
-
fromAmino: MsgCreatePolicyPermissions.fromAmino
|
|
67
|
+
fromAmino: MsgCreatePolicyPermissions.fromAmino,
|
|
23
68
|
},
|
|
24
69
|
"/sparkdream.commons.v1.MsgUpdatePolicyPermissions": {
|
|
25
70
|
aminoType: "sparkdream/x/commons/MsgUpdatePolicyPermissions",
|
|
26
71
|
toAmino: MsgUpdatePolicyPermissions.toAmino,
|
|
27
|
-
fromAmino: MsgUpdatePolicyPermissions.fromAmino
|
|
72
|
+
fromAmino: MsgUpdatePolicyPermissions.fromAmino,
|
|
28
73
|
},
|
|
29
74
|
"/sparkdream.commons.v1.MsgDeletePolicyPermissions": {
|
|
30
75
|
aminoType: "sparkdream/x/commons/MsgDeletePolicyPermissions",
|
|
31
76
|
toAmino: MsgDeletePolicyPermissions.toAmino,
|
|
32
|
-
fromAmino: MsgDeletePolicyPermissions.fromAmino
|
|
77
|
+
fromAmino: MsgDeletePolicyPermissions.fromAmino,
|
|
33
78
|
},
|
|
34
79
|
"/sparkdream.commons.v1.MsgRegisterGroup": {
|
|
35
80
|
aminoType: "sparkdream/x/commons/MsgRegisterGroup",
|
|
36
81
|
toAmino: MsgRegisterGroup.toAmino,
|
|
37
|
-
fromAmino: MsgRegisterGroup.fromAmino
|
|
82
|
+
fromAmino: MsgRegisterGroup.fromAmino,
|
|
38
83
|
},
|
|
39
84
|
"/sparkdream.commons.v1.MsgRenewGroup": {
|
|
40
85
|
aminoType: "sparkdream/x/commons/MsgRenewGroup",
|
|
41
86
|
toAmino: MsgRenewGroup.toAmino,
|
|
42
|
-
fromAmino: MsgRenewGroup.fromAmino
|
|
87
|
+
fromAmino: MsgRenewGroup.fromAmino,
|
|
43
88
|
},
|
|
44
89
|
"/sparkdream.commons.v1.MsgUpdateGroupMembers": {
|
|
45
90
|
aminoType: "sparkdream/x/commons/MsgUpdateGroupMembers",
|
|
46
91
|
toAmino: MsgUpdateGroupMembers.toAmino,
|
|
47
|
-
fromAmino: MsgUpdateGroupMembers.fromAmino
|
|
92
|
+
fromAmino: MsgUpdateGroupMembers.fromAmino,
|
|
48
93
|
},
|
|
49
94
|
"/sparkdream.commons.v1.MsgUpdateGroupConfig": {
|
|
50
95
|
aminoType: "sparkdream/x/commons/MsgUpdateGroupConfig",
|
|
51
96
|
toAmino: MsgUpdateGroupConfig.toAmino,
|
|
52
|
-
fromAmino: MsgUpdateGroupConfig.fromAmino
|
|
97
|
+
fromAmino: MsgUpdateGroupConfig.fromAmino,
|
|
53
98
|
},
|
|
54
99
|
"/sparkdream.commons.v1.MsgForceUpgrade": {
|
|
55
100
|
aminoType: "sparkdream/x/commons/MsgForceUpgrade",
|
|
56
101
|
toAmino: MsgForceUpgrade.toAmino,
|
|
57
|
-
fromAmino: MsgForceUpgrade.fromAmino
|
|
102
|
+
fromAmino: MsgForceUpgrade.fromAmino,
|
|
58
103
|
},
|
|
59
104
|
"/sparkdream.commons.v1.MsgDeleteGroup": {
|
|
60
105
|
aminoType: "sparkdream/x/commons/MsgDeleteGroup",
|
|
61
106
|
toAmino: MsgDeleteGroup.toAmino,
|
|
62
|
-
fromAmino: MsgDeleteGroup.fromAmino
|
|
107
|
+
fromAmino: MsgDeleteGroup.fromAmino,
|
|
63
108
|
},
|
|
64
109
|
"/sparkdream.commons.v1.MsgVetoGroupProposals": {
|
|
65
110
|
aminoType: "sparkdream/x/commons/MsgVetoGroupProposals",
|
|
66
111
|
toAmino: MsgVetoGroupProposals.toAmino,
|
|
67
|
-
fromAmino: MsgVetoGroupProposals.fromAmino
|
|
68
|
-
},
|
|
69
|
-
"/sparkdream.commons.v1.MsgSubmitProposal": {
|
|
70
|
-
aminoType: "sparkdream/x/commons/MsgSubmitProposal",
|
|
71
|
-
toAmino: MsgSubmitProposal.toAmino,
|
|
72
|
-
fromAmino: MsgSubmitProposal.fromAmino
|
|
112
|
+
fromAmino: MsgVetoGroupProposals.fromAmino,
|
|
73
113
|
},
|
|
114
|
+
// Recursive Any handling — see top-of-file comment.
|
|
115
|
+
"/sparkdream.commons.v1.MsgSubmitProposal": buildProposalConverter("sparkdream/x/commons/MsgSubmitProposal"),
|
|
74
116
|
"/sparkdream.commons.v1.MsgVoteProposal": {
|
|
75
117
|
aminoType: "sparkdream/x/commons/MsgVoteProposal",
|
|
76
118
|
toAmino: MsgVoteProposal.toAmino,
|
|
77
|
-
fromAmino: MsgVoteProposal.fromAmino
|
|
119
|
+
fromAmino: MsgVoteProposal.fromAmino,
|
|
78
120
|
},
|
|
79
121
|
"/sparkdream.commons.v1.MsgExecuteProposal": {
|
|
80
122
|
aminoType: "sparkdream/x/commons/MsgExecuteProposal",
|
|
81
123
|
toAmino: MsgExecuteProposal.toAmino,
|
|
82
|
-
fromAmino: MsgExecuteProposal.fromAmino
|
|
83
|
-
},
|
|
84
|
-
"/sparkdream.commons.v1.MsgSubmitAnonymousProposal": {
|
|
85
|
-
aminoType: "sparkdream/x/commons/MsgSubmitAnonymousProposal",
|
|
86
|
-
toAmino: MsgSubmitAnonymousProposal.toAmino,
|
|
87
|
-
fromAmino: MsgSubmitAnonymousProposal.fromAmino
|
|
124
|
+
fromAmino: MsgExecuteProposal.fromAmino,
|
|
88
125
|
},
|
|
126
|
+
// Recursive Any handling — see top-of-file comment.
|
|
127
|
+
"/sparkdream.commons.v1.MsgSubmitAnonymousProposal": buildProposalConverter("sparkdream/x/commons/MsgSubmitAnonymousProposal"),
|
|
89
128
|
"/sparkdream.commons.v1.MsgAnonymousVoteProposal": {
|
|
90
129
|
aminoType: "sparkdream/x/commons/MsgAnonymousVoteProposal",
|
|
91
130
|
toAmino: MsgAnonymousVoteProposal.toAmino,
|
|
92
|
-
fromAmino: MsgAnonymousVoteProposal.fromAmino
|
|
131
|
+
fromAmino: MsgAnonymousVoteProposal.fromAmino,
|
|
93
132
|
},
|
|
94
133
|
"/sparkdream.commons.v1.MsgCreateCategory": {
|
|
95
134
|
aminoType: "sparkdream/x/commons/MsgCreateCategory",
|
|
96
135
|
toAmino: MsgCreateCategory.toAmino,
|
|
97
|
-
fromAmino: MsgCreateCategory.fromAmino
|
|
98
|
-
}
|
|
136
|
+
fromAmino: MsgCreateCategory.fromAmino,
|
|
137
|
+
},
|
|
99
138
|
};
|
|
@@ -1,29 +1,51 @@
|
|
|
1
1
|
//@ts-nocheck
|
|
2
|
-
|
|
2
|
+
// HAND-WRITTEN OVERRIDE — overlaid by scripts/codegen.ts after telescope.
|
|
3
|
+
// See ../../commons/v1/tx.amino.ts for rationale.
|
|
4
|
+
//
|
|
5
|
+
// MsgExecSession has `repeated google.protobuf.Any msgs = 3` (note the
|
|
6
|
+
// shorter field name `msgs`, not `messages`). Same recursive-Any problem.
|
|
7
|
+
import { MsgUpdateParams, MsgUpdateOperationalParams, MsgCreateSession, MsgRevokeSession, } from "./tx";
|
|
8
|
+
import { anyToAmino, aminoToAny } from "../../../nested-amino";
|
|
3
9
|
export const AminoConverter = {
|
|
4
10
|
"/sparkdream.session.v1.MsgUpdateParams": {
|
|
5
11
|
aminoType: "sparkdream/x/session/MsgUpdateParams",
|
|
6
12
|
toAmino: MsgUpdateParams.toAmino,
|
|
7
|
-
fromAmino: MsgUpdateParams.fromAmino
|
|
13
|
+
fromAmino: MsgUpdateParams.fromAmino,
|
|
8
14
|
},
|
|
9
15
|
"/sparkdream.session.v1.MsgUpdateOperationalParams": {
|
|
10
16
|
aminoType: "sparkdream/x/session/MsgUpdateOperationalParams",
|
|
11
17
|
toAmino: MsgUpdateOperationalParams.toAmino,
|
|
12
|
-
fromAmino: MsgUpdateOperationalParams.fromAmino
|
|
18
|
+
fromAmino: MsgUpdateOperationalParams.fromAmino,
|
|
13
19
|
},
|
|
14
20
|
"/sparkdream.session.v1.MsgCreateSession": {
|
|
15
21
|
aminoType: "sparkdream/x/session/MsgCreateSession",
|
|
16
22
|
toAmino: MsgCreateSession.toAmino,
|
|
17
|
-
fromAmino: MsgCreateSession.fromAmino
|
|
23
|
+
fromAmino: MsgCreateSession.fromAmino,
|
|
18
24
|
},
|
|
19
25
|
"/sparkdream.session.v1.MsgRevokeSession": {
|
|
20
26
|
aminoType: "sparkdream/x/session/MsgRevokeSession",
|
|
21
27
|
toAmino: MsgRevokeSession.toAmino,
|
|
22
|
-
fromAmino: MsgRevokeSession.fromAmino
|
|
28
|
+
fromAmino: MsgRevokeSession.fromAmino,
|
|
23
29
|
},
|
|
24
30
|
"/sparkdream.session.v1.MsgExecSession": {
|
|
25
31
|
aminoType: "sparkdream/x/session/MsgExecSession",
|
|
26
|
-
toAmino
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
toAmino(message) {
|
|
33
|
+
const obj = {};
|
|
34
|
+
obj.grantee = message.grantee === "" ? undefined : message.grantee;
|
|
35
|
+
obj.granter = message.granter === "" ? undefined : message.granter;
|
|
36
|
+
// Omit when empty to match the chain's aminojson default for
|
|
37
|
+
// repeated fields.
|
|
38
|
+
obj.msgs = (message.msgs?.length ?? 0) > 0
|
|
39
|
+
? message.msgs.map((a) => anyToAmino(a))
|
|
40
|
+
: undefined;
|
|
41
|
+
return obj;
|
|
42
|
+
},
|
|
43
|
+
fromAmino(object) {
|
|
44
|
+
return {
|
|
45
|
+
grantee: object.grantee ?? "",
|
|
46
|
+
granter: object.granter ?? "",
|
|
47
|
+
msgs: (object.msgs ?? []).map((e) => aminoToAny(e)),
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
},
|
|
29
51
|
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared registry + helpers for amino-converting messages that embed a
|
|
3
|
+
* `repeated google.protobuf.Any` field (`MsgSubmitProposal`,
|
|
4
|
+
* `MsgSubmitAnonymousProposal`, `MsgExecSession`).
|
|
5
|
+
*
|
|
6
|
+
* The Telescope-generated `Any.toAmino` just emits `{type, value: Uint8Array}`,
|
|
7
|
+
* which JSON.stringify turns into `{"0":N,"1":N,…}` — numeric keys that aren't
|
|
8
|
+
* lexicographically sorted, breaking Ledger's strict amino-JSON validator and
|
|
9
|
+
* leaving the chain unable to reconstruct identical sign bytes.
|
|
10
|
+
*
|
|
11
|
+
* Consumers must call `configureNestedAminoConverter({registry, aminoTypes})`
|
|
12
|
+
* once after they've built both their proto Registry and their stargate
|
|
13
|
+
* AminoTypes. The patched converters below then look up each inner Any's
|
|
14
|
+
* proto codec (to decode bytes back to a typed message) and its registered
|
|
15
|
+
* amino converter (to render the proper amino JSON) — symmetric to what
|
|
16
|
+
* `cosmossdk.io/x/tx/signing/aminojson` does on the chain side.
|
|
17
|
+
*/
|
|
18
|
+
interface ProtoCodec {
|
|
19
|
+
/** Proto-decodes raw bytes back to the typed message. */
|
|
20
|
+
decode: (bytes: Uint8Array) => any;
|
|
21
|
+
/** Proto-encodes a typed message (or partial) back to raw bytes. */
|
|
22
|
+
encode: (msg: any) => {
|
|
23
|
+
finish: () => Uint8Array;
|
|
24
|
+
};
|
|
25
|
+
fromPartial: (msg: any) => any;
|
|
26
|
+
}
|
|
27
|
+
interface RegistryLike {
|
|
28
|
+
lookupType: (typeUrl: string) => ProtoCodec | undefined;
|
|
29
|
+
}
|
|
30
|
+
interface AminoTypesLike {
|
|
31
|
+
toAmino: (msg: {
|
|
32
|
+
typeUrl: string;
|
|
33
|
+
value: any;
|
|
34
|
+
}) => {
|
|
35
|
+
type: string;
|
|
36
|
+
value: any;
|
|
37
|
+
};
|
|
38
|
+
fromAmino: (msg: {
|
|
39
|
+
type: string;
|
|
40
|
+
value: any;
|
|
41
|
+
}) => {
|
|
42
|
+
typeUrl: string;
|
|
43
|
+
value: any;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface NestedAminoConfig {
|
|
47
|
+
/**
|
|
48
|
+
* Proto registry capable of resolving any typeUrl that may appear inside an
|
|
49
|
+
* Any-typed field. Typically `new Registry(defaultRegistryTypes)` with each
|
|
50
|
+
* module's `load(registry)` called against it.
|
|
51
|
+
*/
|
|
52
|
+
registry: RegistryLike;
|
|
53
|
+
/**
|
|
54
|
+
* AminoTypes containing converters for every typeUrl that may appear inside
|
|
55
|
+
* an Any-typed field. Typically `new AminoTypes({...createDefaultAminoConverters(), ...moduleAminos})`.
|
|
56
|
+
*/
|
|
57
|
+
aminoTypes: AminoTypesLike;
|
|
58
|
+
}
|
|
59
|
+
export declare function configureNestedAminoConverter(next: NestedAminoConfig): void;
|
|
60
|
+
/** Convert one proto-encoded Any to its amino representation. */
|
|
61
|
+
export declare function anyToAmino(any: {
|
|
62
|
+
typeUrl: string;
|
|
63
|
+
value: Uint8Array;
|
|
64
|
+
}): {
|
|
65
|
+
type: string;
|
|
66
|
+
value: any;
|
|
67
|
+
};
|
|
68
|
+
/** Convert one amino-typed entry back to a proto-encoded Any. */
|
|
69
|
+
export declare function aminoToAny(entry: {
|
|
70
|
+
type: string;
|
|
71
|
+
value: any;
|
|
72
|
+
}): {
|
|
73
|
+
typeUrl: string;
|
|
74
|
+
value: Uint8Array;
|
|
75
|
+
};
|
|
76
|
+
export {};
|
package/nested-amino.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//@ts-nocheck
|
|
3
|
+
/**
|
|
4
|
+
* Shared registry + helpers for amino-converting messages that embed a
|
|
5
|
+
* `repeated google.protobuf.Any` field (`MsgSubmitProposal`,
|
|
6
|
+
* `MsgSubmitAnonymousProposal`, `MsgExecSession`).
|
|
7
|
+
*
|
|
8
|
+
* The Telescope-generated `Any.toAmino` just emits `{type, value: Uint8Array}`,
|
|
9
|
+
* which JSON.stringify turns into `{"0":N,"1":N,…}` — numeric keys that aren't
|
|
10
|
+
* lexicographically sorted, breaking Ledger's strict amino-JSON validator and
|
|
11
|
+
* leaving the chain unable to reconstruct identical sign bytes.
|
|
12
|
+
*
|
|
13
|
+
* Consumers must call `configureNestedAminoConverter({registry, aminoTypes})`
|
|
14
|
+
* once after they've built both their proto Registry and their stargate
|
|
15
|
+
* AminoTypes. The patched converters below then look up each inner Any's
|
|
16
|
+
* proto codec (to decode bytes back to a typed message) and its registered
|
|
17
|
+
* amino converter (to render the proper amino JSON) — symmetric to what
|
|
18
|
+
* `cosmossdk.io/x/tx/signing/aminojson` does on the chain side.
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.configureNestedAminoConverter = configureNestedAminoConverter;
|
|
22
|
+
exports.anyToAmino = anyToAmino;
|
|
23
|
+
exports.aminoToAny = aminoToAny;
|
|
24
|
+
let cfg = null;
|
|
25
|
+
function configureNestedAminoConverter(next) {
|
|
26
|
+
cfg = next;
|
|
27
|
+
}
|
|
28
|
+
function requireCfg() {
|
|
29
|
+
if (!cfg) {
|
|
30
|
+
throw new Error("@sparkdreamnft/sparkdreamjs: configureNestedAminoConverter({registry, aminoTypes}) " +
|
|
31
|
+
"must be called before amino-signing a tx with MsgSubmitProposal / " +
|
|
32
|
+
"MsgSubmitAnonymousProposal / MsgExecSession (their `messages` / `msgs` " +
|
|
33
|
+
"field needs recursive Any conversion that Telescope can't generate).");
|
|
34
|
+
}
|
|
35
|
+
return cfg;
|
|
36
|
+
}
|
|
37
|
+
/** Convert one proto-encoded Any to its amino representation. */
|
|
38
|
+
function anyToAmino(any) {
|
|
39
|
+
const { registry, aminoTypes } = requireCfg();
|
|
40
|
+
const codec = registry.lookupType(any.typeUrl);
|
|
41
|
+
if (!codec) {
|
|
42
|
+
throw new Error(`No proto codec registered for inner type ${any.typeUrl}. ` +
|
|
43
|
+
`Ensure the corresponding module's load() has been called on your Registry.`);
|
|
44
|
+
}
|
|
45
|
+
const decoded = codec.decode(any.value);
|
|
46
|
+
return aminoTypes.toAmino({ typeUrl: any.typeUrl, value: decoded });
|
|
47
|
+
}
|
|
48
|
+
/** Convert one amino-typed entry back to a proto-encoded Any. */
|
|
49
|
+
function aminoToAny(entry) {
|
|
50
|
+
const { registry, aminoTypes } = requireCfg();
|
|
51
|
+
const decoded = aminoTypes.fromAmino(entry);
|
|
52
|
+
const codec = registry.lookupType(decoded.typeUrl);
|
|
53
|
+
if (!codec) {
|
|
54
|
+
throw new Error(`No proto codec registered for inner type ${decoded.typeUrl}.`);
|
|
55
|
+
}
|
|
56
|
+
return { typeUrl: decoded.typeUrl, value: codec.encode(codec.fromPartial(decoded.value)).finish() };
|
|
57
|
+
}
|
package/package.json
CHANGED
package/sparkdream/bundle.d.ts
CHANGED
|
@@ -153,6 +153,7 @@ import * as _326 from "./split/v1/params";
|
|
|
153
153
|
import * as _327 from "./split/v1/query";
|
|
154
154
|
import * as _328 from "./split/v1/share";
|
|
155
155
|
import * as _329 from "./split/v1/tx";
|
|
156
|
+
import * as _480 from "./commons/v1/tx.amino";
|
|
156
157
|
import * as _508 from "./blog/v1/query.lcd";
|
|
157
158
|
import * as _509 from "./collect/v1/query.lcd";
|
|
158
159
|
import * as _510 from "./commons/v1/query.lcd";
|
|
@@ -3746,6 +3747,7 @@ export declare namespace sparkdream {
|
|
|
3746
3747
|
};
|
|
3747
3748
|
};
|
|
3748
3749
|
};
|
|
3750
|
+
configureNestedAminoConverter: typeof _480.configureNestedAminoConverter;
|
|
3749
3751
|
AminoConverter: {
|
|
3750
3752
|
"/sparkdream.commons.v1.MsgUpdateParams": {
|
|
3751
3753
|
aminoType: string;
|
|
@@ -3814,8 +3816,8 @@ export declare namespace sparkdream {
|
|
|
3814
3816
|
};
|
|
3815
3817
|
"/sparkdream.commons.v1.MsgSubmitProposal": {
|
|
3816
3818
|
aminoType: string;
|
|
3817
|
-
toAmino
|
|
3818
|
-
fromAmino
|
|
3819
|
+
toAmino(message: any): any;
|
|
3820
|
+
fromAmino(object: any): any;
|
|
3819
3821
|
};
|
|
3820
3822
|
"/sparkdream.commons.v1.MsgVoteProposal": {
|
|
3821
3823
|
aminoType: string;
|
|
@@ -3829,8 +3831,8 @@ export declare namespace sparkdream {
|
|
|
3829
3831
|
};
|
|
3830
3832
|
"/sparkdream.commons.v1.MsgSubmitAnonymousProposal": {
|
|
3831
3833
|
aminoType: string;
|
|
3832
|
-
toAmino
|
|
3833
|
-
fromAmino
|
|
3834
|
+
toAmino(message: any): any;
|
|
3835
|
+
fromAmino(object: any): any;
|
|
3834
3836
|
};
|
|
3835
3837
|
"/sparkdream.commons.v1.MsgAnonymousVoteProposal": {
|
|
3836
3838
|
aminoType: string;
|
|
@@ -20727,8 +20729,8 @@ export declare namespace sparkdream {
|
|
|
20727
20729
|
};
|
|
20728
20730
|
"/sparkdream.session.v1.MsgExecSession": {
|
|
20729
20731
|
aminoType: string;
|
|
20730
|
-
toAmino
|
|
20731
|
-
fromAmino
|
|
20732
|
+
toAmino(message: any): any;
|
|
20733
|
+
fromAmino(object: any): any;
|
|
20732
20734
|
};
|
|
20733
20735
|
};
|
|
20734
20736
|
MsgUpdateParams: {
|
package/sparkdream/client.d.ts
CHANGED
|
@@ -59,8 +59,8 @@ export declare const sparkdreamAminoConverters: {
|
|
|
59
59
|
};
|
|
60
60
|
"/sparkdream.session.v1.MsgExecSession": {
|
|
61
61
|
aminoType: string;
|
|
62
|
-
toAmino
|
|
63
|
-
fromAmino
|
|
62
|
+
toAmino(message: any): any;
|
|
63
|
+
fromAmino(object: any): any;
|
|
64
64
|
};
|
|
65
65
|
"/sparkdream.season.v1.MsgUpdateParams": {
|
|
66
66
|
aminoType: string;
|
|
@@ -1034,8 +1034,8 @@ export declare const sparkdreamAminoConverters: {
|
|
|
1034
1034
|
};
|
|
1035
1035
|
"/sparkdream.commons.v1.MsgSubmitProposal": {
|
|
1036
1036
|
aminoType: string;
|
|
1037
|
-
toAmino
|
|
1038
|
-
fromAmino
|
|
1037
|
+
toAmino(message: any): any;
|
|
1038
|
+
fromAmino(object: any): any;
|
|
1039
1039
|
};
|
|
1040
1040
|
"/sparkdream.commons.v1.MsgVoteProposal": {
|
|
1041
1041
|
aminoType: string;
|
|
@@ -1049,8 +1049,8 @@ export declare const sparkdreamAminoConverters: {
|
|
|
1049
1049
|
};
|
|
1050
1050
|
"/sparkdream.commons.v1.MsgSubmitAnonymousProposal": {
|
|
1051
1051
|
aminoType: string;
|
|
1052
|
-
toAmino
|
|
1053
|
-
fromAmino
|
|
1052
|
+
toAmino(message: any): any;
|
|
1053
|
+
fromAmino(object: any): any;
|
|
1054
1054
|
};
|
|
1055
1055
|
"/sparkdream.commons.v1.MsgAnonymousVoteProposal": {
|
|
1056
1056
|
aminoType: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { MsgUpdateParams, MsgSpendFromCommons, MsgEmergencyCancelGovProposal, MsgCreatePolicyPermissions, MsgUpdatePolicyPermissions, MsgDeletePolicyPermissions, MsgRegisterGroup, MsgRenewGroup, MsgUpdateGroupMembers, MsgUpdateGroupConfig, MsgForceUpgrade, MsgDeleteGroup, MsgVetoGroupProposals,
|
|
1
|
+
import { MsgUpdateParams, MsgSpendFromCommons, MsgEmergencyCancelGovProposal, MsgCreatePolicyPermissions, MsgUpdatePolicyPermissions, MsgDeletePolicyPermissions, MsgRegisterGroup, MsgRenewGroup, MsgUpdateGroupMembers, MsgUpdateGroupConfig, MsgForceUpgrade, MsgDeleteGroup, MsgVetoGroupProposals, MsgVoteProposal, MsgExecuteProposal, MsgAnonymousVoteProposal, MsgCreateCategory } from "./tx";
|
|
2
|
+
export { configureNestedAminoConverter } from "../../../nested-amino";
|
|
2
3
|
export declare const AminoConverter: {
|
|
3
4
|
"/sparkdream.commons.v1.MsgUpdateParams": {
|
|
4
5
|
aminoType: string;
|
|
@@ -67,8 +68,8 @@ export declare const AminoConverter: {
|
|
|
67
68
|
};
|
|
68
69
|
"/sparkdream.commons.v1.MsgSubmitProposal": {
|
|
69
70
|
aminoType: string;
|
|
70
|
-
toAmino
|
|
71
|
-
fromAmino
|
|
71
|
+
toAmino(message: any): any;
|
|
72
|
+
fromAmino(object: any): any;
|
|
72
73
|
};
|
|
73
74
|
"/sparkdream.commons.v1.MsgVoteProposal": {
|
|
74
75
|
aminoType: string;
|
|
@@ -82,8 +83,8 @@ export declare const AminoConverter: {
|
|
|
82
83
|
};
|
|
83
84
|
"/sparkdream.commons.v1.MsgSubmitAnonymousProposal": {
|
|
84
85
|
aminoType: string;
|
|
85
|
-
toAmino
|
|
86
|
-
fromAmino
|
|
86
|
+
toAmino(message: any): any;
|
|
87
|
+
fromAmino(object: any): any;
|
|
87
88
|
};
|
|
88
89
|
"/sparkdream.commons.v1.MsgAnonymousVoteProposal": {
|
|
89
90
|
aminoType: string;
|
|
@@ -1,102 +1,142 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AminoConverter = void 0;
|
|
4
2
|
//@ts-nocheck
|
|
3
|
+
// HAND-WRITTEN OVERRIDE — overlaid on top of the Telescope-generated tx.amino.ts
|
|
4
|
+
// by scripts/codegen.ts after each codegen run. Do not let codegen wipe this.
|
|
5
|
+
//
|
|
6
|
+
// Why: Telescope emits a flat AminoConverter that hands each entry's toAmino
|
|
7
|
+
// straight through to the message's auto-generated toAmino. For
|
|
8
|
+
// MsgSubmitProposal and MsgSubmitAnonymousProposal (both have
|
|
9
|
+
// `repeated google.protobuf.Any messages`), the auto-generated toAmino calls
|
|
10
|
+
// Any.toAmino which just attaches the raw Uint8Array bytes — Ledger rejects
|
|
11
|
+
// the resulting JSON ("Dictionaries are not sorted") and the chain produces
|
|
12
|
+
// different sign bytes ("signature verification failed").
|
|
13
|
+
//
|
|
14
|
+
// This override delegates the inner Any conversion to a consumer-supplied
|
|
15
|
+
// proto registry + AminoTypes via `configureNestedAminoConverter`. The rest of
|
|
16
|
+
// the converters are unchanged.
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.AminoConverter = exports.configureNestedAminoConverter = void 0;
|
|
5
19
|
const tx_1 = require("./tx");
|
|
20
|
+
const nested_amino_1 = require("../../../nested-amino");
|
|
21
|
+
var nested_amino_2 = require("../../../nested-amino");
|
|
22
|
+
Object.defineProperty(exports, "configureNestedAminoConverter", { enumerable: true, get: function () { return nested_amino_2.configureNestedAminoConverter; } });
|
|
23
|
+
// Both proposal-submission messages share the same shape, so they share a
|
|
24
|
+
// converter factory.
|
|
25
|
+
function buildProposalConverter(aminoType) {
|
|
26
|
+
return {
|
|
27
|
+
aminoType,
|
|
28
|
+
toAmino(message) {
|
|
29
|
+
const obj = {};
|
|
30
|
+
obj.proposer = message.proposer === "" ? undefined : message.proposer;
|
|
31
|
+
obj.policy_address = message.policyAddress === "" ? undefined : message.policyAddress;
|
|
32
|
+
// Mirror cosmossdk.io/x/tx/signing/aminojson's omitempty default for
|
|
33
|
+
// repeated fields: omit when empty rather than emitting `[]`. Otherwise
|
|
34
|
+
// the JS side signs `"messages":[]` and the chain reconstructs without
|
|
35
|
+
// the key, causing signature verification to fail.
|
|
36
|
+
obj.messages = (message.messages?.length ?? 0) > 0
|
|
37
|
+
? message.messages.map((a) => (0, nested_amino_1.anyToAmino)(a))
|
|
38
|
+
: undefined;
|
|
39
|
+
obj.metadata = message.metadata === "" ? undefined : message.metadata;
|
|
40
|
+
return obj;
|
|
41
|
+
},
|
|
42
|
+
fromAmino(object) {
|
|
43
|
+
return {
|
|
44
|
+
proposer: object.proposer ?? "",
|
|
45
|
+
policyAddress: object.policy_address ?? "",
|
|
46
|
+
messages: (object.messages ?? []).map((e) => (0, nested_amino_1.aminoToAny)(e)),
|
|
47
|
+
metadata: object.metadata ?? "",
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
|
6
52
|
exports.AminoConverter = {
|
|
7
53
|
"/sparkdream.commons.v1.MsgUpdateParams": {
|
|
8
54
|
aminoType: "sparkdream/x/commons/MsgUpdateParams",
|
|
9
55
|
toAmino: tx_1.MsgUpdateParams.toAmino,
|
|
10
|
-
fromAmino: tx_1.MsgUpdateParams.fromAmino
|
|
56
|
+
fromAmino: tx_1.MsgUpdateParams.fromAmino,
|
|
11
57
|
},
|
|
12
58
|
"/sparkdream.commons.v1.MsgSpendFromCommons": {
|
|
13
59
|
aminoType: "sparkdream/x/commons/MsgSpendFromCommons",
|
|
14
60
|
toAmino: tx_1.MsgSpendFromCommons.toAmino,
|
|
15
|
-
fromAmino: tx_1.MsgSpendFromCommons.fromAmino
|
|
61
|
+
fromAmino: tx_1.MsgSpendFromCommons.fromAmino,
|
|
16
62
|
},
|
|
17
63
|
"/sparkdream.commons.v1.MsgEmergencyCancelGovProposal": {
|
|
18
64
|
aminoType: "sparkdream/x/commons/MsgEmergencyCancelGovProposal",
|
|
19
65
|
toAmino: tx_1.MsgEmergencyCancelGovProposal.toAmino,
|
|
20
|
-
fromAmino: tx_1.MsgEmergencyCancelGovProposal.fromAmino
|
|
66
|
+
fromAmino: tx_1.MsgEmergencyCancelGovProposal.fromAmino,
|
|
21
67
|
},
|
|
22
68
|
"/sparkdream.commons.v1.MsgCreatePolicyPermissions": {
|
|
23
69
|
aminoType: "sparkdream/x/commons/MsgCreatePolicyPermissions",
|
|
24
70
|
toAmino: tx_1.MsgCreatePolicyPermissions.toAmino,
|
|
25
|
-
fromAmino: tx_1.MsgCreatePolicyPermissions.fromAmino
|
|
71
|
+
fromAmino: tx_1.MsgCreatePolicyPermissions.fromAmino,
|
|
26
72
|
},
|
|
27
73
|
"/sparkdream.commons.v1.MsgUpdatePolicyPermissions": {
|
|
28
74
|
aminoType: "sparkdream/x/commons/MsgUpdatePolicyPermissions",
|
|
29
75
|
toAmino: tx_1.MsgUpdatePolicyPermissions.toAmino,
|
|
30
|
-
fromAmino: tx_1.MsgUpdatePolicyPermissions.fromAmino
|
|
76
|
+
fromAmino: tx_1.MsgUpdatePolicyPermissions.fromAmino,
|
|
31
77
|
},
|
|
32
78
|
"/sparkdream.commons.v1.MsgDeletePolicyPermissions": {
|
|
33
79
|
aminoType: "sparkdream/x/commons/MsgDeletePolicyPermissions",
|
|
34
80
|
toAmino: tx_1.MsgDeletePolicyPermissions.toAmino,
|
|
35
|
-
fromAmino: tx_1.MsgDeletePolicyPermissions.fromAmino
|
|
81
|
+
fromAmino: tx_1.MsgDeletePolicyPermissions.fromAmino,
|
|
36
82
|
},
|
|
37
83
|
"/sparkdream.commons.v1.MsgRegisterGroup": {
|
|
38
84
|
aminoType: "sparkdream/x/commons/MsgRegisterGroup",
|
|
39
85
|
toAmino: tx_1.MsgRegisterGroup.toAmino,
|
|
40
|
-
fromAmino: tx_1.MsgRegisterGroup.fromAmino
|
|
86
|
+
fromAmino: tx_1.MsgRegisterGroup.fromAmino,
|
|
41
87
|
},
|
|
42
88
|
"/sparkdream.commons.v1.MsgRenewGroup": {
|
|
43
89
|
aminoType: "sparkdream/x/commons/MsgRenewGroup",
|
|
44
90
|
toAmino: tx_1.MsgRenewGroup.toAmino,
|
|
45
|
-
fromAmino: tx_1.MsgRenewGroup.fromAmino
|
|
91
|
+
fromAmino: tx_1.MsgRenewGroup.fromAmino,
|
|
46
92
|
},
|
|
47
93
|
"/sparkdream.commons.v1.MsgUpdateGroupMembers": {
|
|
48
94
|
aminoType: "sparkdream/x/commons/MsgUpdateGroupMembers",
|
|
49
95
|
toAmino: tx_1.MsgUpdateGroupMembers.toAmino,
|
|
50
|
-
fromAmino: tx_1.MsgUpdateGroupMembers.fromAmino
|
|
96
|
+
fromAmino: tx_1.MsgUpdateGroupMembers.fromAmino,
|
|
51
97
|
},
|
|
52
98
|
"/sparkdream.commons.v1.MsgUpdateGroupConfig": {
|
|
53
99
|
aminoType: "sparkdream/x/commons/MsgUpdateGroupConfig",
|
|
54
100
|
toAmino: tx_1.MsgUpdateGroupConfig.toAmino,
|
|
55
|
-
fromAmino: tx_1.MsgUpdateGroupConfig.fromAmino
|
|
101
|
+
fromAmino: tx_1.MsgUpdateGroupConfig.fromAmino,
|
|
56
102
|
},
|
|
57
103
|
"/sparkdream.commons.v1.MsgForceUpgrade": {
|
|
58
104
|
aminoType: "sparkdream/x/commons/MsgForceUpgrade",
|
|
59
105
|
toAmino: tx_1.MsgForceUpgrade.toAmino,
|
|
60
|
-
fromAmino: tx_1.MsgForceUpgrade.fromAmino
|
|
106
|
+
fromAmino: tx_1.MsgForceUpgrade.fromAmino,
|
|
61
107
|
},
|
|
62
108
|
"/sparkdream.commons.v1.MsgDeleteGroup": {
|
|
63
109
|
aminoType: "sparkdream/x/commons/MsgDeleteGroup",
|
|
64
110
|
toAmino: tx_1.MsgDeleteGroup.toAmino,
|
|
65
|
-
fromAmino: tx_1.MsgDeleteGroup.fromAmino
|
|
111
|
+
fromAmino: tx_1.MsgDeleteGroup.fromAmino,
|
|
66
112
|
},
|
|
67
113
|
"/sparkdream.commons.v1.MsgVetoGroupProposals": {
|
|
68
114
|
aminoType: "sparkdream/x/commons/MsgVetoGroupProposals",
|
|
69
115
|
toAmino: tx_1.MsgVetoGroupProposals.toAmino,
|
|
70
|
-
fromAmino: tx_1.MsgVetoGroupProposals.fromAmino
|
|
71
|
-
},
|
|
72
|
-
"/sparkdream.commons.v1.MsgSubmitProposal": {
|
|
73
|
-
aminoType: "sparkdream/x/commons/MsgSubmitProposal",
|
|
74
|
-
toAmino: tx_1.MsgSubmitProposal.toAmino,
|
|
75
|
-
fromAmino: tx_1.MsgSubmitProposal.fromAmino
|
|
116
|
+
fromAmino: tx_1.MsgVetoGroupProposals.fromAmino,
|
|
76
117
|
},
|
|
118
|
+
// Recursive Any handling — see top-of-file comment.
|
|
119
|
+
"/sparkdream.commons.v1.MsgSubmitProposal": buildProposalConverter("sparkdream/x/commons/MsgSubmitProposal"),
|
|
77
120
|
"/sparkdream.commons.v1.MsgVoteProposal": {
|
|
78
121
|
aminoType: "sparkdream/x/commons/MsgVoteProposal",
|
|
79
122
|
toAmino: tx_1.MsgVoteProposal.toAmino,
|
|
80
|
-
fromAmino: tx_1.MsgVoteProposal.fromAmino
|
|
123
|
+
fromAmino: tx_1.MsgVoteProposal.fromAmino,
|
|
81
124
|
},
|
|
82
125
|
"/sparkdream.commons.v1.MsgExecuteProposal": {
|
|
83
126
|
aminoType: "sparkdream/x/commons/MsgExecuteProposal",
|
|
84
127
|
toAmino: tx_1.MsgExecuteProposal.toAmino,
|
|
85
|
-
fromAmino: tx_1.MsgExecuteProposal.fromAmino
|
|
86
|
-
},
|
|
87
|
-
"/sparkdream.commons.v1.MsgSubmitAnonymousProposal": {
|
|
88
|
-
aminoType: "sparkdream/x/commons/MsgSubmitAnonymousProposal",
|
|
89
|
-
toAmino: tx_1.MsgSubmitAnonymousProposal.toAmino,
|
|
90
|
-
fromAmino: tx_1.MsgSubmitAnonymousProposal.fromAmino
|
|
128
|
+
fromAmino: tx_1.MsgExecuteProposal.fromAmino,
|
|
91
129
|
},
|
|
130
|
+
// Recursive Any handling — see top-of-file comment.
|
|
131
|
+
"/sparkdream.commons.v1.MsgSubmitAnonymousProposal": buildProposalConverter("sparkdream/x/commons/MsgSubmitAnonymousProposal"),
|
|
92
132
|
"/sparkdream.commons.v1.MsgAnonymousVoteProposal": {
|
|
93
133
|
aminoType: "sparkdream/x/commons/MsgAnonymousVoteProposal",
|
|
94
134
|
toAmino: tx_1.MsgAnonymousVoteProposal.toAmino,
|
|
95
|
-
fromAmino: tx_1.MsgAnonymousVoteProposal.fromAmino
|
|
135
|
+
fromAmino: tx_1.MsgAnonymousVoteProposal.fromAmino,
|
|
96
136
|
},
|
|
97
137
|
"/sparkdream.commons.v1.MsgCreateCategory": {
|
|
98
138
|
aminoType: "sparkdream/x/commons/MsgCreateCategory",
|
|
99
139
|
toAmino: tx_1.MsgCreateCategory.toAmino,
|
|
100
|
-
fromAmino: tx_1.MsgCreateCategory.fromAmino
|
|
101
|
-
}
|
|
140
|
+
fromAmino: tx_1.MsgCreateCategory.fromAmino,
|
|
141
|
+
},
|
|
102
142
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MsgUpdateParams, MsgUpdateOperationalParams, MsgCreateSession, MsgRevokeSession
|
|
1
|
+
import { MsgUpdateParams, MsgUpdateOperationalParams, MsgCreateSession, MsgRevokeSession } from "./tx";
|
|
2
2
|
export declare const AminoConverter: {
|
|
3
3
|
"/sparkdream.session.v1.MsgUpdateParams": {
|
|
4
4
|
aminoType: string;
|
|
@@ -22,7 +22,7 @@ export declare const AminoConverter: {
|
|
|
22
22
|
};
|
|
23
23
|
"/sparkdream.session.v1.MsgExecSession": {
|
|
24
24
|
aminoType: string;
|
|
25
|
-
toAmino
|
|
26
|
-
fromAmino
|
|
25
|
+
toAmino(message: any): any;
|
|
26
|
+
fromAmino(object: any): any;
|
|
27
27
|
};
|
|
28
28
|
};
|
|
@@ -1,32 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
//@ts-nocheck
|
|
3
|
+
// HAND-WRITTEN OVERRIDE — overlaid by scripts/codegen.ts after telescope.
|
|
4
|
+
// See ../../commons/v1/tx.amino.ts for rationale.
|
|
5
|
+
//
|
|
6
|
+
// MsgExecSession has `repeated google.protobuf.Any msgs = 3` (note the
|
|
7
|
+
// shorter field name `msgs`, not `messages`). Same recursive-Any problem.
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.AminoConverter = void 0;
|
|
4
|
-
//@ts-nocheck
|
|
5
10
|
const tx_1 = require("./tx");
|
|
11
|
+
const nested_amino_1 = require("../../../nested-amino");
|
|
6
12
|
exports.AminoConverter = {
|
|
7
13
|
"/sparkdream.session.v1.MsgUpdateParams": {
|
|
8
14
|
aminoType: "sparkdream/x/session/MsgUpdateParams",
|
|
9
15
|
toAmino: tx_1.MsgUpdateParams.toAmino,
|
|
10
|
-
fromAmino: tx_1.MsgUpdateParams.fromAmino
|
|
16
|
+
fromAmino: tx_1.MsgUpdateParams.fromAmino,
|
|
11
17
|
},
|
|
12
18
|
"/sparkdream.session.v1.MsgUpdateOperationalParams": {
|
|
13
19
|
aminoType: "sparkdream/x/session/MsgUpdateOperationalParams",
|
|
14
20
|
toAmino: tx_1.MsgUpdateOperationalParams.toAmino,
|
|
15
|
-
fromAmino: tx_1.MsgUpdateOperationalParams.fromAmino
|
|
21
|
+
fromAmino: tx_1.MsgUpdateOperationalParams.fromAmino,
|
|
16
22
|
},
|
|
17
23
|
"/sparkdream.session.v1.MsgCreateSession": {
|
|
18
24
|
aminoType: "sparkdream/x/session/MsgCreateSession",
|
|
19
25
|
toAmino: tx_1.MsgCreateSession.toAmino,
|
|
20
|
-
fromAmino: tx_1.MsgCreateSession.fromAmino
|
|
26
|
+
fromAmino: tx_1.MsgCreateSession.fromAmino,
|
|
21
27
|
},
|
|
22
28
|
"/sparkdream.session.v1.MsgRevokeSession": {
|
|
23
29
|
aminoType: "sparkdream/x/session/MsgRevokeSession",
|
|
24
30
|
toAmino: tx_1.MsgRevokeSession.toAmino,
|
|
25
|
-
fromAmino: tx_1.MsgRevokeSession.fromAmino
|
|
31
|
+
fromAmino: tx_1.MsgRevokeSession.fromAmino,
|
|
26
32
|
},
|
|
27
33
|
"/sparkdream.session.v1.MsgExecSession": {
|
|
28
34
|
aminoType: "sparkdream/x/session/MsgExecSession",
|
|
29
|
-
toAmino
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
toAmino(message) {
|
|
36
|
+
const obj = {};
|
|
37
|
+
obj.grantee = message.grantee === "" ? undefined : message.grantee;
|
|
38
|
+
obj.granter = message.granter === "" ? undefined : message.granter;
|
|
39
|
+
// Omit when empty to match the chain's aminojson default for
|
|
40
|
+
// repeated fields.
|
|
41
|
+
obj.msgs = (message.msgs?.length ?? 0) > 0
|
|
42
|
+
? message.msgs.map((a) => (0, nested_amino_1.anyToAmino)(a))
|
|
43
|
+
: undefined;
|
|
44
|
+
return obj;
|
|
45
|
+
},
|
|
46
|
+
fromAmino(object) {
|
|
47
|
+
return {
|
|
48
|
+
grantee: object.grantee ?? "",
|
|
49
|
+
granter: object.granter ?? "",
|
|
50
|
+
msgs: (object.msgs ?? []).map((e) => (0, nested_amino_1.aminoToAny)(e)),
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
},
|
|
32
54
|
};
|