Update NFT Schema

Add New Action

create file add_action.ts

vim add_action.ts
add_action.ts
import { SixDataChainConnector, BASE64 } from "@sixnetwork/six-data-chain-sdk";
import exampleNewAction from "./resource/new-action.json";
const main = async () => {
  const sixConnector = new SixDataChainConnector();
  // specify the RPC URL of the chain
  sixConnector.rpcUrl = "https://rpc1.fivenet.sixprotocol.net:443";

  // Retrieve acctount signer from private key or mnemonic
  const accountSigner = await sixConnector.accounts.privateKeyToAccount(<string_private_key_or_mnemonic_seed>)
  // Get index of account
  const address = (await accountSigner.getAccounts())[0].address;
  const rpcClient = await sixConnector.connectRPCClient(accountSigner);
  // Encode NFT data to base64
  const encodeBase64NewAction = BASE64.encode(JSON.stringify(exampleNewAction));
  const msg = await rpcClient.nftmngrModule.msgAddAction({
    creator: address,
    code: "six.rocket_ticket",
    base64NewAction: encodeBase64NewAction,
  });
  const txResponse = await rpcClient.nftmngrModule.signAndBroadcast([msg], {
    fee: { amount: [{ denom: "usix", amount: "10000000" }], gas: "1500000" },
    memo: "Add New Action To rocket_ticket",
  });

  console.log(txResponse);
};
main();

Execute add_action.ts

When it is successful it will response similar to:

Add New Attribute

create file add_attribute.ts

Execute add_attribute.ts

When it is successful it will response similar to:

Last updated