@@ -38,6 +38,15 @@ import { BlockedUln302 } from '@/uln302/blockedSdk'
3838const CONFIG_TYPE_EXECUTOR = 1
3939const CONFIG_TYPE_ULN = 2
4040const CONFIG_TYPE_READ_LIB_CONFIG = 1
41+ const CONFIG_BATCH_SIZE = 10
42+
43+ const chunkArray = < T > ( array : T [ ] , size : number ) : T [ ] [ ] => {
44+ const chunks : T [ ] [ ] = [ ]
45+ for ( let i = 0 ; i < array . length ; i += size ) {
46+ chunks . push ( array . slice ( i , i + size ) )
47+ }
48+ return chunks
49+ }
4150
4251/**
4352 * EVM-specific SDK for EndpointV2 contracts
@@ -283,14 +292,15 @@ export class EndpointV2 extends OmniSDK implements IEndpointV2 {
283292 async setConfig ( oapp : OmniAddress , uln : OmniAddress , setConfigParam : SetConfigParam [ ] ) : Promise < OmniTransaction [ ] > {
284293 this . logger . debug ( `Setting config for OApp ${ oapp } to ULN ${ uln } with config ${ printJson ( setConfigParam ) } ` )
285294
286- const data = this . contract . contract . interface . encodeFunctionData ( 'setConfig' , [ oapp , uln , setConfigParam ] )
295+ const chunks = chunkArray ( setConfigParam , CONFIG_BATCH_SIZE )
287296
288- return [
289- {
297+ return chunks . map ( ( chunk ) => {
298+ const data = this . contract . contract . interface . encodeFunctionData ( 'setConfig' , [ oapp , uln , chunk ] )
299+ return {
290300 ...this . createTransaction ( data ) ,
291- description : `Setting config for ULN ${ uln } to ${ printJson ( setConfigParam ) } ` ,
292- } ,
293- ]
301+ description : `Setting config for ULN ${ uln } to ${ printJson ( chunk ) } ` ,
302+ }
303+ } )
294304 }
295305
296306 async setUlnConfig (
0 commit comments