Skip to content

Commit

Permalink
chore: replace ExpandToken type with ExtendedToken
Browse files Browse the repository at this point in the history
  • Loading branch information
bvotteler committed Nov 13, 2023
1 parent 327a072 commit 4b6a406
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/adapters/hydradx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ChainName, chains } from "../configs";
import { ApiNotFound, CurrencyNotFound } from "../errors";
import {
BalanceData,
ExpandToken,
ExtendedToken,
CrossChainRouterConfigs,
CrossChainTransferParams,
} from "../types";
Expand Down Expand Up @@ -41,27 +41,27 @@ export const hydraRoutersConfig: Omit<CrossChainRouterConfigs, "from">[] = [
},
];

export const hydraTokensConfig: Record<string, ExpandToken> = {
export const hydraTokensConfig: Record<string, ExtendedToken> = {
HDX: {
name: "HDX",
symbol: "HDX",
decimals: 12,
ed: "1000000000000",
toChainData: () => 0,
toRaw: () => 0,
},
IBTC: {
name: "IBTC",
symbol: "IBTC",
decimals: 8,
ed: "36",
toChainData: () => 11,
toRaw: () => 11,
},
INTR: {
name: "INTR",
symbol: "INTR",
decimals: 10,
ed: "6164274209",
toChainData: () => 17,
toRaw: () => 17,
},
};

Expand Down Expand Up @@ -114,9 +114,9 @@ class HydradxBalanceAdapter extends BalanceAdapter {
);
}

const token = this.getToken<ExpandToken>(tokenName);
const token = this.getToken<ExtendedToken>(tokenName);

return this.storages.assets(token.toChainData(), address).observable.pipe(
return this.storages.assets(token.toRaw(), address).observable.pipe(
map((balance) => {
const amount = FN.fromInner(
balance.free?.toString() || "0",
Expand Down Expand Up @@ -210,13 +210,13 @@ class BaseHydradxAdapter extends BaseCrossChainAdapter {

const { address, amount, to, token: tokenName } = params;

const token = this.getToken<ExpandToken>(tokenName);
const token = this.getToken<ExtendedToken>(tokenName);

if (!token) {
throw new CurrencyNotFound(token);
}

const tokenId = token.toChainData();
const tokenId = token.toRaw();
const toChain = chains[to];
const accountId = this.api.createType("AccountId32", address).toHex();

Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export interface BasicToken {
ed: string;
}

export interface ExpandToken extends BasicToken {
toChainData: () => any;
export interface ExtendedToken extends BasicToken {
toRaw: () => any;
}

export interface CrossChainRouterConfigs {
Expand Down

0 comments on commit 4b6a406

Please sign in to comment.