@@ -2,7 +2,7 @@ import { IndexerSubaccountId } from '@dydxprotocol-indexer/v4-protos';
22import { PartialModelObject , QueryBuilder } from 'objection' ;
33
44import config from '../config' ;
5- import { BUFFER_ENCODING_UTF_8 , DEFAULT_POSTGRES_OPTIONS , MAX_PARENT_SUBACCOUNTS } from '../constants' ;
5+ import { BUFFER_ENCODING_UTF_8 , DEFAULT_POSTGRES_OPTIONS } from '../constants' ;
66import {
77 verifyAllRequiredFields ,
88 setupBaseQuery ,
@@ -201,35 +201,3 @@ export async function deleteById(
201201 Transaction . get ( options . txId ) ,
202202 ) . deleteById ( id ) ;
203203}
204-
205- /**
206- * Retrieves all subaccount IDs associated with a parent subaccount.
207- * A subaccount is considered a child of the parent if it has the same address
208- * and its subaccount number follows the modulo relationship with the parent.
209- *
210- * @param parentSubaccount The parent subaccount object with address and subaccountNumber
211- * @param options Query options including transaction ID
212- * @returns A promise that resolves to an array of subaccount ID strings
213- */
214- export async function findIdsForParentSubaccount (
215- parentSubaccount : {
216- address : string ,
217- subaccountNumber : number ,
218- } ,
219- options : Options = DEFAULT_POSTGRES_OPTIONS ,
220- ) : Promise < string [ ] > {
221- // Get all subaccounts for the address
222- const subaccounts = await findAll (
223- { address : parentSubaccount . address } ,
224- [ ] ,
225- options ,
226- ) ;
227-
228- // Filter for subaccounts that match the parent relationship
229- // (subaccountNumber - parentSubaccountNumber) % MAX_PARENT_SUBACCOUNTS = 0
230- return subaccounts
231- . filter ( ( subaccount ) => ( subaccount . subaccountNumber - parentSubaccount . subaccountNumber ) %
232- MAX_PARENT_SUBACCOUNTS === 0 ,
233- )
234- . map ( ( subaccount ) => subaccount . id ) ;
235- }
0 commit comments