@wireio/stake 0.1.2 → 0.1.3

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireio/stake",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "LIQ Staking Module for Wire Network",
5
5
  "homepage": "https://gitea.gitgo.app/Wire/sdk-stake",
6
6
  "license": "FSL-1.1-Apache-2.0",
package/src/index.ts CHANGED
@@ -15,4 +15,4 @@ export * from './networks/solana/utils';
15
15
  // CLIENTS
16
16
  export * from './networks/solana/clients/deposit.client';
17
17
  export * from './networks/solana/clients/distribution.client';
18
- export * from './networks/solana/clients/leaderboard.client';
18
+ export * from './networks/solana/clients/leaderboard.client';
@@ -6,7 +6,6 @@ import { PublicKey as WirePubKey } from '@wireio/core';
6
6
  import { ERC20Abi, EthereumContractService } from './contract'; // TODO replace with staking contract ABI
7
7
  import { DepositEvent, DepositResult } from './types';
8
8
 
9
- // TODO extend to implement ISTAKINGCLIENT
10
9
  export class EthereumStakingClient implements IStakingClient {
11
10
  public readonly pubKey: WirePubKey;
12
11
  private readonly provider: ethers.providers.Web3Provider;
@@ -53,6 +52,8 @@ export class EthereumStakingClient implements IStakingClient {
53
52
  // If/when you extend the interface, you can surface more here.
54
53
  return result.txHash;
55
54
  }
55
+
56
+
56
57
  /**
57
58
  * Simulate a deposit via callStatic.
58
59
  *
@@ -120,13 +121,15 @@ export class EthereumStakingClient implements IStakingClient {
120
121
  */
121
122
  async getPortfolio(): Promise<Portfolio> {
122
123
  const walletAddress = await this.signer.getAddress();
123
-
124
+ // console.log('getPortfolio() wallet address', walletAddress)
124
125
  // 1) Native ETH balance
125
126
  const nativeBalance = await this.provider.getBalance(walletAddress);
126
127
  // console.log('nativeBalance', nativeBalance);
127
128
  const nativeDecimals = this.network?.nativeCurrency?.decimals ?? 18;
128
129
  const nativeSymbol = this.network?.nativeCurrency?.symbol ?? 'ETH';
129
130
 
131
+
132
+
130
133
  // 2) liqETH ERC-20 balance (actual)
131
134
  const liqBalance: ethers.BigNumber = await this.contract.LiqEth.balanceOf(walletAddress);
132
135
  // console.log('liqBalance', liqBalance);
@@ -145,6 +148,11 @@ export class EthereumStakingClient implements IStakingClient {
145
148
  decimals: liqDecimals,
146
149
  symbol: liqSymbol,
147
150
  },
151
+ tracked: {
152
+ amount: liqBalance,
153
+ decimals: liqDecimals,
154
+ symbol: liqSymbol,
155
+ },
148
156
  staked: { // TODO fetch staked balance from outpost
149
157
  amount: BigNumber.from(0),
150
158
  decimals: liqDecimals,
@@ -52,7 +52,7 @@ export class Staker {
52
52
 
53
53
  this.selectedChainID = selectedChainID;
54
54
  }
55
-
55
+
56
56
  /**
57
57
  * Select a chain. Returns true if a client exists for it, false otherwise.
58
58
  * (We still record the selectedChainID so the UI can reflect the chosen chain.)
@@ -3,14 +3,14 @@
3
3
  import { BaseSignerWalletAdapter } from '@solana/wallet-adapter-base';
4
4
  import { PublicKey as SolPubKey } from '@solana/web3.js';
5
5
  import { ChainID, ExternalNetwork, PublicKey } from '@wireio/core';
6
- import { BigNumberish, ethers } from 'ethers';
6
+ import { BigNumber, BigNumberish, ethers } from 'ethers';
7
7
 
8
8
  export interface IStakingClient {
9
9
  pubKey: PublicKey;
10
10
  network: ExternalNetwork;
11
11
 
12
12
  /** Amount is in the chain's smallest unit (lamports/wei, etc.) */
13
- deposit(amount: number): Promise<string>;
13
+ deposit(amount: number | BigNumber): Promise<string>;
14
14
 
15
15
  /** Register any untracked LIQ staked tokens */
16
16
  // register(): Promise<string>;