@monacoprotocol/client v0.0.1
Monaco Protocol Client
NPM package to interface with the Monaco Protocol program on the Solana network. The Monaco Protocol provides a decentralized liquidity network for wagering on binary-outcome events.
The package opens up the consumer-facing interactions with the protocol to facilitate exchanged-based applications including:
- Get markets by status/event/wagering token
- Place bet orders for markets
- Cancel bet orders
- Get market position for wallets
- Get wallet token balances
The package does not contain functionality to administer markets on the protocol.
Getting Started
Examples for working with the client can be found in the Monaco Protocol SDK Examples repository.
Documentation
All endpoints exported by the library contain detailed doc strings and examples confirming to the JSDoc format. These doc strings can be viewed separately in the docs directory.
Supplementary documentation can be accessed from the Monaco Protocol SDK.
Generating Docs
Docs are generated using documentationjs.
npm install -g documentation
npm run generateDocs
Client Response Format
All endpoints in the client return the same response format:
export type ClientResponse<T> = {
success: boolean;
errors: object[];
data: T;
};
Each endpoint defines its own data type used in the response, for example: createBetOrderUiStake
returns Promise<ClientResponse<CreateBetOrderResponse>>
export type CreateBetOrderResponse = {
betOrderPk: PublicKey;
tnxID: string | void;
};
Errors
Errors are purposely left loosely typed as an object[]
so that the client can remain as agnostic as possible and pass through unfiltered errors regardless of origin.
If any error is encountered during a request, the client will return success: false
and data may come back undefined
.
2 years ago