Skip to content

Commit

Permalink
Rename equalsAsset to isFungibleWith
Browse files Browse the repository at this point in the history
  • Loading branch information
jmrossy committed Mar 12, 2024
1 parent d9adfad commit 544eeb5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion typescript/sdk/src/token/IToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ export interface IToken extends TokenArgs {
removeConnection(token: IToken): IToken;

equals(token?: IToken): boolean;
equalsAsset(token?: IToken): boolean;
isFungibleWith(token?: IToken): boolean;
}
4 changes: 3 additions & 1 deletion typescript/sdk/src/token/Token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,11 @@ export class Token implements IToken {
* 1) A HypCollateral contract token and its wrapped token (eg. EvmHypCollateral and ERC20)
* 2) A HypNative contract and its native currency (eg. EvmHypNative and Ether)
* 3) An IBC token and its native equivalent
* This is useful during fee estimation to determine if a TokenAmount for the transfer and the fee
* are actually fungible (represent the same asset).
* @returns true if the tokens represent the same underlying asset
*/
equalsAsset(token?: IToken): boolean {
isFungibleWith(token?: IToken): boolean {
if (!token || token.chainName !== this.chainName) return false;

if (this.equals(token)) return true;
Expand Down
4 changes: 2 additions & 2 deletions typescript/sdk/src/warp/WarpCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,11 @@ export class WarpCore {
const { localQuote, interchainQuote } = feeEstimate;

let maxAmount = balance;
if (originToken.equalsAsset(localQuote.token)) {
if (originToken.isFungibleWith(localQuote.token)) {
maxAmount = maxAmount.minus(localQuote.amount);
}

if (originToken.equalsAsset(interchainQuote.token)) {
if (originToken.isFungibleWith(interchainQuote.token)) {
maxAmount = maxAmount.minus(interchainQuote.amount);
}

Expand Down

0 comments on commit 544eeb5

Please sign in to comment.