Socket
Socket
Sign inDemoInstall

@swapkit/helpers

Package Overview
Dependencies
Maintainers
2
Versions
203
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swapkit/helpers - npm Package Compare versions

Comparing version 1.0.0-rc.110 to 1.0.0-rc.111

2

package.json

@@ -41,3 +41,3 @@ {

"types": "./src/index.ts",
"version": "1.0.0-rc.110"
"version": "1.0.0-rc.111"
}

@@ -109,13 +109,37 @@ import { describe, expect, test } from "bun:test";

expect(firstThor.eqAsset(firstThor)).toBe(true);
expect(firstThor.eqAsset(secondThor)).toBe(true);
expect(firstThor.eqAsset(vThor)).toBe(false);
expect(firstThor.eqAsset(firstUsdc)).toBe(false);
expect(firstThor.eqAsset(secondUsdc)).toBe(false);
expect(firstUsdc.eqAsset(firstThor)).toBe(false);
expect(firstUsdc.eqAsset(secondThor)).toBe(false);
expect(firstUsdc.eqAsset(vThor)).toBe(false);
expect(firstUsdc.eqAsset(firstUsdc)).toBe(true);
expect(firstUsdc.eqAsset(secondUsdc)).toBe(true);
});
test("check if assets have same value, even if not same asset", () => {
const firstThor = AssetValue.fromChainOrSignature("ETH.THOR", "20");
const secondThor = AssetValue.fromChainOrSignature("ETH.THOR", "35");
const thirdThor = AssetValue.fromChainOrSignature("ETH.THOR", "35");
const vThor = AssetValue.fromChainOrSignature("ETH.vTHOR", "20");
expect(firstThor.eqValue(firstThor)).toBe(true);
expect(firstThor.eqValue(secondThor)).toBe(false);
expect(secondThor.eqValue(thirdThor)).toBe(true);
expect(firstThor.eqValue(vThor)).toBe(true);
});
test("check if assets have identical asset and value", () => {
const firstThor = AssetValue.fromChainOrSignature("ETH.THOR", "20");
const secondThor = AssetValue.fromChainOrSignature("ETH.THOR", "35");
const thirdThor = AssetValue.fromChainOrSignature("ETH.THOR", "35");
const vThor = AssetValue.fromChainOrSignature("ETH.vTHOR", "20");
expect(firstThor.eq(firstThor)).toBe(true);
expect(firstThor.eq(secondThor)).toBe(true);
expect(firstThor.eq(secondThor)).toBe(false);
expect(secondThor.eq(thirdThor)).toBe(true);
expect(firstThor.eq(vThor)).toBe(false);
expect(firstThor.eq(firstUsdc)).toBe(false);
expect(firstThor.eq(secondUsdc)).toBe(false);
expect(firstUsdc.eq(firstThor)).toBe(false);
expect(firstUsdc.eq(secondThor)).toBe(false);
expect(firstUsdc.eq(vThor)).toBe(false);
expect(firstUsdc.eq(firstUsdc)).toBe(true);
expect(firstUsdc.eq(secondUsdc)).toBe(true);
});

@@ -122,0 +146,0 @@ });

@@ -61,6 +61,10 @@ import type { CommonAssetString } from "../helpers/asset.ts";

eq({ chain, symbol }: { chain: Chain; symbol: string }) {
eqAsset({ chain, symbol }: { chain: Chain; symbol: string }) {
return this.chain === chain && this.symbol === symbol;
}
eq(assetValue: AssetValue) {
return this.eqAsset(assetValue) && this.eqValue(assetValue);
}
// THOR.RUNE

@@ -67,0 +71,0 @@ // THOR.ETH.ETH

@@ -25,3 +25,3 @@ import { ExplorerUrl, RPCUrl } from "./network";

export type WalletChain = Exclude<Chain, Chain.Chainflip>;
export type WalletChain = Exclude<Chain, Chain.Chainflip | Chain.Radix>;

@@ -28,0 +28,0 @@ export enum ChainId {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc