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

@ethersproject/abstract-provider

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethersproject/abstract-provider - npm Package Compare versions

Comparing version 5.3.0 to 5.4.0

2

lib.esm/_version.d.ts

@@ -1,2 +0,2 @@

export declare const version = "abstract-provider/5.3.0";
export declare const version = "abstract-provider/5.4.0";
//# sourceMappingURL=_version.d.ts.map

@@ -1,2 +0,2 @@

export const version = "abstract-provider/5.3.0";
export const version = "abstract-provider/5.4.0";
//# sourceMappingURL=_version.js.map

@@ -18,2 +18,4 @@ import { BigNumber, BigNumberish } from "@ethersproject/bignumber";

accessList?: AccessListish;
maxPriorityFeePerGas?: BigNumberish;
maxFeePerGas?: BigNumberish;
};

@@ -42,2 +44,3 @@ export interface TransactionResponse extends Transaction {

extraData: string;
baseFeePerGas?: null | BigNumber;
}

@@ -75,5 +78,12 @@ export interface Block extends _Block {

cumulativeGasUsed: BigNumber;
effectiveGasPrice: BigNumber;
byzantium: boolean;
type: number;
status?: number;
}
export interface FeeData {
maxFeePerGas: null | BigNumber;
maxPriorityFeePerGas: null | BigNumber;
gasPrice: null | BigNumber;
}
export interface EventFilter {

@@ -116,2 +126,3 @@ address?: string;

abstract getGasPrice(): Promise<BigNumber>;
getFeeData(): Promise<FeeData>;
abstract getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;

@@ -118,0 +129,0 @@ abstract getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { BigNumber } from "@ethersproject/bignumber";
import { isHexString } from "@ethersproject/bytes";
import { Description, defineReadOnly } from "@ethersproject/properties";
import { Description, defineReadOnly, resolveProperties } from "@ethersproject/properties";
import { Logger } from "@ethersproject/logger";

@@ -67,2 +77,23 @@ import { version } from "./_version";

}
getFeeData() {
return __awaiter(this, void 0, void 0, function* () {
const { block, gasPrice } = yield resolveProperties({
block: this.getBlock("latest"),
gasPrice: this.getGasPrice().catch((error) => {
// @TODO: Why is this now failing on Calaveras?
//console.log(error);
return null;
})
});
let maxFeePerGas = null, maxPriorityFeePerGas = null;
if (block && block.baseFeePerGas) {
// We may want to compute this more accurately in the future,
// using the formula "check if the base fee is correct".
// See: https://eips.ethereum.org/EIPS/eip-1559
maxPriorityFeePerGas = BigNumber.from("1000000000");
maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas);
}
return { maxFeePerGas, maxPriorityFeePerGas, gasPrice };
});
}
// Alias for "on"

@@ -69,0 +100,0 @@ addListener(eventName, listener) {

@@ -1,2 +0,2 @@

export declare const version = "abstract-provider/5.3.0";
export declare const version = "abstract-provider/5.4.0";
//# sourceMappingURL=_version.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = void 0;
exports.version = "abstract-provider/5.3.0";
exports.version = "abstract-provider/5.4.0";
//# sourceMappingURL=_version.js.map

@@ -18,2 +18,4 @@ import { BigNumber, BigNumberish } from "@ethersproject/bignumber";

accessList?: AccessListish;
maxPriorityFeePerGas?: BigNumberish;
maxFeePerGas?: BigNumberish;
};

@@ -42,2 +44,3 @@ export interface TransactionResponse extends Transaction {

extraData: string;
baseFeePerGas?: null | BigNumber;
}

@@ -75,5 +78,12 @@ export interface Block extends _Block {

cumulativeGasUsed: BigNumber;
effectiveGasPrice: BigNumber;
byzantium: boolean;
type: number;
status?: number;
}
export interface FeeData {
maxFeePerGas: null | BigNumber;
maxPriorityFeePerGas: null | BigNumber;
gasPrice: null | BigNumber;
}
export interface EventFilter {

@@ -116,2 +126,3 @@ address?: string;

abstract getGasPrice(): Promise<BigNumber>;
getFeeData(): Promise<FeeData>;
abstract getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;

@@ -118,0 +129,0 @@ abstract getTransactionCount(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<number>;

@@ -17,4 +17,41 @@ "use strict";

})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Provider = exports.TransactionOrderForkEvent = exports.TransactionForkEvent = exports.BlockForkEvent = exports.ForkEvent = void 0;
var bignumber_1 = require("@ethersproject/bignumber");
var bytes_1 = require("@ethersproject/bytes");

@@ -107,2 +144,30 @@ var properties_1 = require("@ethersproject/properties");

}
Provider.prototype.getFeeData = function () {
return __awaiter(this, void 0, void 0, function () {
var _a, block, gasPrice, maxFeePerGas, maxPriorityFeePerGas;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, properties_1.resolveProperties({
block: this.getBlock("latest"),
gasPrice: this.getGasPrice().catch(function (error) {
// @TODO: Why is this now failing on Calaveras?
//console.log(error);
return null;
})
})];
case 1:
_a = _b.sent(), block = _a.block, gasPrice = _a.gasPrice;
maxFeePerGas = null, maxPriorityFeePerGas = null;
if (block && block.baseFeePerGas) {
// We may want to compute this more accurately in the future,
// using the formula "check if the base fee is correct".
// See: https://eips.ethereum.org/EIPS/eip-1559
maxPriorityFeePerGas = bignumber_1.BigNumber.from("1000000000");
maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas);
}
return [2 /*return*/, { maxFeePerGas: maxFeePerGas, maxPriorityFeePerGas: maxPriorityFeePerGas, gasPrice: gasPrice }];
}
});
});
};
// Alias for "on"

@@ -109,0 +174,0 @@ Provider.prototype.addListener = function (eventName, listener) {

{
"author": "Richard Moore <me@ricmoo.com>",
"dependencies": {
"@ethersproject/bignumber": "^5.3.0",
"@ethersproject/bytes": "^5.3.0",
"@ethersproject/logger": "^5.3.0",
"@ethersproject/networks": "^5.3.0",
"@ethersproject/properties": "^5.3.0",
"@ethersproject/transactions": "^5.3.0",
"@ethersproject/web": "^5.3.0"
"@ethersproject/bignumber": "^5.4.0",
"@ethersproject/bytes": "^5.4.0",
"@ethersproject/logger": "^5.4.0",
"@ethersproject/networks": "^5.4.0",
"@ethersproject/properties": "^5.4.0",
"@ethersproject/transactions": "^5.4.0",
"@ethersproject/web": "^5.4.0"
},

@@ -24,3 +24,3 @@ "description": "An Abstract Class for describing an Ethereum Provider for ethers.",

],
"gitHead": "4e6d121fb8aa7327290afab7653364be8ddd8d81",
"gitHead": "71b7547f10229f50d8b701611c5e6041b8ed966b",
"keywords": [

@@ -46,5 +46,5 @@ "Ethereum",

"sideEffects": false,
"tarballHash": "0xbe087cfc8ee43f3154f8006b382424ca7394b04d34fc089372ade08ba9cb65b6",
"tarballHash": "0x0d152f2cef24f5a71be21511b20e285fa705aacdf06f626542595ff64aad5394",
"types": "./lib/index.d.ts",
"version": "5.3.0"
"version": "5.4.0"
}

@@ -1,1 +0,1 @@

export const version = "abstract-provider/5.3.0";
export const version = "abstract-provider/5.4.0";

@@ -6,3 +6,3 @@ "use strict";

import { Network } from "@ethersproject/networks";
import { Deferrable, Description, defineReadOnly } from "@ethersproject/properties";
import { Deferrable, Description, defineReadOnly, resolveProperties } from "@ethersproject/properties";
import { AccessListish, Transaction } from "@ethersproject/transactions";

@@ -33,2 +33,5 @@ import { OnceBlockable } from "@ethersproject/web";

accessList?: AccessListish;
maxPriorityFeePerGas?: BigNumberish;
maxFeePerGas?: BigNumberish;
}

@@ -72,2 +75,4 @@

extraData: string;
baseFeePerGas?: null | BigNumber;
}

@@ -114,6 +119,14 @@

cumulativeGasUsed: BigNumber,
effectiveGasPrice: BigNumber,
byzantium: boolean,
type: number;
status?: number
};
export interface FeeData {
maxFeePerGas: null | BigNumber;
maxPriorityFeePerGas: null | BigNumber;
gasPrice: null | BigNumber;
}
export interface EventFilter {

@@ -213,3 +226,2 @@ address?: string;

// Exported Abstracts
export abstract class Provider implements OnceBlockable {

@@ -223,3 +235,25 @@

abstract getGasPrice(): Promise<BigNumber>;
async getFeeData(): Promise<FeeData> {
const { block, gasPrice } = await resolveProperties({
block: this.getBlock("latest"),
gasPrice: this.getGasPrice().catch((error) => {
// @TODO: Why is this now failing on Calaveras?
//console.log(error);
return null;
})
});
let maxFeePerGas = null, maxPriorityFeePerGas = null;
if (block && block.baseFeePerGas) {
// We may want to compute this more accurately in the future,
// using the formula "check if the base fee is correct".
// See: https://eips.ethereum.org/EIPS/eip-1559
maxPriorityFeePerGas = BigNumber.from("1000000000");
maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas);
}
return { maxFeePerGas, maxPriorityFeePerGas, gasPrice };
}
// Account

@@ -226,0 +260,0 @@ abstract getBalance(addressOrName: string | Promise<string>, blockTag?: BlockTag | Promise<BlockTag>): Promise<BigNumber>;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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