@haven-fi/solauto-sdk 1.0.147 → 1.0.148

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. package/dist/clients/solautoMarginfiClient.d.ts.map +1 -1
  2. package/dist/clients/solautoMarginfiClient.js +2 -1
  3. package/dist/generated/accounts/solautoPosition.d.ts +4 -1
  4. package/dist/generated/accounts/solautoPosition.d.ts.map +1 -1
  5. package/dist/generated/accounts/solautoPosition.js +4 -2
  6. package/dist/generated/instructions/marginfiOpenPosition.d.ts +3 -1
  7. package/dist/generated/instructions/marginfiOpenPosition.d.ts.map +1 -1
  8. package/dist/generated/instructions/marginfiOpenPosition.js +1 -0
  9. package/dist/generated/types/index.d.ts +1 -0
  10. package/dist/generated/types/index.d.ts.map +1 -1
  11. package/dist/generated/types/index.js +1 -0
  12. package/dist/generated/types/positionType.d.ts +15 -0
  13. package/dist/generated/types/positionType.d.ts.map +1 -0
  14. package/dist/generated/types/positionType.js +22 -0
  15. package/dist/types/solauto.d.ts +2 -1
  16. package/dist/types/solauto.d.ts.map +1 -1
  17. package/dist/utils/solanaUtils.d.ts +1 -1
  18. package/dist/utils/solanaUtils.d.ts.map +1 -1
  19. package/dist/utils/solanaUtils.js +2 -2
  20. package/dist/utils/solauto/generalUtils.d.ts +3 -3
  21. package/dist/utils/solauto/generalUtils.d.ts.map +1 -1
  22. package/dist/utils/solauto/generalUtils.js +19 -5
  23. package/package.json +1 -1
  24. package/src/clients/solautoMarginfiClient.ts +4 -1
  25. package/src/generated/accounts/solautoPosition.ts +10 -2
  26. package/src/generated/instructions/marginfiOpenPosition.ts +6 -0
  27. package/src/generated/types/index.ts +1 -0
  28. package/src/generated/types/positionType.ts +25 -0
  29. package/src/types/solauto.ts +2 -1
  30. package/src/utils/solanaUtils.ts +2 -2
  31. package/src/utils/solauto/generalUtils.ts +24 -5
@@ -1 +1 @@
1
- {"version":3,"file":"solautoMarginfiClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoMarginfiClient.ts"],"names":[],"mappings":"AAIA,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kB;IAUhE,OAAO,CAAC,6BAA6B;IAmErC,OAAO,CAAC,oCAAoC;IA0D5C,SAAS,CACP,aAAa,EAAE,GAAG,GAAG,GAAG,EACxB,WAAW,EAAE,cAAc,EAC3B,aAAa,EAAE,wBAAwB,EACvC,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB;IA0DrB,WAAW,CACT,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,EAAE,SAAS,GACjC,kBAAkB;IA2BrB,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,kBAAkB;IAoFlE,iCAAiC,IAAI,kBAAkB;IASjD,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CA4BlE"}
@@ -109,7 +109,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
109
109
  .openPosition(settingParams, dca)
110
110
  .add(this.marginfiOpenPositionIx(settingParams, dca));
111
111
  }
112
- marginfiOpenPositionIx(settingParams, dca) {
112
+ marginfiOpenPositionIx(settingParams, dca, positionType) {
113
113
  let signerDebtTa = undefined;
114
114
  if (dca) {
115
115
  signerDebtTa = (0, umi_1.publicKey)(this.signerDebtTa);
@@ -138,6 +138,7 @@ class SolautoMarginfiClient extends solautoClient_1.SolautoClient {
138
138
  debtBank: (0, umi_1.publicKey)(this.marginfiDebtAccounts.bank),
139
139
  positionDebtTa: (0, umi_1.publicKey)(this.positionDebtTa),
140
140
  signerDebtTa: signerDebtTa,
141
+ positionType: positionType ?? generated_1.PositionType.Leverage,
141
142
  positionData: {
142
143
  positionId: this.positionId,
143
144
  settingParams: settingParams ?? null,
@@ -7,12 +7,13 @@
7
7
  */
8
8
  import { Account, Context, Pda, PublicKey, RpcAccount, RpcGetAccountOptions, RpcGetAccountsOptions } from '@metaplex-foundation/umi';
9
9
  import { Serializer } from '@metaplex-foundation/umi/serializers';
10
- import { PodBool, PodBoolArgs, PositionData, PositionDataArgs, PositionState, PositionStateArgs, RebalanceData, RebalanceDataArgs } from '../types';
10
+ import { PodBool, PodBoolArgs, PositionData, PositionDataArgs, PositionState, PositionStateArgs, PositionType, PositionTypeArgs, RebalanceData, RebalanceDataArgs } from '../types';
11
11
  export type SolautoPosition = Account<SolautoPositionAccountData>;
12
12
  export type SolautoPositionAccountData = {
13
13
  bump: Array<number>;
14
14
  positionId: Array<number>;
15
15
  selfManaged: PodBool;
16
+ positionType: PositionType;
16
17
  padding1: Array<number>;
17
18
  authority: PublicKey;
18
19
  position: PositionData;
@@ -24,6 +25,7 @@ export type SolautoPositionAccountDataArgs = {
24
25
  bump: Array<number>;
25
26
  positionId: Array<number>;
26
27
  selfManaged: PodBoolArgs;
28
+ positionType: PositionTypeArgs;
27
29
  padding1: Array<number>;
28
30
  authority: PublicKey;
29
31
  position: PositionDataArgs;
@@ -41,6 +43,7 @@ export declare function getSolautoPositionGpaBuilder(context: Pick<Context, 'rpc
41
43
  bump: Array<number>;
42
44
  positionId: Array<number>;
43
45
  selfManaged: PodBoolArgs;
46
+ positionType: PositionTypeArgs;
44
47
  padding1: Array<number>;
45
48
  authority: PublicKey;
46
49
  position: PositionDataArgs;
@@ -1 +1 @@
1
- {"version":3,"file":"solautoPosition.d.ts","sourceRoot":"","sources":["../../../src/generated/accounts/solautoPosition.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,OAAO,EACP,GAAG,EACH,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,qBAAqB,EAKtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAMX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,OAAO,EACP,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EAKlB,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,eAAe,GAAG,O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C7B,SAAS,EAAE,SAAS,GAAG,GAAG,EAC1B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAMjC;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,EAC7B,UAAU,EAAE,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,EAClC,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,eAAe,EAAE,CAAC,CAS5B;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,EAC7B,UAAU,EAAE,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,EAClC,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,eAAe,EAAE,CAAC,CAU5B;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,UAAU,CAAC;UAQhC,KAAK,CAAC,MAAM,CAAC;gBACP,KAAK,CAAC,MAAM,CAAC;iBACZ,WAAW;cACd,KAAK,CAAC,MAAM,CAAC;eACZ,SAAS;cACV,gBAAgB;WACnB,iBAAiB;eACb,iBAAiB;aACnB,KAAK,CAAC,MAAM,CAAC;GAe3B;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C"}
1
+ {"version":3,"file":"solautoPosition.d.ts","sourceRoot":"","sources":["../../../src/generated/accounts/solautoPosition.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,OAAO,EACP,GAAG,EACH,SAAS,EACT,UAAU,EACV,oBAAoB,EACpB,qBAAqB,EAKtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAMX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,OAAO,EACP,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,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AAS,GAAG,GAAG,EAC1B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAO1B;AAED,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,EAC7B,SAAS,EAAE,SAAS,GAAG,GAAG,EAC1B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAMjC;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,EAC7B,UAAU,EAAE,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,EAClC,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,eAAe,EAAE,CAAC,CAS5B;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,EAC7B,UAAU,EAAE,KAAK,CAAC,SAAS,GAAG,GAAG,CAAC,EAClC,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,eAAe,EAAE,CAAC,CAU5B;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,UAAU,CAAC;UAQhC,KAAK,CAAC,MAAM,CAAC;gBACP,KAAK,CAAC,MAAM,CAAC;iBACZ,WAAW;kBACV,gBAAgB;cACpB,KAAK,CAAC,MAAM,CAAC;eACZ,SAAS;cACV,gBAAgB;WACnB,iBAAiB;eACb,iBAAiB;aACnB,KAAK,CAAC,MAAM,CAAC;GAgB3B;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C"}
@@ -23,7 +23,8 @@ function getSolautoPositionAccountDataSerializer() {
23
23
  ['bump', (0, serializers_1.array)((0, serializers_1.u8)(), { size: 1 })],
24
24
  ['positionId', (0, serializers_1.array)((0, serializers_1.u8)(), { size: 1 })],
25
25
  ['selfManaged', (0, types_1.getPodBoolSerializer)()],
26
- ['padding1', (0, serializers_1.array)((0, serializers_1.u8)(), { size: 5 })],
26
+ ['positionType', (0, types_1.getPositionTypeSerializer)()],
27
+ ['padding1', (0, serializers_1.array)((0, serializers_1.u8)(), { size: 4 })],
27
28
  ['authority', (0, serializers_1.publicKey)()],
28
29
  ['position', (0, types_1.getPositionDataSerializer)()],
29
30
  ['state', (0, types_1.getPositionStateSerializer)()],
@@ -63,7 +64,8 @@ function getSolautoPositionGpaBuilder(context) {
63
64
  bump: [0, (0, serializers_1.array)((0, serializers_1.u8)(), { size: 1 })],
64
65
  positionId: [1, (0, serializers_1.array)((0, serializers_1.u8)(), { size: 1 })],
65
66
  selfManaged: [2, (0, types_1.getPodBoolSerializer)()],
66
- padding1: [3, (0, serializers_1.array)((0, serializers_1.u8)(), { size: 5 })],
67
+ positionType: [3, (0, types_1.getPositionTypeSerializer)()],
68
+ padding1: [4, (0, serializers_1.array)((0, serializers_1.u8)(), { size: 4 })],
67
69
  authority: [8, (0, serializers_1.publicKey)()],
68
70
  position: [40, (0, types_1.getPositionDataSerializer)()],
69
71
  state: [360, (0, types_1.getPositionStateSerializer)()],
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { Context, Option, OptionOrNullable, Pda, PublicKey, Signer, TransactionBuilder } from '@metaplex-foundation/umi';
9
9
  import { Serializer } from '@metaplex-foundation/umi/serializers';
10
- import { UpdatePositionData, UpdatePositionDataArgs } from '../types';
10
+ import { PositionType, PositionTypeArgs, UpdatePositionData, UpdatePositionDataArgs } from '../types';
11
11
  export type MarginfiOpenPositionInstructionAccounts = {
12
12
  signer: Signer;
13
13
  marginfiProgram: PublicKey | Pda;
@@ -33,10 +33,12 @@ export type MarginfiOpenPositionInstructionAccounts = {
33
33
  };
34
34
  export type MarginfiOpenPositionInstructionData = {
35
35
  discriminator: number;
36
+ positionType: PositionType;
36
37
  positionData: UpdatePositionData;
37
38
  marginfiAccountSeedIdx: Option<bigint>;
38
39
  };
39
40
  export type MarginfiOpenPositionInstructionDataArgs = {
41
+ positionType: PositionTypeArgs;
40
42
  positionData: UpdatePositionDataArgs;
41
43
  marginfiAccountSeedIdx: OptionOrNullable<number | bigint>;
42
44
  };
@@ -1 +1 @@
1
- {"version":3,"file":"marginfiOpenPosition.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/marginfiOpenPosition.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,MAAM,EACN,gBAAgB,EAChB,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAMX,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EAEvB,MAAM,UAAU,CAAC;AAGlB,MAAM,MAAM,uCAAuC,GAAG;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,UAAU,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC7B,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACvB,iBAAiB,EAAE,SAAS,GAAG,GAAG,CAAC;IACnC,mBAAmB,EAAE,SAAS,GAAG,GAAG,CAAC;IACrC,mBAAmB,EAAE,SAAS,GAAG,GAAG,CAAC;IACrC,eAAe,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAClC,kBAAkB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACrC,eAAe,EAAE,SAAS,GAAG,GAAG,CAAC;IACjC,aAAa,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,eAAe,EAAE,SAAS,GAAG,GAAG,GAAG,MAAM,CAAC;IAC1C,UAAU,EAAE,SAAS,GAAG,GAAG,CAAC;IAC5B,UAAU,EAAE,SAAS,GAAG,GAAG,CAAC;IAC5B,gBAAgB,EAAE,SAAS,GAAG,GAAG,CAAC;IAClC,QAAQ,EAAE,SAAS,GAAG,GAAG,CAAC;IAC1B,QAAQ,EAAE,SAAS,GAAG,GAAG,CAAC;IAC1B,cAAc,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;CAChC,CAAC;AAGF,MAAM,MAAM,mCAAmC,GAAG;IAChD,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,kBAAkB,CAAC;IACjC,sBAAsB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,uCAAuC,GAAG;IACpD,YAAY,EAAE,sBAAsB,CAAC;IACrC,sBAAsB,EAAE,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CAC3D,CAAC;AAEF,wBAAgB,gDAAgD,IAAI,UAAU,CAC5E,uCAAuC,EACvC,mCAAmC,CACpC,CAmBA;AAGD,MAAM,MAAM,mCAAmC,GAC7C,uCAAuC,CAAC;AAG1C,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,KAAK,EAAE,uCAAuC,GAC5C,mCAAmC,GACpC,kBAAkB,CAsKpB"}
1
+ {"version":3,"file":"marginfiOpenPosition.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/marginfiOpenPosition.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,MAAM,EACN,gBAAgB,EAChB,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAMX,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EAGvB,MAAM,UAAU,CAAC;AAGlB,MAAM,MAAM,uCAAuC,GAAG;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E,sBAAsB,CAAC;IACrC,sBAAsB,EAAE,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CAC3D,CAAC;AAEF,wBAAgB,gDAAgD,IAAI,UAAU,CAC5E,uCAAuC,EACvC,mCAAmC,CACpC,CAoBA;AAGD,MAAM,MAAM,mCAAmC,GAC7C,uCAAuC,CAAC;AAG1C,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,KAAK,EAAE,uCAAuC,GAC5C,mCAAmC,GACpC,kBAAkB,CAsKpB"}
@@ -16,6 +16,7 @@ const types_1 = require("../types");
16
16
  function getMarginfiOpenPositionInstructionDataSerializer() {
17
17
  return (0, serializers_1.mapSerializer)((0, serializers_1.struct)([
18
18
  ['discriminator', (0, serializers_1.u8)()],
19
+ ['positionType', (0, types_1.getPositionTypeSerializer)()],
19
20
  ['positionData', (0, types_1.getUpdatePositionDataSerializer)()],
20
21
  ['marginfiAccountSeedIdx', (0, serializers_1.option)((0, serializers_1.u64)())],
21
22
  ], { description: 'MarginfiOpenPositionInstructionData' }), (value) => ({ ...value, discriminator: 6 }));
@@ -14,6 +14,7 @@ export * from './podBool';
14
14
  export * from './positionData';
15
15
  export * from './positionState';
16
16
  export * from './positionTokenUsage';
17
+ export * from './positionType';
17
18
  export * from './rebalanceData';
18
19
  export * from './solautoAction';
19
20
  export * from './solautoRebalanceType';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generated/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generated/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC"}
@@ -30,6 +30,7 @@ __exportStar(require("./podBool"), exports);
30
30
  __exportStar(require("./positionData"), exports);
31
31
  __exportStar(require("./positionState"), exports);
32
32
  __exportStar(require("./positionTokenUsage"), exports);
33
+ __exportStar(require("./positionType"), exports);
33
34
  __exportStar(require("./rebalanceData"), exports);
34
35
  __exportStar(require("./solautoAction"), exports);
35
36
  __exportStar(require("./solautoRebalanceType"), exports);
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the kinobi library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun kinobi to update it.
5
+ *
6
+ * @see https://github.com/metaplex-foundation/kinobi
7
+ */
8
+ import { Serializer } from '@metaplex-foundation/umi/serializers';
9
+ export declare enum PositionType {
10
+ Leverage = 0,
11
+ SafeLoan = 1
12
+ }
13
+ export type PositionTypeArgs = PositionType;
14
+ export declare function getPositionTypeSerializer(): Serializer<PositionTypeArgs, PositionType>;
15
+ //# sourceMappingURL=positionType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"positionType.d.ts","sourceRoot":"","sources":["../../../src/generated/types/positionType.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAc,MAAM,sCAAsC,CAAC;AAE9E,oBAAY,YAAY;IACtB,QAAQ,IAAA;IACR,QAAQ,IAAA;CACT;AAED,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAE5C,wBAAgB,yBAAyB,IAAI,UAAU,CACrD,gBAAgB,EAChB,YAAY,CACb,CAIA"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the kinobi library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun kinobi to update it.
6
+ *
7
+ * @see https://github.com/metaplex-foundation/kinobi
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.PositionType = void 0;
11
+ exports.getPositionTypeSerializer = getPositionTypeSerializer;
12
+ const serializers_1 = require("@metaplex-foundation/umi/serializers");
13
+ var PositionType;
14
+ (function (PositionType) {
15
+ PositionType[PositionType["Leverage"] = 0] = "Leverage";
16
+ PositionType[PositionType["SafeLoan"] = 1] = "SafeLoan";
17
+ })(PositionType || (exports.PositionType = PositionType = {}));
18
+ function getPositionTypeSerializer() {
19
+ return (0, serializers_1.scalarEnum)(PositionType, {
20
+ description: 'PositionType',
21
+ });
22
+ }
@@ -1,9 +1,10 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
- import { LendingPlatform } from "../generated";
2
+ import { LendingPlatform, PositionType } from "../generated";
3
3
  export interface SolautoPositionDetails {
4
4
  publicKey?: PublicKey;
5
5
  authority: PublicKey;
6
6
  positionId: number;
7
+ positionType: PositionType;
7
8
  lendingPlatform: LendingPlatform;
8
9
  protocolAccount?: PublicKey;
9
10
  supplyMint?: PublicKey;
@@ -1 +1 @@
1
- {"version":3,"file":"solauto.d.ts","sourceRoot":"","sources":["../../src/types/solauto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,eAAe,CAAC;IACjC,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,oBAAY,kBAAkB;IAC5B,OAAO,WAAW;IAClB,IAAI,SAAS;CACd;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;AAExD,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG,eAAe,GAAG,QAAQ,CAAC"}
1
+ {"version":3,"file":"solauto.d.ts","sourceRoot":"","sources":["../../src/types/solauto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE7D,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,eAAe,EAAE,eAAe,CAAC;IACjC,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,oBAAY,kBAAkB;IAC5B,OAAO,WAAW;IAClB,IAAI,SAAS;CACd;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;AAExD,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG,eAAe,GAAG,QAAQ,CAAC"}
@@ -2,7 +2,7 @@ import { AddressLookupTableInput, Signer, TransactionBuilder, Umi, WrappedInstru
2
2
  import { Connection, PublicKey, TransactionInstruction } from "@solana/web3.js";
3
3
  import { PriorityFeeSetting, TransactionRunType } from "../types";
4
4
  export declare function buildHeliusApiUrl(heliusApiKey: string): string;
5
- export declare function getSolanaRpcConnection(heliusApiUrl: string): [Connection, Umi];
5
+ export declare function getSolanaRpcConnection(rpcUrl: string): [Connection, Umi];
6
6
  export declare function getWrappedInstruction(signer: Signer, ix: TransactionInstruction): WrappedInstruction;
7
7
  export declare function setComputeUnitLimitUmiIx(signer: Signer, maxComputeUnits: number): WrappedInstruction;
8
8
  export declare function setComputeUnitPriceUmiIx(signer: Signer, lamports: number): WrappedInstruction;
@@ -1 +1 @@
1
- {"version":3,"file":"solanaUtils.d.ts","sourceRoot":"","sources":["../../src/utils/solanaUtils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EACvB,MAAM,EACN,kBAAkB,EAClB,GAAG,EACH,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAGL,UAAU,EACV,SAAS,EAIT,sBAAsB,EAEvB,MAAM,iBAAiB,CAAC;AAYzB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAElE,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,UAErD;AAED,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,GACnB,CAAC,UAAU,EAAE,GAAG,CAAC,CAInB;AAED,wBAAgB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AY,EAAE,SAAS,EACvB,SAAS,EAAE,SAAS,GACnB,kBAAkB,CAKpB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,GACb,kBAAkB,CAKpB;AAED,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,GAAG,EACR,oBAAoB,EAAE,MAAM,EAAE,GAC7B,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAkBpC;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,kBAAkB,EACtB,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,CAAC,EAAE,MAAM,sBA4D1B;AAmBD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,kBAAkB,EACtB,eAAe,EAAE,kBAAkB,GAClC,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED,wBAAsB,8BAA8B,CAClD,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,kBAAkB,EACtB,MAAM,CAAC,EAAE,kBAAkB,EAC3B,UAAU,CAAC,EAAE,MAAM,EACnB,eAAe,GAAE,kBAA+C,EAChE,cAAc,CAAC,EAAE,MAAM,IAAI,GAC1B,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CA8DjC"}
@@ -29,8 +29,8 @@ const types_1 = require("../types");
29
29
  function buildHeliusApiUrl(heliusApiKey) {
30
30
  return `https://mainnet.helius-rpc.com/?api-key=${heliusApiKey}`;
31
31
  }
32
- function getSolanaRpcConnection(heliusApiUrl) {
33
- const connection = new web3_js_1.Connection(heliusApiUrl, "confirmed");
32
+ function getSolanaRpcConnection(rpcUrl) {
33
+ const connection = new web3_js_1.Connection(rpcUrl, "confirmed");
34
34
  const umi = (0, umi_bundle_defaults_1.createUmi)(connection);
35
35
  return [connection, umi];
36
36
  }
@@ -1,6 +1,6 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
2
  import { Umi } from "@metaplex-foundation/umi";
3
- import { AutomationSettings, DCASettings, DCASettingsInpArgs, PositionState, SolautoSettingsParameters, SolautoSettingsParametersInpArgs, TokenType } from "../../generated";
3
+ import { AutomationSettings, DCASettings, DCASettingsInpArgs, PositionState, PositionType, SolautoSettingsParameters, SolautoSettingsParametersInpArgs, TokenType } from "../../generated";
4
4
  import { RebalanceAction, SolautoPositionDetails } from "../../types/solauto";
5
5
  export declare function findMintByTicker(ticker: string): PublicKey;
6
6
  export declare function nextAutomationPeriodTimestamp(automation: AutomationSettings): number;
@@ -9,10 +9,10 @@ export declare function getUpdatedValueFromAutomation(currValue: number, targetV
9
9
  export declare function getAdjustedSettingsFromAutomation(settings: SolautoSettingsParameters, currentUnixTime: number): SolautoSettingsParameters;
10
10
  export declare function eligibleForRebalance(positionState: PositionState, positionSettings: SolautoSettingsParameters, positionDca: DCASettings | undefined, currentUnixTime: number, bpsDistanceThreshold?: number): RebalanceAction | undefined;
11
11
  export declare function eligibleForRefresh(positionState: PositionState, positionSettings: SolautoSettingsParameters, currentUnixTime: number): boolean;
12
- export declare function getSolautoManagedPositions(umi: Umi, authority?: PublicKey): Promise<SolautoPositionDetails[]>;
12
+ export declare function getSolautoManagedPositions(umi: Umi, authority?: PublicKey, positionTypeFilter?: PositionType): Promise<SolautoPositionDetails[]>;
13
13
  export declare function getAllReferralStates(umi: Umi): Promise<PublicKey[]>;
14
14
  export declare function getReferralsByUser(umi: Umi, user: PublicKey): Promise<PublicKey[]>;
15
- export declare function getAllPositionsByAuthority(umi: Umi, user: PublicKey): Promise<SolautoPositionDetails[]>;
15
+ export declare function getAllPositionsByAuthority(umi: Umi, user: PublicKey, positionTypeFilter?: PositionType): Promise<SolautoPositionDetails[]>;
16
16
  export declare function positionStateWithLatestPrices(state: PositionState, supplyPrice?: number, debtPrice?: number): Promise<PositionState>;
17
17
  interface AssetProps {
18
18
  mint: PublicKey;
@@ -1 +1 @@
1
- {"version":3,"file":"generalUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/solauto/generalUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAA+B,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAElB,aAAa,EAEb,yBAAyB,EACzB,gCAAgC,EAChC,SAAS,EAIV,MAAM,iBAAiB,CAAC;AAezB,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE9E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAW1D;AAgBD,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,kBAAkB,GAC7B,MAAM,CAKR;AAED,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,kBAAkB,EAC9B,eAAe,EAAE,MAAM,GACtB,OAAO,CAET;AAED,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,kBAAkB,EAC9B,oBAAoB,EAAE,MAAM,UAY7B;AAED,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,yBAAyB,EACnC,eAAe,EAAE,MAAM,GACtB,yBAAyB,CAgB3B;AAED,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,yBAAyB,EAC3C,WAAW,EAAE,WAAW,GAAG,SAAS,EACpC,eAAe,EAAE,MAAM,EACvB,oBAAoB,SAAI,GACvB,eAAe,GAAG,SAAS,CAiC7B;AAED,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,yBAAyB,EAC3C,eAAe,EAAE,MAAM,GACtB,OAAO,CAYT;AAED,wBAAsB,0BAA0B,CAC9C,GAAG,EAAE,GAAG,EACR,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olautoManagedPositions(umi, authority) {
101
+ async function getSolautoManagedPositions(umi, authority, positionTypeFilter) {
102
102
  // bump: [u8; 1]
103
103
  // position_id: [u8; 1]
104
104
  // self_managed: u8 - (1 for true, 0 for false)
105
- // padding: [u8; 5]
105
+ // position_type: PositionType
106
+ // padding: [u8; 4]
106
107
  // authority: pubkey
107
108
  // lending_platform: u8
108
109
  // padding: [u8; 7]
@@ -113,7 +114,7 @@ async function getSolautoManagedPositions(umi, authority) {
113
114
  commitment: "confirmed",
114
115
  dataSlice: {
115
116
  offset: 0,
116
- length: 1 + 1 + 1 + 5 + 32 + 1 + 7 + 32 + 32 + 32, // bump + position_id + self_managed + padding (5) + authority (pubkey) + lending_platform + padding (7) + protocol account (pubkey) + supply mint (pubkey) + debt mint (pubkey)
117
+ length: 1 + 1 + 1 + 1 + 4 + 32 + 1 + 7 + 32 + 32 + 32, // bump + position_id + self_managed + position_type + padding (4) + authority (pubkey) + lending_platform + padding (7) + protocol account (pubkey) + supply mint (pubkey) + debt mint (pubkey)
117
118
  },
118
119
  filters: [
119
120
  {
@@ -135,6 +136,14 @@ async function getSolautoManagedPositions(umi, authority) {
135
136
  },
136
137
  ]
137
138
  : []),
139
+ ...(positionTypeFilter !== undefined ? [
140
+ {
141
+ memcmp: {
142
+ bytes: new Uint8Array(positionTypeFilter),
143
+ offset: 3
144
+ }
145
+ }
146
+ ] : [])
138
147
  ],
139
148
  });
140
149
  return accounts.map((x) => {
@@ -147,6 +156,7 @@ async function getSolautoManagedPositions(umi, authority) {
147
156
  authority: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.authority),
148
157
  positionId: position.positionId[0],
149
158
  lendingPlatform: position.position.lendingPlatform,
159
+ positionType: position.positionType,
150
160
  protocolAccount: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.position.protocolAccount),
151
161
  supplyMint: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.position.supplyMint),
152
162
  debtMint: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.position.debtMint),
@@ -194,16 +204,19 @@ async function getReferralsByUser(umi, user) {
194
204
  });
195
205
  return accounts.map((x) => (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(x.publicKey));
196
206
  }
197
- async function getAllPositionsByAuthority(umi, user) {
207
+ async function getAllPositionsByAuthority(umi, user, positionTypeFilter) {
198
208
  const solautoCompatiblePositions = await Promise.all([
199
209
  (async () => {
200
- const solautoManagedPositions = await getSolautoManagedPositions(umi, user);
210
+ const solautoManagedPositions = await getSolautoManagedPositions(umi, user, positionTypeFilter);
201
211
  return solautoManagedPositions.map((x) => ({
202
212
  ...x,
203
213
  authority: user,
204
214
  }));
205
215
  })(),
206
216
  (async () => {
217
+ if (positionTypeFilter === generated_1.PositionType.SafeLoan) {
218
+ return [];
219
+ }
207
220
  let marginfiPositions = await (0, marginfiUtils_1.getAllMarginfiAccountsByAuthority)(umi, user, true);
208
221
  marginfiPositions = marginfiPositions.filter((x) => x.supplyMint &&
209
222
  (x.debtMint.equals(web3_js_1.PublicKey.default) ||
@@ -212,6 +225,7 @@ async function getAllPositionsByAuthority(umi, user) {
212
225
  publicKey: x.marginfiAccount,
213
226
  authority: user,
214
227
  positionId: 0,
228
+ positionType: generated_1.PositionType.Leverage,
215
229
  lendingPlatform: generated_1.LendingPlatform.Marginfi,
216
230
  protocolAccount: x.marginfiAccount,
217
231
  supplyMint: x.supplyMint,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haven-fi/solauto-sdk",
3
- "version": "1.0.147",
3
+ "version": "1.0.148",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "description": "Typescript SDK for the Solauto program on the Solana blockchain",
@@ -23,6 +23,7 @@ import {
23
23
  DCASettingsInpArgs,
24
24
  LendingPlatform,
25
25
  PositionState,
26
+ PositionType,
26
27
  SolautoActionArgs,
27
28
  SolautoRebalanceTypeArgs,
28
29
  SolautoSettingsParametersInpArgs,
@@ -232,7 +233,8 @@ export class SolautoMarginfiClient extends SolautoClient {
232
233
 
233
234
  private marginfiOpenPositionIx(
234
235
  settingParams?: SolautoSettingsParametersInpArgs,
235
- dca?: DCASettingsInpArgs
236
+ dca?: DCASettingsInpArgs,
237
+ positionType?: PositionType
236
238
  ): TransactionBuilder {
237
239
  let signerDebtTa: UmiPublicKey | undefined = undefined;
238
240
  if (dca) {
@@ -264,6 +266,7 @@ export class SolautoMarginfiClient extends SolautoClient {
264
266
  debtBank: publicKey(this.marginfiDebtAccounts.bank),
265
267
  positionDebtTa: publicKey(this.positionDebtTa),
266
268
  signerDebtTa: signerDebtTa,
269
+ positionType: positionType ?? PositionType.Leverage,
267
270
  positionData: {
268
271
  positionId: this.positionId!,
269
272
  settingParams: settingParams ?? null,
@@ -34,11 +34,14 @@ import {
34
34
  PositionDataArgs,
35
35
  PositionState,
36
36
  PositionStateArgs,
37
+ PositionType,
38
+ PositionTypeArgs,
37
39
  RebalanceData,
38
40
  RebalanceDataArgs,
39
41
  getPodBoolSerializer,
40
42
  getPositionDataSerializer,
41
43
  getPositionStateSerializer,
44
+ getPositionTypeSerializer,
42
45
  getRebalanceDataSerializer,
43
46
  } from '../types';
44
47
 
@@ -48,6 +51,7 @@ export type SolautoPositionAccountData = {
48
51
  bump: Array<number>;
49
52
  positionId: Array<number>;
50
53
  selfManaged: PodBool;
54
+ positionType: PositionType;
51
55
  padding1: Array<number>;
52
56
  authority: PublicKey;
53
57
  position: PositionData;
@@ -60,6 +64,7 @@ export type SolautoPositionAccountDataArgs = {
60
64
  bump: Array<number>;
61
65
  positionId: Array<number>;
62
66
  selfManaged: PodBoolArgs;
67
+ positionType: PositionTypeArgs;
63
68
  padding1: Array<number>;
64
69
  authority: PublicKey;
65
70
  position: PositionDataArgs;
@@ -77,7 +82,8 @@ export function getSolautoPositionAccountDataSerializer(): Serializer<
77
82
  ['bump', array(u8(), { size: 1 })],
78
83
  ['positionId', array(u8(), { size: 1 })],
79
84
  ['selfManaged', getPodBoolSerializer()],
80
- ['padding1', array(u8(), { size: 5 })],
85
+ ['positionType', getPositionTypeSerializer()],
86
+ ['padding1', array(u8(), { size: 4 })],
81
87
  ['authority', publicKeySerializer()],
82
88
  ['position', getPositionDataSerializer()],
83
89
  ['state', getPositionStateSerializer()],
@@ -165,6 +171,7 @@ export function getSolautoPositionGpaBuilder(
165
171
  bump: Array<number>;
166
172
  positionId: Array<number>;
167
173
  selfManaged: PodBoolArgs;
174
+ positionType: PositionTypeArgs;
168
175
  padding1: Array<number>;
169
176
  authority: PublicKey;
170
177
  position: PositionDataArgs;
@@ -175,7 +182,8 @@ export function getSolautoPositionGpaBuilder(
175
182
  bump: [0, array(u8(), { size: 1 })],
176
183
  positionId: [1, array(u8(), { size: 1 })],
177
184
  selfManaged: [2, getPodBoolSerializer()],
178
- padding1: [3, array(u8(), { size: 5 })],
185
+ positionType: [3, getPositionTypeSerializer()],
186
+ padding1: [4, array(u8(), { size: 4 })],
179
187
  authority: [8, publicKeySerializer()],
180
188
  position: [40, getPositionDataSerializer()],
181
189
  state: [360, getPositionStateSerializer()],
@@ -31,8 +31,11 @@ import {
31
31
  getAccountMetasAndSigners,
32
32
  } from '../shared';
33
33
  import {
34
+ PositionType,
35
+ PositionTypeArgs,
34
36
  UpdatePositionData,
35
37
  UpdatePositionDataArgs,
38
+ getPositionTypeSerializer,
36
39
  getUpdatePositionDataSerializer,
37
40
  } from '../types';
38
41
 
@@ -64,11 +67,13 @@ export type MarginfiOpenPositionInstructionAccounts = {
64
67
  // Data.
65
68
  export type MarginfiOpenPositionInstructionData = {
66
69
  discriminator: number;
70
+ positionType: PositionType;
67
71
  positionData: UpdatePositionData;
68
72
  marginfiAccountSeedIdx: Option<bigint>;
69
73
  };
70
74
 
71
75
  export type MarginfiOpenPositionInstructionDataArgs = {
76
+ positionType: PositionTypeArgs;
72
77
  positionData: UpdatePositionDataArgs;
73
78
  marginfiAccountSeedIdx: OptionOrNullable<number | bigint>;
74
79
  };
@@ -85,6 +90,7 @@ export function getMarginfiOpenPositionInstructionDataSerializer(): Serializer<
85
90
  struct<MarginfiOpenPositionInstructionData>(
86
91
  [
87
92
  ['discriminator', u8()],
93
+ ['positionType', getPositionTypeSerializer()],
88
94
  ['positionData', getUpdatePositionDataSerializer()],
89
95
  ['marginfiAccountSeedIdx', option(u64())],
90
96
  ],
@@ -15,6 +15,7 @@ export * from './podBool';
15
15
  export * from './positionData';
16
16
  export * from './positionState';
17
17
  export * from './positionTokenUsage';
18
+ export * from './positionType';
18
19
  export * from './rebalanceData';
19
20
  export * from './solautoAction';
20
21
  export * from './solautoRebalanceType';
@@ -0,0 +1,25 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the kinobi library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun kinobi to update it.
5
+ *
6
+ * @see https://github.com/metaplex-foundation/kinobi
7
+ */
8
+
9
+ import { Serializer, scalarEnum } from '@metaplex-foundation/umi/serializers';
10
+
11
+ export enum PositionType {
12
+ Leverage,
13
+ SafeLoan,
14
+ }
15
+
16
+ export type PositionTypeArgs = PositionType;
17
+
18
+ export function getPositionTypeSerializer(): Serializer<
19
+ PositionTypeArgs,
20
+ PositionType
21
+ > {
22
+ return scalarEnum<PositionType>(PositionType, {
23
+ description: 'PositionType',
24
+ }) as Serializer<PositionTypeArgs, PositionType>;
25
+ }
@@ -1,10 +1,11 @@
1
1
  import { PublicKey } from "@solana/web3.js";
2
- import { LendingPlatform } from "../generated";
2
+ import { LendingPlatform, PositionType } from "../generated";
3
3
 
4
4
  export interface SolautoPositionDetails {
5
5
  publicKey?: PublicKey;
6
6
  authority: PublicKey;
7
7
  positionId: number;
8
+ positionType: PositionType;
8
9
  lendingPlatform: LendingPlatform;
9
10
  protocolAccount?: PublicKey;
10
11
  supplyMint?: PublicKey;
@@ -43,9 +43,9 @@ export function buildHeliusApiUrl(heliusApiKey: string) {
43
43
  }
44
44
 
45
45
  export function getSolanaRpcConnection(
46
- heliusApiUrl: string
46
+ rpcUrl: string
47
47
  ): [Connection, Umi] {
48
- const connection = new Connection(heliusApiUrl, "confirmed");
48
+ const connection = new Connection(rpcUrl, "confirmed");
49
49
  const umi = createUmi(connection);
50
50
  return [connection, umi];
51
51
  }
@@ -6,6 +6,7 @@ import {
6
6
  DCASettingsInpArgs,
7
7
  LendingPlatform,
8
8
  PositionState,
9
+ PositionType,
9
10
  SOLAUTO_PROGRAM_ID,
10
11
  SolautoSettingsParameters,
11
12
  SolautoSettingsParametersInpArgs,
@@ -173,12 +174,14 @@ export function eligibleForRefresh(
173
174
 
174
175
  export async function getSolautoManagedPositions(
175
176
  umi: Umi,
176
- authority?: PublicKey
177
+ authority?: PublicKey,
178
+ positionTypeFilter?: PositionType
177
179
  ): Promise<SolautoPositionDetails[]> {
178
180
  // bump: [u8; 1]
179
181
  // position_id: [u8; 1]
180
182
  // self_managed: u8 - (1 for true, 0 for false)
181
- // padding: [u8; 5]
183
+ // position_type: PositionType
184
+ // padding: [u8; 4]
182
185
  // authority: pubkey
183
186
  // lending_platform: u8
184
187
  // padding: [u8; 7]
@@ -190,7 +193,7 @@ export async function getSolautoManagedPositions(
190
193
  commitment: "confirmed",
191
194
  dataSlice: {
192
195
  offset: 0,
193
- length: 1 + 1 + 1 + 5 + 32 + 1 + 7 + 32 + 32 + 32, // bump + position_id + self_managed + padding (5) + authority (pubkey) + lending_platform + padding (7) + protocol account (pubkey) + supply mint (pubkey) + debt mint (pubkey)
196
+ length: 1 + 1 + 1 + 1 + 4 + 32 + 1 + 7 + 32 + 32 + 32, // bump + position_id + self_managed + position_type + padding (4) + authority (pubkey) + lending_platform + padding (7) + protocol account (pubkey) + supply mint (pubkey) + debt mint (pubkey)
194
197
  },
195
198
  filters: [
196
199
  {
@@ -212,6 +215,14 @@ export async function getSolautoManagedPositions(
212
215
  },
213
216
  ]
214
217
  : []),
218
+ ...(positionTypeFilter !== undefined ? [
219
+ {
220
+ memcmp: {
221
+ bytes: new Uint8Array(positionTypeFilter),
222
+ offset: 3
223
+ }
224
+ }
225
+ ] : [])
215
226
  ],
216
227
  });
217
228
 
@@ -227,6 +238,7 @@ export async function getSolautoManagedPositions(
227
238
  authority: toWeb3JsPublicKey(position.authority),
228
239
  positionId: position.positionId[0],
229
240
  lendingPlatform: position.position.lendingPlatform,
241
+ positionType: position.positionType,
230
242
  protocolAccount: toWeb3JsPublicKey(position.position.protocolAccount),
231
243
  supplyMint: toWeb3JsPublicKey(position.position.supplyMint),
232
244
  debtMint: toWeb3JsPublicKey(position.position.debtMint),
@@ -285,14 +297,16 @@ export async function getReferralsByUser(
285
297
 
286
298
  export async function getAllPositionsByAuthority(
287
299
  umi: Umi,
288
- user: PublicKey
300
+ user: PublicKey,
301
+ positionTypeFilter?: PositionType
289
302
  ): Promise<SolautoPositionDetails[]> {
290
303
  const solautoCompatiblePositions: SolautoPositionDetails[][] =
291
304
  await Promise.all([
292
305
  (async () => {
293
306
  const solautoManagedPositions = await getSolautoManagedPositions(
294
307
  umi,
295
- user
308
+ user,
309
+ positionTypeFilter
296
310
  );
297
311
  return solautoManagedPositions.map((x) => ({
298
312
  ...x,
@@ -300,6 +314,10 @@ export async function getAllPositionsByAuthority(
300
314
  }));
301
315
  })(),
302
316
  (async () => {
317
+ if (positionTypeFilter === PositionType.SafeLoan) {
318
+ return [];
319
+ }
320
+
303
321
  let marginfiPositions = await getAllMarginfiAccountsByAuthority(
304
322
  umi,
305
323
  user,
@@ -315,6 +333,7 @@ export async function getAllPositionsByAuthority(
315
333
  publicKey: x.marginfiAccount,
316
334
  authority: user,
317
335
  positionId: 0,
336
+ positionType: PositionType.Leverage,
318
337
  lendingPlatform: LendingPlatform.Marginfi,
319
338
  protocolAccount: x.marginfiAccount,
320
339
  supplyMint: x.supplyMint,