Skip to content

Call contract method with integer value #243

@gupta977

Description

@gupta977

ERROR
$contract2->at($contractAddress)->call('getID', "123456789012", function ($err, $result) use ($contract2)
If integer value is passed and method returns string, it treated as smart contract error.

WORKING
$contract2->at($contractAddress)->call('getID', "a123456789012", function ($err, $result) use ($contract2)
If string is passed and returns string, it is working properly.

Only number as input is not supported.

$testAbi1 = '[
        {
          "inputs": [
            {
              "internalType": "string",
              "name": "title",
              "type": "string"
            }
          ],
          "name": "getID",
          "outputs": [
            {
              "internalType": "string",
              "name": "",
              "type": "string"
            }
          ],
          "stateMutability": "view",
          "type": "function",
          "constant": true
        }]';
 $contract2 = new Contract($URL, $testAbi1);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions