{"version":3,"file":"utils.mjs","sources":["../src/utils.ts"],"sourcesContent":["import { AlbedoModule } from './modules/albedo.module';\nimport { FreighterModule } from './modules/freighter.module';\nimport { LobstrModule } from './modules/lobstr.module';\nimport { RabetModule } from './modules/rabet.module';\nimport { xBullModule } from './modules/xbull.module';\nimport { HotWalletModule } from './modules/hotwallet.module';\nimport { HanaModule } from './modules/hana.module';\nimport { ModuleInterface } from './types';\n\n/**\n * This method returns all modules that don't require extra configuration before they can be loaded\n * You can provide a filter function if needed\n */\nexport function allowAllModules(opts?: { filterBy: (module: ModuleInterface) => boolean }): ModuleInterface[] {\n  const modules: ModuleInterface[] = [\n    new AlbedoModule(),\n    new FreighterModule(),\n    new RabetModule(),\n    new xBullModule(),\n    new LobstrModule(),\n    new HanaModule(),\n    new HotWalletModule(),\n  ];\n  return opts?.filterBy ? modules.filter(opts.filterBy) : modules;\n}\n\n/**\n * This method only returns those modules from wallet that follow exactly the SEP-43 standard and don't require extra configuration before they can be loaded\n * You can provide a filter function if needed\n */\nexport function sep43Modules(opts?: { filterBy: (module: ModuleInterface) => boolean }): ModuleInterface[] {\n  const modules: ModuleInterface[] = [new FreighterModule(), new HotWalletModule()];\n  return opts?.filterBy ? modules.filter(opts.filterBy) : modules;\n}\n\nexport function parseError(e: any) {\n  return {\n    code: e?.error?.code || e?.code || -1,\n    message: e?.error?.message || e?.message || (typeof e === 'string' && e) || 'Unhandled error from the wallet',\n    ext: e?.error?.ext || e?.ext,\n  };\n}\n"],"names":[],"mappings":";;;;;;;;AAaO,SAAS,gBAAgB,IAA8E,EAAA;AAC5G,EAAA,MAAM,OAA6B,GAAA;AAAA,IACjC,IAAI,YAAa,EAAA;AAAA,IACjB,IAAI,eAAgB,EAAA;AAAA,IACpB,IAAI,WAAY,EAAA;AAAA,IAChB,IAAI,WAAY,EAAA;AAAA,IAChB,IAAI,YAAa,EAAA;AAAA,IACjB,IAAI,UAAW,EAAA;AAAA,IACf,IAAI,eAAgB;AAAA,GACtB;AACA,EAAA,OAAO,MAAM,QAAW,GAAA,OAAA,CAAQ,MAAO,CAAA,IAAA,CAAK,QAAQ,CAAI,GAAA,OAAA;AAC1D;AAMO,SAAS,aAAa,IAA8E,EAAA;AACzG,EAAA,MAAM,UAA6B,CAAC,IAAI,iBAAmB,EAAA,IAAI,iBAAiB,CAAA;AAChF,EAAA,OAAO,MAAM,QAAW,GAAA,OAAA,CAAQ,MAAO,CAAA,IAAA,CAAK,QAAQ,CAAI,GAAA,OAAA;AAC1D;AAEO,SAAS,WAAW,CAAQ,EAAA;AACjC,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,CAAA,EAAG,KAAO,EAAA,IAAA,IAAQ,GAAG,IAAQ,IAAA,CAAA,CAAA;AAAA,IACnC,OAAA,EAAS,GAAG,KAAO,EAAA,OAAA,IAAW,GAAG,OAAY,IAAA,OAAO,CAAM,KAAA,QAAA,IAAY,CAAM,IAAA,iCAAA;AAAA,IAC5E,GAAK,EAAA,CAAA,EAAG,KAAO,EAAA,GAAA,IAAO,CAAG,EAAA;AAAA,GAC3B;AACF;;;;"}