Skip to content

Commit

Permalink
check it's acala karura
Browse files Browse the repository at this point in the history
  • Loading branch information
qiweiii committed Dec 1, 2023
1 parent 354c5ab commit 1b5c689
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/adapters/polkadot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class BasePolkadotAdapter extends BaseCrossChainAdapter {
const { address, amount, to, token } = params;

let addrType: AddressType = "substract";
if (address.startsWith("0x")) {
if (address.startsWith("0x") && (to === "acala" || to === "karura")) {
addrType = "ethereum";
}

Expand Down Expand Up @@ -286,6 +286,10 @@ class BasePolkadotAdapter extends BaseCrossChainAdapter {
this.getDestWeight(token, to)?.toString()
);
} else {
const accountType =
(to === "acala" || to === "karura") && addrType === "ethereum"
? "AccountKey20"
: "AccountId32";
const dst = {
parents: 0,
interior: { X1: { Parachain: toChain.paraChainId } },
Expand All @@ -294,7 +298,7 @@ class BasePolkadotAdapter extends BaseCrossChainAdapter {
parents: 0,
interior: {
X1: {
[addrType === "substract" ? "AccountId32" : "AccountKey20"]: {
[accountType]: {
id: accountId,
},
},
Expand Down

0 comments on commit 1b5c689

Please sign in to comment.