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.5 to 0.2.0

31

dist/config/chains/genshiro.d.ts

@@ -1,28 +0,3 @@

import type { BigDecimals } from "../../util/math";
export declare const genshiro: {
getBalance: (pub: `0x${string}`) => {
readonly section: "system";
readonly method: "account";
readonly args: readonly [`0x${string}`];
};
parseBalance: (data: any, context?: Record<string, any>) => BigDecimals;
getNativeBalance: (pub: `0x${string}`) => {
readonly section: "system";
readonly method: "account";
readonly args: readonly [`0x${string}`];
};
parseNativeBalance: (data: any) => BigDecimals;
getTransferArgs: (amount: `${number}`, pub: `0x${string}`, context?: Record<string, any>) => {
readonly section: "eqBridge";
readonly method: "transferNative";
readonly args: readonly [`${number}`, `0x${string}`, 7, any];
};
nodes: string[];
paraId?: number | undefined;
withdraw?: import("../../types/v1").SubstrateWithdrawType | undefined;
type: "substrate";
name: string;
title: string;
nativeToken: string;
logo?: string | null | undefined;
};
import type { SubstrateChain } from "../../types/v1";
declare const chainDef: SubstrateChain;
export default chainDef;

39

dist/config/chains/genshiro.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.genshiro = void 0;
const chainDef = {
name: "genshiro",
title: "Genshiro",
nativeToken: "gens",
type: "substrate",
logo: "https://contentv2.equilibrium.io/uploads/gens_1f06723045.svg",
nodes: ["wss://node.ksm.genshiro.io"],
withdraw: "eq-bridge",
};
const getBalance = (pub) => ({
const getBalance = (context, pub) => ({
section: "system",

@@ -19,27 +9,29 @@ method: "account",

const getNativeBalance = getBalance;
const parseBalance = (data, context) => {
var _a, _b, _c, _d, _e, _f, _g;
const parseBalance = (context, data) => {
var _a, _b, _c, _d, _e;
const { decimals, asset } = context !== null && context !== void 0 ? context : {};
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 : [];
const sign = (balance === null || balance === void 0 ? void 0 : balance.isPositive) ? "" : "-";
const value = sign +
((_e = (_d = ((_c = (sign ? balance === null || balance === void 0 ? void 0 : balance.asPositive : balance === null || balance === void 0 ? void 0 : balance.asNegative)) !== null && _c !== void 0 ? _c : 0)).toString) === null || _e === void 0 ? void 0 : _e.call(_d, 10));
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),
value: BigInt(value),
decimals,
};
};
const parseNativeBalance = (data) => {
var _a, _b, _c, _d, _e, _f, _g;
const parseNativeBalance = (context, data) => {
var _a, _b, _c, _d, _e;
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 : [];
const sign = (balance === null || balance === void 0 ? void 0 : balance.isPositive) ? "" : "-";
const value = sign +
((_e = (_d = ((_c = (sign ? balance === null || balance === void 0 ? void 0 : balance.asPositive : balance === null || balance === void 0 ? void 0 : balance.asNegative)) !== null && _c !== void 0 ? _c : 0)).toString) === null || _e === void 0 ? void 0 : _e.call(_d, 10));
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),
value: BigInt(value),
decimals,
};
};
const getTransferArgs = (amount, pub, context) => {
const getTransferArgs = (context, amount, pub) => {
return {

@@ -61,2 +53,3 @@ section: "eqBridge",

};
exports.genshiro = Object.assign(Object.assign({}, chainDef), fns);
const chainDef = Object.assign({ name: "genshiro", title: "Genshiro", nativeToken: "gens", type: "substrate", logo: "https://contentv2.equilibrium.io/uploads/gens_1f06723045.svg", nodes: ["wss://node.ksm.genshiro.io"], withdraw: "eq-bridge" }, fns);
exports.default = chainDef;
declare const _default: {
readonly genshiro: {
getBalance: (pub: `0x${string}`) => {
readonly section: "system";
readonly method: "account";
readonly args: readonly [`0x${string}`];
};
parseBalance: (data: any, context?: Record<string, any> | undefined) => import("../../util/math").BigDecimals;
getNativeBalance: (pub: `0x${string}`) => {
readonly section: "system";
readonly method: "account";
readonly args: readonly [`0x${string}`];
};
parseNativeBalance: (data: any) => import("../../util/math").BigDecimals;
getTransferArgs: (amount: `${number}`, pub: `0x${string}`, context?: Record<string, any> | undefined) => {
readonly section: "eqBridge";
readonly method: "transferNative";
readonly args: readonly [`${number}`, `0x${string}`, 7, any];
};
nodes: string[];
paraId?: number | undefined;
withdraw?: import("../../types/v1").SubstrateWithdrawType | undefined;
type: "substrate";
name: string;
title: string;
nativeToken: string;
logo?: string | null | undefined;
};
readonly statemint: {
getBalance: (pub: `0x${string}`, context?: Record<string, any> | undefined) => {
readonly section: "assets";
readonly method: "account";
readonly args: readonly [any, `0x${string}`];
};
parseBalance: (data: any, context?: Record<string, any> | undefined) => import("../../util/math").BigDecimals;
getNativeBalance: (pub: `0x${string}`) => {
readonly section: "system";
readonly method: "account";
readonly args: readonly [`0x${string}`];
};
parseNativeBalance: (data: any, options?: Record<string, any> | undefined) => {
value: bigint;
decimals: number;
};
getTransferArgs: (amount: `${number}`, pub: `0x${string}`, context?: Record<string, any> | undefined) => {
readonly section: "polkadotXcm";
readonly method: "limitedReserveTransferAssets";
readonly args: readonly [{
readonly V2: {
readonly parents: "1";
readonly interior: {
readonly X1: {
readonly Parachain: "2011";
};
};
};
}, {
readonly V2: {
readonly parents: 0;
readonly interior: {
readonly X1: {
readonly AccountId32: {
readonly id: `0x${string}`;
readonly network: "Any";
};
};
};
};
}, {
readonly V2: readonly [{
readonly id: {
readonly Concrete: {
readonly parents: 0;
readonly interior: {
readonly X2: readonly [{
readonly PalletInstance: 50;
}, {
readonly GeneralIndex: any;
}];
};
};
};
readonly fun: {
readonly Fungible: `${number}`;
};
}];
}, 0, {
readonly Unlimited: null;
}];
};
nodes: string[];
paraId?: number | undefined;
withdraw?: import("../../types/v1").SubstrateWithdrawType | undefined;
type: "substrate";
name: string;
title: string;
nativeToken: string;
logo?: string | null | undefined;
};
readonly genshiro: import("../../types/v1").SubstrateChain;
readonly statemint: import("../../types/v1").SubstrateChain;
};
export default _default;
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const genshiro_1 = require("./genshiro");
const statemint_1 = require("./statemint");
const genshiro_1 = __importDefault(require("./genshiro"));
const statemint_1 = __importDefault(require("./statemint"));
exports.default = {
genshiro: genshiro_1.genshiro,
statemint: statemint_1.statemint,
genshiro: genshiro_1.default,
statemint: statemint_1.default,
};

@@ -1,72 +0,3 @@

import type { BigDecimals } from "../../util/math";
export declare const statemint: {
getBalance: (pub: `0x${string}`, context?: Record<string, any>) => {
readonly section: "assets";
readonly method: "account";
readonly args: readonly [any, `0x${string}`];
};
parseBalance: (data: any, context?: Record<string, any>) => BigDecimals;
getNativeBalance: (pub: `0x${string}`) => {
readonly section: "system";
readonly method: "account";
readonly args: readonly [`0x${string}`];
};
parseNativeBalance: (data: any, options?: Record<string, any>) => {
value: bigint;
decimals: number;
};
getTransferArgs: (amount: `${number}`, pub: `0x${string}`, context?: Record<string, any>) => {
readonly section: "polkadotXcm";
readonly method: "limitedReserveTransferAssets";
readonly args: readonly [{
readonly V2: {
readonly parents: "1";
readonly interior: {
readonly X1: {
readonly Parachain: "2011";
};
};
};
}, {
readonly V2: {
readonly parents: 0;
readonly interior: {
readonly X1: {
readonly AccountId32: {
readonly id: `0x${string}`;
readonly network: "Any";
};
};
};
};
}, {
readonly V2: readonly [{
readonly id: {
readonly Concrete: {
readonly parents: 0;
readonly interior: {
readonly X2: readonly [{
readonly PalletInstance: 50;
}, {
readonly GeneralIndex: any;
}];
};
};
};
readonly fun: {
readonly Fungible: `${number}`;
};
}];
}, 0, {
readonly Unlimited: null;
}];
};
nodes: string[];
paraId?: number | undefined;
withdraw?: import("../../types/v1").SubstrateWithdrawType | undefined;
type: "substrate";
name: string;
title: string;
nativeToken: string;
logo?: string | null | undefined;
};
import type { SubstrateChain } from "../../types/v1";
declare const chainDef: SubstrateChain;
export default chainDef;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.statemint = void 0;
const getBalance = (pub, context) => ({
const getBalance = (context, pub) => ({
section: "assets",

@@ -9,3 +8,3 @@ method: "account",

});
const getNativeBalance = (pub) => ({
const getNativeBalance = (context, pub) => ({
section: "system",

@@ -15,3 +14,3 @@ method: "account",

});
const parseBalance = (data, context) => {
const parseBalance = (context, data) => {
var _a, _b, _c;

@@ -23,3 +22,3 @@ return {

};
const parseNativeBalance = (data, options) => {
const parseNativeBalance = (context, data) => {
var _a, _b, _c, _d;

@@ -31,3 +30,3 @@ return {

};
const getTransferArgs = (amount, pub, context) => {
const getTransferArgs = (context, amount, pub) => {
return {

@@ -83,16 +82,7 @@ section: "polkadotXcm",

};
const chainDef = {
name: "statemint",
title: "Statemint",
nativeToken: "dot",
type: "substrate",
logo: null,
withdraw: "parachain",
nodes: [
const chainDef = Object.assign({ name: "statemint", title: "Statemint", nativeToken: "dot", type: "substrate", logo: null, withdraw: "parachain", nodes: [
"wss://statemint-rpc.polkadot.io",
"wss://statemint.api.onfinality.io/public-ws",
"wss://statemint-rpc.dwellir.com;wss://public-rpc.pinknode.io/statemint;wss://statemint.public.curie.radiumblock.co/ws",
],
paraId: 1000,
};
exports.statemint = Object.assign(Object.assign({}, chainDef), fns);
], paraId: 1000 }, fns);
exports.default = chainDef;
import * as tokens from "./tokens";
declare const _default: {
chains: {
readonly genshiro: {
getBalance: (pub: `0x${string}`) => {
readonly section: "system";
readonly method: "account";
readonly args: readonly [`0x${string}`];
};
parseBalance: (data: any, context?: Record<string, any> | undefined) => import("../util/math").BigDecimals;
getNativeBalance: (pub: `0x${string}`) => {
readonly section: "system";
readonly method: "account";
readonly args: readonly [`0x${string}`];
};
parseNativeBalance: (data: any) => import("../util/math").BigDecimals;
getTransferArgs: (amount: `${number}`, pub: `0x${string}`, context?: Record<string, any> | undefined) => {
readonly section: "eqBridge";
readonly method: "transferNative";
readonly args: readonly [`${number}`, `0x${string}`, 7, any];
};
nodes: string[];
paraId?: number | undefined;
withdraw?: import("../types/v1").SubstrateWithdrawType | undefined;
type: "substrate";
name: string;
title: string;
nativeToken: string;
logo?: string | null | undefined;
};
readonly statemint: {
getBalance: (pub: `0x${string}`, context?: Record<string, any> | undefined) => {
readonly section: "assets";
readonly method: "account";
readonly args: readonly [any, `0x${string}`];
};
parseBalance: (data: any, context?: Record<string, any> | undefined) => import("../util/math").BigDecimals;
getNativeBalance: (pub: `0x${string}`) => {
readonly section: "system";
readonly method: "account";
readonly args: readonly [`0x${string}`];
};
parseNativeBalance: (data: any, options?: Record<string, any> | undefined) => {
value: bigint;
decimals: number;
};
getTransferArgs: (amount: `${number}`, pub: `0x${string}`, context?: Record<string, any> | undefined) => {
readonly section: "polkadotXcm";
readonly method: "limitedReserveTransferAssets";
readonly args: readonly [{
readonly V2: {
readonly parents: "1";
readonly interior: {
readonly X1: {
readonly Parachain: "2011";
};
};
};
}, {
readonly V2: {
readonly parents: 0;
readonly interior: {
readonly X1: {
readonly AccountId32: {
readonly id: `0x${string}`;
readonly network: "Any";
};
};
};
};
}, {
readonly V2: readonly [{
readonly id: {
readonly Concrete: {
readonly parents: 0;
readonly interior: {
readonly X2: readonly [{
readonly PalletInstance: 50;
}, {
readonly GeneralIndex: any;
}];
};
};
};
readonly fun: {
readonly Fungible: `${number}`;
};
}];
}, 0, {
readonly Unlimited: null;
}];
};
nodes: string[];
paraId?: number | undefined;
withdraw?: import("../types/v1").SubstrateWithdrawType | undefined;
type: "substrate";
name: string;
title: string;
nativeToken: string;
logo?: string | null | undefined;
};
readonly genshiro: import("../types/v1").SubstrateChain;
readonly statemint: import("../types/v1").SubstrateChain;
};

@@ -103,0 +7,0 @@ tokens: typeof tokens;

import type chains from "../../config/chains";
import type crosschain from "../../config/tokens/crosschain";
import type { BigDecimals } from "../../util/math";
export declare const _NOT_IMPLEMENTED = true;

@@ -13,2 +14,5 @@ export type ChainType = "substrate" | "evm";

}
export type DefaultContext = Record<string, any>;
type Parser<T extends {} = any, C extends DefaultContext = DefaultContext> = (context?: C, data?: T) => BigDecimals;
type Getter<A extends any[], T extends {} = any, C extends DefaultContext = DefaultContext> = (context?: C, ...args: A) => T;
export interface SubstrateChain extends BaseChain<"substrate"> {

@@ -18,2 +22,7 @@ nodes: string[];

withdraw?: SubstrateWithdrawType;
getBalance: Getter<[`0x${string}`]>;
getNativeBalance: Getter<[`0x${string}`]>;
getTransferArgs: Getter<[`${number}`, `0x${string}`]>;
parseBalance: Parser;
parseNativeBalance: Parser;
}

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

{
"name": "@equilab/network",
"version": "0.1.5",
"version": "0.2.0",
"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