helius-labs / helius-sdk

123 stars 39 forks source link

fix(das-types): Missing Response Types #99

Closed 0xIchigo closed 2 months ago

0xIchigo commented 2 months ago

This PR aims to address missing response types, specifically a token's standard and mint extensions

chukwumaokere commented 2 months ago

Just ran into to this very issue today TypeScript doesnt know that token_info is a valid field on searchAssets response.

    const response = await helius.rpc.searchAssets({
        ownerAddress: publicKey,
        supplyMint: process.env.NEXT_PUBLIC_PBP_TOKEN_MINT!,
        tokenType: 'fungible',
        page: 1,
    });

    // TODO: Workaround until https://github.com/helius-labs/helius-sdk/pull/99 gets merged
    const token = response.items[0] as DAS.GetAssetResponse & { token_info: { balance: number, decimals: number }};

    const balance = token.token_info.balance / Math.pow(10, token.token_info.decimals);

    return balance;
0xIchigo commented 2 months ago

Ah @chukwumaokere I apologize for the inconvenience — we'll have this merged and in the next release as soon as possible!