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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## [7.5.0-beta.2](https://github.com/hirosystems/stacks-blockchain-api/compare/v7.5.0-beta.1...v7.5.0-beta.2) (2024-01-05)


### Bug Fixes

* socket-io client should not disconnect with no event reply ([#1800](https://github.com/hirosystems/stacks-blockchain-api/issues/1800)) ([d596fd5](https://github.com/hirosystems/stacks-blockchain-api/commit/d596fd5cc7efe588983d8a902771cc38c21fee82))

## [7.5.0-beta.1](https://github.com/hirosystems/stacks-blockchain-api/compare/v7.4.0...v7.5.0-beta.1) (2024-01-05)


### Features

* add listener callback to socket-io client subscription functions ([#1799](https://github.com/hirosystems/stacks-blockchain-api/issues/1799)) ([5634522](https://github.com/hirosystems/stacks-blockchain-api/commit/5634522132448fa480fcb18978a9cf2bf6f50a37))

## [7.4.0](https://github.com/hirosystems/stacks-blockchain-api/compare/v7.3.6...v7.4.0) (2024-01-04)


Expand Down
1 change: 1 addition & 0 deletions client/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/generated/*
29 changes: 16 additions & 13 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ import * as stacks from '@stacks/blockchain-api-client';
// for testnet, replace with https://api.testnet.hiro.so/
const socketUrl = "https://api.mainnet.hiro.so/";

const socket = io(socketUrl, {
transports: [ "websocket" ]
});
const socket = io(socketUrl);
const sc = new stacks.StacksApiSocketClient(socket);

sc.subscribeAddressTransactions('ST3GQB6WGCWKDNFNPSQRV8DY93JN06XPZ2ZE9EVMA');
sc.subscribeAddressTransactions('ST3GQB6WGCWKDNFNPSQRV8DY93JN06XPZ2ZE9EVMA', (address, tx) => {
console.log('address:', address);
console.log('tx:', tx);
});
```

## Available Updates
Expand Down Expand Up @@ -108,7 +109,7 @@ client.subscribeBlocks(event => {});
```
Subscribe via Socket.io:
```js
sc.subscribeBlocks();
sc.subscribeBlocks(block => {});
```

### Microblock Updates
Expand Down Expand Up @@ -149,7 +150,7 @@ client.subscribeMicroblocks(event => {});
```
Subscribe via Socket.io:
```js
sc.subscribeMicroblocks();
sc.subscribeMicroblocks(microblock => {});
```

### Mempool Updates
Expand Down Expand Up @@ -210,7 +211,7 @@ client.subscribeMempool(event => {});
```
Subscribe via Socket.io:
```js
sc.subscribeMempool();
sc.subscribeMempool(mempoolTx => {});
```

### Transaction Updates
Expand Down Expand Up @@ -277,7 +278,7 @@ client.subscribeTxUpdates('0xd78988664aaa9a1b751cd58c55b253914f790e95ca6f3d402a8
```
Subscribe via Socket.io:
```js
sc.subscribeTransaction('0xd78988664aaa9a1b751cd58c55b253914f790e95ca6f3d402a866559e1cbe0b3');
sc.subscribeTransaction('0xd78988664aaa9a1b751cd58c55b253914f790e95ca6f3d402a866559e1cbe0b3', tx => {});
```

### Address Transaction Updates
Expand Down Expand Up @@ -366,7 +367,7 @@ client.subscribeAddressTransactions('SP3C5SSYVKPAWTR8Y63CVYBR65GD3MG7K80526D1Q',
```
Subscribe via Socket.io:
```js
sc.subscribeAddressTransactions('SP3C5SSYVKPAWTR8Y63CVYBR65GD3MG7K80526D1Q');
sc.subscribeAddressTransactions('SP3C5SSYVKPAWTR8Y63CVYBR65GD3MG7K80526D1Q', (address, tx) => {});
```

### Address Balance Updates
Expand Down Expand Up @@ -412,7 +413,7 @@ client.subscribeAddressBalanceUpdates('SP3C5SSYVKPAWTR8Y63CVYBR65GD3MG7K80526D1Q
```
Subscribe via Socket.io:
```js
sc.subscribeAddressStxBalance('SP3C5SSYVKPAWTR8Y63CVYBR65GD3MG7K80526D1Q');
sc.subscribeAddressStxBalance('SP3C5SSYVKPAWTR8Y63CVYBR65GD3MG7K80526D1Q', (addr, balance) => {});
```

### NFT event updates
Expand Down Expand Up @@ -451,13 +452,15 @@ client.subscribeNftCollectionEventUpdates(
```
Subscribe via Socket.io:
```js
sc.subscribeNftEventUpdates();
sc.subscribeNftAssetEventUpdates(
sc.subscribeNftEvent(nftEvent => {});
sc.subscribeNftAssetEvent(
'SP176ZMV706NZGDDX8VSQRGMB7QN33BBDVZ6BMNHD.project-indigo-act1::Project-Indigo-Act1',
'0x0100000000000000000000000000000095',
(assetId, value, nftEvent) => {}
);
sc.subscribeNftCollectionEventUpdates(
sc.subscribeNftCollectionEvent(
'SP176ZMV706NZGDDX8VSQRGMB7QN33BBDVZ6BMNHD.project-indigo-act1::Project-Indigo-Act1',
(assetId, nftEvent) => {}
);
```

Expand Down
Loading