mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-06-03 23:26:50 +00:00
fixes
This commit is contained in:
@@ -25,18 +25,18 @@ export async function lendAsset(
|
||||
|
||||
const request = {
|
||||
owner: agent.wallet.publicKey.toBase58(),
|
||||
mintAddress: asset,
|
||||
depositAmount: amount,
|
||||
mintAddress: asset.toBase58(),
|
||||
depositAmount: amount.toString(),
|
||||
};
|
||||
|
||||
const priority = `?priorityFee=${getPriorityFees(agent.connection)}`;
|
||||
const priorityFees = await getPriorityFees(agent.connection);
|
||||
const priority = `?priorityFee=${priorityFees.median}`;
|
||||
|
||||
const response = await fetch(
|
||||
`${LULO_API}/generate/account/deposit${priority}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"x-wallet-pubkey": agent.wallet.publicKey.toBase58(),
|
||||
"x-api-key": LULO_API_KEY,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Transaction, Keypair } from "@solana/web3.js";
|
||||
import { Transaction, Keypair, TransactionInstruction } from "@solana/web3.js";
|
||||
import { Connection, ComputeBudgetProgram } from "@solana/web3.js";
|
||||
|
||||
/**
|
||||
@@ -7,7 +7,16 @@ import { Connection, ComputeBudgetProgram } from "@solana/web3.js";
|
||||
* @param connection - Solana RPC connection
|
||||
* @returns Priority fees statistics and instructions for different fee levels
|
||||
*/
|
||||
export async function getPriorityFees(connection: Connection) {
|
||||
export async function getPriorityFees(connection: Connection): Promise<{
|
||||
min: number;
|
||||
median: number;
|
||||
max: number;
|
||||
instructions?: {
|
||||
low: TransactionInstruction;
|
||||
medium: TransactionInstruction;
|
||||
high: TransactionInstruction;
|
||||
};
|
||||
}> {
|
||||
try {
|
||||
// Get recent prioritization fees
|
||||
const priorityFees = await connection.getRecentPrioritizationFees();
|
||||
|
||||
Reference in New Issue
Block a user