CRYPTO NEWS

web3.currentProvider.sendAsync() or web3.currentProvider.send() not working on React native

I am currently working on a React native project that requires me to implement EIP712 typed hashing and signing.

I have implemented the code on React with Metamask, where the both web3.currentProvider.sendAsync() or web3.currentProvider.send() returned the required a signed hash. The method used for signing is eth_signTypedData_v4.

But when trying the similar code on react native it returns an error that looks something like this:

ERROR {"error": {"code": -32700, "message": "err:[]*jsonrpc.Request: decode slice: expect [ or n, but found {, error found in #1 byte of ...|{"signMetho|..., bigger context ...|{"signMethod":"eth_signTypedData_v4","params":["0x5|... when unmarshal request"}, "id": "", "jsonrpc": "2.0"} 

I even tried using web3.eth.sign() and web3.eth.personal.sign(), but the hash returned isn’t the one as required, as it fails in getting the verification in the smart contract.

Following is the Code that I have implement on my React naitve project:

    const params = [account.address, msgParams];     const from = account.address;      console.log(params)      web3.currentProvider?.send({         signMethod,         params,         from     },         async function (err: any, result: any) {             if (err) return console.dir(err)             if (result.error) {                 console.log(result.error.message)             }             if (result.error) return console.error('ERROR', result)             console.log('TYPED SIGNED:' + JSON.stringify(result.result))              console.log("Signature result from wallet :");             console.log(result);             if (result && result.result) {                 const signature = result.result.substring(2);                 const r = "0x" + signature.substring(0, 64);                 const s = "0x" + signature.substring(64, 128);                 const v = parseInt(signature.substring(128, 130), 16);                 console.log("r:", r);                 console.log("s:", s);                 console.log("v:", v);                 console.log(account.address, "userAddress")                  const promiEvent = await contract.methods                     .doingsomething(account.address, r, s, v)                     .send({ from: account.address });                  console.log(promiEvent);                  if (promiEvent) {                     created()                 } else {                     failed("Could not get user signature.");                 }                  const response = await vaultContract.methods.vaults(account.address).call();                 console.log(response)             } else {                 failed("Could not get user signature.");             }         }) 

Following are the version of the packages that are being used:

"web3": "^1.7.0" "react-native": "0.67.2",

Chainlink newbie doubts

I’m starting my studies about Chainlink this week and right now I’m trying to fit all together before I continue my exploration of Chainlink docs. May be you could help me in this task. Could you confirm this understanding? As I’ve already read, there are 3 models in Chainlink: Decentralized Data Model with Flux Aggregator::Listen

I’m starting my studies about Chainlink this week and right now I’m trying to fit all together before I continue my exploration of Chainlink docs. May be you could help me in this task.

Could you confirm this understanding?

As I’ve already read, there are 3 models in Chainlink:

  • Decentralized Data Model with Flux Aggregator where the oracle smart contract receives prices report of crypto assets and aggregate them to offer this information to consumers. However, this model is being deprecated in favor of OCR, right?
  • The Off-Chain Reporting that aggregates the prices of crypto assets off-chain and send a single transaction to the oracle smart contract and this smart contract offer the median of prices to the consumers.
  • Basic Request Model where it is possible to call any Chainlink job. Typically, this job is a API calling with some transformations before the result is sent to the smart contract consumer.

If I’m not misunderstanding this basics concepts, I have some doubts:

  • The first two models, DDM and OCR, are only for assets’ prices or they could be used for other kinds of data since exists oracles providing that data? If true, are there real examples of this kind of usage?
  • About the Basic Request Model, I feel like it is a centralized solution, I haven’t seen any step of aggregation/conciliation, only one node responds and that is it. Is this understanding right or I’m missing something?
  • Another concept not clear yet: what is a Data Provider? I found out this page https://market.link/search/data-providers and seems like centralized providers of data, is that right?

web3.currentProvider.sendAsync() or web3.currentProvider.send() not working on React native

Shopping cart
There are no products in the cart!
Continue shopping
0