Skip to content

Commit

Permalink
fix: client updates and fixes for inplay release (#55)
Browse files Browse the repository at this point in the history
Co-authored-by: Eoin Murphy <[email protected]>
Co-authored-by: Eoin Murphy <[email protected]>
Co-authored-by: pawel-betdex <[email protected]>
  • Loading branch information
4 people authored May 23, 2023
1 parent e713d49 commit def72a4
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 74 deletions.
2 changes: 1 addition & 1 deletion admin/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ switch (script) {
case "setMarketReadyToClose":
setMarketReadyToClose();
break;
case "voidMarket":
case "void_market":
voidMarket();
break;
case "publish_market":
Expand Down
2 changes: 1 addition & 1 deletion admin/update_market_status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
unpublishMarket,
suspendMarket,
unsuspendMarket,
voidMarket,
voidMarket as setMarketReadyToVoidClient,
setMarketReadyToClose as setMarketReadyToCloseClient,
} from "../npm-admin-client/src";
import { checkResponse, getProtocolProgram } from "./util";
Expand Down
12 changes: 12 additions & 0 deletions npm-admin-client/docs/endpoints/market_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ For the given parameters:
* `eventAccountPk` **PublicKey** {PublicKey} publicKey of the event the market is associated with
* `outcomes` **[Array][8]<[string][7]>** {string\[]} list of possible outcomes for the market
* `priceLadder` **[Array][8]<[number][9]>** {number\[]} array of price points to add to the outcome
* `eventStartTimestamp` **EpochTimeStamp?** {EpochTimeStamp} timestamp in seconds representing when the event starts (defaults to marketLockTimestamp)
* `inplayEnabled` **[boolean][10]?** {boolean} whether the market can accept orders after the event starts (defaults to false)
* `inplayOrderDelay` **[number][9]?** {number} number of seconds an inplay order must wait before its liquidity is added to the market and can be matched (defaults to 0)
* `eventStartOrderBehaviour` **MarketOrderBehaviour?** {MarketOrderBehaviour} protocol behaviour to perform when the event start timestamp is reached (defaults to MarketOrderBehaviour.None)
* `marketLockOrderBehaviour` **MarketOrderBehaviour?** {MarketOrderBehaviour} protocol behaviour to perform when the market lock timestamp is reached (defaults to MarketOrderBehaviour.None)
* `batchSize` **[number][9]?** {number} number of prices to add in a single request

### Examples
Expand Down Expand Up @@ -57,6 +62,11 @@ For the given parameters, create a wagering market that accepts orders in the pr
* `marketTokenPk` **PublicKey** {PublicKey} publicKey of the mint token being used to place an order on a market
* `marketLockTimestamp` **EpochTimeStamp** {EpochTimeStamp} timestamp in seconds representing when the market can no longer accept orders
* `eventAccountPk` **PublicKey** {PublicKey} publicKey of the event the market is associated with
* `eventStartTimestamp` **EpochTimeStamp?** {EpochTimeStamp} timestamp in seconds representing when the event starts (defaults to marketLockTimestamp)
* `inplayEnabled` **[boolean][10]?** {boolean} whether the market can accept orders after the event starts (defaults to false)
* `inplayOrderDelay` **[number][9]?** {number} number of seconds an inplay order must wait before its liquidity is added to the market and can be matched (defaults to 0)
* `eventStartOrderBehaviour` **MarketOrderBehaviour?** {MarketOrderBehaviour} protocol behaviour to perform when the event start timestamp is reached (defaults to MarketOrderBehaviour.None)
* `marketLockOrderBehaviour` **MarketOrderBehaviour?** {MarketOrderBehaviour} protocol behaviour to perform when the market lock timestamp is reached (defaults to MarketOrderBehaviour.None)

### Examples

Expand Down Expand Up @@ -88,3 +98,5 @@ Returns **CreateMarketResponse** containing the newly-created market account pub
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array

[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
152 changes: 92 additions & 60 deletions npm-admin-client/docs/types/markets.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,35 @@
* [readyForSettlement][30]
* [settled][31]
* [readyToClose][32]
* [MarketAccount][33]
* [Properties][34]
* [EpochTimeStamp][35]
* [MarketOrderBehaviour][33]
* [none][34]
* [cancelUnmatched][35]
* [MarketOrderBehaviourValue][36]
* [MarketAccount][37]
* [Properties][38]
* [EpochTimeStamp][39]

## CreateMarketResponse

Type: {marketPk: PublicKey, tnxId: [string][36], market: [MarketAccount][33]}
Type: {marketPk: PublicKey, tnxId: [string][40], market: [MarketAccount][37]}

### Properties

* `marketPk` **PublicKey**&#x20;
* `tnxId` **[string][36]**&#x20;
* `market` **[MarketAccount][33]**&#x20;
* `tnxId` **[string][40]**&#x20;
* `market` **[MarketAccount][37]**&#x20;

## CreateMarketWithOutcomesAndPriceLadderResponse

Type: any

## OutcomePdaResponse

Type: {outcomeIndex: [number][37], outcomePda: PublicKey}
Type: {outcomeIndex: [number][41], outcomePda: PublicKey}

### Properties

* `outcomeIndex` **[number][37]**&#x20;
* `outcomeIndex` **[number][41]**&#x20;
* `outcomePda` **PublicKey**&#x20;

## OutcomeInitialisationResponse
Expand All @@ -71,139 +75,159 @@ Type: any

## OutcomePdasResponse

Type: {outcomePdas: [Array][38]<[OutcomePdaResponse][4]>}
Type: {outcomePdas: [Array][42]<[OutcomePdaResponse][4]>}

### Properties

* `outcomePdas` **[Array][38]<[OutcomePdaResponse][4]>**&#x20;
* `outcomePdas` **[Array][42]<[OutcomePdaResponse][4]>**&#x20;

## OutcomeInitialisationsResponse

Type: {outcomes: [Array][38]<[OutcomeInitialisationResponse][6]>}
Type: {outcomes: [Array][42]<[OutcomeInitialisationResponse][6]>}

### Properties

* `outcomes` **[Array][38]<[OutcomeInitialisationResponse][6]>**&#x20;
* `outcomes` **[Array][42]<[OutcomeInitialisationResponse][6]>**&#x20;

## AddPricesToOutcomeResponse

Type: {priceLadder: [Array][38]<[number][37]>, tnxId: [string][36]}
Type: {priceLadder: [Array][42]<[number][41]>, tnxId: [string][40]}

### Properties

* `priceLadder` **[Array][38]<[number][37]>**&#x20;
* `tnxId` **[string][36]**&#x20;
* `priceLadder` **[Array][42]<[number][41]>**&#x20;
* `tnxId` **[string][40]**&#x20;

## BatchAddPricesToOutcomeResponse

Type: {batches: [Array][38]<[AddPricesToOutcomeResponse][12]>}
Type: {batches: [Array][42]<[AddPricesToOutcomeResponse][12]>}

### Properties

* `batches` **[Array][38]<[AddPricesToOutcomeResponse][12]>**&#x20;
* `batches` **[Array][42]<[AddPricesToOutcomeResponse][12]>**&#x20;

## BatchAddPricesToOutcomes

Type: {outcomeIndex: [number][37], outcomePda: PublicKey, batches: [Array][38]<[AddPricesToOutcomeResponse][12]>}
Type: {outcomeIndex: [number][41], outcomePda: PublicKey, batches: [Array][42]<[AddPricesToOutcomeResponse][12]>}

### Properties

* `outcomeIndex` **[number][37]**&#x20;
* `outcomeIndex` **[number][41]**&#x20;
* `outcomePda` **PublicKey**&#x20;
* `batches` **[Array][38]<[AddPricesToOutcomeResponse][12]>**&#x20;
* `batches` **[Array][42]<[AddPricesToOutcomeResponse][12]>**&#x20;

## BatchAddPricesToOutcomesResponse

Type: {results: [Array][38]<[BatchAddPricesToOutcomes][16]>}
Type: {results: [Array][42]<[BatchAddPricesToOutcomes][16]>}

### Properties

* `results` **[Array][38]<[BatchAddPricesToOutcomes][16]>**&#x20;
* `results` **[Array][42]<[BatchAddPricesToOutcomes][16]>**&#x20;

## ValidateMarketOutcomeTitles

Type: {outcomesValid: [boolean][39], missingOutcomes: [Array][38]<[string][36]>, additionalOutcomes: [Array][38]<[string][36]>}
Type: {outcomesValid: [boolean][43], missingOutcomes: [Array][42]<[string][40]>, additionalOutcomes: [Array][42]<[string][40]>}

### Properties

* `outcomesValid` **[boolean][39]**&#x20;
* `missingOutcomes` **[Array][38]<[string][36]>**&#x20;
* `additionalOutcomes` **[Array][38]<[string][36]>**&#x20;
* `outcomesValid` **[boolean][43]**&#x20;
* `missingOutcomes` **[Array][42]<[string][40]>**&#x20;
* `additionalOutcomes` **[Array][42]<[string][40]>**&#x20;

## ValidateMarketOutcomePriceLadder

Type: {priceLadderValid: [boolean][39], outcomePk: PublicKey, missingPrices: [Array][38]<[number][37]>, additionalPrices: [Array][38]<[number][37]>}
Type: {priceLadderValid: [boolean][43], outcomePk: PublicKey, missingPrices: [Array][42]<[number][41]>, additionalPrices: [Array][42]<[number][41]>}

### Properties

* `priceLadderValid` **[boolean][39]**&#x20;
* `priceLadderValid` **[boolean][43]**&#x20;
* `outcomePk` **PublicKey**&#x20;
* `missingPrices` **[Array][38]<[number][37]>**&#x20;
* `additionalPrices` **[Array][38]<[number][37]>**&#x20;
* `missingPrices` **[Array][42]<[number][41]>**&#x20;
* `additionalPrices` **[Array][42]<[number][41]>**&#x20;

## ValidateMarketResponse

Type: {outcomesValid: [boolean][39], priceLaddersValid: [boolean][39], marketValid: [boolean][39], missingOutcomes: [Array][38]<[string][36]>, additionalOutcomes: [Array][38]<[string][36]>, priceLadderValidation: [Array][38]<[ValidateMarketOutcomePriceLadder][22]>}
Type: {outcomesValid: [boolean][43], priceLaddersValid: [boolean][43], marketValid: [boolean][43], missingOutcomes: [Array][42]<[string][40]>, additionalOutcomes: [Array][42]<[string][40]>, priceLadderValidation: [Array][42]<[ValidateMarketOutcomePriceLadder][22]>}

### Properties

* `outcomesValid` **[boolean][39]**&#x20;
* `priceLaddersValid` **[boolean][39]**&#x20;
* `marketValid` **[boolean][39]**&#x20;
* `missingOutcomes` **[Array][38]<[string][36]>**&#x20;
* `additionalOutcomes` **[Array][38]<[string][36]>**&#x20;
* `priceLadderValidation` **[Array][38]<[ValidateMarketOutcomePriceLadder][22]>**&#x20;
* `outcomesValid` **[boolean][43]**&#x20;
* `priceLaddersValid` **[boolean][43]**&#x20;
* `marketValid` **[boolean][43]**&#x20;
* `missingOutcomes` **[Array][42]<[string][40]>**&#x20;
* `additionalOutcomes` **[Array][42]<[string][40]>**&#x20;
* `priceLadderValidation` **[Array][42]<[ValidateMarketOutcomePriceLadder][22]>**&#x20;

## MarketStatus

### initializing

Type: Record<[string][36], never>
Type: Record<[string][40], never>

### open

Type: Record<[string][36], never>
Type: Record<[string][40], never>

### locked

Type: Record<[string][36], never>
Type: Record<[string][40], never>

### readyForSettlement

Type: Record<[string][36], never>
Type: Record<[string][40], never>

### settled

Type: Record<[string][36], never>
Type: Record<[string][40], never>

### readyToClose

Type: Record<[string][36], never>
Type: Record<[string][40], never>

## MarketOrderBehaviour

### none

Type: Record<[string][40], never>

### cancelUnmatched

Type: Record<[string][40], never>

## MarketOrderBehaviourValue

Type: {none: [MarketOrderBehaviour][33], cancelUnmatched: [MarketOrderBehaviour][33]}

## MarketAccount

Type: {authority: BN, decimalLimit: [number][37], escrowAccountBump: [number][37], eventAccount: PublicKey, marketLockTimestamp: BN, marketOutcomesCount: [number][37], marketSettleTimestamp: BN?, marketStatus: [MarketStatus][26], marketType: [string][36], marketWinningOutcomeIndex: [number][37]?, mintAccount: PublicKey, published: [boolean][39], suspended: [boolean][39], title: [string][36]}
Type: {authority: BN, decimalLimit: [number][41], escrowAccountBump: [number][41], eventAccount: PublicKey, eventStartTimestamp: BN, marketLockTimestamp: BN, marketOutcomesCount: [number][41], marketSettleTimestamp: BN?, marketStatus: [MarketStatus][26], marketType: [string][40], marketWinningOutcomeIndex: [number][41]?, mintAccount: PublicKey, published: [boolean][43], suspended: [boolean][43], title: [string][40], inplay: [boolean][43], inplayEnabled: [boolean][43], inplayDelay: [number][41], eventStartOrderBehaviour: [MarketOrderBehaviour][33], marketLockedOrderBehaviour: [MarketOrderBehaviour][33]}

### Properties

* `authority` **BN**&#x20;
* `decimalLimit` **[number][37]**&#x20;
* `escrowAccountBump` **[number][37]**&#x20;
* `decimalLimit` **[number][41]**&#x20;
* `escrowAccountBump` **[number][41]**&#x20;
* `eventAccount` **PublicKey**&#x20;
* `eventStartTimestamp` **BN**&#x20;
* `marketLockTimestamp` **BN**&#x20;
* `marketOutcomesCount` **[number][37]**&#x20;
* `marketOutcomesCount` **[number][41]**&#x20;
* `marketSettleTimestamp` **BN?**&#x20;
* `marketStatus` **[MarketStatus][26]**&#x20;
* `marketType` **[string][36]**&#x20;
* `marketWinningOutcomeIndex` **[number][37]?**&#x20;
* `marketType` **[string][40]**&#x20;
* `marketWinningOutcomeIndex` **[number][41]?**&#x20;
* `mintAccount` **PublicKey**&#x20;
* `published` **[boolean][39]**&#x20;
* `suspended` **[boolean][39]**&#x20;
* `title` **[string][36]**&#x20;
* `published` **[boolean][43]**&#x20;
* `suspended` **[boolean][43]**&#x20;
* `title` **[string][40]**&#x20;
* `inplay` **[boolean][43]**&#x20;
* `inplayEnabled` **[boolean][43]**&#x20;
* `inplayDelay` **[number][41]**&#x20;
* `eventStartOrderBehaviour` **[MarketOrderBehaviour][33]**&#x20;
* `marketLockedOrderBehaviour` **[MarketOrderBehaviour][33]**&#x20;

## EpochTimeStamp

Type: [number][37]
Type: [number][41]

[1]: #createmarketresponse

Expand Down Expand Up @@ -269,16 +293,24 @@ Type: [number][37]

[32]: #readytoclose

[33]: #marketaccount
[33]: #marketorderbehaviour

[34]: #none

[35]: #cancelunmatched

[36]: #marketorderbehaviourvalue

[37]: #marketaccount

[34]: #properties-11
[38]: #properties-11

[35]: #epochtimestamp
[39]: #epochtimestamp

[36]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[40]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[37]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
[41]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[38]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
[42]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array

[39]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
[43]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
Loading

0 comments on commit def72a4

Please sign in to comment.