> For the complete documentation index, see [llms.txt](https://sixnetwork.gitbook.io/nft-gen-2-tech-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sixnetwork.gitbook.io/nft-gen-2-tech-doc/getting-started/sdk-package-for-nodejs/update-nft-schema.md).

# Update NFT Schema

## Add New Action

create file add\_action.ts

```bash
vim add_action.ts
```

{% code title="add\_action.ts" %}

```typescript
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();
```

{% endcode %}

Execute add\_action.ts

```bash
npx ts-node ./add_action.ts
```

When it is successful it will response similar to:

```
{
  code: 0,
  height: 1346,
  rawLog: '[{"events":[{"type":"add_action","attributes":[{"key":"nft_schema_code","value":"six.rocket_ticket"},{"key":"add_action_name","value":"new_action"},{"key":"add_action_result","value":"success"}]},{"type":"message","attributes":[{"key":"action","value":"add_action"}]}]}]',
  transactionHash: '71B92F3DFB5C6A3A0A7FE14DDB856DC3F2EB7B956DB9338CAE962C3D9FF95672',
  gasUsed: 300626,
  gasWanted: 1500000
}
```

## Add New Attribute

create file add\_attribute.ts

{% code title="add\_attribute.ts" %}

```typescript
import { SixDataChainConnector, BASE64 } from "@sixnetwork/six-data-chain-sdk";
import exampleNewAttribute from "./resource/new-attribute.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 encodeBase64NewAttribute = BASE64.encode(JSON.stringify(exampleNewAttribute));
  const msg = await rpcClient.nftmngrModule.msgAddAttribute({
    creator: address,
    code: "six.rocket_ticket",
    location:1, // 0: NFT Attribute(non-Dynamic Attribute), 1: Token Attribute (Dynamic Attribute)
    base64NewAttriuteDefenition: encodeBase64NewAttribute,
  });
  const txResponse = await rpcClient.nftmngrModule.signAndBroadcast([msg], {
    fee: { amount: [{ denom: "usix", amount: "10000000" }], gas: "1500000" },
    memo: "Add New Attribute to NFT Schema",
  });

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

{% endcode %}

Execute add\_attribute.ts

```
npx ts-node ./add_attribute.ts
```

When it is successful it will response similar to:

```
{
  code: 0,
  height: 1762,
  rawLog: '[{"events":[{"type":"add_attribute","attributes":[{"key":"nft_schema_code","value":"six.rocket_ticket"},{"key":"add_attribute_name","value":"new_attribute"},{"key":"add_attribute_location","value":"TOKEN_ATTRIBUTE"},{"key":"add_attribute_result","value":"success"}]},{"type":"message","attributes":[{"key":"action","value":"add_attribute"}]}]}]',
  transactionHash: '1C15FF421FB33696C7773861B8B215E72203346FAC81F8FE467F503050F589DD',
  gasUsed: 303360,
  gasWanted: 1500000
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sixnetwork.gitbook.io/nft-gen-2-tech-doc/getting-started/sdk-package-for-nodejs/update-nft-schema.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
