ton-community / assets-sdk

MIT License
72 stars 12 forks source link

SDK just hangs when creating NFT collection #17

Closed MartinSchere closed 4 months ago

MartinSchere commented 5 months ago

When runnnig:

 const result = await sdk.deployNftCollection(
    {
      collectionContent: {
        name: collectionName,
        description: 'An event',
      },
      commonContent: baseUrl,
    },
    { adminAddress, value: toNano(0.03) }

The code just hangs. It hangs on the following line:

 async deployNftCollection(content, options) {
        if (!this.sender) {
            throw new Error('Sender must be defined');
        }
        const adminAddress = options?.adminAddress ?? this.sender?.address;
        if (adminAddress === undefined) {
            throw new Error('Admin address must be defined in options or be available in Sender');
        }
        console.log("before open")
        const collection = this.api.open(NftCollection_1.NftCollection.createFromConfig({
            admin: adminAddress,
            content: (0, core_1.beginCell)()
                .storeRef(await this.contentToCell((0, content_2.nftContentToInternal)(content.collectionContent), options?.onchainContent ?? false))
                .storeRef((0, core_1.beginCell)().storeStringTail(content.commonContent))
                .endCell(),
            royalty: options?.royaltyParams,
        }, NftCollection_1.NftCollection.code, WORKCHAIN, this.contentResolver));
        console.log("after open")
        if (typeof options?.premintItems?.length === 'number' && options?.premintItems.length > 0) {
            await collection.sendBatchMint(this.sender, options?.premintItems, {
                value: options?.value,
                queryId: options?.queryId
            });
        }
        else {
            console.log("before sendDeploy")
            await collection.sendDeploy(this.sender, options?.value); // Here
            console.log("after sendDeploy")
        }
        return collection;
    }

I am using testnet.

MartinSchere commented 4 months ago

Sorry, new to this blockchain :)

Seems like if the seed is not linked to a highload wallet, the SDK will forever hang when calling sendDeploy

Could be better error management