@everlend/general-pool
Advanced tools
Comparing version 0.0.1 to 0.0.2
export * from './poolMarket'; | ||
export * from './pool'; | ||
export * from './poolBorrowAuthority'; | ||
export * from './withdrawalRequests'; |
@@ -16,2 +16,3 @@ "use strict"; | ||
__exportStar(require("./poolBorrowAuthority"), exports); | ||
__exportStar(require("./withdrawalRequests"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -11,2 +11,5 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -16,2 +19,3 @@ exports.repay = exports.borrow = exports.withdrawRequest = exports.deposit = exports.createPool = exports.initPoolMarket = void 0; | ||
const web3_js_1 = require("@solana/web3.js"); | ||
const bn_js_1 = __importDefault(require("bn.js")); | ||
const accounts_1 = require("./accounts"); | ||
@@ -57,5 +61,3 @@ const program_1 = require("./program"); | ||
const poolPubkey = yield accounts_1.Pool.getPDA(poolMarket, tokenMint); | ||
const poolMarketAuthority = yield program_1.GeneralPoolsProgram.findProgramAddress([ | ||
poolMarket.toBuffer(), | ||
]); | ||
const poolMarketAuthority = yield program_1.GeneralPoolsProgram.findProgramAddress([poolMarket.toBuffer()]); | ||
tx.add(new transactions_1.CreatePool({ feePayer: payerPublicKey }, { | ||
@@ -74,5 +76,3 @@ poolMarket, | ||
const { data: { poolMarket, tokenAccount, poolMint }, } = yield accounts_1.Pool.load(connection, pool); | ||
const poolMarketAuthority = yield program_1.GeneralPoolsProgram.findProgramAddress([ | ||
poolMarket.toBuffer(), | ||
]); | ||
const poolMarketAuthority = yield program_1.GeneralPoolsProgram.findProgramAddress([poolMarket.toBuffer()]); | ||
const tx = new web3_js_1.Transaction(); | ||
@@ -100,3 +100,6 @@ destination = destination !== null && destination !== void 0 ? destination : (yield (0, common_1.findAssociatedTokenAccount)(payerPublicKey, poolMint)); | ||
const { data: { tokenMint, poolMarket, tokenAccount, poolMint }, } = yield accounts_1.Pool.load(connection, pool); | ||
const withdrawRequests = yield program_1.GeneralPoolsProgram.findProgramAddress([ | ||
const withdrawRequests = yield accounts_1.WithdrawalRequests.getPDA(poolMarket, tokenMint); | ||
const { data: { lastRequestId }, } = yield accounts_1.WithdrawalRequests.load(connection, withdrawRequests); | ||
const userWithdrawRequest = yield program_1.GeneralPoolsProgram.findProgramAddress([ | ||
lastRequestId.add(new bn_js_1.default(1, 10)).toBuffer('be'), | ||
buffer_1.Buffer.from('withdrawals'), | ||
@@ -122,2 +125,3 @@ poolMarket.toBuffer(), | ||
withdrawRequests, | ||
userWithdrawRequest, | ||
source, | ||
@@ -135,5 +139,3 @@ destination, | ||
const { data: { poolMarket, tokenAccount, tokenMint }, } = yield accounts_1.Pool.load(connection, pool); | ||
const poolMarketAuthority = yield program_1.GeneralPoolsProgram.findProgramAddress([ | ||
poolMarket.toBuffer(), | ||
]); | ||
const poolMarketAuthority = yield program_1.GeneralPoolsProgram.findProgramAddress([poolMarket.toBuffer()]); | ||
const poolBorrowAuthority = yield accounts_1.PoolBorrowAuthority.getPDA(pool, payerPublicKey); | ||
@@ -140,0 +142,0 @@ const tx = new web3_js_1.Transaction(); |
@@ -14,2 +14,3 @@ import { PublicKey, Transaction, TransactionCtorFields } from '@solana/web3.js'; | ||
withdrawRequests: PublicKey; | ||
userWithdrawRequest: PublicKey; | ||
source: PublicKey; | ||
@@ -16,0 +17,0 @@ destination: PublicKey; |
@@ -25,3 +25,3 @@ "use strict"; | ||
const { feePayer } = options; | ||
const { poolMarket, pool, withdrawRequests, source, destination, tokenAccount, collateralTransit, poolMint, amount, } = params; | ||
const { poolMarket, pool, withdrawRequests, userWithdrawRequest, source, destination, tokenAccount, collateralTransit, poolMint, amount, } = params; | ||
const data = WithdrawRequestArgs.serialize({ amount }); | ||
@@ -33,2 +33,3 @@ this.add(new web3_js_1.TransactionInstruction({ | ||
{ pubkey: withdrawRequests, isSigner: false, isWritable: true }, | ||
{ pubkey: userWithdrawRequest, isSigner: false, isWritable: true }, | ||
{ pubkey: source, isSigner: false, isWritable: true }, | ||
@@ -40,2 +41,4 @@ { pubkey: destination, isSigner: false, isWritable: true }, | ||
{ pubkey: feePayer, isSigner: true, isWritable: false }, | ||
{ pubkey: web3_js_1.SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false }, | ||
{ pubkey: web3_js_1.SystemProgram.programId, isSigner: false, isWritable: false }, | ||
{ pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false }, | ||
@@ -42,0 +45,0 @@ ], |
{ | ||
"name": "@everlend/general-pool", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
export * from './poolMarket' | ||
export * from './pool' | ||
export * from './poolBorrowAuthority' | ||
export * from './withdrawalRequests' |
import { AccountLayout, MintLayout, TOKEN_PROGRAM_ID } from '@solana/spl-token' | ||
import { Connection, Keypair, PublicKey, SystemProgram, Transaction } from '@solana/web3.js' | ||
import BN from 'bn.js' | ||
import { Pool, PoolBorrowAuthority, PoolMarket } from './accounts' | ||
import { Pool, PoolBorrowAuthority, PoolMarket, WithdrawalRequests } from './accounts' | ||
import { GeneralPoolsProgram } from './program' | ||
@@ -81,5 +81,3 @@ import { CreateAssociatedTokenAccount, findAssociatedTokenAccount } from '@everlend/common' | ||
const poolPubkey = await Pool.getPDA(poolMarket, tokenMint) | ||
const poolMarketAuthority = await GeneralPoolsProgram.findProgramAddress([ | ||
poolMarket.toBuffer(), | ||
]) | ||
const poolMarketAuthority = await GeneralPoolsProgram.findProgramAddress([poolMarket.toBuffer()]) | ||
@@ -114,5 +112,3 @@ tx.add( | ||
const poolMarketAuthority = await GeneralPoolsProgram.findProgramAddress([ | ||
poolMarket.toBuffer(), | ||
]) | ||
const poolMarketAuthority = await GeneralPoolsProgram.findProgramAddress([poolMarket.toBuffer()]) | ||
@@ -164,3 +160,10 @@ const tx = new Transaction() | ||
const withdrawRequests = await GeneralPoolsProgram.findProgramAddress([ | ||
const withdrawRequests = await WithdrawalRequests.getPDA(poolMarket, tokenMint) | ||
const { | ||
data: { lastRequestId }, | ||
} = await WithdrawalRequests.load(connection, withdrawRequests) | ||
const userWithdrawRequest = await GeneralPoolsProgram.findProgramAddress([ | ||
lastRequestId.add(new BN(1, 10)).toBuffer('be'), | ||
Buffer.from('withdrawals'), | ||
@@ -199,2 +202,3 @@ poolMarket.toBuffer(), | ||
withdrawRequests, | ||
userWithdrawRequest, | ||
source, | ||
@@ -223,5 +227,3 @@ destination, | ||
const poolMarketAuthority = await GeneralPoolsProgram.findProgramAddress([ | ||
poolMarket.toBuffer(), | ||
]) | ||
const poolMarketAuthority = await GeneralPoolsProgram.findProgramAddress([poolMarket.toBuffer()]) | ||
const poolBorrowAuthority = await PoolBorrowAuthority.getPDA(pool, payerPublicKey) | ||
@@ -228,0 +230,0 @@ |
import { TOKEN_PROGRAM_ID } from '@solana/spl-token' | ||
import { | ||
PublicKey, | ||
SystemProgram, | ||
SYSVAR_RENT_PUBKEY, | ||
Transaction, | ||
@@ -25,2 +27,3 @@ TransactionCtorFields, | ||
withdrawRequests: PublicKey | ||
userWithdrawRequest: PublicKey | ||
source: PublicKey | ||
@@ -42,2 +45,3 @@ destination: PublicKey | ||
withdrawRequests, | ||
userWithdrawRequest, | ||
source, | ||
@@ -59,2 +63,3 @@ destination, | ||
{ pubkey: withdrawRequests, isSigner: false, isWritable: true }, | ||
{ pubkey: userWithdrawRequest, isSigner: false, isWritable: true }, | ||
{ pubkey: source, isSigner: false, isWritable: true }, | ||
@@ -66,2 +71,4 @@ { pubkey: destination, isSigner: false, isWritable: true }, | ||
{ pubkey: feePayer, isSigner: true, isWritable: false }, | ||
{ pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false }, | ||
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, | ||
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false }, | ||
@@ -68,0 +75,0 @@ ], |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
111301
80
2364