@kamino-finance/klend-sdk 5.14.5 → 5.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classes/farm_utils.d.ts +9 -1
- package/dist/classes/farm_utils.d.ts.map +1 -1
- package/dist/classes/farm_utils.js +10 -2
- package/dist/classes/farm_utils.js.map +1 -1
- package/dist/classes/vault.d.ts +1 -1
- package/dist/classes/vault.d.ts.map +1 -1
- package/dist/classes/vault.js +69 -15
- package/dist/classes/vault.js.map +1 -1
- package/dist/client_kamino_manager.d.ts.map +1 -1
- package/dist/client_kamino_manager.js +1 -0
- package/dist/client_kamino_manager.js.map +1 -1
- package/dist/utils/api.d.ts +7 -1
- package/dist/utils/api.d.ts.map +1 -1
- package/dist/utils/api.js +3 -2
- package/dist/utils/api.js.map +1 -1
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +3 -3
- package/dist/utils/constants.js.map +1 -1
- package/package.json +1 -1
- package/src/classes/farm_utils.ts +9 -1
- package/src/classes/vault.ts +88 -15
- package/src/classes/vault_types.ts +1 -1
- package/src/client_kamino_manager.ts +2 -0
- package/src/utils/api.ts +9 -3
- package/src/utils/constants.ts +3 -3
|
@@ -630,6 +630,8 @@ async function main() {
|
|
|
630
630
|
|
|
631
631
|
mode === 'execute' && console.log('Vault ownership accepted:', acceptVaultOwnershipSig);
|
|
632
632
|
|
|
633
|
+
await processTxn(env.client, env.payer, [instructions.initNewLUTIx], mode, 2500, []);
|
|
634
|
+
|
|
633
635
|
// send the LUT mgmt ixs one by one
|
|
634
636
|
const lutIxs = [...instructions.updateLUTIxs];
|
|
635
637
|
for (let i = 0; i < lutIxs.length; i++) {
|
package/src/utils/api.ts
CHANGED
|
@@ -5,6 +5,12 @@ import { CDN_ENDPOINT, getApiEndpoint } from '../utils';
|
|
|
5
5
|
import { IBackOffOptions, backOff } from 'exponential-backoff';
|
|
6
6
|
import { PROGRAM_ID } from '../lib';
|
|
7
7
|
|
|
8
|
+
export type ApiRequestOptions = {
|
|
9
|
+
programId?: PublicKey;
|
|
10
|
+
source?: 'API' | 'CDN';
|
|
11
|
+
apiBaseUrl?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
8
14
|
export type ApiFilterOptions = {
|
|
9
15
|
isCurated?: boolean;
|
|
10
16
|
};
|
|
@@ -15,11 +21,11 @@ export type ApiFilterOptions = {
|
|
|
15
21
|
*
|
|
16
22
|
* @param programId - The program id to retrieve config for
|
|
17
23
|
* @param source - CDN is a json file hosted in the cloud, API is a webserver
|
|
24
|
+
* @param apiBaseUrl - Optional base URL for the API, if not provided, defaults to the standard API endpoint, not used for CDN
|
|
18
25
|
* @param filterOptions - Config options to filter markets by
|
|
19
26
|
*/
|
|
20
27
|
export async function getMarketsFromApi(
|
|
21
|
-
programId:
|
|
22
|
-
source: 'API' | 'CDN' = 'CDN',
|
|
28
|
+
{ programId = PROGRAM_ID, source = 'CDN', apiBaseUrl }: ApiRequestOptions = {},
|
|
23
29
|
filterOptions: ApiFilterOptions = {}
|
|
24
30
|
): Promise<ConfigType> {
|
|
25
31
|
let unfilteredConfigs: ConfigType = {} as ConfigType;
|
|
@@ -30,7 +36,7 @@ export async function getMarketsFromApi(
|
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
if (!unfilteredConfigs || isEmptyObject(unfilteredConfigs)) {
|
|
33
|
-
const API_ENDPOINT = getApiEndpoint(programId);
|
|
39
|
+
const API_ENDPOINT = getApiEndpoint(programId, apiBaseUrl);
|
|
34
40
|
unfilteredConfigs = (await backOff(() => axios.get(API_ENDPOINT), KAMINO_API_RETRY)).data as ConfigType;
|
|
35
41
|
}
|
|
36
42
|
|
package/src/utils/constants.ts
CHANGED
|
@@ -19,11 +19,11 @@ export function isENV(value: any): value is ENV {
|
|
|
19
19
|
return value === 'mainnet-beta' || value === 'devnet' || value === 'localnet';
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export function getApiEndpoint(programId: PublicKey) {
|
|
22
|
+
export function getApiEndpoint(programId: PublicKey, apiBaseUrl: string = 'https://api.kamino.finance') {
|
|
23
23
|
if (programId.equals(PROGRAM_ID)) {
|
|
24
|
-
return
|
|
24
|
+
return `${apiBaseUrl}/v2/kamino-market`;
|
|
25
25
|
} else {
|
|
26
|
-
return
|
|
26
|
+
return `${apiBaseUrl}/v2/kamino-market/?programId=${programId.toString()}`;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|