Skip to content

setktypes.a

Update supported value type for on chain data

Technical Behavior

Here is the default table of supported value type and its limit.

C++ TypeType stringLimit by element
int8int81
int16int161
int32int321
int64int641
uint8uint81
uint16uint161
uint32uint321
uint64uint641
floatfloat321
doublefloat641
stringstring128

Note: In case of string and string[], it will count the total characters instead.

Only Ultra will have authority to update this list.

key_types can only extend the default list, cannot change the type name and its order, since we use this order to store type index in factory's keys.

Action Parameters

The properties of this type are provided below:

Property NameC++ TypeJavaScript TypeDescription
key_typesstd::vector<key_type_info>Object[]The key types that will be updated

key_type_info interface

Property NameC++ TypeJavaScript TypeDescription
key_typestringStringThe name of the key, needs to be unique.
element_number_limituint16_tNumberThe maximum number of entries allowed in dynamic types. For static types defaults to 1.

CLI - cleos

bash
cleos push action eosio.nft.ft setktypes '{ "key_types": [ {"key_type": "int8", "element_number_limit": 1}, {"key_type": "int16", "element_number_limit": 1}, {"key_type": "int32", "element_number_limit": 1}, {"key_type": "int64", "element_number_limit": 1}, {"key_type": "uint8", "element_number_limit": 1}, {"key_type": "uint16", "element_number_limit": 1}, {"key_type": "uint32", "element_number_limit": 1}, {"key_type": "uint64", "element_number_limit": 1}, {"key_type": "float32", "element_number_limit": 1}, {"key_type": "float64", "element_number_limit": 1}, {"key_type": "string", "element_number_limit": 128} ] }' -p ultra.nft.ft@active

JavaScript - eosjs

js
await transact(
    [
        {
            account: 'eosio.nft.ft',
            name: 'setktypes',
            authorization: [{ actor: 'ultra.nft.ft', permission: 'active' }],
            data: {
                key_types: [
                    {key_type: "int8", element_number_limit: 1},
                    {key_type: "int16", element_number_limit: 1},
                    {key_type: "int32", element_number_limit: 1},
                    {key_type: "int64", element_number_limit: 1},
                    {key_type: "uint8", element_number_limit: 1},
                    {key_type: "uint16", element_number_limit: 1},
                    {key_type: "uint32", element_number_limit: 1},
                    {key_type: "uint64", element_number_limit: 1},
                    {key_type: "float32", element_number_limit: 1},
                    {key_type: "float64", element_number_limit: 1},
                    {key_type: "string", element_number_limit: 128}
                ]
            },
        },
    ],
    {
        blocksBehind: 3,
        expireSeconds: 30,
    }
);