Skip to content

Commit

Permalink
feat: marketCounter and marketTokenBalance introduced (#64)
Browse files Browse the repository at this point in the history
* feat: marketCounter and marketTokenBalance introduced

* Update lib/apis/query.ts

Co-authored-by: Nahu <39748285+nahuseyoum@users.noreply.github.com>

* Update lib/apis/query.ts

Co-authored-by: Nahu <39748285+nahuseyoum@users.noreply.github.com>

---------

Co-authored-by: Nahu <39748285+nahuseyoum@users.noreply.github.com>
  • Loading branch information
ivan-cholakov and nahuseyoum authored Jan 10, 2025
1 parent 903291a commit ffa0382
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/apis/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { AccountUtils, StakingStatus, TxType, Utils } from '../utils';
import { Awt } from '../awt';
import { AvnApiConfig, NonceType, PredictionMarketConstants, Royalty } from '../interfaces';
import { AvnApiConfig, NonceType, PredictionMarketAsset, PredictionMarketConstants, Royalty } from '../interfaces';
import { ethereumEncode } from '@polkadot/util-crypto';
import { isHex, u8aToHex, hexToU8a } from '@polkadot/util';

Expand Down Expand Up @@ -340,6 +340,14 @@ export class Query {
return await this.postRequest<string>(this.api, 'getPredictionMarketPoolInfo', { marketId });
}

async getPredictionMarketCounter(): Promise<string> {
return await this.postRequest<string>(this.api, 'getPredictionMarketCounter');
}

async getPredictionMarketTokenBalance(accountId: string, predictionMarketAsset: PredictionMarketAsset): Promise<string>{
return await this.postRequest<string>(this.api, 'getPredictionMarketTokenBalance', {accountId, predictionMarketAsset})
}

async getLiftStatus(txHash: string): Promise<string> {
return await this.postRequest<string>(this.api, 'getEthereumEventStatus', { txHash });
}
Expand Down
4 changes: 4 additions & 0 deletions lib/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ export type PredictionMarketConstants = {
maxSwapFee: number;
};

export type PredictionMarketAsset =
| { CategoricalOutcome: [string, string] }
| { ForeignAsset: string };

export enum Strategy {
/// The trade is rolled back if it cannot be executed fully.
ImmediateOrCancel = 0,
Expand Down

0 comments on commit ffa0382

Please sign in to comment.