26 lines
1021 B
Plaintext
26 lines
1021 B
Plaintext
@subsection Multihash
|
|
|
|
A complement to @code{Locator}, enabling validation and generation for multihashes that have been registered to the contract.
|
|
|
|
|
|
@table @dfn
|
|
@item ERC165 Interface identifier
|
|
@include ../../build/MultiHash.interface
|
|
@item Solidity interface definition
|
|
@include ../../build/contract_MultiHash.texi
|
|
@end table
|
|
|
|
|
|
@subsubsection Using @code{Multihash} with @code{Locator}
|
|
|
|
Given the data @code{foo}, the digest algorithm @code{sha256} (multihash prefix @code{1220}) and a base url @code{https://contentgateway.grassecon.net}, the result of the methods may be as follows:
|
|
|
|
@table @code
|
|
@item toURI(sha256(foo))
|
|
-> @code{"sha256:2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"}
|
|
@item toURL(sha256(foo))
|
|
-> @code{"https://contentgateway.grassecon.net/12202c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"}
|
|
@item tokenURI(toUint(sha256(foo)))
|
|
-> @code{"https://contentgateway.grassecon.net/12202c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae"}
|
|
@end table
|