Skip to content

Commit e9b8caa

Browse files
committed
index hooks
1 parent f05d935 commit e9b8caa

File tree

8 files changed

+56
-3
lines changed

8 files changed

+56
-3
lines changed

src/formulas/formulas/contract/external/cw4Group.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,10 @@ export const admin = makeSimpleContractFormula<string | null>({
5454
// Null if no admin exists.
5555
fallback: null,
5656
})
57+
58+
export const hooks = makeSimpleContractFormula<string[], { hooks: string[] }>({
59+
transformation: 'hooks',
60+
fallbackKeys: ['cw4-hooks'],
61+
fallback: { hooks: [] },
62+
transform: (hooks) => ({ hooks }),
63+
})

src/formulas/formulas/contract/staking/cw20Stake.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,3 +302,13 @@ export const topStakers: ContractFormula<
302302
}))
303303
},
304304
}
305+
306+
export const getHooks = makeSimpleContractFormula<
307+
string[],
308+
{ hooks: string[] }
309+
>({
310+
transformation: 'hooks',
311+
fallbackKeys: ['hooks'],
312+
fallback: { hooks: [] },
313+
transform: (hooks) => ({ hooks }),
314+
})

src/formulas/formulas/contract/voting/daoVotingCw721Staked.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,10 @@ export const ownersOfStakedNfts: ContractFormula<Record<string, string>> = {
256256
)
257257
},
258258
}
259+
260+
export const hooks = makeSimpleContractFormula<string[], { hooks: string[] }>({
261+
transformation: 'hooks',
262+
fallbackKeys: ['hooks'],
263+
fallback: { hooks: [] },
264+
transform: (hooks) => ({ hooks }),
265+
})

src/formulas/formulas/contract/voting/daoVotingNativeStaked.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,13 @@ export const topStakers: ContractFormula<Staker[]> = {
152152
return stakers
153153
},
154154
}
155+
156+
export const getHooks = makeSimpleContractFormula<
157+
string[],
158+
{ hooks: string[] }
159+
>({
160+
transformation: 'hooks',
161+
fallbackKeys: ['hooks'],
162+
fallback: { hooks: [] },
163+
transform: (hooks) => ({ hooks }),
164+
})

src/formulas/formulas/contract/voting/daoVotingOnftStaked.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,9 @@ export const ownersOfStakedNfts: ContractFormula<Record<string, string>> = {
263263
)
264264
},
265265
}
266+
export const hooks = makeSimpleContractFormula<string[], { hooks: string[] }>({
267+
transformation: 'hooks',
268+
fallbackKeys: ['hooks'],
269+
fallback: { hooks: [] },
270+
transform: (hooks) => ({ hooks }),
271+
})

src/formulas/formulas/contract/voting/daoVotingTokenStaked.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,13 @@ export const topStakers: ContractFormula<Staker[]> = {
164164
return stakers
165165
},
166166
}
167+
168+
export const getHooks = makeSimpleContractFormula<
169+
string[],
170+
{ hooks: string[] }
171+
>({
172+
transformation: 'hooks',
173+
fallbackKeys: ['hooks'],
174+
fallback: { hooks: [] },
175+
transform: (hooks) => ({ hooks }),
176+
})

src/transformers/transformers/common.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ const owner: Transformer = {
1919
getValue: (event) => event.valueJson.owner,
2020
}
2121

22-
export default [info, ownership, owner]
22+
const hooks: Transformer = makeTransformer([], 'hooks')
23+
24+
export default [info, ownership, owner, hooks]
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { makeTransformerForMap } from '../../utils'
1+
import { makeTransformer, makeTransformerForMap } from '../../utils'
22

33
const CODE_IDS_KEYS = ['cw4-group']
44

55
const member = makeTransformerForMap(CODE_IDS_KEYS, 'member', 'members')
6+
const hooks = makeTransformer(CODE_IDS_KEYS, 'hooks', 'cw4-hooks')
67

7-
export default [member]
8+
export default [member, hooks]

0 commit comments

Comments
 (0)