@suilend/sdk 1.1.24 → 1.1.26
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/_generated/_dependencies/source/0x1/ascii/structs.js +17 -7
- package/_generated/_dependencies/source/0x1/option/structs.js +17 -7
- package/_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js +17 -7
- package/_generated/suilend/lending-market/structs.js +17 -7
- package/_generated/suilend/liquidity-mining/structs.js +17 -7
- package/_generated/suilend/obligation/structs.js +17 -7
- package/_generated/suilend/reserve/structs.js +17 -7
- package/_generated/suilend/reserve-config/structs.js +17 -7
- package/client.d.ts +21 -22
- package/client.js +5 -15
- package/package.json +1 -1
- package/parsers/reserve.d.ts +4 -4
- package/parsers/reserve.js +21 -11
- package/utils/obligation.js +17 -7
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|
package/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SuiClient } from "@mysten/sui/client";
|
|
2
|
-
import { Transaction, TransactionObjectInput } from "@mysten/sui/transactions";
|
|
2
|
+
import { Transaction, TransactionObjectInput, TransactionResult } from "@mysten/sui/transactions";
|
|
3
3
|
import { SuiPriceServiceConnection, SuiPythClient } from "@pythnetwork/pyth-sui-js";
|
|
4
4
|
import { LendingMarket, ObligationOwnerCap } from "./_generated/suilend/lending-market/structs";
|
|
5
5
|
import { Obligation } from "./_generated/suilend/obligation/structs";
|
|
@@ -31,37 +31,36 @@ export declare class SuilendClient {
|
|
|
31
31
|
getObligation(obligationId: string): Promise<Obligation<string>>;
|
|
32
32
|
static getLendingMarketOwnerCapId(ownerId: string, lendingMarketTypeArgs: string[], client: SuiClient): Promise<string | null>;
|
|
33
33
|
getLendingMarketOwnerCapId(ownerId: string): Promise<string | null>;
|
|
34
|
-
createReserve(lendingMarketOwnerCapId: string, transaction: Transaction, pythPriceId: string, coinType: string, createReserveConfigArgs: CreateReserveConfigArgs): Promise<
|
|
35
|
-
addReward(ownerId: string, lendingMarketOwnerCapId: string, reserveArrayIndex: bigint, isDepositReward: boolean, rewardCoinType: string, rewardValue: string, startTimeMs: bigint, endTimeMs: bigint, transaction: Transaction, mergeCoins?: boolean): Promise<
|
|
36
|
-
cancelReward(lendingMarketOwnerCapId: string, reserveArrayIndex: bigint, isDepositReward: boolean, rewardIndex: bigint, rewardCoinType: string, transaction: Transaction):
|
|
37
|
-
closeReward(lendingMarketOwnerCapId: string, reserveArrayIndex: bigint, isDepositReward: boolean, rewardIndex: bigint, rewardCoinType: string, transaction: Transaction):
|
|
38
|
-
claimReward(obligationOwnerCapId: string, reserveArrayIndex: bigint, rewardIndex: bigint, rewardType: string, side: Side, transaction: Transaction):
|
|
39
|
-
claimRewardAndDeposit(obligationId: string, rewardReserveArrayIndex: bigint, rewardIndex: bigint, rewardType: string, side: Side, depositReserveArrayIndex: bigint, transaction: Transaction):
|
|
34
|
+
createReserve(lendingMarketOwnerCapId: string, transaction: Transaction, pythPriceId: string, coinType: string, createReserveConfigArgs: CreateReserveConfigArgs): Promise<TransactionResult>;
|
|
35
|
+
addReward(ownerId: string, lendingMarketOwnerCapId: string, reserveArrayIndex: bigint, isDepositReward: boolean, rewardCoinType: string, rewardValue: string, startTimeMs: bigint, endTimeMs: bigint, transaction: Transaction, mergeCoins?: boolean): Promise<TransactionResult>;
|
|
36
|
+
cancelReward(lendingMarketOwnerCapId: string, reserveArrayIndex: bigint, isDepositReward: boolean, rewardIndex: bigint, rewardCoinType: string, transaction: Transaction): TransactionResult;
|
|
37
|
+
closeReward(lendingMarketOwnerCapId: string, reserveArrayIndex: bigint, isDepositReward: boolean, rewardIndex: bigint, rewardCoinType: string, transaction: Transaction): TransactionResult;
|
|
38
|
+
claimReward(obligationOwnerCapId: string, reserveArrayIndex: bigint, rewardIndex: bigint, rewardType: string, side: Side, transaction: Transaction): TransactionResult;
|
|
39
|
+
claimRewardAndDeposit(obligationId: string, rewardReserveArrayIndex: bigint, rewardIndex: bigint, rewardType: string, side: Side, depositReserveArrayIndex: bigint, transaction: Transaction): TransactionResult;
|
|
40
40
|
claimRewards(ownerId: string, obligationOwnerCapId: string, rewards: ClaimRewardsReward[], transaction: Transaction, isDepositing: boolean): void;
|
|
41
41
|
claimRewardsAndSendToUser(ownerId: string, obligationOwnerCapId: string, rewards: ClaimRewardsReward[], transaction: Transaction): void;
|
|
42
42
|
claimRewardsAndDeposit(ownerId: string, obligationOwnerCapId: string, rewards: ClaimRewardsReward[], transaction: Transaction): void;
|
|
43
43
|
findReserveArrayIndex(coinType: string): bigint;
|
|
44
|
-
updateReserveConfig(lendingMarketOwnerCapId: string, transaction: Transaction, coinType: string, createReserveConfigArgs: CreateReserveConfigArgs):
|
|
44
|
+
updateReserveConfig(lendingMarketOwnerCapId: string, transaction: Transaction, coinType: string, createReserveConfigArgs: CreateReserveConfigArgs): TransactionResult;
|
|
45
45
|
newObligationOwnerCap(transaction: Transaction, lendingMarketOwnerCapId: string, destinationAddress: string, obligationId: string): void;
|
|
46
|
-
updateRateLimiterConfig(lendingMarketOwnerCapId: string, transaction: Transaction, newRateLimiterConfigArgs: CreateRateLimiterConfigArgs):
|
|
47
|
-
changeReservePriceFeed(lendingMarketOwnerCapId: string, coinType: string, pythPriceId: string, transaction: Transaction): Promise<
|
|
48
|
-
createObligation(transaction: Transaction):
|
|
46
|
+
updateRateLimiterConfig(lendingMarketOwnerCapId: string, transaction: Transaction, newRateLimiterConfigArgs: CreateRateLimiterConfigArgs): TransactionResult;
|
|
47
|
+
changeReservePriceFeed(lendingMarketOwnerCapId: string, coinType: string, pythPriceId: string, transaction: Transaction): Promise<TransactionResult>;
|
|
48
|
+
createObligation(transaction: Transaction): TransactionResult;
|
|
49
49
|
refreshAll(transaction: Transaction, obligation: Obligation<string>, extraReserveArrayIndex?: bigint): Promise<void>;
|
|
50
50
|
refreshReservePrices(transaction: Transaction, priceInfoObjectId: string, reserveArrayIndex: bigint): Promise<void>;
|
|
51
51
|
deposit(sendCoin: TransactionObjectInput, coinType: string, obligationOwnerCap: TransactionObjectInput, transaction: Transaction): void;
|
|
52
|
-
|
|
53
|
-
depositIntoObligation(ownerId: string, coinType: string, value: string, transaction: Transaction, obligationOwnerCapId?: string): Promise<void>;
|
|
52
|
+
depositIntoObligation(ownerId: string, coinType: string, value: string, transaction: Transaction, obligationOwnerCapId: string | TransactionResult): Promise<void>;
|
|
54
53
|
depositLiquidityAndGetCTokens(ownerId: string, coinType: string, value: string, transaction: Transaction): Promise<void>;
|
|
55
|
-
withdraw(obligationOwnerCapId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<
|
|
56
|
-
redeem(ctokens: TransactionObjectInput, coinType: string, exemption: TransactionObjectInput, transaction: Transaction):
|
|
54
|
+
withdraw(obligationOwnerCapId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<TransactionResult>;
|
|
55
|
+
redeem(ctokens: TransactionObjectInput, coinType: string, exemption: TransactionObjectInput, transaction: Transaction): TransactionResult;
|
|
57
56
|
withdrawAndSendToUser(ownerId: string, obligationOwnerCapId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<void>;
|
|
58
|
-
borrow(obligationOwnerCapId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<
|
|
57
|
+
borrow(obligationOwnerCapId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<TransactionResult>;
|
|
59
58
|
borrowAndSendToUser(ownerId: string, obligationOwnerCapId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<void>;
|
|
60
|
-
repay(obligationId: string, coinType: string, coin: TransactionObjectInput, transaction: Transaction):
|
|
61
|
-
repayIntoObligation(ownerId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<
|
|
62
|
-
liquidateAndRedeem(transaction: Transaction, obligation: Obligation<string>, repayCoinType: string, withdrawCoinType: string, repayCoinId: TransactionObjectInput): Promise<
|
|
63
|
-
liquidate(transaction: Transaction, obligation: Obligation<string>, repayCoinType: string, withdrawCoinType: string, repayCoinId: TransactionObjectInput): Promise<
|
|
64
|
-
migrate(transaction: Transaction, lendingMarketOwnerCapId: string):
|
|
65
|
-
claimFees(transaction: Transaction, coinType: string):
|
|
59
|
+
repay(obligationId: string, coinType: string, coin: TransactionObjectInput, transaction: Transaction): TransactionResult;
|
|
60
|
+
repayIntoObligation(ownerId: string, obligationId: string, coinType: string, value: string, transaction: Transaction): Promise<TransactionResult>;
|
|
61
|
+
liquidateAndRedeem(transaction: Transaction, obligation: Obligation<string>, repayCoinType: string, withdrawCoinType: string, repayCoinId: TransactionObjectInput): Promise<TransactionResult>;
|
|
62
|
+
liquidate(transaction: Transaction, obligation: Obligation<string>, repayCoinType: string, withdrawCoinType: string, repayCoinId: TransactionObjectInput): Promise<TransactionResult>;
|
|
63
|
+
migrate(transaction: Transaction, lendingMarketOwnerCapId: string): TransactionResult;
|
|
64
|
+
claimFees(transaction: Transaction, coinType: string): TransactionResult;
|
|
66
65
|
redeemCtokensAndWithdrawLiquidity(ownerId: string, ctokenCoinTypes: string[], transaction: Transaction): Promise<void>;
|
|
67
66
|
}
|
package/client.js
CHANGED
|
@@ -33,10 +33,10 @@ const SUILEND_UPGRADE_CAP_ID = process.env.NEXT_PUBLIC_USE_BETA_MARKET
|
|
|
33
33
|
? "0x05da14368a42a351e106806c09727968ae26be77a6741a018239ef0f99d5185e"
|
|
34
34
|
: "0x3d4ef1859c3ee9fc72858f588b56a09da5466e64f8cc4e90a7b3b909fba8a7ae";
|
|
35
35
|
exports.LENDING_MARKET_ID = process.env.NEXT_PUBLIC_USE_BETA_MARKET
|
|
36
|
-
? "
|
|
36
|
+
? "0x12e46de3eafaf0308a2dd64f1158782ed19e6621835bf883a1dd6b3061115667"
|
|
37
37
|
: "0x84030d26d85eaa7035084a057f2f11f701b7e2e4eda87551becbc7c97505ece1";
|
|
38
38
|
exports.LENDING_MARKET_TYPE = process.env.NEXT_PUBLIC_USE_BETA_MARKET
|
|
39
|
-
? "
|
|
39
|
+
? "0x83556891f4a0f233ce7b05cfe7f957d4020492a34f5405b2cb9377d060bef4bf::spring_sui::SPRING_SUI"
|
|
40
40
|
: "0xf95b06141ed4a174f239417323bde3f209b972f5930d8521ea38a52aff3a6ddf::suilend::MAIN_POOL";
|
|
41
41
|
function getLatestPackageId(client, upgradeCapId) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -191,7 +191,7 @@ class SuilendClient {
|
|
|
191
191
|
owner: ownerId,
|
|
192
192
|
coinType: rewardCoinType,
|
|
193
193
|
})).data;
|
|
194
|
-
if (coins.length > 1 && !isSui && mergeCoins) {
|
|
194
|
+
if (coins.length > 1 && !isSui(rewardCoinType) && mergeCoins) {
|
|
195
195
|
transaction.mergeCoins(transaction.object(coins[0].coinObjectId), coins.map((c) => transaction.object(c.coinObjectId)).slice(1));
|
|
196
196
|
}
|
|
197
197
|
const [rewardCoin] = transaction.splitCoins(isSui(rewardCoinType)
|
|
@@ -268,7 +268,7 @@ class SuilendClient {
|
|
|
268
268
|
transaction.transferObjects([mergeCoin], transaction.pure.address(ownerId));
|
|
269
269
|
}
|
|
270
270
|
else {
|
|
271
|
-
this.
|
|
271
|
+
this.deposit(mergeCoin, rewardCoinType, obligationOwnerCapId, transaction);
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
}
|
|
@@ -402,16 +402,6 @@ class SuilendClient {
|
|
|
402
402
|
deposit: ctokens,
|
|
403
403
|
});
|
|
404
404
|
}
|
|
405
|
-
depositCoin(ownerId, sendCoin, coinType, transaction, obligationOwnerCapId) {
|
|
406
|
-
let createdObligationOwnerCap;
|
|
407
|
-
if (!obligationOwnerCapId) {
|
|
408
|
-
createdObligationOwnerCap = this.createObligation(transaction)[0];
|
|
409
|
-
}
|
|
410
|
-
this.deposit(sendCoin, coinType, (obligationOwnerCapId !== null && obligationOwnerCapId !== void 0 ? obligationOwnerCapId : createdObligationOwnerCap), transaction);
|
|
411
|
-
if (createdObligationOwnerCap) {
|
|
412
|
-
transaction.transferObjects([createdObligationOwnerCap], transaction.pure.address(ownerId));
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
405
|
depositIntoObligation(ownerId, coinType, value, transaction, obligationOwnerCapId) {
|
|
416
406
|
return __awaiter(this, void 0, void 0, function* () {
|
|
417
407
|
const coins = (yield this.client.getCoins({
|
|
@@ -425,7 +415,7 @@ class SuilendClient {
|
|
|
425
415
|
const [sendCoin] = transaction.splitCoins(isSui(coinType)
|
|
426
416
|
? transaction.gas
|
|
427
417
|
: transaction.object(mergeCoin.coinObjectId), [value]);
|
|
428
|
-
this.
|
|
418
|
+
this.deposit(sendCoin, coinType, obligationOwnerCapId, transaction);
|
|
429
419
|
});
|
|
430
420
|
}
|
|
431
421
|
depositLiquidityAndGetCTokens(ownerId, coinType, value, transaction) {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@suilend/sdk","version":"1.1.
|
|
1
|
+
{"name":"@suilend/sdk","version":"1.1.26","private":false,"description":"A TypeScript SDK for interacting with the Suilend program","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./client":"./client.js","./constants":"./constants.js","./types":"./types.js","./api/events":"./api/events.js","./api":"./api/index.js","./parsers/apiReserveAssetDataEvent":"./parsers/apiReserveAssetDataEvent.js","./parsers":"./parsers/index.js","./parsers/lendingMarket":"./parsers/lendingMarket.js","./parsers/obligation":"./parsers/obligation.js","./parsers/rateLimiter":"./parsers/rateLimiter.js","./parsers/reserve":"./parsers/reserve.js","./utils/events":"./utils/events.js","./utils":"./utils/index.js","./utils/obligation":"./utils/obligation.js","./utils/simulate":"./utils/simulate.js","./_generated/_framework/reified":"./_generated/_framework/reified.js","./_generated/_framework/util":"./_generated/_framework/util.js","./_generated/_framework/vector":"./_generated/_framework/vector.js","./_generated/suilend":"./_generated/suilend/index.js","./_generated/suilend/cell/structs":"./_generated/suilend/cell/structs.js","./_generated/suilend/decimal/structs":"./_generated/suilend/decimal/structs.js","./_generated/suilend/lending-market/functions":"./_generated/suilend/lending-market/functions.js","./_generated/suilend/lending-market/structs":"./_generated/suilend/lending-market/structs.js","./_generated/suilend/lending-market-registry/functions":"./_generated/suilend/lending-market-registry/functions.js","./_generated/suilend/liquidity-mining/structs":"./_generated/suilend/liquidity-mining/structs.js","./_generated/suilend/obligation/structs":"./_generated/suilend/obligation/structs.js","./_generated/suilend/rate-limiter/functions":"./_generated/suilend/rate-limiter/functions.js","./_generated/suilend/rate-limiter/structs":"./_generated/suilend/rate-limiter/structs.js","./_generated/suilend/reserve/structs":"./_generated/suilend/reserve/structs.js","./_generated/suilend/reserve-config/functions":"./_generated/suilend/reserve-config/functions.js","./_generated/suilend/reserve-config/structs":"./_generated/suilend/reserve-config/structs.js","./_generated/_dependencies/source/0x1":"./_generated/_dependencies/source/0x1/index.js","./_generated/_dependencies/source/0x2":"./_generated/_dependencies/source/0x2/index.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/index.js","./_generated/_dependencies/source/0x1/ascii/structs":"./_generated/_dependencies/source/0x1/ascii/structs.js","./_generated/_dependencies/source/0x1/option/structs":"./_generated/_dependencies/source/0x1/option/structs.js","./_generated/_dependencies/source/0x1/type-name/structs":"./_generated/_dependencies/source/0x1/type-name/structs.js","./_generated/_dependencies/source/0x2/bag/structs":"./_generated/_dependencies/source/0x2/bag/structs.js","./_generated/_dependencies/source/0x2/balance/structs":"./_generated/_dependencies/source/0x2/balance/structs.js","./_generated/_dependencies/source/0x2/object/structs":"./_generated/_dependencies/source/0x2/object/structs.js","./_generated/_dependencies/source/0x2/object-table/structs":"./_generated/_dependencies/source/0x2/object-table/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/i64/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-feed/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-identifier/structs.js","./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs":"./_generated/_dependencies/source/0x8d97f1cd6ac663735be08d1d2b6d02a159e711586461306ce60a2b7a6a565a9e/price-info/structs.js"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc","eslint":"eslint --fix \"./src/**/*.ts\"","prettier":"prettier --write \"./src/**/*\"","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ts-node ./release.ts && cd ./dist && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/solendprotocol/suilend-public.git"},"bugs":{"url":"https://github.com/solendprotocol/suilend-public/issues"},"dependencies":{"@mysten/bcs":"1.2.0","@mysten/sui":"1.17.0","@pythnetwork/pyth-sui-js":"^2.1.0","bignumber.js":"^9.1.2","p-limit":"3.1.0","uuid":"^11.0.3"},"devDependencies":{"ts-node":"^10.9.2"}}
|
package/parsers/reserve.d.ts
CHANGED
|
@@ -109,19 +109,19 @@ export declare const parseReserve: (reserve: Reserve<string>, coinMetadataMap: R
|
|
|
109
109
|
coinType: string;
|
|
110
110
|
};
|
|
111
111
|
/**
|
|
112
|
-
* @deprecated since version 1.1.
|
|
112
|
+
* @deprecated since version 1.1.19. Use `token.symbol` instead.
|
|
113
113
|
*/
|
|
114
114
|
symbol: string;
|
|
115
115
|
/**
|
|
116
|
-
* @deprecated since version 1.1.
|
|
116
|
+
* @deprecated since version 1.1.19. Use `token.name` instead.
|
|
117
117
|
*/
|
|
118
118
|
name: string;
|
|
119
119
|
/**
|
|
120
|
-
* @deprecated since version 1.1.
|
|
120
|
+
* @deprecated since version 1.1.19. Use `token.iconUrl` instead.
|
|
121
121
|
*/
|
|
122
122
|
iconUrl: string | null | undefined;
|
|
123
123
|
/**
|
|
124
|
-
* @deprecated since version 1.1.
|
|
124
|
+
* @deprecated since version 1.1.19. Use `token.description` instead.
|
|
125
125
|
*/
|
|
126
126
|
description: string;
|
|
127
127
|
/**
|
package/parsers/reserve.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -107,19 +117,19 @@ const parseReserve = (reserve, coinMetadataMap) => {
|
|
|
107
117
|
utilizationPercent,
|
|
108
118
|
token: Object.assign({ coinType }, coinMetadata),
|
|
109
119
|
/**
|
|
110
|
-
* @deprecated since version 1.1.
|
|
120
|
+
* @deprecated since version 1.1.19. Use `token.symbol` instead.
|
|
111
121
|
*/
|
|
112
122
|
symbol,
|
|
113
123
|
/**
|
|
114
|
-
* @deprecated since version 1.1.
|
|
124
|
+
* @deprecated since version 1.1.19. Use `token.name` instead.
|
|
115
125
|
*/
|
|
116
126
|
name,
|
|
117
127
|
/**
|
|
118
|
-
* @deprecated since version 1.1.
|
|
128
|
+
* @deprecated since version 1.1.19. Use `token.iconUrl` instead.
|
|
119
129
|
*/
|
|
120
130
|
iconUrl,
|
|
121
131
|
/**
|
|
122
|
-
* @deprecated since version 1.1.
|
|
132
|
+
* @deprecated since version 1.1.19. Use `token.description` instead.
|
|
123
133
|
*/
|
|
124
134
|
description,
|
|
125
135
|
/**
|
package/utils/obligation.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
36
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
37
|
return new (P || (P = Promise))(function (resolve, reject) {
|