@molecularlabs/nucleus-frontend
Version:
Nucleus BoringVault Frontend SDK
1 lines • 1.37 kB
Source Map (JSON)
{"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\";\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;AAiB1B,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":[]}