web3-plugin-example
Advanced tools
Comparing version 1.1.1 to 1.1.2-dev.2011192.0
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
99906
1291
2
1