{"version":3,"sources":["../../src/api/teller.ts"],"sourcesContent":["/**\n * @fileoverview Functions for interacting with the Teller contract\n */\nimport type { Address } from \"viem\";\nimport { TellerAbi } from \"../contracts/teller-abi\";\nimport { getClient } from \"../lib/client\";\nimport type { ChainId } from \"./vault-config\";\n\n/**\n * Arguments required by the bridge contract for cross-chain transfers\n * @interface BridgeData\n * @property {number} chainSelector - Unique identifier for the destination chain\n * @property {Address} destinationChainReceiver - Address that will receive the bridged tokens\n * @property {Address} bridgeFeeToken - Token used to pay the bridge fee\n * @property {bigint} messageGas - Amount of gas allocated for the cross-chain message\n * @property {`0x${string}`} data - Additional data required for the bridge operation (hex encoded)\n */\nexport type BridgeData = {\n  chainSelector: number;\n  destinationChainReceiver: Address;\n  bridgeFeeToken: Address;\n  messageGas: bigint;\n  data: `0x${string}`;\n};\n\ntype GetPreviewFeeProps = {\n  shareAmount: bigint;\n  bridgeData: BridgeData;\n  contractAddress: Address;\n  chainId: ChainId;\n};\n\nconst getPreviewFee = async ({\n  shareAmount,\n  bridgeData,\n  contractAddress,\n  chainId,\n}: GetPreviewFeeProps): Promise<bigint> => {\n  const client = await getClient(chainId);\n\n  const rate = await client.readContract({\n    abi: TellerAbi,\n    address: contractAddress,\n    functionName: \"previewFee\",\n    args: [shareAmount, bridgeData],\n  });\n\n  return rate;\n};\n\nexport { getPreviewFee };\n"],"mappings":"AAIA,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AA2B1B,MAAM,gBAAgB,OAAO;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA2C;AACzC,QAAM,SAAS,MAAM,UAAU,OAAO;AAEtC,QAAM,OAAO,MAAM,OAAO,aAAa;AAAA,IACrC,KAAK;AAAA,IACL,SAAS;AAAA,IACT,cAAc;AAAA,IACd,MAAM,CAAC,aAAa,UAAU;AAAA,EAChC,CAAC;AAED,SAAO;AACT;","names":[]}