2.5.1 • Published 1 month ago
@sodazone/ocelloids-client v2.5.1
Ocelloids Client Library
TypeScript client library to interact with Ocelloids Service APIs.
Install
NPM
npm install @sodazone/ocelloids-client
Yarn
yarn add @sodazone/ocelloids-client
Usage
import { createXcmAgent } from "@sodazone/ocelloids-client";
// create an xcm agent client
const agent = createXcmAgent({
httpUrl: "http://127.0.0.1:3000",
wsUrl: "ws://127.0.0.1:3000"
});
// subscribe on-demand
const ws = agent.subscribe({
senders: "*",
events: "*",
origins: ["urn:ocn:polkadot:2004"],
destinations: [
"urn:ocn:polkadot:0",
"urn:ocn:polkadot:1000",
"urn:ocn:polkadot:2000",
"urn:ocn:polkadot:2034",
"urn:ocn:polkadot:2104"
]
}, {
onMessage: msg => {
if(xcm.isXcmReceived(msg)) {
console.log("RECV", msg.subscriptionId);
} else if(xcm.isXcmSent(msg)) {
console.log("SENT", msg.subscriptionId)
}
console.log(msg);
},
onError: error => console.log(error),
onClose: event => console.log(event.reason)
});
Explore the documentation site for further details.
Development
Enable corepack:
corepack enable
Install dependencies and build the project:
yarn && yarn build
Testing
Run unit tests:
yarn test
Run unit tests with coverage report:
yarn test:coverage
Compatibility
Compatible with browser environments, Node and Bun.
2.3.0
8 months ago
2.5.0
3 months ago
2.4.1
6 months ago
2.3.2
8 months ago
2.4.0
6 months ago
2.3.1
8 months ago
2.4.3
6 months ago
2.3.4
7 months ago
2.5.1
1 month ago
2.4.2
6 months ago
2.3.3
8 months ago
2.4.5
4 months ago
2.3.6
7 months ago
2.4.4
6 months ago
2.3.5
7 months ago
2.3.0-dev.0
8 months ago
2.0.1-dev.0
1 year ago
2.1.2
1 year ago
2.0.3
1 year ago
2.1.1
1 year ago
2.0.2
1 year ago
2.1.4
1 year ago
2.0.5
1 year ago
2.1.3
1 year ago
2.0.4
1 year ago
2.1.6
11 months ago
2.0.7
1 year ago
2.1.5
1 year ago
2.0.6
1 year ago
2.0.8
1 year ago
2.1.0
1 year ago
2.0.1
1 year ago
2.0.0
1 year ago
1.0.2
1 year ago
1.0.1
1 year ago
1.0.0
1 year ago