diff --git a/src/adapters/interlay.ts b/src/adapters/interlay.ts index 2ecef4e..f1d9f14 100644 --- a/src/adapters/interlay.ts +++ b/src/adapters/interlay.ts @@ -53,6 +53,21 @@ export const interlayRouteConfigs = createRouteConfigs("interlay", [ token: "IBTC", xcm: { fee: { token: "IBTC", amount: "110" }, weightLimit: DEST_WEIGHT }, }, + { + to: "phala", + token: "PHA", + xcm: { fee: { token: "PHA", amount: "65000000000" } }, + }, + { + to: "phala", + token: "INTR", + xcm: { fee: { token: "INTR", amount: "650000000" } }, + }, + { + to: "phala", + token: "IBTC", + xcm: { fee: { token: "IBTC", amount: "6500000" } }, + }, { to: "polkadot", token: "DOT", @@ -237,6 +252,13 @@ export const interlayTokensConfig: Record< ed: "0", toRaw: () => ({ ForeignAsset: 11 }), }, + PHA: { + name: "PHA", + symbol: "PHA", + decimals: 12, + ed: "10000000000", + toRaw: () => ({ ForeignAsset: 14 }), + }, }, kintsugi: { KINT: { diff --git a/src/adapters/phala.ts b/src/adapters/phala.ts index 853e0dd..9e3f69e 100644 --- a/src/adapters/phala.ts +++ b/src/adapters/phala.ts @@ -17,6 +17,30 @@ import { getDestAccountInfo, } from "../utils"; +export const phalaRouteConfigs = createRouteConfigs("phala", [ + { + to: "interlay", + token: "PHA", + xcm: { + fee: { token: "PHA", amount: "80000000000000" }, + }, + }, + { + to: "interlay", + token: "IBTC", + xcm: { + fee: { token: "IBTC", amount: "70" }, + }, + }, + { + to: "interlay", + token: "INTR", + xcm: { + fee: { token: "INTR", amount: "20000000" }, + }, + }, +]); + export const khalaRouteConfigs = createRouteConfigs("khala", [ { to: "karura", @@ -41,6 +65,32 @@ export const khalaRouteConfigs = createRouteConfigs("khala", [ }, ]); +export const phalaTokensConfig: Record = { + PHA: { + name: "PHA", + symbol: "PHA", + decimals: 12, + ed: "10000000000", + toRaw: () => undefined, + }, + IBTC: { + name: "IBTC", + symbol: "IBTC", + decimals: 8, + ed: "1000000", + toRaw: () => + "0x0001000000000000000000000000000000000000000000000000000000000000", + }, + INTR: { + name: "INTR", + symbol: "INTR", + decimals: 10, + ed: "100000000", + toRaw: () => + "0x0002000000000000000000000000000000000000000000000000000000000000", + }, +}; + export const khalaTokensConfig: Record = { PHA: { name: "PHA", @@ -67,6 +117,11 @@ export const khalaTokensConfig: Record = { }, }; +const tokensConfig: Record> = { + khala: khalaTokensConfig, + phala: phalaTokensConfig, +}; + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types const createBalanceStorages = (api: AnyApi) => { return { @@ -119,6 +174,8 @@ class PhalaBalanceAdapter extends BalanceAdapter { const SUPPORTED_TOKENS: Record = { KAR: 1, KUSD: 4, + INTR: 13, + IBTC: 14, }; const tokenId = SUPPORTED_TOKENS[token]; @@ -155,7 +212,7 @@ class BasePhalaAdapter extends BaseCrossChainAdapter { this.balanceAdapter = new PhalaBalanceAdapter({ chain: this.chain.id as ChainId, api, - tokens: khalaTokensConfig, + tokens: tokensConfig[this.chain.id], }); } @@ -273,6 +330,12 @@ class BasePhalaAdapter extends BaseCrossChainAdapter { } } +export class PhalaAdapter extends BasePhalaAdapter { + constructor() { + super(chains.phala, phalaRouteConfigs, phalaTokensConfig); + } +} + export class KhalaAdapter extends BasePhalaAdapter { constructor() { super(chains.khala, khalaRouteConfigs, khalaTokensConfig); diff --git a/src/configs/chains/polkadot-chains.ts b/src/configs/chains/polkadot-chains.ts index a6b9733..a106409 100644 --- a/src/configs/chains/polkadot-chains.ts +++ b/src/configs/chains/polkadot-chains.ts @@ -27,6 +27,13 @@ export const polkadotChains = { paraChainId: 2012, ss58Prefix: 172, }, + phala: { + display: "Phala", + type: "substrate", + icon: "https://resources.acala.network/_next/image?url=%2Fnetworks%2Fphala.png&w=96&q=75", + paraChainId: 2035, + ss58Prefix: 30, + }, moonbeam: { display: "Moonbeam", type: "ethereum",