@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.
- package/dist/classes/action.d.ts +1 -1
- package/dist/classes/action.d.ts.map +1 -1
- package/dist/classes/action.js +28 -13
- package/dist/classes/action.js.map +1 -1
- package/dist/classes/manager.d.ts +29 -18
- package/dist/classes/manager.d.ts.map +1 -1
- package/dist/classes/manager.js +65 -47
- package/dist/classes/manager.js.map +1 -1
- package/dist/classes/market.d.ts +2 -3
- package/dist/classes/market.d.ts.map +1 -1
- package/dist/classes/market.js +8 -9
- package/dist/classes/market.js.map +1 -1
- package/dist/client_kamino_manager.d.ts.map +1 -1
- package/dist/client_kamino_manager.js +30 -22
- package/dist/client_kamino_manager.js.map +1 -1
- package/dist/lending_operations/repay_with_collateral_operations.d.ts.map +1 -1
- package/dist/lending_operations/repay_with_collateral_operations.js +36 -32
- package/dist/lending_operations/repay_with_collateral_operations.js.map +1 -1
- package/dist/lending_operations/swap_collateral_operations.d.ts.map +1 -1
- package/dist/lending_operations/swap_collateral_operations.js +4 -4
- package/dist/lending_operations/swap_collateral_operations.js.map +1 -1
- package/dist/leverage/operations.d.ts +1 -1
- package/dist/leverage/operations.d.ts.map +1 -1
- package/dist/leverage/operations.js +177 -150
- package/dist/leverage/operations.js.map +1 -1
- package/dist/utils/managerTypes.d.ts +1 -2
- package/dist/utils/managerTypes.d.ts.map +1 -1
- package/dist/utils/managerTypes.js +9 -9
- package/dist/utils/managerTypes.js.map +1 -1
- package/dist/utils/oracle.d.ts +2 -2
- package/dist/utils/oracle.d.ts.map +1 -1
- package/dist/utils/oracle.js.map +1 -1
- package/dist/utils/pubkey.d.ts +1 -0
- package/dist/utils/pubkey.d.ts.map +1 -1
- package/dist/utils/pubkey.js +10 -0
- package/dist/utils/pubkey.js.map +1 -1
- package/package.json +2 -2
- package/src/classes/action.ts +28 -12
- package/src/classes/manager.ts +80 -51
- package/src/classes/market.ts +14 -19
- package/src/client.ts +4 -4
- package/src/client_kamino_manager.ts +40 -35
- package/src/lending_operations/repay_with_collateral_operations.ts +76 -72
- package/src/lending_operations/swap_collateral_operations.ts +13 -11
- package/src/leverage/operations.ts +349 -326
- package/src/utils/managerTypes.ts +1 -2
- package/src/utils/oracle.ts +2 -2
- 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
|
|
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;
|
package/src/utils/oracle.ts
CHANGED
|
@@ -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
|
-
|
|
40
|
+
scopeConfigurations: [PublicKey, Configuration][];
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
export function getTokenOracleDataSync(
|
package/src/utils/pubkey.ts
CHANGED
|
@@ -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);
|