Giter Site home page Giter Site logo

Comments (6)

hewigovens avatar hewigovens commented on June 11, 2024

hi, can you share your json playload and expected signature here?

from trust-wallet-ios.

leroldary avatar leroldary commented on June 11, 2024

Hi,
Payload:

  const payload = {
    types:{
      EIP712Domain:[],
      Test:[
        {name: "test", type: "uint64"}
      ],
    },
    primaryType:"Test",
    domain: {},
    message: {
      test: 1,
    },
  };

The expected hash is 0x34091011761262618af3045f97715b4a73eb6737c9396353b85b757201e3ad9f (produced with eth-sig-util)

from trust-wallet-ios.

hewigovens avatar hewigovens commented on June 11, 2024

it's weird, I can get exact 0x34091011761262618af3045f97715b4a73eb6737c9396353b85b757201e3ad9f
here is the test code:

func testUint64() throws {
        let jsonString = """
        {
            "types": {
                "EIP712Domain": [],
                "Test": [
                    {"name": "test", "type": "uint64"}
                ],
            },
            "primaryType": "Test",
            "domain": {},
            "message": {
                "test": 1
            }
        }
        """
        let typed = try JSONDecoder().decode(EIP712TypedData.self, from: jsonString.data(using: .utf8)!)
        let signhash = typed.signHash

        XCTAssertEqual(signhash.hexString, "34091011761262618af3045f97715b4a73eb6737c9396353b85b757201e3ad9f")
    }

put it in this file: https://github.com/TrustWallet/trust-core/blob/master/Tests/Ethereum/Solidity/EIP712/EIP712TypedDataTests.swift

from trust-wallet-ios.

hewigovens avatar hewigovens commented on June 11, 2024

Simulator Screen Shot - iPhone Xʀ - 2019-05-22 at 10 51 56

from trust-wallet-ios.

leroldary avatar leroldary commented on June 11, 2024

Seems the second example is only failing on android. Sorry for the confusion.

This is failing on android and iOS:

  const typedData = {
  types:{
    EIP712Domain:[
      {name:"name",type:"string"},
      {name:"version",type:"string"},
      {name:"chainId",type:"uint256"},
      {name:"verifyingContract",type:"address"}
    ],
    Person:[
      {name:"age",type:"uint64"},
      {name:"name",type:"string"},
      {name:"wallet",type:"address"}
    ],
    Mail:[
      {name:"from",type:"Person"},
      {name:"to",type:"Person"},
      {name:"contents",type:"string"},
      {name: "id", type: "uint256"},
    ]
  },
  primaryType:"Mail",
  domain:{name:"Ether Mail",version:"1",chainId:1,verifyingContract:"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC"},
  message:{
    from:{age: 46,name:"Cow",wallet:"0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826"},
    to:{age: 445711732, name:"Bob",wallet:"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB"},
    contents:"Hello, Bob!",
    id: "18446744073709551617"}
  };

The expected hash is: 0xd7452bcc4deef52ad1a3f658f4100fa870fcb849b2f8c7738c23bd8e736e6c7b

from trust-wallet-ios.

hewigovens avatar hewigovens commented on June 11, 2024

Thanks, we can reproduce this bug, and it will be fixed in future releases

from trust-wallet-ios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.