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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://moveflow.gitbook.io/moveflow/developer/streaming-payment-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
