@kamino-finance/klend-sdk 6.0.5-beta.4 → 6.0.5-beta.7

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 (48) hide show
  1. package/dist/classes/action.d.ts +1 -1
  2. package/dist/classes/action.d.ts.map +1 -1
  3. package/dist/classes/action.js +28 -13
  4. package/dist/classes/action.js.map +1 -1
  5. package/dist/classes/manager.d.ts +29 -18
  6. package/dist/classes/manager.d.ts.map +1 -1
  7. package/dist/classes/manager.js +65 -47
  8. package/dist/classes/manager.js.map +1 -1
  9. package/dist/classes/market.d.ts +2 -3
  10. package/dist/classes/market.d.ts.map +1 -1
  11. package/dist/classes/market.js +8 -9
  12. package/dist/classes/market.js.map +1 -1
  13. package/dist/client_kamino_manager.d.ts.map +1 -1
  14. package/dist/client_kamino_manager.js +30 -22
  15. package/dist/client_kamino_manager.js.map +1 -1
  16. package/dist/lending_operations/repay_with_collateral_operations.d.ts.map +1 -1
  17. package/dist/lending_operations/repay_with_collateral_operations.js +36 -32
  18. package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
  19. package/dist/lending_operations/swap_collateral_operations.d.ts.map +1 -1
  20. package/dist/lending_operations/swap_collateral_operations.js +4 -4
  21. package/dist/lending_operations/swap_collateral_operations.js.map +1 -1
  22. package/dist/leverage/operations.d.ts +1 -1
  23. package/dist/leverage/operations.d.ts.map +1 -1
  24. package/dist/leverage/operations.js +177 -150
  25. package/dist/leverage/operations.js.map +1 -1
  26. package/dist/utils/managerTypes.d.ts +1 -2
  27. package/dist/utils/managerTypes.d.ts.map +1 -1
  28. package/dist/utils/managerTypes.js +9 -9
  29. package/dist/utils/managerTypes.js.map +1 -1
  30. package/dist/utils/oracle.d.ts +2 -2
  31. package/dist/utils/oracle.d.ts.map +1 -1
  32. package/dist/utils/oracle.js.map +1 -1
  33. package/dist/utils/pubkey.d.ts +1 -0
  34. package/dist/utils/pubkey.d.ts.map +1 -1
  35. package/dist/utils/pubkey.js +10 -0
  36. package/dist/utils/pubkey.js.map +1 -1
  37. package/package.json +2 -2
  38. package/src/classes/action.ts +28 -12
  39. package/src/classes/manager.ts +80 -51
  40. package/src/classes/market.ts +14 -19
  41. package/src/client.ts +4 -4
  42. package/src/client_kamino_manager.ts +40 -35
  43. package/src/lending_operations/repay_with_collateral_operations.ts +76 -72
  44. package/src/lending_operations/swap_collateral_operations.ts +13 -11
  45. package/src/leverage/operations.ts +349 -326
  46. package/src/utils/managerTypes.ts +1 -2
  47. package/src/utils/oracle.ts +2 -2
  48. package/src/utils/pubkey.ts +9 -0
@@ -13,7 +13,7 @@ import {
13
13
  WithdrawalCaps,
14
14
  } from '../idl_codegen/types';
15
15
  import Decimal from 'decimal.js';
16
- import { Fraction, ZERO_FRACTION } from '../classes/fraction';
16
+ import { Fraction, ZERO_FRACTION } from '../classes';
17
17
  import BN from 'bn.js';
18
18
  import { numberToLamportsDecimal } from '../classes';
19
19
  import { NULL_PUBKEY } from './pubkey';
@@ -21,7 +21,6 @@ import { OracleType, U16_MAX } from '@kamino-finance/scope-sdk';
21
21
  import { LendingMarket } from '../lib';
22
22
 
23
23
  export type ScopeOracleConfig = {
24
- scopePriceConfigAddress: PublicKey;
25
24
  name: string;
26
25
  oracleType: string;
27
26
  oracleId: number;
@@ -1,6 +1,6 @@
1
1
  import { AccountInfo, Connection, PublicKey } from '@solana/web3.js';
2
2
  import Decimal from 'decimal.js';
3
- import { OraclePrices, Scope } from '@kamino-finance/scope-sdk';
3
+ import { Configuration, OraclePrices, Scope } from '@kamino-finance/scope-sdk';
4
4
  import { isNotNullPubkey, PubkeyHashMap, PublicKeySet } from './pubkey';
5
5
  import { parseTokenSymbol } from '../classes';
6
6
  import SwitchboardProgram from '@switchboard-xyz/sbv2-lite';
@@ -37,7 +37,7 @@ export type CandidatePrice = {
37
37
 
38
38
  export type ScopePriceRefreshConfig = {
39
39
  scope: Scope;
40
- scopeFeed: string;
40
+ scopeConfigurations: [PublicKey, Configuration][];
41
41
  };
42
42
 
43
43
  export function getTokenOracleDataSync(
@@ -253,6 +253,15 @@ export class PubkeyHashMap<K extends PublicKey, V> implements Map<K, V> {
253
253
  }
254
254
  }
255
255
 
256
+ export function setOrAppend<K, V>(map: Map<K, V[]>, key: K, value: V): void {
257
+ const existing = map.get(key);
258
+ if (existing) {
259
+ existing.push(value);
260
+ } else {
261
+ map.set(key, [value]);
262
+ }
263
+ }
264
+
256
265
  export class HashablePublicKey extends PublicKey implements IEquality<HashablePublicKey> {
257
266
  // We only use the last 32 bits of the public key for hashing
258
267
  static MASK = new BN(1).shln(32).subn(1);