Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Multiple fixes to spec and schema (LedgerHQ#32)
Browse files Browse the repository at this point in the history
* Fix types and sources in addressName in specification

* Add @.from as an acceptable path reference to container

* Make tokenPath optional and specify behaviour when absent

* Add array form to nativeCurrencyAddress
  • Loading branch information
lcastillo-ledger authored Oct 8, 2024
1 parent 63693b8 commit a4bb306
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
14 changes: 8 additions & 6 deletions specs/erc-7730.md
Original file line number Diff line number Diff line change
Expand Up @@ -893,13 +893,15 @@ This section describes all container structure supported by this specification a

| Value reference | Value Description | Examples |
| --- | --- | --- |
| @.value | The native currency value of the transaction containing the structured data | |
| @.from | The address of the sender of the transaction | |
| @.value | The native currency value of the transaction | |
| @.to | The destination address of the containing transaction, ie the target smart contract address | |

#### EIP-712 container

| Value reference | Value Description | Examples |
| --- | --- | --- |
| @.from | The address of the signer of the message | |
| @.value | EIP-712 have no underlying currency value transferred, so a wallet MAY interpret it as 0 | |
| @.to | The verifying contract address, when known. If not known a wallet SHOULD reject using the ERC-7730 file to clear sign the message | |

Expand Down Expand Up @@ -931,8 +933,8 @@ Formats useable for uint/int solidity types.
| --- | --- |
| *Description* | Convert value using token decimals, and append token ticker name. If value is above optional `threshold`, display instead `message` with ticker. |
| *Parameters* | --- |
| `tokenPath` | path reference to the address of the token contract. Used to associate correct ticker |
| `nativeCurencyAddress` | If the address pointed to by `tokenPath` is equal to `nativeCurrencyAddress`, the tokenAmount is interpreted as in native currency |
| `tokenPath` | path reference to the address of the token contract. Used to associate correct ticker. If ticker is not found or tokenPath is not set, the wallet SHOULD display the raw value instead with an "Unknown token" warning |
| `nativeCurencyAddress` | Either a string or an array of strings. If the address pointed to by `tokenPath` is equal to one of the addresses in `nativeCurrencyAddress`, the tokenAmount is interpreted as expressed in native currency |
| `threshold` | integer value, above which value is displayed as a special message. Optional |
| `message` | message to display above threshold. Optional, defaults to "Unlimited" |
| *Examples* | --- |
Expand Down Expand Up @@ -1035,12 +1037,12 @@ Formats useable for address
| --- | --- |
| *Description* | Display address as a trusted name if a trusted source exists, an EIP-55 formatted address otherwise. See [next section](#address-trusted-sources) for a reference of trusted sources |
| *Parameters* | --- |
| `type` | The expected type of the address. If set, the wallet SHOULD restrict name lookup to relevant sources, and SHOULD check that the address matches the type |
| `source` | See [next section](#address-trusted-sources) for a reference of trusted sources |
| `types` | An array of expected types of the address (see [next section](#address-types-and-sources)). If set, the wallet SHOULD check that the address matches one of the types provided |
| `sources` | An array of acceptable sources for names (see [next section](#address-types-and-sources)). If set, the wallet SHOULD restrict name lookup to relevant sources |
| *Examples* | --- |
| `vitalik.eth` | Field Value 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 |

#### Address trusted sources
#### Address types and sources

Address names trusted sources specify which type and source of trusted names SHOULD be used to replace an address with a human readable names.

Expand Down
18 changes: 13 additions & 5 deletions specs/erc7730-v1.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,19 @@
},
"nativeCurrencyAddress": {
"title": "Native Currency Address",
"type": "string",
"description": "An address equal to this value is interpreted as an amount in native currency rather than a token."
"oneOf": [
{
"type": "string",
"description": "An address equal to this value is interpreted as an amount in native currency rather than a token."
},
{
"type": "array",
"description": "An array of addresses, any of which are interpreted as an amount in native currency rather than a token.",
"items": {
"type": "string"
}
}
]
},
"threshold": {
"title": "Unlimited Threshold",
Expand All @@ -717,9 +728,6 @@
"description": "The message to display when the amount is above the threshold."
}
},
"required": [
"tokenPath"
],
"additionalProperties": false
},
"nftNameParameters" : {
Expand Down

0 comments on commit a4bb306

Please sign in to comment.