Batch/bulk NFT minting
Batch/bulk NFT minting
Hey TON community,
I am building TON-based game that mints some NFTs. My code mostly uses the code from this [tutorial](https://docs.ton.org/develop/dapps/tutorials/collection-minting) and ton/ton-core/ton-crypto libs:
My NFT deploy code:
```
public async deploy(
wallet: OpenedWallet,
collectionAddress: Address,
params: mintParams
): Promise<number> {
const seqno = await wallet.contract.getSeqno();
await wallet.contract.sendTransfer({
seqno,
secretKey: wallet.keyPair.secretKey,
messages: [
internal({
value: "0.05",
to: collectionAddress,
body: this.createMintBody(params),
}),
],
sendMode: SendMode.IGNORE_ERRORS + SendMode.PAY_GAS_SEPARATELY,
});
return seqno;
}
```
And after I am waiting seqno:
```
export async function waitSeqno(seqno: number, wallet: OpenedWallet): Promise<number> {
for (let attempt = 0; attempt < 20; attempt++) {
await sleep(2000);
const seqnoAfter = await wallet.contract.getSeqno();
if (seqnoAfter == seqno + 1) {
return Promise.resolve(seqno)
}
}
return Promise.reject(`Seqno ${seqno} timeout`)
}
export function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
```
Then I get the confirmation with seqno I request NFT item address by NFT index:
```
static async getAddressByIndex(
collectionAddress: Address,
itemIndex: number,
tonCenterApiKey: string
): Promise<Address> {
const client = new TonClient({
endpoint: "https://toncenter.com/api/v2/jsonRPC",
apiKey: tonCenterApiKey,
});
const response = await client.runMethod(
collectionAddress,
"get_nft_address_by_index",
[{ type: "int", value: BigInt(itemIndex) }]
);
return response.stack.readAddress();
}
```
The whole process takes up to 30 seconds per 1 NFT. I am curiose is there a better option to mint for example 10 NFTs, or the best way is to mint one by one and wait it's confirmation? In that case I have some worries about number of NFTs I can achive within 1 hours. Right now I have to mint all items in sequence because minting command requires nft INDEX parameter and before minting next item I have to get the confirmation that the previous one is minted properly.
Hey TON community,
I am building TON-based game that mints some NFTs. My code mostly uses the code from this [tutorial](https://docs.ton.org/develop/dapps/tutorials/collection-minting) and ton/ton-core/ton-crypto libs:
My NFT deploy code:
```
public async deploy(
wallet: OpenedWallet,
collectionAddress: Address,
params: mintParams
): Promise<number> {
const seqno = await wallet.contract.getSeqno();
await wallet.contract.sendTransfer({
seqno,
secretKey: wallet.keyPair.secretKey,
messages: [
internal({
value: "0.05",
to: collectionAddress,
body: this.createMintBody(params),
}),
],
sendMode: SendMode.IGNORE_ERRORS + SendMode.PAY_GAS_SEPARATELY,
});
return seqno;
}
```
And after I am waiting seqno:
```
export async function waitSeqno(seqno: number, wallet: OpenedWallet): Promise<number> {
for (let attempt = 0; attempt < 20; attempt++) {
await sleep(2000);
const seqnoAfter = await wallet.contract.getSeqno();
if (seqnoAfter == seqno + 1) {
return Promise.resolve(seqno)
}
}
return Promise.reject(`Seqno ${seqno} timeout`)
}
export function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
```
Then I get the confirmation with seqno I request NFT item address by NFT index:
```
static async getAddressByIndex(
collectionAddress: Address,
itemIndex: number,
tonCenterApiKey: string
): Promise<Address> {
const client = new TonClient({
endpoint: "https://toncenter.com/api/v2/jsonRPC",
apiKey: tonCenterApiKey,
});
const response = await client.runMethod(
collectionAddress,
"get_nft_address_by_index",
[{ type: "int", value: BigInt(itemIndex) }]
);
return response.stack.readAddress();
}
```
The whole process takes up to 30 seconds per 1 NFT. I am curiose is there a better option to mint for example 10 NFTs, or the best way is to mint one by one and wait it's confirmation? In that case I have some worries about number of NFTs I can achive within 1 hours. Right now I have to mint all items in sequence because minting command requires nft INDEX parameter and before minting next item I have to get the confirmation that the previose one is minted properly.
#ton
#minting
#nft
Batch/bulk NFT minting
Batch/bulk NFT minting
Hey TON community,
I am building TON-based game that mints some NFTs. My code mostly uses the code from this [tutorial](https://docs.ton.org/develop/dapps/tutorials/collection-minting) and ton/ton-core/ton-crypto libs:
My NFT deploy code:
```
public async deploy(
wallet: OpenedWallet,
collectionAddress: Address,
params: mintParams
): Promise<number> {
const seqno = await wallet.contract.getSeqno();
await wallet.contract.sendTransfer({
seqno,
secretKey: wallet.keyPair.secretKey,
messages: [
internal({
value: "0.05",
to: collectionAddress,
body: this.createMintBody(params),
}),
],
sendMode: SendMode.IGNORE_ERRORS + SendMode.PAY_GAS_SEPARATELY,
});
return seqno;
}
```
And after I am waiting seqno:
```
export async function waitSeqno(seqno: number, wallet: OpenedWallet): Promise<number> {
for (let attempt = 0; attempt < 20; attempt++) {
await sleep(2000);
const seqnoAfter = await wallet.contract.getSeqno();
if (seqnoAfter == seqno + 1) {
return Promise.resolve(seqno)
}
}
return Promise.reject(`Seqno ${seqno} timeout`)
}
export function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
```
Then I get the confirmation with seqno I request NFT item address by NFT index:
```
static async getAddressByIndex(
collectionAddress: Address,
itemIndex: number,
tonCenterApiKey: string
): Promise<Address> {
const client = new TonClient({
endpoint: "https://toncenter.com/api/v2/jsonRPC",
apiKey: tonCenterApiKey,
});
const response = await client.runMethod(
collectionAddress,
"get_nft_address_by_index",
[{ type: "int", value: BigInt(itemIndex) }]
);
return response.stack.readAddress();
}
```
The whole process takes up to 30 seconds per 1 NFT. I am curiose is there a better option to mint for example 10 NFTs, or the best way is to mint one by one and wait it's confirmation? In that case I have some worries about number of NFTs I can achive within 1 hours. Right now I have to mint all items in sequence because minting command requires nft INDEX parameter and before minting next item I have to get the confirmation that the previose one is minted properly.
Hey TON community,
I am building TON-based game that mints some NFTs. My code mostly uses the code from this [tutorial](https://docs.ton.org/develop/dapps/tutorials/collection-minting) and ton/ton-core/ton-crypto libs:
My NFT deploy code:
```
public async deploy(
wallet: OpenedWallet,
collectionAddress: Address,
params: mintParams
): Promise<number> {
const seqno = await wallet.contract.getSeqno();
await wallet.contract.sendTransfer({
seqno,
secretKey: wallet.keyPair.secretKey,
messages: [
internal({
value: "0.05",
to: collectionAddress,
body: this.createMintBody(params),
}),
],
sendMode: SendMode.IGNORE_ERRORS + SendMode.PAY_GAS_SEPARATELY,
});
return seqno;
}
```
And after I am waiting seqno:
```
export async function waitSeqno(seqno: number, wallet: OpenedWallet): Promise<number> {
for (let attempt = 0; attempt < 20; attempt++) {
await sleep(2000);
const seqnoAfter = await wallet.contract.getSeqno();
if (seqnoAfter == seqno + 1) {
return Promise.resolve(seqno)
}
}
return Promise.reject(`Seqno ${seqno} timeout`)
}
export function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
```
Then I get the confirmation with seqno I request NFT item address by NFT index:
```
static async getAddressByIndex(
collectionAddress: Address,
itemIndex: number,
tonCenterApiKey: string
): Promise<Address> {
const client = new TonClient({
endpoint: "https://toncenter.com/api/v2/jsonRPC",
apiKey: tonCenterApiKey,
});
const response = await client.runMethod(
collectionAddress,
"get_nft_address_by_index",
[{ type: "int", value: BigInt(itemIndex) }]
);
return response.stack.readAddress();
}
```
The whole process takes up to 30 seconds per 1 NFT. I am curiose is there a better option to mint for example 10 NFTs, or the best way is to mint one by one without hurry? In that case I have some worries about number of NFTs I can achive within 1 hours. Right now I have to mint all items in sequence because minting command requires nft INDEX parameter and before minting next item I have to get the confirmation that the previose one is minted properly.
#ton
#minting
#nft
Batch/bulk NFT minting
Batch/bulk NFT minting
Hey TON community,
I am building TON-based game that mints some NFTs. My code mostly uses the code from this [tutorial](https://docs.ton.org/develop/dapps/tutorials/collection-minting) and ton/ton-core/ton-crypto libs:
My NFT deploy code:
```
public async deploy(
wallet: OpenedWallet,
collectionAddress: Address,
params: mintParams
): Promise<number> {
const seqno = await wallet.contract.getSeqno();
await wallet.contract.sendTransfer({
seqno,
secretKey: wallet.keyPair.secretKey,
messages: [
internal({
value: "0.05",
to: collectionAddress,
body: this.createMintBody(params),
}),
],
sendMode: SendMode.IGNORE_ERRORS + SendMode.PAY_GAS_SEPARATELY,
});
return seqno;
}
```
And after I am waiting seqno:
```
export async function waitSeqno(seqno: number, wallet: OpenedWallet): Promise<number> {
for (let attempt = 0; attempt < 20; attempt++) {
await sleep(2000);
const seqnoAfter = await wallet.contract.getSeqno();
if (seqnoAfter == seqno + 1) {
return Promise.resolve(seqno)
}
}
return Promise.reject(`Seqno ${seqno} timeout`)
}
export function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
```
Then I get the confirmation with seqno I request NFT item address by NFT index:
```
static async getAddressByIndex(
collectionAddress: Address,
itemIndex: number,
tonCenterApiKey: string
): Promise<Address> {
const client = new TonClient({
endpoint: "https://toncenter.com/api/v2/jsonRPC",
apiKey: tonCenterApiKey,
});
const response = await client.runMethod(
collectionAddress,
"get_nft_address_by_index",
[{ type: "int", value: BigInt(itemIndex) }]
);
return response.stack.readAddress();
}
```
The whole process takes up to 30 seconds per 1 NFT. I am curiose is there a better option to mint for example 10 NFTs, or the best way is to mint one by one without hurry? In that case I have some worries about number of NFTs I can achive within 1 hours. Right now I have to mint all items in sequence because minting command requires nft INDEX parameter and before minting next item I have to get the confirmation that the previose one is minted properly.
Hey TON community,
I am building TON-based game that mints some NFTs. My code mostly uses the code from this [tutorial](https://docs.ton.org/develop/dapps/tutorials/collection-minting) and ton/ton-core/ton-crypto libs:
My NFT deploy code:
```
public async deploy(
wallet: OpenedWallet,
collectionAddress: Address,
params: mintParams
): Promise<number> {
const seqno = await wallet.contract.getSeqno();
await wallet.contract.sendTransfer({
seqno,
secretKey: wallet.keyPair.secretKey,
messages: [
internal({
value: "0.05",
to: collectionAddress,
body: this.createMintBody(params),
}),
],
sendMode: SendMode.IGNORE_ERRORS + SendMode.PAY_GAS_SEPARATELY,
});
return seqno;
}
```
And after I am waiting seqno:
```
export async function waitSeqno(seqno: number, wallet: OpenedWallet): Promise<number> {
for (let attempt = 0; attempt < 20; attempt++) {
await sleep(2000);
const seqnoAfter = await wallet.contract.getSeqno();
if (seqnoAfter == seqno + 1) {
return Promise.resolve(seqno)
}
}
return Promise.reject(`Seqno ${seqno} timeout`)
}
export function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
```
Then I got the confirmation with seqno I request NFT item address by NFT index:
```
static async getAddressByIndex(
collectionAddress: Address,
itemIndex: number,
tonCenterApiKey: string
): Promise<Address> {
const client = new TonClient({
endpoint: "https://toncenter.com/api/v2/jsonRPC",
apiKey: tonCenterApiKey,
});
const response = await client.runMethod(
collectionAddress,
"get_nft_address_by_index",
[{ type: "int", value: BigInt(itemIndex) }]
);
return response.stack.readAddress();
}
```
The whole process takes up to 30 seconds per 1 NFT. I am curiose is there a better option to mint for example 10 NFTs, or the best way is to mint one by one without hurry? In that case I have some worries about number of NFTs I can achive within 1 hours. Right now I have to mint all items in sequence because minting command requires nft INDEX parameter and before minting next item I have to get the confirmation that the previose one is minted properly.
#ton
#minting
#nft
Batch/bulk NFT minting
Batch/bulk NFT minting
Hey TON community,
I am building TON-based game that mints some NFTs. My code mostly uses the code from this [tutorial](https://docs.ton.org/develop/dapps/tutorials/collection-minting) and ton/ton-core/ton-crypto libs:
My NFT deploy code:
```
public async deploy(
wallet: OpenedWallet,
collectionAddress: Address,
params: mintParams
): Promise<number> {
const seqno = await wallet.contract.getSeqno();
await wallet.contract.sendTransfer({
seqno,
secretKey: wallet.keyPair.secretKey,
messages: [
internal({
value: "0.05",
to: collectionAddress,
body: this.createMintBody(params),
}),
],
sendMode: SendMode.IGNORE_ERRORS + SendMode.PAY_GAS_SEPARATELY,
});
return seqno;
}
```
And after I am waiting seqno:
```
export async function waitSeqno(seqno: number, wallet: OpenedWallet): Promise<number> {
for (let attempt = 0; attempt < 20; attempt++) {
await sleep(2000);
const seqnoAfter = await wallet.contract.getSeqno();
if (seqnoAfter == seqno + 1) {
return Promise.resolve(seqno)
}
}
return Promise.reject(`Seqno ${seqno} timeout`)
}
export function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
```
Then I got the confirmation with seqno I request NFT item address by NFT index:
```
static async getAddressByIndex(
collectionAddress: Address,
itemIndex: number,
tonCenterApiKey: string
): Promise<Address> {
const client = new TonClient({
endpoint: "https://toncenter.com/api/v2/jsonRPC",
apiKey: tonCenterApiKey,
});
const response = await client.runMethod(
collectionAddress,
"get_nft_address_by_index",
[{ type: "int", value: BigInt(itemIndex) }]
);
return response.stack.readAddress();
}
```
The whole process takes up to 30 seconds per 1 NFT. I am curiose is there a better option to mint for example 10 NFTs, or the best way is to mint one by one without hurry? In that case I have some worries about number of NFTs I can achive within 1 hours. Right now I have to mint all items in sequence because minting command requires nft INDEX parameter and before minting next item I have to get the confirmation that the previose one is minted properly.
Hey TON community,
I am building TON-based game that mints some NFTs. My code mostly uses the code from this [tutorial](https://docs.ton.org/develop/dapps/tutorials/collection-minting) and ton/ton-core/ton-crypto libs:
My NFT deploy code:
```
public async deploy(
wallet: OpenedWallet,
collectionAddress: Address,
params: mintParams
): Promise<number> {
const seqno = await wallet.contract.getSeqno();
await wallet.contract.sendTransfer({
seqno,
secretKey: wallet.keyPair.secretKey,
messages: [
internal({
value: "0.05",
to: collectionAddress,
body: this.createMintBody(params),
}),
],
sendMode: SendMode.IGNORE_ERRORS + SendMode.PAY_GAS_SEPARATELY,
});
return seqno;
}
```
And after I am waiting seqno:
```
export async function waitSeqno(seqno: number, wallet: OpenedWallet): Promise<number> {
for (let attempt = 0; attempt < 20; attempt++) {
await sleep(2000);
const seqnoAfter = await wallet.contract.getSeqno();
if (seqnoAfter == seqno + 1) {
return Promise.resolve(seqno)
}
}
return Promise.reject(`Seqno ${seqno} timeout`)
}
export function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
```
Then I got the confirmation with seqno I request NFT item address by NFT index:
```
static async getAddressByIndex(
collectionAddress: Address,
itemIndex: number,
tonCenterApiKey: string
): Promise<Address> {
const client = new TonClient({
endpoint: "https://toncenter.com/api/v2/jsonRPC",
apiKey: tonCenterApiKey,
});
const response = await client.runMethod(
collectionAddress,
"get_nft_address_by_index",
[{ type: "int", value: BigInt(itemIndex) }]
);
return response.stack.readAddress();
}
```
The whole process takes up to 30 seconds per 1 NFT. I am curiose is there a better option to mint for example 10 NFTs, or the best way is to mint one by one without hurry?
#ton
#minting
#nft
Batch/bulk NFT minting
Hey TON community,
I am building TON-based game that mints some NFTs. My code mostly uses the code from this [tutorial](https://docs.ton.org/develop/dapps/tutorials/collection-minting) and ton/ton-core/ton-crypto libs:
My NFT deploy code:
```
public async deploy(
wallet: OpenedWallet,
collectionAddress: Address,
params: mintParams
): Promise<number> {
const seqno = await wallet.contract.getSeqno();
await wallet.contract.sendTransfer({
seqno,
secretKey: wallet.keyPair.secretKey,
messages: [
internal({
value: "0.05",
to: collectionAddress,
body: this.createMintBody(params),
}),
],
sendMode: SendMode.IGNORE_ERRORS + SendMode.PAY_GAS_SEPARATELY,
});
return seqno;
}
```
And after I am waiting seqno:
```
export async function waitSeqno(seqno: number, wallet: OpenedWallet): Promise<number> {
for (let attempt = 0; attempt < 20; attempt++) {
await sleep(2000);
const seqnoAfter = await wallet.contract.getSeqno();
if (seqnoAfter == seqno + 1) {
return Promise.resolve(seqno)
}
}
return Promise.reject(`Seqno ${seqno} timeout`)
}
export function sleep(ms: number): Promise<void> {
return new Promise((resolve) => setTimeout(resolve, ms));
}
```
Then I got the confirmation with seqno I request NFT item address by NFT index:
```
static async getAddressByIndex(
collectionAddress: Address,
itemIndex: number,
tonCenterApiKey: string
): Promise<Address> {
const client = new TonClient({
endpoint: "https://toncenter.com/api/v2/jsonRPC",
apiKey: tonCenterApiKey,
});
const response = await client.runMethod(
collectionAddress,
"get_nft_address_by_index",
[{ type: "int", value: BigInt(itemIndex) }]
);
return response.stack.readAddress();
}
```
The whole process takes up to 30 seconds per 1 NFT. I am curiose is there a better option to mint for example 10 NFTs, or the best way is to mint one by one without hurry?