Socket
Socket
Sign inDemoInstall

@moralisweb3/evm-utils

Package Overview
Dependencies
Maintainers
8
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@moralisweb3/evm-utils - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

4

lib/dataTypes/EvmBlock/EvmBlock.d.ts

@@ -43,2 +43,3 @@ import { MoralisDataObject } from '@moralisweb3/core';

}[];
blockTimestamp: string;
data?: string | undefined;

@@ -49,3 +50,2 @@ hash: string;

blockHash: string;
blockTimestamp: Date;
receiptRoot?: string | undefined;

@@ -98,2 +98,3 @@ receiptStatus?: number | undefined;

}[];
blockTimestamp: string;
data?: string | undefined;

@@ -104,3 +105,2 @@ hash: string;

blockHash: string;
blockTimestamp: Date;
receiptRoot?: string | undefined;

@@ -107,0 +107,0 @@ receiptStatus?: number | undefined;

@@ -1,10 +0,50 @@

import { MoralisDataObject } from '@moralisweb3/core';
import { MoralisDataObject, BigNumber } from '@moralisweb3/core';
import { EvmAddress } from '../EvmAddress';
import { EvmChain } from '../EvmChain';
import { EvmNative } from '../EvmNative';
import { EvmTransactionLog } from '../EvmTransactionLog';
import { EvmTransacionInput, EvmTransactionData } from './types';
/**
* Valid input for a new EvmTransaction instance.
* This can be an existing {@link EvmTransaction} or a valid {@link EvmTransacionInput} object
*/
export declare type EvmTransactionish = EvmTransacionInput | EvmTransaction;
/**
* The EvmTranaction is a representation of a published transaction.
*
* Use this class any time you work with a transaction.
*
* @category DataType
*/
export declare class EvmTransaction implements MoralisDataObject {
/**
* Create a new instance of EvmTransaction from any valid transaction input
* @param data - the EvmTransactionish type
* @example
* ```
* const transaction = EvmTransaction.create(data);
*```
*/
static create(data: EvmTransactionish): EvmTransaction;
private _data;
constructor(data: EvmTransacionInput);
static parse: (data: EvmTransacionInput) => EvmTransactionData;
static create(data: EvmTransactionish): EvmTransaction;
/**
* Check the equality between two Evm transactions
* @param dataA - The first transaction
* @param dataB - The second transaction
* @example
* ```ts
* EvmTransaction.equals(dataA, dataB)
* ```
*/
static equals(dataA: EvmTransactionish, dataB: EvmTransactionish): boolean;
/**
* Checks the equality of the current transaction with another evm transaction
* @param data - the transaction to compare with
* @example
* ```ts
* transaction.equals(data)
* ```
*/
equals(data: EvmTransactionish): boolean;

@@ -34,2 +74,3 @@ toJSON(): {

}[];
blockTimestamp: string;
data?: string | undefined;

@@ -40,6 +81,12 @@ hash: string;

blockHash: string;
blockTimestamp: Date;
receiptRoot?: string | undefined;
receiptStatus?: number | undefined;
};
/**
* @returns a JSON represention of the transaction.
* @example
* ```
* transaction.format()
* ```
*/
format(): {

@@ -68,2 +115,3 @@ to: string | undefined;

}[];
blockTimestamp: string;
data?: string | undefined;

@@ -74,8 +122,166 @@ hash: string;

blockHash: string;
blockTimestamp: Date;
receiptRoot?: string | undefined;
receiptStatus?: number | undefined;
};
/**
* @returns the transaction
* @example
* ```
* transaction.result
* ```
*/
get result(): EvmTransactionData;
/**
* @returns the transaction to address
* @example
* ```
* transaction.to // EvmAddress
* ```
*/
get to(): EvmAddress | undefined;
/**
* @returns the transaction from address
* @example
* ```
* transaction.address // EvmAddress
* ```
*/
get from(): EvmAddress;
/**
* @returns the transaction nonce
* @example
* ```
* transaction.nonce // 326595425
* ```
*/
get nonce(): BigNumber | undefined;
/**
* @returns the transaction gas
* @example
* ```
* transaction.gas // 6721975
* ```
*/
get gas(): BigNumber | undefined;
/**
* @returns the transaction gas price
* @example
* ```
* transaction.gasPrice // 20000000000
* ```
*/
get gasPrice(): BigNumber;
/**
* @returns the transaction gas used
* @example
* ```
* transaction.gasUsed // 1340925
* ```
*/
get gasUsed(): BigNumber;
/**
* @returns the transaction cumulative gas used
* @example
* ```
* transaction.cumulativeGasUsed // 1340925
* ```
*/
get cumulativeGasUsed(): BigNumber;
/**
* @returns the transaction block number
* @example
* ```
* transaction.blockNumber // 12526958
* ```
*/
get blockNumber(): BigNumber;
/**
* @returns the transaction value
* @example
* ```
* transaction.value // EvmNative
* ```
*/
get value(): EvmNative | undefined;
/**
* @returns the transaction chain
* @example
* ```
* transaction.chain // EvmChain
* ```
*/
get chain(): EvmChain;
/**
* @returns the transaction contract address
* @example
* ```
* transaction.contractAddress // EvmAddress
* ```
*/
get contractAddress(): EvmAddress | undefined;
/**
* @returns the transaction logs
* @example
* ```
* transaction.logs // EvmTransactionLog[]
* ```
*/
get logs(): EvmTransactionLog[];
/**
* @returns the transaction receipt root
* @example
* ```
* transaction.receiptRoot // string
* ```
*/
get receiptRoot(): string | undefined;
/**
* @returns the transaction receipt status
* @example
* ```
* transaction.receiptStatus // 1
* ```
*/
get receiptStatus(): number | undefined;
/**
* @returns the transaction data
* @example
* ```
* transaction.data // 0x000000000000000000000000000000000000000000000000000000000000002
* ```
*/
get data(): string | undefined;
/**
* @returns the transaction hash
* @example
* ```
* transaction.hash // 0x057Ec652A4F150f7FF94f089A38008f49a0DF88e
* ```
*/
get hash(): string;
/**
* @returns the transaction type
* @example
* ```
* transaction.type // 1
* ```
*/
get type(): number | undefined;
/**
* @returns the transaction black hash
* @example
* ```
* transaction.blockHash // 0x0372c302e3c52e8f2e15d155e2c545e6d802e479236564af052759253b20fd86
* ```
*/
get blockHash(): string;
/**
* @returns the transaction block timestamp
* @example
* ```
* transaction.blockTimestamp // Date
* ```
*/
get blockTimestamp(): Date;
}
//# sourceMappingURL=EvmTransaction.d.ts.map

@@ -20,2 +20,9 @@ "use strict";

var EvmTransactionLog_1 = require("../EvmTransactionLog");
/**
* The EvmTranaction is a representation of a published transaction.
*
* Use this class any time you work with a transaction.
*
* @category DataType
*/
var EvmTransaction = /** @class */ (function () {

@@ -25,2 +32,10 @@ function EvmTransaction(data) {

}
/**
* Create a new instance of EvmTransaction from any valid transaction input
* @param data - the EvmTransactionish type
* @example
* ```
* const transaction = EvmTransaction.create(data);
*```
*/
EvmTransaction.create = function (data) {

@@ -32,2 +47,11 @@ if (data instanceof EvmTransaction) {

};
/**
* Check the equality between two Evm transactions
* @param dataA - The first transaction
* @param dataB - The second transaction
* @example
* ```ts
* EvmTransaction.equals(dataA, dataB)
* ```
*/
EvmTransaction.equals = function (dataA, dataB) {

@@ -44,2 +68,10 @@ var transactionA = EvmTransaction.create(dataA);

};
/**
* Checks the equality of the current transaction with another evm transaction
* @param data - the transaction to compare with
* @example
* ```ts
* transaction.equals(data)
* ```
*/
EvmTransaction.prototype.equals = function (data) {

@@ -51,4 +83,11 @@ return EvmTransaction.equals(this, data);

var data = this._data;
return __assign(__assign({}, data), { to: (_a = data.to) === null || _a === void 0 ? void 0 : _a.format(), from: (_b = data.from) === null || _b === void 0 ? void 0 : _b.format(), nonce: (_c = data.nonce) === null || _c === void 0 ? void 0 : _c.toString(), gas: (_d = data.gas) === null || _d === void 0 ? void 0 : _d.toString(), gasPrice: (_e = data.gasPrice) === null || _e === void 0 ? void 0 : _e.toString(), gasUsed: (_f = data.gasUsed) === null || _f === void 0 ? void 0 : _f.toString(), cumulativeGasUsed: (_g = data.cumulativeGasUsed) === null || _g === void 0 ? void 0 : _g.toString(), blockNumber: (_h = data.blockNumber) === null || _h === void 0 ? void 0 : _h.toString(), value: (_j = data.value) === null || _j === void 0 ? void 0 : _j.toString(), chain: (_k = data.chain) === null || _k === void 0 ? void 0 : _k.format(), contractAddress: (_l = data.contractAddress) === null || _l === void 0 ? void 0 : _l.format(), logs: data.logs.map(function (log) { return log.toJSON(); }) });
return __assign(__assign({}, data), { to: (_a = data.to) === null || _a === void 0 ? void 0 : _a.format(), from: (_b = data.from) === null || _b === void 0 ? void 0 : _b.format(), nonce: (_c = data.nonce) === null || _c === void 0 ? void 0 : _c.toString(), gas: (_d = data.gas) === null || _d === void 0 ? void 0 : _d.toString(), gasPrice: (_e = data.gasPrice) === null || _e === void 0 ? void 0 : _e.toString(), gasUsed: (_f = data.gasUsed) === null || _f === void 0 ? void 0 : _f.toString(), cumulativeGasUsed: (_g = data.cumulativeGasUsed) === null || _g === void 0 ? void 0 : _g.toString(), blockNumber: (_h = data.blockNumber) === null || _h === void 0 ? void 0 : _h.toString(), value: (_j = data.value) === null || _j === void 0 ? void 0 : _j.toString(), chain: (_k = data.chain) === null || _k === void 0 ? void 0 : _k.format(), contractAddress: (_l = data.contractAddress) === null || _l === void 0 ? void 0 : _l.format(), logs: data.logs.map(function (log) { return log.toJSON(); }), blockTimestamp: data.blockTimestamp.toString() });
};
/**
* @returns a JSON represention of the transaction.
* @example
* ```
* transaction.format()
* ```
*/
EvmTransaction.prototype.format = function () {

@@ -58,2 +97,9 @@ return this.toJSON();

Object.defineProperty(EvmTransaction.prototype, "result", {
/**
* @returns the transaction
* @example
* ```
* transaction.result
* ```
*/
get: function () {

@@ -65,2 +111,268 @@ return this._data;

});
Object.defineProperty(EvmTransaction.prototype, "to", {
/**
* @returns the transaction to address
* @example
* ```
* transaction.to // EvmAddress
* ```
*/
get: function () {
return this._data.to;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "from", {
/**
* @returns the transaction from address
* @example
* ```
* transaction.address // EvmAddress
* ```
*/
get: function () {
return this._data.from;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "nonce", {
/**
* @returns the transaction nonce
* @example
* ```
* transaction.nonce // 326595425
* ```
*/
get: function () {
return this._data.nonce;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "gas", {
/**
* @returns the transaction gas
* @example
* ```
* transaction.gas // 6721975
* ```
*/
get: function () {
return this._data.gas;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "gasPrice", {
/**
* @returns the transaction gas price
* @example
* ```
* transaction.gasPrice // 20000000000
* ```
*/
get: function () {
return this._data.gasPrice;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "gasUsed", {
/**
* @returns the transaction gas used
* @example
* ```
* transaction.gasUsed // 1340925
* ```
*/
get: function () {
return this._data.gasUsed;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "cumulativeGasUsed", {
/**
* @returns the transaction cumulative gas used
* @example
* ```
* transaction.cumulativeGasUsed // 1340925
* ```
*/
get: function () {
return this._data.cumulativeGasUsed;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "blockNumber", {
/**
* @returns the transaction block number
* @example
* ```
* transaction.blockNumber // 12526958
* ```
*/
get: function () {
return this._data.blockNumber;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "value", {
/**
* @returns the transaction value
* @example
* ```
* transaction.value // EvmNative
* ```
*/
get: function () {
return this._data.value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "chain", {
/**
* @returns the transaction chain
* @example
* ```
* transaction.chain // EvmChain
* ```
*/
get: function () {
return this._data.chain;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "contractAddress", {
/**
* @returns the transaction contract address
* @example
* ```
* transaction.contractAddress // EvmAddress
* ```
*/
get: function () {
return this._data.contractAddress;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "logs", {
/**
* @returns the transaction logs
* @example
* ```
* transaction.logs // EvmTransactionLog[]
* ```
*/
get: function () {
return this._data.logs;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "receiptRoot", {
/**
* @returns the transaction receipt root
* @example
* ```
* transaction.receiptRoot // string
* ```
*/
get: function () {
return this._data.receiptRoot;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "receiptStatus", {
/**
* @returns the transaction receipt status
* @example
* ```
* transaction.receiptStatus // 1
* ```
*/
get: function () {
return this._data.receiptStatus;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "data", {
/**
* @returns the transaction data
* @example
* ```
* transaction.data // 0x000000000000000000000000000000000000000000000000000000000000002
* ```
*/
get: function () {
return this._data.data;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "hash", {
/**
* @returns the transaction hash
* @example
* ```
* transaction.hash // 0x057Ec652A4F150f7FF94f089A38008f49a0DF88e
* ```
*/
get: function () {
return this._data.hash;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "type", {
/**
* @returns the transaction type
* @example
* ```
* transaction.type // 1
* ```
*/
get: function () {
return this._data.type;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "blockHash", {
/**
* @returns the transaction black hash
* @example
* ```
* transaction.blockHash // 0x0372c302e3c52e8f2e15d155e2c545e6d802e479236564af052759253b20fd86
* ```
*/
get: function () {
return this._data.blockHash;
},
enumerable: false,
configurable: true
});
Object.defineProperty(EvmTransaction.prototype, "blockTimestamp", {
/**
* @returns the transaction block timestamp
* @example
* ```
* transaction.blockTimestamp // Date
* ```
*/
get: function () {
return this._data.blockTimestamp;
},
enumerable: false,
configurable: true
});
EvmTransaction.parse = function (data) {

@@ -67,0 +379,0 @@ var _a;

@@ -6,2 +6,28 @@ import { BigNumber, BigNumberish, DateInput } from '@moralisweb3/core';

import { EvmTransactionLogish, EvmTransactionLog } from '../EvmTransactionLog';
/**
* This can be any object with valid transaction data.
* @example
* ```
* const transactionInput = {
cumulativeGasUsed: "1340925",
gasPrice: "20000000000",
gasUsed: "1340925",
index: "25",
contractAddress: "0x1d6a4cf64b52f6c73f201839aded7379ce58059c",
receiptRoot: "string",
receiptStatus: "1",
chain: "1",
data: "0x000000000000000000000000000000000000000000000000000000000000002",
from: "0xd4a3BebD824189481FC45363602b83C9c7e9cbDf",
hash: "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e",
nonce: "326595425",
value: "650000000000000000",
blockHash: "0x0372c302e3c52e8f2e15d155e2c545e6d802e479236564af052759253b20fd86",
blockNumber: "12526958",
blockTimestamp: new Date("2021-04-02T10:07:54.000Z"),
gas: "6721975",
to: "0xa71db868318f0a0bae9411347cd4a6fa23d8d4ef",
}
* ```
*/
export interface EvmTransacionInput {

@@ -29,2 +55,5 @@ from: EvmAddressish;

}
/**
* This is the return type of the processed EVM transaction
*/
export interface EvmTransactionData {

@@ -31,0 +60,0 @@ from: EvmAddress;

{
"name": "@moralisweb3/evm-utils",
"author": "Moralis",
"version": "2.1.0",
"version": "2.1.1",
"license": "MIT",

@@ -30,4 +30,4 @@ "private": false,

"@ethersproject/transactions": "^5.6.0",
"@moralisweb3/core": "^2.1.0"
"@moralisweb3/core": "^2.1.1"
}
}

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