Skip to content

Commit 37de3e8

Browse files
committed
Hide internal mapping functions from dropdown
1 parent 7490ab5 commit 37de3e8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

components/SubgraphEditor/SubgraphConfig/SubgraphConfig.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ const ContractInput = styled(InputField)`
4949

5050
const ADDRESS_REGEX = /^0x[0-9a-f]{40}$/i
5151

52+
const IGNORED_FUNCTIONS = [
53+
'id_of_type',
54+
'allocate',
55+
'__new',
56+
'__pin',
57+
'__unpin',
58+
'__collect',
59+
'_start',
60+
]
61+
5262
interface TErrorState {
5363
address?: string
5464
compiler?: string
@@ -126,7 +136,7 @@ export const SubgraphConfig = (props: SubgraphConfigProps) => {
126136
const module = await loadAsBytecode(bytecode)
127137
const exports = WebAssembly.Module.exports(module.module)
128138
const functionNames = exports
129-
.filter(_export => _export.kind === 'function')
139+
.filter(_export => _export.kind === 'function' && !IGNORED_FUNCTIONS.includes(_export.name))
130140
.map(_export => _export.name)
131141
setMappingFunctionNames(functionNames)
132142
setFnExtractionLoading(false)
@@ -170,7 +180,7 @@ export const SubgraphConfig = (props: SubgraphConfigProps) => {
170180
return null
171181
}
172182

173-
const updateSelectedContract = (address: string, newProps: any) => {
183+
const updateSelectedContract = (address: string, newProps: Partial<Contract>) => {
174184
if (!subgraph) {
175185
throw new Error('No subgraph')
176186
}

0 commit comments

Comments
 (0)