1

I am trying to pass the correct storage parameters in json to be able to deploy my smart contract. Thank you for your attention...

      (pair (pair (pair (pair (address %admin) (big_map %ledger nat address))
                  (pair (big_map %metadata string bytes)
                        (big_map %operators (pair address (pair address nat)) unit)))
            (pair (pair (mutez %price) (big_map %reverse_ledger address (list nat)))
                  (pair (string %serial) (nat %token_id))))
      (big_map %token_metadata nat (pair (nat %token_id) (map %token_info string bytes)))) ;

What I did (it didn't work):

    import {
  Record,
  Address,
  Mutez,
  Nat,
  Big_map,
  String,
  Bytes,
  Map,
  List
} from "@tezwell/michelson-sdk/literal";

const storage = Record(
  {
    admin: Address("tz1i3veHnR4ogcwKmgugcqnunTmTYP8s8ZAr"),
    ledger: Big_map([
      [Nat(1), Address("tz1i3veHnR4ogcwKmgugcqnunTmTYP8s8ZAr")]
    ]),
    metadata: Big_map([
      [
        String(""),
        Bytes(
          "0x68747470733a2f2f676973742e67697468756275736572636f6e74656e742e636f6d2f6f7269616e6131332f36663138333737353065366562383163646434666633363230663738613133322f7261772f653238396663353037326235613931353134383936376239613433333765313835343731363561322f636f6e74726163745f6d6574612e6a736f6e"
        )
      ]
    ]),
    operators: Big_map([]),
    price: Mutez(1),
    reverse_ledger: Big_map([
      [Address("tz1i3veHnR4ogcwKmgugcqnunTmTYP8s8ZAr"), List([Nat(1)])]
    ]),
    serial: String("SERIAL"),
    token_id: Nat(1),
    token_metadata: Big_map([
      [
        Nat(1),
        Record({
          token_id: Nat(1),
          token_info: Map([
            [
              String(""),
              Bytes(
                "0x68747470733a2f2f676973742e67697468756275736572636f6e74656e742e636f6d2f6f7269616e6131332f35313763373231396531383639333938613765666631343335623862653237392f7261772f326337336132613564353365626466313662633864623831643837343236353964323763646462332f6e66745f6d6574612e6a736f6e"
              )
            ]
          ])
        })
      ]
    ])
  },

  [
    [
      [
        ["admin", "ledger"],
        ["metadata"],
      ]],
      [
        ["price", "reverse_ledger"],
        ["serial", "token_id"],
    ],
    [
    "token_metadata"
  ]]
);

console.log("Micheline: ", storage.toMicheline());
console.log("Michelson JSON: ", JSON.stringify(storage.toJSON(), null, 4));

Thanks for your help

1 Answer 1

1

You can use michelson-sdk to generate the Michelson values (Micheline or Michelson JSON).

codesandbox (Output can be seen in the console)

Micheline

    (Pair (Pair (Pair (Pair "tz1i3veHnR4ogcwKmgugcqnunTmTYP8s8ZAr" { Elt 1 "tz1i3veHnR4ogcwKmgugcqnunTmTYP8s8ZAr" }) (Pair { Elt "" 0x68747470733a2f2f676973742e67697468756275736572636f6e74656e742e636f6d2f6f7269616e6131332f36663138333737353065366562383163646434666633363230663738613133322f7261772f653238396663353037326235613931353134383936376239613433333765313835343731363561322f636f6e74726163745f6d6574612e6a736f6e } {  })) (Pair (Pair 1 { Elt "tz1i3veHnR4ogcwKmgugcqnunTmTYP8s8ZAr" { 1 } }) (Pair "SERIAL" 1))) { Elt 1 (Pair 1 { Elt "" 0x68747470733a2f2f676973742e67697468756275736572636f6e74656e742e636f6d2f6f7269616e6131332f35313763373231396531383639333938613765666631343335623862653237392f7261772f326337336132613564353365626466313662633864623831643837343236353964323763646462332f6e66745f6d6574612e6a736f6e }) }) 

Michelson JSON

{
    "prim": "Pair",
    "args": [
        {
            "prim": "Pair",
            "args": [
                {
                    "prim": "Pair",
                    "args": [
                        {
                            "prim": "Pair",
                            "args": [
                                {
                                    "string": "tz1i3veHnR4ogcwKmgugcqnunTmTYP8s8ZAr"
                                },
                                [
                                    {
                                        "prim": "Elt",
                                        "args": [
                                            {
                                                "int": "1"
                                            },
                                            {
                                                "string": "tz1i3veHnR4ogcwKmgugcqnunTmTYP8s8ZAr"
                                            }
                                        ]
                                    }
                                ]
                            ]
                        },
                        {
                            "prim": "Pair",
                            "args": [
                                [
                                    {
                                        "prim": "Elt",
                                        "args": [
                                            {
                                                "string": ""
                                            },
                                            {
                                                "bytes": "68747470733a2f2f676973742e67697468756275736572636f6e74656e742e636f6d2f6f7269616e6131332f36663138333737353065366562383163646434666633363230663738613133322f7261772f653238396663353037326235613931353134383936376239613433333765313835343731363561322f636f6e74726163745f6d6574612e6a736f6e"
                                            }
                                        ]
                                    }
                                ],
                                []
                            ]
                        }
                    ]
                },
                {
                    "prim": "Pair",
                    "args": [
                        {
                            "prim": "Pair",
                            "args": [
                                {
                                    "int": "1"
                                },
                                [
                                    {
                                        "prim": "Elt",
                                        "args": [
                                            {
                                                "string": "tz1i3veHnR4ogcwKmgugcqnunTmTYP8s8ZAr"
                                            },
                                            [
                                                {
                                                    "int": "1"
                                                }
                                            ]
                                        ]
                                    }
                                ]
                            ]
                        },
                        {
                            "prim": "Pair",
                            "args": [
                                {
                                    "string": "SERIAL"
                                },
                                {
                                    "int": "1"
                                }
                            ]
                        }
                    ]
                }
            ]
        },
        [
            {
                "prim": "Elt",
                "args": [
                    {
                        "int": "1"
                    },
                    {
                        "prim": "Pair",
                        "args": [
                            {
                                "int": "1"
                            },
                            [
                                {
                                    "prim": "Elt",
                                    "args": [
                                        {
                                            "string": ""
                                        },
                                        {
                                            "bytes": "68747470733a2f2f676973742e67697468756275736572636f6e74656e742e636f6d2f6f7269616e6131332f35313763373231396531383639333938613765666631343335623862653237392f7261772f326337336132613564353365626466313662633864623831643837343236353964323763646462332f6e66745f6d6574612e6a736f6e"
                                        }
                                    ]
                                }
                            ]
                        ]
                    }
                ]
            }
        ]
    ]
}
2
  • Hello Rodrigo, sorry to bother you again but I have a problem with a new storage return, I would like to know how you did to fill in the parameters correctly I tried to base myself on your answer to adapt my new storage but I don't can't do it, I'm updating the question with my new storage
    – oriana
    Mar 16, 2022 at 14:47
  • Updated the answer above Mar 16, 2022 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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