@aurigami/sdk 1.17.5 → 1.18.0
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/abis/index.d.ts +2 -1
- package/dist/entities/auriEnv.d.ts +3 -1
- package/dist/interactors/PlyTokenLock.d.ts +16 -0
- package/dist/interactors/index.d.ts +1 -0
- package/dist/sdk.cjs.development.js +93 -1
- 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 +91 -2
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/abis/index.ts +3 -1
- package/src/entities/auriEnv.ts +13 -1
- package/src/interactors/PlyTokenLock.ts +47 -0
- package/src/interactors/index.ts +1 -0
package/package.json
CHANGED
package/src/abis/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ import Multicall2ABI from '@aurigami/contracts/artifacts/contracts/mock/Multical
|
|
|
15
15
|
import PulpABI from '@aurigami/contracts/artifacts/contracts/PULP.sol/PULP.json';
|
|
16
16
|
import ReferralDirectoryV2ABI from '@aurigami/contracts/artifacts/contracts/ReferralDirectoryV2.sol/ReferralDirectoryV2.json';
|
|
17
17
|
import PlyGameABI from '@aurigami/contracts/artifacts/contracts/plygame/PlyGame.sol/PlyGame.json';
|
|
18
|
+
import PlyTokenLockABI from '@aurigami/contracts/artifacts/contracts/PlyTokenLock.sol/PlyTokenLock.json';
|
|
18
19
|
export {
|
|
19
20
|
AuriOracleABI,
|
|
20
21
|
AuTokenABI,
|
|
@@ -33,4 +34,5 @@ export {
|
|
|
33
34
|
PulpABI,
|
|
34
35
|
AuriInternalLensABI,
|
|
35
36
|
PlyGameABI,
|
|
36
|
-
|
|
37
|
+
PlyTokenLockABI,
|
|
38
|
+
};
|
package/src/entities/auriEnv.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
PlyGame,
|
|
11
11
|
PULP,
|
|
12
12
|
ReferralDirectoryV2,
|
|
13
|
+
PlyTokenLock
|
|
13
14
|
} from '@aurigami/contracts/typechain';
|
|
14
15
|
import { Contract } from 'ethers';
|
|
15
16
|
import { assert } from '../helpers/helpers';
|
|
@@ -29,6 +30,7 @@ export class AuriEnv extends BlockchainEntityRead {
|
|
|
29
30
|
private _referralDirectoryV2: ReferralDirectoryV2 | null = null;
|
|
30
31
|
private _oracle: AuriOracle | null = null;
|
|
31
32
|
private _plygame: PlyGame | null = null;
|
|
33
|
+
private _plyTokenLock: PlyTokenLock | null = null;
|
|
32
34
|
|
|
33
35
|
public getContract<CType extends Contract>(address: string, abi: any) {
|
|
34
36
|
return new Contract(address, abi, this._networkConnection.provider) as CType;
|
|
@@ -163,4 +165,14 @@ export class AuriEnv extends BlockchainEntityRead {
|
|
|
163
165
|
}
|
|
164
166
|
return this._plygame;
|
|
165
167
|
}
|
|
166
|
-
|
|
168
|
+
|
|
169
|
+
get plyTokenLock(): PlyTokenLock {
|
|
170
|
+
if (!this._plyTokenLock) {
|
|
171
|
+
this._plyTokenLock = this.getContract<PlyTokenLock>(
|
|
172
|
+
networkAddresses.misc.PLY_TOKEN_LOCK,
|
|
173
|
+
abis.PlyTokenLockABI.abi
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
return this._plyTokenLock;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { TransactionResponse } from '@ethersproject/abstract-provider';
|
|
2
|
+
import { BigNumber as BN, utils } from 'ethers';
|
|
3
|
+
import {
|
|
4
|
+
AuriEnv,
|
|
5
|
+
BlockchainEntity,
|
|
6
|
+
BlockchainEntityRead,
|
|
7
|
+
PLYToken,
|
|
8
|
+
Token,
|
|
9
|
+
TokenAmount,
|
|
10
|
+
} from '../entities';
|
|
11
|
+
import * as helpers from '../helpers';
|
|
12
|
+
import { Address, NetworkConnection } from '../types';
|
|
13
|
+
|
|
14
|
+
export class PlyTokenLockRead extends BlockchainEntityRead {
|
|
15
|
+
public readonly env: AuriEnv;
|
|
16
|
+
|
|
17
|
+
public constructor(networkConnection: NetworkConnection) {
|
|
18
|
+
super(networkConnection);
|
|
19
|
+
this.env = new AuriEnv(networkConnection);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public async getClaimableAmount(recipient: Address): Promise<TokenAmount> {
|
|
23
|
+
const claimableAmount = await this.env.plyTokenLock.callStatic.claimableBalance(recipient);
|
|
24
|
+
return new TokenAmount(new Token(PLYToken.address, 18), claimableAmount.toString(), true);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export class PlyTokenLockReadWrite extends PlyTokenLockRead {
|
|
29
|
+
public async claim(recipient: Address, amount: TokenAmount): Promise<TransactionResponse> {
|
|
30
|
+
const amountToClaim = BN.from(amount.rawAmount());
|
|
31
|
+
return await this.env.plyTokenLock
|
|
32
|
+
.connect(this._networkConnection.signer!)
|
|
33
|
+
.claim(recipient, amountToClaim);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class PlyTokenLock extends BlockchainEntity {
|
|
38
|
+
constructor() {
|
|
39
|
+
super();
|
|
40
|
+
}
|
|
41
|
+
public read(networkConnection: NetworkConnection): PlyTokenLockRead {
|
|
42
|
+
return new PlyTokenLockRead(networkConnection);
|
|
43
|
+
}
|
|
44
|
+
public readWrite(networkConnection: NetworkConnection): PlyTokenLockReadWrite {
|
|
45
|
+
return new PlyTokenLockReadWrite(networkConnection);
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/interactors/index.ts
CHANGED