无法使用元掩码深层链接传递元数据

发布于 2025-01-16 07:58:01 字数 1773 浏览 2 评论 0 原文

这是深层链接:

ethereum:0xBaa11D872cfD22c4D9525E1011af790bB56d656E@1337?value=1e18&data=somedata

这是从上面的 url 生成的 QR

我是无法从 Solidity 合约中的付款接收事件接收元数据,

这是事件日志:

{
  logIndex: 0,
  transactionIndex: 0,
  transactionHash: '0x8d504a1253f30bbc43c5212434dc7dc52a122afc2d08cf6e2c496e34fb316ecd',
  blockHash: '0xcf91cdab48a97255c52532732fff9091a7ff5f371a6552f94aaac55a95fb42b1',
  blockNumber: 33,
  address: '0xBaa11D872cfD22c4D9525E1011af790bB56d656E',
  type: 'mined',
  id: 'log_8ce94ba5',
  returnValues: Result {
    '0': '0x49372600c1BD394922c0B6463611DeD4CbeDAf45',
    '1': '1000000000000000000',
    '2': null,
    _from: '0x49372600c1BD394922c0B6463611DeD4CbeDAf45',
    _amount: '1000000000000000000',
    data: null
  },
  event: 'MoneyReceivedWithData',
  signature: '0xf7d31a904a564a801af9dfae1796bd5fd339d215fedc9314fbfbcffb5c14f205',
  raw: {
    data: '0x0000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000',
    topics: [
      '0xf7d31a904a564a801af9dfae1796bd5fd339d215fedc9314fbfbcffb5c14f205',
      '0x00000000000000000000000049372600c1bd394922c0b6463611ded4cbedaf45'
    ]
  }

这是 Solidity 函数:

事件:

 event MoneyReceived(address indexed _from, uint256 _amount);

回退函数:

 fallback() external payable {
     emit MoneyReceived(msg.sender, msg.value);
 }

正如您所看到的,“returnValues”字段中的“data”字段为空。

请帮忙。我发现无法通过移动元掩码 QR 扫描传输(与深层链接相同)将元数据传递给交易。我需要了解如何构建正确的深层链接 url 以将必要的数据传递到我的 Solidity 事件发射器,或者它是通过深层链接将元数据作为参数传递的一种方法。

This is the deep-link:

ethereum:0xBaa11D872cfD22c4D9525E1011af790bB56d656E@1337?value=1e18&data=somedata

And this is the QR that is generated from the url above

enter image description here

i am not able to receive the metadata from payment receive event in solidity contract

this is the event log:

{
  logIndex: 0,
  transactionIndex: 0,
  transactionHash: '0x8d504a1253f30bbc43c5212434dc7dc52a122afc2d08cf6e2c496e34fb316ecd',
  blockHash: '0xcf91cdab48a97255c52532732fff9091a7ff5f371a6552f94aaac55a95fb42b1',
  blockNumber: 33,
  address: '0xBaa11D872cfD22c4D9525E1011af790bB56d656E',
  type: 'mined',
  id: 'log_8ce94ba5',
  returnValues: Result {
    '0': '0x49372600c1BD394922c0B6463611DeD4CbeDAf45',
    '1': '1000000000000000000',
    '2': null,
    _from: '0x49372600c1BD394922c0B6463611DeD4CbeDAf45',
    _amount: '1000000000000000000',
    data: null
  },
  event: 'MoneyReceivedWithData',
  signature: '0xf7d31a904a564a801af9dfae1796bd5fd339d215fedc9314fbfbcffb5c14f205',
  raw: {
    data: '0x0000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000',
    topics: [
      '0xf7d31a904a564a801af9dfae1796bd5fd339d215fedc9314fbfbcffb5c14f205',
      '0x00000000000000000000000049372600c1bd394922c0b6463611ded4cbedaf45'
    ]
  }

this is the solidity functions:

Event:

 event MoneyReceived(address indexed _from, uint256 _amount);

Fallback function:

 fallback() external payable {
     emit MoneyReceived(msg.sender, msg.value);
 }

and as you can see the "data" field in the "returnValues" field is null.

Please help. I found no way to pass a metadata to transaction via mobile metamask QR scan transfer (same as deep-link). I need to understand how to build a proper deep-link url to pass the necessary data to my solidity event-emiter or is it a way to pass a metadata as a parameter through deep-link.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文