# Pause/Resume Stream

Pause and resume stream both can be performed using same method means same method pause when invoked during ongoing stream and resume when invoked on paused stream can be done in following way.

```typescript
const sourceChain = CHAIN_ID_BSC;
const targetChain = CHAIN_ID_SOLANA;
const receiver = "<evm address>";
const sender = "<evm address>";
const tokenMint = "<solana mint address>";
const dataAccount = "<pubkey of stream data account>";

const receipt = await ethClient.pauseResumeStream(
   sender, 
   receiver, 
   tokenMint, 
   dataAccount
);
```

Now you can find signed vaa bytes of your payload sent to wormhole.

```typescript
const sequence = parseSequenceFromLogEth(receipt, getBridgeAddressForChain(sourceChain));
const zebecEmitterAddress = getEmitterAddressEth(BSC_ZEBEC_BRIDGE_ADDRESS);
const { vaaBytes } = await getSignedVAAWithRetry(
   WORMHOLE_RPC_HOSTS,
   sourceChain,
   zebecEmitterAddress,
   sequence,
);
```

Now post this signed vaa to wormhole solana core bridge program, parse the payloads from vaa and send the parsed data to solana zebec bridge program. This part is optional because it's handled by zebec's specialized relayer.

```typescript
const payerAddress = wallet.publicKey.toString();
const bridgeAddress = getBridgeAddressForChain(targetChain);
const vaaBuf = Buffer.from(vaaBytes);

setDefaultWasm("node"); // use bundler for browser

// posting vaa in solana
await postVaaSolanaWithRetry(
   connection,
   wallet.signTransaction,
   bridgeAddress,
   payerAddress,
   vaaBuf,
   MAX_VAA_UPLOAD_RETRIES_SOLANA,
);

const parsedVaa = parse_vaa(pauseVaa);
const parsedPayload = parseZebecPayload(Buffer.from(parsedVaa.payload));

const result = await solanaClient.pauseResumeStream(
   pauseVaa, 
   <PauseTokenStreamPayload>parsedPayload
);
```


---

# 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://docs.zebec.io/zebec-bridge/bridge-sdk/pause-resume-stream.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.
