Explorer: Remove support for bonfida bot instructions (#27766)
This commit is contained in:
parent
afe1cfe94a
commit
c345981321
File diff suppressed because it is too large
Load Diff
|
@ -4,7 +4,6 @@
|
|||
"private": true,
|
||||
"dependencies": {
|
||||
"@blockworks-foundation/mango-client": "^3.6.7",
|
||||
"@bonfida/bot": "^0.5.3",
|
||||
"@bonfida/spl-name-service": "^0.1.30",
|
||||
"@cloudflare/stream-react": "^1.2.0",
|
||||
"@metamask/jazzicon": "^2.0.0",
|
||||
|
|
|
@ -39,10 +39,6 @@ import {
|
|||
isSerumInstruction,
|
||||
parseSerumInstructionTitle,
|
||||
} from "components/instruction/serum/types";
|
||||
import {
|
||||
isBonfidaBotInstruction,
|
||||
parseBonfidaBotInstructionTitle,
|
||||
} from "components/instruction/bonfida-bot/types";
|
||||
import { INNER_INSTRUCTIONS_START_SLOT } from "pages/TransactionDetailsPage";
|
||||
import { useCluster, Cluster } from "providers/cluster";
|
||||
import { Link } from "react-router-dom";
|
||||
|
@ -492,16 +488,6 @@ const TokenTransactionRow = React.memo(
|
|||
reportError(error, { signature: tx.signature });
|
||||
return undefined;
|
||||
}
|
||||
} else if (
|
||||
transactionInstruction &&
|
||||
isBonfidaBotInstruction(transactionInstruction)
|
||||
) {
|
||||
try {
|
||||
name = parseBonfidaBotInstructionTitle(transactionInstruction);
|
||||
} catch (error) {
|
||||
reportError(error, { signature: tx.signature });
|
||||
return undefined;
|
||||
}
|
||||
} else if (
|
||||
transactionInstruction &&
|
||||
isMangoInstruction(transactionInstruction)
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
import React from "react";
|
||||
import { TransactionInstruction, SignatureResult } from "@solana/web3.js";
|
||||
import { InstructionCard } from "./InstructionCard";
|
||||
import { useCluster } from "providers/cluster";
|
||||
import { reportError } from "utils/sentry";
|
||||
import {
|
||||
decodeCancelOrder,
|
||||
decodeInitializeBot,
|
||||
decodeCreateBot,
|
||||
decodeDeposit,
|
||||
decodeCreateOrder,
|
||||
decodeSettleFunds,
|
||||
decodeRedeem,
|
||||
decodeCollectFees,
|
||||
parseBonfidaBotInstructionTitle,
|
||||
} from "./bonfida-bot/types";
|
||||
import { CancelOrderDetailsCard } from "./bonfida-bot/CancelOrderDetails";
|
||||
import { CollectFeesDetailsCard } from "./bonfida-bot/CollectFeesDetails";
|
||||
import { CreateBotDetailsCard } from "./bonfida-bot/CreateBotDetails";
|
||||
import { DepositDetailsCard } from "./bonfida-bot/DepositDetails";
|
||||
import { InitializeBotDetailsCard } from "./bonfida-bot/InitializeBotDetails";
|
||||
import { RedeemDetailsCard } from "./bonfida-bot/RedeemDetails";
|
||||
import { SettleFundsDetailsCard } from "./bonfida-bot/SettleFundsDetails";
|
||||
import { CreateOrderDetailsCard } from "./bonfida-bot/CreateOrderDetails";
|
||||
|
||||
export function BonfidaBotDetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
signature: string;
|
||||
innerCards?: JSX.Element[];
|
||||
childIndex?: number;
|
||||
}) {
|
||||
const { ix, index, result, signature, innerCards, childIndex } = props;
|
||||
|
||||
const { url } = useCluster();
|
||||
|
||||
let title;
|
||||
try {
|
||||
title = parseBonfidaBotInstructionTitle(ix);
|
||||
|
||||
switch (title) {
|
||||
case "Initialize Bot":
|
||||
return (
|
||||
<InitializeBotDetailsCard info={decodeInitializeBot(ix)} {...props} />
|
||||
);
|
||||
case "Create Bot":
|
||||
return <CreateBotDetailsCard info={decodeCreateBot(ix)} {...props} />;
|
||||
case "Deposit":
|
||||
return <DepositDetailsCard info={decodeDeposit(ix)} {...props} />;
|
||||
case "Create Order":
|
||||
return (
|
||||
<CreateOrderDetailsCard info={decodeCreateOrder(ix)} {...props} />
|
||||
);
|
||||
case "Cancel Order":
|
||||
return (
|
||||
<CancelOrderDetailsCard info={decodeCancelOrder(ix)} {...props} />
|
||||
);
|
||||
case "Settle Funds":
|
||||
return (
|
||||
<SettleFundsDetailsCard info={decodeSettleFunds(ix)} {...props} />
|
||||
);
|
||||
case "settleFunds":
|
||||
return (
|
||||
<SettleFundsDetailsCard info={decodeSettleFunds(ix)} {...props} />
|
||||
);
|
||||
case "Redeem":
|
||||
return <RedeemDetailsCard info={decodeRedeem(ix)} {...props} />;
|
||||
case "Collect Fees":
|
||||
return (
|
||||
<CollectFeesDetailsCard info={decodeCollectFees(ix)} {...props} />
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
reportError(error, {
|
||||
url: url,
|
||||
signature: signature,
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<InstructionCard
|
||||
ix={ix}
|
||||
index={index}
|
||||
result={result}
|
||||
title={`Bonfida Bot: ${title || "Unknown"}`}
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
defaultRaw
|
||||
/>
|
||||
);
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
import React from "react";
|
||||
import { SignatureResult, TransactionInstruction } from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { CancelOrder } from "./types";
|
||||
|
||||
export function CancelOrderDetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: CancelOrder;
|
||||
innerCards?: JSX.Element[];
|
||||
childIndex?: number;
|
||||
}) {
|
||||
const { ix, index, result, info, innerCards, childIndex } = props;
|
||||
|
||||
return (
|
||||
<InstructionCard
|
||||
ix={ix}
|
||||
index={index}
|
||||
result={result}
|
||||
title="Serum Program: Cancel Order"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.programId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Signal Provider Address</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.signalProviderKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.openOrdersKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Serum Event Queue</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.serumEventQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Serum Bids</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.serumMarketBids} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Serum Asks</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.serumMarketAsks} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bot Address</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.poolKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Serum Program ID</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.dexProgramKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Pool Seed</td>
|
||||
<td className="text-lg-end">{info.poolSeed}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Side</td>
|
||||
<td className="text-lg-end">{info.side}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Order Id</td>
|
||||
<td className="text-lg-end">{info.orderId.toString(10)}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
import React from "react";
|
||||
import { SignatureResult, TransactionInstruction } from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { CollectFees } from "./types";
|
||||
|
||||
export function CollectFeesDetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: CollectFees;
|
||||
innerCards?: JSX.Element[];
|
||||
childIndex?: number;
|
||||
}) {
|
||||
const { ix, index, result, info, innerCards, childIndex } = props;
|
||||
|
||||
return (
|
||||
<InstructionCard
|
||||
ix={ix}
|
||||
index={index}
|
||||
result={result}
|
||||
title="Bonfida Bot: Collect Fees"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.programId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Signal Provider</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.signalProviderPoolTokenKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Insurance Fund</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.bonfidaFeePoolTokenKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Buy and Burn</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.bonfidaBnBPTKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Pool Seed</td>
|
||||
<td className="text-lg-end">{info.poolSeed}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
import React from "react";
|
||||
import { SignatureResult, TransactionInstruction } from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { CreateBot } from "./types";
|
||||
|
||||
export function CreateBotDetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: CreateBot;
|
||||
innerCards?: JSX.Element[];
|
||||
childIndex?: number;
|
||||
}) {
|
||||
const { ix, index, result, info, innerCards, childIndex } = props;
|
||||
|
||||
return (
|
||||
<InstructionCard
|
||||
ix={ix}
|
||||
index={index}
|
||||
result={result}
|
||||
title="Bonfida Bot: Create Bot"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.programId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bot Token Mint</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.mintKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bot Address</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.poolKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Target Pool Token Address</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.targetPoolTokenKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Serum Program ID</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.serumProgramId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Signal Provider Address</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.signalProviderKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Pool Seed</td>
|
||||
<td className="text-lg-end">{info.poolSeed}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Fee Ratio</td>
|
||||
<td className="text-lg-end">{info.feeRatio}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Fee Collection Period</td>
|
||||
<td className="text-lg-end">{info.feeCollectionPeriod}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Serum Markets</td>
|
||||
<td className="text-lg-end">{info.markets}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Deposit Amounts</td>
|
||||
<td className="text-lg-end">{info.depositAmounts}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -1,164 +0,0 @@
|
|||
import React from "react";
|
||||
import {
|
||||
SignatureResult,
|
||||
TransactionInstruction,
|
||||
PublicKey,
|
||||
} from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { CreateOrder } from "./types";
|
||||
|
||||
export function CreateOrderDetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: CreateOrder;
|
||||
innerCards?: JSX.Element[];
|
||||
childIndex?: number;
|
||||
}) {
|
||||
const { ix, index, result, info, innerCards, childIndex } = props;
|
||||
console.log("Test");
|
||||
return (
|
||||
<InstructionCard
|
||||
ix={ix}
|
||||
index={index}
|
||||
result={result}
|
||||
title="Bonfida Bot: Create Order"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.programId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Signal Provider Address</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.signalProviderKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Payer Bot Asset Address</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.payerPoolAssetKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Order</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.openOrdersKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Serum Request Queue</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.serumRequestQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Serum Event Queue</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.serumEventQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Serum Bids</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.serumMarketBids} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Serum Asks</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.serumMarketAsks} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bot Address</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.poolKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Coin Vault</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.coinVaultKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Pc Vault</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.pcVaultKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Serum Program ID</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.dexProgramKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bot Token Mint</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={new PublicKey(info.targetMint)} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Pool Seed</td>
|
||||
<td className="text-lg-end">{info.poolSeed}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Side</td>
|
||||
<td className="text-lg-end">{info.side}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Limit Price</td>
|
||||
<td className="text-lg-end">{info.limitPrice}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Ratio to Trade</td>
|
||||
<td className="text-lg-end">{info.ratioOfPoolAssetsToTrade}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Order Type</td>
|
||||
<td className="text-lg-end">{info.orderType}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Coin Lot Size</td>
|
||||
<td className="text-lg-end">{info.coinLotSize.toString()}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Pc Lot Size</td>
|
||||
<td className="text-lg-end">{info.pcLotSize.toString()}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
import React from "react";
|
||||
import { SignatureResult, TransactionInstruction } from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { Deposit } from "./types";
|
||||
|
||||
export function DepositDetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: Deposit;
|
||||
innerCards?: JSX.Element[];
|
||||
childIndex?: number;
|
||||
}) {
|
||||
const { ix, index, result, info, innerCards, childIndex } = props;
|
||||
|
||||
return (
|
||||
<InstructionCard
|
||||
ix={ix}
|
||||
index={index}
|
||||
result={result}
|
||||
title="Bonfida Bot: Deposit"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.programId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Signal Provider Fee Address</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.sigProviderFeeReceiverKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Insurance Funds</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.bonfidaFeeReceiverKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Buy and Burn</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.bonfidaBuyAndBurnKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bot Token Mint</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.mintKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bot Address</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.poolKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Target Pool Token Address</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.targetPoolTokenKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Pool Seed</td>
|
||||
<td className="text-lg-end">{info.poolSeed}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Pool Token Amount</td>
|
||||
<td className="text-lg-end">{info.poolTokenAmount.toString()}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
import React from "react";
|
||||
import { SignatureResult, TransactionInstruction } from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { InitializeBot } from "./types";
|
||||
|
||||
export function InitializeBotDetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: InitializeBot;
|
||||
innerCards?: JSX.Element[];
|
||||
childIndex?: number;
|
||||
}) {
|
||||
const { ix, index, result, info, innerCards, childIndex } = props;
|
||||
|
||||
return (
|
||||
<InstructionCard
|
||||
ix={ix}
|
||||
index={index}
|
||||
result={result}
|
||||
title="Bonfida Bot: Initialize Bot"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.programId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Pool Account</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.poolAccount} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Mint Account</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.mintAccount} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Pool Seed</td>
|
||||
<td className="text-lg-end">{info.poolSeed}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Max Number of Assets</td>
|
||||
<td className="text-lg-end">{info.maxNumberOfAsset}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Number of Markets</td>
|
||||
<td className="text-lg-end">{info.numberOfMarkets}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
import React from "react";
|
||||
import { SignatureResult, TransactionInstruction } from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { Redeem } from "./types";
|
||||
|
||||
export function RedeemDetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: Redeem;
|
||||
innerCards?: JSX.Element[];
|
||||
childIndex?: number;
|
||||
}) {
|
||||
const { ix, index, result, info, innerCards, childIndex } = props;
|
||||
|
||||
return (
|
||||
<InstructionCard
|
||||
ix={ix}
|
||||
index={index}
|
||||
result={result}
|
||||
title="Bonfida Bot: Redeem"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.programId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bot Token Mint</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.mintKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bot Address</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.poolKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Source Bot Token Owner</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.sourcePoolTokenKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Source Bot Token Address</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.sourcePoolTokenKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Pool Seed</td>
|
||||
<td className="text-lg-end">{info.poolSeed}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Pool Token Amount</td>
|
||||
<td className="text-lg-end">{info.poolTokenAmount}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
import React from "react";
|
||||
import { SignatureResult, TransactionInstruction } from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { SettleFunds } from "./types";
|
||||
|
||||
export function SettleFundsDetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: SettleFunds;
|
||||
innerCards?: JSX.Element[];
|
||||
childIndex?: number;
|
||||
}) {
|
||||
const { ix, index, result, info, innerCards, childIndex } = props;
|
||||
return (
|
||||
<InstructionCard
|
||||
ix={ix}
|
||||
index={index}
|
||||
result={result}
|
||||
title="Bonfida Bot: Settle Funds"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.programId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.openOrdersKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bot Address</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.poolKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bot Token Mint</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.poolMintKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Coin Vault</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.coinVaultKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Pc Vault</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.pcVaultKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bot's Coin Address</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.coinPoolAssetKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bot's Pc Address</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.pcPoolAssetKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Vault Signer</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.vaultSignerKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Serum Program ID</td>
|
||||
<td className="text-lg-end">
|
||||
<Address pubkey={info.dexProgramKey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Pool Seed</td>
|
||||
<td className="text-lg-end">{info.poolSeed}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -1,433 +0,0 @@
|
|||
/* eslint-disable @typescript-eslint/no-redeclare */
|
||||
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
||||
import {
|
||||
enums,
|
||||
number,
|
||||
type,
|
||||
Infer,
|
||||
create,
|
||||
array,
|
||||
string,
|
||||
optional,
|
||||
coerce,
|
||||
any,
|
||||
} from "superstruct";
|
||||
import {
|
||||
Instruction,
|
||||
decodeInstruction,
|
||||
BONFIDABOT_PROGRAM_ID,
|
||||
} from "@bonfida/bot";
|
||||
|
||||
export const SERUM_DECODED_MAX = 6;
|
||||
|
||||
export type Side = Infer<typeof Side>;
|
||||
export const Side = enums([0, 1]);
|
||||
|
||||
export type OrderType = Infer<typeof OrderType>;
|
||||
export const OrderType = enums([0, 1, 2]);
|
||||
|
||||
const PublicKeyToString = coerce(string(), any(), (value) => value.toBase58());
|
||||
|
||||
export type InitializeBot = {
|
||||
systemProgramAccount: PublicKey;
|
||||
rentSysvarAccount: PublicKey;
|
||||
splTokenProgramAccount: PublicKey;
|
||||
poolAccount: PublicKey;
|
||||
mintAccount: PublicKey;
|
||||
payerAccount: PublicKey;
|
||||
|
||||
poolSeed: string;
|
||||
maxNumberOfAsset: number | undefined | null;
|
||||
numberOfMarkets: number;
|
||||
programId: PublicKey;
|
||||
};
|
||||
|
||||
export const InitializeBotDecode = type({
|
||||
poolSeed: string(),
|
||||
maxNumberOfAsset: optional(number()),
|
||||
numberOfMarkets: number(),
|
||||
});
|
||||
|
||||
export const decodeInitializeBot = (
|
||||
ix: TransactionInstruction
|
||||
): InitializeBot => {
|
||||
const decoded = create(
|
||||
decodeInstruction(ix.data, Instruction.Init),
|
||||
InitializeBotDecode
|
||||
);
|
||||
const initializeBot: InitializeBot = {
|
||||
systemProgramAccount: ix.keys[0].pubkey,
|
||||
rentSysvarAccount: ix.keys[1].pubkey,
|
||||
splTokenProgramAccount: ix.keys[2].pubkey,
|
||||
poolAccount: ix.keys[3].pubkey,
|
||||
mintAccount: ix.keys[4].pubkey,
|
||||
payerAccount: ix.keys[5].pubkey,
|
||||
poolSeed: decoded.poolSeed,
|
||||
maxNumberOfAsset: decoded.maxNumberOfAsset,
|
||||
numberOfMarkets: decoded.numberOfMarkets,
|
||||
programId: ix.programId,
|
||||
};
|
||||
|
||||
return initializeBot;
|
||||
};
|
||||
|
||||
export type CreateBot = {
|
||||
splTokenProgramId: PublicKey;
|
||||
clockSysvarKey: PublicKey;
|
||||
mintKey: PublicKey;
|
||||
poolKey: PublicKey;
|
||||
poolSeed: string;
|
||||
targetPoolTokenKey: PublicKey;
|
||||
serumProgramId: PublicKey;
|
||||
signalProviderKey: PublicKey;
|
||||
depositAmounts: number[] | undefined | null;
|
||||
markets: string[] | undefined | null;
|
||||
feeCollectionPeriod: number;
|
||||
feeRatio: number;
|
||||
programId: PublicKey;
|
||||
};
|
||||
|
||||
export const CreateBotDecode = type({
|
||||
poolSeed: string(),
|
||||
feeCollectionPeriod: number(),
|
||||
feeRatio: number(),
|
||||
depositAmounts: array(number()),
|
||||
markets: array(PublicKeyToString),
|
||||
});
|
||||
|
||||
export const decodeCreateBot = (ix: TransactionInstruction): CreateBot => {
|
||||
const decoded = create(
|
||||
decodeInstruction(ix.data, Instruction.Create),
|
||||
CreateBotDecode
|
||||
);
|
||||
const createBot: CreateBot = {
|
||||
splTokenProgramId: ix.keys[0].pubkey,
|
||||
clockSysvarKey: ix.keys[1].pubkey,
|
||||
mintKey: ix.keys[4].pubkey,
|
||||
poolKey: ix.keys[6].pubkey,
|
||||
poolSeed: decoded.poolSeed,
|
||||
targetPoolTokenKey: ix.keys[5].pubkey,
|
||||
serumProgramId: ix.keys[2].pubkey,
|
||||
signalProviderKey: ix.keys[3].pubkey,
|
||||
depositAmounts: decoded.depositAmounts,
|
||||
markets: decoded.markets,
|
||||
feeCollectionPeriod: decoded.feeCollectionPeriod,
|
||||
feeRatio: decoded.feeRatio,
|
||||
programId: ix.programId,
|
||||
};
|
||||
|
||||
return createBot;
|
||||
};
|
||||
|
||||
export type Deposit = {
|
||||
splTokenProgramId: PublicKey;
|
||||
programId: PublicKey;
|
||||
sigProviderFeeReceiverKey: PublicKey;
|
||||
bonfidaFeeReceiverKey: PublicKey;
|
||||
bonfidaBuyAndBurnKey: PublicKey;
|
||||
mintKey: PublicKey;
|
||||
poolKey: PublicKey;
|
||||
targetPoolTokenKey: PublicKey;
|
||||
poolSeed: string;
|
||||
poolTokenAmount: number;
|
||||
};
|
||||
|
||||
export const DepositDecode = type({
|
||||
poolSeed: string(),
|
||||
poolTokenAmount: number(),
|
||||
});
|
||||
|
||||
export const decodeDeposit = (ix: TransactionInstruction): Deposit => {
|
||||
const decoded = create(
|
||||
decodeInstruction(ix.data, Instruction.Deposit),
|
||||
DepositDecode
|
||||
);
|
||||
|
||||
const deposit: Deposit = {
|
||||
splTokenProgramId: ix.keys[0].pubkey,
|
||||
programId: ix.programId,
|
||||
sigProviderFeeReceiverKey: ix.keys[3].pubkey,
|
||||
bonfidaFeeReceiverKey: ix.keys[4].pubkey,
|
||||
bonfidaBuyAndBurnKey: ix.keys[5].pubkey,
|
||||
mintKey: ix.keys[1].pubkey,
|
||||
poolKey: ix.keys[6].pubkey,
|
||||
targetPoolTokenKey: ix.keys[2].pubkey,
|
||||
poolSeed: decoded.poolSeed,
|
||||
poolTokenAmount: decoded.poolTokenAmount,
|
||||
};
|
||||
|
||||
return deposit;
|
||||
};
|
||||
|
||||
export type CreateOrder = {
|
||||
programId: PublicKey;
|
||||
signalProviderKey: PublicKey;
|
||||
market: PublicKey;
|
||||
payerPoolAssetKey: PublicKey;
|
||||
openOrdersKey: PublicKey;
|
||||
serumRequestQueue: PublicKey;
|
||||
serumEventQueue: PublicKey;
|
||||
serumMarketBids: PublicKey;
|
||||
serumMarketAsks: PublicKey;
|
||||
poolKey: PublicKey;
|
||||
coinVaultKey: PublicKey;
|
||||
pcVaultKey: PublicKey;
|
||||
splTokenProgramId: PublicKey;
|
||||
dexProgramKey: PublicKey;
|
||||
rentProgramId: PublicKey;
|
||||
srmReferrerKey: PublicKey | null | undefined;
|
||||
poolSeed: string;
|
||||
side: Side;
|
||||
limitPrice: number;
|
||||
ratioOfPoolAssetsToTrade: number;
|
||||
orderType: OrderType;
|
||||
clientId: number;
|
||||
coinLotSize: number;
|
||||
pcLotSize: number;
|
||||
targetMint: string;
|
||||
};
|
||||
|
||||
export const CreateDecode = type({
|
||||
poolSeed: string(),
|
||||
side: Side,
|
||||
limitPrice: number(),
|
||||
ratioOfPoolAssetsToTrade: number(),
|
||||
orderType: OrderType,
|
||||
clientId: number(),
|
||||
coinLotSize: number(),
|
||||
pcLotSize: number(),
|
||||
targetMint: string(),
|
||||
});
|
||||
|
||||
export const decodeCreateOrder = (ix: TransactionInstruction): CreateOrder => {
|
||||
const decoded = create(
|
||||
decodeInstruction(ix.data, Instruction.CreateOrder),
|
||||
CreateDecode
|
||||
);
|
||||
|
||||
const createOrder: CreateOrder = {
|
||||
programId: ix.programId,
|
||||
signalProviderKey: ix.keys[0].pubkey,
|
||||
market: ix.keys[1].pubkey,
|
||||
payerPoolAssetKey: ix.keys[2].pubkey,
|
||||
openOrdersKey: ix.keys[3].pubkey,
|
||||
serumRequestQueue: ix.keys[5].pubkey,
|
||||
serumEventQueue: ix.keys[4].pubkey,
|
||||
serumMarketBids: ix.keys[6].pubkey,
|
||||
serumMarketAsks: ix.keys[7].pubkey,
|
||||
poolKey: ix.keys[8].pubkey,
|
||||
coinVaultKey: ix.keys[9].pubkey,
|
||||
pcVaultKey: ix.keys[10].pubkey,
|
||||
splTokenProgramId: ix.keys[11].pubkey,
|
||||
dexProgramKey: ix.keys[13].pubkey,
|
||||
rentProgramId: ix.keys[12].pubkey,
|
||||
srmReferrerKey: ix.keys[14]?.pubkey,
|
||||
// Miss maxQuantity
|
||||
//
|
||||
poolSeed: decoded.poolSeed,
|
||||
side: decoded.side,
|
||||
limitPrice: decoded.limitPrice,
|
||||
ratioOfPoolAssetsToTrade: decoded.ratioOfPoolAssetsToTrade,
|
||||
orderType: decoded.orderType,
|
||||
clientId: decoded.clientId,
|
||||
coinLotSize: decoded.coinLotSize,
|
||||
pcLotSize: decoded.pcLotSize,
|
||||
targetMint: decoded.targetMint,
|
||||
};
|
||||
|
||||
return createOrder;
|
||||
};
|
||||
|
||||
export type CancelOrder = {
|
||||
programId: PublicKey;
|
||||
signalProviderKey: PublicKey;
|
||||
market: PublicKey;
|
||||
openOrdersKey: PublicKey;
|
||||
serumEventQueue: PublicKey;
|
||||
serumMarketBids: PublicKey;
|
||||
serumMarketAsks: PublicKey;
|
||||
poolKey: PublicKey;
|
||||
dexProgramKey: PublicKey;
|
||||
poolSeed: string;
|
||||
side: Side;
|
||||
orderId: number;
|
||||
};
|
||||
|
||||
export const CancelOrderDecode = type({
|
||||
poolSeed: string(),
|
||||
side: Side,
|
||||
orderId: number(),
|
||||
});
|
||||
|
||||
export const decodeCancelOrder = (ix: TransactionInstruction): CancelOrder => {
|
||||
const decoded = create(
|
||||
decodeInstruction(ix.data, Instruction.CancelOrder),
|
||||
CancelOrderDecode
|
||||
);
|
||||
|
||||
const cancelOrder: CancelOrder = {
|
||||
programId: ix.programId,
|
||||
signalProviderKey: ix.keys[0].pubkey,
|
||||
market: ix.keys[1].pubkey,
|
||||
openOrdersKey: ix.keys[2].pubkey,
|
||||
serumEventQueue: ix.keys[3].pubkey,
|
||||
serumMarketBids: ix.keys[4].pubkey,
|
||||
serumMarketAsks: ix.keys[5].pubkey,
|
||||
poolKey: ix.keys[6].pubkey,
|
||||
dexProgramKey: ix.keys[7].pubkey,
|
||||
//
|
||||
poolSeed: decoded.poolSeed,
|
||||
side: decoded.side,
|
||||
orderId: decoded.orderId,
|
||||
};
|
||||
return cancelOrder;
|
||||
};
|
||||
|
||||
export type SettleFunds = {
|
||||
programId: PublicKey;
|
||||
market: PublicKey;
|
||||
openOrdersKey: PublicKey;
|
||||
poolKey: PublicKey;
|
||||
poolMintKey: PublicKey;
|
||||
coinVaultKey: PublicKey;
|
||||
pcVaultKey: PublicKey;
|
||||
coinPoolAssetKey: PublicKey;
|
||||
pcPoolAssetKey: PublicKey;
|
||||
vaultSignerKey: PublicKey;
|
||||
splTokenProgramId: PublicKey;
|
||||
dexProgramKey: PublicKey;
|
||||
srmReferrerKey: PublicKey | null;
|
||||
poolSeed: string;
|
||||
};
|
||||
|
||||
export const SettleFundsDecode = type({
|
||||
poolSeed: string(),
|
||||
pcIndex: number(),
|
||||
orderId: optional(number()),
|
||||
});
|
||||
|
||||
export const decodeSettleFunds = (ix: TransactionInstruction): SettleFunds => {
|
||||
const decoded = create(
|
||||
decodeInstruction(ix.data, Instruction.SettleFunds),
|
||||
SettleFundsDecode
|
||||
);
|
||||
|
||||
const settleFunds: SettleFunds = {
|
||||
programId: ix.programId,
|
||||
market: ix.keys[0].pubkey,
|
||||
openOrdersKey: ix.keys[1].pubkey,
|
||||
poolKey: ix.keys[2].pubkey,
|
||||
poolMintKey: ix.keys[3].pubkey,
|
||||
coinVaultKey: ix.keys[4].pubkey,
|
||||
pcVaultKey: ix.keys[5].pubkey,
|
||||
coinPoolAssetKey: ix.keys[6].pubkey,
|
||||
pcPoolAssetKey: ix.keys[7].pubkey,
|
||||
vaultSignerKey: ix.keys[8].pubkey,
|
||||
splTokenProgramId: ix.keys[9].pubkey,
|
||||
dexProgramKey: ix.keys[10].pubkey,
|
||||
srmReferrerKey: ix.keys[11]?.pubkey,
|
||||
poolSeed: decoded.poolSeed,
|
||||
};
|
||||
return settleFunds;
|
||||
};
|
||||
|
||||
export type Redeem = {
|
||||
splTokenProgramId: PublicKey;
|
||||
programId: PublicKey;
|
||||
mintKey: PublicKey;
|
||||
poolKey: PublicKey;
|
||||
sourcePoolTokenOwnerKey: PublicKey;
|
||||
sourcePoolTokenKey: PublicKey;
|
||||
poolSeed: string;
|
||||
poolTokenAmount: number;
|
||||
};
|
||||
|
||||
export const RedeemDecode = type({
|
||||
poolSeed: string(),
|
||||
poolTokenAmount: number(),
|
||||
});
|
||||
|
||||
export const decodeRedeem = (ix: TransactionInstruction): Redeem => {
|
||||
const decoded = create(
|
||||
decodeInstruction(ix.data, Instruction.Redeem),
|
||||
RedeemDecode
|
||||
);
|
||||
|
||||
const redeem: Redeem = {
|
||||
programId: ix.programId,
|
||||
splTokenProgramId: ix.keys[0].pubkey,
|
||||
mintKey: ix.keys[2].pubkey,
|
||||
poolKey: ix.keys[5].pubkey,
|
||||
sourcePoolTokenOwnerKey: ix.keys[3].pubkey,
|
||||
sourcePoolTokenKey: ix.keys[4].pubkey,
|
||||
poolSeed: decoded.poolSeed,
|
||||
poolTokenAmount: decoded.poolTokenAmount,
|
||||
};
|
||||
|
||||
return redeem;
|
||||
};
|
||||
|
||||
export type CollectFees = {
|
||||
splTokenProgramId: PublicKey;
|
||||
clockSysvarKey: PublicKey;
|
||||
programId: PublicKey;
|
||||
poolKey: PublicKey;
|
||||
mintKey: PublicKey;
|
||||
signalProviderPoolTokenKey: PublicKey;
|
||||
bonfidaFeePoolTokenKey: PublicKey;
|
||||
bonfidaBnBPTKey: PublicKey;
|
||||
poolSeed: string;
|
||||
};
|
||||
|
||||
export const CollectFeesDecode = type({
|
||||
poolSeed: string(),
|
||||
});
|
||||
|
||||
export const decodeCollectFees = (ix: TransactionInstruction): CollectFees => {
|
||||
const decoded = create(
|
||||
decodeInstruction(ix.data, Instruction.CollectFees),
|
||||
CollectFeesDecode
|
||||
);
|
||||
|
||||
const collectFees: CollectFees = {
|
||||
programId: ix.programId,
|
||||
splTokenProgramId: ix.keys[0].pubkey,
|
||||
clockSysvarKey: ix.keys[1].pubkey,
|
||||
poolKey: ix.keys[2].pubkey,
|
||||
mintKey: ix.keys[3].pubkey,
|
||||
signalProviderPoolTokenKey: ix.keys[4].pubkey,
|
||||
bonfidaFeePoolTokenKey: ix.keys[5].pubkey,
|
||||
bonfidaBnBPTKey: ix.keys[6].pubkey,
|
||||
poolSeed: decoded.poolSeed,
|
||||
};
|
||||
|
||||
return collectFees;
|
||||
};
|
||||
|
||||
export const isBonfidaBotInstruction = (
|
||||
instruction: TransactionInstruction
|
||||
) => {
|
||||
return instruction.programId.equals(BONFIDABOT_PROGRAM_ID);
|
||||
};
|
||||
|
||||
export const INSTRUCTION_LOOKUP: { [key: number]: string } = {
|
||||
0: "Initialize Bot",
|
||||
1: "Create Bot",
|
||||
2: "Deposit",
|
||||
3: "Create Order",
|
||||
4: "Cancel Order",
|
||||
5: "Settle Funds",
|
||||
6: "Redeem",
|
||||
7: "Collect Fees",
|
||||
};
|
||||
|
||||
export const parseBonfidaBotInstructionTitle = (
|
||||
instruction: TransactionInstruction
|
||||
): string => {
|
||||
const code = instruction.data[0];
|
||||
|
||||
if (!(code in INSTRUCTION_LOOKUP)) {
|
||||
throw new Error(`Unrecognized Bonfida Bot instruction code: ${code}`);
|
||||
}
|
||||
return INSTRUCTION_LOOKUP[code];
|
||||
};
|
|
@ -19,7 +19,6 @@ import { TokenLendingDetailsCard } from "components/instruction/TokenLendingDeta
|
|||
import { TokenSwapDetailsCard } from "components/instruction/TokenSwapDetailsCard";
|
||||
import { WormholeDetailsCard } from "components/instruction/WormholeDetailsCard";
|
||||
import { UnknownDetailsCard } from "components/instruction/UnknownDetailsCard";
|
||||
import { BonfidaBotDetailsCard } from "components/instruction/BonfidaBotDetails";
|
||||
import {
|
||||
INNER_INSTRUCTIONS_START_SLOT,
|
||||
SignatureProps,
|
||||
|
@ -29,7 +28,6 @@ import { isAddressLookupTableInstruction } from "components/instruction/address-
|
|||
import { isSerumInstruction } from "components/instruction/serum/types";
|
||||
import { isTokenLendingInstruction } from "components/instruction/token-lending/types";
|
||||
import { isTokenSwapInstruction } from "components/instruction/token-swap/types";
|
||||
import { isBonfidaBotInstruction } from "components/instruction/bonfida-bot/types";
|
||||
import { useFetchTransactionDetails } from "providers/transactions/parsed";
|
||||
import {
|
||||
useTransactionDetails,
|
||||
|
@ -228,8 +226,6 @@ function InstructionCard({
|
|||
|
||||
if (isAddressLookupTableInstruction(transactionIx)) {
|
||||
return <AddressLookupTableDetailsCard key={key} {...props} />;
|
||||
} else if (isBonfidaBotInstruction(transactionIx)) {
|
||||
return <BonfidaBotDetailsCard key={key} {...props} />;
|
||||
} else if (isMangoInstruction(transactionIx)) {
|
||||
return <MangoDetailsCard key={key} {...props} />;
|
||||
} else if (isSerumInstruction(transactionIx)) {
|
||||
|
|
|
@ -24,10 +24,6 @@ import {
|
|||
isSerumInstruction,
|
||||
parseSerumInstructionTitle,
|
||||
} from "components/instruction/serum/types";
|
||||
import {
|
||||
isBonfidaBotInstruction,
|
||||
parseBonfidaBotInstructionTitle,
|
||||
} from "components/instruction/bonfida-bot/types";
|
||||
import { TOKEN_PROGRAM_ID } from "providers/accounts/tokens";
|
||||
|
||||
export type InstructionType = {
|
||||
|
@ -110,16 +106,6 @@ export function getTokenInstructionName(
|
|||
} else {
|
||||
return undefined;
|
||||
}
|
||||
} else if (
|
||||
transactionInstruction &&
|
||||
isBonfidaBotInstruction(transactionInstruction)
|
||||
) {
|
||||
try {
|
||||
name = parseBonfidaBotInstructionTitle(transactionInstruction);
|
||||
} catch (error) {
|
||||
reportError(error, { signature: signatureInfo.signature });
|
||||
return undefined;
|
||||
}
|
||||
} else if (
|
||||
transactionInstruction &&
|
||||
isSerumInstruction(transactionInstruction)
|
||||
|
|
Loading…
Reference in New Issue