Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 2 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,38 +69,19 @@ const client = new OpenSeaStreamClient({

You can also optionally pass in:

- a `network` if you would like to access testnet networks.
- The default value is `Network.MAINNET` for all mainnet chains
- Can also select `Network.TESTNET` for all testnet chains
- a `network` parameter (defaults to `Network.MAINNET`)
- `apiUrl` if you would like to access another OpenSea Stream API endpoint. Not needed if you provide a network or use the default values.
- an `onError` callback to handle errors. The default behavior is to `console.error` the error.
- a `logLevel` to set the log level. The default is `LogLevel.INFO`.

## Available Networks

The OpenSea Stream API is available on the following networks:
The OpenSea Stream API is available on mainnet:

### Mainnet

`wss://stream.openseabeta.com/socket`

### Testnet

`wss://testnets-stream.openseabeta.com/socket`

To create testnet instance of the client, you can create it with the following arguments:

```typescript
import { OpenSeaStreamClient, Network } from '@opensea/stream-js';

const client = new OpenSeaStreamClient({
network: Network.TESTNET,
token: 'YOUR_OPENSEA_API_KEY'
});
```

An API key is not needed for testnets, so any value is okay for `token` when network is `Network.TESTNET`.

## Manually connecting to the socket (optional)

The client will automatically connect to the socket as soon as you subscribe to the first channel.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opensea/stream-js",
"version": "0.1.3",
"version": "0.2.0",
"description": "A TypeScript SDK to receive pushed updates from OpenSea over websocket",
"license": "MIT",
"author": "OpenSea Developers",
Expand Down
3 changes: 1 addition & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Network } from './types.js';

export const ENDPOINTS = {
[Network.MAINNET]: 'wss://stream.openseabeta.com/socket',
[Network.TESTNET]: 'wss://testnets-stream.openseabeta.com/socket'
[Network.MAINNET]: 'wss://stream.openseabeta.com/socket'
};
3 changes: 1 addition & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ export type ClientConfig = {
};

export enum Network {
MAINNET = 'mainnet',
TESTNET = 'testnet'
MAINNET = 'mainnet'
}

export enum EventType {
Expand Down