@avalabs/fusion-sdk 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/constants.cjs +1 -1
  2. package/dist/constants.cjs.map +1 -1
  3. package/dist/constants.d.cts +2 -2
  4. package/dist/constants.d.ts +2 -2
  5. package/dist/constants.js +1 -1
  6. package/dist/constants.js.map +1 -1
  7. package/dist/mod.cjs +1 -1
  8. package/dist/mod.d.cts +2 -2
  9. package/dist/mod.d.ts +2 -2
  10. package/dist/mod.js +1 -1
  11. package/dist/transfer-service/avalanche-evm/_handlers/estimate-native-fee.cjs +1 -1
  12. package/dist/transfer-service/avalanche-evm/_handlers/estimate-native-fee.cjs.map +1 -1
  13. package/dist/transfer-service/avalanche-evm/_handlers/estimate-native-fee.js +1 -1
  14. package/dist/transfer-service/avalanche-evm/_handlers/estimate-native-fee.js.map +1 -1
  15. package/dist/transfer-service/avalanche-evm/_handlers/track-transfer.cjs.map +1 -1
  16. package/dist/transfer-service/avalanche-evm/_handlers/track-transfer.js.map +1 -1
  17. package/dist/transfer-service/lombard/btc-to-btcb/_handlers/estimate-native-fee.cjs +1 -1
  18. package/dist/transfer-service/lombard/btc-to-btcb/_handlers/estimate-native-fee.cjs.map +1 -1
  19. package/dist/transfer-service/lombard/btc-to-btcb/_handlers/estimate-native-fee.js +1 -1
  20. package/dist/transfer-service/lombard/btc-to-btcb/_handlers/estimate-native-fee.js.map +1 -1
  21. package/dist/transfer-service/lombard/btcb-to-btc/_handlers/estimate-native-fee.cjs +1 -1
  22. package/dist/transfer-service/lombard/btcb-to-btc/_handlers/estimate-native-fee.cjs.map +1 -1
  23. package/dist/transfer-service/lombard/btcb-to-btc/_handlers/estimate-native-fee.js +1 -1
  24. package/dist/transfer-service/lombard/btcb-to-btc/_handlers/estimate-native-fee.js.map +1 -1
  25. package/dist/transfer-service/markr/_handlers/estimate-native-fee.cjs +1 -1
  26. package/dist/transfer-service/markr/_handlers/estimate-native-fee.cjs.map +1 -1
  27. package/dist/transfer-service/markr/_handlers/estimate-native-fee.js +1 -1
  28. package/dist/transfer-service/markr/_handlers/estimate-native-fee.js.map +1 -1
  29. package/dist/transfer-service/markr/_handlers/transfer-asset.cjs +1 -1
  30. package/dist/transfer-service/markr/_handlers/transfer-asset.cjs.map +1 -1
  31. package/dist/transfer-service/markr/_handlers/transfer-asset.js +1 -1
  32. package/dist/transfer-service/markr/_handlers/transfer-asset.js.map +1 -1
  33. package/dist/transfer-service/markr/_solana-utils.cjs +1 -1
  34. package/dist/transfer-service/markr/_solana-utils.cjs.map +1 -1
  35. package/dist/transfer-service/markr/_solana-utils.js +1 -1
  36. package/dist/transfer-service/markr/_solana-utils.js.map +1 -1
  37. package/dist/transfer-service/markr/_utils.cjs +1 -1
  38. package/dist/transfer-service/markr/_utils.cjs.map +1 -1
  39. package/dist/transfer-service/markr/_utils.js +1 -1
  40. package/dist/transfer-service/markr/_utils.js.map +1 -1
  41. package/dist/transfer-service/wrap-unwrap/_handlers/estimate-native-fee.cjs +1 -1
  42. package/dist/transfer-service/wrap-unwrap/_handlers/estimate-native-fee.cjs.map +1 -1
  43. package/dist/transfer-service/wrap-unwrap/_handlers/estimate-native-fee.js +1 -1
  44. package/dist/transfer-service/wrap-unwrap/_handlers/estimate-native-fee.js.map +1 -1
  45. package/dist/types/service.d.cts +6 -2
  46. package/dist/types/service.d.ts +6 -2
  47. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"estimate-native-fee.cjs","names":["ServiceType","SdkError","ErrorReason","ErrorCode","getWrapDirection","getEvmClientForChain","estimateWrapUnwrapGas","getWrapperContractAddress","estimateEvmFeesPerGas"],"sources":["../../../../src/transfer-service/wrap-unwrap/_handlers/estimate-native-fee.ts"],"sourcesContent":["import { isAddress } from 'viem';\nimport { ServiceType } from '../../../constants';\nimport { ErrorCode, ErrorReason, SdkError } from '../../../errors';\nimport type { TransferService } from '../../../types/service';\nimport type { Caip2ChainId } from '../../../types/caip';\nimport { getWrapDirection, getWrapperContractAddress, estimateWrapUnwrapGas } from '../_utils';\nimport type { WrapChainConfig } from '../constants';\nimport { getEvmClientForChain } from '../../_utils';\nimport { estimateEvmFeesPerGas } from '../../_evm-gas';\n\nexport interface EstimateNativeFeeFactoryConfig {\n chainConfigs: ReadonlyMap<Caip2ChainId, WrapChainConfig>;\n}\n\nexport function estimateNativeFeeFactory({\n chainConfigs,\n}: EstimateNativeFeeFactoryConfig): TransferService['estimateNativeFee'] {\n return async (quote, options) => {\n if (quote.serviceType !== ServiceType.WRAP_UNWRAP) {\n throw new SdkError(ErrorReason.INCORRECT_PROVIDER_PROVIDED, ErrorCode.INVALID_PARAMS);\n }\n\n const fromAddress = quote.fromAddress;\n if (!isAddress(fromAddress)) {\n throw new SdkError(ErrorReason.INVALID_PARAMS, ErrorCode.INVALID_PARAMS, {\n details: 'fromAddress is not a valid EVM address.',\n });\n }\n\n const chainId = quote.sourceChain.chainId;\n const direction = getWrapDirection(quote.assetIn, quote.assetOut, chainId, chainConfigs);\n if (!direction) {\n throw new SdkError(ErrorReason.INVALID_PARAMS, ErrorCode.INVALID_PARAMS, {\n details: 'Quote does not represent a valid wrap/unwrap pair.',\n });\n }\n\n const client = getEvmClientForChain({ chain: quote.sourceChain });\n\n const gasWithMargin = await estimateWrapUnwrapGas({\n direction,\n amountIn: quote.amountIn,\n contractAddress: getWrapperContractAddress(chainId, chainConfigs),\n fromAddress,\n client,\n estimateGasMarginBps: options?.feeUnitsMarginBps,\n });\n\n const fees = await estimateEvmFeesPerGas(client, quote.sourceChain, options?.overrides?.feeRateTier);\n\n const maxFeePerGas = options?.overrides?.maxFeePerGas ?? fees.maxFeePerGas;\n const maxPriorityFeePerGas = options?.overrides?.maxPriorityFeePerGas ?? fees.maxPriorityFeePerGas;\n\n const totalFee = gasWithMargin * maxFeePerGas;\n\n return {\n asset: quote.sourceChain.networkToken,\n totalFee,\n meta: {\n maxFeePerGas,\n maxPriorityFeePerGas,\n },\n };\n };\n}\n"],"mappings":"6OAcA,SAAgB,EAAyB,CACvC,gBACuE,CACvE,OAAO,MAAO,EAAO,IAAY,CAC/B,GAAI,EAAM,cAAgBA,EAAAA,YAAY,YACpC,MAAM,IAAIC,EAAAA,SAASC,EAAAA,YAAY,4BAA6BC,EAAAA,UAAU,eAAe,CAGvF,IAAM,EAAc,EAAM,YAC1B,GAAI,EAAA,EAAA,EAAA,WAAW,EAAY,CACzB,MAAM,IAAIF,EAAAA,SAASC,EAAAA,YAAY,eAAgBC,EAAAA,UAAU,eAAgB,CACvE,QAAS,0CACV,CAAC,CAGJ,IAAM,EAAU,EAAM,YAAY,QAC5B,EAAYC,EAAAA,iBAAiB,EAAM,QAAS,EAAM,SAAU,EAAS,EAAa,CACxF,GAAI,CAAC,EACH,MAAM,IAAIH,EAAAA,SAASC,EAAAA,YAAY,eAAgBC,EAAAA,UAAU,eAAgB,CACvE,QAAS,qDACV,CAAC,CAGJ,IAAM,EAASE,EAAAA,qBAAqB,CAAE,MAAO,EAAM,YAAa,CAAC,CAE3D,EAAgB,MAAMC,EAAAA,sBAAsB,CAChD,YACA,SAAU,EAAM,SAChB,gBAAiBC,EAAAA,0BAA0B,EAAS,EAAa,CACjE,cACA,SACA,qBAAsB,GAAS,kBAChC,CAAC,CAEI,EAAO,MAAMC,EAAAA,sBAAsB,EAAQ,EAAM,YAAa,GAAS,WAAW,YAAY,CAE9F,EAAe,GAAS,WAAW,cAAgB,EAAK,aACxD,EAAuB,GAAS,WAAW,sBAAwB,EAAK,qBAExE,EAAW,EAAgB,EAEjC,MAAO,CACL,MAAO,EAAM,YAAY,aACzB,WACA,KAAM,CACJ,eACA,uBACD,CACF"}
1
+ {"version":3,"file":"estimate-native-fee.cjs","names":["ServiceType","SdkError","ErrorReason","ErrorCode","getWrapDirection","getEvmClientForChain","estimateWrapUnwrapGas","getWrapperContractAddress","estimateEvmFeesPerGas"],"sources":["../../../../src/transfer-service/wrap-unwrap/_handlers/estimate-native-fee.ts"],"sourcesContent":["import { isAddress } from 'viem';\nimport { ServiceType } from '../../../constants';\nimport { ErrorCode, ErrorReason, SdkError } from '../../../errors';\nimport type { TransferService } from '../../../types/service';\nimport type { Caip2ChainId } from '../../../types/caip';\nimport { getWrapDirection, getWrapperContractAddress, estimateWrapUnwrapGas } from '../_utils';\nimport type { WrapChainConfig } from '../constants';\nimport { getEvmClientForChain } from '../../_utils';\nimport { estimateEvmFeesPerGas } from '../../_evm-gas';\n\nexport interface EstimateNativeFeeFactoryConfig {\n chainConfigs: ReadonlyMap<Caip2ChainId, WrapChainConfig>;\n}\n\nexport function estimateNativeFeeFactory({\n chainConfigs,\n}: EstimateNativeFeeFactoryConfig): TransferService['estimateNativeFee'] {\n return async (quote, options) => {\n if (quote.serviceType !== ServiceType.WRAP_UNWRAP) {\n throw new SdkError(ErrorReason.INCORRECT_PROVIDER_PROVIDED, ErrorCode.INVALID_PARAMS);\n }\n\n const fromAddress = quote.fromAddress;\n if (!isAddress(fromAddress)) {\n throw new SdkError(ErrorReason.INVALID_PARAMS, ErrorCode.INVALID_PARAMS, {\n details: 'fromAddress is not a valid EVM address.',\n });\n }\n\n const chainId = quote.sourceChain.chainId;\n const direction = getWrapDirection(quote.assetIn, quote.assetOut, chainId, chainConfigs);\n if (!direction) {\n throw new SdkError(ErrorReason.INVALID_PARAMS, ErrorCode.INVALID_PARAMS, {\n details: 'Quote does not represent a valid wrap/unwrap pair.',\n });\n }\n\n const client = getEvmClientForChain({ chain: quote.sourceChain });\n\n const gasWithMargin = await estimateWrapUnwrapGas({\n direction,\n amountIn: quote.amountIn,\n contractAddress: getWrapperContractAddress(chainId, chainConfigs),\n fromAddress,\n client,\n estimateGasMarginBps: options?.feeUnitsMarginBps,\n });\n\n const fees = await estimateEvmFeesPerGas(client, quote.sourceChain, options?.overrides?.feeRateTier);\n\n const maxFeePerGas = options?.overrides?.maxFeePerGas ?? fees.maxFeePerGas;\n const maxPriorityFeePerGas = options?.overrides?.maxPriorityFeePerGas ?? fees.maxPriorityFeePerGas;\n\n const totalFee = gasWithMargin * maxFeePerGas;\n\n return {\n asset: quote.sourceChain.networkToken,\n totalFee,\n totalUpfrontFee: totalFee,\n meta: {\n maxFeePerGas,\n maxPriorityFeePerGas,\n },\n };\n };\n}\n"],"mappings":"6OAcA,SAAgB,EAAyB,CACvC,gBACuE,CACvE,OAAO,MAAO,EAAO,IAAY,CAC/B,GAAI,EAAM,cAAgBA,EAAAA,YAAY,YACpC,MAAM,IAAIC,EAAAA,SAASC,EAAAA,YAAY,4BAA6BC,EAAAA,UAAU,eAAe,CAGvF,IAAM,EAAc,EAAM,YAC1B,GAAI,EAAA,EAAA,EAAA,WAAW,EAAY,CACzB,MAAM,IAAIF,EAAAA,SAASC,EAAAA,YAAY,eAAgBC,EAAAA,UAAU,eAAgB,CACvE,QAAS,0CACV,CAAC,CAGJ,IAAM,EAAU,EAAM,YAAY,QAC5B,EAAYC,EAAAA,iBAAiB,EAAM,QAAS,EAAM,SAAU,EAAS,EAAa,CACxF,GAAI,CAAC,EACH,MAAM,IAAIH,EAAAA,SAASC,EAAAA,YAAY,eAAgBC,EAAAA,UAAU,eAAgB,CACvE,QAAS,qDACV,CAAC,CAGJ,IAAM,EAASE,EAAAA,qBAAqB,CAAE,MAAO,EAAM,YAAa,CAAC,CAE3D,EAAgB,MAAMC,EAAAA,sBAAsB,CAChD,YACA,SAAU,EAAM,SAChB,gBAAiBC,EAAAA,0BAA0B,EAAS,EAAa,CACjE,cACA,SACA,qBAAsB,GAAS,kBAChC,CAAC,CAEI,EAAO,MAAMC,EAAAA,sBAAsB,EAAQ,EAAM,YAAa,GAAS,WAAW,YAAY,CAE9F,EAAe,GAAS,WAAW,cAAgB,EAAK,aACxD,EAAuB,GAAS,WAAW,sBAAwB,EAAK,qBAExE,EAAW,EAAgB,EAEjC,MAAO,CACL,MAAO,EAAM,YAAY,aACzB,WACA,gBAAiB,EACjB,KAAM,CACJ,eACA,uBACD,CACF"}
@@ -1,2 +1,2 @@
1
- import{ServiceType as e}from"../../../constants.js";import{ErrorCode as t,ErrorReason as n,SdkError as r}from"../../../errors.js";import{getEvmClientForChain as i}from"../../_utils.js";import{estimateEvmFeesPerGas as a}from"../../_evm-gas.js";import{estimateWrapUnwrapGas as o,getWrapDirection as s,getWrapperContractAddress as c}from"../_utils.js";import{isAddress as l}from"viem";function u({chainConfigs:u}){return async(d,f)=>{if(d.serviceType!==e.WRAP_UNWRAP)throw new r(n.INCORRECT_PROVIDER_PROVIDED,t.INVALID_PARAMS);let p=d.fromAddress;if(!l(p))throw new r(n.INVALID_PARAMS,t.INVALID_PARAMS,{details:`fromAddress is not a valid EVM address.`});let m=d.sourceChain.chainId,h=s(d.assetIn,d.assetOut,m,u);if(!h)throw new r(n.INVALID_PARAMS,t.INVALID_PARAMS,{details:`Quote does not represent a valid wrap/unwrap pair.`});let g=i({chain:d.sourceChain}),_=await o({direction:h,amountIn:d.amountIn,contractAddress:c(m,u),fromAddress:p,client:g,estimateGasMarginBps:f?.feeUnitsMarginBps}),v=await a(g,d.sourceChain,f?.overrides?.feeRateTier),y=f?.overrides?.maxFeePerGas??v.maxFeePerGas,b=f?.overrides?.maxPriorityFeePerGas??v.maxPriorityFeePerGas,x=_*y;return{asset:d.sourceChain.networkToken,totalFee:x,meta:{maxFeePerGas:y,maxPriorityFeePerGas:b}}}}export{u as estimateNativeFeeFactory};
1
+ import{ServiceType as e}from"../../../constants.js";import{ErrorCode as t,ErrorReason as n,SdkError as r}from"../../../errors.js";import{getEvmClientForChain as i}from"../../_utils.js";import{estimateEvmFeesPerGas as a}from"../../_evm-gas.js";import{estimateWrapUnwrapGas as o,getWrapDirection as s,getWrapperContractAddress as c}from"../_utils.js";import{isAddress as l}from"viem";function u({chainConfigs:u}){return async(d,f)=>{if(d.serviceType!==e.WRAP_UNWRAP)throw new r(n.INCORRECT_PROVIDER_PROVIDED,t.INVALID_PARAMS);let p=d.fromAddress;if(!l(p))throw new r(n.INVALID_PARAMS,t.INVALID_PARAMS,{details:`fromAddress is not a valid EVM address.`});let m=d.sourceChain.chainId,h=s(d.assetIn,d.assetOut,m,u);if(!h)throw new r(n.INVALID_PARAMS,t.INVALID_PARAMS,{details:`Quote does not represent a valid wrap/unwrap pair.`});let g=i({chain:d.sourceChain}),_=await o({direction:h,amountIn:d.amountIn,contractAddress:c(m,u),fromAddress:p,client:g,estimateGasMarginBps:f?.feeUnitsMarginBps}),v=await a(g,d.sourceChain,f?.overrides?.feeRateTier),y=f?.overrides?.maxFeePerGas??v.maxFeePerGas,b=f?.overrides?.maxPriorityFeePerGas??v.maxPriorityFeePerGas,x=_*y;return{asset:d.sourceChain.networkToken,totalFee:x,totalUpfrontFee:x,meta:{maxFeePerGas:y,maxPriorityFeePerGas:b}}}}export{u as estimateNativeFeeFactory};
2
2
  //# sourceMappingURL=estimate-native-fee.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"estimate-native-fee.js","names":[],"sources":["../../../../src/transfer-service/wrap-unwrap/_handlers/estimate-native-fee.ts"],"sourcesContent":["import { isAddress } from 'viem';\nimport { ServiceType } from '../../../constants';\nimport { ErrorCode, ErrorReason, SdkError } from '../../../errors';\nimport type { TransferService } from '../../../types/service';\nimport type { Caip2ChainId } from '../../../types/caip';\nimport { getWrapDirection, getWrapperContractAddress, estimateWrapUnwrapGas } from '../_utils';\nimport type { WrapChainConfig } from '../constants';\nimport { getEvmClientForChain } from '../../_utils';\nimport { estimateEvmFeesPerGas } from '../../_evm-gas';\n\nexport interface EstimateNativeFeeFactoryConfig {\n chainConfigs: ReadonlyMap<Caip2ChainId, WrapChainConfig>;\n}\n\nexport function estimateNativeFeeFactory({\n chainConfigs,\n}: EstimateNativeFeeFactoryConfig): TransferService['estimateNativeFee'] {\n return async (quote, options) => {\n if (quote.serviceType !== ServiceType.WRAP_UNWRAP) {\n throw new SdkError(ErrorReason.INCORRECT_PROVIDER_PROVIDED, ErrorCode.INVALID_PARAMS);\n }\n\n const fromAddress = quote.fromAddress;\n if (!isAddress(fromAddress)) {\n throw new SdkError(ErrorReason.INVALID_PARAMS, ErrorCode.INVALID_PARAMS, {\n details: 'fromAddress is not a valid EVM address.',\n });\n }\n\n const chainId = quote.sourceChain.chainId;\n const direction = getWrapDirection(quote.assetIn, quote.assetOut, chainId, chainConfigs);\n if (!direction) {\n throw new SdkError(ErrorReason.INVALID_PARAMS, ErrorCode.INVALID_PARAMS, {\n details: 'Quote does not represent a valid wrap/unwrap pair.',\n });\n }\n\n const client = getEvmClientForChain({ chain: quote.sourceChain });\n\n const gasWithMargin = await estimateWrapUnwrapGas({\n direction,\n amountIn: quote.amountIn,\n contractAddress: getWrapperContractAddress(chainId, chainConfigs),\n fromAddress,\n client,\n estimateGasMarginBps: options?.feeUnitsMarginBps,\n });\n\n const fees = await estimateEvmFeesPerGas(client, quote.sourceChain, options?.overrides?.feeRateTier);\n\n const maxFeePerGas = options?.overrides?.maxFeePerGas ?? fees.maxFeePerGas;\n const maxPriorityFeePerGas = options?.overrides?.maxPriorityFeePerGas ?? fees.maxPriorityFeePerGas;\n\n const totalFee = gasWithMargin * maxFeePerGas;\n\n return {\n asset: quote.sourceChain.networkToken,\n totalFee,\n meta: {\n maxFeePerGas,\n maxPriorityFeePerGas,\n },\n };\n };\n}\n"],"mappings":"8XAcA,SAAgB,EAAyB,CACvC,gBACuE,CACvE,OAAO,MAAO,EAAO,IAAY,CAC/B,GAAI,EAAM,cAAgB,EAAY,YACpC,MAAM,IAAI,EAAS,EAAY,4BAA6B,EAAU,eAAe,CAGvF,IAAM,EAAc,EAAM,YAC1B,GAAI,CAAC,EAAU,EAAY,CACzB,MAAM,IAAI,EAAS,EAAY,eAAgB,EAAU,eAAgB,CACvE,QAAS,0CACV,CAAC,CAGJ,IAAM,EAAU,EAAM,YAAY,QAC5B,EAAY,EAAiB,EAAM,QAAS,EAAM,SAAU,EAAS,EAAa,CACxF,GAAI,CAAC,EACH,MAAM,IAAI,EAAS,EAAY,eAAgB,EAAU,eAAgB,CACvE,QAAS,qDACV,CAAC,CAGJ,IAAM,EAAS,EAAqB,CAAE,MAAO,EAAM,YAAa,CAAC,CAE3D,EAAgB,MAAM,EAAsB,CAChD,YACA,SAAU,EAAM,SAChB,gBAAiB,EAA0B,EAAS,EAAa,CACjE,cACA,SACA,qBAAsB,GAAS,kBAChC,CAAC,CAEI,EAAO,MAAM,EAAsB,EAAQ,EAAM,YAAa,GAAS,WAAW,YAAY,CAE9F,EAAe,GAAS,WAAW,cAAgB,EAAK,aACxD,EAAuB,GAAS,WAAW,sBAAwB,EAAK,qBAExE,EAAW,EAAgB,EAEjC,MAAO,CACL,MAAO,EAAM,YAAY,aACzB,WACA,KAAM,CACJ,eACA,uBACD,CACF"}
1
+ {"version":3,"file":"estimate-native-fee.js","names":[],"sources":["../../../../src/transfer-service/wrap-unwrap/_handlers/estimate-native-fee.ts"],"sourcesContent":["import { isAddress } from 'viem';\nimport { ServiceType } from '../../../constants';\nimport { ErrorCode, ErrorReason, SdkError } from '../../../errors';\nimport type { TransferService } from '../../../types/service';\nimport type { Caip2ChainId } from '../../../types/caip';\nimport { getWrapDirection, getWrapperContractAddress, estimateWrapUnwrapGas } from '../_utils';\nimport type { WrapChainConfig } from '../constants';\nimport { getEvmClientForChain } from '../../_utils';\nimport { estimateEvmFeesPerGas } from '../../_evm-gas';\n\nexport interface EstimateNativeFeeFactoryConfig {\n chainConfigs: ReadonlyMap<Caip2ChainId, WrapChainConfig>;\n}\n\nexport function estimateNativeFeeFactory({\n chainConfigs,\n}: EstimateNativeFeeFactoryConfig): TransferService['estimateNativeFee'] {\n return async (quote, options) => {\n if (quote.serviceType !== ServiceType.WRAP_UNWRAP) {\n throw new SdkError(ErrorReason.INCORRECT_PROVIDER_PROVIDED, ErrorCode.INVALID_PARAMS);\n }\n\n const fromAddress = quote.fromAddress;\n if (!isAddress(fromAddress)) {\n throw new SdkError(ErrorReason.INVALID_PARAMS, ErrorCode.INVALID_PARAMS, {\n details: 'fromAddress is not a valid EVM address.',\n });\n }\n\n const chainId = quote.sourceChain.chainId;\n const direction = getWrapDirection(quote.assetIn, quote.assetOut, chainId, chainConfigs);\n if (!direction) {\n throw new SdkError(ErrorReason.INVALID_PARAMS, ErrorCode.INVALID_PARAMS, {\n details: 'Quote does not represent a valid wrap/unwrap pair.',\n });\n }\n\n const client = getEvmClientForChain({ chain: quote.sourceChain });\n\n const gasWithMargin = await estimateWrapUnwrapGas({\n direction,\n amountIn: quote.amountIn,\n contractAddress: getWrapperContractAddress(chainId, chainConfigs),\n fromAddress,\n client,\n estimateGasMarginBps: options?.feeUnitsMarginBps,\n });\n\n const fees = await estimateEvmFeesPerGas(client, quote.sourceChain, options?.overrides?.feeRateTier);\n\n const maxFeePerGas = options?.overrides?.maxFeePerGas ?? fees.maxFeePerGas;\n const maxPriorityFeePerGas = options?.overrides?.maxPriorityFeePerGas ?? fees.maxPriorityFeePerGas;\n\n const totalFee = gasWithMargin * maxFeePerGas;\n\n return {\n asset: quote.sourceChain.networkToken,\n totalFee,\n totalUpfrontFee: totalFee,\n meta: {\n maxFeePerGas,\n maxPriorityFeePerGas,\n },\n };\n };\n}\n"],"mappings":"8XAcA,SAAgB,EAAyB,CACvC,gBACuE,CACvE,OAAO,MAAO,EAAO,IAAY,CAC/B,GAAI,EAAM,cAAgB,EAAY,YACpC,MAAM,IAAI,EAAS,EAAY,4BAA6B,EAAU,eAAe,CAGvF,IAAM,EAAc,EAAM,YAC1B,GAAI,CAAC,EAAU,EAAY,CACzB,MAAM,IAAI,EAAS,EAAY,eAAgB,EAAU,eAAgB,CACvE,QAAS,0CACV,CAAC,CAGJ,IAAM,EAAU,EAAM,YAAY,QAC5B,EAAY,EAAiB,EAAM,QAAS,EAAM,SAAU,EAAS,EAAa,CACxF,GAAI,CAAC,EACH,MAAM,IAAI,EAAS,EAAY,eAAgB,EAAU,eAAgB,CACvE,QAAS,qDACV,CAAC,CAGJ,IAAM,EAAS,EAAqB,CAAE,MAAO,EAAM,YAAa,CAAC,CAE3D,EAAgB,MAAM,EAAsB,CAChD,YACA,SAAU,EAAM,SAChB,gBAAiB,EAA0B,EAAS,EAAa,CACjE,cACA,SACA,qBAAsB,GAAS,kBAChC,CAAC,CAEI,EAAO,MAAM,EAAsB,EAAQ,EAAM,YAAa,GAAS,WAAW,YAAY,CAE9F,EAAe,GAAS,WAAW,cAAgB,EAAK,aACxD,EAAuB,GAAS,WAAW,sBAAwB,EAAK,qBAExE,EAAW,EAAgB,EAEjC,MAAO,CACL,MAAO,EAAM,YAAY,aACzB,WACA,gBAAiB,EACjB,KAAM,CACJ,eACA,uBACD,CACF"}
@@ -57,6 +57,10 @@ interface NativeFeeEstimate {
57
57
  /** The native asset used for the fee */
58
58
  readonly asset: NativeAsset;
59
59
  /**
60
+ * @deprecated Use `totalUpfrontFee` instead. The value is the same, but is being renamed for clarity.
61
+ */
62
+ readonly totalFee: bigint;
63
+ /**
60
64
  * Total upfront native amount required in the smallest native units
61
65
  * (e.g., wei for EVM, lamports for Solana, satoshis for Bitcoin).
62
66
  *
@@ -66,9 +70,9 @@ interface NativeFeeEstimate {
66
70
  * both swap and approval fee requirements. In the case of Solana, this includes
67
71
  * execution fees plus any rent that must be funded upfront.
68
72
  */
69
- readonly totalFee: bigint;
73
+ readonly totalUpfrontFee: bigint;
70
74
  /**
71
- * Portion of `totalFee` that is expected to be refunded to the user.
75
+ * Portion of `totalUpfrontFee` that is expected to be refunded to the user.
72
76
  *
73
77
  * For example, in Solana this may include lamports returned when temporary
74
78
  * accounts are closed in the same transaction.
@@ -57,6 +57,10 @@ interface NativeFeeEstimate {
57
57
  /** The native asset used for the fee */
58
58
  readonly asset: NativeAsset;
59
59
  /**
60
+ * @deprecated Use `totalUpfrontFee` instead. The value is the same, but is being renamed for clarity.
61
+ */
62
+ readonly totalFee: bigint;
63
+ /**
60
64
  * Total upfront native amount required in the smallest native units
61
65
  * (e.g., wei for EVM, lamports for Solana, satoshis for Bitcoin).
62
66
  *
@@ -66,9 +70,9 @@ interface NativeFeeEstimate {
66
70
  * both swap and approval fee requirements. In the case of Solana, this includes
67
71
  * execution fees plus any rent that must be funded upfront.
68
72
  */
69
- readonly totalFee: bigint;
73
+ readonly totalUpfrontFee: bigint;
70
74
  /**
71
- * Portion of `totalFee` that is expected to be refunded to the user.
75
+ * Portion of `totalUpfrontFee` that is expected to be refunded to the user.
72
76
  *
73
77
  * For example, in Solana this may include lamports returned when temporary
74
78
  * accounts are closed in the same transaction.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@avalabs/fusion-sdk",
3
3
  "license": "Limited Ecosystem License",
4
- "version": "0.10.0",
4
+ "version": "0.11.0",
5
5
  "type": "module",
6
6
  "main": "./dist/mod.cjs",
7
7
  "module": "./dist/mod.js",