0

I'm using this smart contract: https://github.com/claudebarde/taquito-pinata-tezos-nft/blob/main/contract/NFTS_contract.mligo

I can deploy it on the https://ide.ligolang.org/ using the storage they have commented out at the end of the contract, copy-paste the contract (KT...) to my taquito application and everything works.

But, I want to deploy it and provide the storage directly in my taquito/jsligo application, but I have no idea how to declare/set/assign the store.

e.g.

import {  TezosToolkit } from "@taquito/taquito";
import { importKey } from "@taquito/signer";
import { RPC_URL } from "./utils/constants";
import { InMemorySigner } from "@taquito/signer";
import dotenv from "dotenv";

dotenv.config();
const Tezos = new TezosToolkit(RPC_URL);
const privateKey = process.env.WALLET_PRIVATE!;


importKey(Tezos, privateKey);
// generic.json is referring to Michelson source code in JSON representation
const genericMultisigJSONfile = require("../smart_contract/samples/fa_2.tz");

const storage = /* I have no idea */

function sign() {
  Tezos.setProvider({ signer: new InMemorySigner(privateKey) });

 
  Tezos.contract
    .originate({
      code: genericMultisigJSONfile,
      storage: storage,
    })
  .then((originationOp) => {
    console.log(
      `Waiting for confirmation of origination for ${originationOp.contractAddress}...`
    );
    return originationOp.contract();
  })
  .then((contract) => {
    console.log(contract);
  })
  .catch((error) => console.log(`Error: ${JSON.stringify(error, null, 2)}`));
}

sign();

1 Answer 1

1

You can follow these steps to originate the contract with Taquito: https://tezostaquito.io/docs/originate/

Regarding the initial storage, you can use this JavaScript object:

import { MichelsonMap } from "@taquito/taquito";

const initialStorage = {
  ledger : new MichelsonMap();
  operators : new MichelsonMap();
  reverse_ledger: new MichelsonMap();
  metadata: new MichelsonMap();
  token_metadata: new MichelsonMap();
  next_token_id: 0;
  admin: VALID_TEZOS_ADDRESS;
}

This will originate a new contract with empty bigmaps. There is no need to type the bigmaps, Taquito will figure it out :)

0

Your Answer

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

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