@haven-fi/solauto-sdk 1.0.80 → 1.0.81
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/clients/solautoClient.d.ts.map +1 -1
- package/dist/clients/solautoClient.js +2 -0
- package/dist/generated/instructions/claimReferralFees.d.ts +2 -0
- package/dist/generated/instructions/claimReferralFees.d.ts.map +1 -1
- package/dist/generated/instructions/claimReferralFees.js +17 -7
- package/dist/utils/solauto/generalUtils.d.ts +1 -0
- package/dist/utils/solauto/generalUtils.d.ts.map +1 -1
- package/dist/utils/solauto/generalUtils.js +10 -0
- package/package.json +1 -1
- package/src/clients/solautoClient.ts +2 -0
- package/src/generated/instructions/claimReferralFees.ts +19 -7
- package/src/utils/solauto/generalUtils.ts +12 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solautoClient.d.ts","sourceRoot":"","sources":["../../src/clients/solautoClient.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAEL,UAAU,EACV,SAAS,EACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,GAAG,EAQJ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EAEd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,yBAAyB,EACzB,gCAAgC,EAChC,sBAAsB,EASvB,MAAM,cAAc,CAAC;AAStB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAMvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAOnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,C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E,wBAAwB,EACvC,SAAS,CAAC,EAAE,gBAAgB,EAC5B,2BAA2B,CAAC,EAAE,MAAM,EACpC,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB;IAEf,qBAAqB,IAAI,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAYlE"}
|
@@ -208,6 +208,8 @@ class SolautoClient {
|
|
208
208
|
: undefined;
|
209
209
|
return (0, generated_1.claimReferralFees)(this.umi, {
|
210
210
|
signer: this.signer,
|
211
|
+
signerWsolTa: (0, umi_1.publicKey)((0, accountUtils_1.getTokenAccount)((0, umi_web3js_adapters_1.toWeb3JsPublicKey)(this.signer.publicKey), spl_token_1.NATIVE_MINT)),
|
212
|
+
referralAuthority: (0, umi_1.publicKey)(this.authorityReferralStateData.authority),
|
211
213
|
referralState: (0, umi_1.publicKey)(this.authorityReferralState),
|
212
214
|
referralFeesDestTa: (0, umi_1.publicKey)(this.authorityReferralDestTa),
|
213
215
|
referralFeesDestMint: (0, umi_1.publicKey)(this.authorityReferralFeesDestMint),
|
@@ -9,12 +9,14 @@ import { Context, Pda, PublicKey, Signer, TransactionBuilder } from '@metaplex-f
|
|
9
9
|
import { Serializer } from '@metaplex-foundation/umi/serializers';
|
10
10
|
export type ClaimReferralFeesInstructionAccounts = {
|
11
11
|
signer: Signer;
|
12
|
+
signerWsolTa?: PublicKey | Pda;
|
12
13
|
systemProgram?: PublicKey | Pda;
|
13
14
|
tokenProgram?: PublicKey | Pda;
|
14
15
|
rent?: PublicKey | Pda;
|
15
16
|
referralState: PublicKey | Pda;
|
16
17
|
referralFeesDestTa: PublicKey | Pda;
|
17
18
|
referralFeesDestMint: PublicKey | Pda;
|
19
|
+
referralAuthority?: PublicKey | Pda;
|
18
20
|
feesDestinationTa?: PublicKey | Pda;
|
19
21
|
};
|
20
22
|
export type ClaimReferralFeesInstructionData = {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"claimReferralFees.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/claimReferralFees.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAIX,MAAM,sCAAsC,CAAC;AAQ9C,MAAM,MAAM,oCAAoC,GAAG;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACvB,aAAa,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,kBAAkB,EAAE,SAAS,GAAG,GAAG,CAAC;IACpC,oBAAoB,EAAE,SAAS,GAAG,GAAG,CAAC;IACtC,iBAAiB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;CACrC,CAAC;AAGF,MAAM,MAAM,gCAAgC,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzE,MAAM,MAAM,oCAAoC,GAAG,EAAE,CAAC;AAEtD,wBAAgB,6CAA6C,IAAI,UAAU,CACzE,oCAAoC,EACpC,gCAAgC,CACjC,CAcA;AAGD,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,KAAK,EAAE,oCAAoC,GAC1C,kBAAkB,
|
1
|
+
{"version":3,"file":"claimReferralFees.d.ts","sourceRoot":"","sources":["../../../src/generated/instructions/claimReferralFees.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,OAAO,EACP,GAAG,EACH,SAAS,EACT,MAAM,EACN,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EAIX,MAAM,sCAAsC,CAAC;AAQ9C,MAAM,MAAM,oCAAoC,GAAG;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,aAAa,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAChC,YAAY,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,IAAI,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACvB,aAAa,EAAE,SAAS,GAAG,GAAG,CAAC;IAC/B,kBAAkB,EAAE,SAAS,GAAG,GAAG,CAAC;IACpC,oBAAoB,EAAE,SAAS,GAAG,GAAG,CAAC;IACtC,iBAAiB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;IACpC,iBAAiB,CAAC,EAAE,SAAS,GAAG,GAAG,CAAC;CACrC,CAAC;AAGF,MAAM,MAAM,gCAAgC,GAAG;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzE,MAAM,MAAM,oCAAoC,GAAG,EAAE,CAAC;AAEtD,wBAAgB,6CAA6C,IAAI,UAAU,CACzE,oCAAoC,EACpC,gCAAgC,CACjC,CAcA;AAGD,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,EAClC,KAAK,EAAE,oCAAoC,GAC1C,kBAAkB,CAmGpB"}
|
@@ -28,34 +28,44 @@ function claimReferralFees(context, input) {
|
|
28
28
|
isWritable: false,
|
29
29
|
value: input.signer ?? null,
|
30
30
|
},
|
31
|
-
|
31
|
+
signerWsolTa: {
|
32
32
|
index: 1,
|
33
|
+
isWritable: true,
|
34
|
+
value: input.signerWsolTa ?? null,
|
35
|
+
},
|
36
|
+
systemProgram: {
|
37
|
+
index: 2,
|
33
38
|
isWritable: false,
|
34
39
|
value: input.systemProgram ?? null,
|
35
40
|
},
|
36
41
|
tokenProgram: {
|
37
|
-
index:
|
42
|
+
index: 3,
|
38
43
|
isWritable: false,
|
39
44
|
value: input.tokenProgram ?? null,
|
40
45
|
},
|
41
|
-
rent: { index:
|
46
|
+
rent: { index: 4, isWritable: false, value: input.rent ?? null },
|
42
47
|
referralState: {
|
43
|
-
index:
|
48
|
+
index: 5,
|
44
49
|
isWritable: false,
|
45
50
|
value: input.referralState ?? null,
|
46
51
|
},
|
47
52
|
referralFeesDestTa: {
|
48
|
-
index:
|
53
|
+
index: 6,
|
49
54
|
isWritable: true,
|
50
55
|
value: input.referralFeesDestTa ?? null,
|
51
56
|
},
|
52
57
|
referralFeesDestMint: {
|
53
|
-
index:
|
58
|
+
index: 7,
|
54
59
|
isWritable: false,
|
55
60
|
value: input.referralFeesDestMint ?? null,
|
56
61
|
},
|
62
|
+
referralAuthority: {
|
63
|
+
index: 8,
|
64
|
+
isWritable: true,
|
65
|
+
value: input.referralAuthority ?? null,
|
66
|
+
},
|
57
67
|
feesDestinationTa: {
|
58
|
-
index:
|
68
|
+
index: 9,
|
59
69
|
isWritable: true,
|
60
70
|
value: input.feesDestinationTa ?? null,
|
61
71
|
},
|
@@ -2,6 +2,7 @@ import { PublicKey } from "@solana/web3.js";
|
|
2
2
|
import { Umi } from "@metaplex-foundation/umi";
|
3
3
|
import { AutomationSettings, DCASettings, DCASettingsInpArgs, PositionState, SolautoSettingsParameters, SolautoSettingsParametersInpArgs } from "../../generated";
|
4
4
|
import { RebalanceAction, SolautoPositionDetails } from "../../types/solauto";
|
5
|
+
export declare function findMintByTicker(ticker: string): PublicKey;
|
5
6
|
export declare function nextAutomationPeriodTimestamp(automation: AutomationSettings): number;
|
6
7
|
export declare function eligibleForNextAutomationPeriod(automation: AutomationSettings, currentUnixTime: number): boolean;
|
7
8
|
export declare function getUpdatedValueFromAutomation(currValue: number, targetValue: number, automation: AutomationSettings, currentUnixTimestamp: number): number;
|
@@ -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,0BA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M,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,gCAAgC,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAE/C,qBAAa,mBAAmB;IACvB,gBAAgB,EAAE,MAAM,CAAa;IACrC,cAAc,EAAE,MAAM,CAAa;IACnC,uBAAuB,EAAE,MAAM,CAAa;IAC5C,QAAQ,EAAE,yBAAyB,GAAG,SAAS,CAAa;IAC5D,SAAS,EAAE,WAAW,GAAG,SAAS,CAAa;IAEtD,GAAG,CAAC,MAAM,EAAE,kBAAkB;IA0B9B,KAAK;IAQL,UAAU,IAAI,OAAO;CAQtB"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.LivePositionUpdates = void 0;
|
4
|
+
exports.findMintByTicker = findMintByTicker;
|
4
5
|
exports.nextAutomationPeriodTimestamp = nextAutomationPeriodTimestamp;
|
5
6
|
exports.eligibleForNextAutomationPeriod = eligibleForNextAutomationPeriod;
|
6
7
|
exports.getUpdatedValueFromAutomation = getUpdatedValueFromAutomation;
|
@@ -23,6 +24,15 @@ const accountUtils_1 = require("../accountUtils");
|
|
23
24
|
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
24
25
|
const constants_1 = require("../../constants");
|
25
26
|
const marginfiUtils_1 = require("../marginfiUtils");
|
27
|
+
function findMintByTicker(ticker) {
|
28
|
+
for (const key in constants_1.TOKEN_INFO) {
|
29
|
+
const account = constants_1.TOKEN_INFO[key];
|
30
|
+
if (account.ticker.toString().toLowerCase() === ticker.toString().toLowerCase()) {
|
31
|
+
return new web3_js_1.PublicKey(key);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
throw new Error(`Token mint not found by the ticker: ${ticker}`);
|
35
|
+
}
|
26
36
|
function newPeriodsPassed(automation, currentUnixTimestamp) {
|
27
37
|
return Math.min(automation.targetPeriods, automation.periodsPassed +
|
28
38
|
Math.floor((currentUnixTimestamp - Number(automation.unixStartDate)) /
|
package/package.json
CHANGED
@@ -405,6 +405,8 @@ export abstract class SolautoClient {
|
|
405
405
|
: undefined;
|
406
406
|
return claimReferralFees(this.umi, {
|
407
407
|
signer: this.signer,
|
408
|
+
signerWsolTa: publicKey(getTokenAccount(toWeb3JsPublicKey(this.signer.publicKey), NATIVE_MINT)),
|
409
|
+
referralAuthority: publicKey(this.authorityReferralStateData!.authority),
|
408
410
|
referralState: publicKey(this.authorityReferralState),
|
409
411
|
referralFeesDestTa: publicKey(this.authorityReferralDestTa),
|
410
412
|
referralFeesDestMint: publicKey(this.authorityReferralFeesDestMint),
|
@@ -30,12 +30,14 @@ import {
|
|
30
30
|
// Accounts.
|
31
31
|
export type ClaimReferralFeesInstructionAccounts = {
|
32
32
|
signer: Signer;
|
33
|
+
signerWsolTa?: PublicKey | Pda;
|
33
34
|
systemProgram?: PublicKey | Pda;
|
34
35
|
tokenProgram?: PublicKey | Pda;
|
35
36
|
rent?: PublicKey | Pda;
|
36
37
|
referralState: PublicKey | Pda;
|
37
38
|
referralFeesDestTa: PublicKey | Pda;
|
38
39
|
referralFeesDestMint: PublicKey | Pda;
|
40
|
+
referralAuthority?: PublicKey | Pda;
|
39
41
|
feesDestinationTa?: PublicKey | Pda;
|
40
42
|
};
|
41
43
|
|
@@ -81,34 +83,44 @@ export function claimReferralFees(
|
|
81
83
|
isWritable: false as boolean,
|
82
84
|
value: input.signer ?? null,
|
83
85
|
},
|
84
|
-
|
86
|
+
signerWsolTa: {
|
85
87
|
index: 1,
|
88
|
+
isWritable: true as boolean,
|
89
|
+
value: input.signerWsolTa ?? null,
|
90
|
+
},
|
91
|
+
systemProgram: {
|
92
|
+
index: 2,
|
86
93
|
isWritable: false as boolean,
|
87
94
|
value: input.systemProgram ?? null,
|
88
95
|
},
|
89
96
|
tokenProgram: {
|
90
|
-
index:
|
97
|
+
index: 3,
|
91
98
|
isWritable: false as boolean,
|
92
99
|
value: input.tokenProgram ?? null,
|
93
100
|
},
|
94
|
-
rent: { index:
|
101
|
+
rent: { index: 4, isWritable: false as boolean, value: input.rent ?? null },
|
95
102
|
referralState: {
|
96
|
-
index:
|
103
|
+
index: 5,
|
97
104
|
isWritable: false as boolean,
|
98
105
|
value: input.referralState ?? null,
|
99
106
|
},
|
100
107
|
referralFeesDestTa: {
|
101
|
-
index:
|
108
|
+
index: 6,
|
102
109
|
isWritable: true as boolean,
|
103
110
|
value: input.referralFeesDestTa ?? null,
|
104
111
|
},
|
105
112
|
referralFeesDestMint: {
|
106
|
-
index:
|
113
|
+
index: 7,
|
107
114
|
isWritable: false as boolean,
|
108
115
|
value: input.referralFeesDestMint ?? null,
|
109
116
|
},
|
117
|
+
referralAuthority: {
|
118
|
+
index: 8,
|
119
|
+
isWritable: true as boolean,
|
120
|
+
value: input.referralAuthority ?? null,
|
121
|
+
},
|
110
122
|
feesDestinationTa: {
|
111
|
-
index:
|
123
|
+
index: 9,
|
112
124
|
isWritable: true as boolean,
|
113
125
|
value: input.feesDestinationTa ?? null,
|
114
126
|
},
|
@@ -29,6 +29,18 @@ import {
|
|
29
29
|
import { getAllMarginfiAccountsByAuthority } from "../marginfiUtils";
|
30
30
|
import { RebalanceAction, SolautoPositionDetails } from "../../types/solauto";
|
31
31
|
|
32
|
+
export function findMintByTicker(ticker: string): PublicKey {
|
33
|
+
for (const key in TOKEN_INFO) {
|
34
|
+
const account = TOKEN_INFO[key];
|
35
|
+
if (
|
36
|
+
account.ticker.toString().toLowerCase() === ticker.toString().toLowerCase()
|
37
|
+
) {
|
38
|
+
return new PublicKey(key);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
throw new Error(`Token mint not found by the ticker: ${ticker}`);
|
42
|
+
}
|
43
|
+
|
32
44
|
function newPeriodsPassed(
|
33
45
|
automation: AutomationSettings,
|
34
46
|
currentUnixTimestamp: number
|