wealdtech / ethereal

Apache License 2.0
209 stars 41 forks source link

How to format in the "send" command #31

Closed danimesq closed 2 years ago

danimesq commented 2 years ago

Is ethereal contract send --contract=0xfa28eC7198028438514b49a3CF353BcA5541ce1d --json=Peepeth.json --call='post(ipfs-hash)' --from=0xDDfC2e10702d8A781727A34D83B3bb3CA94a3E91 correct?

Using the Peepeth ABI on justsmartcontracts:

Screenshot from 2021-10-14 11-02-36

How to properly pass to the "send" command that the call is post and _ipfsHash (string)?

Peepeth.json:

[{"constant":false,"inputs":[{"name":"_followee","type":"address"}],"name":"unFollow","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x034889ff"},{"constant":false,"inputs":[{"name":"_ipfsHash","type":"string"}],"name":"updateAccount","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x141926fa"},{"constant":true,"inputs":[],"name":"isActive","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x22f3e2d4"},{"constant":false,"inputs":[{"name":"_isActive","type":"bool"}],"name":"setIsActive","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x2750fc78"},{"constant":false,"inputs":[{"name":"_followee","type":"address"}],"name":"follow","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x4dbf27cc"},{"constant":false,"inputs":[{"name":"_name","type":"bytes16"}],"name":"changeName","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x5047b337"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"names","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x5cf3d346"},{"constant":false,"inputs":[{"name":"_ipfsHash","type":"string"}],"name":"reply","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x5ebe7c72"},{"constant":true,"inputs":[{"name":"","type":"bytes32"}],"name":"addresses","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x699f200f"},{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"setNewAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x71587988"},{"constant":true,"inputs":[{"name":"_addr","type":"address"}],"name":"accountExists","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x75cd51ed"},{"constant":true,"inputs":[{"name":"bStr","type":"bytes16"}],"name":"isValidName","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function","signature":"0x767eb8ad"},{"constant":false,"inputs":[{"name":"_ipfsHash","type":"string"}],"name":"share","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x7f630b4c"},{"constant":false,"inputs":[{"name":"_ipfsHash","type":"string"}],"name":"saveBatch","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x80dfa34a"},{"constant":false,"inputs":[],"name":"cashout","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x84054d3d"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x8da5cb5b"},{"constant":false,"inputs":[{"name":"_ipfsHash","type":"string"}],"name":"post","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x8ee93cf3"},{"constant":false,"inputs":[{"name":"_name","type":"bytes16"},{"name":"_ipfsHash","type":"string"}],"name":"createAccount","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x8f929c4a"},{"constant":false,"inputs":[{"name":"newMinPercentage","type":"uint256"}],"name":"setMinSiteTipPercentage","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x963e2680"},{"constant":false,"inputs":[{"name":"_author","type":"address"},{"name":"_messageID","type":"string"},{"name":"_ownerTip","type":"uint256"},{"name":"_ipfsHash","type":"string"}],"name":"tip","outputs":[],"payable":true,"stateMutability":"payable","type":"function","signature":"0xae1cad3a"},{"constant":true,"inputs":[],"name":"newAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xccdb3f45"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"interfaceInstances","outputs":[{"name":"interfaceAddress","type":"address"},{"name":"startBlock","type":"uint96"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xdbfa6226"},{"constant":false,"inputs":[{"name":"_address","type":"address"}],"name":"transferAccount","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xe4852b9b"},{"constant":false,"inputs":[],"name":"lockMinSiteTipPercentage","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xec0b529f"},{"constant":true,"inputs":[],"name":"interfaceInstanceCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xec8e1afa"},{"constant":true,"inputs":[],"name":"minSiteTipPercentage","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xee19fe96"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xf2fde38b"},{"constant":true,"inputs":[],"name":"tipPercentageLocked","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xfde20b6c"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[],"name":"PeepethEvent","type":"event","signature":"0xf894eb6b6b7c1337f8bcbc258277160f8627cff828907252cb7db60c7f3fae02"}]

References: https://github.com/wealdtech/ethereal#send, https://justsmartcontracts.dev/#/

danimesq commented 2 years ago

@wealdtech @mcdee

danimesq commented 2 years ago

Also: https://github.com/wealdtech/ethereal/issues/32

mcdee commented 2 years ago

From the help output:

--abi string        ABI, or path to ABI, for the contract
--json string       JSON, or path to JSON, for the contract as output by solc --combined-json=bin,abi

So you want to use --abi not --json.

danimesq commented 2 years ago

@mcdee

So you want to use --abi not --json.

Many thanks for pointing out. Have tried it:

ethereal contract send --contract=0xfa28eC7198028438514b49a3CF353BcA5541ce1d --abi=Peepeth.json --call='post(ipfs-hash)' --from=0xDDfC2e10702d8A781727A34D83B3bb3CA94a3E91

Output:

line 1:5 mismatched input 'ipfs' expecting ')' Failed to convert arguments: argument count mismatch: got 0 for 1

How to format it so it can work like in https://justsmartcontracts.dev/#/?

Example:

Screenshot from 2021-10-14 11-02-36

How to format the --call='post(ipfs-hash)' so it can support post>_ipfsHash (string)?

mcdee commented 2 years ago

As the ABI says, it is a string so needs to be quoted. Something like:

ethereal contract send --contract=0xfa28eC7198028438514b49a3CF353BcA5541ce1d --abi=Peepeth.json --call='post("hashgoeshere")' --from=0xDDfC2e10702d8A781727A34D83B3bb3CA94a3E91