Initialize Token Stream

const now = nowInSec();
const streamRate = FungibleTokenAmount.parse("0.0001", 18).toString();
const startTime = (now + 10).toString();
const endTime = (now + 400).toString(); // 5 min
const receiver = "receiverAccountId.testnet";
const canCancel = true;
const canUpdate = true;
const tokenId = "usdc.fakes.testnet";

const streamParams: InitTokenStreamParams = {
   streamRate,
   startTime,
   endTime,
   receiver,
   canCancel,
   canUpdate,
   tokenId,
};

const streamPayload = await client.initTokenStream(streamParams);

const results = await wallet.signAndSendTransactions(streamPayload);

For obtaining streamId, you can do in the following way.

Last updated