Description

Michelson Map is an abstraction over the michelson native map. It supports complex Pair as key

Type Parameters

Constructors

Properties

[michelsonMapTypeSymbol]: boolean = true

Accessors

Methods

  • Parameters

    • key: K
    • value: T

    Returns void

    Description

    Set a key and a value in the MichelsonMap. If the key already exists, override the current value.

    Example

    map.set("myKey", "myValue") // Using a string as key
    

    Example

    map.set({0: "test", 1: "test1"}, "myValue") // Using a pair as key
    

    Warn

    The same key can be represented in multiple ways, depending on the type of the key. This duplicate key situation will cause a runtime error (duplicate key) when sending the map data to the Tezos RPC node.

    For example, consider a contract with a map whose key is of type boolean. If you set the following values in MichelsonMap: map.set(false, "myValue") and map.set(null, "myValue").

    You will get two unique entries in the MichelsonMap. These values will both be evaluated as falsy by the MichelsonEncoder and ultimately rejected by the Tezos RPC.

Generated using TypeDoc