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

@ton-api/ton-adapter need support isContractDeployed function #217

Open
YanYuanFE opened this issue Dec 6, 2024 · 1 comment
Open

@ton-api/ton-adapter need support isContractDeployed function #217

YanYuanFE opened this issue Dec 6, 2024 · 1 comment

Comments

@YanYuanFE
Copy link

provider.isContractDeployed is not a function

@mois-ilya
Copy link
Collaborator

Hello!

The ContractProvider interface from [ton/core](https://github.com/ton-org/ton-core/blob/213fed91d6f63d978c27588509e15ab53c8bafdb/src/contract/ContractProvider.ts) does not include the isContractDeployed method.

This method belongs to TonClient4 from ton/ton, which operates on top of the light server. In our case, instead of TonClient4, we use @ton-api/client (which this adapter is based on), which has the getAccount method that returns information about an account, including its status.

Here is an example of how you can obtain the desired value:

const account = await ta.accounts.getAccount(accountAddress);
const isContractDeployed = account.status !== 'nonexist' && account.status !== 'uninit';

Thus, instead of isContractDeployed, you can use the account status check via the getAccount method. If the account status is not 'nonexist' and not 'uninit', then the contract is deployed.

If you have any additional questions or need further assistance, please let us know!


Additional Information:

Ensure you are using the latest version of @ton-api/client to have access to all current methods and improvements. We also recommend reviewing the api documentation for more detailed information on working with accounts and contracts.

@mois-ilya mois-ilya reopened this Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants