Views

recipientBalance

This view is used to return the active balance of the recipient of a specific stream.

#[view(recipientBalance)]
fn recipient_balance(&self, stream_id: u64) -> BigUint

You can use the MultiversX public APIs to query the CoinDrip smart contract. Let's use axios for an example of such a call:

await axios.post('https://devnet-gateway.multiversx.com/vm-values/int',
    {
        funcName: 'recipientBalance',
        scAddress: 'erd1qqqqqqqqqqqqqpgqfgned8q9zqwaeya4sc0stf7elpj6ylsdlpzqwhk5ye',
        args: ["STREAM ID HEX"],
        value: "0"
    }
);

senderBalance

This view is used to return the active balance of the sender of a specific stream.

#[view(senderBalance)]
fn sender_balance(&self, stream_id: u64) -> BigUint

You can use the MultiversX public APIs to query the CoinDrip smart contract. Let's use axios for an example of such a call:

getStreamData

This view will return a Stream struct based on the stream id.

Because this will return a struct, we'll present you another way to query the smart contract and decode the struct using mx js sdk:

Last updated

Was this helpful?