@aurigami/sdk 1.11.0-beta → 1.11.0-beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/interactors/PlyGame.d.ts +6 -1
- package/dist/sdk.cjs.development.js +78 -12
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +78 -12
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/index.d.ts +5 -0
- package/package.json +1 -1
- package/src/interactors/PlyGame.ts +25 -1
- package/src/types/index.ts +6 -0
package/dist/types/index.d.ts
CHANGED
|
@@ -152,6 +152,11 @@ export declare type PlyGameBetResult = {
|
|
|
152
152
|
*/
|
|
153
153
|
transactionHash: string;
|
|
154
154
|
};
|
|
155
|
+
export declare type PlyGameLeaderboardItem = {
|
|
156
|
+
player: string;
|
|
157
|
+
gamesPlayed: number;
|
|
158
|
+
unlockedPulpAmount: TokenAmount;
|
|
159
|
+
};
|
|
155
160
|
export declare type PlyBetMadeEvent = TypedEvent<[string, BN, number] & {
|
|
156
161
|
player: string;
|
|
157
162
|
amount: BN;
|
package/package.json
CHANGED
|
@@ -3,7 +3,14 @@ import * as consts from '../consts';
|
|
|
3
3
|
import { AuriEnv, BlockchainEntity, BlockchainEntityRead, Token, TokenAmount } from '../entities';
|
|
4
4
|
import * as helpers from '../helpers';
|
|
5
5
|
import { getBlocksTimestamp, isSameAddress } from '../helpers';
|
|
6
|
-
import
|
|
6
|
+
import * as AuriAPI from '../helpers/aurigami-api';
|
|
7
|
+
import {
|
|
8
|
+
Address,
|
|
9
|
+
NetworkConnection,
|
|
10
|
+
PlyBetMadeEvent,
|
|
11
|
+
PlyGameBetResult,
|
|
12
|
+
PlyGameLeaderboardItem,
|
|
13
|
+
} from '../types';
|
|
7
14
|
|
|
8
15
|
export class PlyGameRead extends BlockchainEntityRead {
|
|
9
16
|
public readonly plyToken: Token;
|
|
@@ -86,6 +93,18 @@ export class PlyGameRead extends BlockchainEntityRead {
|
|
|
86
93
|
|
|
87
94
|
return this.attachTimestamp(betMadeEvents.map((e) => this.parseBetMakeEvent(e)));
|
|
88
95
|
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Top 100 users by amount of PULP unlocked
|
|
99
|
+
*/
|
|
100
|
+
public async leaderboard(): Promise<PlyGameLeaderboardItem[]> {
|
|
101
|
+
const result = await AuriAPI.getPaginatedApi('/plygame/leaderboard');
|
|
102
|
+
return result.items.map((item, i) => ({
|
|
103
|
+
player: item.user!,
|
|
104
|
+
unlockedPulpAmount: new TokenAmount(this.pulpToken, item.unlockedAmount!),
|
|
105
|
+
gamesPlayed: item.count!,
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
89
108
|
}
|
|
90
109
|
|
|
91
110
|
export class PlyGameReadWrite extends PlyGameRead {
|
|
@@ -106,6 +125,11 @@ export class PlyGameReadWrite extends PlyGameRead {
|
|
|
106
125
|
.connect(this._networkConnection.signer!)
|
|
107
126
|
.makeBetOnce(amount.rawAmount());
|
|
108
127
|
}
|
|
128
|
+
public async approve(amount: TokenAmount): Promise<TransactionResponse> {
|
|
129
|
+
return this.env.ply
|
|
130
|
+
.connect(this._networkConnection.signer!)
|
|
131
|
+
.approve(this.env.plygame.address, amount.rawAmount());
|
|
132
|
+
}
|
|
109
133
|
}
|
|
110
134
|
|
|
111
135
|
export class PlyGame extends BlockchainEntity {
|
package/src/types/index.ts
CHANGED
|
@@ -172,6 +172,12 @@ export type PlyGameBetResult = {
|
|
|
172
172
|
transactionHash: string;
|
|
173
173
|
};
|
|
174
174
|
|
|
175
|
+
export type PlyGameLeaderboardItem = {
|
|
176
|
+
player: string;
|
|
177
|
+
gamesPlayed: number;
|
|
178
|
+
unlockedPulpAmount: TokenAmount;
|
|
179
|
+
};
|
|
180
|
+
|
|
175
181
|
export type PlyBetMadeEvent = TypedEvent<
|
|
176
182
|
[string, BN, number] & { player: string; amount: BN; outcome: number }
|
|
177
183
|
>;
|