☄️Streaming Payment SDK

Moveflow Streaming Payment SDK is a TypeScript SDK for interacting related to streaming payment contract on aptos. It provides a set of functions to create, manage, and retrieve streaming ops

Getting Started

Create a project using this example:

npm install --save  @moveflow/sdk-aptos

or

yarn add  @moveflow/sdk-aptos

Use SDK

Deploy a copy of your application to IPFS using the following command:

const rpc = https://testnet.aptoslabs.com
const sdk = new SDK(rpc, NetworkType.Testnet)

Submit Tx

  1. create a stream

const payload = sdk.stream.create({

  recipientAddr: '0x20f0cbe21cb340fe56500e0889cad03f8a9e54a33e3c4acfc24ce2bdfabc4180',
  depositAmount: 1,
  startTime: start_time,
  stopTime: stop_time,
  // coinType: AptosCoin,
  interval: 1000,
  // name: '1',
  // remark: '1',
  // canPause: true,
  // closeable: true,
  // recipientModifiable: true

})

const txid = await SignAndSubmitTransaction(payload)
  1. pause a stream

const payload = sdk.stream.pause({
    id: 29,
    coinType: AptosCoin,
})

const txid = await SignAndSubmitTransaction(payload)
  1. resume a stream

 const payload = sdk.stream.resume({
      id: 29,
    coinType: AptosCoin,
})

const txid = await SignAndSubmitTransaction(payload)
  1. close a stream

const payload = sdk.stream.close({ id: 29 })
const txid = await SignAndSubmitTransaction(payload)
  1. extend a stream

const payload = sdk.stream.extend({
    id: 30,
    extraAmount: 300,
    stopTime: '1635724800',
    ratePerInterval: '100',
    interval: '1000',
    coinType: AptosCoin,
})

const txid = await SignAndSubmitTransaction(payload)

Query Streams

  1. query incoming streams

const address = `0x20f0cbe21cb340fe56500e0889cad03f8a9e54a33e3c4acfc24ce2bdfabc4180`
const res = await sdk.stream.getIncomingStreams(address);

  1. query outgoing streams

const address = `0x20f0cbe21cb340fe56500e0889cad03f8a9e54a33e3c4acfc24ce2bdfabc4180`
const res = await sdk.stream.getOutgoingStreams(address)

https://github.com/Move-Flow/sdk.js/tree/lyb/aptos-sdk

Last updated