Hello I am trying to use runMethod method for a smart contract method with the following format
_ get_member_balance(slice address) method_id {

I am not quite sure how to convert to slice and how actually call that method using typescript. Anyone could guide me?

Jul 11, 2023, 10:32 PM
which ton lib are u using?
Jul 11, 2023, 11:45 PM
i think you have to store the input params as a TupleItem then call client.runMethod(contract_address, "get_member_balance", inputParamsTupleItem)

not sure how to convert address to slice tho
Jul 12, 2023, 3:35 AM
Great question! I assume you're asking about the code in FunC and also the way to fetch SmartContract data through this FunC code in TypeScript. If that's the case, here is the solution:

1/ Make sure it's a get method. Notice that methods in the interface class that call getters must start with the word get. This prefix is a requirement of the TON TypeScript library.

The slice you're referring to in _ get_member_balance(slice address) method_id { is a data format used at the FunC level.

2/ To read this get_method function in FunC with TypeScript code, you just need to provide an Address data type for it.

You can check the tutorial here: https://ton-community.github.io/tutorials/02-contract/
Jul 12, 2023, 4:05 AM

© 2024 Draquery.com All rights reserved.