@aurigami/sdk 1.11.0-beta3 → 1.11.0-beta5
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/sdk.cjs.development.js +7 -4
- 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 +7 -4
- package/dist/sdk.esm.js.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/interactors/PlyGame.ts +9 -4
- package/src/types/index.ts +2 -2
package/dist/types/index.d.ts
CHANGED
|
@@ -141,9 +141,9 @@ export declare type PlyGameBetResult = {
|
|
|
141
141
|
*/
|
|
142
142
|
outcome: string;
|
|
143
143
|
/**
|
|
144
|
-
*
|
|
144
|
+
* ply lost amount
|
|
145
145
|
*/
|
|
146
|
-
|
|
146
|
+
lostAmount: TokenAmount;
|
|
147
147
|
unlockedPulpAmount: TokenAmount;
|
|
148
148
|
block: number;
|
|
149
149
|
timestamp: number;
|
package/package.json
CHANGED
|
@@ -29,11 +29,14 @@ export class PlyGameRead extends BlockchainEntityRead {
|
|
|
29
29
|
|
|
30
30
|
private parseBetMakeEvent(event: PlyBetMadeEvent): PlyGameBetResult {
|
|
31
31
|
let outcome = ['bigWin', 'win', 'lose', 'noImpact'][event.args.outcome];
|
|
32
|
-
let
|
|
33
|
-
|
|
32
|
+
let betAmount = event.args.amount;
|
|
33
|
+
// 0%, 0%, 100%, 2%
|
|
34
|
+
// big win, win, lose, no impact
|
|
35
|
+
let lostAmount = betAmount.mul([0, 0, 100, 2][event.args.outcome]).div(100);
|
|
36
|
+
let unlock = betAmount.mul([10, 1, 0, 0][event.args.outcome]);
|
|
34
37
|
return {
|
|
35
38
|
player: event.args.player,
|
|
36
|
-
|
|
39
|
+
lostAmount: new TokenAmount(this.plyToken, lostAmount.toString()),
|
|
37
40
|
unlockedPulpAmount: new TokenAmount(this.pulpToken, unlock.toString()),
|
|
38
41
|
outcome: outcome,
|
|
39
42
|
transactionHash: event.transactionHash,
|
|
@@ -83,7 +86,9 @@ export class PlyGameRead extends BlockchainEntityRead {
|
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
public async getPlyGameResultsInTransaction(txHash: Address): Promise<PlyGameBetResult[]> {
|
|
86
|
-
|
|
89
|
+
// wait for the tx to be mined if needed.
|
|
90
|
+
let tx = await this._networkConnection.provider.waitForTransaction(txHash, 1);
|
|
91
|
+
|
|
87
92
|
let filter = this.env.plygame.filters.BetMade();
|
|
88
93
|
let betMadeEvents: PlyBetMadeEvent[] = tx.logs
|
|
89
94
|
.filter((log) => isSameAddress(log.topics[0], filter.topics![0] as string))
|
package/src/types/index.ts
CHANGED