hedge-web3 0.1.23 → 0.1.27

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.
Files changed (62) hide show
  1. package/declarations/Constants.d.ts +3 -3
  2. package/declarations/idl/vault.d.ts +889 -752
  3. package/declarations/instructions/closeLiquidationPoolPosition.d.ts +1 -1
  4. package/declarations/instructions/createVault.d.ts +1 -1
  5. package/declarations/instructions/depositLiquidationPool.d.ts +1 -1
  6. package/declarations/instructions/depositVault.d.ts +1 -1
  7. package/declarations/instructions/liquidateVault.d.ts +1 -1
  8. package/declarations/instructions/loanVault.d.ts +1 -1
  9. package/declarations/instructions/redeemVault.d.ts +1 -1
  10. package/declarations/instructions/repayVault.d.ts +1 -1
  11. package/declarations/instructions/withdrawVault.d.ts +1 -1
  12. package/declarations/state/LiquidationPosition.d.ts +2 -2
  13. package/declarations/state/StakingPool.d.ts +1 -1
  14. package/declarations/state/StakingPoolPosition.d.ts +2 -2
  15. package/declarations/state/VaultAccount.d.ts +3 -3
  16. package/declarations/state/VaultHistoryEvent.d.ts +2 -2
  17. package/lib/Constants.js +10 -10
  18. package/lib/idl/vault.js +922 -785
  19. package/lib/instructions/closeLiquidationPoolPosition.js +9 -9
  20. package/lib/instructions/createStakingPool.js +4 -4
  21. package/lib/instructions/createVault.js +11 -11
  22. package/lib/instructions/depositLiquidationPool.js +9 -9
  23. package/lib/instructions/depositVault.js +8 -8
  24. package/lib/instructions/initHedgeFoundation.js +4 -4
  25. package/lib/instructions/liquidateVault.js +9 -9
  26. package/lib/instructions/loanVault.js +9 -9
  27. package/lib/instructions/redeemVault.js +10 -10
  28. package/lib/instructions/repayVault.js +10 -10
  29. package/lib/instructions/withdrawStakingPool.js +6 -6
  30. package/lib/instructions/withdrawVault.js +8 -8
  31. package/lib/state/LiquidationPosition.js +2 -2
  32. package/lib/state/StakingPool.js +1 -1
  33. package/lib/state/StakingPoolPosition.js +3 -3
  34. package/lib/state/VaultAccount.js +2 -2
  35. package/lib/state/VaultHistoryEvent.js +2 -2
  36. package/lib/utils/Errors.js +2 -2
  37. package/package.json +8 -9
  38. package/src/Constants.ts +73 -31
  39. package/src/idl/vault.ts +1848 -1574
  40. package/src/instructions/closeLiquidationPoolPosition.ts +10 -10
  41. package/src/instructions/createStakingPool.ts +5 -5
  42. package/src/instructions/createVault.ts +17 -17
  43. package/src/instructions/depositLiquidationPool.ts +10 -10
  44. package/src/instructions/depositVault.ts +12 -12
  45. package/src/instructions/initHedgeFoundation.ts +5 -5
  46. package/src/instructions/initHedgeFoundationTokens.ts +1 -1
  47. package/src/instructions/liquidateVault.ts +10 -10
  48. package/src/instructions/loanVault.ts +11 -11
  49. package/src/instructions/redeemVault.ts +12 -12
  50. package/src/instructions/repayVault.ts +12 -12
  51. package/src/instructions/setHalted.ts +1 -1
  52. package/src/instructions/withdrawStakingPool.ts +7 -7
  53. package/src/instructions/withdrawVault.ts +12 -12
  54. package/src/state/LiquidationPosition.ts +3 -3
  55. package/src/state/StakingPool.ts +2 -6
  56. package/src/state/StakingPoolPosition.ts +4 -4
  57. package/src/state/VaultAccount.ts +3 -3
  58. package/src/state/VaultHistoryEvent.ts +4 -4
  59. package/src/utils/Errors.ts +2 -2
  60. package/declarations/idl/idl.d.ts +0 -2
  61. package/lib/idl/idl.js +0 -1475
  62. package/src/idl/idl.ts +0 -1474
@@ -1,7 +1,7 @@
1
1
  import { BN, Program, Provider } from '@project-serum/anchor'
2
2
  import { getOrCreateAssociatedTokenAccount, TOKEN_PROGRAM_ID } from '@solana/spl-token'
3
3
  import { Keypair, PublicKey, sendAndConfirmTransaction, Signer, SystemProgram, Transaction, TransactionInstruction } from '@solana/web3.js'
4
- import { findAssociatedTokenAddress, getHedgeMintPublicKey, getPoolPublicKeyForMint, getVaultTypeAccountPublicKey, getUsdhMintPublicKey, getVaultSystemStatePublicKey } from '../Constants'
4
+ import { findAssociatedTokenAddress, getHedgeMintPublicKey, getPoolPublicKeyForMint, getVaultTypeAccountPublicKey, getUshMintPublicKey, getVaultSystemStatePublicKey } from '../Constants'
5
5
 
6
6
  export async function repayVault (
7
7
  program: Program,
@@ -11,10 +11,10 @@ export async function repayVault (
11
11
  repayAmount: number,
12
12
  overrideTime?: number
13
13
  ): Promise<PublicKey> {
14
- const usdhMintPublickey = await getUsdhMintPublicKey()
14
+ const ushMintPublickey = await getUshMintPublicKey()
15
15
 
16
- // Prep the user to get USDH back out at some point
17
- const payerUsdhAccount = await getOrCreateAssociatedTokenAccount(provider.connection, payer, usdhMintPublickey, payer.publicKey)
16
+ // Prep the user to get USH back out at some point
17
+ const payerUshAccount = await getOrCreateAssociatedTokenAccount(provider.connection, payer, ushMintPublickey, payer.publicKey)
18
18
  const vaultAccount = await program.account.vault.fetch(vaultPublicKey)
19
19
 
20
20
  const vaultTypeAccountPublicKey = await getVaultTypeAccountPublicKey(vaultAccount.collateralType)
@@ -27,7 +27,7 @@ export async function repayVault (
27
27
  await repayVaultInstruction(
28
28
  program,
29
29
  payer.publicKey,
30
- payerUsdhAccount.address,
30
+ payerUshAccount.address,
31
31
  vaultPublicKey,
32
32
  vaultAssociatedTokenAccount,
33
33
  history.publicKey,
@@ -44,7 +44,7 @@ export async function repayVault (
44
44
  export async function repayVaultInstruction (
45
45
  program: Program,
46
46
  payerPublicKey: PublicKey,
47
- ownerUsdhAccount: PublicKey,
47
+ ownerUshAccount: PublicKey,
48
48
  vaultPublickey: PublicKey,
49
49
  vaultAssociatedTokenAccount: PublicKey,
50
50
  historyPublicKey: PublicKey,
@@ -54,12 +54,12 @@ export async function repayVaultInstruction (
54
54
  overrideTime?: number
55
55
  ): Promise<TransactionInstruction> {
56
56
  const vaultSystemStatePublicKey = await getVaultSystemStatePublicKey()
57
- const usdhMintPublickey = await getUsdhMintPublicKey()
57
+ const ushMintPublickey = await getUshMintPublicKey()
58
58
  const hedgeMintPublickey = await getHedgeMintPublicKey()
59
59
  const [hedgeStakingPoolPublicKey] = await getPoolPublicKeyForMint(hedgeMintPublickey)
60
- const hedgeStakingPoolAssociatedUsdhTokenAccount = await findAssociatedTokenAddress(
60
+ const hedgeStakingPoolAssociatedUshTokenAccount = await findAssociatedTokenAddress(
61
61
  hedgeStakingPoolPublicKey,
62
- usdhMintPublickey
62
+ ushMintPublickey
63
63
  )
64
64
 
65
65
  return program.instruction.repayVault(
@@ -74,10 +74,10 @@ export async function repayVaultInstruction (
74
74
  vaultAssociatedTokenAccount: vaultAssociatedTokenAccount,
75
75
  history: historyPublicKey,
76
76
  feePool: hedgeStakingPoolPublicKey,
77
- feePoolAssociatedUsdhTokenAccount: hedgeStakingPoolAssociatedUsdhTokenAccount,
78
- usdhMint: usdhMintPublickey,
77
+ feePoolAssociatedUshTokenAccount: hedgeStakingPoolAssociatedUshTokenAccount,
78
+ ushMint: ushMintPublickey,
79
79
  vaultOwner: payerPublicKey,
80
- ownerUsdhAccount: ownerUsdhAccount,
80
+ ownerUshAccount: ownerUshAccount,
81
81
  tokenProgram: TOKEN_PROGRAM_ID,
82
82
  systemProgram: SystemProgram.programId
83
83
  },
@@ -2,7 +2,7 @@ import { BN, Program, Provider } from '@project-serum/anchor'
2
2
  import { TokenInstructions } from '@project-serum/serum'
3
3
  import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID, getOrCreateAssociatedTokenAccount } from '@solana/spl-token'
4
4
  import { Keypair, PublicKey, sendAndConfirmTransaction, Signer, SystemProgram, SYSVAR_RENT_PUBKEY, Transaction, TransactionInstruction } from '@solana/web3.js'
5
- import { findAssociatedTokenAddress, findVaultAddress, getVaultTypeAccountPublicKey, getUsdhMintPublicKey, getVaultSystemStatePublicKey, getPoolPublicKeyForMint, getHedgeMintPublicKey } from '../Constants'
5
+ import { findAssociatedTokenAddress, findVaultAddress, getVaultTypeAccountPublicKey, getUshMintPublicKey, getVaultSystemStatePublicKey, getPoolPublicKeyForMint, getHedgeMintPublicKey } from '../Constants'
6
6
 
7
7
  import { v4 as uuidv4 } from 'uuid'
8
8
  import { parseAnchorErrors } from '../utils/Errors'
@@ -2,7 +2,7 @@ import { BN, Program, Provider } from '@project-serum/anchor'
2
2
  import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '@solana/spl-token'
3
3
  import { Keypair, PublicKey, sendAndConfirmTransaction, Signer, SystemProgram, SYSVAR_RENT_PUBKEY, Transaction, TransactionInstruction } from '@solana/web3.js'
4
4
  import { parseAnchorErrors } from '../utils/Errors'
5
- import { findAssociatedTokenAddress, getHedgeMintPublicKey, getPoolPublicKeyForMint, getUsdhMintPublicKey, getVaultSystemStatePublicKey } from '../Constants'
5
+ import { findAssociatedTokenAddress, getHedgeMintPublicKey, getPoolPublicKeyForMint, getUshMintPublicKey, getVaultSystemStatePublicKey } from '../Constants'
6
6
 
7
7
  export async function withdrawStakingPool (
8
8
  program: Program,
@@ -34,14 +34,14 @@ export async function withdrawStakingPoolInstruction (
34
34
  overrideStartTime?: number
35
35
  ): Promise<TransactionInstruction> {
36
36
  const vaultSystemStatePublicKey = await getVaultSystemStatePublicKey()
37
- const usdhMintPublickey = await getUsdhMintPublicKey()
37
+ const ushMintPublickey = await getUshMintPublicKey()
38
38
  const hedgeMintPublickey = await getHedgeMintPublicKey()
39
39
  const [poolPublickey] = await getPoolPublicKeyForMint(stakedTokenMintPublicKey)
40
40
  const poolAssociatedStakedTokenAccount = await findAssociatedTokenAddress(poolPublickey, stakedTokenMintPublicKey)
41
- const poolAssociatedUsdhTokenAccount = await findAssociatedTokenAddress(poolPublickey, usdhMintPublickey)
41
+ const poolAssociatedUshTokenAccount = await findAssociatedTokenAddress(poolPublickey, ushMintPublickey)
42
42
  const payerAssociatedStakedTokenAccount = await findAssociatedTokenAddress(payerPublicKey, stakedTokenMintPublicKey)
43
43
  const payerAssociatedHedgeAccount = await findAssociatedTokenAddress(payerPublicKey, hedgeMintPublickey)
44
- const payerAssociatedUsdhAccount = await findAssociatedTokenAddress(payerPublicKey, usdhMintPublickey)
44
+ const payerAssociatedUshAccount = await findAssociatedTokenAddress(payerPublicKey, ushMintPublickey)
45
45
  const communityHedgeTokenAccount = await findAssociatedTokenAddress(vaultSystemStatePublicKey, hedgeMintPublickey)
46
46
 
47
47
  return program.instruction.withdrawStakingPool(
@@ -53,14 +53,14 @@ export async function withdrawStakingPoolInstruction (
53
53
  pool: poolPublickey,
54
54
  poolPosition: poolPositionPublicKey,
55
55
  poolAssociatedStakedTokenAccount: poolAssociatedStakedTokenAccount,
56
- poolAssociatedUsdhTokenAccount: poolAssociatedUsdhTokenAccount,
56
+ poolAssociatedUshTokenAccount: poolAssociatedUshTokenAccount,
57
57
  payerAssociatedStakedTokenAccount: payerAssociatedStakedTokenAccount,
58
58
  payerAssociatedHedgeAccount: payerAssociatedHedgeAccount,
59
- payerAssociatedUsdhAccount: payerAssociatedUsdhAccount,
59
+ payerAssociatedUshAccount: payerAssociatedUshAccount,
60
60
  communityAssociatedHedgeTokenAccount: communityHedgeTokenAccount,
61
61
  hedgeMint: hedgeMintPublickey,
62
62
  stakedTokenMint: stakedTokenMintPublicKey,
63
- usdhMint: usdhMintPublickey,
63
+ ushMint: ushMintPublickey,
64
64
  rent: SYSVAR_RENT_PUBKEY,
65
65
  tokenProgram: TOKEN_PROGRAM_ID,
66
66
  associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
@@ -2,7 +2,7 @@ import { BN, Program, Provider } from '@project-serum/anchor'
2
2
  import { getOrCreateAssociatedTokenAccount, TOKEN_PROGRAM_ID } from '@solana/spl-token'
3
3
  import { TokenInstructions } from '@project-serum/serum'
4
4
  import { Keypair, PublicKey, sendAndConfirmTransaction, Signer, SystemProgram, Transaction, TransactionInstruction } from '@solana/web3.js'
5
- import { findAssociatedTokenAddress, getVaultTypeAccountPublicKey, getUsdhMintPublicKey, getVaultSystemStatePublicKey, getPoolPublicKeyForMint, getHedgeMintPublicKey } from '../Constants'
5
+ import { findAssociatedTokenAddress, getVaultTypeAccountPublicKey, getUshMintPublicKey, getVaultSystemStatePublicKey, getPoolPublicKeyForMint, getHedgeMintPublicKey } from '../Constants'
6
6
 
7
7
  export async function withdrawVault (
8
8
  program: Program,
@@ -12,10 +12,10 @@ export async function withdrawVault (
12
12
  withdrawAmount: number,
13
13
  overrideTime?: number
14
14
  ): Promise<PublicKey> {
15
- const usdhMintPublickey = await getUsdhMintPublicKey()
15
+ const ushMintPublickey = await getUshMintPublicKey()
16
16
 
17
- // Prep the user to get USDH back out at some point
18
- await getOrCreateAssociatedTokenAccount(provider.connection, payer, usdhMintPublickey, payer.publicKey)
17
+ // Prep the user to get USH back out at some point
18
+ await getOrCreateAssociatedTokenAccount(provider.connection, payer, ushMintPublickey, payer.publicKey)
19
19
 
20
20
  const history = Keypair.generate()
21
21
  const vaultSystemStatePublicKey = await getVaultSystemStatePublicKey()
@@ -28,9 +28,9 @@ export async function withdrawVault (
28
28
 
29
29
  const destinationTokenAccount = await getOrCreateAssociatedTokenAccount(provider.connection, payer, vaultTypeAccountInfo.collateralMint, payer.publicKey)
30
30
  const [hedgeStakingPoolPublicKey] = await getPoolPublicKeyForMint(await getHedgeMintPublicKey())
31
- const hedgeStakingPoolAssociatedUsdhTokenAccount = await findAssociatedTokenAddress(
31
+ const hedgeStakingPoolAssociatedUshTokenAccount = await findAssociatedTokenAddress(
32
32
  hedgeStakingPoolPublicKey,
33
- usdhMintPublickey
33
+ ushMintPublickey
34
34
  )
35
35
 
36
36
  const transaction = new Transaction().add(
@@ -44,8 +44,8 @@ export async function withdrawVault (
44
44
  vaultTypeAccount,
45
45
  vaultTypeAssociatedTokenAccount.address,
46
46
  hedgeStakingPoolPublicKey,
47
- hedgeStakingPoolAssociatedUsdhTokenAccount,
48
- usdhMintPublickey,
47
+ hedgeStakingPoolAssociatedUshTokenAccount,
48
+ ushMintPublickey,
49
49
  history.publicKey,
50
50
  withdrawAmount,
51
51
  overrideTime
@@ -65,8 +65,8 @@ export async function withdrawVaultInstruction (
65
65
  vaultTypeAccount: PublicKey,
66
66
  vaultTypeAssociatedTokenAccount: PublicKey,
67
67
  hedgeStakingPoolPublicKey: PublicKey,
68
- hedgeStakingPoolAssociatedUsdhTokenAccount: PublicKey,
69
- usdhMint: PublicKey,
68
+ hedgeStakingPoolAssociatedUshTokenAccount: PublicKey,
69
+ ushMint: PublicKey,
70
70
  historyPublicKey: PublicKey,
71
71
  withdrawAmount: number,
72
72
  overrideTime?: number
@@ -82,8 +82,8 @@ export async function withdrawVaultInstruction (
82
82
  vault: vaultPublickey,
83
83
  vaultAssociatedTokenAccount: vaultAssociatedCollateralPublicKey,
84
84
  feePool: hedgeStakingPoolPublicKey,
85
- feePoolAssociatedUsdhTokenAccount: hedgeStakingPoolAssociatedUsdhTokenAccount,
86
- usdhMint: usdhMint,
85
+ feePoolAssociatedUshTokenAccount: hedgeStakingPoolAssociatedUshTokenAccount,
86
+ ushMint: ushMint,
87
87
  history: historyPublicKey,
88
88
  vaultOwner: payerPublicKey,
89
89
  destinationTokenAccount: destinationTokenAccount,
@@ -11,7 +11,7 @@ export class LiquidationPosition {
11
11
 
12
12
  public ownerAccount: PublicKey
13
13
  public deposit: number
14
- public closedUsdh: number
14
+ public closedUsh: number
15
15
  public timestampOpened: Date
16
16
  public timestampClosed: Date
17
17
 
@@ -27,7 +27,7 @@ export class LiquidationPosition {
27
27
  this.eraPublicKey = poolPositionInfo.era
28
28
  this.ownerAccount = poolPositionInfo.ownerAccount
29
29
  this.deposit = poolPositionInfo.deposit.toNumber()
30
- this.closedUsdh = poolPositionInfo.closedUsdh.toNumber()
30
+ this.closedUsh = poolPositionInfo.closedUsh.toNumber()
31
31
  this.timestampOpened = poolPositionInfo.timestampOpened.toNumber()
32
32
  this.timestampClosed = poolPositionInfo.timestampClosed.toNumber()
33
33
 
@@ -40,7 +40,7 @@ export class LiquidationPosition {
40
40
  console.log("poolPositionInfo.state, poolPositionInfo.state")
41
41
  }
42
42
 
43
- public getUsdhAvailable (era: LiquidationPoolEra): Decimal {
43
+ public getUshAvailable (era: LiquidationPoolEra): Decimal {
44
44
  return (era.product.div(this.productSnapshotEntry)).mul(new Decimal(this.deposit))
45
45
  }
46
46
 
@@ -12,7 +12,7 @@ export class StakingPool {
12
12
  totalHedgeReward: number
13
13
 
14
14
  hedgeRewardAccumulator: Decimal
15
- usdhFeeAccumulator: Decimal
15
+ ushFeeAccumulator: Decimal
16
16
  collateralFeeAccumulator: [Decimal]
17
17
 
18
18
  constructor (public poolInfo: any, publicKey: PublicKey) {
@@ -26,13 +26,9 @@ export class StakingPool {
26
26
  this.totalHedgeReward = poolInfo.totalHedgeReward.toNumber()
27
27
 
28
28
  this.hedgeRewardAccumulator = DecimalFromU128(poolInfo.hedgeRewardAccumulator)
29
- this.usdhFeeAccumulator = DecimalFromU128(poolInfo.usdhFeeAccumulator)
29
+ this.ushFeeAccumulator = DecimalFromU128(poolInfo.ushFeeAccumulator)
30
30
  this.collateralFeeAccumulator = poolInfo.collateralFeeAccumulator.map((sum: any) => { return DecimalFromU128(sum) })
31
31
  // this.currentRewardsPerDay = DecimalFromU128(poolInfo.currentRewardsPerDay)
32
32
  }
33
33
 
34
- // updateFeeAccumulator () {
35
- // this.feeAccumulator = (this.totalFeesNow - this.totalFeesPrevious) / this.deposits
36
- // this.totalFeesPrevious = this.totalFeesNow
37
- // }
38
34
  }
@@ -13,7 +13,7 @@ export class StakingPoolPosition {
13
13
  public timestampClosed: number
14
14
  public closedRewardedTokens: number
15
15
  public startHedgeRewardAccumulator: Decimal
16
- public startUsdhFeeAccumulator: Decimal
16
+ public startUshFeeAccumulator: Decimal
17
17
  public startSolFeeAccumulator: Decimal
18
18
  public open: boolean
19
19
 
@@ -27,13 +27,13 @@ export class StakingPoolPosition {
27
27
  this.closedRewardedTokens = poolPositionInfo.closedRewardedTokens.toNumber()
28
28
 
29
29
  this.startHedgeRewardAccumulator = DecimalFromU128(poolPositionInfo.startHedgeRewardAccumulator)
30
- this.startUsdhFeeAccumulator = DecimalFromU128(poolPositionInfo.startUsdhFeeAccumulator)
30
+ this.startUshFeeAccumulator = DecimalFromU128(poolPositionInfo.startUshFeeAccumulator)
31
31
  this.startSolFeeAccumulator = DecimalFromU128(poolPositionInfo.startSolFeeAccumulator)
32
32
 
33
33
  this.open = poolPositionInfo.state.open !== undefined
34
34
  }
35
35
 
36
- public getCurrentUsdhFeeReward (): Decimal {
37
- return this.pool.usdhFeeAccumulator.minus(this.startUsdhFeeAccumulator).times(new Decimal(this.deposited))
36
+ public getCurrentUshFeeReward (): Decimal {
37
+ return this.pool.ushFeeAccumulator.minus(this.startUshFeeAccumulator).times(new Decimal(this.deposited))
38
38
  }
39
39
  }
@@ -18,7 +18,7 @@ export class VaultAccount {
18
18
  /** The deposited collateral of the vault (in SOL Lamports). */
19
19
  deposited: number
20
20
 
21
- /** The outstanding debt of the vault (in USDH Lamports). Denormalized to time 0. */
21
+ /** The outstanding debt of the vault (in USH Lamports). Denormalized to time 0. */
22
22
  denormalizedDebt: number
23
23
 
24
24
  debtProductSnapshotBytes: Decimal
@@ -64,9 +64,9 @@ export class VaultAccount {
64
64
  }
65
65
 
66
66
  /**
67
- * Get the debt value in USDH
67
+ * Get the debt value in USH
68
68
  *
69
- * @returns debt value in USDH
69
+ * @returns debt value in USH
70
70
  */
71
71
  public inUsd (): number {
72
72
  return this.denormalizedDebt / LAMPORTS_PER_SOL
@@ -7,8 +7,8 @@ export class VaultHistoryEvent {
7
7
  publicKey: PublicKey
8
8
  actorAccount: PublicKey
9
9
  usdSolPrice: Decimal
10
- usdhDebtBefore: number
11
- usdhDebtAfter: number
10
+ ushDebtBefore: number
11
+ ushDebtAfter: number
12
12
  collateralBalanceBefore: number
13
13
  collateralBalanceAfter: number
14
14
  minCollateralRatioBefore: Decimal
@@ -24,8 +24,8 @@ export class VaultHistoryEvent {
24
24
 
25
25
  this.usdSolPrice = DecimalFromU128(account.usdSolPrice.toString())
26
26
 
27
- this.usdhDebtBefore = account.usdhDebtBefore.toNumber()
28
- this.usdhDebtAfter = account.usdhDebtAfter.toNumber()
27
+ this.ushDebtBefore = account.ushDebtBefore.toNumber()
28
+ this.ushDebtAfter = account.ushDebtAfter.toNumber()
29
29
  this.collateralBalanceBefore = account.collateralBalanceBefore.toNumber()
30
30
  this.collateralBalanceAfter = account.collateralBalanceAfter.toNumber()
31
31
  this.minCollateralRatioBefore = DecimalFromU128(account.minCollateralRatioBefore)
@@ -1,8 +1,8 @@
1
1
  import { parseIdlErrors, ProgramError } from '@project-serum/anchor'
2
- import { vaultIdl } from '../idl/idl'
2
+ import { IDL } from '../idl/vault'
3
3
 
4
4
  export function parseAnchorErrors (error: any): void {
5
- const idlErrors = parseIdlErrors(vaultIdl)
5
+ const idlErrors = parseIdlErrors(IDL)
6
6
  const parsedError = ProgramError.parse(error, idlErrors)
7
7
  if (parsedError !== null) {
8
8
  throw parsedError
@@ -1,2 +0,0 @@
1
- import { Idl } from '@project-serum/anchor';
2
- export declare const vaultIdl: Idl;