Skip to content

Commit

Permalink
use , to get interface name
Browse files Browse the repository at this point in the history
  • Loading branch information
Zetazzz committed Feb 5, 2025
1 parent 130b169 commit cbb655d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/ast/src/encoding/proto/from-amino/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ export const fromAmino = {
anyType(args: fromAminoMethod) {
const { origName } = getFieldNames(args.field);

const interfaceName = Object.keys(args.context.ref.traversed.acceptsInterface)[0];
const accepts_interface = args.field.options["(cosmos_proto.accepts_interface)"];
const interfaceName = accepts_interface.split(",")[0];
const interfaceFnName = getInterfaceFromAminoName(interfaceName);

let aminoFuncExpr: t.Expression = t.identifier(interfaceFnName);
Expand Down Expand Up @@ -552,7 +553,8 @@ export const arrayTypes = {
},

anyType(args: fromAminoMethod) {
const interfaceName = Object.keys(args.context.ref.traversed.acceptsInterface)[0];
const accepts_interface = args.field.options["(cosmos_proto.accepts_interface)"];
const interfaceName = accepts_interface.split(",")[0];
const interfaceFnName = getInterfaceFromAminoName(interfaceName);

let aminoFuncExpr: t.Expression = t.identifier(interfaceFnName);
Expand Down
6 changes: 4 additions & 2 deletions packages/ast/src/encoding/proto/to-amino/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => {

anyType(args: ToAminoJSONMethod) {
const { propName, origName } = getFieldNames(args.field);
const interfaceName = Object.keys(args.context.ref.traversed.acceptsInterface)[0];
const accepts_interface = args.field.options["(cosmos_proto.accepts_interface)"];
const interfaceName = accepts_interface.split(",")[0];
const interfaceFnName = getInterfaceToAminoName(interfaceName)

args.context.getTypeName(args.field);
Expand Down Expand Up @@ -795,7 +796,8 @@ export const arrayTypes = {
},
anyType(args: ToAminoJSONMethod) {
const { propName, origName } = getFieldNames(args.field);
const interfaceName = Object.keys(args.context.ref.traversed.acceptsInterface)[0];
const accepts_interface = args.field.options["(cosmos_proto.accepts_interface)"];
const interfaceName = accepts_interface.split(",")[0];
const interfaceFnName = getInterfaceToAminoName(interfaceName)

const isGlobalRegistry = args.context.options.interfaces?.useGlobalDecoderRegistry;
Expand Down

0 comments on commit cbb655d

Please sign in to comment.