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

web3-plugin-example

Package Overview
Dependencies
Maintainers
0
Versions
358
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web3-plugin-example - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2-dev.2011192.0

7

lib/request_manager_middleware.js

@@ -31,7 +31,6 @@ "use strict";

}
else if ((reqObj).method === 'eth_call' &&
Array.isArray((reqObj).params)) {
(reqObj) = Object.assign(Object.assign({}, (reqObj)), {
else if (reqObj.method === 'eth_call' && Array.isArray(reqObj.params)) {
reqObj = Object.assign(Object.assign({}, reqObj), {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
params: [...((_a = (reqObj).params) !== null && _a !== void 0 ? _a : []), '0x0', '0x1'] });
params: [...((_a = reqObj.params) !== null && _a !== void 0 ? _a : []), '0x0', '0x1'] });
}

@@ -38,0 +37,0 @@ return Promise.resolve(reqObj);

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

import { TransactionMiddleware, TransactionMiddlewareData } from "web3-eth";
import { TransactionMiddleware, TransactionMiddlewareData } from 'web3-eth';
export declare class Web3TransactionMiddleware implements TransactionMiddleware {

@@ -3,0 +3,0 @@ processTransaction(transaction: TransactionMiddlewareData, _options?: {

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

exports.Web3TransactionMiddleware = void 0;
// Sample Transaction Middleware
// Sample Transaction Middleware
class Web3TransactionMiddleware {

@@ -37,3 +37,3 @@ // eslint-disable-next-line class-methods-use-this

let txObj = Object.assign({}, transaction);
// Add your logic here for transaction modification
// Add your logic here for transaction modification
txObj.data = '0x123';

@@ -40,0 +40,0 @@ return Promise.resolve(txObj);

{
"name": "web3-plugin-example",
"version": "1.1.1",
"version": "1.1.2-dev.2011192.0+2011192",
"description": "Example implementations of Web3.js' 4.x plugin system",

@@ -48,8 +48,8 @@ "repository": "https://github.com/ChainSafe/web3.js",

"typescript": "^4.7.4",
"web3": "^4.11.0",
"web3-core": "^4.5.0",
"web3-eth-abi": "^4.2.3",
"web3-eth-contract": "^4.6.0",
"web3-types": "^1.7.0",
"web3-utils": "^4.3.1"
"web3": "4.15.1-dev.2011192.0+2011192",
"web3-core": "4.7.1-dev.2011192.0+2011192",
"web3-eth-abi": "4.4.1-dev.2011192.0+2011192",
"web3-eth-contract": "4.7.2-dev.2011192.0+2011192",
"web3-types": "1.9.1-dev.2011192.0+2011192",
"web3-utils": "4.3.3-dev.2011192.0+2011192"
},

@@ -64,3 +64,3 @@ "peerDependencies": {

},
"gitHead": "2b6f7f5435230d860f55766f2d2a3c1358227e4f"
"gitHead": "2011192f92218aa1572f2c711f38866eba92f844"
}

@@ -41,10 +41,7 @@ /*

public link(parentContext: Web3Context): void {
if (this.web3Middleware) parentContext.requestManager.setMiddleware(this.web3Middleware);
if (this.web3Middleware)
parentContext.requestManager.setMiddleware(this.web3Middleware);
super.link(parentContext);
}
public async customRpcMethod() {

@@ -63,3 +60,2 @@ return this.requestManager.send({

}
}

@@ -66,0 +62,0 @@

@@ -45,12 +45,9 @@ /*

});
} else if (
(reqObj ).method === 'eth_call' &&
Array.isArray((reqObj ).params)
) {
(reqObj ) = {
...(reqObj ),
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
params: [...((reqObj ).params ?? []), '0x0', '0x1'],
};
}
} else if (reqObj.method === 'eth_call' && Array.isArray(reqObj.params)) {
reqObj = {
...reqObj,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
params: [...(reqObj.params ?? []), '0x0', '0x1'],
};
}

@@ -57,0 +54,0 @@ return Promise.resolve(reqObj as JsonRpcPayload<ParamType>);

@@ -34,6 +34,5 @@ /*

public link(parentContext: Web3Context): void {
if (this.txMiddleware) {
// Following can modify Web3-Eth and also Web3-Eth-Contract packages transactions
if (this.txMiddleware){
// Following can modify Web3-Eth and also Web3-Eth-Contract packages transactions
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call

@@ -45,4 +44,2 @@ (parentContext as any).Web3Eth.setTransactionMiddleware(this.txMiddleware);

}
}

@@ -18,17 +18,15 @@ /*

import { TransactionMiddleware, TransactionMiddlewareData } from "web3-eth";
import { TransactionMiddleware, TransactionMiddlewareData } from 'web3-eth';
// Sample Transaction Middleware
// Sample Transaction Middleware
export class Web3TransactionMiddleware implements TransactionMiddleware {
// eslint-disable-next-line class-methods-use-this
public async processTransaction(transaction: TransactionMiddlewareData,
_options?: { [key: string]: unknown } | undefined):
Promise<TransactionMiddlewareData> {
public async processTransaction(
transaction: TransactionMiddlewareData,
_options?: { [key: string]: unknown } | undefined,
): Promise<TransactionMiddlewareData> {
// eslint-disable-next-line prefer-const
let txObj = { ...transaction };
// Add your logic here for transaction modification
// Add your logic here for transaction modification
txObj.data = '0x123';

@@ -38,3 +36,2 @@

}
}

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

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