@aurigami/sdk 1.16.2 → 1.17.1

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.16.2",
2
+ "version": "1.17.1",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
package/src/SDK.ts CHANGED
@@ -5,6 +5,7 @@ import { AuriEnv, BlockchainEntity, BlockchainEntityRead, Token, TokenAmount } f
5
5
  import { MiscRead, StakingRead, StakingReadWrite } from './interactors';
6
6
  import * as types from './types';
7
7
  import * as NotificationApi from './helpers/notification-api';
8
+ import { BigNumber as BN } from 'ethers';
8
9
 
9
10
  export class SdkRead extends BlockchainEntityRead {
10
11
  protected env: AuriEnv;
@@ -1,6 +1,6 @@
1
1
  import axios from 'axios';
2
2
 
3
- const AURORA_API_BASE_URL = 'https://api.aurorascan.dev/api';
3
+ const AURORA_API_BASE_URL = 'https://explorer.mainnet.aurora.dev/api';
4
4
 
5
5
  export async function getQuery(
6
6
  module: string,
@@ -169,7 +169,7 @@ export async function getBlockBeforeTimestamp(provider: Provider, timestamp: num
169
169
 
170
170
  // In case the API return `Block timestamp too far in the future`
171
171
  // use the last block number
172
- return parseInt(result) || (await provider.getBlockNumber());
172
+ return parseInt(result.blockNumber) || (await provider.getBlockNumber());
173
173
  }
174
174
 
175
175
  export function devLog(message?: any, ...optionalParams: any[]): void {
@@ -0,0 +1,39 @@
1
+ import { TransactionResponse } from '@ethersproject/abstract-provider';
2
+ import { BigNumber as BN } from 'ethers';
3
+ import { AuriEnv, BlockchainEntity, BlockchainEntityRead, TokenAmount } from '../entities';
4
+ import { Address, NetworkConnection } from '../types';
5
+
6
+ export class PulpRead extends BlockchainEntityRead {
7
+ public readonly env: AuriEnv;
8
+
9
+ public constructor(networkConnection: NetworkConnection) {
10
+ super(networkConnection);
11
+ this.env = new AuriEnv(networkConnection);
12
+ }
13
+
14
+ public async remainingEarlyUnlockPulp(user: Address): Promise<BN> {
15
+ return this.env.pulp.getMaxAmountRedeemable(user);
16
+ }
17
+ }
18
+
19
+ export class PulpReadWrite extends PulpRead {
20
+ public async convertEarlyPulp(
21
+ recipient: Address,
22
+ amount: TokenAmount
23
+ ): Promise<TransactionResponse> {
24
+ const amountToRedeem = BN.from(amount.rawAmount);
25
+ return this.env.pulp.redeem(recipient, amountToRedeem);
26
+ }
27
+ }
28
+
29
+ export class Pulp extends BlockchainEntity {
30
+ constructor() {
31
+ super();
32
+ }
33
+ public read(networkConnection: NetworkConnection): PulpRead {
34
+ return new PulpRead(networkConnection);
35
+ }
36
+ public readWrite(networkConnection: NetworkConnection): PulpReadWrite {
37
+ return new PulpReadWrite(networkConnection);
38
+ }
39
+ }