@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/dist/interactors/PlyGame.d.ts +4 -0
- package/dist/sdk.cjs.development.js +51 -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 +51 -12
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/interactors/PlyGame.ts +13 -0
package/package.json
CHANGED
|
@@ -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 {
|