@everlend/general-pool
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -13,5 +13,5 @@ import { Connection, Keypair, PublicKey, Transaction } from '@solana/web3.js'; | ||
export declare const createPool: ({ connection, payerPublicKey }: ActionOptions, poolMarket: PublicKey, tokenMint: PublicKey, tokenAccount?: Keypair, poolMint?: Keypair) => Promise<ActionResult>; | ||
export declare const deposit: ({ connection, payerPublicKey }: ActionOptions, pool: PublicKey, amount: BN, source: PublicKey, destination?: PublicKey) => Promise<ActionResult>; | ||
export declare const withdrawRequest: ({ connection, payerPublicKey }: ActionOptions, pool: PublicKey, collateralAmount: BN, source: PublicKey, destination?: PublicKey) => Promise<ActionResult>; | ||
export declare const deposit: ({ connection, payerPublicKey }: ActionOptions, pool: PublicKey, registry: PublicKey, amount: BN, source: PublicKey, destination?: PublicKey) => Promise<ActionResult>; | ||
export declare const withdrawRequest: ({ connection, payerPublicKey }: ActionOptions, pool: PublicKey, registry: PublicKey, collateralAmount: BN, source: PublicKey, destination?: PublicKey) => Promise<ActionResult>; | ||
export declare const borrow: ({ connection, payerPublicKey }: ActionOptions, pool: PublicKey, amount: BN, destination?: PublicKey) => Promise<ActionResult>; | ||
export declare const repay: ({ connection, payerPublicKey }: ActionOptions, pool: PublicKey, amount: BN, interestAmount: BN, source: PublicKey) => Promise<ActionResult>; |
@@ -67,6 +67,7 @@ "use strict"; | ||
exports.createPool = createPool; | ||
const deposit = ({ connection, payerPublicKey }, pool, amount, source, destination) => __awaiter(void 0, void 0, void 0, function* () { | ||
const deposit = ({ connection, payerPublicKey }, pool, registry, amount, source, destination) => __awaiter(void 0, void 0, void 0, function* () { | ||
const { data: { poolMarket, tokenAccount, poolMint }, } = yield accounts_1.Pool.load(connection, pool); | ||
const poolMarketAuthority = yield program_1.GeneralPoolsProgram.findProgramAddress([poolMarket.toBuffer()]); | ||
const tx = new web3_js_1.Transaction(); | ||
const registryPoolConfig = yield (0, common_1.findRegistryPoolConfigAccount)(registry, pool); | ||
destination = destination !== null && destination !== void 0 ? destination : (yield (0, common_1.findAssociatedTokenAccount)(payerPublicKey, poolMint)); | ||
@@ -79,2 +80,4 @@ !(yield connection.getAccountInfo(destination)) && | ||
tx.add(new transactions_1.Deposit({ feePayer: payerPublicKey }, { | ||
registryPoolConfig, | ||
registry, | ||
poolMarket, | ||
@@ -92,3 +95,3 @@ pool, | ||
exports.deposit = deposit; | ||
const withdrawRequest = ({ connection, payerPublicKey }, pool, collateralAmount, source, destination) => __awaiter(void 0, void 0, void 0, function* () { | ||
const withdrawRequest = ({ connection, payerPublicKey }, pool, registry, collateralAmount, source, destination) => __awaiter(void 0, void 0, void 0, function* () { | ||
const { data: { tokenMint, poolMarket, tokenAccount, poolMint }, } = yield accounts_1.Pool.load(connection, pool); | ||
@@ -103,2 +106,3 @@ const withdrawRequests = yield accounts_1.WithdrawalRequests.getPDA(poolMarket, tokenMint); | ||
const tx = new web3_js_1.Transaction(); | ||
const registryPoolConfig = yield (0, common_1.findRegistryPoolConfigAccount)(registry, pool); | ||
destination = destination !== null && destination !== void 0 ? destination : (yield (0, common_1.findAssociatedTokenAccount)(payerPublicKey, tokenMint)); | ||
@@ -111,2 +115,4 @@ !(yield connection.getAccountInfo(destination)) && | ||
tx.add(new transactions_1.WithdrawRequest({ feePayer: payerPublicKey }, { | ||
registry, | ||
registryPoolConfig, | ||
poolMarket, | ||
@@ -113,0 +119,0 @@ pool, |
@@ -11,2 +11,4 @@ import { PublicKey, Transaction, TransactionCtorFields } from '@solana/web3.js'; | ||
declare type DepositParams = { | ||
registry: PublicKey; | ||
registryPoolConfig: PublicKey; | ||
poolMarket: PublicKey; | ||
@@ -13,0 +15,0 @@ pool: PublicKey; |
@@ -25,6 +25,8 @@ "use strict"; | ||
const { feePayer } = options; | ||
const { poolMarket, pool, source, destination, tokenAccount, poolMint, poolMarketAuthority, amount, } = params; | ||
const { registry, registryPoolConfig, poolMarket, pool, source, destination, tokenAccount, poolMint, poolMarketAuthority, amount, } = params; | ||
const data = DepositArgs.serialize({ amount }); | ||
this.add(new web3_js_1.TransactionInstruction({ | ||
keys: [ | ||
{ pubkey: registry, isSigner: false, isWritable: false }, | ||
{ pubkey: registryPoolConfig, isSigner: false, isWritable: false }, | ||
{ pubkey: poolMarket, isSigner: false, isWritable: false }, | ||
@@ -31,0 +33,0 @@ { pubkey: pool, isSigner: false, isWritable: false }, |
@@ -11,2 +11,4 @@ import { PublicKey, Transaction, TransactionCtorFields } from '@solana/web3.js'; | ||
declare type WithdrawRequestParams = { | ||
registry: PublicKey; | ||
registryPoolConfig: PublicKey; | ||
poolMarket: PublicKey; | ||
@@ -13,0 +15,0 @@ pool: PublicKey; |
@@ -25,6 +25,8 @@ "use strict"; | ||
const { feePayer } = options; | ||
const { poolMarket, pool, withdrawRequests, withdrawalRequest, source, destination, tokenAccount, collateralTransit, poolMint, collateralAmount, } = params; | ||
const { registry, registryPoolConfig, poolMarket, pool, withdrawRequests, withdrawalRequest, source, destination, tokenAccount, collateralTransit, poolMint, collateralAmount, } = params; | ||
const data = WithdrawRequestArgs.serialize({ collateralAmount }); | ||
this.add(new web3_js_1.TransactionInstruction({ | ||
keys: [ | ||
{ pubkey: registry, isSigner: false, isWritable: false }, | ||
{ pubkey: registryPoolConfig, isSigner: false, isWritable: false }, | ||
{ pubkey: poolMarket, isSigner: false, isWritable: false }, | ||
@@ -31,0 +33,0 @@ { pubkey: pool, isSigner: false, isWritable: false }, |
{ | ||
"name": "@everlend/general-pool", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -12,3 +12,3 @@ import { AccountLayout, MintLayout, TOKEN_PROGRAM_ID } from '@solana/spl-token' | ||
import { GeneralPoolsProgram } from './program' | ||
import { CreateAssociatedTokenAccount, findAssociatedTokenAccount } from '@everlend/common' | ||
import { CreateAssociatedTokenAccount, findAssociatedTokenAccount, findRegistryPoolConfigAccount } from '@everlend/common' | ||
import { Borrow, CreatePool, Deposit, InitPoolMarket, Repay, WithdrawRequest } from './transactions' | ||
@@ -110,2 +110,3 @@ import { Buffer } from 'buffer' | ||
pool: PublicKey, | ||
registry: PublicKey, | ||
amount: BN, | ||
@@ -122,2 +123,3 @@ source: PublicKey, | ||
const tx = new Transaction() | ||
const registryPoolConfig = await findRegistryPoolConfigAccount(registry, pool) | ||
@@ -141,2 +143,4 @@ // Create destination account for pool mint if doesn't exist | ||
{ | ||
registryPoolConfig, | ||
registry, | ||
poolMarket, | ||
@@ -160,2 +164,3 @@ pool, | ||
pool: PublicKey, | ||
registry: PublicKey, | ||
collateralAmount: BN, | ||
@@ -180,2 +185,3 @@ source: PublicKey, | ||
const registryPoolConfig = await findRegistryPoolConfigAccount(registry, pool) | ||
// Create destination account for token mint if doesn't exist | ||
@@ -198,2 +204,4 @@ destination = destination ?? (await findAssociatedTokenAccount(payerPublicKey, tokenMint)) | ||
{ | ||
registry, | ||
registryPoolConfig, | ||
poolMarket, | ||
@@ -200,0 +208,0 @@ pool, |
@@ -22,2 +22,4 @@ import { TOKEN_PROGRAM_ID } from '@solana/spl-token' | ||
type DepositParams = { | ||
registry: PublicKey | ||
registryPoolConfig: PublicKey | ||
poolMarket: PublicKey | ||
@@ -38,2 +40,4 @@ pool: PublicKey | ||
const { | ||
registry, | ||
registryPoolConfig, | ||
poolMarket, | ||
@@ -54,2 +58,4 @@ pool, | ||
keys: [ | ||
{ pubkey: registry, isSigner: false, isWritable: false }, | ||
{ pubkey: registryPoolConfig, isSigner: false, isWritable: false }, | ||
{ pubkey: poolMarket, isSigner: false, isWritable: false }, | ||
@@ -56,0 +62,0 @@ { pubkey: pool, isSigner: false, isWritable: false }, |
@@ -25,2 +25,4 @@ import { TOKEN_PROGRAM_ID } from '@solana/spl-token' | ||
type WithdrawRequestParams = { | ||
registry: PublicKey | ||
registryPoolConfig: PublicKey | ||
poolMarket: PublicKey | ||
@@ -43,2 +45,4 @@ pool: PublicKey | ||
const { | ||
registry, | ||
registryPoolConfig, | ||
poolMarket, | ||
@@ -61,2 +65,4 @@ pool, | ||
keys: [ | ||
{ pubkey: registry, isSigner: false, isWritable: false }, | ||
{ pubkey: registryPoolConfig, isSigner: false, isWritable: false }, | ||
{ pubkey: poolMarket, isSigner: false, isWritable: false }, | ||
@@ -63,0 +69,0 @@ { pubkey: pool, isSigner: false, isWritable: false }, |
@@ -12,2 +12,3 @@ import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID } from '@solana/spl-token' | ||
POOL_PUBKEY, | ||
REGISTRY_PUBKEY, | ||
} from './utils' | ||
@@ -91,2 +92,3 @@ | ||
POOL_PUBKEY, | ||
REGISTRY_PUBKEY, | ||
amount, | ||
@@ -117,2 +119,3 @@ source, | ||
POOL_PUBKEY, | ||
REGISTRY_PUBKEY, | ||
amount, | ||
@@ -119,0 +122,0 @@ destination, |
@@ -21,2 +21,3 @@ import { ASSOCIATED_TOKEN_PROGRAM_ID, MintLayout, TOKEN_PROGRAM_ID } from '@solana/spl-token' | ||
) | ||
export const REGISTRY_PUBKEY: PublicKey = new PublicKey('6KCHtgSGR2WDE3aqrqSJppHRGVPgy9fHDX5XD8VZgb61') | ||
export const POOL_PUBKEY: PublicKey = new PublicKey('CEDGxQ1Hga4LsCHAHme1C4RJM9fimTfwjUfokPM5YU8Q') | ||
@@ -23,0 +24,0 @@ export const POOL2_PUBKEY: PublicKey = new PublicKey('4rEzYjgu8QyvG75waddZkTDdgP7XHy8YcWMxdNsPXAdV') |
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
122673
2606