3

As far as I can tell using the taquito npm package, in order to get any storage from a contract, you have to get all of a contract's storage. This seems like it can become highly inefficient if you are storing lots of data in a contract but I only needed to get a single variable.

I'm using Archetype lang to write my contracts.

2

Yes, that is possible with TzKT API (it's free and open-source), which allows you to specify a path to a particular part in the storage you want to receive.

For example, if a contract has the following storage:

{
    "vesting": {
        "vesting_schedule": {
            "next_payout": "2019-09-29T08:30:00Z",
            "payout_interval": "2629800"
        },
        "vesting_quantities": {
            "vested_balance": "162775594954",
            "vesting_increment": "199041301565"
        }
    },
    "key_info": {
        "key_groups": [
            {
                "signatories": [
                    "edpkvS5QFv7KRGfa3b87gg9DBpxSm3NpSwnjhUjNBQrRUUR66F7C9g",
                    "edpktm3zeGMzfzFuqgyYftt7uNyVRANTjrJCdU7bURwgGb9bRZwmJq",
                    "edpkucCnbeGPWNvGHeTQ5hENHPrc8txBBiQXNphu3jgv9KYbhQBovd",
                    "edpkuNjKKT48xBoT5asPrWdmuM1Yw8D93MwgFgVvtca8jb5pstzaCh"
                ],
                "group_threshold": "2"
            },
            {
                "signatories": [
                    "edpkukogJzCZSAfc5foRpEZGsryMjiXj77VxcFLzZoreB1vZWFeKc2",
                    "edpkuSZ1GoM6MALh4fPZBrwDhGwY9vENEoyctcXuDK3yoiX4xWhMaA",
                    "edpkvXL9B32DcEbMNiMangcSFMvAd8NBwH8AfmRb6iBbHxLgx3J59P",
                    "edpkumCFhgS94cjZXiFnnq7MFsaWBz4Tp78AX2fZfhB9J9hcgcKxgy"
                ],
                "group_threshold": "2"
            },
            ...
        ],
        "overall_threshold": "4"
    },
    "pour_info": {
        "pour_dest": "tz3bTdwZinP8U1JmSweNzVKhmwafqWmFWRfk",
        "pour_authorizer": "edpkteDwHwoNPB18tKToFKeSCykvr1ExnoMV5nawTJy9Y9nLTfQ541"
    },
    "replay_counter": "6505"
}

and you need just the first signatory from the second key group, you can do .../storage?path=key_info.key_groups.1.signatories.0, so you will receive just

edpkukogJzCZSAfc5foRpEZGsryMjiXj77VxcFLzZoreB1vZWFeKc2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.