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

@edgeandnode/common

Package Overview
Dependencies
Maintainers
7
Versions
453
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@edgeandnode/common - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3-alpha

build/index.esm.js

0

build/index.d.ts
export { generateExampleQuery, connectProvider, getContract, getTxLink, formatUnitsOriginal, formatWithNumeral } from './utils';

50

build/index.js

@@ -1,7 +0,17 @@

import gql from 'graphql-tag';
import { parse, print } from 'graphql';
import pluralize from 'pluralize';
import { ethers, utils } from 'ethers';
import numeral from 'numeral';
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var gql = require('graphql-tag');
var graphql = require('graphql');
var pluralize = require('pluralize');
var ethers = require('ethers');
var numeral = require('numeral');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var gql__default = /*#__PURE__*/_interopDefaultLegacy(gql);
var pluralize__default = /*#__PURE__*/_interopDefaultLegacy(pluralize);
var numeral__default = /*#__PURE__*/_interopDefaultLegacy(numeral);
// Example query for a subgraph, generated from its schema

@@ -32,3 +42,3 @@ const pickExampleTypes = (definitions) => {

// Generate collection query field
let rootField = pluralize.plural(typeDef.name.value);
let rootField = pluralize__default['default'].plural(typeDef.name.value);
if (rootField === typeDef.name.value) {

@@ -42,3 +52,3 @@ return null;

try {
const doc = parse(schema);
const doc = graphql.parse(schema);
const typeDefs = pickExampleTypes(doc.definitions);

@@ -48,3 +58,3 @@ const typeQueries = typeDefs

.filter((query) => query !== null);
const query = gql `
const query = gql__default['default'] `
{

@@ -54,3 +64,3 @@ ${typeQueries.join('\n')}

`;
return print(query);
return graphql.print(query);
}

@@ -66,3 +76,3 @@ catch (e) {

try {
const provider = new ethers.providers.StaticJsonRpcProvider(rpcEndpoint);
const provider = new ethers.ethers.providers.StaticJsonRpcProvider(rpcEndpoint);
providerWithSigner = provider.getSigner(ethAddress);

@@ -79,3 +89,3 @@ }

try {
contract = new ethers.Contract(contractAddress, contractABI, providerOrSigner);
contract = new ethers.ethers.Contract(contractAddress, contractABI, providerOrSigner);
}

@@ -88,3 +98,3 @@ catch (e) {

};
const formatUnitsOriginal = (num, power) => power ? utils.formatUnits(num, power) : utils.formatUnits(num, 18);
const formatUnitsOriginal = (num, power) => power ? ethers.utils.formatUnits(num, power) : ethers.utils.formatUnits(num, 18);
const getTxLink = (transactionId, networkName) => {

@@ -109,18 +119,2 @@ let txLink = '';

? '~ 0'
: numeral(num).format(format ? format : '0.0a');
return result;
};
export { connectProvider, formatUnitsOriginal, formatWithNumeral, generateExampleQuery, getContract, getTxLink };
//# sourceMappingURL=index.js.map
`https://${networkName}.etherscan.io/tx/${transactionId}`;
}
return txLink;
};
const formatWithNumeral = (num, format) => {
const result = num === 0 || num === '0'
? '0'
: num > 0 && num < 0.5
? '~ 0'
: numeral__default['default'](num).format(format ? format : '0.0a');

@@ -127,0 +121,0 @@ return result;

@@ -0,0 +0,0 @@ import { ethers, ContractInterface } from 'ethers';

export declare const formatWithNumeral: (num: number | string, format?: string) => string;

@@ -0,0 +0,0 @@ import { DefinitionNode, ObjectTypeDefinitionNode, FieldDefinitionNode, TypeNode, DocumentNode } from 'graphql';

export * from './graphql.utils';
export * from './ethers.utils';
export * from './formatters.utils';
{
"name": "@edgeandnode/common",
"version": "1.0.2",
"version": "1.0.3-alpha",
"description": "Common Edge & Node utils and types",

@@ -37,2 +37,3 @@ "main": "build/index.js",

"devDependencies": {
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-eslint": "^8.0.1",

@@ -55,2 +56,3 @@ "@rollup/plugin-json": "^4.1.0",

"rollup": "^2.51.2",
"rollup-plugin-typescript2": "^0.30.0",
"ts-jest": "^27.0.3",

@@ -57,0 +59,0 @@ "typescript": "^4.3.2"

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