@@ -6,7 +6,11 @@ import {
66 FastifyReplyTypeBox ,
77 FastifyRequestTypeBox ,
88} from "../../utils" ;
9- import { getAllocatorForChain , getChains } from "../../../common/chains" ;
9+ import {
10+ getChains ,
11+ getOffchainAllocatorForChain ,
12+ getOnchainAllocatorForChain ,
13+ } from "../../../common/chains" ;
1014
1115const Schema = {
1216 response : {
@@ -34,6 +38,11 @@ const Schema = {
3438 allocator : Type . Optional (
3539 Type . String ( { description : "The allocator address for the chain" } )
3640 ) ,
41+ allocatorMode : Type . Optional (
42+ Type . Union ( [ Type . Literal ( "offchain" ) , Type . Literal ( "onchain" ) ] , {
43+ description : "The vm type of the chain" ,
44+ } )
45+ ) ,
3746 } ) ,
3847 {
3948 description : "A list of supported chains" ,
@@ -57,13 +66,19 @@ export default {
5766 return reply . status ( 200 ) . send ( {
5867 chains : await Promise . all (
5968 Object . keys ( chains ) . map ( async ( id ) => {
69+ const allocatorMode = chains [ id ] . metadata . allocatorChainId
70+ ? "onchain"
71+ : "offchain" ;
6072 return {
6173 id,
6274 vmType : chains [ id ] . vmType ,
6375 depository : chains [ id ] . depository ,
6476 allocator : chains [ id ] . depository
65- ? await getAllocatorForChain ( id )
77+ ? allocatorMode === "offchain"
78+ ? await getOffchainAllocatorForChain ( id )
79+ : await getOnchainAllocatorForChain ( id )
6680 : undefined ,
81+ allocatorMode,
6782 } ;
6883 } )
6984 ) ,
0 commit comments