( struct: AbiStruct, group: GroupType, fields: ProcessedField[], )
| 51 | }; |
| 52 | |
| 53 | export const resolveGroupMembers = ( |
| 54 | struct: AbiStruct, |
| 55 | group: GroupType, |
| 56 | fields: ProcessedField[], |
| 57 | ): ProcessedField[] => { |
| 58 | const fieldCopies: ProcessedField[] = [] |
| 59 | for (const member of group.members) { |
| 60 | const field = fields.find((field) => field.name === member.name); |
| 61 | if (!field) throw Error(`Member ${member.name} of group ${group.name} not found in ${struct.name}`); |
| 62 | |
| 63 | // Shallow copy because we won't need to modify nested values |
| 64 | const fieldCopy = { ...field }; |
| 65 | |
| 66 | // If group member defines coder type, it will override the group's coder type |
| 67 | // and the coder type of the original field in the struct. |
| 68 | // If group defines coder type, it will override the coder type of the original |
| 69 | // field in the struct. |
| 70 | if (member.coderType) applyCoderType(fieldCopy, member.coderType); |
| 71 | else if (group.coderType) applyCoderType(fieldCopy, group.coderType); |
| 72 | |
| 73 | fieldCopies.push(fieldCopy); |
| 74 | } |
| 75 | return fieldCopies; |
| 76 | } |
| 77 | |
| 78 | export const applyGroupAccessCoder = ( |
| 79 | group: GroupType, |
no test coverage detected