@avalabs/fusion-sdk 0.28.1 → 0.28.2
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.
- package/dist/transfer-service/avalanche-evm/_handlers/get-assets.cjs +1 -1
- package/dist/transfer-service/avalanche-evm/_handlers/get-assets.cjs.map +1 -1
- package/dist/transfer-service/avalanche-evm/_handlers/get-assets.js +1 -1
- package/dist/transfer-service/avalanche-evm/_handlers/get-assets.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require(`../../../constants.cjs`),t=require(`../_constants.cjs`);function n({avalancheTokens:n,ethereumTokens:r,nativeTokenConfig:i}){return async()=>{let a=Object.values(r).reduce((t,n)=>{
|
|
1
|
+
const e=require(`../../../constants.cjs`),t=require(`../_constants.cjs`);function n({avalancheTokens:n,ethereumTokens:r,nativeTokenConfig:i}){return async()=>{let a=Object.values(r).reduce((t,n)=>{let r=n.chainId,i=n.target.chainId,a={...n.token,destinations:n.token.symbol===`USDC`?{}:{[i]:{address:n.target.tokenAddress,bridgeProviders:[e.ServiceType.AVALANCHE_EVM]}},swapProviders:[]},o=t[r]??[];return o.push(a),t[r]=o,t},{}),o=Object.values(n).reduce((t,n)=>{let r=n.chainId,i=n.target.chainId,a={...n.token,destinations:{[i]:{address:n.target.tokenAddress,bridgeProviders:[e.ServiceType.AVALANCHE_EVM]}},swapProviders:[]},o=t[r]??[];return o.push(a),t[r]=o,t},a),s=e.EthereumChainIds.MAINNET;o[s]&&o[s].push({...t.ETH_TOKEN,destinations:{[e.AvalancheChainIds.MAINNET]:{address:i.avalancheToken.token.address,bridgeProviders:[e.ServiceType.AVALANCHE_EVM]}},swapProviders:[]});let c=e.EthereumChainIds.SEPOLIA;return o[c]&&o[c].push({...t.ETH_TOKEN,destinations:{[e.AvalancheChainIds.FUJI]:{address:i.avalancheToken.token.address,bridgeProviders:[e.ServiceType.AVALANCHE_EVM]}},swapProviders:[]}),o}}exports.getAssetsFactory=n;
|
|
2
2
|
//# sourceMappingURL=get-assets.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-assets.cjs","names":["ServiceType","EthereumChainIds","ETH_TOKEN","AvalancheChainIds"],"sources":["../../../../src/transfer-service/avalanche-evm/_handlers/get-assets.ts"],"sourcesContent":["import { AvalancheChainIds, EthereumChainIds, ServiceType } from '../../../constants';\nimport type { ChainAssetMap } from '../../../types/asset';\nimport type { TransferService } from '../../../types/service';\nimport type { DeepMutable } from '../../../types/utility-types';\nimport { ETH_TOKEN } from '../_constants';\nimport type { AvalancheTokens, EthereumTokens } from '../_types';\n\nexport interface GetAssetsFactoryConfig {\n avalancheTokens: AvalancheTokens;\n ethereumTokens: EthereumTokens;\n nativeTokenConfig: {\n ethereumToken: EthereumTokens[keyof EthereumTokens];\n avalancheToken: AvalancheTokens[keyof AvalancheTokens];\n };\n}\n\nexport function getAssetsFactory({\n avalancheTokens,\n ethereumTokens,\n nativeTokenConfig,\n}: GetAssetsFactoryConfig): TransferService['getAssets'] {\n return async () => {\n const assetsWithEthTokens = Object.values(ethereumTokens).reduce((list, tokenConfig) => {\n
|
|
1
|
+
{"version":3,"file":"get-assets.cjs","names":["ServiceType","EthereumChainIds","ETH_TOKEN","AvalancheChainIds"],"sources":["../../../../src/transfer-service/avalanche-evm/_handlers/get-assets.ts"],"sourcesContent":["import { AvalancheChainIds, EthereumChainIds, ServiceType } from '../../../constants';\nimport type { ChainAssetMap } from '../../../types/asset';\nimport type { TransferService } from '../../../types/service';\nimport type { DeepMutable } from '../../../types/utility-types';\nimport { ETH_TOKEN } from '../_constants';\nimport type { AvalancheTokens, EthereumTokens } from '../_types';\n\nexport interface GetAssetsFactoryConfig {\n avalancheTokens: AvalancheTokens;\n ethereumTokens: EthereumTokens;\n nativeTokenConfig: {\n ethereumToken: EthereumTokens[keyof EthereumTokens];\n avalancheToken: AvalancheTokens[keyof AvalancheTokens];\n };\n}\n\nexport function getAssetsFactory({\n avalancheTokens,\n ethereumTokens,\n nativeTokenConfig,\n}: GetAssetsFactoryConfig): TransferService['getAssets'] {\n return async () => {\n const assetsWithEthTokens = Object.values(ethereumTokens).reduce((list, tokenConfig) => {\n const ethChainId = tokenConfig.chainId;\n const avaChainId = tokenConfig.target.chainId;\n\n // USDC onboarding goes through CCTP (to native USDC), so it gets no USDC.e destination.\n // It is still listed so that USDC.e -> USDC can resolve its target asset.\n const bridgeAsset = {\n ...tokenConfig.token,\n destinations:\n tokenConfig.token.symbol === 'USDC'\n ? {}\n : {\n [avaChainId]: {\n address: tokenConfig.target.tokenAddress,\n bridgeProviders: [ServiceType.AVALANCHE_EVM],\n },\n },\n swapProviders: [],\n };\n\n const currentList = list[ethChainId] ?? [];\n currentList.push(bridgeAsset);\n list[ethChainId] = currentList;\n\n return list;\n }, {} as DeepMutable<ChainAssetMap>);\n\n const allAssets = Object.values(avalancheTokens).reduce((list, tokenConfig) => {\n const avaChainId = tokenConfig.chainId;\n const ethChainId = tokenConfig.target.chainId;\n\n const bridgeAsset = {\n ...tokenConfig.token,\n destinations: {\n [ethChainId]: {\n address: tokenConfig.target.tokenAddress,\n bridgeProviders: [ServiceType.AVALANCHE_EVM],\n },\n },\n swapProviders: [],\n };\n\n const currentList = list[avaChainId] ?? [];\n currentList.push(bridgeAsset);\n list[avaChainId] = currentList;\n\n return list;\n }, assetsWithEthTokens);\n\n const homesteadKey = EthereumChainIds.MAINNET;\n if (allAssets[homesteadKey]) {\n allAssets[homesteadKey].push({\n ...ETH_TOKEN,\n destinations: {\n [AvalancheChainIds.MAINNET]: {\n // Native ETH on Ethereum maps to WETH.e on Avalanche\n address: nativeTokenConfig.avalancheToken.token.address,\n bridgeProviders: [ServiceType.AVALANCHE_EVM],\n },\n },\n swapProviders: [],\n });\n }\n\n const sepoliaKey = EthereumChainIds.SEPOLIA;\n if (allAssets[sepoliaKey]) {\n allAssets[sepoliaKey].push({\n ...ETH_TOKEN,\n destinations: {\n [AvalancheChainIds.FUJI]: {\n address: nativeTokenConfig.avalancheToken.token.address,\n bridgeProviders: [ServiceType.AVALANCHE_EVM],\n },\n },\n swapProviders: [],\n });\n }\n\n return allAssets as ChainAssetMap;\n };\n}\n"],"mappings":"yEAgBA,SAAgB,EAAiB,CAC/B,kBACA,iBACA,qBACuD,CACvD,OAAO,SAAY,CACjB,IAAM,EAAsB,OAAO,OAAO,EAAe,CAAC,QAAQ,EAAM,IAAgB,CACtF,IAAM,EAAa,EAAY,QACzB,EAAa,EAAY,OAAO,QAIhC,EAAc,CAClB,GAAG,EAAY,MACf,aACE,EAAY,MAAM,SAAW,OACzB,EAAE,CACF,EACG,GAAa,CACZ,QAAS,EAAY,OAAO,aAC5B,gBAAiB,CAACA,EAAAA,YAAY,cAAc,CAC7C,CACF,CACP,cAAe,EAAE,CAClB,CAEK,EAAc,EAAK,IAAe,EAAE,CAI1C,OAHA,EAAY,KAAK,EAAY,CAC7B,EAAK,GAAc,EAEZ,GACN,EAAE,CAA+B,CAE9B,EAAY,OAAO,OAAO,EAAgB,CAAC,QAAQ,EAAM,IAAgB,CAC7E,IAAM,EAAa,EAAY,QACzB,EAAa,EAAY,OAAO,QAEhC,EAAc,CAClB,GAAG,EAAY,MACf,aAAc,EACX,GAAa,CACZ,QAAS,EAAY,OAAO,aAC5B,gBAAiB,CAACA,EAAAA,YAAY,cAAc,CAC7C,CACF,CACD,cAAe,EAAE,CAClB,CAEK,EAAc,EAAK,IAAe,EAAE,CAI1C,OAHA,EAAY,KAAK,EAAY,CAC7B,EAAK,GAAc,EAEZ,GACN,EAAoB,CAEjB,EAAeC,EAAAA,iBAAiB,QAClC,EAAU,IACZ,EAAU,GAAc,KAAK,CAC3B,GAAGC,EAAAA,UACH,aAAc,EACXC,EAAAA,kBAAkB,SAAU,CAE3B,QAAS,EAAkB,eAAe,MAAM,QAChD,gBAAiB,CAACH,EAAAA,YAAY,cAAc,CAC7C,CACF,CACD,cAAe,EAAE,CAClB,CAAC,CAGJ,IAAM,EAAaC,EAAAA,iBAAiB,QAcpC,OAbI,EAAU,IACZ,EAAU,GAAY,KAAK,CACzB,GAAGC,EAAAA,UACH,aAAc,EACXC,EAAAA,kBAAkB,MAAO,CACxB,QAAS,EAAkB,eAAe,MAAM,QAChD,gBAAiB,CAACH,EAAAA,YAAY,cAAc,CAC7C,CACF,CACD,cAAe,EAAE,CAClB,CAAC,CAGG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{AvalancheChainIds as e,EthereumChainIds as t,ServiceType as n}from"../../../constants.js";import{ETH_TOKEN as r}from"../_constants.js";function i({avalancheTokens:i,ethereumTokens:a,nativeTokenConfig:o}){return async()=>{let s=Object.values(a).reduce((e,t)=>{
|
|
1
|
+
import{AvalancheChainIds as e,EthereumChainIds as t,ServiceType as n}from"../../../constants.js";import{ETH_TOKEN as r}from"../_constants.js";function i({avalancheTokens:i,ethereumTokens:a,nativeTokenConfig:o}){return async()=>{let s=Object.values(a).reduce((e,t)=>{let r=t.chainId,i=t.target.chainId,a={...t.token,destinations:t.token.symbol===`USDC`?{}:{[i]:{address:t.target.tokenAddress,bridgeProviders:[n.AVALANCHE_EVM]}},swapProviders:[]},o=e[r]??[];return o.push(a),e[r]=o,e},{}),c=Object.values(i).reduce((e,t)=>{let r=t.chainId,i=t.target.chainId,a={...t.token,destinations:{[i]:{address:t.target.tokenAddress,bridgeProviders:[n.AVALANCHE_EVM]}},swapProviders:[]},o=e[r]??[];return o.push(a),e[r]=o,e},s),l=t.MAINNET;c[l]&&c[l].push({...r,destinations:{[e.MAINNET]:{address:o.avalancheToken.token.address,bridgeProviders:[n.AVALANCHE_EVM]}},swapProviders:[]});let u=t.SEPOLIA;return c[u]&&c[u].push({...r,destinations:{[e.FUJI]:{address:o.avalancheToken.token.address,bridgeProviders:[n.AVALANCHE_EVM]}},swapProviders:[]}),c}}export{i as getAssetsFactory};
|
|
2
2
|
//# sourceMappingURL=get-assets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-assets.js","names":[],"sources":["../../../../src/transfer-service/avalanche-evm/_handlers/get-assets.ts"],"sourcesContent":["import { AvalancheChainIds, EthereumChainIds, ServiceType } from '../../../constants';\nimport type { ChainAssetMap } from '../../../types/asset';\nimport type { TransferService } from '../../../types/service';\nimport type { DeepMutable } from '../../../types/utility-types';\nimport { ETH_TOKEN } from '../_constants';\nimport type { AvalancheTokens, EthereumTokens } from '../_types';\n\nexport interface GetAssetsFactoryConfig {\n avalancheTokens: AvalancheTokens;\n ethereumTokens: EthereumTokens;\n nativeTokenConfig: {\n ethereumToken: EthereumTokens[keyof EthereumTokens];\n avalancheToken: AvalancheTokens[keyof AvalancheTokens];\n };\n}\n\nexport function getAssetsFactory({\n avalancheTokens,\n ethereumTokens,\n nativeTokenConfig,\n}: GetAssetsFactoryConfig): TransferService['getAssets'] {\n return async () => {\n const assetsWithEthTokens = Object.values(ethereumTokens).reduce((list, tokenConfig) => {\n
|
|
1
|
+
{"version":3,"file":"get-assets.js","names":[],"sources":["../../../../src/transfer-service/avalanche-evm/_handlers/get-assets.ts"],"sourcesContent":["import { AvalancheChainIds, EthereumChainIds, ServiceType } from '../../../constants';\nimport type { ChainAssetMap } from '../../../types/asset';\nimport type { TransferService } from '../../../types/service';\nimport type { DeepMutable } from '../../../types/utility-types';\nimport { ETH_TOKEN } from '../_constants';\nimport type { AvalancheTokens, EthereumTokens } from '../_types';\n\nexport interface GetAssetsFactoryConfig {\n avalancheTokens: AvalancheTokens;\n ethereumTokens: EthereumTokens;\n nativeTokenConfig: {\n ethereumToken: EthereumTokens[keyof EthereumTokens];\n avalancheToken: AvalancheTokens[keyof AvalancheTokens];\n };\n}\n\nexport function getAssetsFactory({\n avalancheTokens,\n ethereumTokens,\n nativeTokenConfig,\n}: GetAssetsFactoryConfig): TransferService['getAssets'] {\n return async () => {\n const assetsWithEthTokens = Object.values(ethereumTokens).reduce((list, tokenConfig) => {\n const ethChainId = tokenConfig.chainId;\n const avaChainId = tokenConfig.target.chainId;\n\n // USDC onboarding goes through CCTP (to native USDC), so it gets no USDC.e destination.\n // It is still listed so that USDC.e -> USDC can resolve its target asset.\n const bridgeAsset = {\n ...tokenConfig.token,\n destinations:\n tokenConfig.token.symbol === 'USDC'\n ? {}\n : {\n [avaChainId]: {\n address: tokenConfig.target.tokenAddress,\n bridgeProviders: [ServiceType.AVALANCHE_EVM],\n },\n },\n swapProviders: [],\n };\n\n const currentList = list[ethChainId] ?? [];\n currentList.push(bridgeAsset);\n list[ethChainId] = currentList;\n\n return list;\n }, {} as DeepMutable<ChainAssetMap>);\n\n const allAssets = Object.values(avalancheTokens).reduce((list, tokenConfig) => {\n const avaChainId = tokenConfig.chainId;\n const ethChainId = tokenConfig.target.chainId;\n\n const bridgeAsset = {\n ...tokenConfig.token,\n destinations: {\n [ethChainId]: {\n address: tokenConfig.target.tokenAddress,\n bridgeProviders: [ServiceType.AVALANCHE_EVM],\n },\n },\n swapProviders: [],\n };\n\n const currentList = list[avaChainId] ?? [];\n currentList.push(bridgeAsset);\n list[avaChainId] = currentList;\n\n return list;\n }, assetsWithEthTokens);\n\n const homesteadKey = EthereumChainIds.MAINNET;\n if (allAssets[homesteadKey]) {\n allAssets[homesteadKey].push({\n ...ETH_TOKEN,\n destinations: {\n [AvalancheChainIds.MAINNET]: {\n // Native ETH on Ethereum maps to WETH.e on Avalanche\n address: nativeTokenConfig.avalancheToken.token.address,\n bridgeProviders: [ServiceType.AVALANCHE_EVM],\n },\n },\n swapProviders: [],\n });\n }\n\n const sepoliaKey = EthereumChainIds.SEPOLIA;\n if (allAssets[sepoliaKey]) {\n allAssets[sepoliaKey].push({\n ...ETH_TOKEN,\n destinations: {\n [AvalancheChainIds.FUJI]: {\n address: nativeTokenConfig.avalancheToken.token.address,\n bridgeProviders: [ServiceType.AVALANCHE_EVM],\n },\n },\n swapProviders: [],\n });\n }\n\n return allAssets as ChainAssetMap;\n };\n}\n"],"mappings":"8IAgBA,SAAgB,EAAiB,CAC/B,kBACA,iBACA,qBAC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,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avalabs/fusion-sdk",
|
|
3
3
|
"license": "Limited Ecosystem License",
|
|
4
|
-
"version": "0.28.
|
|
4
|
+
"version": "0.28.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/mod.cjs",
|
|
7
7
|
"module": "./dist/mod.js",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"vitest": "4.0.6",
|
|
51
51
|
"tsdown": "0.21.4",
|
|
52
52
|
"zod": "4.1.12",
|
|
53
|
-
"
|
|
54
|
-
"
|
|
53
|
+
"@internal/tsdown-config": "0.0.1",
|
|
54
|
+
"eslint-config-custom": "0.1.0"
|
|
55
55
|
},
|
|
56
56
|
"sideEffects": false,
|
|
57
57
|
"scripts": {
|