Start Streaming

Start streaming helps to initiate the stream , for this user should decide start time , end time , amount and receiver before streaming and pass parameters as :

// Native Token

const response = stream.init({
        sender: "sender_wallet_address",
        receiver: "receiver_wallet_address",
        start_time: unixtimestamp,
        end_time: unixtimestamp,
        amount: <amount in SOL>
    })
   
// SPL Token

 const response = await token.init({
      sender: 'J75jd3kjsABQSDrEdywcyhmbq8eHDowfW9xtEWsVALy9',
      receiver: "Av6xsgSrnM1UAj4pUZnEWM97iBphph69NPHE8J2ceeYs",
      start_time: Math.floor(Date.now() / 1000) + 80,
      end_time: Math.floor(Date.now() / 1000) + 150,
      amount: 0.5,
      token_mint_address:'zebeczgi5fSEtbpfQKVZKCJ3WgYXxjkMUkNNx7fLKAF',
 });
 console.log(response);

Note: Returned PDA 'escrow' should be saved for using stream methods: pause, resume, and, withdraw the streamed token.

Last updated