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

Document how to get a contract's balance via Sandbox API #1783

Open
anton-trunov opened this issue Feb 11, 2025 · 0 comments
Open

Document how to get a contract's balance via Sandbox API #1783

anton-trunov opened this issue Feb 11, 2025 · 0 comments
Assignees
Labels
docs: Book /book section of the docs: Guides, Cheatsheets, and a streamlined sequence of educational materials docs: Reference /ref section of the docs: API reference, standard libraries, specification and evolution kind: docs Documentation for docs.tact-lang.org kept in docs folder kind: testing Tests (*.spec.ts)
Milestone

Comments

@anton-trunov
Copy link
Member

anton-trunov commented Feb 11, 2025

It can be done like so:

const contractBalance = (await blockchain.getContract(contract.address)).balance;

There is no need to add a getter to your contract to test how the contract's balance is changing:

get fun balance(): Int { return myBalance() }

P.S.: (novusnota) Thinking of a separate page for the Blueprint & Sandbox. In the Reference → Tools / Third-party.

@anton-trunov anton-trunov added kind: docs Documentation for docs.tact-lang.org kept in docs folder kind: testing Tests (*.spec.ts) labels Feb 11, 2025
@anton-trunov anton-trunov added this to the Doc: 2025-02 milestone Feb 11, 2025
@novusnota novusnota added docs: Book /book section of the docs: Guides, Cheatsheets, and a streamlined sequence of educational materials docs: Reference /ref section of the docs: API reference, standard libraries, specification and evolution labels Feb 11, 2025
@novusnota novusnota modified the milestones: Doc: 2025-02, Doc: 2025-03 Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs: Book /book section of the docs: Guides, Cheatsheets, and a streamlined sequence of educational materials docs: Reference /ref section of the docs: API reference, standard libraries, specification and evolution kind: docs Documentation for docs.tact-lang.org kept in docs folder kind: testing Tests (*.spec.ts)
Projects
None yet
Development

No branches or pull requests

2 participants