@aurigami/sdk 1.12.2 → 1.12.4

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.12.2",
2
+ "version": "1.12.4",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -1,4 +1,5 @@
1
1
  import { TransactionResponse } from '@ethersproject/abstract-provider';
2
+ import { BigNumber as BN } from 'ethers';
2
3
  import * as consts from '../consts';
3
4
  import { AuriEnv, BlockchainEntity, BlockchainEntityRead, Token, TokenAmount } from '../entities';
4
5
  import * as helpers from '../helpers';
@@ -118,6 +119,18 @@ export class PlyGameRead extends BlockchainEntityRead {
118
119
  gamesPlayed: item.count!,
119
120
  }));
120
121
  }
122
+
123
+ public async getLastJackpotResult(): Promise<{ winner: Address; amount: TokenAmount }> {
124
+ // 158 is the storage slot of the jackpot length
125
+ let round = BN.from(
126
+ await this._networkConnection.provider.getStorageAt(this.env.plygame.address, 158)
127
+ );
128
+ let result = await this.env.plygame.jackpotHistory(round.sub(1));
129
+ return {
130
+ winner: result.winner.slice(0, 6) + '...' + result.winner.slice(4),
131
+ amount: new TokenAmount(this.plyToken, result.amount.toString()),
132
+ };
133
+ }
121
134
  }
122
135
 
123
136
  export class PlyGameReadWrite extends PlyGameRead {