Skip to content

Commit

Permalink
feat: add description and metadata to ainft object creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jiyoung-an committed Jun 21, 2024
1 parent 350f533 commit 5cc79f1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,16 @@ export default class Nft extends FactoryBase {
* });
* ```
*/
async create(name: string, symbol: string): Promise<{ txHash: string, ainftObject: Ainft721Object }> {
async create(name: string, symbol: string, description?: string, metadata?: object): Promise<{ txHash: string; ainftObject: Ainft721Object }> {
const address = await this.ain.signer.getAddress();

const body = { address, name, symbol };
const body = {
address,
name,
symbol,
...(description && { description }),
...(metadata && { metadata }),
};
const trailingUrl = 'native';
const { ainftObjectId, txBody } = await this.sendRequest(HttpMethod.POST, trailingUrl, body);
const res = await this.ain.sendTransaction(txBody);
Expand All @@ -52,7 +58,7 @@ export default class Nft extends FactoryBase {

await this.register(ainftObjectId);
const ainftObject = await this.get(ainftObjectId);
return { txHash: res.tx_hash, ainftObject }
return { txHash: res.tx_hash, ainftObject };
}

/**
Expand Down

0 comments on commit 5cc79f1

Please sign in to comment.