@everlend/api
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -33,2 +33,3 @@ /// <reference types="node" /> | ||
amountBorrowed: u64; | ||
oracle: PublicKey; | ||
}[]>; | ||
@@ -44,2 +45,3 @@ getCollateralTokens(): Promise<{ | ||
ratioHealthy: u64; | ||
oracle: PublicKey; | ||
}[]>; | ||
@@ -55,2 +57,3 @@ getLiquidityInfo(liquidityPubkey: PublicKey): Promise<{ | ||
amountBorrowed: u64; | ||
oracle: PublicKey; | ||
}>; | ||
@@ -66,2 +69,3 @@ getCollateralInfo(collateralPubkey: PublicKey): Promise<{ | ||
ratioHealthy: u64; | ||
oracle: PublicKey; | ||
}>; | ||
@@ -91,10 +95,12 @@ getObligationInfo(obligatioPubkey: PublicKey): Promise<{ | ||
getMintDecimals(pubkey: PublicKey): Promise<any>; | ||
obligationCollateralDepositTx(obligationPubkey: PublicKey, collateralPubkey: PublicKey, uiAmount: number, source: PublicKey, userTransferAuthority: PublicKey): Promise<Transaction>; | ||
obligationCollateralDeposit(obligationPubkey: PublicKey, collateralPubkey: PublicKey, uiAmount: number, source: PublicKey, payer?: Signer): Promise<void>; | ||
obligationCollateralWithdrawTx(obligationPubkey: PublicKey, collateralPubkey: PublicKey, uiAmount: number, destination: PublicKey, obligationOwner: PublicKey): Promise<Transaction>; | ||
obligationCollateralWithdraw(obligationPubkey: PublicKey, collateralPubkey: PublicKey, uiAmount: number, destination: PublicKey, payer?: Signer): Promise<void>; | ||
obligationLiquidityBorrowTx(obligationPubkey: PublicKey, liquidityPubkey: PublicKey, collateralPubkey: PublicKey, uiAmount: number, destination: PublicKey, obligationOwner: PublicKey): Promise<Transaction>; | ||
obligationLiquidityBorrow(obligationPubkey: PublicKey, liquidityPubkey: PublicKey, collateralPubkey: PublicKey, uiAmount: number, destination: PublicKey, payer?: Signer): Promise<void>; | ||
obligationLiquidityRepayTx(obligationPubkey: PublicKey, liquidityPubkey: PublicKey, uiAmount: number, source: PublicKey, userTransferAuthority: PublicKey): Promise<Transaction>; | ||
obligationLiquidityRepay(obligationPubkey: PublicKey, liquidityPubkey: PublicKey, uiAmount: number, source: PublicKey, payer?: Signer): Promise<void>; | ||
obligationCollateralDepositTx(obligationPubkey: PublicKey, uiAmount: number, source: PublicKey, userTransferAuthority: PublicKey): Promise<Transaction>; | ||
obligationCollateralDeposit(obligationPubkey: PublicKey, uiAmount: number, source: PublicKey, payer?: Signer): Promise<void>; | ||
obligationCollateralWithdrawTx(obligationPubkey: PublicKey, uiAmount: number, destination: PublicKey): Promise<Transaction>; | ||
obligationCollateralWithdraw(obligationPubkey: PublicKey, uiAmount: number, destination: PublicKey, payer?: Signer): Promise<void>; | ||
obligationLiquidityBorrowTx(obligationPubkey: PublicKey, uiAmount: number, destination: PublicKey): Promise<Transaction>; | ||
obligationLiquidityBorrow(obligationPubkey: PublicKey, uiAmount: number, destination: PublicKey, payer?: Signer): Promise<void>; | ||
obligationLiquidityRepayTx(obligationPubkey: PublicKey, uiAmount: number, source: PublicKey, userTransferAuthority: PublicKey): Promise<Transaction>; | ||
obligationLiquidityRepay(obligationPubkey: PublicKey, uiAmount: number, source: PublicKey, payer?: Signer): Promise<void>; | ||
liquidateObligationTx(obligationPubkey: PublicKey, source: PublicKey, destination: PublicKey, userTransferAuthority: PublicKey): Promise<Transaction>; | ||
liquidateObligation(obligationPubkey: PublicKey, source: PublicKey, destination: PublicKey, payer?: Signer): Promise<void>; | ||
} |
@@ -41,3 +41,3 @@ "use strict"; | ||
const transaction_1 = require("./transaction"); | ||
exports.PROGRAM_ID = new web3_js_1.PublicKey('69LK6qziCCnqgmUPYpuiJ2y8JavKVRrCZ4pDekSyDZTn'); | ||
exports.PROGRAM_ID = new web3_js_1.PublicKey('CeGmkTwwswnRowjTFCMXf1Y5LaE3RqF6YqdmJfrQGRPb'); | ||
__exportStar(require("./instruction"), exports); | ||
@@ -254,5 +254,6 @@ __exportStar(require("./transaction"), exports); | ||
} | ||
obligationCollateralDepositTx(obligationPubkey, collateralPubkey, uiAmount, source, userTransferAuthority) { | ||
obligationCollateralDepositTx(obligationPubkey, uiAmount, source, userTransferAuthority) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const collateral = yield this.getCollateralInfo(collateralPubkey); | ||
const obligation = yield this.getObligationInfo(obligationPubkey); | ||
const collateral = yield this.getCollateralInfo(obligation.collateral); | ||
const amount = new spl_token_1.u64(uiAmount * Math.pow(10, yield this.getMintDecimals(collateral.tokenMint))); | ||
@@ -263,3 +264,3 @@ const tx = new web3_js_1.Transaction().add(Instruction.obligationCollateralDeposit({ | ||
obligation: obligationPubkey, | ||
collateral: collateralPubkey, | ||
collateral: obligation.collateral, | ||
source, | ||
@@ -273,5 +274,5 @@ collateralTokenAccount: collateral.tokenAccount, | ||
} | ||
obligationCollateralDeposit(obligationPubkey, collateralPubkey, uiAmount, source, payer = this.payer) { | ||
obligationCollateralDeposit(obligationPubkey, uiAmount, source, payer = this.payer) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const tx = yield this.obligationCollateralDepositTx(obligationPubkey, collateralPubkey, uiAmount, source, payer.publicKey); | ||
const tx = yield this.obligationCollateralDepositTx(obligationPubkey, uiAmount, source, payer.publicKey); | ||
const signature = yield web3_js_1.sendAndConfirmTransaction(this.connection, tx, [payer]); | ||
@@ -281,5 +282,7 @@ console.log(`Signature: ${signature}`); | ||
} | ||
obligationCollateralWithdrawTx(obligationPubkey, collateralPubkey, uiAmount, destination, obligationOwner) { | ||
obligationCollateralWithdrawTx(obligationPubkey, uiAmount, destination) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const collateral = yield this.getCollateralInfo(collateralPubkey); | ||
const obligation = yield this.getObligationInfo(obligationPubkey); | ||
const liquidity = yield this.getLiquidityInfo(obligation.liquidity); | ||
const collateral = yield this.getCollateralInfo(obligation.collateral); | ||
const [marketAuthority] = yield web3_js_1.PublicKey.findProgramAddress([this.pubkey.toBuffer()], this.programId); | ||
@@ -291,8 +294,11 @@ const amount = new spl_token_1.u64(uiAmount * Math.pow(10, yield this.getMintDecimals(collateral.tokenMint))); | ||
obligation: obligationPubkey, | ||
collateral: collateralPubkey, | ||
liquidity: obligation.liquidity, | ||
collateral: obligation.collateral, | ||
destination, | ||
collateralTokenAccount: collateral.tokenAccount, | ||
obligationOwner, | ||
obligationOwner: obligation.owner, | ||
marketAuthority, | ||
amount, | ||
liquidityOracle: liquidity.oracle, | ||
collateralOracle: collateral.oracle, | ||
})); | ||
@@ -302,5 +308,5 @@ return tx; | ||
} | ||
obligationCollateralWithdraw(obligationPubkey, collateralPubkey, uiAmount, destination, payer = this.payer) { | ||
obligationCollateralWithdraw(obligationPubkey, uiAmount, destination, payer = this.payer) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const tx = yield this.obligationCollateralWithdrawTx(obligationPubkey, collateralPubkey, uiAmount, destination, payer.publicKey); | ||
const tx = yield this.obligationCollateralWithdrawTx(obligationPubkey, uiAmount, destination); | ||
const signature = yield web3_js_1.sendAndConfirmTransaction(this.connection, tx, [payer]); | ||
@@ -310,5 +316,7 @@ console.log(`Signature: ${signature}`); | ||
} | ||
obligationLiquidityBorrowTx(obligationPubkey, liquidityPubkey, collateralPubkey, uiAmount, destination, obligationOwner) { | ||
obligationLiquidityBorrowTx(obligationPubkey, uiAmount, destination) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const liquidity = yield this.getLiquidityInfo(liquidityPubkey); | ||
const obligation = yield this.getObligationInfo(obligationPubkey); | ||
const liquidity = yield this.getLiquidityInfo(obligation.liquidity); | ||
const collateral = yield this.getCollateralInfo(obligation.collateral); | ||
const [marketAuthority] = yield web3_js_1.PublicKey.findProgramAddress([this.pubkey.toBuffer()], this.programId); | ||
@@ -320,9 +328,11 @@ const amount = new spl_token_1.u64(uiAmount * Math.pow(10, yield this.getMintDecimals(liquidity.tokenMint))); | ||
obligation: obligationPubkey, | ||
liquidity: liquidityPubkey, | ||
collateral: collateralPubkey, | ||
liquidity: obligation.liquidity, | ||
collateral: obligation.collateral, | ||
destination, | ||
liquidityTokenAccount: liquidity.tokenAccount, | ||
obligationOwner, | ||
obligationOwner: obligation.owner, | ||
marketAuthority, | ||
amount, | ||
liquidityOracle: liquidity.oracle, | ||
collateralOracle: collateral.oracle, | ||
})); | ||
@@ -332,5 +342,5 @@ return tx; | ||
} | ||
obligationLiquidityBorrow(obligationPubkey, liquidityPubkey, collateralPubkey, uiAmount, destination, payer = this.payer) { | ||
obligationLiquidityBorrow(obligationPubkey, uiAmount, destination, payer = this.payer) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const tx = yield this.obligationLiquidityBorrowTx(obligationPubkey, liquidityPubkey, collateralPubkey, uiAmount, destination, payer.publicKey); | ||
const tx = yield this.obligationLiquidityBorrowTx(obligationPubkey, uiAmount, destination); | ||
const signature = yield web3_js_1.sendAndConfirmTransaction(this.connection, tx, [payer]); | ||
@@ -340,5 +350,6 @@ console.log(`Signature: ${signature}`); | ||
} | ||
obligationLiquidityRepayTx(obligationPubkey, liquidityPubkey, uiAmount, source, userTransferAuthority) { | ||
obligationLiquidityRepayTx(obligationPubkey, uiAmount, source, userTransferAuthority) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const liquidity = yield this.getLiquidityInfo(liquidityPubkey); | ||
const obligation = yield this.getObligationInfo(obligationPubkey); | ||
const liquidity = yield this.getLiquidityInfo(obligation.liquidity); | ||
const amount = new spl_token_1.u64(uiAmount * Math.pow(10, yield this.getMintDecimals(liquidity.tokenMint))); | ||
@@ -349,3 +360,3 @@ const tx = new web3_js_1.Transaction().add(Instruction.obligationLiquidityRepay({ | ||
obligation: obligationPubkey, | ||
liquidity: liquidityPubkey, | ||
liquidity: obligation.liquidity, | ||
source, | ||
@@ -359,5 +370,5 @@ liquidityTokenAccount: liquidity.tokenAccount, | ||
} | ||
obligationLiquidityRepay(obligationPubkey, liquidityPubkey, uiAmount, source, payer = this.payer) { | ||
obligationLiquidityRepay(obligationPubkey, uiAmount, source, payer = this.payer) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const tx = yield this.obligationLiquidityRepayTx(obligationPubkey, liquidityPubkey, uiAmount, source, payer.publicKey); | ||
const tx = yield this.obligationLiquidityRepayTx(obligationPubkey, uiAmount, source, payer.publicKey); | ||
const signature = yield web3_js_1.sendAndConfirmTransaction(this.connection, tx, [payer]); | ||
@@ -367,4 +378,35 @@ console.log(`Signature: ${signature}`); | ||
} | ||
liquidateObligationTx(obligationPubkey, source, destination, userTransferAuthority) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const obligation = yield this.getObligationInfo(obligationPubkey); | ||
const liquidity = yield this.getLiquidityInfo(obligation.liquidity); | ||
const collateral = yield this.getCollateralInfo(obligation.collateral); | ||
const [marketAuthority] = yield web3_js_1.PublicKey.findProgramAddress([this.pubkey.toBuffer()], this.programId); | ||
const tx = new web3_js_1.Transaction().add(Instruction.liquidateObligation({ | ||
programId: this.programId, | ||
market: this.pubkey, | ||
obligation: obligationPubkey, | ||
source, | ||
destination, | ||
liquidity: obligation.liquidity, | ||
collateral: obligation.collateral, | ||
liquidityTokenAccount: liquidity.tokenAccount, | ||
collateralTokenAccount: collateral.tokenAccount, | ||
userTransferAuthority, | ||
marketAuthority, | ||
liquidityOracle: liquidity.oracle, | ||
collateralOracle: collateral.oracle, | ||
})); | ||
return tx; | ||
}); | ||
} | ||
liquidateObligation(obligationPubkey, source, destination, payer = this.payer) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const tx = yield this.liquidateObligationTx(obligationPubkey, source, destination, payer.publicKey); | ||
const signature = yield web3_js_1.sendAndConfirmTransaction(this.connection, tx, [payer]); | ||
console.log(`Signature: ${signature}`); | ||
}); | ||
} | ||
} | ||
exports.LendingMarket = LendingMarket; | ||
//# sourceMappingURL=index.js.map |
@@ -52,2 +52,3 @@ import { u64 } from '@solana/spl-token'; | ||
obligation: PublicKey; | ||
liquidity: PublicKey; | ||
collateral: PublicKey; | ||
@@ -58,5 +59,7 @@ destination: PublicKey; | ||
marketAuthority: PublicKey; | ||
liquidityOracle: PublicKey; | ||
collateralOracle: PublicKey; | ||
amount: u64; | ||
}; | ||
export declare const obligationCollateralWithdraw: ({ programId, market, obligation, collateral, destination, collateralTokenAccount, obligationOwner, marketAuthority, amount, }: ObligationCollateralWithdrawParams) => TransactionInstruction; | ||
export declare const obligationCollateralWithdraw: ({ programId, market, liquidity, obligation, collateral, destination, collateralTokenAccount, obligationOwner, marketAuthority, liquidityOracle, collateralOracle, amount, }: ObligationCollateralWithdrawParams) => TransactionInstruction; | ||
export declare type ObligationLiquidityBorrowParams = BaseInstructionParams & { | ||
@@ -71,5 +74,7 @@ market: PublicKey; | ||
marketAuthority: PublicKey; | ||
liquidityOracle: PublicKey; | ||
collateralOracle: PublicKey; | ||
amount: u64; | ||
}; | ||
export declare const obligationLiquidityBorrow: ({ programId, market, obligation, liquidity, collateral, destination, liquidityTokenAccount, obligationOwner, marketAuthority, amount, }: ObligationLiquidityBorrowParams) => TransactionInstruction; | ||
export declare const obligationLiquidityBorrow: ({ programId, market, obligation, liquidity, collateral, destination, liquidityTokenAccount, obligationOwner, marketAuthority, liquidityOracle, collateralOracle, amount, }: ObligationLiquidityBorrowParams) => TransactionInstruction; | ||
export declare type ObligationLiquidityRepayParams = BaseInstructionParams & { | ||
@@ -85,2 +90,17 @@ market: PublicKey; | ||
export declare const obligationLiquidityRepay: ({ programId, market, obligation, liquidity, source, liquidityTokenAccount, userTransferAuthority, amount, }: ObligationLiquidityRepayParams) => TransactionInstruction; | ||
export declare type LiquidateObligationParams = BaseInstructionParams & { | ||
market: PublicKey; | ||
obligation: PublicKey; | ||
source: PublicKey; | ||
destination: PublicKey; | ||
liquidity: PublicKey; | ||
collateral: PublicKey; | ||
liquidityTokenAccount: PublicKey; | ||
collateralTokenAccount: PublicKey; | ||
userTransferAuthority: PublicKey; | ||
marketAuthority: PublicKey; | ||
liquidityOracle: PublicKey; | ||
collateralOracle: PublicKey; | ||
}; | ||
export declare const liquidateObligation: ({ programId, market, obligation, source, destination, liquidity, collateral, liquidityTokenAccount, collateralTokenAccount, userTransferAuthority, marketAuthority, liquidityOracle, collateralOracle, }: LiquidateObligationParams) => TransactionInstruction; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.obligationLiquidityRepay = exports.obligationLiquidityBorrow = exports.obligationCollateralWithdraw = exports.obligationCollateralDeposit = exports.createObligation = exports.liquidityWithdraw = exports.liquidityDeposit = void 0; | ||
exports.liquidateObligation = exports.obligationLiquidityRepay = exports.obligationLiquidityBorrow = exports.obligationCollateralWithdraw = exports.obligationCollateralDeposit = exports.createObligation = exports.liquidityWithdraw = exports.liquidityDeposit = void 0; | ||
const spl_token_1 = require("@solana/spl-token"); | ||
@@ -87,3 +87,3 @@ const web3_js_1 = require("@solana/web3.js"); | ||
exports.obligationCollateralDeposit = obligationCollateralDeposit; | ||
const obligationCollateralWithdraw = ({ programId, market, obligation, collateral, destination, collateralTokenAccount, obligationOwner, marketAuthority, amount, }) => { | ||
const obligationCollateralWithdraw = ({ programId, market, liquidity, obligation, collateral, destination, collateralTokenAccount, obligationOwner, marketAuthority, liquidityOracle, collateralOracle, amount, }) => { | ||
const data = utils_1.encodeData(layout_1.MarketInsructionLayouts.ObligationCollateralWithdraw, { | ||
@@ -95,2 +95,3 @@ amount: new spl_token_1.u64(amount).toBuffer(), | ||
{ pubkey: obligation, isSigner: false, isWritable: true }, | ||
{ pubkey: liquidity, isSigner: false, isWritable: false }, | ||
{ pubkey: collateral, isSigner: false, isWritable: false }, | ||
@@ -102,2 +103,5 @@ { pubkey: destination, isSigner: false, isWritable: true }, | ||
{ pubkey: marketAuthority, isSigner: false, isWritable: false }, | ||
{ pubkey: liquidityOracle, isSigner: false, isWritable: false }, | ||
{ pubkey: collateralOracle, isSigner: false, isWritable: false }, | ||
{ pubkey: web3_js_1.SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false }, | ||
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false }, | ||
@@ -110,3 +114,3 @@ ], | ||
exports.obligationCollateralWithdraw = obligationCollateralWithdraw; | ||
const obligationLiquidityBorrow = ({ programId, market, obligation, liquidity, collateral, destination, liquidityTokenAccount, obligationOwner, marketAuthority, amount, }) => { | ||
const obligationLiquidityBorrow = ({ programId, market, obligation, liquidity, collateral, destination, liquidityTokenAccount, obligationOwner, marketAuthority, liquidityOracle, collateralOracle, amount, }) => { | ||
const data = utils_1.encodeData(layout_1.MarketInsructionLayouts.ObligationLiquidityBorrow, { | ||
@@ -125,2 +129,5 @@ amount: new spl_token_1.u64(amount).toBuffer(), | ||
{ pubkey: marketAuthority, isSigner: false, isWritable: false }, | ||
{ pubkey: liquidityOracle, isSigner: false, isWritable: false }, | ||
{ pubkey: collateralOracle, isSigner: false, isWritable: false }, | ||
{ pubkey: web3_js_1.SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false }, | ||
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false }, | ||
@@ -152,2 +159,26 @@ ], | ||
exports.obligationLiquidityRepay = obligationLiquidityRepay; | ||
const liquidateObligation = ({ programId, market, obligation, source, destination, liquidity, collateral, liquidityTokenAccount, collateralTokenAccount, userTransferAuthority, marketAuthority, liquidityOracle, collateralOracle, }) => { | ||
const data = utils_1.encodeData(layout_1.MarketInsructionLayouts.LiquidateObligation); | ||
return new web3_js_1.TransactionInstruction({ | ||
keys: [ | ||
{ pubkey: obligation, isSigner: false, isWritable: true }, | ||
{ pubkey: source, isSigner: false, isWritable: true }, | ||
{ pubkey: destination, isSigner: false, isWritable: true }, | ||
{ pubkey: liquidity, isSigner: false, isWritable: true }, | ||
{ pubkey: collateral, isSigner: false, isWritable: true }, | ||
{ pubkey: liquidityTokenAccount, isSigner: false, isWritable: true }, | ||
{ pubkey: collateralTokenAccount, isSigner: false, isWritable: true }, | ||
{ pubkey: market, isSigner: false, isWritable: false }, | ||
{ pubkey: userTransferAuthority, isSigner: true, isWritable: false }, | ||
{ pubkey: marketAuthority, isSigner: false, isWritable: false }, | ||
{ pubkey: liquidityOracle, isSigner: false, isWritable: false }, | ||
{ pubkey: collateralOracle, isSigner: false, isWritable: false }, | ||
{ pubkey: web3_js_1.SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false }, | ||
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false }, | ||
], | ||
programId: new web3_js_1.PublicKey(programId), | ||
data, | ||
}); | ||
}; | ||
exports.liquidateObligation = liquidateObligation; | ||
//# sourceMappingURL=instruction.js.map |
@@ -35,2 +35,6 @@ export declare const InstructionLayout: any; | ||
}; | ||
LiquidateObligation: { | ||
index: number; | ||
layout: any; | ||
}; | ||
}; |
@@ -43,2 +43,3 @@ "use strict"; | ||
BaseLayout.uint64('amount_borrowed'), | ||
BaseLayout.publicKey('oracle'), | ||
]); | ||
@@ -53,2 +54,3 @@ exports.CollateralLayout = buffer_layout_1.default.struct([ | ||
BaseLayout.uint64('ratio_healthy'), | ||
BaseLayout.publicKey('oracle'), | ||
]); | ||
@@ -93,3 +95,7 @@ exports.ObligationLayout = buffer_layout_1.default.struct([ | ||
}, | ||
LiquidateObligation: { | ||
index: 12, | ||
layout: buffer_layout_1.default.struct([exports.InstructionLayout]), | ||
}, | ||
}; | ||
//# sourceMappingURL=layout.js.map |
@@ -25,3 +25,4 @@ /// <reference types="node" /> | ||
amountBorrowed: u64; | ||
constructor(version: number, status: LiquidityStatus, market: PublicKey, tokenMint: PublicKey, tokenAccount: PublicKey, poolMint: PublicKey, amountBorrowed: u64); | ||
oracle: PublicKey; | ||
constructor(version: number, status: LiquidityStatus, market: PublicKey, tokenMint: PublicKey, tokenAccount: PublicKey, poolMint: PublicKey, amountBorrowed: u64, oracle: PublicKey); | ||
static from(buffer: Buffer): Liquidity; | ||
@@ -42,3 +43,4 @@ } | ||
ratioHealthy: u64; | ||
constructor(version: number, status: CollateralStatus, market: PublicKey, tokenMint: PublicKey, tokenAccount: PublicKey, ratioInitial: u64, ratioHealthy: u64); | ||
oracle: PublicKey; | ||
constructor(version: number, status: CollateralStatus, market: PublicKey, tokenMint: PublicKey, tokenAccount: PublicKey, ratioInitial: u64, ratioHealthy: u64, oracle: PublicKey); | ||
static from(buffer: Buffer): Collateral; | ||
@@ -45,0 +47,0 @@ } |
@@ -32,3 +32,3 @@ "use strict"; | ||
class Liquidity { | ||
constructor(version, status, market, tokenMint, tokenAccount, poolMint, amountBorrowed) { | ||
constructor(version, status, market, tokenMint, tokenAccount, poolMint, amountBorrowed, oracle) { | ||
this.version = version; | ||
@@ -41,5 +41,6 @@ this.status = status; | ||
this.amountBorrowed = amountBorrowed; | ||
this.oracle = oracle; | ||
} | ||
static from(buffer) { | ||
const { version, status, market, token_mint, token_account, pool_mint, amount_borrowed } = layout_1.LiquidityLayout.decode(buffer); | ||
const { version, status, market, token_mint, token_account, pool_mint, amount_borrowed, oracle, } = layout_1.LiquidityLayout.decode(buffer); | ||
return { | ||
@@ -53,2 +54,3 @@ version, | ||
amountBorrowed: spl_token_1.u64.fromBuffer(amount_borrowed), | ||
oracle: new web3_js_1.PublicKey(oracle), | ||
}; | ||
@@ -65,3 +67,3 @@ } | ||
class Collateral { | ||
constructor(version, status, market, tokenMint, tokenAccount, ratioInitial, ratioHealthy) { | ||
constructor(version, status, market, tokenMint, tokenAccount, ratioInitial, ratioHealthy, oracle) { | ||
this.version = version; | ||
@@ -74,5 +76,6 @@ this.status = status; | ||
this.ratioHealthy = ratioHealthy; | ||
this.oracle = oracle; | ||
} | ||
static from(buffer) { | ||
const { version, status, market, token_mint, token_account, ratio_initial, ratio_healthy } = layout_1.CollateralLayout.decode(buffer); | ||
const { version, status, market, token_mint, token_account, ratio_initial, ratio_healthy, oracle, } = layout_1.CollateralLayout.decode(buffer); | ||
return { | ||
@@ -86,2 +89,3 @@ version, | ||
ratioHealthy: spl_token_1.u64.fromBuffer(ratio_healthy), | ||
oracle: new web3_js_1.PublicKey(oracle), | ||
}; | ||
@@ -88,0 +92,0 @@ } |
{ | ||
"name": "@everlend/api", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
146
src/index.ts
@@ -15,3 +15,3 @@ import { MintLayout, Token, u64 } from '@solana/spl-token' | ||
export const PROGRAM_ID: PublicKey = new PublicKey('69LK6qziCCnqgmUPYpuiJ2y8JavKVRrCZ4pDekSyDZTn') | ||
export const PROGRAM_ID: PublicKey = new PublicKey('CeGmkTwwswnRowjTFCMXf1Y5LaE3RqF6YqdmJfrQGRPb') | ||
@@ -135,7 +135,2 @@ export * from './instruction' | ||
/** | ||
* Generate liquidity accounts for source & destination | ||
* @param liquidityPubkey Liquidity pubkey | ||
* @returns [liquidity token account, pool account] | ||
*/ | ||
async generateProviderAccounts(liquidityPubkey: PublicKey, payer = this.payer) { | ||
@@ -173,8 +168,2 @@ const liquidity = await this.getLiquidityInfo(liquidityPubkey) | ||
/** | ||
* Generate collateral accounts | ||
* @param liquidityPubkey Liquidity Pubkey | ||
* @param collateralPubkey Collateral Pubkey | ||
* @returns [liquidity token account, collateral token account] | ||
*/ | ||
async generateBorrowerAccounts( | ||
@@ -253,10 +242,2 @@ liquidityPubkey: PublicKey, | ||
/** | ||
* Transfer tokens to liquidity account and mint pool tokens | ||
* @param liquidityPubkey Liquidity pubkey | ||
* @param uiAmount Amount tokens to deposit | ||
* @param source Source account of token mint | ||
* @param destination Destination account of pool mint | ||
* @param payer Signer for transfer tokens | ||
*/ | ||
async liquidityDeposit( | ||
@@ -314,10 +295,2 @@ liquidityPubkey: PublicKey, | ||
/** | ||
* Burn pool tokens and transfer liquidity tokens | ||
* @param liquidityPubkey Liquidity pubkey | ||
* @param uiAmount Amount tokens to deposit | ||
* @param source Source account of pool mint | ||
* @param destination Destination account of token account | ||
* @param payer Signer for transfer tokens | ||
*/ | ||
async liquidityWithdraw( | ||
@@ -403,3 +376,2 @@ liquidityPubkey: PublicKey, | ||
obligationPubkey: PublicKey, | ||
collateralPubkey: PublicKey, | ||
uiAmount: number, | ||
@@ -409,3 +381,4 @@ source: PublicKey, | ||
) { | ||
const collateral = await this.getCollateralInfo(collateralPubkey) | ||
const obligation = await this.getObligationInfo(obligationPubkey) | ||
const collateral = await this.getCollateralInfo(obligation.collateral) | ||
@@ -421,3 +394,3 @@ const amount = new u64( | ||
obligation: obligationPubkey, | ||
collateral: collateralPubkey, | ||
collateral: obligation.collateral, | ||
source, | ||
@@ -435,3 +408,2 @@ collateralTokenAccount: collateral.tokenAccount, | ||
obligationPubkey: PublicKey, | ||
collateralPubkey: PublicKey, | ||
uiAmount: number, | ||
@@ -443,3 +415,2 @@ source: PublicKey, | ||
obligationPubkey, | ||
collateralPubkey, | ||
uiAmount, | ||
@@ -456,8 +427,8 @@ source, | ||
obligationPubkey: PublicKey, | ||
collateralPubkey: PublicKey, | ||
uiAmount: number, | ||
destination: PublicKey, | ||
obligationOwner: PublicKey, | ||
) { | ||
const collateral = await this.getCollateralInfo(collateralPubkey) | ||
const obligation = await this.getObligationInfo(obligationPubkey) | ||
const liquidity = await this.getLiquidityInfo(obligation.liquidity) | ||
const collateral = await this.getCollateralInfo(obligation.collateral) | ||
@@ -477,8 +448,11 @@ const [marketAuthority] = await PublicKey.findProgramAddress( | ||
obligation: obligationPubkey, | ||
collateral: collateralPubkey, | ||
liquidity: obligation.liquidity, | ||
collateral: obligation.collateral, | ||
destination, | ||
collateralTokenAccount: collateral.tokenAccount, | ||
obligationOwner, | ||
obligationOwner: obligation.owner, | ||
marketAuthority, | ||
amount, | ||
liquidityOracle: liquidity.oracle, | ||
collateralOracle: collateral.oracle, | ||
}), | ||
@@ -492,3 +466,2 @@ ) | ||
obligationPubkey: PublicKey, | ||
collateralPubkey: PublicKey, | ||
uiAmount: number, | ||
@@ -498,9 +471,3 @@ destination: PublicKey, | ||
) { | ||
const tx = await this.obligationCollateralWithdrawTx( | ||
obligationPubkey, | ||
collateralPubkey, | ||
uiAmount, | ||
destination, | ||
payer.publicKey, | ||
) | ||
const tx = await this.obligationCollateralWithdrawTx(obligationPubkey, uiAmount, destination) | ||
@@ -513,9 +480,8 @@ const signature = await sendAndConfirmTransaction(this.connection, tx, [payer]) | ||
obligationPubkey: PublicKey, | ||
liquidityPubkey: PublicKey, | ||
collateralPubkey: PublicKey, | ||
uiAmount: number, | ||
destination: PublicKey, | ||
obligationOwner: PublicKey, | ||
) { | ||
const liquidity = await this.getLiquidityInfo(liquidityPubkey) | ||
const obligation = await this.getObligationInfo(obligationPubkey) | ||
const liquidity = await this.getLiquidityInfo(obligation.liquidity) | ||
const collateral = await this.getCollateralInfo(obligation.collateral) | ||
@@ -533,9 +499,11 @@ const [marketAuthority] = await PublicKey.findProgramAddress( | ||
obligation: obligationPubkey, | ||
liquidity: liquidityPubkey, | ||
collateral: collateralPubkey, | ||
liquidity: obligation.liquidity, | ||
collateral: obligation.collateral, | ||
destination, | ||
liquidityTokenAccount: liquidity.tokenAccount, | ||
obligationOwner, | ||
obligationOwner: obligation.owner, | ||
marketAuthority, | ||
amount, | ||
liquidityOracle: liquidity.oracle, | ||
collateralOracle: collateral.oracle, | ||
}), | ||
@@ -549,4 +517,2 @@ ) | ||
obligationPubkey: PublicKey, | ||
liquidityPubkey: PublicKey, | ||
collateralPubkey: PublicKey, | ||
uiAmount: number, | ||
@@ -556,10 +522,3 @@ destination: PublicKey, | ||
) { | ||
const tx = await this.obligationLiquidityBorrowTx( | ||
obligationPubkey, | ||
liquidityPubkey, | ||
collateralPubkey, | ||
uiAmount, | ||
destination, | ||
payer.publicKey, | ||
) | ||
const tx = await this.obligationLiquidityBorrowTx(obligationPubkey, uiAmount, destination) | ||
@@ -572,3 +531,2 @@ const signature = await sendAndConfirmTransaction(this.connection, tx, [payer]) | ||
obligationPubkey: PublicKey, | ||
liquidityPubkey: PublicKey, | ||
uiAmount: number, | ||
@@ -578,3 +536,4 @@ source: PublicKey, | ||
) { | ||
const liquidity = await this.getLiquidityInfo(liquidityPubkey) | ||
const obligation = await this.getObligationInfo(obligationPubkey) | ||
const liquidity = await this.getLiquidityInfo(obligation.liquidity) | ||
@@ -588,3 +547,3 @@ const amount = new u64(uiAmount * Math.pow(10, await this.getMintDecimals(liquidity.tokenMint))) | ||
obligation: obligationPubkey, | ||
liquidity: liquidityPubkey, | ||
liquidity: obligation.liquidity, | ||
source, | ||
@@ -602,3 +561,2 @@ liquidityTokenAccount: liquidity.tokenAccount, | ||
obligationPubkey: PublicKey, | ||
liquidityPubkey: PublicKey, | ||
uiAmount: number, | ||
@@ -610,3 +568,2 @@ source: PublicKey, | ||
obligationPubkey, | ||
liquidityPubkey, | ||
uiAmount, | ||
@@ -620,2 +577,55 @@ source, | ||
} | ||
async liquidateObligationTx( | ||
obligationPubkey: PublicKey, | ||
source: PublicKey, | ||
destination: PublicKey, | ||
userTransferAuthority: PublicKey, | ||
) { | ||
const obligation = await this.getObligationInfo(obligationPubkey) | ||
const liquidity = await this.getLiquidityInfo(obligation.liquidity) | ||
const collateral = await this.getCollateralInfo(obligation.collateral) | ||
const [marketAuthority] = await PublicKey.findProgramAddress( | ||
[this.pubkey.toBuffer()], | ||
this.programId, | ||
) | ||
const tx = new Transaction().add( | ||
Instruction.liquidateObligation({ | ||
programId: this.programId, | ||
market: this.pubkey, | ||
obligation: obligationPubkey, | ||
source, | ||
destination, | ||
liquidity: obligation.liquidity, | ||
collateral: obligation.collateral, | ||
liquidityTokenAccount: liquidity.tokenAccount, | ||
collateralTokenAccount: collateral.tokenAccount, | ||
userTransferAuthority, | ||
marketAuthority, | ||
liquidityOracle: liquidity.oracle, | ||
collateralOracle: collateral.oracle, | ||
}), | ||
) | ||
return tx | ||
} | ||
async liquidateObligation( | ||
obligationPubkey: PublicKey, | ||
source: PublicKey, | ||
destination: PublicKey, | ||
payer = this.payer, | ||
) { | ||
const tx = await this.liquidateObligationTx( | ||
obligationPubkey, | ||
source, | ||
destination, | ||
payer.publicKey, | ||
) | ||
const signature = await sendAndConfirmTransaction(this.connection, tx, [payer]) | ||
console.log(`Signature: ${signature}`) | ||
} | ||
} |
@@ -5,2 +5,3 @@ import { TOKEN_PROGRAM_ID, u64 } from '@solana/spl-token' | ||
SystemProgram, | ||
SYSVAR_CLOCK_PUBKEY, | ||
SYSVAR_RENT_PUBKEY, | ||
@@ -178,2 +179,3 @@ TransactionInstruction, | ||
obligation: PublicKey | ||
liquidity: PublicKey | ||
collateral: PublicKey | ||
@@ -184,2 +186,4 @@ destination: PublicKey | ||
marketAuthority: PublicKey | ||
liquidityOracle: PublicKey | ||
collateralOracle: PublicKey | ||
amount: u64 | ||
@@ -190,2 +194,3 @@ } | ||
market, | ||
liquidity, | ||
obligation, | ||
@@ -197,2 +202,4 @@ collateral, | ||
marketAuthority, | ||
liquidityOracle, | ||
collateralOracle, | ||
amount, | ||
@@ -207,2 +214,3 @@ }: ObligationCollateralWithdrawParams) => { | ||
{ pubkey: obligation, isSigner: false, isWritable: true }, | ||
{ pubkey: liquidity, isSigner: false, isWritable: false }, | ||
{ pubkey: collateral, isSigner: false, isWritable: false }, | ||
@@ -214,2 +222,5 @@ { pubkey: destination, isSigner: false, isWritable: true }, | ||
{ pubkey: marketAuthority, isSigner: false, isWritable: false }, | ||
{ pubkey: liquidityOracle, isSigner: false, isWritable: false }, | ||
{ pubkey: collateralOracle, isSigner: false, isWritable: false }, | ||
{ pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false }, | ||
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false }, | ||
@@ -231,2 +242,4 @@ ], | ||
marketAuthority: PublicKey | ||
liquidityOracle: PublicKey | ||
collateralOracle: PublicKey | ||
amount: u64 | ||
@@ -244,2 +257,4 @@ } | ||
marketAuthority, | ||
liquidityOracle, | ||
collateralOracle, | ||
amount, | ||
@@ -261,2 +276,5 @@ }: ObligationLiquidityBorrowParams) => { | ||
{ pubkey: marketAuthority, isSigner: false, isWritable: false }, | ||
{ pubkey: liquidityOracle, isSigner: false, isWritable: false }, | ||
{ pubkey: collateralOracle, isSigner: false, isWritable: false }, | ||
{ pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false }, | ||
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false }, | ||
@@ -306,1 +324,54 @@ ], | ||
} | ||
export type LiquidateObligationParams = BaseInstructionParams & { | ||
market: PublicKey | ||
obligation: PublicKey | ||
source: PublicKey | ||
destination: PublicKey | ||
liquidity: PublicKey | ||
collateral: PublicKey | ||
liquidityTokenAccount: PublicKey | ||
collateralTokenAccount: PublicKey | ||
userTransferAuthority: PublicKey | ||
marketAuthority: PublicKey | ||
liquidityOracle: PublicKey | ||
collateralOracle: PublicKey | ||
} | ||
export const liquidateObligation = ({ | ||
programId, | ||
market, | ||
obligation, | ||
source, | ||
destination, | ||
liquidity, | ||
collateral, | ||
liquidityTokenAccount, | ||
collateralTokenAccount, | ||
userTransferAuthority, | ||
marketAuthority, | ||
liquidityOracle, | ||
collateralOracle, | ||
}: LiquidateObligationParams) => { | ||
const data = encodeData(MarketInsructionLayouts.LiquidateObligation) | ||
return new TransactionInstruction({ | ||
keys: [ | ||
{ pubkey: obligation, isSigner: false, isWritable: true }, | ||
{ pubkey: source, isSigner: false, isWritable: true }, | ||
{ pubkey: destination, isSigner: false, isWritable: true }, | ||
{ pubkey: liquidity, isSigner: false, isWritable: true }, | ||
{ pubkey: collateral, isSigner: false, isWritable: true }, | ||
{ pubkey: liquidityTokenAccount, isSigner: false, isWritable: true }, | ||
{ pubkey: collateralTokenAccount, isSigner: false, isWritable: true }, | ||
{ pubkey: market, isSigner: false, isWritable: false }, | ||
{ pubkey: userTransferAuthority, isSigner: true, isWritable: false }, | ||
{ pubkey: marketAuthority, isSigner: false, isWritable: false }, | ||
{ pubkey: liquidityOracle, isSigner: false, isWritable: false }, | ||
{ pubkey: collateralOracle, isSigner: false, isWritable: false }, | ||
{ pubkey: SYSVAR_CLOCK_PUBKEY, isSigner: false, isWritable: false }, | ||
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false }, | ||
], | ||
programId: new PublicKey(programId), | ||
data, | ||
}) | ||
} |
@@ -21,2 +21,3 @@ import BufferLayout from 'buffer-layout' | ||
BaseLayout.uint64('amount_borrowed'), | ||
BaseLayout.publicKey('oracle'), | ||
]) | ||
@@ -32,2 +33,3 @@ | ||
BaseLayout.uint64('ratio_healthy'), | ||
BaseLayout.publicKey('oracle'), | ||
]) | ||
@@ -74,2 +76,6 @@ | ||
}, | ||
LiquidateObligation: { | ||
index: 12, | ||
layout: BufferLayout.struct([InstructionLayout]), | ||
}, | ||
} |
@@ -40,7 +40,16 @@ import { u64 } from '@solana/spl-token' | ||
public amountBorrowed: u64, | ||
public oracle: PublicKey, | ||
) {} | ||
static from(buffer: Buffer): Liquidity { | ||
const { version, status, market, token_mint, token_account, pool_mint, amount_borrowed } = | ||
LiquidityLayout.decode(buffer) | ||
const { | ||
version, | ||
status, | ||
market, | ||
token_mint, | ||
token_account, | ||
pool_mint, | ||
amount_borrowed, | ||
oracle, | ||
} = LiquidityLayout.decode(buffer) | ||
@@ -55,2 +64,3 @@ return { | ||
amountBorrowed: u64.fromBuffer(amount_borrowed), | ||
oracle: new PublicKey(oracle), | ||
} | ||
@@ -75,7 +85,16 @@ } | ||
public ratioHealthy: u64, | ||
public oracle: PublicKey, | ||
) {} | ||
static from(buffer: Buffer): Collateral { | ||
const { version, status, market, token_mint, token_account, ratio_initial, ratio_healthy } = | ||
CollateralLayout.decode(buffer) | ||
const { | ||
version, | ||
status, | ||
market, | ||
token_mint, | ||
token_account, | ||
ratio_initial, | ||
ratio_healthy, | ||
oracle, | ||
} = CollateralLayout.decode(buffer) | ||
@@ -90,2 +109,3 @@ return { | ||
ratioHealthy: u64.fromBuffer(ratio_healthy), | ||
oracle: new PublicKey(oracle), | ||
} | ||
@@ -92,0 +112,0 @@ } |
@@ -12,5 +12,6 @@ import { Token, TOKEN_PROGRAM_ID, u64 } from '@solana/spl-token' | ||
const MARKET_PUBKEY: PublicKey = new PublicKey('3E1nNz4FiptsBW8vj36zQEikH4AYjhqSD3jfWkjc4LZV') | ||
const LIQUIDITY_PUBKEY: PublicKey = new PublicKey('BrmEecfTGZFoygN4RVUvPC3wNeGoTx23sor8r9R12toX') | ||
const COLLATERAL_PUBKEY: PublicKey = new PublicKey('A1EgEXQ4p3R6vgiv35gQNnc198QZ5D3YTL4edpmcnwQH') | ||
const ENDPOINT = 'https://api.devnet.solana.com' | ||
const MARKET_PUBKEY: PublicKey = new PublicKey('31dcWJrN1a2QtS2gULCzXZwtA61ej6R5dnyw3jxfRrun') | ||
const LIQUIDITY_PUBKEY: PublicKey = new PublicKey('829Jka8s5qdeJzd16PUQZDpFTRZzDx6VVKzHUsxzfqqn') | ||
const COLLATERAL_PUBKEY: PublicKey = new PublicKey('4vAS1K5D6RoTPFrszfkbu3o9pCDj8gL1LdHBdyUdEqPt') | ||
const RATIO_INITIAL = 0.5 | ||
@@ -62,3 +63,3 @@ | ||
beforeAll(() => { | ||
connection = new Connection('http://127.0.0.1:8899', 'recent') | ||
connection = new Connection(ENDPOINT, 'recent') | ||
payer = Keypair.fromSecretKey(SECRET_KEY) | ||
@@ -72,4 +73,2 @@ lendingMarket = LendingMarket.init(connection, MARKET_PUBKEY, payer) | ||
console.log(market) | ||
expect(market.version).toEqual(1) | ||
@@ -83,4 +82,2 @@ }) | ||
console.log(liquidity) | ||
expect(liquidity.market).toEqual(MARKET_PUBKEY) | ||
@@ -94,4 +91,2 @@ }) | ||
console.log(collateral) | ||
expect(collateral.market).toEqual(MARKET_PUBKEY) | ||
@@ -105,4 +100,2 @@ }) | ||
console.log(liquidityTokens) | ||
expect(liquidityTokens.length).toEqual(1) | ||
@@ -116,4 +109,2 @@ }) | ||
console.log(collateralTokens) | ||
expect(collateralTokens.length).toEqual(1) | ||
@@ -123,3 +114,3 @@ }) | ||
describe('liquidityDeposit', () => { | ||
describe.skip('liquidityDeposit', () => { | ||
test('liquidity deposit', async () => { | ||
@@ -143,3 +134,3 @@ const liquidity = await lendingMarket.getLiquidityInfo(LIQUIDITY_PUBKEY) | ||
describe('liquidityWithdraw', () => { | ||
describe.skip('liquidityWithdraw', () => { | ||
test('liquidity withdraw', async () => { | ||
@@ -166,3 +157,3 @@ const liquidity = await lendingMarket.getLiquidityInfo(LIQUIDITY_PUBKEY) | ||
describe('createObligation', () => { | ||
describe.skip('createObligation', () => { | ||
test('create obligation', async () => { | ||
@@ -181,3 +172,3 @@ const borrower = await generateNewPayer() | ||
describe('obligationCollateralDeposit', () => { | ||
describe.skip('obligationCollateralDeposit', () => { | ||
test('obligation collateral deposit', async () => { | ||
@@ -193,13 +184,7 @@ const borrower = await generateNewPayer() | ||
await lendingMarket.obligationCollateralDeposit( | ||
obligationPubkey, | ||
COLLATERAL_PUBKEY, | ||
uiAmount, | ||
source, | ||
borrower, | ||
) | ||
await lendingMarket.obligationCollateralDeposit(obligationPubkey, uiAmount, source, borrower) | ||
}) | ||
}) | ||
describe('obligationCollateralWithdraw', () => { | ||
describe.skip('obligationCollateralWithdraw', () => { | ||
test('obligation collateral withdraw', async () => { | ||
@@ -215,21 +200,8 @@ const borrower = await generateNewPayer() | ||
await lendingMarket.obligationCollateralDeposit( | ||
obligationPubkey, | ||
COLLATERAL_PUBKEY, | ||
uiAmount, | ||
source, | ||
borrower, | ||
) | ||
await lendingMarket.obligationCollateralWithdraw( | ||
obligationPubkey, | ||
COLLATERAL_PUBKEY, | ||
uiAmount, | ||
source, | ||
borrower, | ||
) | ||
await lendingMarket.obligationCollateralDeposit(obligationPubkey, uiAmount, source, borrower) | ||
await lendingMarket.obligationCollateralWithdraw(obligationPubkey, uiAmount, source, borrower) | ||
}) | ||
}) | ||
describe('obligationLiquidityBorrow', () => { | ||
describe.skip('obligationLiquidityBorrow', () => { | ||
test('obligation liquidity borrow', async () => { | ||
@@ -254,14 +226,6 @@ // Liquidity deposit | ||
await lendingMarket.obligationCollateralDeposit( | ||
obligationPubkey, | ||
COLLATERAL_PUBKEY, | ||
uiAmount, | ||
source, | ||
borrower, | ||
) | ||
await lendingMarket.obligationCollateralDeposit(obligationPubkey, uiAmount, source, borrower) | ||
await lendingMarket.obligationLiquidityBorrow( | ||
obligationPubkey, | ||
LIQUIDITY_PUBKEY, | ||
COLLATERAL_PUBKEY, | ||
uiAmount * RATIO_INITIAL, | ||
@@ -274,3 +238,3 @@ destination, | ||
describe('obligationLiquidityRepay', () => { | ||
describe.skip('obligationLiquidityRepay', () => { | ||
test('obligation liquidity repay', async () => { | ||
@@ -295,14 +259,6 @@ // Liquidity deposit | ||
await lendingMarket.obligationCollateralDeposit( | ||
obligationPubkey, | ||
COLLATERAL_PUBKEY, | ||
uiAmount, | ||
source, | ||
borrower, | ||
) | ||
await lendingMarket.obligationCollateralDeposit(obligationPubkey, uiAmount, source, borrower) | ||
await lendingMarket.obligationLiquidityBorrow( | ||
obligationPubkey, | ||
LIQUIDITY_PUBKEY, | ||
COLLATERAL_PUBKEY, | ||
uiAmount * RATIO_INITIAL, | ||
@@ -315,3 +271,2 @@ destination, | ||
obligationPubkey, | ||
LIQUIDITY_PUBKEY, | ||
uiAmount * RATIO_INITIAL, | ||
@@ -318,0 +273,0 @@ destination, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2719307
12817