ton-core / ton

Most popular TON Typescript Library
MIT License
70 stars 58 forks source link

Bug with parse admin address of jetton master #34

Open 0x0liver opened 6 months ago

0x0liver commented 6 months ago

Description:

I got an error when trying to get jetton data with this function:

    async getJettonData(provider: ContractProvider) {
        let res = await provider.get('get_jetton_data', []);
        let totalSupply = res.stack.readBigNumber();
        let mintable = res.stack.readBoolean();
        let adminAddress = res.stack.readAddress();
        let content = res.stack.readCell();
        let walletCode = res.stack.readCell();
        return {
            totalSupply,
            mintable,
            adminAddress,
            content,
            walletCode
        };
    }

The problem is that the proxy ton (EQCM3B12QK1e4yZSf8GtBRT0aLMNyEsBc_DhVfRRtOEffLez) does not have an admin address, so I encounter the error:

Error: Invalid address: 0

Steps to Reproduce: Call the function with the jetton address EQCM3B12QK1e4yZSf8GtBRT0aLMNyEsBc_DhVfRRtOEffLez.

Solution: Use let adminAddress = res.stack.readAddressOpt(); instead.

Torakushi commented 2 months ago

Same here. I agree with the solution proposed here