@haven-fi/solauto-sdk 1.0.648 → 1.0.649
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/README.md +0 -1
- package/dist/generated/types/positionData.d.ts +6 -6
- package/dist/generated/types/positionData.d.ts.map +1 -1
- package/dist/generated/types/positionData.js +3 -3
- package/dist/idls/switchboard.json +1949 -1
- package/dist/pyth-sdk/accounts/index.d.ts +9 -0
- package/dist/pyth-sdk/accounts/index.d.ts.map +1 -0
- package/dist/pyth-sdk/accounts/index.js +24 -0
- package/dist/pyth-sdk/accounts/priceUpdateV2Account.d.ts +39 -0
- package/dist/pyth-sdk/accounts/priceUpdateV2Account.d.ts.map +1 -0
- package/dist/pyth-sdk/accounts/priceUpdateV2Account.js +75 -0
- package/dist/pyth-sdk/index.d.ts +10 -0
- package/dist/pyth-sdk/index.d.ts.map +1 -0
- package/dist/pyth-sdk/index.js +25 -0
- package/dist/pyth-sdk/types/index.d.ts +10 -0
- package/dist/pyth-sdk/types/index.d.ts.map +1 -0
- package/dist/pyth-sdk/types/index.js +25 -0
- package/dist/pyth-sdk/types/priceMessage.d.ts +31 -0
- package/dist/pyth-sdk/types/priceMessage.d.ts.map +1 -0
- package/dist/pyth-sdk/types/priceMessage.js +23 -0
- package/dist/pyth-sdk/types/priceUpdateV2.d.ts +24 -0
- package/dist/pyth-sdk/types/priceUpdateV2.d.ts.map +1 -0
- package/dist/pyth-sdk/types/priceUpdateV2.js +20 -0
- package/dist/services/solauto/solautoClient.d.ts +0 -1
- package/dist/services/solauto/solautoClient.d.ts.map +1 -1
- package/dist/solautoPosition/solautoPositionEx.d.ts.map +1 -1
- package/dist/solautoPosition/solautoPositionEx.js +2 -2
- package/dist/utils/pythUtils.d.ts +0 -16
- package/dist/utils/pythUtils.d.ts.map +1 -1
- package/dist/utils/pythUtils.js +3 -52
- package/dist/utils/solautoUtils.js +3 -3
- package/package.json +1 -2
- package/src/generated/types/positionData.ts +9 -9
- package/src/idls/switchboard.json +1949 -1
- package/src/pyth-sdk/accounts/index.ts +9 -0
- package/src/pyth-sdk/accounts/priceUpdateV2Account.ts +179 -0
- package/src/pyth-sdk/index.ts +10 -0
- package/src/pyth-sdk/types/index.ts +10 -0
- package/src/pyth-sdk/types/priceMessage.ts +58 -0
- package/src/pyth-sdk/types/priceUpdateV2.ts +46 -0
- package/src/services/solauto/solautoClient.ts +0 -1
- package/src/solautoPosition/solautoPositionEx.ts +5 -4
- package/src/utils/pythUtils.ts +7 -54
- package/src/utils/solautoUtils.ts +3 -3
- package/tests/unit/rebalanceCalculations.ts +4 -4
@@ -0,0 +1,9 @@
|
|
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
|
+
export * from './priceUpdateV2Account';
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pyth-sdk/accounts/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,wBAAwB,CAAC"}
|
@@ -0,0 +1,24 @@
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
14
|
+
}
|
15
|
+
Object.defineProperty(o, k2, desc);
|
16
|
+
}) : (function(o, m, k, k2) {
|
17
|
+
if (k2 === undefined) k2 = k;
|
18
|
+
o[k2] = m[k];
|
19
|
+
}));
|
20
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
21
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
22
|
+
};
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
24
|
+
__exportStar(require("./priceUpdateV2Account"), exports);
|
@@ -0,0 +1,39 @@
|
|
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 { Account, Context, Pda, PublicKey, RpcAccount, RpcGetAccountOptions, RpcGetAccountsOptions } from '@metaplex-foundation/umi';
|
9
|
+
import { Serializer } from '@metaplex-foundation/umi/serializers';
|
10
|
+
import { PriceMessage, PriceMessageArgs } from '../types';
|
11
|
+
export type PriceUpdateV2Account = Account<PriceUpdateV2AccountAccountData>;
|
12
|
+
export type PriceUpdateV2AccountAccountData = {
|
13
|
+
discriminator: Array<number>;
|
14
|
+
writeAuthority: PublicKey;
|
15
|
+
verificationLevel: number;
|
16
|
+
priceMessage: PriceMessage;
|
17
|
+
postedSlot: bigint;
|
18
|
+
};
|
19
|
+
export type PriceUpdateV2AccountAccountDataArgs = {
|
20
|
+
writeAuthority: PublicKey;
|
21
|
+
verificationLevel: number;
|
22
|
+
priceMessage: PriceMessageArgs;
|
23
|
+
postedSlot: number | bigint;
|
24
|
+
};
|
25
|
+
export declare function getPriceUpdateV2AccountAccountDataSerializer(): Serializer<PriceUpdateV2AccountAccountDataArgs, PriceUpdateV2AccountAccountData>;
|
26
|
+
export declare function deserializePriceUpdateV2Account(rawAccount: RpcAccount): PriceUpdateV2Account;
|
27
|
+
export declare function fetchPriceUpdateV2Account(context: Pick<Context, 'rpc'>, publicKey: PublicKey | Pda, options?: RpcGetAccountOptions): Promise<PriceUpdateV2Account>;
|
28
|
+
export declare function safeFetchPriceUpdateV2Account(context: Pick<Context, 'rpc'>, publicKey: PublicKey | Pda, options?: RpcGetAccountOptions): Promise<PriceUpdateV2Account | null>;
|
29
|
+
export declare function fetchAllPriceUpdateV2Account(context: Pick<Context, 'rpc'>, publicKeys: Array<PublicKey | Pda>, options?: RpcGetAccountsOptions): Promise<PriceUpdateV2Account[]>;
|
30
|
+
export declare function safeFetchAllPriceUpdateV2Account(context: Pick<Context, 'rpc'>, publicKeys: Array<PublicKey | Pda>, options?: RpcGetAccountsOptions): Promise<PriceUpdateV2Account[]>;
|
31
|
+
export declare function getPriceUpdateV2AccountGpaBuilder(context: Pick<Context, 'rpc' | 'programs'>): import("@metaplex-foundation/umi").GpaBuilder<PriceUpdateV2Account, {
|
32
|
+
discriminator: Array<number>;
|
33
|
+
writeAuthority: PublicKey;
|
34
|
+
verificationLevel: number;
|
35
|
+
priceMessage: PriceMessageArgs;
|
36
|
+
postedSlot: number | bigint;
|
37
|
+
}>;
|
38
|
+
export declare function getPriceUpdateV2AccountSize(): number;
|
39
|
+
//# sourceMappingURL=priceUpdateV2Account.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"priceUpdateV2Account.d.ts","sourceRoot":"","sources":["../../../src/pyth-sdk/accounts/priceUpdateV2Account.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,EAOX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,YAAY,EACZ,gBAAgB,EAEjB,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jC;AAED,wBAAsB,gCAAgC,CACpD,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,oBAAoB,EAAE,CAAC,CAUjC;AAED,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,UAAU,CAAC;mBAQvB,KAAK,CAAC,MAAM,CAAC;oBACZ,SAAS;uBACN,MAAM;kBACX,gBAAgB;gBAClB,MAAM,GAAG,MAAM;GAYhC;AAED,wBAAgB,2BAA2B,IAAI,MAAM,CAEpD"}
|
@@ -0,0 +1,75 @@
|
|
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.getPriceUpdateV2AccountAccountDataSerializer = getPriceUpdateV2AccountAccountDataSerializer;
|
11
|
+
exports.deserializePriceUpdateV2Account = deserializePriceUpdateV2Account;
|
12
|
+
exports.fetchPriceUpdateV2Account = fetchPriceUpdateV2Account;
|
13
|
+
exports.safeFetchPriceUpdateV2Account = safeFetchPriceUpdateV2Account;
|
14
|
+
exports.fetchAllPriceUpdateV2Account = fetchAllPriceUpdateV2Account;
|
15
|
+
exports.safeFetchAllPriceUpdateV2Account = safeFetchAllPriceUpdateV2Account;
|
16
|
+
exports.getPriceUpdateV2AccountGpaBuilder = getPriceUpdateV2AccountGpaBuilder;
|
17
|
+
exports.getPriceUpdateV2AccountSize = getPriceUpdateV2AccountSize;
|
18
|
+
const umi_1 = require("@metaplex-foundation/umi");
|
19
|
+
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
20
|
+
const types_1 = require("../types");
|
21
|
+
function getPriceUpdateV2AccountAccountDataSerializer() {
|
22
|
+
return (0, serializers_1.mapSerializer)((0, serializers_1.struct)([
|
23
|
+
['discriminator', (0, serializers_1.array)((0, serializers_1.u8)(), { size: 8 })],
|
24
|
+
['writeAuthority', (0, serializers_1.publicKey)()],
|
25
|
+
['verificationLevel', (0, serializers_1.u8)()],
|
26
|
+
['priceMessage', (0, types_1.getPriceMessageSerializer)()],
|
27
|
+
['postedSlot', (0, serializers_1.u64)()],
|
28
|
+
], { description: 'PriceUpdateV2AccountAccountData' }), (value) => ({
|
29
|
+
...value,
|
30
|
+
discriminator: [93, 77, 250, 192, 211, 157, 97, 248],
|
31
|
+
}));
|
32
|
+
}
|
33
|
+
function deserializePriceUpdateV2Account(rawAccount) {
|
34
|
+
return (0, umi_1.deserializeAccount)(rawAccount, getPriceUpdateV2AccountAccountDataSerializer());
|
35
|
+
}
|
36
|
+
async function fetchPriceUpdateV2Account(context, publicKey, options) {
|
37
|
+
const maybeAccount = await context.rpc.getAccount((0, umi_1.publicKey)(publicKey, false), options);
|
38
|
+
(0, umi_1.assertAccountExists)(maybeAccount, 'PriceUpdateV2Account');
|
39
|
+
return deserializePriceUpdateV2Account(maybeAccount);
|
40
|
+
}
|
41
|
+
async function safeFetchPriceUpdateV2Account(context, publicKey, options) {
|
42
|
+
const maybeAccount = await context.rpc.getAccount((0, umi_1.publicKey)(publicKey, false), options);
|
43
|
+
return maybeAccount.exists
|
44
|
+
? deserializePriceUpdateV2Account(maybeAccount)
|
45
|
+
: null;
|
46
|
+
}
|
47
|
+
async function fetchAllPriceUpdateV2Account(context, publicKeys, options) {
|
48
|
+
const maybeAccounts = await context.rpc.getAccounts(publicKeys.map((key) => (0, umi_1.publicKey)(key, false)), options);
|
49
|
+
return maybeAccounts.map((maybeAccount) => {
|
50
|
+
(0, umi_1.assertAccountExists)(maybeAccount, 'PriceUpdateV2Account');
|
51
|
+
return deserializePriceUpdateV2Account(maybeAccount);
|
52
|
+
});
|
53
|
+
}
|
54
|
+
async function safeFetchAllPriceUpdateV2Account(context, publicKeys, options) {
|
55
|
+
const maybeAccounts = await context.rpc.getAccounts(publicKeys.map((key) => (0, umi_1.publicKey)(key, false)), options);
|
56
|
+
return maybeAccounts
|
57
|
+
.filter((maybeAccount) => maybeAccount.exists)
|
58
|
+
.map((maybeAccount) => deserializePriceUpdateV2Account(maybeAccount));
|
59
|
+
}
|
60
|
+
function getPriceUpdateV2AccountGpaBuilder(context) {
|
61
|
+
const programId = context.programs.getPublicKey('', 'pythWSnswVUd12oZpeFP8e9CVaEqJg25g1Vtc2biRsT');
|
62
|
+
return (0, umi_1.gpaBuilder)(context, programId)
|
63
|
+
.registerFields({
|
64
|
+
discriminator: [0, (0, serializers_1.array)((0, serializers_1.u8)(), { size: 8 })],
|
65
|
+
writeAuthority: [8, (0, serializers_1.publicKey)()],
|
66
|
+
verificationLevel: [40, (0, serializers_1.u8)()],
|
67
|
+
priceMessage: [41, (0, types_1.getPriceMessageSerializer)()],
|
68
|
+
postedSlot: [125, (0, serializers_1.u64)()],
|
69
|
+
})
|
70
|
+
.deserializeUsing((account) => deserializePriceUpdateV2Account(account))
|
71
|
+
.whereField('discriminator', [93, 77, 250, 192, 211, 157, 97, 248]);
|
72
|
+
}
|
73
|
+
function getPriceUpdateV2AccountSize() {
|
74
|
+
return 133;
|
75
|
+
}
|
@@ -0,0 +1,10 @@
|
|
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
|
+
export * from './accounts';
|
9
|
+
export * from './types';
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pyth-sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
@@ -0,0 +1,25 @@
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
14
|
+
}
|
15
|
+
Object.defineProperty(o, k2, desc);
|
16
|
+
}) : (function(o, m, k, k2) {
|
17
|
+
if (k2 === undefined) k2 = k;
|
18
|
+
o[k2] = m[k];
|
19
|
+
}));
|
20
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
21
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
22
|
+
};
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
24
|
+
__exportStar(require("./accounts"), exports);
|
25
|
+
__exportStar(require("./types"), exports);
|
@@ -0,0 +1,10 @@
|
|
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
|
+
export * from './priceMessage';
|
9
|
+
export * from './priceUpdateV2';
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pyth-sdk/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC"}
|
@@ -0,0 +1,25 @@
|
|
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
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
14
|
+
}
|
15
|
+
Object.defineProperty(o, k2, desc);
|
16
|
+
}) : (function(o, m, k, k2) {
|
17
|
+
if (k2 === undefined) k2 = k;
|
18
|
+
o[k2] = m[k];
|
19
|
+
}));
|
20
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
21
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
22
|
+
};
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
24
|
+
__exportStar(require("./priceMessage"), exports);
|
25
|
+
__exportStar(require("./priceUpdateV2"), exports);
|
@@ -0,0 +1,31 @@
|
|
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 { PublicKey } from '@metaplex-foundation/umi';
|
9
|
+
import { Serializer } from '@metaplex-foundation/umi/serializers';
|
10
|
+
export type PriceMessage = {
|
11
|
+
feedId: PublicKey;
|
12
|
+
price: bigint;
|
13
|
+
conf: bigint;
|
14
|
+
exponent: number;
|
15
|
+
publishTime: bigint;
|
16
|
+
prevPublishTime: bigint;
|
17
|
+
emaPrice: bigint;
|
18
|
+
emaConf: bigint;
|
19
|
+
};
|
20
|
+
export type PriceMessageArgs = {
|
21
|
+
feedId: PublicKey;
|
22
|
+
price: number | bigint;
|
23
|
+
conf: number | bigint;
|
24
|
+
exponent: number;
|
25
|
+
publishTime: number | bigint;
|
26
|
+
prevPublishTime: number | bigint;
|
27
|
+
emaPrice: number | bigint;
|
28
|
+
emaConf: number | bigint;
|
29
|
+
};
|
30
|
+
export declare function getPriceMessageSerializer(): Serializer<PriceMessageArgs, PriceMessage>;
|
31
|
+
//# sourceMappingURL=priceMessage.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"priceMessage.d.ts","sourceRoot":"","sources":["../../../src/pyth-sdk/types/priceMessage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EACL,UAAU,EAMX,MAAM,sCAAsC,CAAC;AAE9C,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,UAAU,CACrD,gBAAgB,EAChB,YAAY,CACb,CAcA"}
|
@@ -0,0 +1,23 @@
|
|
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.getPriceMessageSerializer = getPriceMessageSerializer;
|
11
|
+
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
|
+
function getPriceMessageSerializer() {
|
13
|
+
return (0, serializers_1.struct)([
|
14
|
+
['feedId', (0, serializers_1.publicKey)()],
|
15
|
+
['price', (0, serializers_1.i64)()],
|
16
|
+
['conf', (0, serializers_1.u64)()],
|
17
|
+
['exponent', (0, serializers_1.i32)()],
|
18
|
+
['publishTime', (0, serializers_1.i64)()],
|
19
|
+
['prevPublishTime', (0, serializers_1.i64)()],
|
20
|
+
['emaPrice', (0, serializers_1.i64)()],
|
21
|
+
['emaConf', (0, serializers_1.u64)()],
|
22
|
+
], { description: 'PriceMessage' });
|
23
|
+
}
|
@@ -0,0 +1,24 @@
|
|
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 { PublicKey } from '@metaplex-foundation/umi';
|
9
|
+
import { Serializer } from '@metaplex-foundation/umi/serializers';
|
10
|
+
import { PriceMessage, PriceMessageArgs } from '.';
|
11
|
+
export type PriceUpdateV2 = {
|
12
|
+
writeAuthority: PublicKey;
|
13
|
+
verificationLevel: number;
|
14
|
+
priceMessage: PriceMessage;
|
15
|
+
postedSlot: bigint;
|
16
|
+
};
|
17
|
+
export type PriceUpdateV2Args = {
|
18
|
+
writeAuthority: PublicKey;
|
19
|
+
verificationLevel: number;
|
20
|
+
priceMessage: PriceMessageArgs;
|
21
|
+
postedSlot: number | bigint;
|
22
|
+
};
|
23
|
+
export declare function getPriceUpdateV2Serializer(): Serializer<PriceUpdateV2Args, PriceUpdateV2>;
|
24
|
+
//# sourceMappingURL=priceUpdateV2.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"priceUpdateV2.d.ts","sourceRoot":"","sources":["../../../src/pyth-sdk/types/priceUpdateV2.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EACL,UAAU,EAKX,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAA6B,MAAM,GAAG,CAAC;AAE9E,MAAM,MAAM,aAAa,GAAG;IAC1B,cAAc,EAAE,SAAS,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,cAAc,EAAE,SAAS,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,gBAAgB,CAAC;IAC/B,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B,CAAC;AAEF,wBAAgB,0BAA0B,IAAI,UAAU,CACtD,iBAAiB,EACjB,aAAa,CACd,CAUA"}
|
@@ -0,0 +1,20 @@
|
|
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.getPriceUpdateV2Serializer = getPriceUpdateV2Serializer;
|
11
|
+
const serializers_1 = require("@metaplex-foundation/umi/serializers");
|
12
|
+
const _1 = require(".");
|
13
|
+
function getPriceUpdateV2Serializer() {
|
14
|
+
return (0, serializers_1.struct)([
|
15
|
+
['writeAuthority', (0, serializers_1.publicKey)()],
|
16
|
+
['verificationLevel', (0, serializers_1.u8)()],
|
17
|
+
['priceMessage', (0, _1.getPriceMessageSerializer)()],
|
18
|
+
['postedSlot', (0, serializers_1.u64)()],
|
19
|
+
], { description: 'PriceUpdateV2' });
|
20
|
+
}
|
@@ -8,7 +8,6 @@ import { ReferralStateManager, ReferralStateManagerArgs } from "./referralStateM
|
|
8
8
|
import { SolautoPositionEx } from "../../solautoPosition";
|
9
9
|
import { FlProviderAggregator } from "../flashLoans";
|
10
10
|
export interface SolautoClientArgs extends ReferralStateManagerArgs {
|
11
|
-
new?: boolean;
|
12
11
|
positionId?: number;
|
13
12
|
supplyMint?: PublicKey;
|
14
13
|
debtMint?: PublicKey;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../../src/services/solauto/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAA6B,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EACL,kBAAkB,EAMnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,gCAAgC,EAEhC,sBAAsB,EAGvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAML,cAAc,EACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,iBAAkB,SAAQ,wBAAwB;IACjE,
|
1
|
+
{"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../../src/services/solauto/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAA6B,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EACL,kBAAkB,EAMnB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,SAAS,EACT,aAAa,EACb,iBAAiB,EACjB,gCAAgC,EAEhC,sBAAsB,EAGvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAML,cAAc,EACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,iBAAkB,SAAQ,wBAAwB;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,aAAa,CAAC,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AAkB,GACvB,kBAAkB;IA0BrB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,kBAAkB;IAsDlE,QAAQ,CAAC,eAAe,IAAI,kBAAkB;IAE9C,WAAW,IAAI,kBAAkB;IAgCjC,QAAQ,CAAC,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,kBAAkB;IAE5D,qBAAqB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB;IAqFlE,QAAQ,CAAC,WAAW,CAClB,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,gBAAgB,GACrB,kBAAkB;CACtB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoPositionEx.d.ts","sourceRoot":"","sources":["../../src/solautoPosition/solautoPositionEx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAK/C,OAAO,EACL,WAAW,EAEX,eAAe,EACf,aAAa,EACb,SAAS,EACT,eAAe,EACf,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,
|
1
|
+
{"version":3,"file":"solautoPositionEx.d.ts","sourceRoot":"","sources":["../../src/solautoPosition/solautoPositionEx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAK/C,OAAO,EACL,WAAW,EAEX,eAAe,EACf,aAAa,EACb,SAAS,EACT,eAAe,EACf,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EAOL,cAAc,EAgBf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAMvD,OAAO,EAAqC,SAAS,EAAE,MAAM,cAAc,CAAC;AAE5E,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,eAAe,CAA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SAAI,GAAG,eAAe,GAAG,SAAS;IAuB3E,kBAAkB,IAAI,OAAO;IAQ7B,SAAS,CAAC,uBAAuB;IAWjC,QAAQ,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAE7D,uBAAuB,CAAC,SAAS,CAAC,EAAE,SAAS;IAiBnD,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;IASvD,iBAAiB,CAAC,KAAK,EAAE,MAAM;IAI/B,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IASjD,eAAe,CAAC,KAAK,EAAE,MAAM;IAI7B,cAAc,CAAC,WAAW,CAAC,EAAE,MAAM;IAUnC,wBAAwB,CACtB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,SAAS;IASvB,iBAAiB,CACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,2BAA2B,CAAC,EAAE,MAAM;IA0BhC,mBAAmB;CAM1B"}
|
@@ -18,7 +18,7 @@ class SolautoPositionEx {
|
|
18
18
|
this.lpUserAccount =
|
19
19
|
args.customArgs?.lpUserAccount ??
|
20
20
|
(args.data.position
|
21
|
-
? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(args.data.position.
|
21
|
+
? (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(args.data.position.lpUserAccount)
|
22
22
|
: undefined);
|
23
23
|
this.lpEnv = args.customArgs?.lpEnv ?? "Prod";
|
24
24
|
this._data = args.data;
|
@@ -90,7 +90,7 @@ class SolautoPositionEx {
|
|
90
90
|
return (0, utils_1.maxRepayToBps)(this.state.maxLtvBps, this.state.liqThresholdBps);
|
91
91
|
}
|
92
92
|
get repayFromBps() {
|
93
|
-
return (this.settings?.repayToBps ?? 0) + (this.settings?.repayGap ?? 0);
|
93
|
+
return Math.min((this.settings?.repayToBps ?? 0) + (this.settings?.repayGap ?? 0), this.maxRepayFromBps);
|
94
94
|
}
|
95
95
|
get maxRepayFromBps() {
|
96
96
|
return (0, utils_1.maxRepayFromBps)(this.state.maxLtvBps, this.state.liqThresholdBps);
|
@@ -1,21 +1,5 @@
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
2
2
|
import { Umi } from "@metaplex-foundation/umi";
|
3
|
-
type PriceUpdateV2 = {
|
4
|
-
writeAuthority: Buffer;
|
5
|
-
verificationLevel: number;
|
6
|
-
priceMessage: {
|
7
|
-
feedId: Buffer;
|
8
|
-
price: bigint;
|
9
|
-
conf: bigint;
|
10
|
-
exponent: number;
|
11
|
-
publishTime: bigint;
|
12
|
-
prevPublishTime: bigint;
|
13
|
-
emaPrice: bigint;
|
14
|
-
emaConf: bigint;
|
15
|
-
};
|
16
|
-
};
|
17
|
-
export declare function parsePriceInfo(data: Uint8Array): PriceUpdateV2;
|
18
3
|
export declare function getMostUpToDatePythOracle(umi: Umi, oracleKeys: PublicKey[]): Promise<PublicKey>;
|
19
4
|
export declare function getPythPushOracleAddress(feedId: PublicKey, shardId: number, programId?: PublicKey): PublicKey;
|
20
|
-
export {};
|
21
5
|
//# sourceMappingURL=pythUtils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pythUtils.d.ts","sourceRoot":"","sources":["../../src/utils/pythUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
1
|
+
{"version":3,"file":"pythUtils.d.ts","sourceRoot":"","sources":["../../src/utils/pythUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAa,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAK1D,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,SAAS,EAAE,sBAgBxB;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,SAA6B,GACvC,SAAS,CAMX"}
|
package/dist/utils/pythUtils.js
CHANGED
@@ -1,63 +1,14 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.parsePriceInfo = parsePriceInfo;
|
27
3
|
exports.getMostUpToDatePythOracle = getMostUpToDatePythOracle;
|
28
4
|
exports.getPythPushOracleAddress = getPythPushOracleAddress;
|
29
5
|
const web3_js_1 = require("@solana/web3.js");
|
6
|
+
const umi_1 = require("@metaplex-foundation/umi");
|
30
7
|
const constants_1 = require("../constants");
|
31
8
|
const generalUtils_1 = require("./generalUtils");
|
32
|
-
const
|
33
|
-
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
34
|
-
const priceUpdateV2Schema = {
|
35
|
-
struct: {
|
36
|
-
writeAuthority: {
|
37
|
-
array: { type: "u8", len: 32 },
|
38
|
-
},
|
39
|
-
verificationLevel: "u8",
|
40
|
-
priceMessage: {
|
41
|
-
struct: {
|
42
|
-
feedId: { array: { type: "u8", len: 32 } },
|
43
|
-
price: "i64",
|
44
|
-
conf: "u64",
|
45
|
-
exponent: "i32",
|
46
|
-
publishTime: "i64",
|
47
|
-
prevPublishTime: "i64",
|
48
|
-
emaPrice: "i64",
|
49
|
-
emaConf: "u64",
|
50
|
-
},
|
51
|
-
},
|
52
|
-
postedSlot: "u64",
|
53
|
-
},
|
54
|
-
};
|
55
|
-
function parsePriceInfo(data) {
|
56
|
-
let decoded = borsh.deserialize(priceUpdateV2Schema, data);
|
57
|
-
return decoded;
|
58
|
-
}
|
9
|
+
const pyth_sdk_1 = require("../pyth-sdk");
|
59
10
|
async function getMostUpToDatePythOracle(umi, oracleKeys) {
|
60
|
-
const oracles = (0, generalUtils_1.zip)(oracleKeys,
|
11
|
+
const oracles = (0, generalUtils_1.zip)(oracleKeys, await (0, pyth_sdk_1.safeFetchAllPriceUpdateV2Account)(umi, oracleKeys.map((x) => (0, umi_1.publicKey)(x)), { commitment: "confirmed" })).sort((a, b) => Number(b[1]?.priceMessage.publishTime ?? 0) -
|
61
12
|
Number(a[1]?.priceMessage.publishTime ?? 0));
|
62
13
|
return oracles[0][0];
|
63
14
|
}
|
@@ -120,8 +120,8 @@ async function getSolautoManagedPositions(umi, authority, positionTypeFilter) {
|
|
120
120
|
let tokens;
|
121
121
|
if (position.position.lendingPlatform === generated_1.LendingPlatform.Marginfi) {
|
122
122
|
tokens = [
|
123
|
-
(0, marginfiUtils_1.findMarginfiAccounts)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.position.
|
124
|
-
(0, marginfiUtils_1.findMarginfiAccounts)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.position.
|
123
|
+
(0, marginfiUtils_1.findMarginfiAccounts)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.position.lpSupplyAccount)).mint,
|
124
|
+
(0, marginfiUtils_1.findMarginfiAccounts)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.position.lpDebtAccount)).mint,
|
125
125
|
];
|
126
126
|
}
|
127
127
|
// TODO: PF
|
@@ -131,7 +131,7 @@ async function getSolautoManagedPositions(umi, authority, positionTypeFilter) {
|
|
131
131
|
positionId: position.positionId[0],
|
132
132
|
lendingPlatform: position.position.lendingPlatform,
|
133
133
|
positionType: position.positionType,
|
134
|
-
lpUserAccount: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.position.
|
134
|
+
lpUserAccount: (0, umi_web3js_adapters_1.toWeb3JsPublicKey)(position.position.lpUserAccount),
|
135
135
|
supplyMint: tokens[0],
|
136
136
|
debtMint: tokens[1],
|
137
137
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@haven-fi/solauto-sdk",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.649",
|
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,7 +23,6 @@
|
|
23
23
|
"@switchboard-xyz/common": "=3.0.12",
|
24
24
|
"@switchboard-xyz/on-demand": "=1.2.51",
|
25
25
|
"axios": "^1.7.8",
|
26
|
-
"borsh": "^2.0.0",
|
27
26
|
"bs58": "^5.0.0",
|
28
27
|
"cross-fetch": "^4.0.0",
|
29
28
|
"dotenv": "^16.4.7",
|
@@ -30,9 +30,9 @@ import {
|
|
30
30
|
export type PositionData = {
|
31
31
|
lendingPlatform: LendingPlatform;
|
32
32
|
padding1: Array<number>;
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
lpUserAccount: PublicKey;
|
34
|
+
lpSupplyAccount: PublicKey;
|
35
|
+
lpDebtAccount: PublicKey;
|
36
36
|
settings: SolautoSettingsParameters;
|
37
37
|
dca: DCASettings;
|
38
38
|
padding: Array<number>;
|
@@ -41,9 +41,9 @@ export type PositionData = {
|
|
41
41
|
export type PositionDataArgs = {
|
42
42
|
lendingPlatform: LendingPlatformArgs;
|
43
43
|
padding1: Array<number>;
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
lpUserAccount: PublicKey;
|
45
|
+
lpSupplyAccount: PublicKey;
|
46
|
+
lpDebtAccount: PublicKey;
|
47
47
|
settings: SolautoSettingsParametersArgs;
|
48
48
|
dca: DCASettingsArgs;
|
49
49
|
padding: Array<number>;
|
@@ -57,9 +57,9 @@ export function getPositionDataSerializer(): Serializer<
|
|
57
57
|
[
|
58
58
|
['lendingPlatform', getLendingPlatformSerializer()],
|
59
59
|
['padding1', array(u8(), { size: 7 })],
|
60
|
-
['
|
61
|
-
['
|
62
|
-
['
|
60
|
+
['lpUserAccount', publicKeySerializer()],
|
61
|
+
['lpSupplyAccount', publicKeySerializer()],
|
62
|
+
['lpDebtAccount', publicKeySerializer()],
|
63
63
|
['settings', getSolautoSettingsParametersSerializer()],
|
64
64
|
['dca', getDCASettingsSerializer()],
|
65
65
|
['padding', array(u32(), { size: 4 })],
|