decentraland / marketplace

🏛️ Decentraland's NFT Marketplace
https://market.decentraland.org
Other
1.13k stars 663 forks source link

Marketplace sends full JSON payload to send method #223

Open floating opened 4 years ago

floating commented 4 years ago

I'm using Frame & Frame extension to access the marketplace and I am receiving the error Method is not a valid string.

After some digging it seems to be because Decentraland is sending a full JSON-RPC payload and callback to the provider's window.ethereum.send(method, params) method, which is the wrong signature.

I logged the arguments of the send method below. As you can see this only happens when calling eth_accounts, the other send calls for net_version and eth_subscribe follow the signature correctly.

send: net_version []

send: net_version []

send: {jsonrpc: "2.0", id: 1, method: "eth_accounts", params: Array(0)} ƒ (e,t){if(e)return i(e);if(!t)return i(new Error("No response."));if(!function(e){return Array.isArray(e)?e.every(f):f(e)}(t)){var n=t.error&&t.error.message?t.error.message:"Invalid JSON RPC response…
Uncaught (in promise) Error: Method is not a valid string.
    at <anonymous>:1:1176545
    at new Promise (<anonymous>)
    at FrameProvider._send (<anonymous>:1:1176233)
    at FrameProvider.send (<anonymous>:1:1176642)
    at legacy-provider-adapter.ts:29
    at new Promise (<anonymous>)
    at e.value (legacy-provider-adapter.ts:26)
    at e.<anonymous> (eth.ts:75)
    at u (runtime.js:45)
    at Generator._invoke (runtime.js:274)

send: eth_subscribe ["networkChanged"]

send: eth_subscribe ["accountsChanged"]
nachomazzara commented 4 years ago

Thanks for reporting @floating, We will dig on it. It will be solved by https://github.com/decentraland/decentraland-dapps

floating commented 3 years ago

Any updates here? We really want to be able to use Frame with Decentraland :)

Frame follows the standard EIP-1193 Ethereum provider spec and is injected via window.ethereum just like MetaMask.

floating commented 3 years ago

We're trying to provide a shim for this behavior in eth-provider but it's doesn't seem to be just a signature problem. Do you know where send it being used like this? Is it expecting send to be synchronous?