Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@equilab/network

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@equilab/network - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

7

dist/config/chains/genshiro.d.ts

@@ -14,6 +14,6 @@ import type { BigDecimals } from "../../util/math";

};
parseNativeBalance: (data: any, context?: Record<string, any>) => BigDecimals;
parseNativeBalance: (data: any) => BigDecimals;
getTransferArgs: (amount: `${number}`, pub: `0x${string}`, context?: Record<string, any>) => {
readonly section: "polkadotXcm";
readonly method: "limitedReserveTransferAssets";
readonly section: "eqBridge";
readonly method: "transferNative";
readonly args: readonly [`${number}`, `0x${string}`, 7, any];

@@ -23,2 +23,3 @@ };

paraId?: number | undefined;
withdraw?: import("../../types/v1").SubstrateWithdrawType | undefined;
type: "substrate";

@@ -25,0 +26,0 @@ name: string;

@@ -9,4 +9,5 @@ "use strict";

type: "substrate",
logo: null,
logo: "https://contentv2.equilibrium.io/uploads/gens_1f06723045.svg",
nodes: ["wss://node.ksm.genshiro.io"],
withdraw: "eq-bridge",
};

@@ -31,7 +32,18 @@ const getBalance = (pub) => ({

};
const parseNativeBalance = parseBalance;
const parseNativeBalance = (data) => {
var _a, _b, _c, _d, _e, _f, _g;
const { decimals, asset } = { decimals: 9, asset: 1734700659 };
const balances = ((_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.isV0) ? data.data.asV0.balance : undefined;
const [, balance] = (_b = balances === null || balances === void 0 ? void 0 : balances.find(([assetId]) => assetId.toString(10) === (asset === null || asset === void 0 ? void 0 : asset.toString(10)))) !== null && _b !== void 0 ? _b : [];
return {
value: BigInt((balance === null || balance === void 0 ? void 0 : balance.isPositive)
? (_d = (_c = balance.asPositive) === null || _c === void 0 ? void 0 : _c.toString) === null || _d === void 0 ? void 0 : _d.call(_c, 10)
: (_g = `-${(_f = (_e = balance.asNegative) === null || _e === void 0 ? void 0 : _e.toString) === null || _f === void 0 ? void 0 : _f.call(_e, 10)}`) !== null && _g !== void 0 ? _g : 0),
decimals,
};
};
const getTransferArgs = (amount, pub, context) => {
return {
section: "polkadotXcm",
method: "limitedReserveTransferAssets",
section: "eqBridge",
method: "transferNative",
args: [amount, pub, 7, context === null || context === void 0 ? void 0 : context.resourceId],

@@ -38,0 +50,0 @@ };

@@ -14,6 +14,6 @@ declare const _default: {

};
parseNativeBalance: (data: any, context?: Record<string, any> | undefined) => import("../../util/math").BigDecimals;
parseNativeBalance: (data: any) => import("../../util/math").BigDecimals;
getTransferArgs: (amount: `${number}`, pub: `0x${string}`, context?: Record<string, any> | undefined) => {
readonly section: "polkadotXcm";
readonly method: "limitedReserveTransferAssets";
readonly section: "eqBridge";
readonly method: "transferNative";
readonly args: readonly [`${number}`, `0x${string}`, 7, any];

@@ -23,2 +23,3 @@ };

paraId?: number | undefined;
withdraw?: import("../../types/v1").SubstrateWithdrawType | undefined;
type: "substrate";

@@ -94,2 +95,3 @@ name: string;

paraId?: number | undefined;
withdraw?: import("../../types/v1").SubstrateWithdrawType | undefined;
type: "substrate";

@@ -96,0 +98,0 @@ name: string;

@@ -66,2 +66,3 @@ import type { BigDecimals } from "../../util/math";

paraId?: number | undefined;
withdraw?: import("../../types/v1").SubstrateWithdrawType | undefined;
type: "substrate";

@@ -68,0 +69,0 @@ name: string;

@@ -85,2 +85,3 @@ "use strict";

logo: null,
withdraw: "parachain",
nodes: [

@@ -87,0 +88,0 @@ "wss://statemint-rpc.polkadot.io",

@@ -16,6 +16,6 @@ import * as tokens from "./tokens";

};
parseNativeBalance: (data: any, context?: Record<string, any> | undefined) => import("../util/math").BigDecimals;
parseNativeBalance: (data: any) => import("../util/math").BigDecimals;
getTransferArgs: (amount: `${number}`, pub: `0x${string}`, context?: Record<string, any> | undefined) => {
readonly section: "polkadotXcm";
readonly method: "limitedReserveTransferAssets";
readonly section: "eqBridge";
readonly method: "transferNative";
readonly args: readonly [`${number}`, `0x${string}`, 7, any];

@@ -25,2 +25,3 @@ };

paraId?: number | undefined;
withdraw?: import("../types/v1").SubstrateWithdrawType | undefined;
type: "substrate";

@@ -96,2 +97,3 @@ name: string;

paraId?: number | undefined;
withdraw?: import("../types/v1").SubstrateWithdrawType | undefined;
type: "substrate";

@@ -98,0 +100,0 @@ name: string;

@@ -14,2 +14,26 @@ "use strict";

const BALANCE_ARGS = ["0x00"];
const serializeBigIntToString = (a) => {
if (typeof a !== "bigint") {
return a;
}
return a.toString();
};
const MOCK = {
genshiro: {
parseNativeBalance: [
{
data: {
isV0: true,
asV0: {
balance: [
[1734700659, { isPositive: true, asPositive: 10000000000 }],
[6648164, { isPositive: true, asPositive: 10000000 }],
],
},
},
},
{ value: BigInt(10000000000), decimals: 9 },
],
},
};
(0, assert_1.default)((0, typed_1.getEntries)(config_1.default.tokens.crosschain).every(([chainName, tokens]) => {

@@ -32,4 +56,13 @@ const chain = config_1.default.chains[chainName];

console.info(`chain ${chainName}, token ${tokenName}, context: ${JSON.stringify(context)}`);
return [{ method: BALANCE_METHOD, args: BALANCE_ARGS }].every(({ method, args }) => {
assert_1.default.deepStrictEqual(chain[method](...args, context), deserialized[method](...args, context), `chain[${method}](...${JSON.stringify(args)}) !== deserialized[${method}](...${JSON.stringify(args)})`);
return [
{ method: BALANCE_METHOD, args: BALANCE_ARGS },
...(chainName in MOCK
? (0, typed_1.getEntries)(MOCK[chainName]).map(([method, args]) => {
return { method, args };
})
: []),
].every(({ method, args }) => {
assert_1.default.deepStrictEqual(chain[method](
// @ts-ignore
...args, context), deserialized[method](...args, context), `chain[${method}](...${JSON.stringify(args, serializeBigIntToString)}) !== deserialized[${method}](...${JSON.stringify(args, serializeBigIntToString)})`);
return true;

@@ -36,0 +69,0 @@ });

@@ -5,2 +5,3 @@ import type chains from "../../config/chains";

export type ChainType = "substrate" | "evm";
export type SubstrateWithdrawType = "relay" | "parachain" | "parachain-evm" | "eq-bridge";
interface BaseChain<T extends ChainType> {

@@ -16,2 +17,3 @@ type: T;

paraId?: number;
withdraw?: SubstrateWithdrawType;
}

@@ -18,0 +20,0 @@ export interface EVMChain extends BaseChain<"evm"> {

{
"name": "@equilab/network",
"version": "0.1.4",
"version": "0.1.5",
"main": "./dist/index.js",

@@ -5,0 +5,0 @@ "license": "none",

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