@avalabs/fusion-sdk 0.6.0 → 0.7.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 (91) hide show
  1. package/dist/constants.cjs +1 -1
  2. package/dist/constants.cjs.map +1 -1
  3. package/dist/constants.js +1 -1
  4. package/dist/constants.js.map +1 -1
  5. package/dist/mod.d.cts +3 -3
  6. package/dist/mod.d.ts +3 -3
  7. package/dist/transfer-manager.cjs +1 -1
  8. package/dist/transfer-manager.cjs.map +1 -1
  9. package/dist/transfer-manager.js +1 -1
  10. package/dist/transfer-manager.js.map +1 -1
  11. package/dist/transfer-service/avalanche-evm/_handlers/get-bridgeable-assets.cjs +2 -0
  12. package/dist/transfer-service/avalanche-evm/_handlers/get-bridgeable-assets.cjs.map +1 -0
  13. package/dist/transfer-service/avalanche-evm/_handlers/get-bridgeable-assets.js +2 -0
  14. package/dist/transfer-service/avalanche-evm/_handlers/get-bridgeable-assets.js.map +1 -0
  15. package/dist/transfer-service/avalanche-evm/avalanche-evm-service.cjs +1 -1
  16. package/dist/transfer-service/avalanche-evm/avalanche-evm-service.cjs.map +1 -1
  17. package/dist/transfer-service/avalanche-evm/avalanche-evm-service.js +1 -1
  18. package/dist/transfer-service/avalanche-evm/avalanche-evm-service.js.map +1 -1
  19. package/dist/transfer-service/lombard/_utils/asset.cjs +1 -1
  20. package/dist/transfer-service/lombard/_utils/asset.cjs.map +1 -1
  21. package/dist/transfer-service/lombard/_utils/asset.js +1 -1
  22. package/dist/transfer-service/lombard/_utils/asset.js.map +1 -1
  23. package/dist/transfer-service/lombard/btc-to-btcb/_handlers/get-bridgeable-assets.cjs +2 -0
  24. package/dist/transfer-service/lombard/btc-to-btcb/_handlers/get-bridgeable-assets.cjs.map +1 -0
  25. package/dist/transfer-service/lombard/btc-to-btcb/_handlers/get-bridgeable-assets.js +2 -0
  26. package/dist/transfer-service/lombard/btc-to-btcb/_handlers/get-bridgeable-assets.js.map +1 -0
  27. package/dist/transfer-service/lombard/btc-to-btcb-service.cjs +1 -1
  28. package/dist/transfer-service/lombard/btc-to-btcb-service.cjs.map +1 -1
  29. package/dist/transfer-service/lombard/btc-to-btcb-service.js +1 -1
  30. package/dist/transfer-service/lombard/btc-to-btcb-service.js.map +1 -1
  31. package/dist/transfer-service/lombard/btcb-to-btc/_handlers/get-bridgeable-assets.cjs +2 -0
  32. package/dist/transfer-service/lombard/btcb-to-btc/_handlers/get-bridgeable-assets.cjs.map +1 -0
  33. package/dist/transfer-service/lombard/btcb-to-btc/_handlers/get-bridgeable-assets.js +2 -0
  34. package/dist/transfer-service/lombard/btcb-to-btc/_handlers/get-bridgeable-assets.js.map +1 -0
  35. package/dist/transfer-service/lombard/btcb-to-btc-service.cjs +1 -1
  36. package/dist/transfer-service/lombard/btcb-to-btc-service.cjs.map +1 -1
  37. package/dist/transfer-service/lombard/btcb-to-btc-service.js +1 -1
  38. package/dist/transfer-service/lombard/btcb-to-btc-service.js.map +1 -1
  39. package/dist/transfer-service/lombard/constants.cjs +1 -1
  40. package/dist/transfer-service/lombard/constants.cjs.map +1 -1
  41. package/dist/transfer-service/lombard/constants.js +1 -1
  42. package/dist/transfer-service/lombard/constants.js.map +1 -1
  43. package/dist/transfer-service/markr/_api.cjs +1 -1
  44. package/dist/transfer-service/markr/_api.js +1 -1
  45. package/dist/transfer-service/markr/_handlers/analyze-support.cjs +1 -1
  46. package/dist/transfer-service/markr/_handlers/analyze-support.cjs.map +1 -1
  47. package/dist/transfer-service/markr/_handlers/analyze-support.js +1 -1
  48. package/dist/transfer-service/markr/_handlers/analyze-support.js.map +1 -1
  49. package/dist/transfer-service/markr/_handlers/get-bridgeable-assets.cjs +2 -0
  50. package/dist/transfer-service/markr/_handlers/get-bridgeable-assets.cjs.map +1 -0
  51. package/dist/transfer-service/markr/_handlers/get-bridgeable-assets.js +2 -0
  52. package/dist/transfer-service/markr/_handlers/get-bridgeable-assets.js.map +1 -0
  53. package/dist/transfer-service/markr/_handlers/track-transfer.cjs +1 -1
  54. package/dist/transfer-service/markr/_handlers/track-transfer.cjs.map +1 -1
  55. package/dist/transfer-service/markr/_handlers/track-transfer.js +1 -1
  56. package/dist/transfer-service/markr/_handlers/track-transfer.js.map +1 -1
  57. package/dist/transfer-service/markr/_utils.cjs +1 -1
  58. package/dist/transfer-service/markr/_utils.cjs.map +1 -1
  59. package/dist/transfer-service/markr/_utils.js +1 -1
  60. package/dist/transfer-service/markr/_utils.js.map +1 -1
  61. package/dist/transfer-service/markr/constants.cjs +1 -1
  62. package/dist/transfer-service/markr/constants.cjs.map +1 -1
  63. package/dist/transfer-service/markr/constants.js +1 -1
  64. package/dist/transfer-service/markr/constants.js.map +1 -1
  65. package/dist/transfer-service/markr/markr-service.cjs +1 -1
  66. package/dist/transfer-service/markr/markr-service.cjs.map +1 -1
  67. package/dist/transfer-service/markr/markr-service.js +1 -1
  68. package/dist/transfer-service/markr/markr-service.js.map +1 -1
  69. package/dist/transfer-service/wrap-unwrap/_handlers/get-bridgeable-assets.cjs +2 -0
  70. package/dist/transfer-service/wrap-unwrap/_handlers/get-bridgeable-assets.cjs.map +1 -0
  71. package/dist/transfer-service/wrap-unwrap/_handlers/get-bridgeable-assets.js +2 -0
  72. package/dist/transfer-service/wrap-unwrap/_handlers/get-bridgeable-assets.js.map +1 -0
  73. package/dist/transfer-service/wrap-unwrap/constants.cjs +1 -1
  74. package/dist/transfer-service/wrap-unwrap/constants.cjs.map +1 -1
  75. package/dist/transfer-service/wrap-unwrap/constants.js +1 -1
  76. package/dist/transfer-service/wrap-unwrap/constants.js.map +1 -1
  77. package/dist/transfer-service/wrap-unwrap/wrap-unwrap-service.cjs +1 -1
  78. package/dist/transfer-service/wrap-unwrap/wrap-unwrap-service.cjs.map +1 -1
  79. package/dist/transfer-service/wrap-unwrap/wrap-unwrap-service.js +1 -1
  80. package/dist/transfer-service/wrap-unwrap/wrap-unwrap-service.js.map +1 -1
  81. package/dist/types/asset.d.cts +6 -1
  82. package/dist/types/asset.d.ts +6 -1
  83. package/dist/types/service.d.cts +15 -2
  84. package/dist/types/service.d.ts +15 -2
  85. package/dist/types/transfer-manager.d.cts +17 -1
  86. package/dist/types/transfer-manager.d.ts +17 -1
  87. package/dist/utils/asset-id.cjs +2 -0
  88. package/dist/utils/asset-id.cjs.map +1 -0
  89. package/dist/utils/asset-id.js +2 -0
  90. package/dist/utils/asset-id.js.map +1 -0
  91. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"asset.cjs","names":["BTCB_ADDRESSES","SdkError","ErrorReason","ErrorCode","TokenType"],"sources":["../../../../src/transfer-service/lombard/_utils/asset.ts"],"sourcesContent":["import type { ChainId, Env } from '@lombard.finance/sdk';\nimport { TokenType } from '../../../constants';\nimport { ErrorCode, ErrorReason, SdkError } from '../../../errors';\nimport type { Erc20Asset } from '../../../types/asset';\nimport { BTCB_ADDRESSES } from '../constants';\n\nexport function getBTCbAsset(chainId: ChainId, env: Env): Erc20Asset {\n const address = BTCB_ADDRESSES[env]?.[chainId];\n\n if (!address) {\n throw new SdkError(ErrorReason.CHAIN_NOT_SUPPORTED, ErrorCode.INVALID_PARAMS, {\n details: `No BTCb address configured for env: ${env}, chainId: ${chainId}`,\n });\n }\n\n return {\n type: TokenType.ERC20,\n name: 'Bitcoin',\n symbol: 'BTC.b',\n decimals: 8,\n address,\n };\n}\n"],"mappings":"yGAMA,SAAgB,EAAa,EAAkB,EAAsB,CACnE,IAAM,EAAUA,EAAAA,eAAe,KAAO,GAEtC,GAAI,CAAC,EACH,MAAM,IAAIC,EAAAA,SAASC,EAAAA,YAAY,oBAAqBC,EAAAA,UAAU,eAAgB,CAC5E,QAAS,uCAAuC,EAAI,aAAa,IAClE,CAAC,CAGJ,MAAO,CACL,KAAMC,EAAAA,UAAU,MAChB,KAAM,UACN,OAAQ,QACR,SAAU,EACV,UACD"}
1
+ {"version":3,"file":"asset.cjs","names":["BTCB_ADDRESSES","SdkError","ErrorReason","ErrorCode","TokenType","BTCB_LOGO_URI"],"sources":["../../../../src/transfer-service/lombard/_utils/asset.ts"],"sourcesContent":["import type { ChainId, Env } from '@lombard.finance/sdk';\nimport { TokenType } from '../../../constants';\nimport { ErrorCode, ErrorReason, SdkError } from '../../../errors';\nimport type { Erc20Asset } from '../../../types/asset';\nimport { BTCB_ADDRESSES, BTCB_LOGO_URI } from '../constants';\n\nexport function getBTCbAsset(chainId: ChainId, env: Env): Erc20Asset {\n const address = BTCB_ADDRESSES[env]?.[chainId];\n\n if (!address) {\n throw new SdkError(ErrorReason.CHAIN_NOT_SUPPORTED, ErrorCode.INVALID_PARAMS, {\n details: `No BTCb address configured for env: ${env}, chainId: ${chainId}`,\n });\n }\n\n return {\n type: TokenType.ERC20,\n name: 'Bitcoin',\n symbol: 'BTC.b',\n decimals: 8,\n address,\n logoUri: BTCB_LOGO_URI,\n };\n}\n"],"mappings":"yGAMA,SAAgB,EAAa,EAAkB,EAAsB,CACnE,IAAM,EAAUA,EAAAA,eAAe,KAAO,GAEtC,GAAI,CAAC,EACH,MAAM,IAAIC,EAAAA,SAASC,EAAAA,YAAY,oBAAqBC,EAAAA,UAAU,eAAgB,CAC5E,QAAS,uCAAuC,EAAI,aAAa,IAClE,CAAC,CAGJ,MAAO,CACL,KAAMC,EAAAA,UAAU,MAChB,KAAM,UACN,OAAQ,QACR,SAAU,EACV,UACA,QAASC,EAAAA,cACV"}
@@ -1,2 +1,2 @@
1
- import{TokenType as e}from"../../../constants.js";import{ErrorCode as t,ErrorReason as n,SdkError as r}from"../../../errors.js";import{BTCB_ADDRESSES as i}from"../constants.js";function a(a,o){let s=i[o]?.[a];if(!s)throw new r(n.CHAIN_NOT_SUPPORTED,t.INVALID_PARAMS,{details:`No BTCb address configured for env: ${o}, chainId: ${a}`});return{type:e.ERC20,name:`Bitcoin`,symbol:`BTC.b`,decimals:8,address:s}}export{a as getBTCbAsset};
1
+ import{TokenType as e}from"../../../constants.js";import{ErrorCode as t,ErrorReason as n,SdkError as r}from"../../../errors.js";import{BTCB_ADDRESSES as i,BTCB_LOGO_URI as a}from"../constants.js";function o(o,s){let c=i[s]?.[o];if(!c)throw new r(n.CHAIN_NOT_SUPPORTED,t.INVALID_PARAMS,{details:`No BTCb address configured for env: ${s}, chainId: ${o}`});return{type:e.ERC20,name:`Bitcoin`,symbol:`BTC.b`,decimals:8,address:c,logoUri:a}}export{o as getBTCbAsset};
2
2
  //# sourceMappingURL=asset.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"asset.js","names":[],"sources":["../../../../src/transfer-service/lombard/_utils/asset.ts"],"sourcesContent":["import type { ChainId, Env } from '@lombard.finance/sdk';\nimport { TokenType } from '../../../constants';\nimport { ErrorCode, ErrorReason, SdkError } from '../../../errors';\nimport type { Erc20Asset } from '../../../types/asset';\nimport { BTCB_ADDRESSES } from '../constants';\n\nexport function getBTCbAsset(chainId: ChainId, env: Env): Erc20Asset {\n const address = BTCB_ADDRESSES[env]?.[chainId];\n\n if (!address) {\n throw new SdkError(ErrorReason.CHAIN_NOT_SUPPORTED, ErrorCode.INVALID_PARAMS, {\n details: `No BTCb address configured for env: ${env}, chainId: ${chainId}`,\n });\n }\n\n return {\n type: TokenType.ERC20,\n name: 'Bitcoin',\n symbol: 'BTC.b',\n decimals: 8,\n address,\n };\n}\n"],"mappings":"iLAMA,SAAgB,EAAa,EAAkB,EAAsB,CACnE,IAAM,EAAU,EAAe,KAAO,GAEtC,GAAI,CAAC,EACH,MAAM,IAAI,EAAS,EAAY,oBAAqB,EAAU,eAAgB,CAC5E,QAAS,uCAAuC,EAAI,aAAa,IAClE,CAAC,CAGJ,MAAO,CACL,KAAM,EAAU,MAChB,KAAM,UACN,OAAQ,QACR,SAAU,EACV,UACD"}
1
+ {"version":3,"file":"asset.js","names":[],"sources":["../../../../src/transfer-service/lombard/_utils/asset.ts"],"sourcesContent":["import type { ChainId, Env } from '@lombard.finance/sdk';\nimport { TokenType } from '../../../constants';\nimport { ErrorCode, ErrorReason, SdkError } from '../../../errors';\nimport type { Erc20Asset } from '../../../types/asset';\nimport { BTCB_ADDRESSES, BTCB_LOGO_URI } from '../constants';\n\nexport function getBTCbAsset(chainId: ChainId, env: Env): Erc20Asset {\n const address = BTCB_ADDRESSES[env]?.[chainId];\n\n if (!address) {\n throw new SdkError(ErrorReason.CHAIN_NOT_SUPPORTED, ErrorCode.INVALID_PARAMS, {\n details: `No BTCb address configured for env: ${env}, chainId: ${chainId}`,\n });\n }\n\n return {\n type: TokenType.ERC20,\n name: 'Bitcoin',\n symbol: 'BTC.b',\n decimals: 8,\n address,\n logoUri: BTCB_LOGO_URI,\n };\n}\n"],"mappings":"oMAMA,SAAgB,EAAa,EAAkB,EAAsB,CACnE,IAAM,EAAU,EAAe,KAAO,GAEtC,GAAI,CAAC,EACH,MAAM,IAAI,EAAS,EAAY,oBAAqB,EAAU,eAAgB,CAC5E,QAAS,uCAAuC,EAAI,aAAa,IAClE,CAAC,CAGJ,MAAO,CACL,KAAM,EAAU,MAChB,KAAM,UACN,OAAQ,QACR,SAAU,EACV,UACA,QAAS,EACV"}
@@ -0,0 +1,2 @@
1
+ const e=require(`../../../../constants.cjs`);function t({config:t}){return async({sourceAsset:n,sourceChainId:r,targetChainId:i})=>r!==t.sourceChain||i!==t.targetChain||n.type!==e.TokenType.NATIVE?[]:[{...t.targetAsset,bridgeProviders:[e.ServiceType.LOMBARD_BTC_TO_BTCB]}]}exports.getBridgeableAssetsFactory=t;
2
+ //# sourceMappingURL=get-bridgeable-assets.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-bridgeable-assets.cjs","names":["TokenType","ServiceType"],"sources":["../../../../../src/transfer-service/lombard/btc-to-btcb/_handlers/get-bridgeable-assets.ts"],"sourcesContent":["import { ServiceType, TokenType } from '../../../../constants';\nimport type { GetBridgeableAssetsProps, TransferService } from '../../../../types/service';\nimport type { BridgeableUiAsset } from '../../../../types/asset';\nimport type { BtcToBtcbConfig } from '../../types';\n\nexport function getBridgeableAssetsFactory({\n config,\n}: {\n config: BtcToBtcbConfig;\n}): TransferService['getBridgeableAssets'] {\n return async ({\n sourceAsset,\n sourceChainId,\n targetChainId,\n }: GetBridgeableAssetsProps): Promise<readonly BridgeableUiAsset[]> => {\n if (\n sourceChainId !== config.sourceChain ||\n targetChainId !== config.targetChain ||\n sourceAsset.type !== TokenType.NATIVE\n ) {\n return [];\n }\n return [{ ...config.targetAsset, bridgeProviders: [ServiceType.LOMBARD_BTC_TO_BTCB] }];\n };\n}\n"],"mappings":"6CAKA,SAAgB,EAA2B,CACzC,UAGyC,CACzC,OAAO,MAAO,CACZ,cACA,gBACA,mBAGE,IAAkB,EAAO,aACzB,IAAkB,EAAO,aACzB,EAAY,OAASA,EAAAA,UAAU,OAExB,EAAE,CAEJ,CAAC,CAAE,GAAG,EAAO,YAAa,gBAAiB,CAACC,EAAAA,YAAY,oBAAoB,CAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ import{ServiceType as e,TokenType as t}from"../../../../constants.js";function n({config:n}){return async({sourceAsset:r,sourceChainId:i,targetChainId:a})=>i!==n.sourceChain||a!==n.targetChain||r.type!==t.NATIVE?[]:[{...n.targetAsset,bridgeProviders:[e.LOMBARD_BTC_TO_BTCB]}]}export{n as getBridgeableAssetsFactory};
2
+ //# sourceMappingURL=get-bridgeable-assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-bridgeable-assets.js","names":[],"sources":["../../../../../src/transfer-service/lombard/btc-to-btcb/_handlers/get-bridgeable-assets.ts"],"sourcesContent":["import { ServiceType, TokenType } from '../../../../constants';\nimport type { GetBridgeableAssetsProps, TransferService } from '../../../../types/service';\nimport type { BridgeableUiAsset } from '../../../../types/asset';\nimport type { BtcToBtcbConfig } from '../../types';\n\nexport function getBridgeableAssetsFactory({\n config,\n}: {\n config: BtcToBtcbConfig;\n}): TransferService['getBridgeableAssets'] {\n return async ({\n sourceAsset,\n sourceChainId,\n targetChainId,\n }: GetBridgeableAssetsProps): Promise<readonly BridgeableUiAsset[]> => {\n if (\n sourceChainId !== config.sourceChain ||\n targetChainId !== config.targetChain ||\n sourceAsset.type !== TokenType.NATIVE\n ) {\n return [];\n }\n return [{ ...config.targetAsset, bridgeProviders: [ServiceType.LOMBARD_BTC_TO_BTCB] }];\n };\n}\n"],"mappings":"sEAKA,SAAgB,EAA2B,CACzC,UAGyC,CACzC,OAAO,MAAO,CACZ,cACA,gBACA,mBAGE,IAAkB,EAAO,aACzB,IAAkB,EAAO,aACzB,EAAY,OAAS,EAAU,OAExB,EAAE,CAEJ,CAAC,CAAE,GAAG,EAAO,YAAa,gBAAiB,CAAC,EAAY,oBAAoB,CAAE,CAAC"}
@@ -1,2 +1,2 @@
1
- require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants.cjs`),t=require(`../../utils/caip.cjs`),n=require(`./constants.cjs`),r=require(`./_utils/asset.cjs`),i=require(`./_utils/chain.cjs`),a=require(`./_utils/fee.cjs`),o=require(`./btc-to-btcb/_handlers/get-assets.cjs`),s=require(`./btc-to-btcb/_handlers/analyze-support.cjs`),c=require(`./btc-to-btcb/_handlers/estimate-native-fee.cjs`),l=require(`./btc-to-btcb/_handlers/get-minimum-transfer-amount.cjs`),u=require(`./btc-to-btcb/_handlers/stream-quotes.cjs`),d=require(`./btc-to-btcb/_handlers/track-transfer.cjs`),f=require(`./btc-to-btcb/_handlers/transfer-asset.cjs`);let p=require(`@lombard.finance/sdk`);async function m({bitcoinFunctions:m,btcSigner:h,environment:g,evmSigner:_}){let v=n.ENV_MAP[g],y=v===p.Env.prod?e.BitcoinChainIds.MAINNET:e.BitcoinChainIds.TESTNET,b=v===p.Env.prod?e.AvalancheChainIds.MAINNET:e.AvalancheChainIds.FUJI,x=t.caip2ToEip155ChainId(b),S=p.Token.BTCb;i.assertSupportedChainId(x);let C={environment:g,env:v,sourceChain:y,targetChain:b,targetChainId:x,targetAsset:r.getBTCbAsset(x,v),targetToken:S,mintingFee:(await a.getFees(S,x,v)).mintingFee};return{analyzeSupport:s.analyzeSupportFactory({config:C}),estimateNativeFee:c.estimateNativeFeeFactory({bitcoinFunctions:m,config:C}),getAssets:o.getAssetsFactory({config:C}),getMinimumTransferAmount:async()=>l.getMinimumTransferAmount(),getSupportedChains:async()=>new Map([[y,new Set([b])]]),streamQuotes:u.streamQuotesFactory({config:C}),trackTransfer:d.trackTransferFactory({bitcoinFunctions:m,config:C}),transferAsset:f.transferAssetFactory({bitcoinFunctions:m,btcSigner:h,config:C,evmSigner:_}),type:e.ServiceType.LOMBARD_BTC_TO_BTCB}}exports.createBtcToBtcbService=m;
1
+ require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants.cjs`),t=require(`../../utils/caip.cjs`),n=require(`./constants.cjs`),r=require(`./_utils/asset.cjs`),i=require(`./_utils/chain.cjs`),a=require(`./_utils/fee.cjs`),o=require(`./btc-to-btcb/_handlers/get-assets.cjs`),s=require(`./btc-to-btcb/_handlers/analyze-support.cjs`),c=require(`./btc-to-btcb/_handlers/estimate-native-fee.cjs`),l=require(`./btc-to-btcb/_handlers/get-minimum-transfer-amount.cjs`),u=require(`./btc-to-btcb/_handlers/stream-quotes.cjs`),d=require(`./btc-to-btcb/_handlers/track-transfer.cjs`),f=require(`./btc-to-btcb/_handlers/transfer-asset.cjs`),p=require(`./btc-to-btcb/_handlers/get-bridgeable-assets.cjs`);let m=require(`@lombard.finance/sdk`);async function h({bitcoinFunctions:h,btcSigner:g,environment:_,evmSigner:v}){let y=n.ENV_MAP[_],b=y===m.Env.prod?e.BitcoinChainIds.MAINNET:e.BitcoinChainIds.TESTNET,x=y===m.Env.prod?e.AvalancheChainIds.MAINNET:e.AvalancheChainIds.FUJI,S=t.caip2ToEip155ChainId(x),C=m.Token.BTCb;i.assertSupportedChainId(S);let w={environment:_,env:y,sourceChain:b,targetChain:x,targetChainId:S,targetAsset:r.getBTCbAsset(S,y),targetToken:C,mintingFee:(await a.getFees(C,S,y)).mintingFee};return{analyzeSupport:s.analyzeSupportFactory({config:w}),estimateNativeFee:c.estimateNativeFeeFactory({bitcoinFunctions:h,config:w}),getAssets:o.getAssetsFactory({config:w}),getBridgeableAssets:p.getBridgeableAssetsFactory({config:w}),getMinimumTransferAmount:async()=>l.getMinimumTransferAmount(),getSupportedChains:async()=>new Map([[b,new Set([x])]]),streamQuotes:u.streamQuotesFactory({config:w}),trackTransfer:d.trackTransferFactory({bitcoinFunctions:h,config:w}),transferAsset:f.transferAssetFactory({bitcoinFunctions:h,btcSigner:g,config:w,evmSigner:v}),type:e.ServiceType.LOMBARD_BTC_TO_BTCB}}exports.createBtcToBtcbService=h;
2
2
  //# sourceMappingURL=btc-to-btcb-service.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"btc-to-btcb-service.cjs","names":["ENV_MAP","Env","BitcoinChainIds","AvalancheChainIds","caip2ToEip155ChainId","Token","getBTCbAsset","getFees","analyzeSupportFactory","estimateNativeFeeFactory","getAssetsFactory","getMinimumTransferAmount","streamQuotesFactory","trackTransferFactory","transferAssetFactory","ServiceType"],"sources":["../../../src/transfer-service/lombard/btc-to-btcb-service.ts"],"sourcesContent":["import { Env, Token } from '@lombard.finance/sdk';\nimport { AvalancheChainIds, BitcoinChainIds, ServiceType } from '../../constants';\nimport type { Environment } from '../../constants';\nimport { caip2ToEip155ChainId } from '../../utils/caip';\nimport type { BitcoinFunctions } from '../../types/bitcoin';\nimport type { TransferService } from '../../types/service';\nimport type { BtcSigner, EvmSignerWithMessage } from '../../types/signer';\nimport { ENV_MAP } from './constants';\nimport { getBTCbAsset } from './_utils/asset';\nimport { assertSupportedChainId } from './_utils/chain';\nimport type { BtcToBtcbConfig } from './types';\nimport { getFees } from './_utils/fee';\nimport { getAssetsFactory } from './btc-to-btcb/_handlers/get-assets';\nimport { analyzeSupportFactory } from './btc-to-btcb/_handlers/analyze-support';\nimport { estimateNativeFeeFactory } from './btc-to-btcb/_handlers/estimate-native-fee';\nimport { getMinimumTransferAmount } from './btc-to-btcb/_handlers/get-minimum-transfer-amount';\nimport { streamQuotesFactory } from './btc-to-btcb/_handlers/stream-quotes';\nimport { trackTransferFactory } from './btc-to-btcb/_handlers/track-transfer';\nimport { transferAssetFactory } from './btc-to-btcb/_handlers/transfer-asset';\nimport type { Fetch } from '../../types/utility-types';\n\nexport interface BtcToBtcbServiceOptions {\n bitcoinFunctions: BitcoinFunctions;\n btcSigner: BtcSigner;\n environment: Environment;\n evmSigner: EvmSignerWithMessage;\n fetch?: Fetch;\n}\n\nexport async function createBtcToBtcbService({\n bitcoinFunctions,\n btcSigner,\n environment,\n evmSigner,\n}: BtcToBtcbServiceOptions): Promise<TransferService> {\n const env = ENV_MAP[environment];\n\n const sourceChain = env === Env.prod ? BitcoinChainIds.MAINNET : BitcoinChainIds.TESTNET;\n const targetChain = env === Env.prod ? AvalancheChainIds.MAINNET : AvalancheChainIds.FUJI;\n const targetChainId = caip2ToEip155ChainId(targetChain);\n const targetToken = Token.BTCb;\n\n assertSupportedChainId(targetChainId);\n\n const targetAsset = getBTCbAsset(targetChainId, env);\n\n const fees = await getFees(targetToken, targetChainId, env);\n\n const config: BtcToBtcbConfig = {\n environment,\n env,\n sourceChain,\n targetChain,\n targetChainId,\n targetAsset,\n targetToken,\n mintingFee: fees.mintingFee,\n };\n\n return {\n analyzeSupport: analyzeSupportFactory({ config }),\n estimateNativeFee: estimateNativeFeeFactory({ bitcoinFunctions, config }),\n getAssets: getAssetsFactory({ config }),\n getMinimumTransferAmount: async () => {\n return getMinimumTransferAmount();\n },\n getSupportedChains: async () => {\n return new Map([[sourceChain, new Set([targetChain])]]);\n },\n streamQuotes: streamQuotesFactory({ config }),\n trackTransfer: trackTransferFactory({ bitcoinFunctions, config }),\n transferAsset: transferAssetFactory({ bitcoinFunctions, btcSigner, config, evmSigner }),\n type: ServiceType.LOMBARD_BTC_TO_BTCB,\n } satisfies TransferService;\n}\n"],"mappings":"grBA6BA,eAAsB,EAAuB,CAC3C,mBACA,YACA,cACA,aACoD,CACpD,IAAM,EAAMA,EAAAA,QAAQ,GAEd,EAAc,IAAQC,EAAAA,IAAI,KAAOC,EAAAA,gBAAgB,QAAUA,EAAAA,gBAAgB,QAC3E,EAAc,IAAQD,EAAAA,IAAI,KAAOE,EAAAA,kBAAkB,QAAUA,EAAAA,kBAAkB,KAC/E,EAAgBC,EAAAA,qBAAqB,EAAY,CACjD,EAAcC,EAAAA,MAAM,KAE1B,EAAA,uBAAuB,EAAc,CAMrC,IAAM,EAA0B,CAC9B,cACA,MACA,cACA,cACA,gBACA,YAVkBC,EAAAA,aAAa,EAAe,EAAI,CAWlD,cACA,YAVW,MAAMC,EAAAA,QAAQ,EAAa,EAAe,EAAI,EAUxC,WAClB,CAED,MAAO,CACL,eAAgBC,EAAAA,sBAAsB,CAAE,SAAQ,CAAC,CACjD,kBAAmBC,EAAAA,yBAAyB,CAAE,mBAAkB,SAAQ,CAAC,CACzE,UAAWC,EAAAA,iBAAiB,CAAE,SAAQ,CAAC,CACvC,yBAA0B,SACjBC,EAAAA,0BAA0B,CAEnC,mBAAoB,SACX,IAAI,IAAI,CAAC,CAAC,EAAa,IAAI,IAAI,CAAC,EAAY,CAAC,CAAC,CAAC,CAAC,CAEzD,aAAcC,EAAAA,oBAAoB,CAAE,SAAQ,CAAC,CAC7C,cAAeC,EAAAA,qBAAqB,CAAE,mBAAkB,SAAQ,CAAC,CACjE,cAAeC,EAAAA,qBAAqB,CAAE,mBAAkB,YAAW,SAAQ,YAAW,CAAC,CACvF,KAAMC,EAAAA,YAAY,oBACnB"}
1
+ {"version":3,"file":"btc-to-btcb-service.cjs","names":["ENV_MAP","Env","BitcoinChainIds","AvalancheChainIds","caip2ToEip155ChainId","Token","getBTCbAsset","getFees","analyzeSupportFactory","estimateNativeFeeFactory","getAssetsFactory","getBridgeableAssetsFactory","getMinimumTransferAmount","streamQuotesFactory","trackTransferFactory","transferAssetFactory","ServiceType"],"sources":["../../../src/transfer-service/lombard/btc-to-btcb-service.ts"],"sourcesContent":["import { Env, Token } from '@lombard.finance/sdk';\nimport { AvalancheChainIds, BitcoinChainIds, ServiceType } from '../../constants';\nimport type { Environment } from '../../constants';\nimport { caip2ToEip155ChainId } from '../../utils/caip';\nimport type { BitcoinFunctions } from '../../types/bitcoin';\nimport type { TransferService } from '../../types/service';\nimport type { BtcSigner, EvmSignerWithMessage } from '../../types/signer';\nimport { ENV_MAP } from './constants';\nimport { getBTCbAsset } from './_utils/asset';\nimport { assertSupportedChainId } from './_utils/chain';\nimport type { BtcToBtcbConfig } from './types';\nimport { getFees } from './_utils/fee';\nimport { getAssetsFactory } from './btc-to-btcb/_handlers/get-assets';\nimport { analyzeSupportFactory } from './btc-to-btcb/_handlers/analyze-support';\nimport { estimateNativeFeeFactory } from './btc-to-btcb/_handlers/estimate-native-fee';\nimport { getMinimumTransferAmount } from './btc-to-btcb/_handlers/get-minimum-transfer-amount';\nimport { streamQuotesFactory } from './btc-to-btcb/_handlers/stream-quotes';\nimport { trackTransferFactory } from './btc-to-btcb/_handlers/track-transfer';\nimport { transferAssetFactory } from './btc-to-btcb/_handlers/transfer-asset';\nimport { getBridgeableAssetsFactory } from './btc-to-btcb/_handlers/get-bridgeable-assets';\nimport type { Fetch } from '../../types/utility-types';\n\nexport interface BtcToBtcbServiceOptions {\n bitcoinFunctions: BitcoinFunctions;\n btcSigner: BtcSigner;\n environment: Environment;\n evmSigner: EvmSignerWithMessage;\n fetch?: Fetch;\n}\n\nexport async function createBtcToBtcbService({\n bitcoinFunctions,\n btcSigner,\n environment,\n evmSigner,\n}: BtcToBtcbServiceOptions): Promise<TransferService> {\n const env = ENV_MAP[environment];\n\n const sourceChain = env === Env.prod ? BitcoinChainIds.MAINNET : BitcoinChainIds.TESTNET;\n const targetChain = env === Env.prod ? AvalancheChainIds.MAINNET : AvalancheChainIds.FUJI;\n const targetChainId = caip2ToEip155ChainId(targetChain);\n const targetToken = Token.BTCb;\n\n assertSupportedChainId(targetChainId);\n\n const targetAsset = getBTCbAsset(targetChainId, env);\n\n const fees = await getFees(targetToken, targetChainId, env);\n\n const config: BtcToBtcbConfig = {\n environment,\n env,\n sourceChain,\n targetChain,\n targetChainId,\n targetAsset,\n targetToken,\n mintingFee: fees.mintingFee,\n };\n\n return {\n analyzeSupport: analyzeSupportFactory({ config }),\n estimateNativeFee: estimateNativeFeeFactory({ bitcoinFunctions, config }),\n getAssets: getAssetsFactory({ config }),\n getBridgeableAssets: getBridgeableAssetsFactory({ config }),\n getMinimumTransferAmount: async () => {\n return getMinimumTransferAmount();\n },\n getSupportedChains: async () => {\n return new Map([[sourceChain, new Set([targetChain])]]);\n },\n streamQuotes: streamQuotesFactory({ config }),\n trackTransfer: trackTransferFactory({ bitcoinFunctions, config }),\n transferAsset: transferAssetFactory({ bitcoinFunctions, btcSigner, config, evmSigner }),\n type: ServiceType.LOMBARD_BTC_TO_BTCB,\n } satisfies TransferService;\n}\n"],"mappings":"+uBA8BA,eAAsB,EAAuB,CAC3C,mBACA,YACA,cACA,aACoD,CACpD,IAAM,EAAMA,EAAAA,QAAQ,GAEd,EAAc,IAAQC,EAAAA,IAAI,KAAOC,EAAAA,gBAAgB,QAAUA,EAAAA,gBAAgB,QAC3E,EAAc,IAAQD,EAAAA,IAAI,KAAOE,EAAAA,kBAAkB,QAAUA,EAAAA,kBAAkB,KAC/E,EAAgBC,EAAAA,qBAAqB,EAAY,CACjD,EAAcC,EAAAA,MAAM,KAE1B,EAAA,uBAAuB,EAAc,CAMrC,IAAM,EAA0B,CAC9B,cACA,MACA,cACA,cACA,gBACA,YAVkBC,EAAAA,aAAa,EAAe,EAAI,CAWlD,cACA,YAVW,MAAMC,EAAAA,QAAQ,EAAa,EAAe,EAAI,EAUxC,WAClB,CAED,MAAO,CACL,eAAgBC,EAAAA,sBAAsB,CAAE,SAAQ,CAAC,CACjD,kBAAmBC,EAAAA,yBAAyB,CAAE,mBAAkB,SAAQ,CAAC,CACzE,UAAWC,EAAAA,iBAAiB,CAAE,SAAQ,CAAC,CACvC,oBAAqBC,EAAAA,2BAA2B,CAAE,SAAQ,CAAC,CAC3D,yBAA0B,SACjBC,EAAAA,0BAA0B,CAEnC,mBAAoB,SACX,IAAI,IAAI,CAAC,CAAC,EAAa,IAAI,IAAI,CAAC,EAAY,CAAC,CAAC,CAAC,CAAC,CAEzD,aAAcC,EAAAA,oBAAoB,CAAE,SAAQ,CAAC,CAC7C,cAAeC,EAAAA,qBAAqB,CAAE,mBAAkB,SAAQ,CAAC,CACjE,cAAeC,EAAAA,qBAAqB,CAAE,mBAAkB,YAAW,SAAQ,YAAW,CAAC,CACvF,KAAMC,EAAAA,YAAY,oBACnB"}
@@ -1,2 +1,2 @@
1
- import{AvalancheChainIds as e,BitcoinChainIds as t,ServiceType as n}from"../../constants.js";import{caip2ToEip155ChainId as r}from"../../utils/caip.js";import{ENV_MAP as i}from"./constants.js";import{getBTCbAsset as a}from"./_utils/asset.js";import{assertSupportedChainId as o}from"./_utils/chain.js";import{getFees as s}from"./_utils/fee.js";import{getAssetsFactory as c}from"./btc-to-btcb/_handlers/get-assets.js";import{analyzeSupportFactory as l}from"./btc-to-btcb/_handlers/analyze-support.js";import{estimateNativeFeeFactory as u}from"./btc-to-btcb/_handlers/estimate-native-fee.js";import{getMinimumTransferAmount as d}from"./btc-to-btcb/_handlers/get-minimum-transfer-amount.js";import{streamQuotesFactory as f}from"./btc-to-btcb/_handlers/stream-quotes.js";import{trackTransferFactory as p}from"./btc-to-btcb/_handlers/track-transfer.js";import{transferAssetFactory as m}from"./btc-to-btcb/_handlers/transfer-asset.js";import{Env as h,Token as g}from"@lombard.finance/sdk";async function _({bitcoinFunctions:_,btcSigner:v,environment:y,evmSigner:b}){let x=i[y],S=x===h.prod?t.MAINNET:t.TESTNET,C=x===h.prod?e.MAINNET:e.FUJI,w=r(C),T=g.BTCb;o(w);let E={environment:y,env:x,sourceChain:S,targetChain:C,targetChainId:w,targetAsset:a(w,x),targetToken:T,mintingFee:(await s(T,w,x)).mintingFee};return{analyzeSupport:l({config:E}),estimateNativeFee:u({bitcoinFunctions:_,config:E}),getAssets:c({config:E}),getMinimumTransferAmount:async()=>d(),getSupportedChains:async()=>new Map([[S,new Set([C])]]),streamQuotes:f({config:E}),trackTransfer:p({bitcoinFunctions:_,config:E}),transferAsset:m({bitcoinFunctions:_,btcSigner:v,config:E,evmSigner:b}),type:n.LOMBARD_BTC_TO_BTCB}}export{_ as createBtcToBtcbService};
1
+ import{AvalancheChainIds as e,BitcoinChainIds as t,ServiceType as n}from"../../constants.js";import{caip2ToEip155ChainId as r}from"../../utils/caip.js";import{ENV_MAP as i}from"./constants.js";import{getBTCbAsset as a}from"./_utils/asset.js";import{assertSupportedChainId as o}from"./_utils/chain.js";import{getFees as s}from"./_utils/fee.js";import{getAssetsFactory as c}from"./btc-to-btcb/_handlers/get-assets.js";import{analyzeSupportFactory as l}from"./btc-to-btcb/_handlers/analyze-support.js";import{estimateNativeFeeFactory as u}from"./btc-to-btcb/_handlers/estimate-native-fee.js";import{getMinimumTransferAmount as d}from"./btc-to-btcb/_handlers/get-minimum-transfer-amount.js";import{streamQuotesFactory as f}from"./btc-to-btcb/_handlers/stream-quotes.js";import{trackTransferFactory as p}from"./btc-to-btcb/_handlers/track-transfer.js";import{transferAssetFactory as m}from"./btc-to-btcb/_handlers/transfer-asset.js";import{getBridgeableAssetsFactory as h}from"./btc-to-btcb/_handlers/get-bridgeable-assets.js";import{Env as g,Token as _}from"@lombard.finance/sdk";async function v({bitcoinFunctions:v,btcSigner:y,environment:b,evmSigner:x}){let S=i[b],C=S===g.prod?t.MAINNET:t.TESTNET,w=S===g.prod?e.MAINNET:e.FUJI,T=r(w),E=_.BTCb;o(T);let D={environment:b,env:S,sourceChain:C,targetChain:w,targetChainId:T,targetAsset:a(T,S),targetToken:E,mintingFee:(await s(E,T,S)).mintingFee};return{analyzeSupport:l({config:D}),estimateNativeFee:u({bitcoinFunctions:v,config:D}),getAssets:c({config:D}),getBridgeableAssets:h({config:D}),getMinimumTransferAmount:async()=>d(),getSupportedChains:async()=>new Map([[C,new Set([w])]]),streamQuotes:f({config:D}),trackTransfer:p({bitcoinFunctions:v,config:D}),transferAsset:m({bitcoinFunctions:v,btcSigner:y,config:D,evmSigner:x}),type:n.LOMBARD_BTC_TO_BTCB}}export{v as createBtcToBtcbService};
2
2
  //# sourceMappingURL=btc-to-btcb-service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"btc-to-btcb-service.js","names":[],"sources":["../../../src/transfer-service/lombard/btc-to-btcb-service.ts"],"sourcesContent":["import { Env, Token } from '@lombard.finance/sdk';\nimport { AvalancheChainIds, BitcoinChainIds, ServiceType } from '../../constants';\nimport type { Environment } from '../../constants';\nimport { caip2ToEip155ChainId } from '../../utils/caip';\nimport type { BitcoinFunctions } from '../../types/bitcoin';\nimport type { TransferService } from '../../types/service';\nimport type { BtcSigner, EvmSignerWithMessage } from '../../types/signer';\nimport { ENV_MAP } from './constants';\nimport { getBTCbAsset } from './_utils/asset';\nimport { assertSupportedChainId } from './_utils/chain';\nimport type { BtcToBtcbConfig } from './types';\nimport { getFees } from './_utils/fee';\nimport { getAssetsFactory } from './btc-to-btcb/_handlers/get-assets';\nimport { analyzeSupportFactory } from './btc-to-btcb/_handlers/analyze-support';\nimport { estimateNativeFeeFactory } from './btc-to-btcb/_handlers/estimate-native-fee';\nimport { getMinimumTransferAmount } from './btc-to-btcb/_handlers/get-minimum-transfer-amount';\nimport { streamQuotesFactory } from './btc-to-btcb/_handlers/stream-quotes';\nimport { trackTransferFactory } from './btc-to-btcb/_handlers/track-transfer';\nimport { transferAssetFactory } from './btc-to-btcb/_handlers/transfer-asset';\nimport type { Fetch } from '../../types/utility-types';\n\nexport interface BtcToBtcbServiceOptions {\n bitcoinFunctions: BitcoinFunctions;\n btcSigner: BtcSigner;\n environment: Environment;\n evmSigner: EvmSignerWithMessage;\n fetch?: Fetch;\n}\n\nexport async function createBtcToBtcbService({\n bitcoinFunctions,\n btcSigner,\n environment,\n evmSigner,\n}: BtcToBtcbServiceOptions): Promise<TransferService> {\n const env = ENV_MAP[environment];\n\n const sourceChain = env === Env.prod ? BitcoinChainIds.MAINNET : BitcoinChainIds.TESTNET;\n const targetChain = env === Env.prod ? AvalancheChainIds.MAINNET : AvalancheChainIds.FUJI;\n const targetChainId = caip2ToEip155ChainId(targetChain);\n const targetToken = Token.BTCb;\n\n assertSupportedChainId(targetChainId);\n\n const targetAsset = getBTCbAsset(targetChainId, env);\n\n const fees = await getFees(targetToken, targetChainId, env);\n\n const config: BtcToBtcbConfig = {\n environment,\n env,\n sourceChain,\n targetChain,\n targetChainId,\n targetAsset,\n targetToken,\n mintingFee: fees.mintingFee,\n };\n\n return {\n analyzeSupport: analyzeSupportFactory({ config }),\n estimateNativeFee: estimateNativeFeeFactory({ bitcoinFunctions, config }),\n getAssets: getAssetsFactory({ config }),\n getMinimumTransferAmount: async () => {\n return getMinimumTransferAmount();\n },\n getSupportedChains: async () => {\n return new Map([[sourceChain, new Set([targetChain])]]);\n },\n streamQuotes: streamQuotesFactory({ config }),\n trackTransfer: trackTransferFactory({ bitcoinFunctions, config }),\n transferAsset: transferAssetFactory({ bitcoinFunctions, btcSigner, config, evmSigner }),\n type: ServiceType.LOMBARD_BTC_TO_BTCB,\n } satisfies TransferService;\n}\n"],"mappings":"s9BA6BA,eAAsB,EAAuB,CAC3C,mBACA,YACA,cACA,aACoD,CACpD,IAAM,EAAM,EAAQ,GAEd,EAAc,IAAQ,EAAI,KAAO,EAAgB,QAAU,EAAgB,QAC3E,EAAc,IAAQ,EAAI,KAAO,EAAkB,QAAU,EAAkB,KAC/E,EAAgB,EAAqB,EAAY,CACjD,EAAc,EAAM,KAE1B,EAAuB,EAAc,CAMrC,IAAM,EAA0B,CAC9B,cACA,MACA,cACA,cACA,gBACA,YAVkB,EAAa,EAAe,EAAI,CAWlD,cACA,YAVW,MAAM,EAAQ,EAAa,EAAe,EAAI,EAUxC,WAClB,CAED,MAAO,CACL,eAAgB,EAAsB,CAAE,SAAQ,CAAC,CACjD,kBAAmB,EAAyB,CAAE,mBAAkB,SAAQ,CAAC,CACzE,UAAW,EAAiB,CAAE,SAAQ,CAAC,CACvC,yBAA0B,SACjB,GAA0B,CAEnC,mBAAoB,SACX,IAAI,IAAI,CAAC,CAAC,EAAa,IAAI,IAAI,CAAC,EAAY,CAAC,CAAC,CAAC,CAAC,CAEzD,aAAc,EAAoB,CAAE,SAAQ,CAAC,CAC7C,cAAe,EAAqB,CAAE,mBAAkB,SAAQ,CAAC,CACjE,cAAe,EAAqB,CAAE,mBAAkB,YAAW,SAAQ,YAAW,CAAC,CACvF,KAAM,EAAY,oBACnB"}
1
+ {"version":3,"file":"btc-to-btcb-service.js","names":[],"sources":["../../../src/transfer-service/lombard/btc-to-btcb-service.ts"],"sourcesContent":["import { Env, Token } from '@lombard.finance/sdk';\nimport { AvalancheChainIds, BitcoinChainIds, ServiceType } from '../../constants';\nimport type { Environment } from '../../constants';\nimport { caip2ToEip155ChainId } from '../../utils/caip';\nimport type { BitcoinFunctions } from '../../types/bitcoin';\nimport type { TransferService } from '../../types/service';\nimport type { BtcSigner, EvmSignerWithMessage } from '../../types/signer';\nimport { ENV_MAP } from './constants';\nimport { getBTCbAsset } from './_utils/asset';\nimport { assertSupportedChainId } from './_utils/chain';\nimport type { BtcToBtcbConfig } from './types';\nimport { getFees } from './_utils/fee';\nimport { getAssetsFactory } from './btc-to-btcb/_handlers/get-assets';\nimport { analyzeSupportFactory } from './btc-to-btcb/_handlers/analyze-support';\nimport { estimateNativeFeeFactory } from './btc-to-btcb/_handlers/estimate-native-fee';\nimport { getMinimumTransferAmount } from './btc-to-btcb/_handlers/get-minimum-transfer-amount';\nimport { streamQuotesFactory } from './btc-to-btcb/_handlers/stream-quotes';\nimport { trackTransferFactory } from './btc-to-btcb/_handlers/track-transfer';\nimport { transferAssetFactory } from './btc-to-btcb/_handlers/transfer-asset';\nimport { getBridgeableAssetsFactory } from './btc-to-btcb/_handlers/get-bridgeable-assets';\nimport type { Fetch } from '../../types/utility-types';\n\nexport interface BtcToBtcbServiceOptions {\n bitcoinFunctions: BitcoinFunctions;\n btcSigner: BtcSigner;\n environment: Environment;\n evmSigner: EvmSignerWithMessage;\n fetch?: Fetch;\n}\n\nexport async function createBtcToBtcbService({\n bitcoinFunctions,\n btcSigner,\n environment,\n evmSigner,\n}: BtcToBtcbServiceOptions): Promise<TransferService> {\n const env = ENV_MAP[environment];\n\n const sourceChain = env === Env.prod ? BitcoinChainIds.MAINNET : BitcoinChainIds.TESTNET;\n const targetChain = env === Env.prod ? AvalancheChainIds.MAINNET : AvalancheChainIds.FUJI;\n const targetChainId = caip2ToEip155ChainId(targetChain);\n const targetToken = Token.BTCb;\n\n assertSupportedChainId(targetChainId);\n\n const targetAsset = getBTCbAsset(targetChainId, env);\n\n const fees = await getFees(targetToken, targetChainId, env);\n\n const config: BtcToBtcbConfig = {\n environment,\n env,\n sourceChain,\n targetChain,\n targetChainId,\n targetAsset,\n targetToken,\n mintingFee: fees.mintingFee,\n };\n\n return {\n analyzeSupport: analyzeSupportFactory({ config }),\n estimateNativeFee: estimateNativeFeeFactory({ bitcoinFunctions, config }),\n getAssets: getAssetsFactory({ config }),\n getBridgeableAssets: getBridgeableAssetsFactory({ config }),\n getMinimumTransferAmount: async () => {\n return getMinimumTransferAmount();\n },\n getSupportedChains: async () => {\n return new Map([[sourceChain, new Set([targetChain])]]);\n },\n streamQuotes: streamQuotesFactory({ config }),\n trackTransfer: trackTransferFactory({ bitcoinFunctions, config }),\n transferAsset: transferAssetFactory({ bitcoinFunctions, btcSigner, config, evmSigner }),\n type: ServiceType.LOMBARD_BTC_TO_BTCB,\n } satisfies TransferService;\n}\n"],"mappings":"ojCA8BA,eAAsB,EAAuB,CAC3C,mBACA,YACA,cACA,aACoD,CACpD,IAAM,EAAM,EAAQ,GAEd,EAAc,IAAQ,EAAI,KAAO,EAAgB,QAAU,EAAgB,QAC3E,EAAc,IAAQ,EAAI,KAAO,EAAkB,QAAU,EAAkB,KAC/E,EAAgB,EAAqB,EAAY,CACjD,EAAc,EAAM,KAE1B,EAAuB,EAAc,CAMrC,IAAM,EAA0B,CAC9B,cACA,MACA,cACA,cACA,gBACA,YAVkB,EAAa,EAAe,EAAI,CAWlD,cACA,YAVW,MAAM,EAAQ,EAAa,EAAe,EAAI,EAUxC,WAClB,CAED,MAAO,CACL,eAAgB,EAAsB,CAAE,SAAQ,CAAC,CACjD,kBAAmB,EAAyB,CAAE,mBAAkB,SAAQ,CAAC,CACzE,UAAW,EAAiB,CAAE,SAAQ,CAAC,CACvC,oBAAqB,EAA2B,CAAE,SAAQ,CAAC,CAC3D,yBAA0B,SACjB,GAA0B,CAEnC,mBAAoB,SACX,IAAI,IAAI,CAAC,CAAC,EAAa,IAAI,IAAI,CAAC,EAAY,CAAC,CAAC,CAAC,CAAC,CAEzD,aAAc,EAAoB,CAAE,SAAQ,CAAC,CAC7C,cAAe,EAAqB,CAAE,mBAAkB,SAAQ,CAAC,CACjE,cAAe,EAAqB,CAAE,mBAAkB,YAAW,SAAQ,YAAW,CAAC,CACvF,KAAM,EAAY,oBACnB"}
@@ -0,0 +1,2 @@
1
+ const e=require(`../../../../constants.cjs`);function t({config:t}){return async({sourceAsset:n,sourceChainId:r,targetChainId:i})=>r!==t.sourceChain||i!==t.targetChain||n.type!==e.TokenType.ERC20||n.address.toLowerCase()!==t.sourceAsset.address.toLowerCase()?[]:[{...t.targetAsset,bridgeProviders:[e.ServiceType.LOMBARD_BTCB_TO_BTC]}]}exports.getBridgeableAssetsFactory=t;
2
+ //# sourceMappingURL=get-bridgeable-assets.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-bridgeable-assets.cjs","names":["TokenType","ServiceType"],"sources":["../../../../../src/transfer-service/lombard/btcb-to-btc/_handlers/get-bridgeable-assets.ts"],"sourcesContent":["import { ServiceType, TokenType } from '../../../../constants';\nimport type { GetBridgeableAssetsProps, TransferService } from '../../../../types/service';\nimport type { BridgeableUiAsset } from '../../../../types/asset';\nimport type { BtcbToBtcConfig } from '../../types';\n\nexport function getBridgeableAssetsFactory({\n config,\n}: {\n config: BtcbToBtcConfig;\n}): TransferService['getBridgeableAssets'] {\n return async ({\n sourceAsset,\n sourceChainId,\n targetChainId,\n }: GetBridgeableAssetsProps): Promise<readonly BridgeableUiAsset[]> => {\n if (\n sourceChainId !== config.sourceChain ||\n targetChainId !== config.targetChain ||\n sourceAsset.type !== TokenType.ERC20 ||\n sourceAsset.address.toLowerCase() !== config.sourceAsset.address.toLowerCase()\n ) {\n return [];\n }\n return [{ ...config.targetAsset, bridgeProviders: [ServiceType.LOMBARD_BTCB_TO_BTC] }];\n };\n}\n"],"mappings":"6CAKA,SAAgB,EAA2B,CACzC,UAGyC,CACzC,OAAO,MAAO,CACZ,cACA,gBACA,mBAGE,IAAkB,EAAO,aACzB,IAAkB,EAAO,aACzB,EAAY,OAASA,EAAAA,UAAU,OAC/B,EAAY,QAAQ,aAAa,GAAK,EAAO,YAAY,QAAQ,aAAa,CAEvE,EAAE,CAEJ,CAAC,CAAE,GAAG,EAAO,YAAa,gBAAiB,CAACC,EAAAA,YAAY,oBAAoB,CAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ import{ServiceType as e,TokenType as t}from"../../../../constants.js";function n({config:n}){return async({sourceAsset:r,sourceChainId:i,targetChainId:a})=>i!==n.sourceChain||a!==n.targetChain||r.type!==t.ERC20||r.address.toLowerCase()!==n.sourceAsset.address.toLowerCase()?[]:[{...n.targetAsset,bridgeProviders:[e.LOMBARD_BTCB_TO_BTC]}]}export{n as getBridgeableAssetsFactory};
2
+ //# sourceMappingURL=get-bridgeable-assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-bridgeable-assets.js","names":[],"sources":["../../../../../src/transfer-service/lombard/btcb-to-btc/_handlers/get-bridgeable-assets.ts"],"sourcesContent":["import { ServiceType, TokenType } from '../../../../constants';\nimport type { GetBridgeableAssetsProps, TransferService } from '../../../../types/service';\nimport type { BridgeableUiAsset } from '../../../../types/asset';\nimport type { BtcbToBtcConfig } from '../../types';\n\nexport function getBridgeableAssetsFactory({\n config,\n}: {\n config: BtcbToBtcConfig;\n}): TransferService['getBridgeableAssets'] {\n return async ({\n sourceAsset,\n sourceChainId,\n targetChainId,\n }: GetBridgeableAssetsProps): Promise<readonly BridgeableUiAsset[]> => {\n if (\n sourceChainId !== config.sourceChain ||\n targetChainId !== config.targetChain ||\n sourceAsset.type !== TokenType.ERC20 ||\n sourceAsset.address.toLowerCase() !== config.sourceAsset.address.toLowerCase()\n ) {\n return [];\n }\n return [{ ...config.targetAsset, bridgeProviders: [ServiceType.LOMBARD_BTCB_TO_BTC] }];\n };\n}\n"],"mappings":"sEAKA,SAAgB,EAA2B,CACzC,UAGyC,CACzC,OAAO,MAAO,CACZ,cACA,gBACA,mBAGE,IAAkB,EAAO,aACzB,IAAkB,EAAO,aACzB,EAAY,OAAS,EAAU,OAC/B,EAAY,QAAQ,aAAa,GAAK,EAAO,YAAY,QAAQ,aAAa,CAEvE,EAAE,CAEJ,CAAC,CAAE,GAAG,EAAO,YAAa,gBAAiB,CAAC,EAAY,oBAAoB,CAAE,CAAC"}
@@ -1,2 +1,2 @@
1
- require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants.cjs`),t=require(`../../errors.cjs`),n=require(`../../utils/caip.cjs`),r=require(`./constants.cjs`),i=require(`./_utils/asset.cjs`),a=require(`./_utils/chain.cjs`),o=require(`./_utils/fee.cjs`),s=require(`./btcb-to-btc/_handlers/analyze-support.cjs`),c=require(`./btcb-to-btc/_handlers/get-assets.cjs`),l=require(`./btcb-to-btc/_handlers/estimate-native-fee.cjs`),u=require(`./btcb-to-btc/_handlers/stream-quotes.cjs`),d=require(`./btcb-to-btc/_handlers/track-transfer.cjs`),f=require(`./btcb-to-btc/_handlers/transfer-asset.cjs`);let p=require(`@lombard.finance/sdk`);async function m({bitcoinFunctions:m,environment:h,evmSigner:g}){let _=r.ENV_MAP[h],v=_===p.Env.prod?e.AvalancheChainIds.MAINNET:e.AvalancheChainIds.FUJI,y=_===p.Env.prod?e.BitcoinChainIds.MAINNET:e.BitcoinChainIds.TESTNET,b=n.caip2ToEip155ChainId(v);a.assertSupportedChainId(b);let x=i.getBTCbAsset(b,_),S=r.BTCB_ADAPTER_ADDRESSES[_]?.[b];if(!S)throw new t.ServiceInitializationError;let C=await o.getFees(p.Token.BTCb,b,_),w={environment:h,env:_,sourceChain:v,targetChain:y,sourceChainId:b,sourceAsset:x,adapterAddress:S,targetAsset:r.BTC_NATIVE_ASSET,redeemFee:C.redeemFee,minRedeemAmount:C.minRedeemAmount};return{analyzeSupport:s.analyzeSupportFactory({config:w}),estimateNativeFee:l.estimateNativeFeeFactory({config:w}),getAssets:c.getAssetsFactory({config:w}),getMinimumTransferAmount:async()=>w.minRedeemAmount+w.redeemFee,getSupportedChains:async()=>new Map([[v,new Set([y])]]),streamQuotes:u.streamQuotesFactory({config:w}),trackTransfer:d.trackTransferFactory({bitcoinFunctions:m,config:w}),transferAsset:f.transferAssetFactory({bitcoinFunctions:m,config:w,evmSigner:g}),type:e.ServiceType.LOMBARD_BTCB_TO_BTC}}exports.createBtcbToBtcService=m;
1
+ require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants.cjs`),t=require(`../../errors.cjs`),n=require(`../../utils/caip.cjs`),r=require(`./constants.cjs`),i=require(`./_utils/asset.cjs`),a=require(`./_utils/chain.cjs`),o=require(`./_utils/fee.cjs`),s=require(`./btcb-to-btc/_handlers/analyze-support.cjs`),c=require(`./btcb-to-btc/_handlers/get-assets.cjs`),l=require(`./btcb-to-btc/_handlers/estimate-native-fee.cjs`),u=require(`./btcb-to-btc/_handlers/stream-quotes.cjs`),d=require(`./btcb-to-btc/_handlers/track-transfer.cjs`),f=require(`./btcb-to-btc/_handlers/transfer-asset.cjs`),p=require(`./btcb-to-btc/_handlers/get-bridgeable-assets.cjs`);let m=require(`@lombard.finance/sdk`);async function h({bitcoinFunctions:h,environment:g,evmSigner:_}){let v=r.ENV_MAP[g],y=v===m.Env.prod?e.AvalancheChainIds.MAINNET:e.AvalancheChainIds.FUJI,b=v===m.Env.prod?e.BitcoinChainIds.MAINNET:e.BitcoinChainIds.TESTNET,x=n.caip2ToEip155ChainId(y);a.assertSupportedChainId(x);let S=i.getBTCbAsset(x,v),C=r.BTCB_ADAPTER_ADDRESSES[v]?.[x];if(!C)throw new t.ServiceInitializationError;let w=await o.getFees(m.Token.BTCb,x,v),T={environment:g,env:v,sourceChain:y,targetChain:b,sourceChainId:x,sourceAsset:S,adapterAddress:C,targetAsset:r.BTC_NATIVE_ASSET,redeemFee:w.redeemFee,minRedeemAmount:w.minRedeemAmount};return{analyzeSupport:s.analyzeSupportFactory({config:T}),estimateNativeFee:l.estimateNativeFeeFactory({config:T}),getAssets:c.getAssetsFactory({config:T}),getBridgeableAssets:p.getBridgeableAssetsFactory({config:T}),getMinimumTransferAmount:async()=>T.minRedeemAmount+T.redeemFee,getSupportedChains:async()=>new Map([[y,new Set([b])]]),streamQuotes:u.streamQuotesFactory({config:T}),trackTransfer:d.trackTransferFactory({bitcoinFunctions:h,config:T}),transferAsset:f.transferAssetFactory({bitcoinFunctions:h,config:T,evmSigner:_}),type:e.ServiceType.LOMBARD_BTCB_TO_BTC}}exports.createBtcbToBtcService=h;
2
2
  //# sourceMappingURL=btcb-to-btc-service.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"btcb-to-btc-service.cjs","names":["ENV_MAP","Env","AvalancheChainIds","BitcoinChainIds","caip2ToEip155ChainId","getBTCbAsset","BTCB_ADAPTER_ADDRESSES","ServiceInitializationError","getFees","Token","BTC_NATIVE_ASSET","analyzeSupportFactory","estimateNativeFeeFactory","getAssetsFactory","streamQuotesFactory","trackTransferFactory","transferAssetFactory","ServiceType"],"sources":["../../../src/transfer-service/lombard/btcb-to-btc-service.ts"],"sourcesContent":["import { Env, Token } from '@lombard.finance/sdk';\nimport { AvalancheChainIds, BitcoinChainIds, ServiceType } from '../../constants';\nimport type { Environment } from '../../constants';\nimport { ServiceInitializationError } from '../../errors';\nimport { caip2ToEip155ChainId } from '../../utils/caip';\nimport type { BitcoinFunctions } from '../../types/bitcoin';\nimport type { TransferService } from '../../types/service';\nimport type { EvmSignerWithMessage } from '../../types/signer';\nimport { BTC_NATIVE_ASSET, BTCB_ADAPTER_ADDRESSES, ENV_MAP } from './constants';\nimport { getBTCbAsset } from './_utils/asset';\nimport { assertSupportedChainId } from './_utils/chain';\nimport type { BtcbToBtcConfig } from './types';\nimport { getFees } from './_utils/fee';\nimport { analyzeSupportFactory } from './btcb-to-btc/_handlers/analyze-support';\nimport { getAssetsFactory } from './btcb-to-btc/_handlers/get-assets';\nimport { estimateNativeFeeFactory } from './btcb-to-btc/_handlers/estimate-native-fee';\nimport { streamQuotesFactory } from './btcb-to-btc/_handlers/stream-quotes';\nimport { trackTransferFactory } from './btcb-to-btc/_handlers/track-transfer';\nimport { transferAssetFactory } from './btcb-to-btc/_handlers/transfer-asset';\nimport type { Fetch } from '../../types/utility-types';\n\nexport interface BtcbToBtcServiceOptions {\n bitcoinFunctions: BitcoinFunctions;\n environment: Environment;\n evmSigner: EvmSignerWithMessage;\n fetch?: Fetch;\n}\n\nexport async function createBtcbToBtcService({\n bitcoinFunctions,\n environment,\n evmSigner,\n}: BtcbToBtcServiceOptions): Promise<TransferService> {\n const env = ENV_MAP[environment];\n\n const sourceChain = env === Env.prod ? AvalancheChainIds.MAINNET : AvalancheChainIds.FUJI;\n const targetChain = env === Env.prod ? BitcoinChainIds.MAINNET : BitcoinChainIds.TESTNET;\n const sourceChainId = caip2ToEip155ChainId(sourceChain);\n\n assertSupportedChainId(sourceChainId);\n\n const sourceAsset = getBTCbAsset(sourceChainId, env);\n\n const adapterAddress = BTCB_ADAPTER_ADDRESSES[env]?.[sourceChainId];\n\n if (!adapterAddress) {\n throw new ServiceInitializationError();\n }\n\n const fees = await getFees(Token.BTCb, sourceChainId, env);\n\n const config: BtcbToBtcConfig = {\n environment,\n env,\n sourceChain,\n targetChain,\n sourceChainId,\n sourceAsset,\n adapterAddress,\n targetAsset: BTC_NATIVE_ASSET,\n redeemFee: fees.redeemFee,\n minRedeemAmount: fees.minRedeemAmount,\n };\n\n return {\n analyzeSupport: analyzeSupportFactory({ config }),\n estimateNativeFee: estimateNativeFeeFactory({ config }),\n getAssets: getAssetsFactory({ config }),\n getMinimumTransferAmount: async () => {\n return config.minRedeemAmount + config.redeemFee;\n },\n getSupportedChains: async () => {\n return new Map([[sourceChain, new Set([targetChain])]]);\n },\n streamQuotes: streamQuotesFactory({ config }),\n trackTransfer: trackTransferFactory({ bitcoinFunctions, config }),\n transferAsset: transferAssetFactory({ bitcoinFunctions, config, evmSigner }),\n type: ServiceType.LOMBARD_BTCB_TO_BTC,\n } satisfies TransferService;\n}\n"],"mappings":"yoBA4BA,eAAsB,EAAuB,CAC3C,mBACA,cACA,aACoD,CACpD,IAAM,EAAMA,EAAAA,QAAQ,GAEd,EAAc,IAAQC,EAAAA,IAAI,KAAOC,EAAAA,kBAAkB,QAAUA,EAAAA,kBAAkB,KAC/E,EAAc,IAAQD,EAAAA,IAAI,KAAOE,EAAAA,gBAAgB,QAAUA,EAAAA,gBAAgB,QAC3E,EAAgBC,EAAAA,qBAAqB,EAAY,CAEvD,EAAA,uBAAuB,EAAc,CAErC,IAAM,EAAcC,EAAAA,aAAa,EAAe,EAAI,CAE9C,EAAiBC,EAAAA,uBAAuB,KAAO,GAErD,GAAI,CAAC,EACH,MAAM,IAAIC,EAAAA,2BAGZ,IAAM,EAAO,MAAMC,EAAAA,QAAQC,EAAAA,MAAM,KAAM,EAAe,EAAI,CAEpD,EAA0B,CAC9B,cACA,MACA,cACA,cACA,gBACA,cACA,iBACA,YAAaC,EAAAA,iBACb,UAAW,EAAK,UAChB,gBAAiB,EAAK,gBACvB,CAED,MAAO,CACL,eAAgBC,EAAAA,sBAAsB,CAAE,SAAQ,CAAC,CACjD,kBAAmBC,EAAAA,yBAAyB,CAAE,SAAQ,CAAC,CACvD,UAAWC,EAAAA,iBAAiB,CAAE,SAAQ,CAAC,CACvC,yBAA0B,SACjB,EAAO,gBAAkB,EAAO,UAEzC,mBAAoB,SACX,IAAI,IAAI,CAAC,CAAC,EAAa,IAAI,IAAI,CAAC,EAAY,CAAC,CAAC,CAAC,CAAC,CAEzD,aAAcC,EAAAA,oBAAoB,CAAE,SAAQ,CAAC,CAC7C,cAAeC,EAAAA,qBAAqB,CAAE,mBAAkB,SAAQ,CAAC,CACjE,cAAeC,EAAAA,qBAAqB,CAAE,mBAAkB,SAAQ,YAAW,CAAC,CAC5E,KAAMC,EAAAA,YAAY,oBACnB"}
1
+ {"version":3,"file":"btcb-to-btc-service.cjs","names":["ENV_MAP","Env","AvalancheChainIds","BitcoinChainIds","caip2ToEip155ChainId","getBTCbAsset","BTCB_ADAPTER_ADDRESSES","ServiceInitializationError","getFees","Token","BTC_NATIVE_ASSET","analyzeSupportFactory","estimateNativeFeeFactory","getAssetsFactory","getBridgeableAssetsFactory","streamQuotesFactory","trackTransferFactory","transferAssetFactory","ServiceType"],"sources":["../../../src/transfer-service/lombard/btcb-to-btc-service.ts"],"sourcesContent":["import { Env, Token } from '@lombard.finance/sdk';\nimport { AvalancheChainIds, BitcoinChainIds, ServiceType } from '../../constants';\nimport type { Environment } from '../../constants';\nimport { ServiceInitializationError } from '../../errors';\nimport { caip2ToEip155ChainId } from '../../utils/caip';\nimport type { BitcoinFunctions } from '../../types/bitcoin';\nimport type { TransferService } from '../../types/service';\nimport type { EvmSignerWithMessage } from '../../types/signer';\nimport { BTC_NATIVE_ASSET, BTCB_ADAPTER_ADDRESSES, ENV_MAP } from './constants';\nimport { getBTCbAsset } from './_utils/asset';\nimport { assertSupportedChainId } from './_utils/chain';\nimport type { BtcbToBtcConfig } from './types';\nimport { getFees } from './_utils/fee';\nimport { analyzeSupportFactory } from './btcb-to-btc/_handlers/analyze-support';\nimport { getAssetsFactory } from './btcb-to-btc/_handlers/get-assets';\nimport { estimateNativeFeeFactory } from './btcb-to-btc/_handlers/estimate-native-fee';\nimport { streamQuotesFactory } from './btcb-to-btc/_handlers/stream-quotes';\nimport { trackTransferFactory } from './btcb-to-btc/_handlers/track-transfer';\nimport { transferAssetFactory } from './btcb-to-btc/_handlers/transfer-asset';\nimport { getBridgeableAssetsFactory } from './btcb-to-btc/_handlers/get-bridgeable-assets';\nimport type { Fetch } from '../../types/utility-types';\n\nexport interface BtcbToBtcServiceOptions {\n bitcoinFunctions: BitcoinFunctions;\n environment: Environment;\n evmSigner: EvmSignerWithMessage;\n fetch?: Fetch;\n}\n\nexport async function createBtcbToBtcService({\n bitcoinFunctions,\n environment,\n evmSigner,\n}: BtcbToBtcServiceOptions): Promise<TransferService> {\n const env = ENV_MAP[environment];\n\n const sourceChain = env === Env.prod ? AvalancheChainIds.MAINNET : AvalancheChainIds.FUJI;\n const targetChain = env === Env.prod ? BitcoinChainIds.MAINNET : BitcoinChainIds.TESTNET;\n const sourceChainId = caip2ToEip155ChainId(sourceChain);\n\n assertSupportedChainId(sourceChainId);\n\n const sourceAsset = getBTCbAsset(sourceChainId, env);\n\n const adapterAddress = BTCB_ADAPTER_ADDRESSES[env]?.[sourceChainId];\n\n if (!adapterAddress) {\n throw new ServiceInitializationError();\n }\n\n const fees = await getFees(Token.BTCb, sourceChainId, env);\n\n const config: BtcbToBtcConfig = {\n environment,\n env,\n sourceChain,\n targetChain,\n sourceChainId,\n sourceAsset,\n adapterAddress,\n targetAsset: BTC_NATIVE_ASSET,\n redeemFee: fees.redeemFee,\n minRedeemAmount: fees.minRedeemAmount,\n };\n\n return {\n analyzeSupport: analyzeSupportFactory({ config }),\n estimateNativeFee: estimateNativeFeeFactory({ config }),\n getAssets: getAssetsFactory({ config }),\n getBridgeableAssets: getBridgeableAssetsFactory({ config }),\n getMinimumTransferAmount: async () => {\n return config.minRedeemAmount + config.redeemFee;\n },\n getSupportedChains: async () => {\n return new Map([[sourceChain, new Set([targetChain])]]);\n },\n streamQuotes: streamQuotesFactory({ config }),\n trackTransfer: trackTransferFactory({ bitcoinFunctions, config }),\n transferAsset: transferAssetFactory({ bitcoinFunctions, config, evmSigner }),\n type: ServiceType.LOMBARD_BTCB_TO_BTC,\n } satisfies TransferService;\n}\n"],"mappings":"wsBA6BA,eAAsB,EAAuB,CAC3C,mBACA,cACA,aACoD,CACpD,IAAM,EAAMA,EAAAA,QAAQ,GAEd,EAAc,IAAQC,EAAAA,IAAI,KAAOC,EAAAA,kBAAkB,QAAUA,EAAAA,kBAAkB,KAC/E,EAAc,IAAQD,EAAAA,IAAI,KAAOE,EAAAA,gBAAgB,QAAUA,EAAAA,gBAAgB,QAC3E,EAAgBC,EAAAA,qBAAqB,EAAY,CAEvD,EAAA,uBAAuB,EAAc,CAErC,IAAM,EAAcC,EAAAA,aAAa,EAAe,EAAI,CAE9C,EAAiBC,EAAAA,uBAAuB,KAAO,GAErD,GAAI,CAAC,EACH,MAAM,IAAIC,EAAAA,2BAGZ,IAAM,EAAO,MAAMC,EAAAA,QAAQC,EAAAA,MAAM,KAAM,EAAe,EAAI,CAEpD,EAA0B,CAC9B,cACA,MACA,cACA,cACA,gBACA,cACA,iBACA,YAAaC,EAAAA,iBACb,UAAW,EAAK,UAChB,gBAAiB,EAAK,gBACvB,CAED,MAAO,CACL,eAAgBC,EAAAA,sBAAsB,CAAE,SAAQ,CAAC,CACjD,kBAAmBC,EAAAA,yBAAyB,CAAE,SAAQ,CAAC,CACvD,UAAWC,EAAAA,iBAAiB,CAAE,SAAQ,CAAC,CACvC,oBAAqBC,EAAAA,2BAA2B,CAAE,SAAQ,CAAC,CAC3D,yBAA0B,SACjB,EAAO,gBAAkB,EAAO,UAEzC,mBAAoB,SACX,IAAI,IAAI,CAAC,CAAC,EAAa,IAAI,IAAI,CAAC,EAAY,CAAC,CAAC,CAAC,CAAC,CAEzD,aAAcC,EAAAA,oBAAoB,CAAE,SAAQ,CAAC,CAC7C,cAAeC,EAAAA,qBAAqB,CAAE,mBAAkB,SAAQ,CAAC,CACjE,cAAeC,EAAAA,qBAAqB,CAAE,mBAAkB,SAAQ,YAAW,CAAC,CAC5E,KAAMC,EAAAA,YAAY,oBACnB"}
@@ -1,2 +1,2 @@
1
- import{AvalancheChainIds as e,BitcoinChainIds as t,ServiceType as n}from"../../constants.js";import{ServiceInitializationError as r}from"../../errors.js";import{caip2ToEip155ChainId as i}from"../../utils/caip.js";import{BTCB_ADAPTER_ADDRESSES as a,BTC_NATIVE_ASSET as o,ENV_MAP as s}from"./constants.js";import{getBTCbAsset as c}from"./_utils/asset.js";import{assertSupportedChainId as l}from"./_utils/chain.js";import{getFees as u}from"./_utils/fee.js";import{analyzeSupportFactory as d}from"./btcb-to-btc/_handlers/analyze-support.js";import{getAssetsFactory as f}from"./btcb-to-btc/_handlers/get-assets.js";import{estimateNativeFeeFactory as p}from"./btcb-to-btc/_handlers/estimate-native-fee.js";import{streamQuotesFactory as m}from"./btcb-to-btc/_handlers/stream-quotes.js";import{trackTransferFactory as h}from"./btcb-to-btc/_handlers/track-transfer.js";import{transferAssetFactory as g}from"./btcb-to-btc/_handlers/transfer-asset.js";import{Env as _,Token as v}from"@lombard.finance/sdk";async function y({bitcoinFunctions:y,environment:b,evmSigner:x}){let S=s[b],C=S===_.prod?e.MAINNET:e.FUJI,w=S===_.prod?t.MAINNET:t.TESTNET,T=i(C);l(T);let E=c(T,S),D=a[S]?.[T];if(!D)throw new r;let O=await u(v.BTCb,T,S),k={environment:b,env:S,sourceChain:C,targetChain:w,sourceChainId:T,sourceAsset:E,adapterAddress:D,targetAsset:o,redeemFee:O.redeemFee,minRedeemAmount:O.minRedeemAmount};return{analyzeSupport:d({config:k}),estimateNativeFee:p({config:k}),getAssets:f({config:k}),getMinimumTransferAmount:async()=>k.minRedeemAmount+k.redeemFee,getSupportedChains:async()=>new Map([[C,new Set([w])]]),streamQuotes:m({config:k}),trackTransfer:h({bitcoinFunctions:y,config:k}),transferAsset:g({bitcoinFunctions:y,config:k,evmSigner:x}),type:n.LOMBARD_BTCB_TO_BTC}}export{y as createBtcbToBtcService};
1
+ import{AvalancheChainIds as e,BitcoinChainIds as t,ServiceType as n}from"../../constants.js";import{ServiceInitializationError as r}from"../../errors.js";import{caip2ToEip155ChainId as i}from"../../utils/caip.js";import{BTCB_ADAPTER_ADDRESSES as a,BTC_NATIVE_ASSET as o,ENV_MAP as s}from"./constants.js";import{getBTCbAsset as c}from"./_utils/asset.js";import{assertSupportedChainId as l}from"./_utils/chain.js";import{getFees as u}from"./_utils/fee.js";import{analyzeSupportFactory as d}from"./btcb-to-btc/_handlers/analyze-support.js";import{getAssetsFactory as f}from"./btcb-to-btc/_handlers/get-assets.js";import{estimateNativeFeeFactory as p}from"./btcb-to-btc/_handlers/estimate-native-fee.js";import{streamQuotesFactory as m}from"./btcb-to-btc/_handlers/stream-quotes.js";import{trackTransferFactory as h}from"./btcb-to-btc/_handlers/track-transfer.js";import{transferAssetFactory as g}from"./btcb-to-btc/_handlers/transfer-asset.js";import{getBridgeableAssetsFactory as _}from"./btcb-to-btc/_handlers/get-bridgeable-assets.js";import{Env as v,Token as y}from"@lombard.finance/sdk";async function b({bitcoinFunctions:b,environment:x,evmSigner:S}){let C=s[x],w=C===v.prod?e.MAINNET:e.FUJI,T=C===v.prod?t.MAINNET:t.TESTNET,E=i(w);l(E);let D=c(E,C),O=a[C]?.[E];if(!O)throw new r;let k=await u(y.BTCb,E,C),A={environment:x,env:C,sourceChain:w,targetChain:T,sourceChainId:E,sourceAsset:D,adapterAddress:O,targetAsset:o,redeemFee:k.redeemFee,minRedeemAmount:k.minRedeemAmount};return{analyzeSupport:d({config:A}),estimateNativeFee:p({config:A}),getAssets:f({config:A}),getBridgeableAssets:_({config:A}),getMinimumTransferAmount:async()=>A.minRedeemAmount+A.redeemFee,getSupportedChains:async()=>new Map([[w,new Set([T])]]),streamQuotes:m({config:A}),trackTransfer:h({bitcoinFunctions:b,config:A}),transferAsset:g({bitcoinFunctions:b,config:A,evmSigner:S}),type:n.LOMBARD_BTCB_TO_BTC}}export{b as createBtcbToBtcService};
2
2
  //# sourceMappingURL=btcb-to-btc-service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"btcb-to-btc-service.js","names":[],"sources":["../../../src/transfer-service/lombard/btcb-to-btc-service.ts"],"sourcesContent":["import { Env, Token } from '@lombard.finance/sdk';\nimport { AvalancheChainIds, BitcoinChainIds, ServiceType } from '../../constants';\nimport type { Environment } from '../../constants';\nimport { ServiceInitializationError } from '../../errors';\nimport { caip2ToEip155ChainId } from '../../utils/caip';\nimport type { BitcoinFunctions } from '../../types/bitcoin';\nimport type { TransferService } from '../../types/service';\nimport type { EvmSignerWithMessage } from '../../types/signer';\nimport { BTC_NATIVE_ASSET, BTCB_ADAPTER_ADDRESSES, ENV_MAP } from './constants';\nimport { getBTCbAsset } from './_utils/asset';\nimport { assertSupportedChainId } from './_utils/chain';\nimport type { BtcbToBtcConfig } from './types';\nimport { getFees } from './_utils/fee';\nimport { analyzeSupportFactory } from './btcb-to-btc/_handlers/analyze-support';\nimport { getAssetsFactory } from './btcb-to-btc/_handlers/get-assets';\nimport { estimateNativeFeeFactory } from './btcb-to-btc/_handlers/estimate-native-fee';\nimport { streamQuotesFactory } from './btcb-to-btc/_handlers/stream-quotes';\nimport { trackTransferFactory } from './btcb-to-btc/_handlers/track-transfer';\nimport { transferAssetFactory } from './btcb-to-btc/_handlers/transfer-asset';\nimport type { Fetch } from '../../types/utility-types';\n\nexport interface BtcbToBtcServiceOptions {\n bitcoinFunctions: BitcoinFunctions;\n environment: Environment;\n evmSigner: EvmSignerWithMessage;\n fetch?: Fetch;\n}\n\nexport async function createBtcbToBtcService({\n bitcoinFunctions,\n environment,\n evmSigner,\n}: BtcbToBtcServiceOptions): Promise<TransferService> {\n const env = ENV_MAP[environment];\n\n const sourceChain = env === Env.prod ? AvalancheChainIds.MAINNET : AvalancheChainIds.FUJI;\n const targetChain = env === Env.prod ? BitcoinChainIds.MAINNET : BitcoinChainIds.TESTNET;\n const sourceChainId = caip2ToEip155ChainId(sourceChain);\n\n assertSupportedChainId(sourceChainId);\n\n const sourceAsset = getBTCbAsset(sourceChainId, env);\n\n const adapterAddress = BTCB_ADAPTER_ADDRESSES[env]?.[sourceChainId];\n\n if (!adapterAddress) {\n throw new ServiceInitializationError();\n }\n\n const fees = await getFees(Token.BTCb, sourceChainId, env);\n\n const config: BtcbToBtcConfig = {\n environment,\n env,\n sourceChain,\n targetChain,\n sourceChainId,\n sourceAsset,\n adapterAddress,\n targetAsset: BTC_NATIVE_ASSET,\n redeemFee: fees.redeemFee,\n minRedeemAmount: fees.minRedeemAmount,\n };\n\n return {\n analyzeSupport: analyzeSupportFactory({ config }),\n estimateNativeFee: estimateNativeFeeFactory({ config }),\n getAssets: getAssetsFactory({ config }),\n getMinimumTransferAmount: async () => {\n return config.minRedeemAmount + config.redeemFee;\n },\n getSupportedChains: async () => {\n return new Map([[sourceChain, new Set([targetChain])]]);\n },\n streamQuotes: streamQuotesFactory({ config }),\n trackTransfer: trackTransferFactory({ bitcoinFunctions, config }),\n transferAsset: transferAssetFactory({ bitcoinFunctions, config, evmSigner }),\n type: ServiceType.LOMBARD_BTCB_TO_BTC,\n } satisfies TransferService;\n}\n"],"mappings":"m+BA4BA,eAAsB,EAAuB,CAC3C,mBACA,cACA,aACoD,CACpD,IAAM,EAAM,EAAQ,GAEd,EAAc,IAAQ,EAAI,KAAO,EAAkB,QAAU,EAAkB,KAC/E,EAAc,IAAQ,EAAI,KAAO,EAAgB,QAAU,EAAgB,QAC3E,EAAgB,EAAqB,EAAY,CAEvD,EAAuB,EAAc,CAErC,IAAM,EAAc,EAAa,EAAe,EAAI,CAE9C,EAAiB,EAAuB,KAAO,GAErD,GAAI,CAAC,EACH,MAAM,IAAI,EAGZ,IAAM,EAAO,MAAM,EAAQ,EAAM,KAAM,EAAe,EAAI,CAEpD,EAA0B,CAC9B,cACA,MACA,cACA,cACA,gBACA,cACA,iBACA,YAAa,EACb,UAAW,EAAK,UAChB,gBAAiB,EAAK,gBACvB,CAED,MAAO,CACL,eAAgB,EAAsB,CAAE,SAAQ,CAAC,CACjD,kBAAmB,EAAyB,CAAE,SAAQ,CAAC,CACvD,UAAW,EAAiB,CAAE,SAAQ,CAAC,CACvC,yBAA0B,SACjB,EAAO,gBAAkB,EAAO,UAEzC,mBAAoB,SACX,IAAI,IAAI,CAAC,CAAC,EAAa,IAAI,IAAI,CAAC,EAAY,CAAC,CAAC,CAAC,CAAC,CAEzD,aAAc,EAAoB,CAAE,SAAQ,CAAC,CAC7C,cAAe,EAAqB,CAAE,mBAAkB,SAAQ,CAAC,CACjE,cAAe,EAAqB,CAAE,mBAAkB,SAAQ,YAAW,CAAC,CAC5E,KAAM,EAAY,oBACnB"}
1
+ {"version":3,"file":"btcb-to-btc-service.js","names":[],"sources":["../../../src/transfer-service/lombard/btcb-to-btc-service.ts"],"sourcesContent":["import { Env, Token } from '@lombard.finance/sdk';\nimport { AvalancheChainIds, BitcoinChainIds, ServiceType } from '../../constants';\nimport type { Environment } from '../../constants';\nimport { ServiceInitializationError } from '../../errors';\nimport { caip2ToEip155ChainId } from '../../utils/caip';\nimport type { BitcoinFunctions } from '../../types/bitcoin';\nimport type { TransferService } from '../../types/service';\nimport type { EvmSignerWithMessage } from '../../types/signer';\nimport { BTC_NATIVE_ASSET, BTCB_ADAPTER_ADDRESSES, ENV_MAP } from './constants';\nimport { getBTCbAsset } from './_utils/asset';\nimport { assertSupportedChainId } from './_utils/chain';\nimport type { BtcbToBtcConfig } from './types';\nimport { getFees } from './_utils/fee';\nimport { analyzeSupportFactory } from './btcb-to-btc/_handlers/analyze-support';\nimport { getAssetsFactory } from './btcb-to-btc/_handlers/get-assets';\nimport { estimateNativeFeeFactory } from './btcb-to-btc/_handlers/estimate-native-fee';\nimport { streamQuotesFactory } from './btcb-to-btc/_handlers/stream-quotes';\nimport { trackTransferFactory } from './btcb-to-btc/_handlers/track-transfer';\nimport { transferAssetFactory } from './btcb-to-btc/_handlers/transfer-asset';\nimport { getBridgeableAssetsFactory } from './btcb-to-btc/_handlers/get-bridgeable-assets';\nimport type { Fetch } from '../../types/utility-types';\n\nexport interface BtcbToBtcServiceOptions {\n bitcoinFunctions: BitcoinFunctions;\n environment: Environment;\n evmSigner: EvmSignerWithMessage;\n fetch?: Fetch;\n}\n\nexport async function createBtcbToBtcService({\n bitcoinFunctions,\n environment,\n evmSigner,\n}: BtcbToBtcServiceOptions): Promise<TransferService> {\n const env = ENV_MAP[environment];\n\n const sourceChain = env === Env.prod ? AvalancheChainIds.MAINNET : AvalancheChainIds.FUJI;\n const targetChain = env === Env.prod ? BitcoinChainIds.MAINNET : BitcoinChainIds.TESTNET;\n const sourceChainId = caip2ToEip155ChainId(sourceChain);\n\n assertSupportedChainId(sourceChainId);\n\n const sourceAsset = getBTCbAsset(sourceChainId, env);\n\n const adapterAddress = BTCB_ADAPTER_ADDRESSES[env]?.[sourceChainId];\n\n if (!adapterAddress) {\n throw new ServiceInitializationError();\n }\n\n const fees = await getFees(Token.BTCb, sourceChainId, env);\n\n const config: BtcbToBtcConfig = {\n environment,\n env,\n sourceChain,\n targetChain,\n sourceChainId,\n sourceAsset,\n adapterAddress,\n targetAsset: BTC_NATIVE_ASSET,\n redeemFee: fees.redeemFee,\n minRedeemAmount: fees.minRedeemAmount,\n };\n\n return {\n analyzeSupport: analyzeSupportFactory({ config }),\n estimateNativeFee: estimateNativeFeeFactory({ config }),\n getAssets: getAssetsFactory({ config }),\n getBridgeableAssets: getBridgeableAssetsFactory({ config }),\n getMinimumTransferAmount: async () => {\n return config.minRedeemAmount + config.redeemFee;\n },\n getSupportedChains: async () => {\n return new Map([[sourceChain, new Set([targetChain])]]);\n },\n streamQuotes: streamQuotesFactory({ config }),\n trackTransfer: trackTransferFactory({ bitcoinFunctions, config }),\n transferAsset: transferAssetFactory({ bitcoinFunctions, config, evmSigner }),\n type: ServiceType.LOMBARD_BTCB_TO_BTC,\n } satisfies TransferService;\n}\n"],"mappings":"ikCA6BA,eAAsB,EAAuB,CAC3C,mBACA,cACA,aACoD,CACpD,IAAM,EAAM,EAAQ,GAEd,EAAc,IAAQ,EAAI,KAAO,EAAkB,QAAU,EAAkB,KAC/E,EAAc,IAAQ,EAAI,KAAO,EAAgB,QAAU,EAAgB,QAC3E,EAAgB,EAAqB,EAAY,CAEvD,EAAuB,EAAc,CAErC,IAAM,EAAc,EAAa,EAAe,EAAI,CAE9C,EAAiB,EAAuB,KAAO,GAErD,GAAI,CAAC,EACH,MAAM,IAAI,EAGZ,IAAM,EAAO,MAAM,EAAQ,EAAM,KAAM,EAAe,EAAI,CAEpD,EAA0B,CAC9B,cACA,MACA,cACA,cACA,gBACA,cACA,iBACA,YAAa,EACb,UAAW,EAAK,UAChB,gBAAiB,EAAK,gBACvB,CAED,MAAO,CACL,eAAgB,EAAsB,CAAE,SAAQ,CAAC,CACjD,kBAAmB,EAAyB,CAAE,SAAQ,CAAC,CACvD,UAAW,EAAiB,CAAE,SAAQ,CAAC,CACvC,oBAAqB,EAA2B,CAAE,SAAQ,CAAC,CAC3D,yBAA0B,SACjB,EAAO,gBAAkB,EAAO,UAEzC,mBAAoB,SACX,IAAI,IAAI,CAAC,CAAC,EAAa,IAAI,IAAI,CAAC,EAAY,CAAC,CAAC,CAAC,CAAC,CAEzD,aAAc,EAAoB,CAAE,SAAQ,CAAC,CAC7C,cAAe,EAAqB,CAAE,mBAAkB,SAAQ,CAAC,CACjE,cAAe,EAAqB,CAAE,mBAAkB,SAAQ,YAAW,CAAC,CAC5E,KAAM,EAAY,oBACnB"}
@@ -1,2 +1,2 @@
1
- require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants.cjs`);let t=require(`@lombard.finance/sdk`);const n={[e.Environment.DEV]:t.Env.dev,[e.Environment.TEST]:t.Env.ibc,[e.Environment.PROD]:t.Env.prod},r={type:e.TokenType.NATIVE,name:`Bitcoin`,symbol:`BTC`,decimals:8},i={[t.Env.dev]:{43113:`0x7fbdc44bfebde80c970ba622b678dab36cee31f6`},[t.Env.ibc]:{43113:`0x71ba2b8dc58e7ca1b6d81a60729e31aefa37ae02`},[t.Env.stage]:{43113:`0x7fbdc44bfebde80c970ba622b678dab36cee31f6`},[t.Env.testnet]:{43113:`0xb14f240714bd23bda103a7189d512a90326e4d01`},[t.Env.prod]:{43114:`0x152b9d0fdc40c096757f570a51e494bd4b943e50`}},a={[t.Env.dev]:{43113:`0x0a65c37d07c32e5ea8ea40495b7f249cde26935e`},[t.Env.ibc]:{43113:`0x1391f9ac408cf13214ddb71d359002658eaf9ebb`},[t.Env.stage]:{43113:`0x0a65c37d07c32e5ea8ea40495b7f249cde26935e`},[t.Env.testnet]:{43113:`0x41bcd71e7c92b1c8dde53037f9b2c4aa2058b1cb`},[t.Env.prod]:{43114:`0x85d1d52e11290f174444d21c2a167bedbe36e4d2`}};exports.BTCB_ADAPTER_ADDRESSES=a,exports.BTCB_ADDRESSES=i,exports.BTC_CONFIRMATION_COUNT=6,exports.BTC_NATIVE_ASSET=r,exports.ENV_MAP=n,exports.EVM_CONFIRMATION_COUNT=1,exports.LOMBARD_PARTNER_ID=`core`,exports.MIN_DEPOSIT_BTC_AMOUNT_SATOSHI=20000n;
1
+ require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../constants.cjs`);let t=require(`@lombard.finance/sdk`);const n={[e.Environment.DEV]:t.Env.dev,[e.Environment.TEST]:t.Env.ibc,[e.Environment.PROD]:t.Env.prod},r={type:e.TokenType.NATIVE,name:`Bitcoin`,symbol:`BTC`,decimals:8,logoUri:`https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoin/info/logo.png`},i={[t.Env.dev]:{43113:`0x7fbdc44bfebde80c970ba622b678dab36cee31f6`},[t.Env.ibc]:{43113:`0x71ba2b8dc58e7ca1b6d81a60729e31aefa37ae02`},[t.Env.stage]:{43113:`0x7fbdc44bfebde80c970ba622b678dab36cee31f6`},[t.Env.testnet]:{43113:`0xb14f240714bd23bda103a7189d512a90326e4d01`},[t.Env.prod]:{43114:`0x152b9d0fdc40c096757f570a51e494bd4b943e50`}},a={[t.Env.dev]:{43113:`0x0a65c37d07c32e5ea8ea40495b7f249cde26935e`},[t.Env.ibc]:{43113:`0x1391f9ac408cf13214ddb71d359002658eaf9ebb`},[t.Env.stage]:{43113:`0x0a65c37d07c32e5ea8ea40495b7f249cde26935e`},[t.Env.testnet]:{43113:`0x41bcd71e7c92b1c8dde53037f9b2c4aa2058b1cb`},[t.Env.prod]:{43114:`0x85d1d52e11290f174444d21c2a167bedbe36e4d2`}};exports.BTCB_ADAPTER_ADDRESSES=a,exports.BTCB_ADDRESSES=i,exports.BTCB_LOGO_URI=`https://images.ctfassets.net/gcj8jwzm6086/aeab859f-78aa-4a05-8f77-b7e3492beb39/12c3dad31c4e71389d11661e4504c34b/43114-0x152b9d0FdC40C096757F570A51E494bd4b943E50.png`,exports.BTC_CONFIRMATION_COUNT=6,exports.BTC_NATIVE_ASSET=r,exports.ENV_MAP=n,exports.EVM_CONFIRMATION_COUNT=1,exports.LOMBARD_PARTNER_ID=`core`,exports.MIN_DEPOSIT_BTC_AMOUNT_SATOSHI=20000n;
2
2
  //# sourceMappingURL=constants.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.cjs","names":["Environment","Env","TokenType"],"sources":["../../../src/transfer-service/lombard/constants.ts"],"sourcesContent":["import { type ChainId, Env } from '@lombard.finance/sdk';\nimport type { Address as EvmAddress } from 'viem';\nimport { Environment, TokenType } from '../../constants';\nimport type { NativeAsset } from '../../types/asset';\n\n/** The Lombard partner ID */\nexport const LOMBARD_PARTNER_ID = 'core';\n\n/**\n * The number of confirmations needed on BTC network for\n * the deposit to be picked up by claimer.\n */\nexport const BTC_CONFIRMATION_COUNT = 6;\n\n/** The number of confirmations on EVM network */\nexport const EVM_CONFIRMATION_COUNT = 1;\n\n/** The mapping of SDK environments to Lombard's SDK env. */\nexport const ENV_MAP: Record<Environment, Env> = {\n [Environment.DEV]: Env.dev,\n [Environment.TEST]: Env.ibc,\n [Environment.PROD]: Env.prod,\n};\n\n/** The minimum BTC amount eligible for depositing (in Satoshis). */\nexport const MIN_DEPOSIT_BTC_AMOUNT_SATOSHI = 20000n;\n\n/** Estimated bridging time in hours for BTCb to BTC direction */\nexport const ESTIMATED_BRIDGING_TIME_BTCB_TO_BTC_HOURS = 6;\n\nexport const BTC_NATIVE_ASSET: NativeAsset = {\n type: TokenType.NATIVE,\n name: 'Bitcoin',\n symbol: 'BTC',\n decimals: 8,\n};\n\n/**\n * BTCb token contract addresses by environment and chain ID.\n * These are the ERC20 token contracts for BTCb.\n * Organized as: Env -> ChainId -> Address\n */\nexport const BTCB_ADDRESSES: Record<Env, Partial<Record<ChainId, EvmAddress>>> = {\n [Env.dev]: {\n 43113: '0x7fbdc44bfebde80c970ba622b678dab36cee31f6',\n },\n [Env.ibc]: {\n 43113: '0x71ba2b8dc58e7ca1b6d81a60729e31aefa37ae02',\n },\n [Env.stage]: {\n 43113: '0x7fbdc44bfebde80c970ba622b678dab36cee31f6',\n },\n [Env.testnet]: {\n 43113: '0xb14f240714bd23bda103a7189d512a90326e4d01',\n },\n [Env.prod]: {\n 43114: '0x152b9d0fdc40c096757f570a51e494bd4b943e50',\n },\n};\n\n/**\n * BTCb adapter contract addresses by environment and chain ID.\n * On Avalanche, BTCb uses a dual-contract architecture:\n * - Token contract: ERC20 for balances, permits, approvals\n * - Adapter contract: For bridge operations (burn/mint), needs approval for redemptions\n * Organized as: Env -> ChainId -> Address\n */\nexport const BTCB_ADAPTER_ADDRESSES: Record<Env, Partial<Record<ChainId, EvmAddress>>> = {\n [Env.dev]: {\n 43113: '0x0a65c37d07c32e5ea8ea40495b7f249cde26935e',\n },\n [Env.ibc]: {\n 43113: '0x1391f9ac408cf13214ddb71d359002658eaf9ebb',\n },\n [Env.stage]: {\n 43113: '0x0a65c37d07c32e5ea8ea40495b7f249cde26935e',\n },\n [Env.testnet]: {\n 43113: '0x41bcd71e7c92b1c8dde53037f9b2c4aa2058b1cb',\n },\n [Env.prod]: {\n 43114: '0x85d1d52e11290f174444d21c2a167bedbe36e4d2',\n },\n};\n"],"mappings":"6HAMA,MAYa,EAAoC,EAC9CA,EAAAA,YAAY,KAAMC,EAAAA,IAAI,KACtBD,EAAAA,YAAY,MAAOC,EAAAA,IAAI,KACvBD,EAAAA,YAAY,MAAOC,EAAAA,IAAI,KACzB,CAQY,EAAgC,CAC3C,KAAMC,EAAAA,UAAU,OAChB,KAAM,UACN,OAAQ,MACR,SAAU,EACX,CAOY,EAAoE,EAC9ED,EAAAA,IAAI,KAAM,CACT,MAAO,6CACR,EACAA,EAAAA,IAAI,KAAM,CACT,MAAO,6CACR,EACAA,EAAAA,IAAI,OAAQ,CACX,MAAO,6CACR,EACAA,EAAAA,IAAI,SAAU,CACb,MAAO,6CACR,EACAA,EAAAA,IAAI,MAAO,CACV,MAAO,6CACR,CACF,CASY,EAA4E,EACtFA,EAAAA,IAAI,KAAM,CACT,MAAO,6CACR,EACAA,EAAAA,IAAI,KAAM,CACT,MAAO,6CACR,EACAA,EAAAA,IAAI,OAAQ,CACX,MAAO,6CACR,EACAA,EAAAA,IAAI,SAAU,CACb,MAAO,6CACR,EACAA,EAAAA,IAAI,MAAO,CACV,MAAO,6CACR,CACF"}
1
+ {"version":3,"file":"constants.cjs","names":["Environment","Env","TokenType"],"sources":["../../../src/transfer-service/lombard/constants.ts"],"sourcesContent":["import { type ChainId, Env } from '@lombard.finance/sdk';\nimport type { Address as EvmAddress } from 'viem';\nimport { Environment, TokenType } from '../../constants';\nimport type { NativeAsset } from '../../types/asset';\n\n/** The Lombard partner ID */\nexport const LOMBARD_PARTNER_ID = 'core';\n\n/**\n * The number of confirmations needed on BTC network for\n * the deposit to be picked up by claimer.\n */\nexport const BTC_CONFIRMATION_COUNT = 6;\n\n/** The number of confirmations on EVM network */\nexport const EVM_CONFIRMATION_COUNT = 1;\n\n/** The mapping of SDK environments to Lombard's SDK env. */\nexport const ENV_MAP: Record<Environment, Env> = {\n [Environment.DEV]: Env.dev,\n [Environment.TEST]: Env.ibc,\n [Environment.PROD]: Env.prod,\n};\n\n/** The minimum BTC amount eligible for depositing (in Satoshis). */\nexport const MIN_DEPOSIT_BTC_AMOUNT_SATOSHI = 20000n;\n\n/** Estimated bridging time in hours for BTCb to BTC direction */\nexport const ESTIMATED_BRIDGING_TIME_BTCB_TO_BTC_HOURS = 6;\n\nexport const BTC_LOGO_URI =\n 'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoin/info/logo.png';\nexport const BTCB_LOGO_URI =\n 'https://images.ctfassets.net/gcj8jwzm6086/aeab859f-78aa-4a05-8f77-b7e3492beb39/12c3dad31c4e71389d11661e4504c34b/43114-0x152b9d0FdC40C096757F570A51E494bd4b943E50.png';\n\nexport const BTC_NATIVE_ASSET: NativeAsset = {\n type: TokenType.NATIVE,\n name: 'Bitcoin',\n symbol: 'BTC',\n decimals: 8,\n logoUri: BTC_LOGO_URI,\n};\n\n/**\n * BTCb token contract addresses by environment and chain ID.\n * These are the ERC20 token contracts for BTCb.\n * Organized as: Env -> ChainId -> Address\n */\nexport const BTCB_ADDRESSES: Record<Env, Partial<Record<ChainId, EvmAddress>>> = {\n [Env.dev]: {\n 43113: '0x7fbdc44bfebde80c970ba622b678dab36cee31f6',\n },\n [Env.ibc]: {\n 43113: '0x71ba2b8dc58e7ca1b6d81a60729e31aefa37ae02',\n },\n [Env.stage]: {\n 43113: '0x7fbdc44bfebde80c970ba622b678dab36cee31f6',\n },\n [Env.testnet]: {\n 43113: '0xb14f240714bd23bda103a7189d512a90326e4d01',\n },\n [Env.prod]: {\n 43114: '0x152b9d0fdc40c096757f570a51e494bd4b943e50',\n },\n};\n\n/**\n * BTCb adapter contract addresses by environment and chain ID.\n * On Avalanche, BTCb uses a dual-contract architecture:\n * - Token contract: ERC20 for balances, permits, approvals\n * - Adapter contract: For bridge operations (burn/mint), needs approval for redemptions\n * Organized as: Env -> ChainId -> Address\n */\nexport const BTCB_ADAPTER_ADDRESSES: Record<Env, Partial<Record<ChainId, EvmAddress>>> = {\n [Env.dev]: {\n 43113: '0x0a65c37d07c32e5ea8ea40495b7f249cde26935e',\n },\n [Env.ibc]: {\n 43113: '0x1391f9ac408cf13214ddb71d359002658eaf9ebb',\n },\n [Env.stage]: {\n 43113: '0x0a65c37d07c32e5ea8ea40495b7f249cde26935e',\n },\n [Env.testnet]: {\n 43113: '0x41bcd71e7c92b1c8dde53037f9b2c4aa2058b1cb',\n },\n [Env.prod]: {\n 43114: '0x85d1d52e11290f174444d21c2a167bedbe36e4d2',\n },\n};\n"],"mappings":"6HAMA,MAYa,EAAoC,EAC9CA,EAAAA,YAAY,KAAMC,EAAAA,IAAI,KACtBD,EAAAA,YAAY,MAAOC,EAAAA,IAAI,KACvBD,EAAAA,YAAY,MAAOC,EAAAA,IAAI,KACzB,CAaY,EAAgC,CAC3C,KAAMC,EAAAA,UAAU,OAChB,KAAM,UACN,OAAQ,MACR,SAAU,EACV,QAAS,gGACV,CAOY,EAAoE,EAC9ED,EAAAA,IAAI,KAAM,CACT,MAAO,6CACR,EACAA,EAAAA,IAAI,KAAM,CACT,MAAO,6CACR,EACAA,EAAAA,IAAI,OAAQ,CACX,MAAO,6CACR,EACAA,EAAAA,IAAI,SAAU,CACb,MAAO,6CACR,EACAA,EAAAA,IAAI,MAAO,CACV,MAAO,6CACR,CACF,CASY,EAA4E,EACtFA,EAAAA,IAAI,KAAM,CACT,MAAO,6CACR,EACAA,EAAAA,IAAI,KAAM,CACT,MAAO,6CACR,EACAA,EAAAA,IAAI,OAAQ,CACX,MAAO,6CACR,EACAA,EAAAA,IAAI,SAAU,CACb,MAAO,6CACR,EACAA,EAAAA,IAAI,MAAO,CACV,MAAO,6CACR,CACF"}
@@ -1,2 +1,2 @@
1
- import{Environment as e,TokenType as t}from"../../constants.js";import{Env as n}from"@lombard.finance/sdk";const r=`core`,i=6,a=1,o={[e.DEV]:n.dev,[e.TEST]:n.ibc,[e.PROD]:n.prod},s=20000n,c={type:t.NATIVE,name:`Bitcoin`,symbol:`BTC`,decimals:8},l={[n.dev]:{43113:`0x7fbdc44bfebde80c970ba622b678dab36cee31f6`},[n.ibc]:{43113:`0x71ba2b8dc58e7ca1b6d81a60729e31aefa37ae02`},[n.stage]:{43113:`0x7fbdc44bfebde80c970ba622b678dab36cee31f6`},[n.testnet]:{43113:`0xb14f240714bd23bda103a7189d512a90326e4d01`},[n.prod]:{43114:`0x152b9d0fdc40c096757f570a51e494bd4b943e50`}},u={[n.dev]:{43113:`0x0a65c37d07c32e5ea8ea40495b7f249cde26935e`},[n.ibc]:{43113:`0x1391f9ac408cf13214ddb71d359002658eaf9ebb`},[n.stage]:{43113:`0x0a65c37d07c32e5ea8ea40495b7f249cde26935e`},[n.testnet]:{43113:`0x41bcd71e7c92b1c8dde53037f9b2c4aa2058b1cb`},[n.prod]:{43114:`0x85d1d52e11290f174444d21c2a167bedbe36e4d2`}};export{u as BTCB_ADAPTER_ADDRESSES,l as BTCB_ADDRESSES,i as BTC_CONFIRMATION_COUNT,c as BTC_NATIVE_ASSET,o as ENV_MAP,a as EVM_CONFIRMATION_COUNT,r as LOMBARD_PARTNER_ID,s as MIN_DEPOSIT_BTC_AMOUNT_SATOSHI};
1
+ import{Environment as e,TokenType as t}from"../../constants.js";import{Env as n}from"@lombard.finance/sdk";const r=`core`,i=6,a=1,o={[e.DEV]:n.dev,[e.TEST]:n.ibc,[e.PROD]:n.prod},s=20000n,c=`https://images.ctfassets.net/gcj8jwzm6086/aeab859f-78aa-4a05-8f77-b7e3492beb39/12c3dad31c4e71389d11661e4504c34b/43114-0x152b9d0FdC40C096757F570A51E494bd4b943E50.png`,l={type:t.NATIVE,name:`Bitcoin`,symbol:`BTC`,decimals:8,logoUri:`https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoin/info/logo.png`},u={[n.dev]:{43113:`0x7fbdc44bfebde80c970ba622b678dab36cee31f6`},[n.ibc]:{43113:`0x71ba2b8dc58e7ca1b6d81a60729e31aefa37ae02`},[n.stage]:{43113:`0x7fbdc44bfebde80c970ba622b678dab36cee31f6`},[n.testnet]:{43113:`0xb14f240714bd23bda103a7189d512a90326e4d01`},[n.prod]:{43114:`0x152b9d0fdc40c096757f570a51e494bd4b943e50`}},d={[n.dev]:{43113:`0x0a65c37d07c32e5ea8ea40495b7f249cde26935e`},[n.ibc]:{43113:`0x1391f9ac408cf13214ddb71d359002658eaf9ebb`},[n.stage]:{43113:`0x0a65c37d07c32e5ea8ea40495b7f249cde26935e`},[n.testnet]:{43113:`0x41bcd71e7c92b1c8dde53037f9b2c4aa2058b1cb`},[n.prod]:{43114:`0x85d1d52e11290f174444d21c2a167bedbe36e4d2`}};export{d as BTCB_ADAPTER_ADDRESSES,u as BTCB_ADDRESSES,c as BTCB_LOGO_URI,i as BTC_CONFIRMATION_COUNT,l as BTC_NATIVE_ASSET,o as ENV_MAP,a as EVM_CONFIRMATION_COUNT,r as LOMBARD_PARTNER_ID,s as MIN_DEPOSIT_BTC_AMOUNT_SATOSHI};
2
2
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":[],"sources":["../../../src/transfer-service/lombard/constants.ts"],"sourcesContent":["import { type ChainId, Env } from '@lombard.finance/sdk';\nimport type { Address as EvmAddress } from 'viem';\nimport { Environment, TokenType } from '../../constants';\nimport type { NativeAsset } from '../../types/asset';\n\n/** The Lombard partner ID */\nexport const LOMBARD_PARTNER_ID = 'core';\n\n/**\n * The number of confirmations needed on BTC network for\n * the deposit to be picked up by claimer.\n */\nexport const BTC_CONFIRMATION_COUNT = 6;\n\n/** The number of confirmations on EVM network */\nexport const EVM_CONFIRMATION_COUNT = 1;\n\n/** The mapping of SDK environments to Lombard's SDK env. */\nexport const ENV_MAP: Record<Environment, Env> = {\n [Environment.DEV]: Env.dev,\n [Environment.TEST]: Env.ibc,\n [Environment.PROD]: Env.prod,\n};\n\n/** The minimum BTC amount eligible for depositing (in Satoshis). */\nexport const MIN_DEPOSIT_BTC_AMOUNT_SATOSHI = 20000n;\n\n/** Estimated bridging time in hours for BTCb to BTC direction */\nexport const ESTIMATED_BRIDGING_TIME_BTCB_TO_BTC_HOURS = 6;\n\nexport const BTC_NATIVE_ASSET: NativeAsset = {\n type: TokenType.NATIVE,\n name: 'Bitcoin',\n symbol: 'BTC',\n decimals: 8,\n};\n\n/**\n * BTCb token contract addresses by environment and chain ID.\n * These are the ERC20 token contracts for BTCb.\n * Organized as: Env -> ChainId -> Address\n */\nexport const BTCB_ADDRESSES: Record<Env, Partial<Record<ChainId, EvmAddress>>> = {\n [Env.dev]: {\n 43113: '0x7fbdc44bfebde80c970ba622b678dab36cee31f6',\n },\n [Env.ibc]: {\n 43113: '0x71ba2b8dc58e7ca1b6d81a60729e31aefa37ae02',\n },\n [Env.stage]: {\n 43113: '0x7fbdc44bfebde80c970ba622b678dab36cee31f6',\n },\n [Env.testnet]: {\n 43113: '0xb14f240714bd23bda103a7189d512a90326e4d01',\n },\n [Env.prod]: {\n 43114: '0x152b9d0fdc40c096757f570a51e494bd4b943e50',\n },\n};\n\n/**\n * BTCb adapter contract addresses by environment and chain ID.\n * On Avalanche, BTCb uses a dual-contract architecture:\n * - Token contract: ERC20 for balances, permits, approvals\n * - Adapter contract: For bridge operations (burn/mint), needs approval for redemptions\n * Organized as: Env -> ChainId -> Address\n */\nexport const BTCB_ADAPTER_ADDRESSES: Record<Env, Partial<Record<ChainId, EvmAddress>>> = {\n [Env.dev]: {\n 43113: '0x0a65c37d07c32e5ea8ea40495b7f249cde26935e',\n },\n [Env.ibc]: {\n 43113: '0x1391f9ac408cf13214ddb71d359002658eaf9ebb',\n },\n [Env.stage]: {\n 43113: '0x0a65c37d07c32e5ea8ea40495b7f249cde26935e',\n },\n [Env.testnet]: {\n 43113: '0x41bcd71e7c92b1c8dde53037f9b2c4aa2058b1cb',\n },\n [Env.prod]: {\n 43114: '0x85d1d52e11290f174444d21c2a167bedbe36e4d2',\n },\n};\n"],"mappings":"2GAMA,MAAa,EAAqB,OAMrB,EAAyB,EAGzB,EAAyB,EAGzB,EAAoC,EAC9C,EAAY,KAAM,EAAI,KACtB,EAAY,MAAO,EAAI,KACvB,EAAY,MAAO,EAAI,KACzB,CAGY,EAAiC,OAKjC,EAAgC,CAC3C,KAAM,EAAU,OAChB,KAAM,UACN,OAAQ,MACR,SAAU,EACX,CAOY,EAAoE,EAC9E,EAAI,KAAM,CACT,MAAO,6CACR,EACA,EAAI,KAAM,CACT,MAAO,6CACR,EACA,EAAI,OAAQ,CACX,MAAO,6CACR,EACA,EAAI,SAAU,CACb,MAAO,6CACR,EACA,EAAI,MAAO,CACV,MAAO,6CACR,CACF,CASY,EAA4E,EACtF,EAAI,KAAM,CACT,MAAO,6CACR,EACA,EAAI,KAAM,CACT,MAAO,6CACR,EACA,EAAI,OAAQ,CACX,MAAO,6CACR,EACA,EAAI,SAAU,CACb,MAAO,6CACR,EACA,EAAI,MAAO,CACV,MAAO,6CACR,CACF"}
1
+ {"version":3,"file":"constants.js","names":[],"sources":["../../../src/transfer-service/lombard/constants.ts"],"sourcesContent":["import { type ChainId, Env } from '@lombard.finance/sdk';\nimport type { Address as EvmAddress } from 'viem';\nimport { Environment, TokenType } from '../../constants';\nimport type { NativeAsset } from '../../types/asset';\n\n/** The Lombard partner ID */\nexport const LOMBARD_PARTNER_ID = 'core';\n\n/**\n * The number of confirmations needed on BTC network for\n * the deposit to be picked up by claimer.\n */\nexport const BTC_CONFIRMATION_COUNT = 6;\n\n/** The number of confirmations on EVM network */\nexport const EVM_CONFIRMATION_COUNT = 1;\n\n/** The mapping of SDK environments to Lombard's SDK env. */\nexport const ENV_MAP: Record<Environment, Env> = {\n [Environment.DEV]: Env.dev,\n [Environment.TEST]: Env.ibc,\n [Environment.PROD]: Env.prod,\n};\n\n/** The minimum BTC amount eligible for depositing (in Satoshis). */\nexport const MIN_DEPOSIT_BTC_AMOUNT_SATOSHI = 20000n;\n\n/** Estimated bridging time in hours for BTCb to BTC direction */\nexport const ESTIMATED_BRIDGING_TIME_BTCB_TO_BTC_HOURS = 6;\n\nexport const BTC_LOGO_URI =\n 'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoin/info/logo.png';\nexport const BTCB_LOGO_URI =\n 'https://images.ctfassets.net/gcj8jwzm6086/aeab859f-78aa-4a05-8f77-b7e3492beb39/12c3dad31c4e71389d11661e4504c34b/43114-0x152b9d0FdC40C096757F570A51E494bd4b943E50.png';\n\nexport const BTC_NATIVE_ASSET: NativeAsset = {\n type: TokenType.NATIVE,\n name: 'Bitcoin',\n symbol: 'BTC',\n decimals: 8,\n logoUri: BTC_LOGO_URI,\n};\n\n/**\n * BTCb token contract addresses by environment and chain ID.\n * These are the ERC20 token contracts for BTCb.\n * Organized as: Env -> ChainId -> Address\n */\nexport const BTCB_ADDRESSES: Record<Env, Partial<Record<ChainId, EvmAddress>>> = {\n [Env.dev]: {\n 43113: '0x7fbdc44bfebde80c970ba622b678dab36cee31f6',\n },\n [Env.ibc]: {\n 43113: '0x71ba2b8dc58e7ca1b6d81a60729e31aefa37ae02',\n },\n [Env.stage]: {\n 43113: '0x7fbdc44bfebde80c970ba622b678dab36cee31f6',\n },\n [Env.testnet]: {\n 43113: '0xb14f240714bd23bda103a7189d512a90326e4d01',\n },\n [Env.prod]: {\n 43114: '0x152b9d0fdc40c096757f570a51e494bd4b943e50',\n },\n};\n\n/**\n * BTCb adapter contract addresses by environment and chain ID.\n * On Avalanche, BTCb uses a dual-contract architecture:\n * - Token contract: ERC20 for balances, permits, approvals\n * - Adapter contract: For bridge operations (burn/mint), needs approval for redemptions\n * Organized as: Env -> ChainId -> Address\n */\nexport const BTCB_ADAPTER_ADDRESSES: Record<Env, Partial<Record<ChainId, EvmAddress>>> = {\n [Env.dev]: {\n 43113: '0x0a65c37d07c32e5ea8ea40495b7f249cde26935e',\n },\n [Env.ibc]: {\n 43113: '0x1391f9ac408cf13214ddb71d359002658eaf9ebb',\n },\n [Env.stage]: {\n 43113: '0x0a65c37d07c32e5ea8ea40495b7f249cde26935e',\n },\n [Env.testnet]: {\n 43113: '0x41bcd71e7c92b1c8dde53037f9b2c4aa2058b1cb',\n },\n [Env.prod]: {\n 43114: '0x85d1d52e11290f174444d21c2a167bedbe36e4d2',\n },\n};\n"],"mappings":"2GAMA,MAAa,EAAqB,OAMrB,EAAyB,EAGzB,EAAyB,EAGzB,EAAoC,EAC9C,EAAY,KAAM,EAAI,KACtB,EAAY,MAAO,EAAI,KACvB,EAAY,MAAO,EAAI,KACzB,CAGY,EAAiC,OAOjC,EACX,uKAEW,EAAgC,CAC3C,KAAM,EAAU,OAChB,KAAM,UACN,OAAQ,MACR,SAAU,EACV,QAAS,gGACV,CAOY,EAAoE,EAC9E,EAAI,KAAM,CACT,MAAO,6CACR,EACA,EAAI,KAAM,CACT,MAAO,6CACR,EACA,EAAI,OAAQ,CACX,MAAO,6CACR,EACA,EAAI,SAAU,CACb,MAAO,6CACR,EACA,EAAI,MAAO,CACV,MAAO,6CACR,CACF,CASY,EAA4E,EACtF,EAAI,KAAM,CACT,MAAO,6CACR,EACA,EAAI,KAAM,CACT,MAAO,6CACR,EACA,EAAI,OAAQ,CACX,MAAO,6CACR,EACA,EAAI,SAAU,CACb,MAAO,6CACR,EACA,EAAI,MAAO,CACV,MAAO,6CACR,CACF"}
@@ -1,2 +1,2 @@
1
- const e=require(`../../errors.cjs`),t=require(`../fetch-utilities.cjs`),n=require(`./_schema.cjs`);function r(e){if(e)return{Authorization:`Bearer ${e}`}}async function i({apiBaseUrl:i,apiToken:a,fetch:o}){let s=`/info/chains`,c=await t.fetchJson(t.combineUrlPathnames(i,s),{headers:r(a),fetch:o}),l=n.SupportedChainsResponseSchema.safeParse(c);if(!l.success)throw new e.ResponseValidationError(`Invalid response from Markr "${s}" endpoint.`,l.error.issues);return l.data}async function a({apiBaseUrl:i,apiToken:a,fetch:o},s){let c=`/tokens/${s}/list`,l=await t.fetchJson(t.combineUrlPathnames(i,c),{headers:r(a),fetch:o}),u=n.TokenListResponseSchema.safeParse(l);if(!u.success)throw new e.ResponseValidationError(`Invalid response from Markr "${c}" endpoint.`,u.error.issues);return u.data}async function o({apiBaseUrl:i,apiToken:a,fetch:o},s,{onDone:c,onError:l,onQuote:u,signal:d}){let f=`/quote`,p=t.combineUrlPathnames(i,f),m=[];try{for await(let i of t.fetchEventStream(p,{body:JSON.stringify(s),fetch:o,headers:r(a),signal:d})){let t=n.QuoteResponseSchema.safeParse(JSON.parse(i.data));if(!t.success){l(new e.ResponseValidationError(`Invalid quote data received from Markr "${f}" endpoint.`,t.error.issues));continue}`done`in t.data?c():(u(t.data),m.push(t.data))}}catch(e){e instanceof Error?l(e):l(Error(`An unknown error occurred during the quote stream.`,{cause:e})),c()}return m}async function s({apiBaseUrl:i,apiToken:a,fetch:o},s){let c=`/swap`,l=await t.fetchJson(t.combineUrlPathnames(i,c),{body:JSON.stringify(s),fetch:o,headers:r(a),method:`POST`}),u=n.SwapResponseSchema.safeParse(l);if(!u.success)throw new e.ResponseValidationError(`Invalid response from Markr "${c}" endpoint.`,u.error.issues);return u.data}async function c({apiBaseUrl:i,apiToken:a,fetch:o}){let s=`/info/partner`,c=await t.fetchJson(t.combineUrlPathnames(i,s),{headers:r(a),fetch:o}),l=n.PartnerInfoResponseSchema.safeParse(c);if(!l.success)throw new e.ResponseValidationError(`Invalid response from Markr "${s}" endpoint.`,l.error.issues);return l.data}async function l({apiBaseUrl:i,apiToken:a,fetch:o},s,{signal:c}={}){let l=`/cross-chain/status/${s}`,u=await t.fetchJson(t.combineUrlPathnames(i,l),{headers:r(a),fetch:o,retries:10,retryOn(t){let n=(t.init.method??`GET`).toUpperCase();if(![`GET`,`HEAD`,`OPTIONS`,`TRACE`].includes(n))return!1;if(t.error)return!(t.error instanceof e.AbortedError);let r=t.response?.status??0;return r===404||r===408||r===425||r===429||r>=500&&r<=599},signal:c}),d=n.CrossChainStatusResponseSchema.safeParse(u);if(!d.success)throw new e.ResponseValidationError(`Invalid response from Markr "${l}" endpoint.`,d.error.issues,u);return d.data}async function u({apiBaseUrl:i,apiToken:a,fetch:o},{chainId:s,crossChainSwap:c,quoteId:l}){let u=`/spender-address?chainId=${s}&cross=${c?`true`:`false`}&uuid=${l}`,d=await t.fetchJson(t.combineUrlPathnames(i,u),{headers:r(a),fetch:o}),f=n.SpenderAddressResponseSchema.safeParse(d);if(!f.success)throw new e.ResponseValidationError(`Invalid response from Markr "${u}" endpoint.`,f.error.issues);return f.data}exports.markrGetCrossChainStatus=l,exports.markrGetInfoChains=i,exports.markrGetPartnerInfo=c,exports.markrGetSpenderAddress=u,exports.markrGetTokenList=a,exports.markrStreamQuote=o,exports.markrSwap=s;
1
+ const e=require(`../../errors.cjs`),t=require(`./_schema.cjs`),n=require(`../fetch-utilities.cjs`);function r(e){if(e)return{Authorization:`Bearer ${e}`}}async function i({apiBaseUrl:i,apiToken:a,fetch:o}){let s=`/info/chains`,c=await n.fetchJson(n.combineUrlPathnames(i,s),{headers:r(a),fetch:o}),l=t.SupportedChainsResponseSchema.safeParse(c);if(!l.success)throw new e.ResponseValidationError(`Invalid response from Markr "${s}" endpoint.`,l.error.issues);return l.data}async function a({apiBaseUrl:i,apiToken:a,fetch:o},s){let c=`/tokens/${s}/list`,l=await n.fetchJson(n.combineUrlPathnames(i,c),{headers:r(a),fetch:o}),u=t.TokenListResponseSchema.safeParse(l);if(!u.success)throw new e.ResponseValidationError(`Invalid response from Markr "${c}" endpoint.`,u.error.issues);return u.data}async function o({apiBaseUrl:i,apiToken:a,fetch:o},s,{onDone:c,onError:l,onQuote:u,signal:d}){let f=`/quote`,p=n.combineUrlPathnames(i,f),m=[];try{for await(let i of n.fetchEventStream(p,{body:JSON.stringify(s),fetch:o,headers:r(a),signal:d})){let n=t.QuoteResponseSchema.safeParse(JSON.parse(i.data));if(!n.success){l(new e.ResponseValidationError(`Invalid quote data received from Markr "${f}" endpoint.`,n.error.issues));continue}`done`in n.data?c():(u(n.data),m.push(n.data))}}catch(e){e instanceof Error?l(e):l(Error(`An unknown error occurred during the quote stream.`,{cause:e})),c()}return m}async function s({apiBaseUrl:i,apiToken:a,fetch:o},s){let c=`/swap`,l=await n.fetchJson(n.combineUrlPathnames(i,c),{body:JSON.stringify(s),fetch:o,headers:r(a),method:`POST`}),u=t.SwapResponseSchema.safeParse(l);if(!u.success)throw new e.ResponseValidationError(`Invalid response from Markr "${c}" endpoint.`,u.error.issues);return u.data}async function c({apiBaseUrl:i,apiToken:a,fetch:o}){let s=`/info/partner`,c=await n.fetchJson(n.combineUrlPathnames(i,s),{headers:r(a),fetch:o}),l=t.PartnerInfoResponseSchema.safeParse(c);if(!l.success)throw new e.ResponseValidationError(`Invalid response from Markr "${s}" endpoint.`,l.error.issues);return l.data}async function l({apiBaseUrl:i,apiToken:a,fetch:o},s,{signal:c}={}){let l=`/cross-chain/status/${s}`,u=await n.fetchJson(n.combineUrlPathnames(i,l),{headers:r(a),fetch:o,retries:10,retryOn(t){let n=(t.init.method??`GET`).toUpperCase();if(![`GET`,`HEAD`,`OPTIONS`,`TRACE`].includes(n))return!1;if(t.error)return!(t.error instanceof e.AbortedError);let r=t.response?.status??0;return r===404||r===408||r===425||r===429||r>=500&&r<=599},signal:c}),d=t.CrossChainStatusResponseSchema.safeParse(u);if(!d.success)throw new e.ResponseValidationError(`Invalid response from Markr "${l}" endpoint.`,d.error.issues,u);return d.data}async function u({apiBaseUrl:i,apiToken:a,fetch:o},{chainId:s,crossChainSwap:c,quoteId:l}){let u=`/spender-address?chainId=${s}&cross=${c?`true`:`false`}&uuid=${l}`,d=await n.fetchJson(n.combineUrlPathnames(i,u),{headers:r(a),fetch:o}),f=t.SpenderAddressResponseSchema.safeParse(d);if(!f.success)throw new e.ResponseValidationError(`Invalid response from Markr "${u}" endpoint.`,f.error.issues);return f.data}exports.markrGetCrossChainStatus=l,exports.markrGetInfoChains=i,exports.markrGetPartnerInfo=c,exports.markrGetSpenderAddress=u,exports.markrGetTokenList=a,exports.markrStreamQuote=o,exports.markrSwap=s;
2
2
  //# sourceMappingURL=_api.cjs.map
@@ -1,2 +1,2 @@
1
- import{AbortedError as e,ResponseValidationError as t}from"../../errors.js";import{combineUrlPathnames as n,fetchEventStream as r,fetchJson as i}from"../fetch-utilities.js";import{CrossChainStatusResponseSchema as a,PartnerInfoResponseSchema as o,QuoteResponseSchema as s,SpenderAddressResponseSchema as c,SupportedChainsResponseSchema as l,SwapResponseSchema as u,TokenListResponseSchema as d}from"./_schema.js";function f(e){if(e)return{Authorization:`Bearer ${e}`}}async function p({apiBaseUrl:e,apiToken:r,fetch:a}){let o=`/info/chains`,s=await i(n(e,o),{headers:f(r),fetch:a}),c=l.safeParse(s);if(!c.success)throw new t(`Invalid response from Markr "${o}" endpoint.`,c.error.issues);return c.data}async function m({apiBaseUrl:e,apiToken:r,fetch:a},o){let s=`/tokens/${o}/list`,c=await i(n(e,s),{headers:f(r),fetch:a}),l=d.safeParse(c);if(!l.success)throw new t(`Invalid response from Markr "${s}" endpoint.`,l.error.issues);return l.data}async function h({apiBaseUrl:e,apiToken:i,fetch:a},o,{onDone:c,onError:l,onQuote:u,signal:d}){let p=`/quote`,m=n(e,p),h=[];try{for await(let e of r(m,{body:JSON.stringify(o),fetch:a,headers:f(i),signal:d})){let n=s.safeParse(JSON.parse(e.data));if(!n.success){l(new t(`Invalid quote data received from Markr "${p}" endpoint.`,n.error.issues));continue}`done`in n.data?c():(u(n.data),h.push(n.data))}}catch(e){e instanceof Error?l(e):l(Error(`An unknown error occurred during the quote stream.`,{cause:e})),c()}return h}async function g({apiBaseUrl:e,apiToken:r,fetch:a},o){let s=`/swap`,c=await i(n(e,s),{body:JSON.stringify(o),fetch:a,headers:f(r),method:`POST`}),l=u.safeParse(c);if(!l.success)throw new t(`Invalid response from Markr "${s}" endpoint.`,l.error.issues);return l.data}async function _({apiBaseUrl:e,apiToken:r,fetch:a}){let s=`/info/partner`,c=await i(n(e,s),{headers:f(r),fetch:a}),l=o.safeParse(c);if(!l.success)throw new t(`Invalid response from Markr "${s}" endpoint.`,l.error.issues);return l.data}async function v({apiBaseUrl:r,apiToken:o,fetch:s},c,{signal:l}={}){let u=`/cross-chain/status/${c}`,d=await i(n(r,u),{headers:f(o),fetch:s,retries:10,retryOn(t){let n=(t.init.method??`GET`).toUpperCase();if(![`GET`,`HEAD`,`OPTIONS`,`TRACE`].includes(n))return!1;if(t.error)return!(t.error instanceof e);let r=t.response?.status??0;return r===404||r===408||r===425||r===429||r>=500&&r<=599},signal:l}),p=a.safeParse(d);if(!p.success)throw new t(`Invalid response from Markr "${u}" endpoint.`,p.error.issues,d);return p.data}async function y({apiBaseUrl:e,apiToken:r,fetch:a},{chainId:o,crossChainSwap:s,quoteId:l}){let u=`/spender-address?chainId=${o}&cross=${s?`true`:`false`}&uuid=${l}`,d=await i(n(e,u),{headers:f(r),fetch:a}),p=c.safeParse(d);if(!p.success)throw new t(`Invalid response from Markr "${u}" endpoint.`,p.error.issues);return p.data}export{v as markrGetCrossChainStatus,p as markrGetInfoChains,_ as markrGetPartnerInfo,y as markrGetSpenderAddress,m as markrGetTokenList,h as markrStreamQuote,g as markrSwap};
1
+ import{AbortedError as e,ResponseValidationError as t}from"../../errors.js";import{CrossChainStatusResponseSchema as n,PartnerInfoResponseSchema as r,QuoteResponseSchema as i,SpenderAddressResponseSchema as a,SupportedChainsResponseSchema as o,SwapResponseSchema as s,TokenListResponseSchema as c}from"./_schema.js";import{combineUrlPathnames as l,fetchEventStream as u,fetchJson as d}from"../fetch-utilities.js";function f(e){if(e)return{Authorization:`Bearer ${e}`}}async function p({apiBaseUrl:e,apiToken:n,fetch:r}){let i=`/info/chains`,a=await d(l(e,i),{headers:f(n),fetch:r}),s=o.safeParse(a);if(!s.success)throw new t(`Invalid response from Markr "${i}" endpoint.`,s.error.issues);return s.data}async function m({apiBaseUrl:e,apiToken:n,fetch:r},i){let a=`/tokens/${i}/list`,o=await d(l(e,a),{headers:f(n),fetch:r}),s=c.safeParse(o);if(!s.success)throw new t(`Invalid response from Markr "${a}" endpoint.`,s.error.issues);return s.data}async function h({apiBaseUrl:e,apiToken:n,fetch:r},a,{onDone:o,onError:s,onQuote:c,signal:d}){let p=`/quote`,m=l(e,p),h=[];try{for await(let e of u(m,{body:JSON.stringify(a),fetch:r,headers:f(n),signal:d})){let n=i.safeParse(JSON.parse(e.data));if(!n.success){s(new t(`Invalid quote data received from Markr "${p}" endpoint.`,n.error.issues));continue}`done`in n.data?o():(c(n.data),h.push(n.data))}}catch(e){e instanceof Error?s(e):s(Error(`An unknown error occurred during the quote stream.`,{cause:e})),o()}return h}async function g({apiBaseUrl:e,apiToken:n,fetch:r},i){let a=`/swap`,o=await d(l(e,a),{body:JSON.stringify(i),fetch:r,headers:f(n),method:`POST`}),c=s.safeParse(o);if(!c.success)throw new t(`Invalid response from Markr "${a}" endpoint.`,c.error.issues);return c.data}async function _({apiBaseUrl:e,apiToken:n,fetch:i}){let a=`/info/partner`,o=await d(l(e,a),{headers:f(n),fetch:i}),s=r.safeParse(o);if(!s.success)throw new t(`Invalid response from Markr "${a}" endpoint.`,s.error.issues);return s.data}async function v({apiBaseUrl:r,apiToken:i,fetch:a},o,{signal:s}={}){let c=`/cross-chain/status/${o}`,u=await d(l(r,c),{headers:f(i),fetch:a,retries:10,retryOn(t){let n=(t.init.method??`GET`).toUpperCase();if(![`GET`,`HEAD`,`OPTIONS`,`TRACE`].includes(n))return!1;if(t.error)return!(t.error instanceof e);let r=t.response?.status??0;return r===404||r===408||r===425||r===429||r>=500&&r<=599},signal:s}),p=n.safeParse(u);if(!p.success)throw new t(`Invalid response from Markr "${c}" endpoint.`,p.error.issues,u);return p.data}async function y({apiBaseUrl:e,apiToken:n,fetch:r},{chainId:i,crossChainSwap:o,quoteId:s}){let c=`/spender-address?chainId=${i}&cross=${o?`true`:`false`}&uuid=${s}`,u=await d(l(e,c),{headers:f(n),fetch:r}),p=a.safeParse(u);if(!p.success)throw new t(`Invalid response from Markr "${c}" endpoint.`,p.error.issues);return p.data}export{v as markrGetCrossChainStatus,p as markrGetInfoChains,_ as markrGetPartnerInfo,y as markrGetSpenderAddress,m as markrGetTokenList,h as markrStreamQuote,g as markrSwap};
2
2
  //# sourceMappingURL=_api.js.map
@@ -1,2 +1,2 @@
1
- const e=require(`../../../constants.cjs`);function t({hasSolanaSigner:t,supportedChains:n}){return({sourceAsset:r,sourceChainId:i,targetAsset:a,targetChainId:o})=>{let s=r.type===e.TokenType.NATIVE||r.type===e.TokenType.ERC20||r.type===e.TokenType.SPL&&t,c=a.type===e.TokenType.NATIVE||a.type===e.TokenType.ERC20||a.type===e.TokenType.SPL&&t;if(!s||!c)return!1;let l=n.get(i),u=n.get(o);return!l||!u?!1:i===o?l.swapEnabled:l.crossChainSwapEnabled&&l.crossChainTargetChainIds.has(o)}}exports.analyzeSupportFactory=t;
1
+ const e=require(`../../../constants.cjs`),t=require(`../_utils.cjs`);function n({hasSolanaSigner:n,supportedChains:r}){return({sourceAsset:i,sourceChainId:a,targetAsset:o,targetChainId:s})=>{let c=i.type===e.TokenType.NATIVE||i.type===e.TokenType.ERC20||i.type===e.TokenType.SPL&&n,l=o.type===e.TokenType.NATIVE||o.type===e.TokenType.ERC20||o.type===e.TokenType.SPL&&n;return!c||!l?!1:t.isRouteSupported(r,a,s)}}exports.analyzeSupportFactory=n;
2
2
  //# sourceMappingURL=analyze-support.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"analyze-support.cjs","names":["TokenType"],"sources":["../../../../src/transfer-service/markr/_handlers/analyze-support.ts"],"sourcesContent":["import { TokenType } from '../../../constants';\nimport type { TransferService } from '../../../types/service';\nimport type { SupportedChainsMap } from '../_utils';\n\nexport interface AnalyzeSupportFactoryConfig {\n hasSolanaSigner: boolean;\n supportedChains: SupportedChainsMap;\n}\n\nexport function analyzeSupportFactory({\n hasSolanaSigner,\n supportedChains,\n}: AnalyzeSupportFactoryConfig): TransferService['analyzeSupport'] {\n return ({ sourceAsset, sourceChainId, targetAsset, targetChainId }) => {\n const validSourceAssetType =\n sourceAsset.type === TokenType.NATIVE ||\n sourceAsset.type === TokenType.ERC20 ||\n (sourceAsset.type === TokenType.SPL && hasSolanaSigner);\n const validTargetAssetType =\n targetAsset.type === TokenType.NATIVE ||\n targetAsset.type === TokenType.ERC20 ||\n (targetAsset.type === TokenType.SPL && hasSolanaSigner);\n\n if (!validSourceAssetType || !validTargetAssetType) {\n return false;\n }\n\n const supportedSourceChain = supportedChains.get(sourceChainId);\n const supportedTargetChain = supportedChains.get(targetChainId);\n\n // Validate chains are supported.\n if (!supportedSourceChain || !supportedTargetChain) {\n return false;\n }\n\n // Validate same-chain swaps are supported if source and target chains are the same.\n if (sourceChainId === targetChainId) {\n return supportedSourceChain.swapEnabled;\n }\n\n // Validate cross-chain swaps are supported for the explicit source -> target route.\n return (\n supportedSourceChain.crossChainSwapEnabled && supportedSourceChain.crossChainTargetChainIds.has(targetChainId)\n );\n };\n}\n"],"mappings":"0CASA,SAAgB,EAAsB,CACpC,kBACA,mBACiE,CACjE,OAAQ,CAAE,cAAa,gBAAe,cAAa,mBAAoB,CACrE,IAAM,EACJ,EAAY,OAASA,EAAAA,UAAU,QAC/B,EAAY,OAASA,EAAAA,UAAU,OAC9B,EAAY,OAASA,EAAAA,UAAU,KAAO,EACnC,EACJ,EAAY,OAASA,EAAAA,UAAU,QAC/B,EAAY,OAASA,EAAAA,UAAU,OAC9B,EAAY,OAASA,EAAAA,UAAU,KAAO,EAEzC,GAAI,CAAC,GAAwB,CAAC,EAC5B,MAAO,GAGT,IAAM,EAAuB,EAAgB,IAAI,EAAc,CACzD,EAAuB,EAAgB,IAAI,EAAc,CAa/D,MAVI,CAAC,GAAwB,CAAC,EACrB,GAIL,IAAkB,EACb,EAAqB,YAK5B,EAAqB,uBAAyB,EAAqB,yBAAyB,IAAI,EAAc"}
1
+ {"version":3,"file":"analyze-support.cjs","names":["TokenType","isRouteSupported"],"sources":["../../../../src/transfer-service/markr/_handlers/analyze-support.ts"],"sourcesContent":["import { TokenType } from '../../../constants';\nimport type { TransferService } from '../../../types/service';\nimport { isRouteSupported, type SupportedChainsMap } from '../_utils';\n\nexport interface AnalyzeSupportFactoryConfig {\n hasSolanaSigner: boolean;\n supportedChains: SupportedChainsMap;\n}\n\nexport function analyzeSupportFactory({\n hasSolanaSigner,\n supportedChains,\n}: AnalyzeSupportFactoryConfig): TransferService['analyzeSupport'] {\n return ({ sourceAsset, sourceChainId, targetAsset, targetChainId }) => {\n const validSourceAssetType =\n sourceAsset.type === TokenType.NATIVE ||\n sourceAsset.type === TokenType.ERC20 ||\n (sourceAsset.type === TokenType.SPL && hasSolanaSigner);\n const validTargetAssetType =\n targetAsset.type === TokenType.NATIVE ||\n targetAsset.type === TokenType.ERC20 ||\n (targetAsset.type === TokenType.SPL && hasSolanaSigner);\n\n if (!validSourceAssetType || !validTargetAssetType) {\n return false;\n }\n\n return isRouteSupported(supportedChains, sourceChainId, targetChainId);\n };\n}\n"],"mappings":"qEASA,SAAgB,EAAsB,CACpC,kBACA,mBACiE,CACjE,OAAQ,CAAE,cAAa,gBAAe,cAAa,mBAAoB,CACrE,IAAM,EACJ,EAAY,OAASA,EAAAA,UAAU,QAC/B,EAAY,OAASA,EAAAA,UAAU,OAC9B,EAAY,OAASA,EAAAA,UAAU,KAAO,EACnC,EACJ,EAAY,OAASA,EAAAA,UAAU,QAC/B,EAAY,OAASA,EAAAA,UAAU,OAC9B,EAAY,OAASA,EAAAA,UAAU,KAAO,EAMzC,MAJI,CAAC,GAAwB,CAAC,EACrB,GAGFC,EAAAA,iBAAiB,EAAiB,EAAe,EAAc"}
@@ -1,2 +1,2 @@
1
- import{TokenType as e}from"../../../constants.js";function t({hasSolanaSigner:t,supportedChains:n}){return({sourceAsset:r,sourceChainId:i,targetAsset:a,targetChainId:o})=>{let s=r.type===e.NATIVE||r.type===e.ERC20||r.type===e.SPL&&t,c=a.type===e.NATIVE||a.type===e.ERC20||a.type===e.SPL&&t;if(!s||!c)return!1;let l=n.get(i),u=n.get(o);return!l||!u?!1:i===o?l.swapEnabled:l.crossChainSwapEnabled&&l.crossChainTargetChainIds.has(o)}}export{t as analyzeSupportFactory};
1
+ import{TokenType as e}from"../../../constants.js";import{isRouteSupported as t}from"../_utils.js";function n({hasSolanaSigner:n,supportedChains:r}){return({sourceAsset:i,sourceChainId:a,targetAsset:o,targetChainId:s})=>{let c=i.type===e.NATIVE||i.type===e.ERC20||i.type===e.SPL&&n,l=o.type===e.NATIVE||o.type===e.ERC20||o.type===e.SPL&&n;return!c||!l?!1:t(r,a,s)}}export{n as analyzeSupportFactory};
2
2
  //# sourceMappingURL=analyze-support.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"analyze-support.js","names":[],"sources":["../../../../src/transfer-service/markr/_handlers/analyze-support.ts"],"sourcesContent":["import { TokenType } from '../../../constants';\nimport type { TransferService } from '../../../types/service';\nimport type { SupportedChainsMap } from '../_utils';\n\nexport interface AnalyzeSupportFactoryConfig {\n hasSolanaSigner: boolean;\n supportedChains: SupportedChainsMap;\n}\n\nexport function analyzeSupportFactory({\n hasSolanaSigner,\n supportedChains,\n}: AnalyzeSupportFactoryConfig): TransferService['analyzeSupport'] {\n return ({ sourceAsset, sourceChainId, targetAsset, targetChainId }) => {\n const validSourceAssetType =\n sourceAsset.type === TokenType.NATIVE ||\n sourceAsset.type === TokenType.ERC20 ||\n (sourceAsset.type === TokenType.SPL && hasSolanaSigner);\n const validTargetAssetType =\n targetAsset.type === TokenType.NATIVE ||\n targetAsset.type === TokenType.ERC20 ||\n (targetAsset.type === TokenType.SPL && hasSolanaSigner);\n\n if (!validSourceAssetType || !validTargetAssetType) {\n return false;\n }\n\n const supportedSourceChain = supportedChains.get(sourceChainId);\n const supportedTargetChain = supportedChains.get(targetChainId);\n\n // Validate chains are supported.\n if (!supportedSourceChain || !supportedTargetChain) {\n return false;\n }\n\n // Validate same-chain swaps are supported if source and target chains are the same.\n if (sourceChainId === targetChainId) {\n return supportedSourceChain.swapEnabled;\n }\n\n // Validate cross-chain swaps are supported for the explicit source -> target route.\n return (\n supportedSourceChain.crossChainSwapEnabled && supportedSourceChain.crossChainTargetChainIds.has(targetChainId)\n );\n };\n}\n"],"mappings":"kDASA,SAAgB,EAAsB,CACpC,kBACA,mBACiE,CACjE,OAAQ,CAAE,cAAa,gBAAe,cAAa,mBAAoB,CACrE,IAAM,EACJ,EAAY,OAAS,EAAU,QAC/B,EAAY,OAAS,EAAU,OAC9B,EAAY,OAAS,EAAU,KAAO,EACnC,EACJ,EAAY,OAAS,EAAU,QAC/B,EAAY,OAAS,EAAU,OAC9B,EAAY,OAAS,EAAU,KAAO,EAEzC,GAAI,CAAC,GAAwB,CAAC,EAC5B,MAAO,GAGT,IAAM,EAAuB,EAAgB,IAAI,EAAc,CACzD,EAAuB,EAAgB,IAAI,EAAc,CAa/D,MAVI,CAAC,GAAwB,CAAC,EACrB,GAIL,IAAkB,EACb,EAAqB,YAK5B,EAAqB,uBAAyB,EAAqB,yBAAyB,IAAI,EAAc"}
1
+ {"version":3,"file":"analyze-support.js","names":[],"sources":["../../../../src/transfer-service/markr/_handlers/analyze-support.ts"],"sourcesContent":["import { TokenType } from '../../../constants';\nimport type { TransferService } from '../../../types/service';\nimport { isRouteSupported, type SupportedChainsMap } from '../_utils';\n\nexport interface AnalyzeSupportFactoryConfig {\n hasSolanaSigner: boolean;\n supportedChains: SupportedChainsMap;\n}\n\nexport function analyzeSupportFactory({\n hasSolanaSigner,\n supportedChains,\n}: AnalyzeSupportFactoryConfig): TransferService['analyzeSupport'] {\n return ({ sourceAsset, sourceChainId, targetAsset, targetChainId }) => {\n const validSourceAssetType =\n sourceAsset.type === TokenType.NATIVE ||\n sourceAsset.type === TokenType.ERC20 ||\n (sourceAsset.type === TokenType.SPL && hasSolanaSigner);\n const validTargetAssetType =\n targetAsset.type === TokenType.NATIVE ||\n targetAsset.type === TokenType.ERC20 ||\n (targetAsset.type === TokenType.SPL && hasSolanaSigner);\n\n if (!validSourceAssetType || !validTargetAssetType) {\n return false;\n }\n\n return isRouteSupported(supportedChains, sourceChainId, targetChainId);\n };\n}\n"],"mappings":"kGASA,SAAgB,EAAsB,CACpC,kBACA,mBACiE,CACjE,OAAQ,CAAE,cAAa,gBAAe,cAAa,mBAAoB,CACrE,IAAM,EACJ,EAAY,OAAS,EAAU,QAC/B,EAAY,OAAS,EAAU,OAC9B,EAAY,OAAS,EAAU,KAAO,EACnC,EACJ,EAAY,OAAS,EAAU,QAC/B,EAAY,OAAS,EAAU,OAC9B,EAAY,OAAS,EAAU,KAAO,EAMzC,MAJI,CAAC,GAAwB,CAAC,EACrB,GAGF,EAAiB,EAAiB,EAAe,EAAc"}
@@ -0,0 +1,2 @@
1
+ const e=require(`../../../constants.cjs`),t=require(`../_utils.cjs`);function n({getTargetChainAssets:n,supportedChains:r}){return async({sourceChainId:i,targetChainId:a})=>t.isRouteSupported(r,i,a)?(await n(a)).map(t=>({...t,bridgeProviders:[e.ServiceType.MARKR]})):[]}exports.getBridgeableAssetsFactory=n;
2
+ //# sourceMappingURL=get-bridgeable-assets.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-bridgeable-assets.cjs","names":["isRouteSupported","ServiceType"],"sources":["../../../../src/transfer-service/markr/_handlers/get-bridgeable-assets.ts"],"sourcesContent":["import { ServiceType } from '../../../constants';\nimport type { Asset, BridgeableUiAsset } from '../../../types/asset';\nimport type { GetBridgeableAssetsProps, TransferService } from '../../../types/service';\nimport type { Caip2ChainId } from '../../../types/caip';\nimport { isRouteSupported, type SupportedChainsMap } from '../_utils';\n\nexport function getBridgeableAssetsFactory({\n getTargetChainAssets,\n supportedChains,\n}: {\n getTargetChainAssets: (targetChainId: Caip2ChainId) => Promise<readonly Asset[]>;\n supportedChains: SupportedChainsMap;\n}): TransferService['getBridgeableAssets'] {\n return async ({ sourceChainId, targetChainId }: GetBridgeableAssetsProps): Promise<readonly BridgeableUiAsset[]> => {\n if (!isRouteSupported(supportedChains, sourceChainId, targetChainId)) return [];\n\n const assets = await getTargetChainAssets(targetChainId);\n return assets.map((asset) => ({ ...asset, bridgeProviders: [ServiceType.MARKR] as const }));\n };\n}\n"],"mappings":"qEAMA,SAAgB,EAA2B,CACzC,uBACA,mBAIyC,CACzC,OAAO,MAAO,CAAE,gBAAe,mBACxBA,EAAAA,iBAAiB,EAAiB,EAAe,EAAc,EAErD,MAAM,EAAqB,EAAc,EAC1C,IAAK,IAAW,CAAE,GAAG,EAAO,gBAAiB,CAACC,EAAAA,YAAY,MAAM,CAAW,EAAE,CAHd,EAAE"}
@@ -0,0 +1,2 @@
1
+ import{ServiceType as e}from"../../../constants.js";import{isRouteSupported as t}from"../_utils.js";function n({getTargetChainAssets:n,supportedChains:r}){return async({sourceChainId:i,targetChainId:a})=>t(r,i,a)?(await n(a)).map(t=>({...t,bridgeProviders:[e.MARKR]})):[]}export{n as getBridgeableAssetsFactory};
2
+ //# sourceMappingURL=get-bridgeable-assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-bridgeable-assets.js","names":[],"sources":["../../../../src/transfer-service/markr/_handlers/get-bridgeable-assets.ts"],"sourcesContent":["import { ServiceType } from '../../../constants';\nimport type { Asset, BridgeableUiAsset } from '../../../types/asset';\nimport type { GetBridgeableAssetsProps, TransferService } from '../../../types/service';\nimport type { Caip2ChainId } from '../../../types/caip';\nimport { isRouteSupported, type SupportedChainsMap } from '../_utils';\n\nexport function getBridgeableAssetsFactory({\n getTargetChainAssets,\n supportedChains,\n}: {\n getTargetChainAssets: (targetChainId: Caip2ChainId) => Promise<readonly Asset[]>;\n supportedChains: SupportedChainsMap;\n}): TransferService['getBridgeableAssets'] {\n return async ({ sourceChainId, targetChainId }: GetBridgeableAssetsProps): Promise<readonly BridgeableUiAsset[]> => {\n if (!isRouteSupported(supportedChains, sourceChainId, targetChainId)) return [];\n\n const assets = await getTargetChainAssets(targetChainId);\n return assets.map((asset) => ({ ...asset, bridgeProviders: [ServiceType.MARKR] as const }));\n };\n}\n"],"mappings":"oGAMA,SAAgB,EAA2B,CACzC,uBACA,mBAIyC,CACzC,OAAO,MAAO,CAAE,gBAAe,mBACxB,EAAiB,EAAiB,EAAe,EAAc,EAErD,MAAM,EAAqB,EAAc,EAC1C,IAAK,IAAW,CAAE,GAAG,EAAO,gBAAiB,CAAC,EAAY,MAAM,CAAW,EAAE,CAHd,EAAE"}
@@ -1,2 +1,2 @@
1
- require(`../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../../errors.cjs`),t=require(`../../../_utils/chain.cjs`),n=require(`../../_utils.cjs`),r=require(`../_api.cjs`),i=require(`../../_tracking-utilities.cjs`),a=require(`../constants.cjs`);let o=require(`viem`),s=require(`@solana/kit`);const c=3e3;function l({apiOptions:e}){return({transfer:n,updateListener:r})=>n.sourceChain.chainId===n.targetChain.chainId?t.isSolanaNamespace(n.sourceChain.chainId)?u({transfer:n,updateListener:r}):i.trackSameChainEvmTransfer({transfer:n,updateListener:r}):f({transfer:n,updateListener:r},e)}function u({transfer:e,updateListener:t}){let n=new AbortController,r=()=>n.abort();return e.status===`source-pending`?{cancel:r,result:d(e,t,n.signal)}:{cancel:r,result:Promise.resolve(e)}}async function d(t,r,i){let{txHash:o}=t.source;try{(0,s.assertIsSignature)(o)}catch{let n={...t,errorCode:e.ErrorCode.INVALID_PARAMS,failedAtMs:Date.now(),status:`failed`};return r(n),n}let c=n.getSolanaRpcForChain({chain:t.sourceChain}),l=Date.now();for(;!i.aborted;){if(Date.now()-l>a.SOLANA_TX_TIMEOUT_MS){let n={...t,errorCode:e.ErrorCode.TIMEOUT,failedAtMs:Date.now(),status:`failed`};return r(n),n}try{let{value:s}=await c.getSignatureStatuses([o],{searchTransactionHistory:!0}).send(),l=s[0];if(!l){await n.waitForTimeoutOrAbort({timeoutMs:a.SOLANA_POLLING_INTERVAL_MS,signal:i});continue}if(l.err!==null){let n={...t,errorCode:e.ErrorCode.TRANSACTION_REVERTED,failedAtMs:Date.now(),status:`failed`};return r(n),n}if(l.confirmationStatus===`finalized`){let e={...t,completedAtMs:Date.now(),source:{...t.source,confirmationCount:t.source.requiredConfirmationCount},status:`completed`,target:null};return r(e),e}let u=Number(l.confirmations??0),d=Math.min(u,t.source.requiredConfirmationCount-1);d!==t.source.confirmationCount&&(t={...t,source:{...t.source,confirmationCount:d}},r(t)),await n.waitForTimeoutOrAbort({timeoutMs:a.SOLANA_POLLING_INTERVAL_MS,signal:i})}catch(e){let i={...t,errorCode:n.getErrorCodeForSolanaRpcError(e),failedAtMs:Date.now(),status:`failed`};return r(i),i}}return t}function f({transfer:e,updateListener:t},n){let r=new AbortController;return{cancel:()=>{r.abort()},result:(async()=>{let i=structuredClone(e);for(;!r.signal.aborted;){let e=await p(i,n,r.signal);if(r.signal.aborted)break;if(i=e,t(e),e.status===`completed`||e.status===`failed`)return e;await new Promise(e=>{let t=setTimeout(e,c);r.signal.addEventListener(`abort`,()=>clearTimeout(t),{once:!0})})}return i})()}}async function p(i,a,c){if(i.status===`completed`||i.status===`failed`)return i;if(!g(i.source.txHash,i.sourceChain.chainId))return{...i,errorCode:e.ErrorCode.INVALID_PARAMS,errorReason:`Invalid source transaction hash`,failedAtMs:Date.now(),status:`failed`};if(i.status===`source-pending`){if(t.isEvmNamespace(i.sourceChain.chainId)){let t=i.source.txHash;if(!(0,o.isHash)(t))return{...i,errorCode:e.ErrorCode.INVALID_PARAMS,errorReason:`Invalid source transaction hash`,failedAtMs:Date.now(),status:`failed`};let r=n.getEvmClientForChain({chain:i.sourceChain});try{let a=await n.awaitOrAbort(r.waitForTransactionReceipt({hash:t}),c);if(a.status===`aborted`)return i;let o=a.value;return o.status===`reverted`?{...i,errorCode:e.ErrorCode.TRANSACTION_REVERTED,errorReason:`Source transaction was reverted`,failedAtMs:Date.now(),status:`failed`}:(await m(r,o.blockNumber,c)).status===`aborted`?i:v(i)}catch(e){return{...i,errorCode:n.getErrorCodeForViemError(e),errorReason:`Failed to confirm source transaction finality`,failedAtMs:Date.now(),status:`failed`}}}if(t.isSolanaNamespace(i.sourceChain.chainId)){let t=i.source.txHash;try{(0,s.assertIsSignature)(t)}catch{return{...i,errorCode:e.ErrorCode.INVALID_PARAMS,errorReason:`Invalid source transaction hash`,failedAtMs:Date.now(),status:`failed`}}let n=await h(i.sourceChain,t,c);return n.status===`aborted`?i:n.status===`failed`?{...i,errorCode:n.errorCode,errorReason:`Failed to confirm source transaction finality`,failedAtMs:Date.now(),status:`failed`}:v(i)}}try{let t=await r.markrGetCrossChainStatus(a,i.source.txHash,{signal:c}),n=y(i,t);switch(t.status){case`failed`:return{...n,errorCode:e.ErrorCode.TRANSACTION_REVERTED,errorReason:`Transaction execution failed.`,failedAtMs:C(t),status:`failed`};case`pending`:return _(t.sourceChain.finalized)?v(n):n;case`committed`:case`pending_execution`:return b(n,t);case`completed`:return x(n,t);default:return S(n,t)}}catch(t){return console.error(`[Unified Asset Transfer] Error fetching cross-chain status from Markr API`,{error:t,now:Date.now()}),{...i,errorCode:e.ErrorCode.UNKNOWN,errorReason:`Failed to fetch cross-chain tx status`,failedAtMs:Date.now(),status:`failed`}}}async function m(e,t,r){for(;!r.aborted;){let i=await n.awaitOrAbort(e.getBlock({blockTag:`finalized`}),r);if(i.status===`aborted`)return{status:`aborted`};if(i.value.number>=t)return{status:`ok`};await n.waitForTimeoutOrAbort({timeoutMs:c,signal:r})}return{status:`aborted`}}async function h(t,r,i){let o=n.getSolanaRpcForChain({chain:t}),s=Date.now();for(;!i.aborted;){if(Date.now()-s>a.SOLANA_TX_TIMEOUT_MS)return{status:`failed`,errorCode:e.ErrorCode.TIMEOUT};try{let{value:t}=await o.getSignatureStatuses([r],{searchTransactionHistory:!0}).send(),s=t[0];if(!s){await n.waitForTimeoutOrAbort({timeoutMs:a.SOLANA_POLLING_INTERVAL_MS,signal:i});continue}if(s.err!==null)return{status:`failed`,errorCode:e.ErrorCode.TRANSACTION_REVERTED};if(s.confirmationStatus===`finalized`)return{status:`ok`};await n.waitForTimeoutOrAbort({timeoutMs:a.SOLANA_POLLING_INTERVAL_MS,signal:i})}catch(e){return{status:`failed`,errorCode:n.getErrorCodeForSolanaRpcError(e)}}}return{status:`aborted`}}function g(e,n){if(t.isEvmNamespace(n))return(0,o.isHash)(e);if(t.isSolanaNamespace(n))try{return(0,s.assertIsSignature)(e),!0}catch{return!1}return!1}function _(e){return e===!0||typeof e==`string`}function v(e){return{...e,source:{...e.source,confirmationCount:2,requiredConfirmationCount:2},status:`source-completed`}}function y(e,t){let n={...e.metadata??{}};return t.destinationChain.bridgeHash&&(n.bridgeHash=t.destinationChain.bridgeHash),t.debug&&(n.debug=t.debug),Object.keys(n).length===0?e:{...e,metadata:n}}function b(e,t){let{timestamp:n,transactionHash:r}=t.destinationChain;return{...e,source:{...e.source,confirmationCount:2,requiredConfirmationCount:2},status:`target-pending`,target:{confirmationCount:r?1:0,requiredConfirmationCount:2,startedAtMs:n?new Date(n).getTime():Date.now(),txHash:r??void 0}}}function x(e,t){let{timestamp:n,transactionHash:r}=t.destinationChain;return{...e,completedAtMs:C(t),status:`completed`,source:{...e.source,confirmationCount:2,requiredConfirmationCount:2},target:r?{txHash:r,confirmationCount:2,requiredConfirmationCount:2,startedAtMs:n?new Date(n).getTime():Date.now()}:null}}function S(e,t){return t.progress.executed===!0?x(e,t):t.progress.committed===!0?b(e,t):_(t.sourceChain.finalized)?v(e):{...e,source:{...e.source,confirmationCount:0,requiredConfirmationCount:2},status:`source-pending`}}function C(e){return e.destinationChain.finalized?new Date(e.destinationChain.finalized).getTime():e.destinationChain.timestamp?new Date(e.destinationChain.timestamp).getTime():e.sourceChain.finalized?typeof e.sourceChain.finalized==`boolean`&&e.sourceChain.finalized===!0?new Date(e.sourceChain.timestamp).getTime():new Date(e.sourceChain.finalized).getTime():new Date(e.sourceChain.timestamp).getTime()}exports.trackTransferFactory=l;
1
+ require(`../../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../../errors.cjs`),t=require(`../../../_utils/chain.cjs`),n=require(`../../_utils.cjs`),r=require(`../_api.cjs`),i=require(`../../_tracking-utilities.cjs`),a=require(`../constants.cjs`);let o=require(`viem`),s=require(`@solana/kit`);function c({apiOptions:e}){return({transfer:n,updateListener:r})=>n.sourceChain.chainId===n.targetChain.chainId?t.isSolanaNamespace(n.sourceChain.chainId)?l({transfer:n,updateListener:r}):i.trackSameChainEvmTransfer({transfer:n,updateListener:r}):d({transfer:n,updateListener:r},e)}function l({transfer:e,updateListener:t}){let n=new AbortController,r=()=>n.abort();return e.status===`source-pending`?{cancel:r,result:u(e,t,n.signal)}:{cancel:r,result:Promise.resolve(e)}}async function u(t,r,i){let{txHash:o}=t.source;try{(0,s.assertIsSignature)(o)}catch{let n={...t,errorCode:e.ErrorCode.INVALID_PARAMS,failedAtMs:Date.now(),status:`failed`};return r(n),n}let c=n.getSolanaRpcForChain({chain:t.sourceChain}),l=Date.now();for(;!i.aborted;){if(Date.now()-l>a.SOLANA_TX_TIMEOUT_MS){let n={...t,errorCode:e.ErrorCode.TIMEOUT,failedAtMs:Date.now(),status:`failed`};return r(n),n}try{let{value:s}=await c.getSignatureStatuses([o],{searchTransactionHistory:!0}).send(),l=s[0];if(!l){await n.waitForTimeoutOrAbort({timeoutMs:a.SOLANA_POLLING_INTERVAL_MS,signal:i});continue}if(l.err!==null){let n={...t,errorCode:e.ErrorCode.TRANSACTION_REVERTED,failedAtMs:Date.now(),status:`failed`};return r(n),n}if(l.confirmationStatus===`finalized`){let e={...t,completedAtMs:Date.now(),source:{...t.source,confirmationCount:t.source.requiredConfirmationCount},status:`completed`,target:null};return r(e),e}let u=Number(l.confirmations??0),d=Math.min(u,t.source.requiredConfirmationCount-1);d!==t.source.confirmationCount&&(t={...t,source:{...t.source,confirmationCount:d}},r(t)),await n.waitForTimeoutOrAbort({timeoutMs:a.SOLANA_POLLING_INTERVAL_MS,signal:i})}catch(e){let i={...t,errorCode:n.getErrorCodeForSolanaRpcError(e),failedAtMs:Date.now(),status:`failed`};return r(i),i}}return t}function d({transfer:e,updateListener:t},n){let r=new AbortController;return{cancel:()=>{r.abort()},result:(async()=>{let i=structuredClone(e);for(;!r.signal.aborted;){let e=await f(i,n,r.signal);if(r.signal.aborted)break;if(i=e,t(e),e.status===`completed`||e.status===`failed`)return e;let a=h(e);await new Promise(e=>{let t=setTimeout(e,a);r.signal.addEventListener(`abort`,()=>clearTimeout(t),{once:!0})})}return i})()}}async function f(i,a,c){if(i.status===`completed`||i.status===`failed`)return i;if(!b(i.source.txHash,i.sourceChain.chainId))return{...i,errorCode:e.ErrorCode.INVALID_PARAMS,errorReason:`Invalid source transaction hash`,failedAtMs:Date.now(),status:`failed`};if(i.status===`source-pending`){if(t.isEvmNamespace(i.sourceChain.chainId)){let t=i.source.txHash;if(!(0,o.isHash)(t))return{...i,errorCode:e.ErrorCode.INVALID_PARAMS,errorReason:`Invalid source transaction hash`,failedAtMs:Date.now(),status:`failed`};let r=n.getEvmClientForChain({chain:i.sourceChain});try{let a=await n.awaitOrAbort(r.waitForTransactionReceipt({hash:t}),c);if(a.status===`aborted`)return i;let o=a.value;return o.status===`reverted`?{...i,errorCode:e.ErrorCode.TRANSACTION_REVERTED,errorReason:`Source transaction was reverted`,failedAtMs:Date.now(),status:`failed`}:(await p(r,i.sourceChain.chainId,i.sourceChain.chainName,o.blockNumber,c)).status===`aborted`?i:S(i)}catch(e){return{...i,errorCode:n.getErrorCodeForViemError(e),errorReason:`Failed to confirm source transaction finality`,failedAtMs:Date.now(),status:`failed`}}}if(t.isSolanaNamespace(i.sourceChain.chainId)){let t=i.source.txHash;try{(0,s.assertIsSignature)(t)}catch{return{...i,errorCode:e.ErrorCode.INVALID_PARAMS,errorReason:`Invalid source transaction hash`,failedAtMs:Date.now(),status:`failed`}}let n=await y(i.sourceChain,t,c);return n.status===`aborted`?i:n.status===`failed`?{...i,errorCode:n.errorCode,errorReason:`Failed to confirm source transaction finality`,failedAtMs:Date.now(),status:`failed`}:S(i)}}try{let t=await r.markrGetCrossChainStatus(a,i.source.txHash,{signal:c}),n=C(i,t);switch(t.status){case`failed`:return{...n,errorCode:e.ErrorCode.TRANSACTION_REVERTED,errorReason:`Transaction execution failed.`,failedAtMs:D(t),status:`failed`};case`pending`:return x(t.sourceChain.finalized)?S(n):n;case`committed`:case`pending_execution`:return w(n,t);case`completed`:return T(n,t);default:return E(n,t)}}catch(t){return console.error(`[Unified Asset Transfer] Error fetching cross-chain status from Markr API`,{error:t,now:Date.now()}),{...i,errorCode:e.ErrorCode.UNKNOWN,errorReason:`Failed to fetch cross-chain tx status`,failedAtMs:Date.now(),status:`failed`}}}async function p(e,t,r,i,a){let o=m(t,r);for(;!a.aborted;){let t=await n.awaitOrAbort(e.getBlock({blockTag:`finalized`}),a);if(t.status===`aborted`)return{status:`aborted`};if(t.value.number>=i)return{status:`ok`};await n.waitForTimeoutOrAbort({timeoutMs:o,signal:a})}return{status:`aborted`}}function m(e,t){return a.CROSS_CHAIN_POLLING_INTERVAL_MS[v(g(e,t))]}function h(e){return e.status===`source-pending`?m(e.sourceChain.chainId,e.sourceChain.chainName):m(e.targetChain.chainId,e.targetChain.chainName)}function g(e,t){let n=a.FINALITY_MS_BY_CHAIN_ID[e];if(n!==void 0)return n;let r=_(t);return a.FINALITY_MS_BY_CHAIN_NAME_ALIAS.find(({aliases:e})=>e.some(e=>r.includes(e)))?.finalityMs}function _(e){return e.toLowerCase().replace(/[^a-z0-9]/g,``)}function v(e){return e===void 0?`medium`:e<=a.FINALITY_TIER_MAX_FINALITY_MS.fast?`fast`:e<=a.FINALITY_TIER_MAX_FINALITY_MS.medium?`medium`:e<=a.FINALITY_TIER_MAX_FINALITY_MS.slow?`slow`:`verySlow`}async function y(t,r,i){let o=n.getSolanaRpcForChain({chain:t}),s=Date.now();for(;!i.aborted;){if(Date.now()-s>a.SOLANA_TX_TIMEOUT_MS)return{status:`failed`,errorCode:e.ErrorCode.TIMEOUT};try{let{value:t}=await o.getSignatureStatuses([r],{searchTransactionHistory:!0}).send(),s=t[0];if(!s){await n.waitForTimeoutOrAbort({timeoutMs:a.SOLANA_POLLING_INTERVAL_MS,signal:i});continue}if(s.err!==null)return{status:`failed`,errorCode:e.ErrorCode.TRANSACTION_REVERTED};if(s.confirmationStatus===`finalized`)return{status:`ok`};await n.waitForTimeoutOrAbort({timeoutMs:a.SOLANA_POLLING_INTERVAL_MS,signal:i})}catch(e){return{status:`failed`,errorCode:n.getErrorCodeForSolanaRpcError(e)}}}return{status:`aborted`}}function b(e,n){if(t.isEvmNamespace(n))return(0,o.isHash)(e);if(t.isSolanaNamespace(n))try{return(0,s.assertIsSignature)(e),!0}catch{return!1}return!1}function x(e){return e===!0||typeof e==`string`}function S(e){return{...e,source:{...e.source,confirmationCount:2,requiredConfirmationCount:2},status:`source-completed`}}function C(e,t){let n={...e.metadata??{}};return t.destinationChain.bridgeHash&&(n.bridgeHash=t.destinationChain.bridgeHash),t.debug&&(n.debug=t.debug),Object.keys(n).length===0?e:{...e,metadata:n}}function w(e,t){let{timestamp:n,transactionHash:r}=t.destinationChain;return{...e,source:{...e.source,confirmationCount:2,requiredConfirmationCount:2},status:`target-pending`,target:{confirmationCount:r?1:0,requiredConfirmationCount:2,startedAtMs:n?new Date(n).getTime():Date.now(),txHash:r??void 0}}}function T(e,t){let{timestamp:n,transactionHash:r}=t.destinationChain;return{...e,completedAtMs:D(t),status:`completed`,source:{...e.source,confirmationCount:2,requiredConfirmationCount:2},target:r?{txHash:r,confirmationCount:2,requiredConfirmationCount:2,startedAtMs:n?new Date(n).getTime():Date.now()}:null}}function E(e,t){return t.progress.executed===!0?T(e,t):t.progress.committed===!0?w(e,t):x(t.sourceChain.finalized)?S(e):{...e,source:{...e.source,confirmationCount:0,requiredConfirmationCount:2},status:`source-pending`}}function D(e){return e.destinationChain.finalized?new Date(e.destinationChain.finalized).getTime():e.destinationChain.timestamp?new Date(e.destinationChain.timestamp).getTime():e.sourceChain.finalized?typeof e.sourceChain.finalized==`boolean`&&e.sourceChain.finalized===!0?new Date(e.sourceChain.timestamp).getTime():new Date(e.sourceChain.finalized).getTime():new Date(e.sourceChain.timestamp).getTime()}exports.trackTransferFactory=c;
2
2
  //# sourceMappingURL=track-transfer.cjs.map