clarity-lang / reference

The Clarity Reference
149 stars 34 forks source link

map-get for data maps from other contracts #30

Open friedger opened 4 years ago

friedger commented 4 years ago

There is an node RPC endpoint for getting a data map entry. Contracts should be able to do this as well (and not rely on the developer to provide a read-only function).

Signature: (contract-map-get? .contract-name map-name key-tuple)

Input: ContractName, MapName, tuple

Output: (optional (tuple))

The contract-map-get? function looks up and returns an entry from the specified contract's data map. The value is looked up using key-tuple. If there is no such contract or no such value associated with that key in the data map, the function returns a none option. Otherwise, it returns (some value).