web3-plugin-example
Advanced tools
Comparing version 1.1.2-dev.cbcfc18.0 to 1.1.2-dev.d6baee6.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.2-dev.cbcfc18.0+cbcfc18", | ||
"version": "1.1.2-dev.d6baee6.0+d6baee6", | ||
"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.1-dev.cbcfc18.0+cbcfc18", | ||
"web3-core": "4.5.1-dev.cbcfc18.0+cbcfc18", | ||
"web3-eth-abi": "4.2.4-dev.cbcfc18.0+cbcfc18", | ||
"web3-eth-contract": "4.6.1-dev.cbcfc18.0+cbcfc18", | ||
"web3-types": "1.7.1-dev.cbcfc18.0+cbcfc18", | ||
"web3-utils": "4.3.2-dev.cbcfc18.0+cbcfc18" | ||
"web3": "4.13.1-dev.d6baee6.0+d6baee6", | ||
"web3-core": "4.6.1-dev.d6baee6.0+d6baee6", | ||
"web3-eth-abi": "4.2.5-dev.d6baee6.0+d6baee6", | ||
"web3-eth-contract": "4.7.1-dev.d6baee6.0+d6baee6", | ||
"web3-types": "1.8.1-dev.d6baee6.0+d6baee6", | ||
"web3-utils": "4.3.2-dev.d6baee6.0+d6baee6" | ||
}, | ||
@@ -64,3 +64,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "cbcfc1878502008349f805a2e82e9263a02b717e" | ||
"gitHead": "d6baee6ca3b729d06cb262211a572fbe2361bf68" | ||
} |
@@ -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
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
99906
222
1291
30
2
237