@aurigami/sdk 1.12.3 → 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.3",
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';
@@ -119,10 +120,14 @@ export class PlyGameRead extends BlockchainEntityRead {
119
120
  }));
120
121
  }
121
122
 
122
- public async getJackpotResult(round: number): Promise<{ winner: Address; amount: TokenAmount }> {
123
- let result = await this.env.plygame.jackpotHistory(round);
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));
124
129
  return {
125
- winner: result.winner,
130
+ winner: result.winner.slice(0, 6) + '...' + result.winner.slice(4),
126
131
  amount: new TokenAmount(this.plyToken, result.amount.toString()),
127
132
  };
128
133
  }