Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E@ scenes don't listen to Metamask #3186

Open
nearnshaw opened this issue Jan 22, 2025 · 0 comments
Open

E@ scenes don't listen to Metamask #3186

nearnshaw opened this issue Jan 22, 2025 · 0 comments
Labels
bug Something isn't working new Issues to triage
Milestone

Comments

@nearnshaw
Copy link
Member

nearnshaw commented Jan 22, 2025

📔 Issue Description:

This functionality is pending implementation in E@.

With the old client, I was able to have a paid entrance to a building. If I interact with a button, Metamask opens up to accept a tx, once the tx is approved the door opens in my scene.
With the new client, with the same code I can get Metamask to open, but then if I accept the tx nothing happens.

Scenes use the sendAsync method. Currently that method is failing here:

Image

Several scenes use this library to simplify the use of blockchain functionality. Meaning creators will rarely use the sendAsync directly in their code, but it gets used implicitly:
https://github.com/decentraland/dcl-crypto-toolkit

With that library, you should be able to use the following statement to send MANA to an address. The callback in the then() statement is executed once after the tx is mined and added to a block in the blockchain.

crypto.mana.send(myWallet, numericAmount, true).then(() => { ... }

This approach should also work:

import { executeTask } from '@dcl/sdk/ecs'
import * as crypto from 'dcl-crypto-toolkit'

const testAddressTarget = '0x04812c531083054863ef354EF600A61857921466'

export function main() {
    executeTask(async () => {
        const balance = await crypto.mana.balance(testAddressTarget )
        console.log('First Mana balance:', balance)

        try {
            await crypto.mana.send(testAddressTarget, 10, false)
            console.log('Mana sent successfully!')
        }catch(e){
            console.log(e)
        } finally {
            try {
                const balance = await crypto.mana.balance(testAddressTarget )
                console.log('Then Mana balance:', balance)
            }catch(e){
                console.log(e)
            }
        }
    })
}
[10:02](https://decentralandteam.slack.com/archives/C01QVR7TJK1/p1731416526211729?thread_ts=1731413337.269199&cid=C01QVR7TJK1)

Misha mentions that the following API could maybe be useful, but this needs research:

      [PublicAPI("Used by StreamingAssets/Js/Modules/EthereumController.js")]
        public object TryPay(decimal amount, string currency, string toAddress)
        {
            //TODO no payments yet
            return new SendEthereumMessageResponse
                { jsonAnyResponse = "{}" };
        }

STR:

  1. Download this scene
    https://github.com/koshimazaki/sdk7-goerli-plaza/tree/main/Paid-Button
  2. Run npm i and npm run start -- --explorer-alpha to run in preview
  3. Click on the button, accept the tx in the UI. Metamask will open on your browser to confirm the transaction. After you do, the door would open on the Web explorer, not on the E@

TIP: When opening the explorer use the following to connect the explorer to the testnet and avoid sending real money while testing the scene. You will need to own MANA on Sepolia:
decentraland://realm=http://127.0.0.1:8000&local-scene=true&debug=true&dclenv=zone&position=0,0

✔️ Expected Result:

The door should open. This is how it behaves on the Web explorer.

Actual Result with evidence:

The transaction completes and nothing happens. No communication comes back from Metamask to the Explorer.

Repro Index:

100%, the functionality is pending implementation.

🖥️ Operative system and additional Notes:

This happens on all operating systems

@nearnshaw nearnshaw added bug Something isn't working new Issues to triage labels Jan 22, 2025
@aixaCode aixaCode added this to the Cycle 11 milestone Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working new Issues to triage
Projects
Status: Todo
Development

No branches or pull requests

2 participants