casper-wallet icon indicating copy to clipboard operation
casper-wallet copied to clipboard

Casper Wallet | Signature request | Show called contract hash

Open davidatwhiletrue opened this issue 3 years ago • 2 comments

In this screen, it would be helpful to show the contract hash that's being called. If the call is via the contract package, then show the contract package hash and the version number.

image

davidatwhiletrue avatar Jan 25 '23 14:01 davidatwhiletrue

I have completed the requirements & dependency analysis of this ticket. contract hash is available in the deploy, version is an optional argument for StoredVersionContractByHash and it will be shown only when provided, in case it's empty we can show latest as it will call the latest version. Same situation for StoredVersionContractByName @davidatwhiletrue Furthermore, when a deploy is calling contracts by name we will show the NamedKeys argument.

Blocker: it's also blocked by the design specs @adammake

piotrwitek avatar Feb 13 '23 11:02 piotrwitek

@piotrwitek as described, the contract should be displayed to the user on the "Sign" screen. The entry point name alone is insufficient as multiple contracts may have identically named entry points, thus the contract identification is necessary.

There are six different ways of creating a deploy on the Casper network, each of which should have its own representation in the Wallet. The method used to call a deploy can be determined from the session key within the deploy structure.

Below are the six deploy execution types with examples (here is the corresponding definition from the Casper node sources)

Type Session key Example Casper Wallet representation Notes
WASM byte-code ModuleBytes 0000...6127 "Type" field with the word "WASM" as the value. E.g. Type: WASM
On-chain contract called by hash StoredContractByHash 0001...8ae6 "Type" field with the word "Contract call" as value and the "Contract" field with the shortened contract hash with a possibility of full preview, e.g. Type: Contract call and Contract: dead...beef
On-chain contract called by user-defined name StoredContractByName 0009...bf2f1 "Type" field with the word "Contract call" as value and the "Contract" field with the contract name defined by the user, e.g. Type: Contract call and Contract: faucet The alias is defined in the user namespace and works only for the user who defined it.
On-chain contract called by its contract package hash and version StoredVersionedContractByHash 01b6...1b64 "Type" field with the word "Contract call" as value and the "Contract Package" field with shortened contract package hash with a possibility of full preview and "Contract Version" field with the called contract version. E.g. Type: Contract call and Contract Package: dead...beef and Contract Version: latest The version defaults to the latest if omitted
On-chain contract called by user-defined contract package name and version StoredVersionedContractByName 00e21...e966 "Type" field with the word "Contract call" as value and the "Contract Package" field with the contract package name defined by the user and "Contract Version" field with the called contract version. E.g. Type: Contract call and Contract Package: faucet and Contract Version: 1 The version defaults to the latest if omitted. The alias is defined in the user namespace and works only for the user who defined it.
Natively defined transfer contract known as "Native transfer" Transfer 7cc4...fd22 "Type" field with the word "Transfer" as the value. E.g. Type: Transfer

The session key can be found in the raw deploy data in the examples above. Here is a screenshot for the StoredContractByName example:

Screenshot 2023-02-13 at 19 06 44

ihor avatar Feb 13 '23 18:02 ihor