> For the complete documentation index, see [llms.txt](https://moveflow.gitbook.io/moveflow/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://moveflow.gitbook.io/moveflow/developer/streaming-payment-sdk.md).

# Streaming Payment SDK

### 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

<pre data-full-width="false"><code><strong>const payload = sdk.stream.create({
</strong>
  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)
</code></pre>

2. pause a stream

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

const txid = await SignAndSubmitTransaction(payload)

```

3. resume a stream

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

const txid = await SignAndSubmitTransaction(payload)

```

4. close a stream

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

5. 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);


```

2. query outgoing streams

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

### Github Link:&#x20;

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