{"version":3,"sources":["../src/chains/stellar/nativeConnect.ts"],"names":[],"mappings":";;;AAWA,eAAsB,qBACpB,KAAA,EAC2E;AAC3E,EAAA,MAAM,MAAA,GAAS,MAAM,aAAA,CAA4B;AAAA,IAC/C,GAAG,KAAA;AAAA,IACH,KAAA,EAAO,SAAA;AAAA,IACP,aAAA,EAAe,OAAO,KAAA,KAAU;AAC9B,MAAA,MAAM,MAAM,MAAM,mBAAA,CAAoB,IAAA,CAAK,EAAE,OAAO,CAAA;AACpD,MAAA,OAAO,GAAA,GAAM,YAAA,CAAa,GAAG,CAAA,GAAI,IAAA;AAAA,IACnC,CAAA;AAAA,IACA,WAAA,EAAa,OAAO,IAAA,EAAmB,KAAA,KACrC,YAAA,CAAa,MAAM,mBAAA,CAAoB,cAAA,CAAe,IAAA,EAAM,EAAE,KAAA,EAAO,CAAC;AAAA,GACzE,CAAA;AACD,EAAA,OAAO,EAAE,OAAA,EAAS,MAAA,CAAO,OAAA,EAAS,OAAA,EAAS,OAAO,KAAA,EAAO,OAAA,EAAS,YAAA,EAAc,MAAA,CAAO,YAAA,EAAa;AACtG;AAEA,SAAS,aAAa,OAAA,EAAmC;AACvD,EAAA,OAAO,EAAE,OAAA,EAAS,MAAM,OAAA,CAAQ,aAAA,IAAiB,OAAA,EAAQ;AAC3D","file":"chunk-JB3PZDSD.mjs","sourcesContent":["import { WebCryptoControlKey, type ControlKey } from \"./WebCryptoControlKey\";\nimport {\n  resolveNative,\n  type ResolveNativeInput,\n} from \"../../secret/nativeAccount\";\nimport type { Ed25519Seed } from \"../../secret/dek\";\n\nexport type ResolveNativeStellarInput = Omit<ResolveNativeInput, \"chain\" | \"importSpend\" | \"loadPersisted\">;\n\ntype StellarSpend = { address(): string; control: ControlKey };\n\nexport async function resolveNativeStellar(\n  input: ResolveNativeStellarInput,\n): Promise<{ address: string; control?: ControlKey; isNewAccount: boolean }> {\n  const native = await resolveNative<StellarSpend>({\n    ...input,\n    chain: \"stellar\",\n    loadPersisted: async (keyId) => {\n      const key = await WebCryptoControlKey.load({ keyId });\n      return key ? stellarSpend(key) : null;\n    },\n    importSpend: async (seed: Ed25519Seed, keyId: string) =>\n      stellarSpend(await WebCryptoControlKey.importFromSeed(seed, { keyId })),\n  });\n  return { address: native.address, control: native.spend?.control, isNewAccount: native.isNewAccount };\n}\n\nfunction stellarSpend(control: ControlKey): StellarSpend {\n  return { address: () => control.publicAddress(), control };\n}\n"]}