@kamino-finance/klend-sdk 5.0.2 → 5.0.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.
Files changed (62) hide show
  1. package/dist/classes/fraction.d.ts.map +1 -1
  2. package/dist/classes/fraction.js.map +1 -1
  3. package/dist/classes/manager.d.ts.map +1 -1
  4. package/dist/classes/manager.js +14 -1
  5. package/dist/classes/manager.js.map +1 -1
  6. package/dist/classes/market.d.ts +4 -0
  7. package/dist/classes/market.d.ts.map +1 -1
  8. package/dist/classes/market.js +15 -0
  9. package/dist/classes/market.js.map +1 -1
  10. package/dist/classes/reserve.d.ts.map +1 -1
  11. package/dist/classes/reserve.js +15 -24
  12. package/dist/classes/reserve.js.map +1 -1
  13. package/dist/classes/utils.d.ts +3 -0
  14. package/dist/classes/utils.d.ts.map +1 -1
  15. package/dist/classes/utils.js +30 -0
  16. package/dist/classes/utils.js.map +1 -1
  17. package/dist/client_kamino_manager.js +1 -1
  18. package/dist/client_kamino_manager.js.map +1 -1
  19. package/dist/idl.json +27 -2
  20. package/dist/idl_codegen/accounts/LendingMarket.d.ts +6 -0
  21. package/dist/idl_codegen/accounts/LendingMarket.d.ts.map +1 -1
  22. package/dist/idl_codegen/accounts/LendingMarket.js +8 -1
  23. package/dist/idl_codegen/accounts/LendingMarket.js.map +1 -1
  24. package/dist/idl_codegen/accounts/Obligation.d.ts +3 -12
  25. package/dist/idl_codegen/accounts/Obligation.d.ts.map +1 -1
  26. package/dist/idl_codegen/accounts/Obligation.js +1 -4
  27. package/dist/idl_codegen/accounts/Obligation.js.map +1 -1
  28. package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.d.ts +20 -0
  29. package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.d.ts.map +1 -1
  30. package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.js +33 -1
  31. package/dist/idl_codegen/types/UpdateLendingMarketConfigValue.js.map +1 -1
  32. package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts +13 -0
  33. package/dist/idl_codegen/types/UpdateLendingMarketMode.d.ts.map +1 -1
  34. package/dist/idl_codegen/types/UpdateLendingMarketMode.js +25 -1
  35. package/dist/idl_codegen/types/UpdateLendingMarketMode.js.map +1 -1
  36. package/dist/idl_codegen/types/index.d.ts +4 -4
  37. package/dist/idl_codegen/types/index.d.ts.map +1 -1
  38. package/dist/idl_codegen/types/index.js.map +1 -1
  39. package/dist/utils/ObligationType.d.ts.map +1 -1
  40. package/dist/utils/ObligationType.js.map +1 -1
  41. package/dist/utils/managerTypes.d.ts.map +1 -1
  42. package/dist/utils/managerTypes.js.map +1 -1
  43. package/dist/utils/pubkey.d.ts.map +1 -1
  44. package/dist/utils/pubkey.js.map +1 -1
  45. package/dist/utils/rpc.d.ts.map +1 -1
  46. package/dist/utils/rpc.js.map +1 -1
  47. package/package.json +1 -1
  48. package/src/classes/fraction.ts +5 -0
  49. package/src/classes/manager.ts +14 -1
  50. package/src/classes/market.ts +18 -1
  51. package/src/classes/reserve.ts +39 -36
  52. package/src/classes/utils.ts +30 -0
  53. package/src/client_kamino_manager.ts +1 -1
  54. package/src/idl_codegen/accounts/LendingMarket.ts +12 -1
  55. package/src/idl_codegen/accounts/Obligation.ts +3 -12
  56. package/src/idl_codegen/types/UpdateLendingMarketConfigValue.ts +43 -0
  57. package/src/idl_codegen/types/UpdateLendingMarketMode.ts +30 -0
  58. package/src/idl_codegen/types/index.ts +4 -0
  59. package/src/utils/ObligationType.ts +6 -0
  60. package/src/utils/managerTypes.ts +1 -0
  61. package/src/utils/pubkey.ts +2 -0
  62. package/src/utils/rpc.ts +1 -0
@@ -283,6 +283,41 @@ export class ElevationGroup {
283
283
  }
284
284
  }
285
285
 
286
+ export type NameFields = [Array<number>]
287
+ export type NameValue = [Array<number>]
288
+
289
+ export interface NameJSON {
290
+ kind: "Name"
291
+ value: [Array<number>]
292
+ }
293
+
294
+ export class Name {
295
+ static readonly discriminator = 8
296
+ static readonly kind = "Name"
297
+ readonly discriminator = 8
298
+ readonly kind = "Name"
299
+ readonly value: NameValue
300
+
301
+ constructor(value: NameFields) {
302
+ this.value = [value[0]]
303
+ }
304
+
305
+ toJSON(): NameJSON {
306
+ return {
307
+ kind: "Name",
308
+ value: [this.value[0]],
309
+ }
310
+ }
311
+
312
+ toEncodable() {
313
+ return {
314
+ Name: {
315
+ _0: this.value[0],
316
+ },
317
+ }
318
+ }
319
+ }
320
+
286
321
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
287
322
  export function fromDecoded(
288
323
  obj: any
@@ -323,6 +358,10 @@ export function fromDecoded(
323
358
  const val = obj["ElevationGroup"]
324
359
  return new ElevationGroup([types.ElevationGroup.fromDecoded(val["_0"])])
325
360
  }
361
+ if ("Name" in obj) {
362
+ const val = obj["Name"]
363
+ return new Name([val["_0"]])
364
+ }
326
365
 
327
366
  throw new Error("Invalid enum object")
328
367
  }
@@ -355,6 +394,9 @@ export function fromJSON(
355
394
  case "ElevationGroup": {
356
395
  return new ElevationGroup([types.ElevationGroup.fromJSON(obj.value[0])])
357
396
  }
397
+ case "Name": {
398
+ return new Name([obj.value[0]])
399
+ }
358
400
  }
359
401
  }
360
402
 
@@ -368,6 +410,7 @@ export function layout(property?: string) {
368
410
  borsh.struct([borsh.u128("_0")], "U128"),
369
411
  borsh.struct([borsh.publicKey("_0")], "Pubkey"),
370
412
  borsh.struct([types.ElevationGroup.layout("_0")], "ElevationGroup"),
413
+ borsh.struct([borsh.array(borsh.u8(), 32, "_0")], "Name"),
371
414
  ])
372
415
  if (property !== undefined) {
373
416
  return ret.replicate(property)
@@ -417,6 +417,29 @@ export class UpdatePaddingFields {
417
417
  }
418
418
  }
419
419
 
420
+ export interface UpdateNameJSON {
421
+ kind: "UpdateName"
422
+ }
423
+
424
+ export class UpdateName {
425
+ static readonly discriminator = 18
426
+ static readonly kind = "UpdateName"
427
+ readonly discriminator = 18
428
+ readonly kind = "UpdateName"
429
+
430
+ toJSON(): UpdateNameJSON {
431
+ return {
432
+ kind: "UpdateName",
433
+ }
434
+ }
435
+
436
+ toEncodable() {
437
+ return {
438
+ UpdateName: {},
439
+ }
440
+ }
441
+ }
442
+
420
443
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
421
444
  export function fromDecoded(obj: any): types.UpdateLendingMarketModeKind {
422
445
  if (typeof obj !== "object") {
@@ -477,6 +500,9 @@ export function fromDecoded(obj: any): types.UpdateLendingMarketModeKind {
477
500
  if ("UpdatePaddingFields" in obj) {
478
501
  return new UpdatePaddingFields()
479
502
  }
503
+ if ("UpdateName" in obj) {
504
+ return new UpdateName()
505
+ }
480
506
 
481
507
  throw new Error("Invalid enum object")
482
508
  }
@@ -539,6 +565,9 @@ export function fromJSON(
539
565
  case "UpdatePaddingFields": {
540
566
  return new UpdatePaddingFields()
541
567
  }
568
+ case "UpdateName": {
569
+ return new UpdateName()
570
+ }
542
571
  }
543
572
  }
544
573
 
@@ -562,6 +591,7 @@ export function layout(property?: string) {
562
591
  borsh.struct([], "UpdateMinNetValueObligationPostAction"),
563
592
  borsh.struct([], "UpdateMinValueSkipPriorityLiqCheck"),
564
593
  borsh.struct([], "UpdatePaddingFields"),
594
+ borsh.struct([], "UpdateName"),
565
595
  ])
566
596
  if (property !== undefined) {
567
597
  return ret.replicate(property)
@@ -116,6 +116,7 @@ export type UpdateLendingMarketConfigValueKind =
116
116
  | UpdateLendingMarketConfigValue.U128
117
117
  | UpdateLendingMarketConfigValue.Pubkey
118
118
  | UpdateLendingMarketConfigValue.ElevationGroup
119
+ | UpdateLendingMarketConfigValue.Name
119
120
  export type UpdateLendingMarketConfigValueJSON =
120
121
  | UpdateLendingMarketConfigValue.BoolJSON
121
122
  | UpdateLendingMarketConfigValue.U8JSON
@@ -125,6 +126,7 @@ export type UpdateLendingMarketConfigValueJSON =
125
126
  | UpdateLendingMarketConfigValue.U128JSON
126
127
  | UpdateLendingMarketConfigValue.PubkeyJSON
127
128
  | UpdateLendingMarketConfigValue.ElevationGroupJSON
129
+ | UpdateLendingMarketConfigValue.NameJSON
128
130
 
129
131
  export { UpdateLendingMarketMode }
130
132
 
@@ -147,6 +149,7 @@ export type UpdateLendingMarketModeKind =
147
149
  | UpdateLendingMarketMode.UpdateMinNetValueObligationPostAction
148
150
  | UpdateLendingMarketMode.UpdateMinValueSkipPriorityLiqCheck
149
151
  | UpdateLendingMarketMode.UpdatePaddingFields
152
+ | UpdateLendingMarketMode.UpdateName
150
153
  export type UpdateLendingMarketModeJSON =
151
154
  | UpdateLendingMarketMode.UpdateOwnerJSON
152
155
  | UpdateLendingMarketMode.UpdateEmergencyModeJSON
@@ -166,6 +169,7 @@ export type UpdateLendingMarketModeJSON =
166
169
  | UpdateLendingMarketMode.UpdateMinNetValueObligationPostActionJSON
167
170
  | UpdateLendingMarketMode.UpdateMinValueSkipPriorityLiqCheckJSON
168
171
  | UpdateLendingMarketMode.UpdatePaddingFieldsJSON
172
+ | UpdateLendingMarketMode.UpdateNameJSON
169
173
 
170
174
  export { LastUpdate } from "./LastUpdate"
171
175
  export type { LastUpdateFields, LastUpdateJSON } from "./LastUpdate"
@@ -24,6 +24,7 @@ export class VanillaObligation {
24
24
  constructor(programId: PublicKey) {
25
25
  this.programId = programId;
26
26
  }
27
+
27
28
  toArgs() {
28
29
  const initObligationArgs: InitObligationArgsModel = {
29
30
  tag: VanillaObligation.tag,
@@ -34,6 +35,7 @@ export class VanillaObligation {
34
35
 
35
36
  return initObligationArgs;
36
37
  }
38
+
37
39
  toPda(market: PublicKey, user: PublicKey) {
38
40
  return getObligationPdaWithArgs(market, user, this.toArgs(), this.programId);
39
41
  }
@@ -61,6 +63,7 @@ export class MultiplyObligation {
61
63
 
62
64
  return initObligationArgs;
63
65
  }
66
+
64
67
  toPda(market: PublicKey, user: PublicKey) {
65
68
  return getObligationPdaWithArgs(market, user, this.toArgs(), this.programId);
66
69
  }
@@ -88,6 +91,7 @@ export class LeverageObligation {
88
91
 
89
92
  return initObligationArgs;
90
93
  }
94
+
91
95
  toPda(market: PublicKey, user: PublicKey) {
92
96
  return getObligationPdaWithArgs(market, user, this.toArgs(), this.programId);
93
97
  }
@@ -102,6 +106,7 @@ export class LendingObligation {
102
106
  this.token = token;
103
107
  this.programId = programId;
104
108
  }
109
+
105
110
  toArgs() {
106
111
  const initObligationArgs: InitObligationArgsModel = {
107
112
  tag: LendingObligation.tag,
@@ -112,6 +117,7 @@ export class LendingObligation {
112
117
 
113
118
  return initObligationArgs;
114
119
  }
120
+
115
121
  toPda(market: PublicKey, user: PublicKey) {
116
122
  return getObligationPdaWithArgs(market, user, this.toArgs(), this.programId);
117
123
  }
@@ -49,6 +49,7 @@ export interface AssetConfig {
49
49
  assetReserveConfigParams: AssetReserveConfigParams;
50
50
 
51
51
  setAssetConfigParams(assetReserveConfigParams: AssetReserveConfigParams): void;
52
+
52
53
  getReserveConfig(): ReserveConfig;
53
54
  }
54
55
 
@@ -239,6 +239,7 @@ export class PubkeyHashMap<K extends PublicKey, V> implements Map<K, V> {
239
239
  export class HashablePublicKey extends PublicKey implements IEquality<HashablePublicKey> {
240
240
  // We only use the last 32 bits of the public key for hashing
241
241
  static MASK = new BN(1).shln(32).subn(1);
242
+
242
243
  constructor(value: PublicKey | string | Buffer | Uint8Array | Array<number>) {
243
244
  super(value);
244
245
  }
@@ -257,5 +258,6 @@ export class HashablePublicKey extends PublicKey implements IEquality<HashablePu
257
258
 
258
259
  interface IEquality<T extends IEquality<T>> {
259
260
  equals(other: T): boolean;
261
+
260
262
  hashCode(): number;
261
263
  }
package/src/utils/rpc.ts CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  import { Buffer } from 'buffer';
11
11
  import axios from 'axios';
12
12
  import { init, decompress } from '@bokuweb/zstd-wasm';
13
+
13
14
  (async () => {
14
15
  await init();
15
16
  })();