{"version":3,"file":"getAllTokenAccountsByOwner.cjs","sources":["../../../../../src/rpc/methods/getAllTokenAccountsByOwner.ts"],"sourcesContent":["import type { RpcCaller } from \"../caller\";\nimport {\n  type GetTokenAccountsByOwnerV2Config,\n  type GetTokenAccountsByOwnerV2Request,\n  type GetTokenAccountsByOwnerV2Response,\n  type GtaV2Account,\n} from \"../../types\";\nimport { makeGetTokenAccountsByOwnerV2 } from \"./getTokenAccountsByOwnerV2\";\n\nexport type GetAllTokenAccountsByOwnerFn = (\n  owner: string,\n  filter?: GetTokenAccountsByOwnerV2Request[1],\n  options?: Omit<GetTokenAccountsByOwnerV2Config, \"paginationKey\" | \"limit\">\n) => Promise<ReadonlyArray<GtaV2Account>>;\n\nexport const makeGetAllTokenAccountsByOwner =\n  (call: RpcCaller): GetAllTokenAccountsByOwnerFn =>\n  async (owner, filter = {}, options = {}) => {\n    const getPage = makeGetTokenAccountsByOwnerV2(call);\n    const out: GtaV2Account[] = [];\n    let paginationKey: string | null = null;\n\n    do {\n      const res: GetTokenAccountsByOwnerV2Response = await getPage([\n        owner,\n        filter,\n        {\n          ...options,\n          limit: 10_000,\n          ...(paginationKey ? { paginationKey } : {}),\n        },\n      ]);\n\n      const page = (res as any)?.value ?? (res as any);\n      out.push(...page.accounts);\n      paginationKey = page.paginationKey;\n    } while (paginationKey);\n\n    return out;\n  };\n"],"names":["makeGetTokenAccountsByOwnerV2"],"mappings":";;;;MAea,8BAA8B,GACzC,CAAC,IAAe,KAChB,OAAO,KAAK,EAAE,MAAM,GAAG,EAAE,EAAE,OAAO,GAAG,EAAE,KAAI;AACzC,IAAA,MAAM,OAAO,GAAGA,uDAA6B,CAAC,IAAI,CAAC;IACnD,MAAM,GAAG,GAAmB,EAAE;IAC9B,IAAI,aAAa,GAAkB,IAAI;AAEvC,IAAA,GAAG;AACD,QAAA,MAAM,GAAG,GAAsC,MAAM,OAAO,CAAC;YAC3D,KAAK;YACL,MAAM;AACN,YAAA;AACE,gBAAA,GAAG,OAAO;AACV,gBAAA,KAAK,EAAE,KAAM;AACb,gBAAA,IAAI,aAAa,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC;AAC5C,aAAA;AACF,SAAA,CAAC;AAEF,QAAA,MAAM,IAAI,GAAI,GAAW,EAAE,KAAK,IAAK,GAAW;QAChD,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;AAC1B,QAAA,aAAa,GAAG,IAAI,CAAC,aAAa;IACpC,CAAC,QAAQ,aAAa;AAEtB,IAAA,OAAO,GAAG;AACZ;;;;"}