Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix- How to get transaction hash when deploying smart contract #225

Closed
legiarung opened this issue Sep 28, 2022 · 7 comments
Closed

Hotfix- How to get transaction hash when deploying smart contract #225

legiarung opened this issue Sep 28, 2022 · 7 comments

Comments

@legiarung
Copy link

I check and see here you only return contract address.
My code:

let params = {
			name: name,
			symbol: symbol || "",
			fee_recipient: recipient || currentAddress,
			primary_sale_recipient: recipient || currentAddress,
			platform_fee_recipient: recipient || currentAddress,
			seller_fee_basis_points: fee || 0,
			platform_fee_basis_points: fee || 0,
			description: `hazbase:${currentProjectId}`
		}

contractId = await sdk.deployer.deployNFTCollection(params)
 contractId = await sdk.deployer.deployEditionDrop(params)
contractId = await sdk.deployer.deployNFTDrop(params)
contractId = await sdk.deployer.deployToken(params)

You code :

deployNFTCollection(metadata: NFTContractDeployMetadata): Promise<string>;

Issues:

When many of my users use gasless, I want to save the information for customers to pay through Openzeplin. I don't see this function returning txHash but returning address.

But I see other functions like MintToken, SendToken, ... that return txid, like below.

My code get txid :

switch (contractType) {
		case 'edition-drop':
			contract = sdk.getEditionDrop(currentContractId)
			return txid = await contract.createBatch(Array.isArray(data)? data: [data])
		case 'nft-collection':
			contract = sdk.getNFTCollection(currentContractId)
			return txid = await contract.mintBatch(Array.isArray(data)? data: [data])
		case 'nft-drop':
			contract = sdk.getNFTDrop(currentContractId)
			return txid = await contract.createBatch(Array.isArray(data)? data: [data])
		case 'token':
			contract = sdk.getToken(currentContractId)
			return txid = await contract.mintTo(params.mintto, params.amount)
		default:
			break;
	}

YouCode return txid:

mintBatch(metadata: NFTMetadataOrUri[]): Promise<TransactionResultWithId<NFTMetadataOwner>[]>;

Can you help me pay extra txID when deploying contract .
Thanks!!!

@legiarung
Copy link
Author

@joaquim-verges please support me

@joaquim-verges
Copy link
Contributor

@legiarung sorry for the late response.

This is a feature that we have in our backlog and been wanting to expose for a while. I'll try to expose this for you this week, shouldn't take too long.

The implementation will probably be an event listener that allows you to capture the tx hash of any deploy through the SDK. Would that work for you?

@legiarung
Copy link
Author

legiarung commented Sep 29, 2022

@joaquim-verges
Thank you for responding . I also have some errors when using gasless, I have put the problem here. Do you mind if you check it for me.
But if not using gasless it works fine.
thirdweb-dev/ozdefender-autotask#4
thirdweb-dev/widgets#76

@haunguyenuit
Copy link

@legiarung sorry for the late response.

This is a feature that we have in our backlog and been wanting to expose for a while. I'll try to expose this for you this week, shouldn't take too long.

The implementation will probably be an event listener that allows you to capture the tx hash of any deploy through the SDK. Would that work for you?

@joaquim-verges I also need the transaction hash after deploying smart contract. Did you release that feature?

@adam-maj
Copy link
Contributor

Hi @haunguyenuit @legiarung - we've now released this feature to @thirdweb-dev/sdk@nightly version. You should be able to access the transaction hash and contract address of deployed contracts with the following interface:

// Add deploy event transaction listener
sdk.deployer.addDeployListener((event) => {
  // Hash of the deploy transaction
  console.log(deploy.transactionHash);
  // Address of the deployed contract
  console.log(deploy.contractAddress);
});

// Now when we deploy, we'll get pinged in our listener
sdk.deployer.deployEdition(...);

Let me know if you have any further questions

@haunguyenuit
Copy link

Hi @haunguyenuit @legiarung - we've now released this feature to @thirdweb-dev/sdk@nightly version. You should be able to access the transaction hash and contract address of deployed contracts with the following interface:

// Add deploy event transaction listener
sdk.deployer.addDeployListener((event) => {
  // Hash of the deploy transaction
  console.log(deploy.transactionHash);
  // Address of the deployed contract
  console.log(deploy.contractAddress);
});

// Now when we deploy, we'll get pinged in our listener
sdk.deployer.deployEdition(...);

Let me know if you have any further questions

ok, thanks @adam-maj

@legiarung
Copy link
Author

Hi @haunguyenuit @legiarung - we've now released this feature to @thirdweb-dev/sdk@nightly version. You should be able to access the transaction hash and contract address of deployed contracts with the following interface:

// Add deploy event transaction listener
sdk.deployer.addDeployListener((event) => {
  // Hash of the deploy transaction
  console.log(deploy.transactionHash);
  // Address of the deployed contract
  console.log(deploy.contractAddress);
});

// Now when we deploy, we'll get pinged in our listener
sdk.deployer.deployEdition(...);

Let me know if you have any further questions

Thank you sir, I have many issues for you but have not been answered yet. please help me check it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants