TypeError: Attempted to assign to readonly property.
We find the cause of this error at node_modules/web3-core-methods/src/index.js
var Method = function Method(options) {
if (!options.call || !options.name) {
throw new Error('When creating a method you need to provide at least the "name" and "call" property.');
}
this.name = options.name;
this.call = options.call;
this.params = options.params || 0;
Now, as Function.protoype.call was frozen, this.call = options.call throws
TypeError: Attempted to assign to readonly property.
PoC
https://github.com/LavaMoat/docs/blob/main/react-native-and-ses-lockdown.md
Discussion
Sample Error
We find the cause of this error at
node_modules/web3-core-methods/src/index.js
Now, as
Function.protoype.call
was frozen,this.call = options.call
throwsSolution Proposed
The
Object.defineProperty
workaroundhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
Replace this
By this
Items of Actions